Viewing media files causes crash due to `preferredSigner` not existing
@eighthave - seems like our assumption that there will always be a most appropriate signature is incorrect for media files.
Is media signed by fdroidserver? Would be very great if it was, because the ability to verify who has created and released a piece of media seems like a good practice that probably isn't available through most other distribution channels.
However, there would be all sorts of complications around verifying signatures, because now the Android system does it for us.
Perhaps the best thing is to change the assumption from:
All "apps" have a preferred signer
to instead be:
All actual apps (i.e. not media) have a preferred signer
By changing App#getMostAppropriateSignature()
to return null
again instead of throwing an exception it works. Thoughts?
To reproduce, try to view any media thing instead of an app (e.g. your "Novnain Whistles" from http://testy.at.or.at/fdroid/repo):
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.fdroid.fdroid/org.fdroid.fdroid.AppDetails2}: java.lang.IllegalStateException: Most Appropriate Signature not found!
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: java.lang.IllegalStateException: Most Appropriate Signature not found!
at org.fdroid.fdroid.data.App.getMostAppropriateSignature(App.java:1165)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter.getSuggestedApk(AppDetailsRecyclerViewAdapter.java:181)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter.shouldShowPermissions(AppDetailsRecyclerViewAdapter.java:174)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter.addItem(AppDetailsRecyclerViewAdapter.java:166)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter.updateItems(AppDetailsRecyclerViewAdapter.java:135)
at org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter.<init>(AppDetailsRecyclerViewAdapter.java:107)
at org.fdroid.fdroid.AppDetails2.onCreate(AppDetails2.java:130)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
... 10 more