4

The app is running with Marshmallow. With the app open, I switched to "Setting>Apps>MyApp>Permissions" to toggle the permissions and when switching back to the app, it crashes. From the logcat, I found these lines:

01-18 14:45:35.456     799-1158/? I/ActivityManager? Killing 23531:ca.bluecross.ab.sys1/u0a103 (adj 9): permissions revoked
01-18 14:45:35.476     799-1632/? I/WindowState? **WIN DEATH:** Window{20182a4 u0 ca.bluecross.ab.sys1/myexample.com.view.activities.eclaims.AuditActivity}
01-18 14:45:35.476     799-1600/? D/GraphicsStats? Buffer count: 6                                                          
01-18 14:45:35.477      799-894/? W/InputDispatcher? channel 'd9c6d5e myexample.com.sys1/myexample.com.view.activities.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
01-18 14:45:35.477      799-894/? E/InputDispatcher? channel 'd9c6d5e myexample.com.sys1/myexample.com.view.activities.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-18 14:45:35.478     799-1160/? I/WindowState? **WIN DEATH:** Window{d9c6d5e u0 myexample.com.sys1/myexample.com.view.activities.MainActivity}
01-18 14:45:35.478     799-1160/? W/InputDispatcher? Attempted to unregister already unregistered input channel 'd9c6d5e myexample.com.sys1/myexample.com.view.activities.MainActivity (server)'
01-18 14:45:35.484     799-1600/? W/ActivityManager? Spurious death for ProcessRecord{5c56227 0:myexample.com.sys1/u0a103}, curProc for 23531: null

What do those WIN DEATHin the logcat mean? Is Android OS killing my app?

Floern
  • 33,559
  • 24
  • 104
  • 119
Shawn Chen
  • 95
  • 10
  • 1
    When revoking a permission your process gets terminated by Android. This is how new permissions model works. What is unclear to me with your question is if you are experiencing some kind of crash at UI level or if you just see that app is killed in logcat, but after you can reopen it normally. – andrea.petreri Jan 18 '16 at 23:13
  • The crash happens at UI level, then, after clicking the "Ok" button of the dialog, the app is launched again. – Shawn Chen Jan 19 '16 at 16:05
  • @thetonrifles, further looking down in the logcat, it shows that when switching back to the app after revoke the permission in "Settings", it tries to restart the activities/fragment. But my understanding for Marshmallow is that the os is killing the app or relaunch the app, right? Because it tries to restart the activity/fragment, which has some params from previous screens, the app crashes in UI. – Shawn Chen Jan 19 '16 at 17:54
  • What can happen is that after terminating your application, Android tries to recreate the activity and restore its state (including fragments). Maybe here you have some problem with fragments management. – andrea.petreri Jan 19 '16 at 18:48
  • 2
    @thetonrifles, that's where it's confusing me: after terminating your application, Android tries to recreate the activity and restore its state (including fragments). As android tries to terminate the app, why does it care to try to recreate the current activity/fragment at all. Shouldn't it just launch the app again? (Current activity/fragment refers to the screen when I switch out to revoke permissions in "Settings") In my case, some params are from previous fragment and become null when the current fragment is being recreated, hence app crashes. – Shawn Chen Jan 19 '16 at 19:57
  • Well, this is the normal Android behavior. Revoking permission has the effect of stopping your activity. When you try re-open it, you will get your activity re-created with the saved state. This is the same happening for example when changing your device configuration (e.g. rotating your screen). It's developer responsibility to properly handle state restore. – andrea.petreri Jan 19 '16 at 20:02
  • 1
    @thetonrifles that's not the same as rotating device. If you have class member in Application class, it will be null when you change the permissions but when you rotate device the value is not null(ed). – vilpe89 Feb 20 '17 at 12:06
  • @ShawnChen I know this is an old post, but did you reach a solution to your problem? – Sherif El Nady Sep 24 '19 at 16:42

1 Answers1

0

In my case I solved it by remove custom progress bar. It loaded when fragment start, but after restore from background and switch permissions it crashed on progressbar.dismiss()

P.S. custom progressbar: SVProgressHUD

Serega Maleev
  • 403
  • 5
  • 6