Use Mockito to mock LocaleList rather than changing App.java. The only
reliably working emulator tests on gitlab-ci are emulator-22. The change to
App.java in 3406edefcd broke there:
E/ACRA ( 2231): Caused by: java.lang.NoClassDefFoundError: android.os.LocaleList
E/ACRA ( 2231): at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
E/ACRA ( 2231): at java.lang.Class.getDexCacheType(Class.java:479)
E/ACRA ( 2231): at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:191)
E/ACRA ( 2231): at java.lang.reflect.ArtMethod.getReturnType(ArtMethod.java:145)
E/ACRA ( 2231): at java.lang.reflect.Method.getReturnType(Method.java:184)
E/ACRA ( 2231): at java.lang.Class.getDeclaredMethods(Class.java:771)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.util.ClassUtil.getClassMethods(ClassUtil.java:1172)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector._addMemberMethods(AnnotatedMethodCollector.java:117)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector.collect(AnnotatedMethodCollector.java:49)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector.collectMethods(AnnotatedMethodCollector.java:40)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.AnnotatedClass._methods(AnnotatedClass.java:382)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.AnnotatedClass.memberMethods(AnnotatedClass.java:322)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addMethods(POJOPropertiesCollector.java:555)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:323)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getPropertyMap(POJOPropertiesCollector.java:287)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getProperties(POJOPropertiesCollector.java:186)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.BasicBeanDescription._properties(BasicBeanDescription.java:164)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findProperties(BasicBeanDescription.java:239)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._findCreatorsFromProperties(BasicDeserializerFactory.java:292)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:276)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:224)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:220)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:143)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:458)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.createContextual(ObjectArrayDeserializer.java:128)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:696)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:496)
E/ACRA ( 2231): at com.fasterxml.jackson.databind.Objec
In the case where a non-standard region has been set for the primary
system language, the secondary locale will be used for localized
strings when available instead of the expected primary language.
For example, set system locales to [en-SE, ja-JP], that is English
with region Sweden, and Japanese with region Japan, most apps will
display English descriptions but those which have a Japanese
translation will display that instead.
This commit adds a fallback case for when the primary locale has not
matched any translations, but it's language part does.
Liberapay was originally included using a numeric ID, since they had not yet
finalized the public URLs. Now it is a username. So this logic prefers
the username in Liberapay: field, and uses the old LiberapayID: as a
fallback. LiberapayID: will not override Liberapay: if it is already set.
This reuses the old database key since it is stored and processed as a
String anyway.
This testing at the wrong point, namely in the app details where you are
already looking at the antifeatures which might be present.
In the list view there's an additional direct check with
isDisabledByAntiFeatures() anyway.
Fixfdroid/fdroidclient#1845
The most expensive part of this whole process is calculating the hash of the
whole APK. InstalledAppProvider already caches that, and the rest is OK to
query. If any particular part of the query is expensive, it could also be
moved to InstalledAppProviderService.
java.lang.NumberFormatException: For input string: "@2131034146"
at java.lang.Integer.parseInt(Integer.java:615)
at java.lang.Integer.parseInt(Integer.java:650)
at org.fdroid.fdroid.data.App.getMinTargetMaxSdkVersions(App.java:1092)
at org.fdroid.fdroid.data.App.initInstalledApk(App.java:769)
at org.fdroid.fdroid.data.App.getInstance(App.java:395)
at
org.fdroid.fdroid.localrepo.CacheSwapAppsService.onHandleIntent(CacheSwapAppsService.java:77)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
This is insurance to make sure that packageNames are not abused for
exploiting F-Droid. The database queries already use SQL Prepared
Statements, but who know what else might be exploitable.
fdroid/fdroidclient#1588
Also, app.installedApk.sig is set in App.initInstalledApk()
from 3a5ecc5e8e
refs #1305
refs #855
java.lang.NullPointerException
at org.fdroid.fdroid.data.App.getInstance(App.java:390)
at org.fdroid.fdroid.localrepo.CacheSwapAppsService.onHandleIntent(CacheSwapAppsService.java:77)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
This changes the logic of Utils.getBinaryHash() to return null on failure
rather than only throwing exceptions. That makes it easier to handle these
failures where Utils.getBinaryHash() is called.
#1305#855
This was only partially hooked up and often not even populated.
It was added in 4895e2d790, but things have
changed a lot now. We should be moving towards preferring the drawable XML
vector icons, which will scale nicely for all DPIs.