facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.76k stars 24.29k forks source link

Android: OnNewIntentListener callback is not called when the Activity's onNewIntent occurs #42305

Open lisa-bella97 opened 9 months ago

lisa-bella97 commented 9 months ago

Description

My Android React Native app uses a foreground dispatch system to handle NFC intents. I have implemented the Activity.onNewIntent callback to process the data from the scanned NFC tag. I also used OnNewIntentListener registration via the addOnNewIntentListener method. This listener should get a callback associated with Activity.onNewIntent with the new Intent, but it does not - when I attach an NFC tag, Activity.onNewIntent is called as expected, but the OnNewIntentListener callback is not called. Native Android application (without React Native Framework) works as expected in this case.

Steps to reproduce

  1. Install and run Android application with npm run android.
  2. Open LogCat window in Android studio and filter it by tag "MY_LOGS" (or run adb logcat | grep "MY_LOGS" in terminal).
  3. Attach NFC tag to your physical device (NFC adapter must be available on it).
  4. You will see the following logs in LogCat (Intent action can differ from below depending on the NFC tag):
    01-16 16:22:36.154 31792 31792 D MY_LOGS : MainActivity addOnNewIntentListener
    01-16 16:22:36.165 31792 31792 D MY_LOGS : MainActivity enableForegroundDispatch
    01-16 16:22:44.786 31792 31792 D MY_LOGS : MainActivity disableForegroundDispatch
    01-16 16:22:44.788 31792 31792 D MY_LOGS : MainActivity onNewIntent Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x30000000 cmp=com.reproducerapp/.MainActivity (has extras) }
    01-16 16:22:44.799 31792 31792 D MY_LOGS : MainActivity enableForegroundDispatch

    Expected logs (containing OnNewIntentListener callback - handleNfcIntent):

    01-16 15:29:53.569 30002 30002 D MY_LOGS : MainActivity addOnNewIntentListener
    01-16 15:29:53.594 30002 30002 D MY_LOGS : MainActivity enableForegroundDispatch
    01-16 15:29:57.932 30002 30002 D MY_LOGS : MainActivity disableForegroundDispatch
    01-16 15:29:57.935 30002 30002 D MY_LOGS : MainActivity handleNfcIntent Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x30000000 cmp=com.example.myapp/.MainActivity (has extras) }
    01-16 15:29:57.935 30002 30002 D MY_LOGS : MainActivity onNewIntent Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x30000000 cmp=com.example.myapp/.MainActivity (has extras) }
    01-16 15:29:57.939 30002 30002 D MY_LOGS : MainActivity enableForegroundDispatch

React Native Version

0.73.2

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Memory: 17.05 GB / 31.12 GB
  Shell:
    version: 5.1.16
    path: /bin/bash
Binaries:
  Node:
    version: 21.5.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.4
    path: /usr/local/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 11.0.21
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.2
    wanted: 0.73.2
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

Full LogCat output:

01-16 16:33:46.594 32688 32688 D MY_LOGS : MainActivity addOnNewIntentListener
01-16 16:33:46.603 32688 32688 D CompatibilityChangeReporter: Compat change id reported: 160794467; UID 10249; state: ENABLED
01-16 16:33:46.605 32688 32688 D MY_LOGS : MainActivity enableForegroundDispatch
01-16 16:33:46.610 32688 32688 D CompatibilityChangeReporter: Compat change id reported: 237531167; UID 10249; state: DISABLED
01-16 16:33:46.614 32688 32725 W Parcel  : Expecting binder but got null!
01-16 16:33:46.618  1909  2604 D CoreBackPreview: Window{14c1c21 u0 com.reproducerapp/com.reproducerapp.MainActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@3e17a07, mPriority=0}
01-16 16:33:46.626 32688 32688 W unknown:ReactNative: Packager connection already open, nooping.
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: QUALCOMM build                   : 4783c89, I46ff5fc46f
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Build Date                       : 11/30/20
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.31.04.01
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Local Branch                     : QPR2
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Remote Branch                    : 
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Remote Branch                    : 
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Reconstruct Branch               : 
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Build Config                     : S P 10.0.4 AArch64
01-16 16:33:46.636 32688 32725 I AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
01-16 16:33:46.640 32688 32725 I AdrenoGLES-0: PFP: 0x016dd093, ME: 0x00000000
01-16 16:33:46.641 32688 32725 W AdrenoUtils: <ReadGpuID_from_sysfs:197>: Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model
01-16 16:33:46.641 32688 32725 W AdrenoUtils: <ReadGpuID:221>: Failed to read chip ID from gpu_model. Fallback to use the GSL path
01-16 16:33:46.646   642  2872 I SDM     : HWCDisplay::GetColorModeCount: Supported color mode count = 3
01-16 16:33:46.646   642  2872 I SDM     : HWCDisplay::GetColorModes: Color mode = 0 is supported
01-16 16:33:46.646   642  2872 I SDM     : HWCDisplay::GetColorModes: Color mode = 7 is supported
01-16 16:33:46.646   642  2872 I SDM     : HWCDisplay::GetColorModes: Color mode = 9 is supported
01-16 16:33:46.647 32688 32725 E OpenGLRenderer: Unable to match the desired swap behavior.
01-16 16:33:46.650   588   588 I servicemanager: Could not find android.hardware.graphics.allocator.IAllocator/default in the VINTF manifest.
01-16 16:33:46.664  1909  2141 W ziparchive: Unable to open '/data/app/~~ZZpfxEeD8C_r_8DjAEya3Q==/com.reproducerapp-8umpAorIRc7I6mCyEz_l2g==/base.dm': No such file or directory
01-16 16:33:46.665  1909  2141 I ActivityTaskManager: Displayed com.reproducerapp/.MainActivity: +559ms
01-16 16:33:46.665 32688 32688 D CompatibilityChangeReporter: Compat change id reported: 210923482; UID 10249; state: ENABLED
01-16 16:33:46.672 32688 32725 W Parcel  : Expecting binder but got null!
01-16 16:33:46.678  1909  3471 D CoreBackPreview: Window{1175715 u0 PopupWindow:75b348c}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@61b701b, mPriority=0}
01-16 16:33:46.694 32688 32725 E OpenGLRenderer: Unable to match the desired swap behavior.
01-16 16:33:46.716  1909  2604 D CompatibilityChangeReporter: Compat change id reported: 214016041; UID 10249; state: ENABLED
01-16 16:33:46.722  3717  3717 I dwpx    : onStop
01-16 16:33:46.726  2826  3699 D OneSearchSuggestProvider: Shut down the binder channel
01-16 16:33:46.727  2826 20538 I s.nexuslauncher: oneway function results for code 2 on binder at 0xb400006ea35335b0 will be dropped but finished with status UNKNOWN_TRANSACTION
01-16 16:33:46.732  3170  3170 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3206 
01-16 16:33:46.736  3170  3170 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2147 repeatCheckTimes = 0, locked = false
01-16 16:33:46.736  3170  3170 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1894 onStartInput(EditorInfo{EditorInfo{packageName=com.reproducerapp, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=0, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=-1, fieldName=null, extras=null, hintText=null, hintLocales=[]}}, false)
01-16 16:33:46.736  3170  3170 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2147 repeatCheckTimes = 1, locked = false
01-16 16:33:46.860  1909  3476 D CoreBackPreview: Window{1175715 u0 PopupWindow:75b348c}: Setting back callback null
01-16 16:33:46.863  1909  3476 W InputManager-JNI: Input channel object '1175715 PopupWindow:75b348c (client)' was disposed without first being removed with the input manager!
01-16 16:33:46.891 32688 32688 W unknown:ReactNative: Packager connection already open, nooping.
01-16 16:33:46.908 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.traceupdateoverlay.TraceUpdateOverlayManager
01-16 16:33:46.915 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
01-16 16:33:46.920 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
01-16 16:33:46.922 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
01-16 16:33:46.926 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
01-16 16:33:46.929 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
01-16 16:33:46.931 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
01-16 16:33:46.933 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
01-16 16:33:46.937 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
01-16 16:33:46.939 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
01-16 16:33:46.940 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
01-16 16:33:46.942 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
01-16 16:33:46.943 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
01-16 16:33:46.945 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
01-16 16:33:46.948 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
01-16 16:33:46.950 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
01-16 16:33:46.951 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
01-16 16:33:46.951 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
01-16 16:33:46.952 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
01-16 16:33:46.957 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
01-16 16:33:46.960 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
01-16 16:33:46.963 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
01-16 16:33:46.965 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
01-16 16:33:46.969 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
01-16 16:33:46.969 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
01-16 16:33:46.971 32688 32740 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
01-16 16:33:47.010 32688 32740 I flipper : flipper: FlipperClient::addPlugin Fresco
01-16 16:33:47.037  1909  3806 W InputManager-JNI: Input channel object 'e3f520d Splash Screen com.reproducerapp (client)' was disposed without first being removed with the input manager!
01-16 16:33:47.041  1909  3476 D CoreBackPreview: Window{e3f520d u0 Splash Screen com.reproducerapp EXITING}: Setting back callback null
01-16 16:33:47.126  2870  3824 I FontLog : (REDACTED) Received query %s, URI %s
01-16 16:33:47.127  2870  3824 I FontLog : (REDACTED) Query [%s] resolved to %s
01-16 16:33:47.130  2870  3824 I FontLog : (REDACTED) Fetch %s end status %s
01-16 16:33:47.139  2870  3824 I FontLog : (REDACTED) Pulling font file for id = %d, cache size = %d
01-16 16:33:47.144  2870  3824 I FontLog : (REDACTED) Pulling font file for id = %d, cache size = %d
01-16 16:33:47.152 32688 32740 W ziparchive: Unable to open '/data/app/~~ghqPTuy_baC51j3_xtw9KA==/com.google.android.trichromelibrary_609919433-RP3SA7hawD1b8hLsyzXcHA==/base.dm': No such file or directory
01-16 16:33:47.152 32688 32740 W ziparchive: Unable to open '/data/app/~~ghqPTuy_baC51j3_xtw9KA==/com.google.android.trichromelibrary_609919433-RP3SA7hawD1b8hLsyzXcHA==/base.dm': No such file or directory
01-16 16:33:47.152 32688 32740 W m.reproducerapp: Entry not found
01-16 16:33:47.158 32688 32740 D nativeloader: Configuring clns-5 for other apk /data/app/~~ghqPTuy_baC51j3_xtw9KA==/com.google.android.trichromelibrary_609919433-RP3SA7hawD1b8hLsyzXcHA==/base.apk. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~WAPW2aweFax9erzIrLZ2gA==/com.google.android.webview-4KH0Tdk1Zd8YSzhpfc7CTg==/lib/arm64:/data/app/~~WAPW2aweFax9erzIrLZ2gA==/com.google.android.webview-4KH0Tdk1Zd8YSzhpfc7CTg==/base.apk!/lib/arm64-v8a:/data/app/~~ghqPTuy_baC51j3_xtw9KA==/com.google.android.trichromelibrary_609919433-RP3SA7hawD1b8hLsyzXcHA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
01-16 16:33:47.168 32688 32740 D nativeloader: Configuring clns-6 for other apk /data/app/~~WAPW2aweFax9erzIrLZ2gA==/com.google.android.webview-4KH0Tdk1Zd8YSzhpfc7CTg==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~WAPW2aweFax9erzIrLZ2gA==/com.google.android.webview-4KH0Tdk1Zd8YSzhpfc7CTg==/lib/arm64:/data/app/~~WAPW2aweFax9erzIrLZ2gA==/com.google.android.webview-4KH0Tdk1Zd8YSzhpfc7CTg==/base.apk!/lib/arm64-v8a:/data/app/~~ghqPTuy_baC51j3_xtw9KA==/com.google.android.trichromelibrary_609919433-RP3SA7hawD1b8hLsyzXcHA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
01-16 16:33:47.191 32688 32740 I WebViewFactory: Loading com.google.android.webview version 120.0.6099.194 (code 609919433)
01-16 16:33:47.220 32688 32740 I cr_WVCFactoryProvider: Loaded version=120.0.6099.194 minSdkVersion=29 isBundle=true multiprocess=true packageId=2
01-16 16:33:47.243 32688 32748 E chromium: [0116/163347.243189:ERROR:variations_seed_loader.cc(69)] Failed to open file for reading. Errno: 2
01-16 16:33:47.260 32688 32740 I cr_LibraryLoader: Successfully loaded native library
01-16 16:33:47.263 32688 32740 I cr_CachingUmaRecorder: Flushed 7 samples from 7 histograms, 0 samples were dropped.
01-16 16:33:47.289 32688 32751 D TrafficStats: tagSocket(132) with statsTag=0xffffffff, statsUid=-1
01-16 16:33:47.313 32688 32739 I ReactNativeJS: Running "ReproducerApp" with {"rootTag":11}
01-16 16:33:47.331 32688 32752 D TrafficStats: tagSocket(132) with statsTag=0xffffffff, statsUid=-1
01-16 16:33:47.359  3717  3732 W earchbox:search: Reducing the number of considered missed Gc histogram windows from 275 to 100
01-16 16:33:47.868 32688 32688 D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10249; state: ENABLED
01-16 16:33:47.869 32688 32688 W m.reproducerapp: Accessing hidden field Landroid/widget/ScrollView;->mScroller:Landroid/widget/OverScroller; (unsupported, reflection, allowed)
01-16 16:33:48.493  2633  4568 D QCNEJ/WlanStaInfoRelay: Received action: android.net.wifi.RSSI_CHANGED
01-16 16:33:48.499  3001  3292 D DeviceStateHelper: Wifi freq: 5220
01-16 16:33:48.507  1909  2349 D ConnectivityService: NetReassign [no changes] [c 0] [a 1] [i 1]
01-16 16:33:48.510  3223  8547 I com.google.android.ims.: [55] emu.handleMessage:1 [55] : RcsEngineImpl[DUAL_REG]:[8148b7dd-36ee]>Handler: handleMessage processing message:[NOTIFY_UPTIME_IGNORE_STATE_CHANGED] with [non-null]:RcsEngineImpl reference
01-16 16:33:48.511  2732  3244 E PhoneInterfaceManager: [PhoneIntfMgr] getCarrierPrivilegeStatusForUid: Invalid subId
01-16 16:33:48.512  3223  8547 I com.google.android.ims.: [55] elr.b:11 [55] : ProvisioningEngineDataRetriever: RCS Configuration storage in Bugle is disabled by p/h flag, using ProvisioningEngineStateCacheUtil.getProvisioningConfigurationForGivenSimIfExist()
01-16 16:33:48.512  3223  8548 I com.google.android.ims.: [56] edc.c:5 [56] : Connected state: [1], networkType: [WIFI]
01-16 16:33:48.547 32688 32758 D TrafficStats: tagSocket(104) with statsTag=0x90000, statsUid=-1
01-16 16:33:49.424  1001  1178 D VSC     : @ 20474.684: [Significant Motion] Stop motion_detect
01-16 16:33:49.424  1001  1178 D VSC     : @ 20474.684: [Significant Motion] Request accel, interval 20.0 ms, latency 3200.0 ms
01-16 16:33:49.424  1001  1178 D CHRE    : @ 20474.684: InstantMotion
01-16 16:33:49.428  1001  1178 D ASH     : @ 20474.688: SensorType 195 resampler quality 0
01-16 16:33:49.451  1001  1178 D CHRE    : @ 20474.711: MagGyroCal(0)=ON
01-16 16:33:49.511  1001  1178 D ASH     : @ 20474.772: SensorType 195 resampler quality 1
01-16 16:33:49.511  1001  1178 D ASH     : @ 20474.772: SensorType 195 resampler quality 1
01-16 16:33:50.557 32688 32760 D TrafficStats: tagSocket(104) with statsTag=0x90000, statsUid=-1
01-16 16:33:51.189  3451  3451 D NativeNfcTag: Connect to a tech with a different handle
01-16 16:33:51.209  3451  4296 E libnfc_nci: [ERROR:rw_mfc.cc(528)] RW_MfcDetectNDef
01-16 16:33:51.209  3451  4296 E libnfc_nci: [ERROR:rw_mfc.cc(889)] rw_mfc_readBlock: RW_MFC_SUBSTATE_WAIT_ACK
01-16 16:33:51.296  3451  3451 D NativeNfcTag: Check NDEF Failed - status = 3
01-16 16:33:51.306  3451  4296 E libnfc_nci: [ERROR:rw_mfc.cc(528)] RW_MfcDetectNDef
01-16 16:33:51.306  3451  4296 E libnfc_nci: [ERROR:rw_mfc.cc(889)] rw_mfc_readBlock: RW_MFC_SUBSTATE_WAIT_ACK
01-16 16:33:51.393  3451  3451 D NativeNfcTag: Check NDEF Failed - status = 3
01-16 16:33:51.405  3451 32762 D NativeNfcTag: Starting background presence check
01-16 16:33:51.409  1909  3673 I ActivityTaskManager: START u0 {act=android.nfc.action.TAG_DISCOVERED flg=0x20000000 cmp=com.reproducerapp/.MainActivity (has extras)} from uid 10249
01-16 16:33:51.410  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 265464455; UID 10249; state: DISABLED
01-16 16:33:51.411  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 265452344; UID 10249; state: DISABLED
01-16 16:33:51.411  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 266124927; UID 10249; state: DISABLED
01-16 16:33:51.411  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 265451093; UID 10249; state: DISABLED
01-16 16:33:51.412  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 265456536; UID 10249; state: DISABLED
01-16 16:33:51.412  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 255940284; UID 10249; state: DISABLED
01-16 16:33:51.412  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 236283604; UID 10249; state: DISABLED
01-16 16:33:51.413  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 263959004; UID 10249; state: DISABLED
01-16 16:33:51.414  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 264304459; UID 10249; state: DISABLED
01-16 16:33:51.414  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 264301586; UID 10249; state: DISABLED
01-16 16:33:51.414  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 254631730; UID 10249; state: DISABLED
01-16 16:33:51.415  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 273509367; UID 10249; state: DISABLED
01-16 16:33:51.415  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 263259275; UID 10249; state: DISABLED
01-16 16:33:51.416  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 194480991; UID 10249; state: ENABLED
01-16 16:33:51.417  1909  3673 W ActivityTaskManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x20000000 cmp=com.reproducerapp/.MainActivity (has extras) }
01-16 16:33:51.417  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 174042980; UID 10249; state: DISABLED
01-16 16:33:51.422  1909  3673 D CompatibilityChangeReporter: Compat change id reported: 194833441; UID 10249; state: ENABLED
01-16 16:33:51.424  1001  1001 I sensors-hal: [hal]batch_physical_sensor:314, android.sensor.accelerometer/11, period=200000000, max_latency=2000000000
01-16 16:33:51.424  1001  1001 I sensors-hal: [sensor]set_config:64, sample_period_ns is adjusted to 200000000 based on min/max delay_ns
01-16 16:33:51.425  1001  1001 I sensors-hal: [hal]batch_physical_sensor:323, android.sensor.accelerometer/11, period=200000000, max_latency=2000000000 request completed
01-16 16:33:51.425  1001 30831 I sensors-hal: [ssc_sensor]ssc_conn_resp_cb:686, resp_value = 0
01-16 16:33:51.429   982  9874 D audio_hw_primary: start_output_stream: enter: stream(0xecf84330)usecase(1: low-latency-playback)  devices(0x2) is_haptic_usecase(0)
01-16 16:33:51.429   982  9874 D audio_hw_primary: select_devices for use case (low-latency-playback)
01-16 16:33:51.429   982  9874 I msm8974_platform: platform_check_and_set_codec_backend_cfg:becf: afe: bitwidth 24, samplerate 48000 channels 2, backend_idx 0 usecase = 1 device (speaker)
01-16 16:33:51.429   982  9874 I msm8974_platform: platform_check_and_set_codec_backend_cfg: new_snd_devices[0] is 2
01-16 16:33:51.429   982  9874 I msm8974_platform: platform_check_codec_backend_cfg:becf: afe: bitwidth 24, samplerate 48000 channels 2, backend_idx 0 usecase = 1 device (speaker)
01-16 16:33:51.429 32688 32688 D MY_LOGS : MainActivity disableForegroundDispatch
01-16 16:33:51.430 32688 32688 D MY_LOGS : MainActivity onNewIntent Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x30000000 cmp=com.reproducerapp/.MainActivity (has extras) }
01-16 16:33:51.431   982  9874 D msm8974_platform: platform_check_codec_backend_cfg:becf: updated afe: bitwidth 24, samplerate 48000 channels 2,backend_idx 0 usecase = 1 device (speaker)
01-16 16:33:51.431   982  9874 I msm8974_platform: platform_check_codec_backend_cfg:becf: afe: Codec selected backend: 0 updated bit width: 24 and sample rate: 48000
01-16 16:33:51.431   982  9874 I msm8974_platform: platform_check_codec_backend_cfg:becf: afe: Codec backend needs to be updated. new bit width: 24new sample rate: 48000 new channels: 2
01-16 16:33:51.431   982  9874 I msm8974_platform: platform_set_codec_backend_cfg:becf: afe: bitwidth 24, samplerate 48000 channels 2 format 1, backend_idx 0 device (speaker)
01-16 16:33:51.431   982  9874 E msm8974_platform: platform_set_codec_backend_cfg:becf: afe: Could not get ctl for mixer command - SLIM_0_RX Format
01-16 16:33:51.431   982  9874 D audio_hw_primary: check_usecases_codec_backend:becf: force routing 0
01-16 16:33:51.431   982  9874 D audio_hw_primary: check_usecases_codec_backend:becf: (78) check_usecases curr device: speaker, usecase device: backends match 0
01-16 16:33:51.431   982  9874 D audio_hw_primary: check_usecases_codec_backend:becf: check_usecases num.of Usecases to switch 0
01-16 16:33:51.431   982  9874 D hardware_info: hw_info_append_hw_type : device_name = speaker
01-16 16:33:51.431   982  9874 D audio_route: Apply path: speaker
01-16 16:33:51.434  1001  1178 I VSC     : @ 20476.695: {Fusion} configure fusion 9 5000us 0us.
01-16 16:33:51.434  1001  1178 D VSC     : @ 20476.695: [Gravity Sensor] Request accel, interval 5.0 ms, latency 0.0 ms
01-16 16:33:51.434   982  9874 I TI-SmartPA-hal: using previously read calibration values
01-16 16:33:51.434  1001  1178 D VSC     : @ 20476.695: [Gravity Sensor] Request gyro, interval 5.0 ms, latency 0.0 ms
01-16 16:33:51.435  1001  1001 I sensors-hal: [hal]batch_physical_sensor:314, android.sensor.accelerometer/11, period=66667000, max_latency=0
01-16 16:33:51.435  1001  1001 I sensors-hal: [sensor]set_config:64, sample_period_ns is adjusted to 66667000 based on min/max delay_ns
01-16 16:33:51.435  1001  1001 I sensors-hal: [hal]batch_physical_sensor:323, android.sensor.accelerometer/11, period=66667000, max_latency=0 request completed
01-16 16:33:51.436  1001  1001 I sensors-hal: [hal]flush_physical_sensor:355, android.sensor.accelerometer/11
01-16 16:33:51.436  1001  1001 I sensors-hal: [hal]flush_physical_sensor:361, android.sensor.accelerometer/11 completed
01-16 16:33:51.437   982  9874 V TI-SmartPA-hal: TAS25XX_SET_RE_LEFT:  3343332
01-16 16:33:51.438  1001 30831 I sensors-hal: [ssc_sensor]ssc_conn_resp_cb:686, resp_value = 0
01-16 16:33:51.438  1001 30831 I sensors-hal: [ssc_sensor]ssc_conn_resp_cb:686, resp_value = 0
01-16 16:33:51.438  1001  1178 D ASH     : @ 20476.697: SensorType 1 resampler quality 0
01-16 16:33:51.438   982  9874 V TI-SmartPA-hal: TAS25XX_SET_RE_RIGHT:  3793282
01-16 16:33:51.439   982  9874 V TI-SmartPA-hal: TAS25XX_SET_T_CALIB:  25
01-16 16:33:51.442 32688 32688 D MY_LOGS : MainActivity enableForegroundDispatch

Reproducer

https://github.com/lisa-bella97/reproducer-react-native

Screenshots and Videos

No response

EnricoMazzu commented 4 weeks ago

Hi @lisa-bella97, @cortinico .

the listeners chain is invoked in ComponentActivity Layer,

    @CallSuper
    @Override
    protected void onNewIntent(
            @SuppressLint({"UnknownNullness", "MissingNullability"}) Intent intent
    ) {
        super.onNewIntent(intent);
        for (Consumer<Intent> listener : mOnNewIntentListeners) {
            listener.accept(intent);
        }
    }

React Native ReactActivity not always call super.OnNewIntent(..)


    public void onNewIntent(Intent intent) {
        if (!this.mDelegate.onNewIntent(intent)) {
            super.onNewIntent(intent);
        }

    }

And the delegate condition is:

    public boolean onNewIntent(Intent intent) {
        if (!ReactFeatureFlags.enableBridgelessArchitecture && this.getReactNativeHost().hasInstance()) {
            this.getReactNativeHost().getReactInstanceManager().onNewIntent(intent);
            return true;
        } else {
            return false;
        }
    }

Maybe you can evaluate the usage of an ActivityEventListener (part of React Native framework) in a native module to handle your onNewIntent case