zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.1k stars 836 forks source link

[Android] One-time permissions cause a crash of the application after a delay #711

Closed vasylnahuliak closed 1 year ago

vasylnahuliak commented 2 years ago

Bug summary

react-native-permissions on Android does not handle One-Time Permissions after exiting (background or lock phone) from the application for more than ~1 minute.

Video example

Logcat
2022-09-01 10:21:50.183 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=430.75ms min=1.72ms max=6784.09ms count=16
2022-09-01 10:21:50.668 6910-6997/com.reactnativeandroidonetimepermission W/unknown:ReactContext: initializeMessageQueueThreads() is called.
2022-09-01 10:21:50.672 6910-6910/com.reactnativeandroidonetimepermission W/unknown:ReactNative: Packager connection already open, nooping.
2022-09-01 10:21:50.693 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
2022-09-01 10:21:50.701 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
2022-09-01 10:21:50.705 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
2022-09-01 10:21:50.708 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2022-09-01 10:21:50.709 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2022-09-01 10:21:50.711 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
2022-09-01 10:21:50.713 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2022-09-01 10:21:50.716 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
2022-09-01 10:21:50.719 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
2022-09-01 10:21:50.720 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2022-09-01 10:21:50.721 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
2022-09-01 10:21:50.722 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2022-09-01 10:21:50.724 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2022-09-01 10:21:50.724 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
2022-09-01 10:21:50.726 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2022-09-01 10:21:50.727 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2022-09-01 10:21:50.728 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
2022-09-01 10:21:50.729 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2022-09-01 10:21:50.729 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
2022-09-01 10:21:50.730 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2022-09-01 10:21:50.733 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
2022-09-01 10:21:50.735 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2022-09-01 10:21:50.736 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
2022-09-01 10:21:50.737 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2022-09-01 10:21:50.739 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2022-09-01 10:21:50.739 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
2022-09-01 10:21:50.741 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
2022-09-01 10:21:50.746 6910-6999/com.reactnativeandroidonetimepermission W/unknown:ReactContext: initializeMessageQueueThreads() is called.
2022-09-01 10:21:50.747 6910-6999/com.reactnativeandroidonetimepermission D/SoLoader: libyoga.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:21:50.748 6910-6999/com.reactnativeandroidonetimepermission D/SoLoader: libyoga.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:21:50.748 6910-6999/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libyoga.so
2022-09-01 10:21:50.774 6910-6999/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Fresco
2022-09-01 10:21:50.923 6910-6998/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativeblob.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:21:50.923 6910-6998/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativeblob.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:21:50.923 6910-6998/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libreactnativeblob.so
2022-09-01 10:21:50.948 6910-6999/com.reactnativeandroidonetimepermission I/WebViewFactory: Loading com.google.android.webview version 91.0.4472.114 (code 447211487)
2022-09-01 10:21:51.059 6910-6999/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed)
2022-09-01 10:21:51.059 6910-6999/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed)
2022-09-01 10:21:51.060 6910-6999/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed)
2022-09-01 10:21:51.060 6910-6999/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2022-09-01 10:21:51.060 6910-6999/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2022-09-01 10:21:51.071 6910-7009/com.reactnativeandroidonetimepermission I/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.reactnativeandroidonetimepermission/app_webview/variations_seed_new"
2022-09-01 10:21:51.071 6910-7009/com.reactnativeandroidonetimepermission I/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.reactnativeandroidonetimepermission/app_webview/variations_seed"
2022-09-01 10:21:51.071 6910-7009/com.reactnativeandroidonetimepermission I/cr_VariationsUtils: Requesting new seed from IVariationsSeedServer

    --------- beginning of system
2022-09-01 10:21:51.077 6910-6999/com.reactnativeandroidonetimepermission I/cr_LibraryLoader: Loaded native library version number "91.0.4472.114"
2022-09-01 10:21:51.078 6910-6999/com.reactnativeandroidonetimepermission I/cr_CachingUmaRecorder: Flushed 5 samples from 5 histograms.
2022-09-01 10:21:51.158 6910-6998/com.reactnativeandroidonetimepermission I/ReactNativeJS: Running "reactNativeAndroidOneTimePermission" with {"rootTag":1}
2022-09-01 10:22:24.019 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=5317.46ms min=2.16ms max=32580.39ms count=8
2022-09-01 10:22:25.424 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=23.92ms min=2.76ms max=516.08ms count=40
2022-09-01 10:22:28.308 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=53.07ms min=3.10ms max=2022.49ms count=50
2022-09-01 10:22:29.875 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=153.01ms min=1.76ms max=1373.66ms count=10
2022-09-01 10:22:29.922 6910-6954/com.reactnativeandroidonetimepermission D/OpenGLRenderer: endAllActiveAnimators on 0x76018d483670 (RippleDrawable) with handle 0x76009d493400
2022-09-01 10:22:29.984 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=234.86ms min=2.96ms max=1534.22ms count=7
2022-09-01 10:22:32.316 6910-6954/com.reactnativeandroidonetimepermission D/EGL_emulation: app_time_stats: avg=322.17ms min=1.76ms max=2211.42ms count=7
2022-09-01 10:22:32.813 6910-6998/com.reactnativeandroidonetimepermission I/ReactNativeJNI: Memory warning (pressure level: TRIM_MEMORY_UI_HIDDEN) received by JS VM, ignoring because it's non-severe
2022-09-01 10:24:03.640 7183-7183/? I/etimepermissio: Late-enabling -Xcheck:jni
2022-09-01 10:24:03.707 7183-7183/? W/etimepermissio: Unexpected CPU variant for X86 using defaults: x86_64
2022-09-01 10:24:03.786 7183-7183/com.reactnativeandroidonetimepermission D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10146; state: ENABLED
2022-09-01 10:24:04.121 7183-7183/com.reactnativeandroidonetimepermission V/GraphicsEnvironment: ANGLE Developer option for 'com.reactnativeandroidonetimepermission' set to: 'default'
2022-09-01 10:24:04.121 7183-7183/com.reactnativeandroidonetimepermission V/GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
2022-09-01 10:24:04.123 7183-7183/com.reactnativeandroidonetimepermission D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2022-09-01 10:24:04.125 7183-7183/com.reactnativeandroidonetimepermission D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2022-09-01 10:24:04.176 7183-7183/com.reactnativeandroidonetimepermission V/fb-UnpackingSoSource: locked dso store /data/user/0/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.206 7183-7183/com.reactnativeandroidonetimepermission I/fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.206 7183-7183/com.reactnativeandroidonetimepermission V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.227 7183-7183/com.reactnativeandroidonetimepermission D/SoLoader: libjscexecutor.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.227 7183-7183/com.reactnativeandroidonetimepermission D/SoLoader: libjscexecutor.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:04.227 7183-7183/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libjscexecutor.so
2022-09-01 10:24:04.246 7183-7183/com.reactnativeandroidonetimepermission D/JavaScriptCore.Version: 250230.2.1
2022-09-01 10:24:04.424 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: libfbjni.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.425 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: libfbjni.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:04.425 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libfbjni.so
2022-09-01 10:24:04.440 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: libflipper.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:04.444 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: libflipper.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:04.446 7183-7210/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libflipper.so
2022-09-01 10:24:04.547 7183-7183/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden field Landroid/view/View;->mKeyedTags:Landroid/util/SparseArray; (unsupported, reflection, allowed)
2022-09-01 10:24:04.547 7183-7183/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden field Landroid/view/View;->mListenerInfo:Landroid/view/View$ListenerInfo; (unsupported, reflection, allowed)
2022-09-01 10:24:04.548 7183-7183/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden field Landroid/view/View$ListenerInfo;->mOnClickListener:Landroid/view/View$OnClickListener; (unsupported, reflection, allowed)
2022-09-01 10:24:04.559 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Inspector
2022-09-01 10:24:04.559 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin React
2022-09-01 10:24:04.566 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Databases
2022-09-01 10:24:04.570 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Preferences
2022-09-01 10:24:04.573 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin CrashReporter
2022-09-01 10:24:04.579 7183-7183/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Network
2022-09-01 10:24:04.628 7183-7210/com.reactnativeandroidonetimepermission W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-09-01 10:24:04.628 7183-7210/com.reactnativeandroidonetimepermission W/System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-09-01 10:24:04.630 7183-7210/com.reactnativeandroidonetimepermission W/System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-09-01 10:24:04.636 7183-7231/com.reactnativeandroidonetimepermission D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so
2022-09-01 10:24:04.651 7183-7231/com.reactnativeandroidonetimepermission D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
2022-09-01 10:24:04.660 7183-7231/com.reactnativeandroidonetimepermission D/libEGL: loaded /vendor/lib64/egl/libGLESv2_emulation.so
2022-09-01 10:24:04.848 7183-7183/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2022-09-01 10:24:04.849 7183-7183/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2022-09-01 10:24:04.891 7183-7183/com.reactnativeandroidonetimepermission W/unknown:ReactNative: Packager connection already open, nooping.
2022-09-01 10:24:04.911 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: createUnique: call
2022-09-01 10:24:04.912 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: HostConnection::get() New Host Connection established 0x76010d44d0d0, tid 7229
2022-09-01 10:24:04.977 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
2022-09-01 10:24:04.989 7183-7229/com.reactnativeandroidonetimepermission W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2022-09-01 10:24:04.990 7183-7229/com.reactnativeandroidonetimepermission W/OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS
2022-09-01 10:24:04.993 7183-7229/com.reactnativeandroidonetimepermission D/EGL_emulation: eglCreateContext: 0x76010d450550: maj 3 min 0 rcv 3
2022-09-01 10:24:04.998 7183-7229/com.reactnativeandroidonetimepermission D/EGL_emulation: eglMakeCurrent: 0x76010d450550: ver 3 0 (tinfo 0x76032affb080) (first time)
2022-09-01 10:24:05.028 7183-7229/com.reactnativeandroidonetimepermission I/Gralloc4: mapper 4.x is not supported
2022-09-01 10:24:05.031 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: createUnique: call
2022-09-01 10:24:05.033 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: HostConnection::get() New Host Connection established 0x76010d44ebd0, tid 7229
2022-09-01 10:24:05.034 7183-7229/com.reactnativeandroidonetimepermission D/goldfish-address-space: allocate: Ask for block of size 0x100
2022-09-01 10:24:05.035 7183-7229/com.reactnativeandroidonetimepermission D/goldfish-address-space: allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000
2022-09-01 10:24:05.037 7183-7229/com.reactnativeandroidonetimepermission W/Gralloc4: allocator 4.x is not supported
2022-09-01 10:24:05.072 7183-7229/com.reactnativeandroidonetimepermission D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
2022-09-01 10:24:05.488 7183-7239/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativejni.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:05.489 7183-7239/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativejni.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:05.489 7183-7239/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libreactnativejni.so
2022-09-01 10:24:05.594 7183-7239/com.reactnativeandroidonetimepermission W/unknown:ReactContext: initializeMessageQueueThreads() is called.
2022-09-01 10:24:05.600 7183-7183/com.reactnativeandroidonetimepermission W/unknown:ReactNative: Packager connection already open, nooping.
2022-09-01 10:24:05.640 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
2022-09-01 10:24:05.658 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
2022-09-01 10:24:05.664 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
2022-09-01 10:24:05.673 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2022-09-01 10:24:05.676 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2022-09-01 10:24:05.677 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
2022-09-01 10:24:05.679 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2022-09-01 10:24:05.684 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
2022-09-01 10:24:05.690 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
2022-09-01 10:24:05.695 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2022-09-01 10:24:05.711 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
2022-09-01 10:24:05.719 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2022-09-01 10:24:05.745 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2022-09-01 10:24:05.750 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
2022-09-01 10:24:05.775 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2022-09-01 10:24:05.786 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2022-09-01 10:24:05.806 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
2022-09-01 10:24:05.810 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2022-09-01 10:24:05.815 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
2022-09-01 10:24:05.835 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2022-09-01 10:24:05.856 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
2022-09-01 10:24:05.862 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2022-09-01 10:24:05.871 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
2022-09-01 10:24:05.874 7183-7192/com.reactnativeandroidonetimepermission I/etimepermissio: Background young concurrent copying GC freed 23624(7196KB) AllocSpace objects, 7(140KB) LOS objects, 85% free, 4298KB/28MB, paused 453us,21us total 167.390ms
2022-09-01 10:24:05.876 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2022-09-01 10:24:05.882 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2022-09-01 10:24:05.883 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
2022-09-01 10:24:05.887 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
2022-09-01 10:24:05.907 7183-7241/com.reactnativeandroidonetimepermission W/unknown:ReactContext: initializeMessageQueueThreads() is called.
2022-09-01 10:24:05.917 7183-7241/com.reactnativeandroidonetimepermission D/SoLoader: libyoga.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:05.917 7183-7241/com.reactnativeandroidonetimepermission D/SoLoader: libyoga.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:05.917 7183-7241/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libyoga.so
2022-09-01 10:24:06.078 7183-7241/com.reactnativeandroidonetimepermission I/flipper: flipper: FlipperClient::addPlugin Fresco
2022-09-01 10:24:06.204 7183-7240/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativeblob.so not found on /data/data/com.reactnativeandroidonetimepermission/lib-main
2022-09-01 10:24:06.204 7183-7240/com.reactnativeandroidonetimepermission D/SoLoader: libreactnativeblob.so found on /data/app/~~5HUPhnXERRk54Or0vfzxEg==/com.reactnativeandroidonetimepermission-7XhBI40RtbbJXu_Gbat2oQ==/lib/x86_64
2022-09-01 10:24:06.204 7183-7240/com.reactnativeandroidonetimepermission D/SoLoader: Not resolving dependencies for libreactnativeblob.so
2022-09-01 10:24:06.220 7183-7241/com.reactnativeandroidonetimepermission I/WebViewFactory: Loading com.google.android.webview version 91.0.4472.114 (code 447211487)
2022-09-01 10:24:06.284 7183-7241/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed)
2022-09-01 10:24:06.284 7183-7241/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed)
2022-09-01 10:24:06.284 7183-7241/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed)
2022-09-01 10:24:06.285 7183-7241/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2022-09-01 10:24:06.285 7183-7241/com.reactnativeandroidonetimepermission W/etimepermissio: Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2022-09-01 10:24:06.300 7183-7250/com.reactnativeandroidonetimepermission I/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.reactnativeandroidonetimepermission/app_webview/variations_seed_new"
2022-09-01 10:24:06.300 7183-7250/com.reactnativeandroidonetimepermission I/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.reactnativeandroidonetimepermission/app_webview/variations_seed"
2022-09-01 10:24:06.304 7183-7241/com.reactnativeandroidonetimepermission I/cr_LibraryLoader: Loaded native library version number "91.0.4472.114"
2022-09-01 10:24:06.306 7183-7241/com.reactnativeandroidonetimepermission I/cr_CachingUmaRecorder: Flushed 5 samples from 5 histograms.
2022-09-01 10:24:06.485 7183-7240/com.reactnativeandroidonetimepermission I/ReactNativeJS: Running "reactNativeAndroidOneTimePermission" with {"rootTag":1}
  

Library version

3.6.1

Environment info

  System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 149.95 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
    Watchman: 2022.07.04.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4/13F17a - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.5 => 0.69.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Steps to reproduce:

  1. Tap the "Increase 0" button (You see "Increase 1")
  2. Tap the "Permission" button
  3. Select "Only This Time"
  4. Go to background or lock the phone
  5. Wait more than ~1 minute
  6. Open the application
  7. You see the "Increase 0" button instead of "Increase 1" (because the application have been crashed)

Platform: Android Physical device: Nokia G20, Android 12 Emulator: Pixel 5 API 31, Android 12

Reproducible sample code

Repo with example: https://github.com/vasylnahuliak/react-native-android-one-time-permission/blob/react-native-permissions/App.js

import React, {useState} from 'react';
import {SafeAreaView, StyleSheet, View, Alert, Button} from 'react-native';
import {request, PERMISSIONS} from 'react-native-permissions';

const App = () => {
  const [counter, setCounter] = useState(0);

  const handleIncreaseButtonPress = () => {
    setCounter(currentCounter => currentCounter + 1);
  };

  const handlePermissionButtonPress = async () => {
    try {
      const status = await request(PERMISSIONS.ANDROID.CAMERA);

      Alert.alert('Permission status', status);
    } catch (error) {
      Alert.alert(error?.message || 'Unknown error');
    }
  };

  return (
    <SafeAreaView style={styles.root}>
      <View style={styles.buttonWrapper}>
        <Button
          title={`Increase ${counter}`}
          onPress={handleIncreaseButtonPress}
        />
      </View>
      <View style={styles.buttonWrapper}>
        <Button title="Permission" onPress={handlePermissionButtonPress} />
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  root: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  buttonWrapper: {
    marginVertical: 40,
  },
});

export default App;
vasylnahuliak commented 2 years ago

FYI: PermissionsAndroid from 'react-native' also has the same issue https://github.com/facebook/react-native/issues/34547

boodong-kwanee commented 2 years ago

@vasylnahuliak

There you are!

Have you tried to use PermissionsAndroid? I have fixed this issue with this. I hope you would fix your issue!

zoontek commented 2 years ago

@boodong-rn The Android part of this module is nearly identical to PermissionsAndroid, it just add support for UNAVAILABLE (checked after any request, it just read the permissions manifest)

boodong-kwanee commented 2 years ago

@zoontek Yes, I was wrong. I got still same issue. It's not been resolved. Do you have any idea about solving this issue?

edritech93 commented 2 years ago

same issue, I use react-native 0.70.2

ys-sherzad commented 1 year ago

Hi guys, I keep getting permissionStatus = blocked for Android. Anything changed?? Isn't Android notifications enabled by default

sagarjeu commented 1 year ago

the same issue, I use react-native 0.64.2

mikehardy commented 1 year ago

@sagarjeu important to note that you are pretty far out of the support range at this point: https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported

fabiendem commented 1 year ago

Cross referencing my comment at https://github.com/facebook/react-native/issues/34547#issuecomment-1753391728 I think this is working as expected, there is no crash, the process is likely to be killed on purpose by the OS to apply the revocation of the one time permission.

zoontek commented 1 year ago

@fabiendem Good to know, and flawless explanations 👌

I'm closing this.