TBA: Gracefully handle auto-restart after crash
Sometimes Android kills background/idle applications (arbitrarily) as a way of freeing memory needed by active/foreground apps or need by other system services. In some cases, the app is automatically restarted after some time period. Tor Browser on Android does not handle this well. When the app is opened, after it is "restarted", the user is shown a blank, purple screen. This leads me to think it is loading the TorBootstrap fragment, but it doesn't render (?).
13:59:19.189 3366 8097 I WindowManager: WIN DEATH: Window{bfd4312 u0 org.torproject.torbrowser_alpha/org.mozilla.gecko.BrowserApp}
13:59:19.223 3366 3380 I ActivityManager: Process org.torproject.torbrowser_alpha (pid 18467) has died: prcp FGS
13:59:19.223 3366 3380 W ActivityManager: Scheduling restart of crashed service org.torproject.torbrowser_alpha/org.mozilla.gecko.media.MediaControlService in 23746ms
13:59:19.223 3366 3380 W ActivityManager: Scheduling restart of crashed service org.torproject.torbrowser_alpha/org.torproject.android.service.TorService in 23746ms
13:59:43.190 3366 3383 I ActivityManager: Start proc 32619:org.torproject.torbrowser_alpha/u0a163 for service org.torproject.torbrowser_alpha/org.torproject.android.service.TorService
15:46:44.817 3366 5721 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.torproject.torbrowser_alpha/.App bnds=[237,1607][448,1807] (has extras)} from uid 10031
15:46:44.966 3366 5711 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x200000 cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.BrowserApp bnds=[237,1607][448,1807] (has extras)} from uid 10163
15:46:45.058 32619 32641 D GeckoSharedPrefs: Current version = 2, prefs version = 2
I can reproduce this by inducing a crash while the app is in the background (open torbrowser, then switch to another app, and then induce the crash, then reopen the torbrowser).
$ adb shell am crash org.torproject.torbrowser_alpha