Let react_native_assert really abort the app

Summary:
Fixed a bug in `react_native_assert` that was not effectively letting the app
call `abort()`. The app was actually printing on log twice.
Ref: https://developer.android.com/ndk/reference/group/logging#__android_log_assert

Changelog:
[Android] [Changed] - Let react_native_assert really abort the app

Reviewed By: JoshuaGross

Differential Revision: D32204080

fbshipit-source-id: ca16c50aaf4e41a2318277c233be0e944b2ad8f1
This commit is contained in:
Nicola Corti
2021-11-11 08:57:59 -08:00
committed by Facebook GitHub Bot
parent 181464903c
commit 2ae06df58f
@@ -22,7 +22,7 @@ extern "C" void react_native_assert_fail(
const char *file,
int line,
const char *expr) {
// Print as an error so it shows up in logcat before crash....
// Print as an error so it shows up in logcat before crash...
__android_log_print(
ANDROID_LOG_ERROR,
"ReactNative",
@@ -31,9 +31,9 @@ extern "C" void react_native_assert_fail(
line,
func,
expr);
// Print as a fatal so it crashes and shows up in uploaded logs
__android_log_print(
ANDROID_LOG_FATAL,
// ...and trigger an abort so it crashes and shows up in uploaded logs.
__android_log_assert(
nullptr,
"ReactNative",
"%s:%d: function %s: assertion failed (%s)",
file,