permissions-dispatcher / PermissionsDispatcher

A declarative API to handle Android runtime permissions.
https://github.com/permissions-dispatcher/PermissionsDispatcher
Apache License 2.0
11.22k stars 1.44k forks source link

Application restarted after you grant permissions #588

Closed JustTrust closed 5 years ago

JustTrust commented 5 years ago

Overview

Application restarted after you grant permissions. Its not a crash app just restarted from main activity. No any error in logs, just few strings about restarting:

2019-02-06 17:00:47.683 I/ActivityManager: Killing 20733:com.aaa.debug/u0a130 (adj 100): permission grant or revoke changed gids 2019-02-06 17:00:47.684 D/ActivityManager: cleanUpApplicationRecord -- 20733 2019-02-06 17:00:47.684 W/ActivityManager: Force removing ActivityRecord{d13e83b u0 com.aaa.debug/com.aaa.activity.CameraActivity t464}: app died, no saved state

Expected

app shouldn't restart

Actual

app restarted

Environment

library version = '3.1.0' android 7.1.2

Reproducible steps

Fragment is open, you request permissions, grant it and app restarted

hotchemi commented 5 years ago

@JustTrust

We've never seen that so I wonder there're something weird in app code. Thx.

JustTrust commented 5 years ago

Yes same happens with your sample app with same logs


2019-02-07 10:17:21.851 1489-1511/? I/ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.packageinstaller cmp=com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity (has extras)} from uid 10092 on display 0
2019-02-07 10:17:21.855 1489-1511/? D/ActivityTrigger: ActivityTrigger activityPauseTrigger 
2019-02-07 10:17:21.961 7397-7411/? I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build:  (Ifcb662fdfd)
    OpenGL ES Shader Compiler Version: XE031.09.00.04
    Build Date: 07/11/17 Tue
    Local Branch: 
    Remote Branch: 
    Local Patches: 
    Reconstruct Branch: 
2019-02-07 10:17:21.962 7397-7411/? I/OpenGLRenderer: Initialized EGL, version 1.4
2019-02-07 10:17:21.962 7397-7411/? D/OpenGLRenderer: Swap behavior 1
2019-02-07 10:17:22.011 1489-1562/? I/ActivityManager: Displayed com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity: +150ms
2019-02-07 10:17:22.355 498-570/? E/libnav: CablComputeBacklightLevel(): UpdateType = DifferentSceneUpdate
2019-02-07 10:17:22.369 624-624/? I/cnss_diag: type=1400 audit(0.0:357): avc: denied { read } for name="primary" dev="tmpfs" ino=6064 scontext=u:r:wcnss_service:s0 tcontext=u:object_r:storage_file:s0 tclass=lnk_file permissive=1
2019-02-07 10:17:22.369 624-624/? I/cnss_diag: type=1400 audit(0.0:358): avc: denied { read } for name="primary" dev="tmpfs" ino=27028 scontext=u:r:wcnss_service:s0 tcontext=u:object_r:mnt_user_file:s0 tclass=lnk_file permissive=1
2019-02-07 10:17:23.178 1489-1586/? I/ActivityManager: Killing 8259:permissions.dispatcher.samplekotlin/u0a92 (adj 100): permission grant or revoke changed gids
2019-02-07 10:17:23.180 1489-1586/? D/ActivityManager: cleanUpApplicationRecord -- 8259
2019-02-07 10:17:23.180 1489-1489/? I/GnssLocationProvider: WakeLock acquired by sendMessage(3, 0, com.android.server.location.GnssLocationProvider$GpsRequest@4a94a71)
2019-02-07 10:17:23.182 1489-1586/? W/ActivityManager: Force removing ActivityRecord{d1bc564 u0 permissions.dispatcher.samplekotlin/.MainActivity t477}: app died, no saved state
2019-02-07 10:17:23.184 1489-1525/? I/GnssLocationProvider: WakeLock released by handleMessage(3, 0, com.android.server.location.GnssLocationProvider$GpsRequest@4a94a71)
2019-02-07 10:17:23.196 1489-2180/? D/GraphicsStats: Buffer count: 4
2019-02-07 10:17:23.199 1489-1798/? W/InputDispatcher: channel 'ad4f94 permissions.dispatcher.samplekotlin/permissions.dispatcher.samplekotlin.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2019-02-07 10:17:23.199 1489-1798/? E/InputDispatcher: channel 'ad4f94 permissions.dispatcher.samplekotlin/permissions.dispatcher.samplekotlin.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-02-07 10:17:23.204 1489-1586/? W/InputDispatcher: Attempted to unregister already unregistered input channel 'ad4f94 permissions.dispatcher.samplekotlin/permissions.dispatcher.samplekotlin.MainActivity (server)'```
hotchemi commented 5 years ago

@JustTrust what kind of device are you using for test? Sorry I haven't been able to reproduce yet 🤔 And also can we possibly get the GIF which records how app behaves?

JustTrust commented 5 years ago

Device is vepoy System is a pure android without any customisation.

video-to-gif

hotchemi commented 5 years ago

Oh weird..we've been testing with emulators and several physical devices but never seen that state before..🤔My next question is if you don't use the library you can deal with it?

JustTrust commented 5 years ago

I'll try to check it without library, but it needs more time

hotchemi commented 5 years ago

Any update? 👀

JustTrust commented 5 years ago

Yes, I copied generated code from dispatcher class in my fragment and got the same behaviour. Maybe its a device related issue, what do you think? This device has additional camera in QR code scanner.

smelfungus commented 5 years ago

@JustTrust did you try plain android permissions requests with no libraries? They are pretty simple to implement especially for the test case of permission requesting and result basic handling. https://developer.android.com/training/permissions/requesting Feels like this issue will persist there. What about other apps requesting runtime permissions by the way?

JustTrust commented 5 years ago

With location permissions everything is fine. I will try to make a test with pure android permissions request.

hotchemi commented 5 years ago

I suppose the cause is on devise side..let me close the issue for the time being and reopen if needed. thank you for your contribution! appreciated.