TBA: Prevent crash following upgrade
For the last few releases (maybe all of them), TBA crashes after installing the update. I believe this only happens if the app was open and then the new apk is installed (therefore the app goes into the background). After the crash, opening the app again is successful and it doesn't crash (for the same reason) again.
01-30 11:32:58.544 22804 22804 D AndroidRuntime: Shutting down VM
01-30 11:32:58.545 22804 22804 E AndroidRuntime: FATAL EXCEPTION: main
01-30 11:32:58.545 22804 22804 E AndroidRuntime: Process: org.torproject.torbrowser_alpha, PID: 22804
01-30 11:32:58.545 22804 22804 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver org.mozilla.gecko.PackageReplacedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3194)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ActivityThread.-wrap17(Unknown Source:0)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1477)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at org.mozilla.gecko.PackageReplacedReceiver.onReceive(PackageReplacedReceiver.java:29)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: ... 8 more
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 2 ("main")
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ContextImpl.startService(ContextImpl.java:1477)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at org.mozilla.gecko.PackageReplacedReceiver.onReceive(PackageReplacedReceiver.java:29)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ActivityThread.-wrap17(Unknown Source:0)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.os.Handler.dispatchMessage(Handler.java:106)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.os.Looper.loop(Looper.java:164)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at android.app.ActivityThread.main(ActivityThread.java:6494)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at java.lang.reflect.Method.invoke(Native Method)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
The cause of the crash being: java.lang.RuntimeException: Unable to start receiver org.mozilla.gecko.PackageReplacedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}