disable AppDetails action buttons until they have refreshed their state
When returning to an AppDetails screen, it can take some seconds to refresh the state of the buttons. If it is not possible to make that instant, then those buttons should be disabled until their state has been refreshed. Otherwise, users can click them, which causes crashes or wrong actions.
java.lang.IllegalStateException: Couldn't find installed apk for ...
at org.fdroid.fdroid.AppDetails2.uninstallApk(AppDetails2.java:770)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter$3.onClick(AppDetailsRecyclerViewAdapter.java:1066)
at android.view.View.performClick(View.java:4463)
at android.view.View$PerformClick.run(View.java:18770)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
User comments:
Sony F5321, v1.2
Tried to remove an app which I previously already removed through the launcher
Moto G (5) Plus, v1.0.3
I uninstalled an app manually which I had run from fdroid, then went back to fdroid and hit uninstall.
OnePlus A2003, v1.0.3
i uninstalled an app from the playstore while the appage for that same app was opened in fdroid
Xiaomi Redmi 4A, v1.1-alpha3
while trying to uninstall openlauncher
HUAWEI P6S-U06, v1.0.3
tap the uninstall button for an app that has meanwhile been uninstalled via the launcher or system settings
ASUS_Z00AD, v1.2.2
Had multiple problems with packages not being able to upgrade. after some time getting fdroid to "successfully" updgrade itself I tried upgrading Conversations and Mastalab, Conversations failed with error -3, Mastalad failed by this app crash.
ONEPLUS A3003, v1.0.3
In F-Droid, go to the detail screen of an application and install it from there, which makes the Uninstall and Run buttons appear. Hit the Home-button to leave F-Droid.
Now uninstall the app from outside of F-Droid. When uninstallation has completed, quickly switch back to F-Droid. This will still show the Uninstall and Run buttons, and take about a second to switch to the Install button.
Before it switches to the Install button, tap on either the Uninstall or the Run button to produce this crash.
So, in order to fix this, you probably just have to do a not-null check before attempting to run or uninstall the app.