Open shaneinlogik opened 1 week ago
For anyone else experiencing this bug, I was able to workaround it by updating onConfigurationChanged
in NavigationActivity.java like so:
@Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); runOnUiThread(() -> { getReactGateway().onConfigurationChanged(this, newConfig); navigator.onConfigurationChanged(newConfig); }); }
What happened?
When running on a Samsung Galaxy with the latest Android software update, the app crashes when calling setRoot from registerAppLaunchedListener
Logcat out:
com.facebook.react.bridge.AssertionException: Expected to run on UI thread! at com.facebook.react.bridge.SoftAssertions.assertCondition(SoftAssertions.java:37) at com.facebook.react.bridge.UiThreadUtil.assertOnUiThread(UiThreadUtil.java:44) at com.facebook.react.ReactInstanceManager.onConfigurationChanged(ReactInstanceManager.java:840) at com.reactnativenavigation.react.ReactGateway.onConfigurationChanged(ReactGateway.java:47) at com.reactnativenavigation.NavigationActivity.onConfigurationChanged(NavigationActivity.java:59) at androidx.appcompat.app.AppCompatDelegateImpl.updateActivityConfiguration(AppCompatDelegateImpl.java:2925) at androidx.appcompat.app.AppCompatDelegateImpl.updateResourcesConfiguration(AppCompatDelegateImpl.java:2914) at androidx.appcompat.app.AppCompatDelegateImpl.updateAppConfiguration(AppCompatDelegateImpl.java:2843) at androidx.appcompat.app.AppCompatDelegateImpl.applyApplicationSpecificConfig(AppCompatDelegateImpl.java:2561) at androidx.appcompat.app.AppCompatDelegateImpl.applyApplicationSpecificConfig(AppCompatDelegateImpl.java:2522) at androidx.appcompat.app.AppCompatDelegateImpl.applyDayNight(AppCompatDelegateImpl.java:2501) at androidx.appcompat.app.AppCompatDelegate.applyDayNightToActiveDelegates(AppCompatDelegate.java:1028) at androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.java:652) at com.facebook.react.modules.appearance.AppearanceModule.setColorScheme(AppearanceModule.java:74) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146) at com.facebook.jni.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233) at java.lang.Thread.run(Thread.java:1012)
This was also in logcat:
11-07 12:02:17.170 24657 24657 E unknown:ReactNative: Tried to remove non-existent frame callback 11-07 12:02:17.183 1116 1116 E audit : type=1400 audit(1730944937.181:356594): avc: denied { ioctl } for pid=6748 comm="c.android.sdhms" path="/data/user/0/com.sec.android.sdhms/databases/sec_batterystats_ext" dev="dm-53" ino=12935 ioctlcmd=0xf522 scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=file permissive=0 SEPF_SM-A536E_12_0001 audit_filtered 11-07 12:02:17.209 1116 1116 E audit : type=1400 audit(1730944937.205:356595): avc: denied { ioctl } for pid=6748 comm="c.android.sdhms" path="/data/user/0/com.sec.android.sdhms/databases/sec_batterystats_ext" dev="dm-53" ino=12935 ioctlcmd=0xf522 scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=file permissive=0 SEPF_SM-A536E_12_0001 audit_filtered 11-07 12:02:17.214 1116 1116 E audit : type=1400 audit(1730944937.209:356596): avc: denied { ioctl } for pid=6748 comm="c.android.sdhms" path="/data/user/0/com.sec.android.sdhms/databases/sec_batterystats_ext" dev="dm-53" ino=12935 ioctlcmd=0xf522 scontext=u:r:system_app:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=file permissive=0 SEPF_SM-A536E_12_0001 audit_filtered 11-07 12:02:17.302 1550 1727 E WindowManager: win=Window{4d29c30 u0 InputMethod} destroySurfaces: appStopped=true cleanupOnResume=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8 caller=com.android.server.wm.WindowManagerService.tryStartExitingAnimation:2980 com.android.server.wm.WindowManagerService.relayoutWindow:2685 com.android.server.wm.Session.relayout:282 android.view.IWindowSession$Stub.onTransact:782 com.android.server.wm.Session.onTransact:204 android.os.Binder.execTransactInternal:1375 android.os.Binder.execTransact:1311
What was the expected behaviour?
App does not crash
Was it tested on latest react-native-navigation?
Help us reproduce this issue!
I am unable to produce a min repo as I do not own a Galaxy. The issue only seems to trigger when the app is consuming high amount of power. the problem is not present when react-native-navigation is removed and NavigationApplication is changed back to ReactApplication etc
In what environment did this happen?
React Native Navigation version: 7.40.0 React Native version: 0.74.5 Has Fabric (React Native's new rendering system) enabled: no Node version: 18.20.4 Device model: Galaxy S24 Android version: 14