1

Step 1: Open my app

Step 2: Open system settings(My app is still alive, not killed)

Step 3: Choose a permission of my app(e.g. camera or location), which state is allow and turn it to deny

Step 4: Open my app

My app dead in Step3, and in Step4 it start a new thread. It also happened on other apps. I try these on android 10 and android 12 emulator.

Other apps I' ve tried on emulator: WeChat, Google Photos, Chrome. For most kinds of permission they dead, and for some permissions they still alive. (My WeChat dead when denied camera permission, but for "Draw over other apps" permission, it did not)

Why did the thread die? There is no useful log in the dead thread. The new thread says: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.

Krahmal
  • 195
  • 13
  • What's the code you have that is using threads? and how does it interact with the Android framework lifecycle? – Blundell Mar 29 '22 at 07:48
  • @Blundel I think it has nothing to do with my code. The system photo app also dead when I deny its phone permission. – Krahmal Mar 29 '22 at 07:55
  • Don't west your time on unrealistic problems. it's only possible when the user has the intention to do this. – Gulab Sagevadiya Jun 01 '22 at 08:56

1 Answers1

1

When your app is alive. if you revoke permission from the settings page. The app process will be recreated. it will go to the exact screen where you are before the app gets killed. but viewmodel and all objects would be null at this point. Refer: Crash when disable permission and go back to the app

Venkataramanan
  • 149
  • 1
  • 15
  • Yes, I' ve seen that. But only some permissions will cause that, and others will not. It' s strange and I give up. Thank you. – Krahmal Jun 01 '22 at 09:30
  • yes. only dangerous permissions will cause that.. for example location, camera permissions.. – Venkataramanan Jun 10 '22 at 09:55
  • I have also seen such behaviour. But still have the doubt that whether this is guaranteed to happen across every OS version and device. Otherwise, it is important to handle this and check for permissions every onResume, for permission-dependant activities. FYI, in a Galaxy S21 I can reproduce the behaviour by opening the app in a window and going to app settings and denying a permission while having the window open. When denying it immediately closes (for Location and Nearby devices permissions) – BamsBamx Jan 12 '23 at 15:57