1
0

force all Android 5.0 devices to use the old index v0 XML format

The workaround is fugly, so we really don't want to include it in the
modern code.  Luckily, we have old index support there :-D

closes #1014
closes #1202
closes #1208
#111
Este cometimento está contido em:
Hans-Christoph Steiner 2017-10-23 21:58:26 +02:00
ascendente 0f05e95b2a
cometimento 4b0eb32d30
2 ficheiros modificados com 17 adições e 0 eliminações

Ver ficheiro

@ -285,6 +285,15 @@ public class FDroidApp extends Application {
curTheme = Preferences.get().getTheme(); curTheme = Preferences.get().getTheme();
Preferences.get().configureProxy(); Preferences.get().configureProxy();
// bug specific to exactly 5.0 makes it only work with the old index
// which includes an ugly, hacky workaround
// https://gitlab.com/fdroid/fdroidclient/issues/1014
if (Build.VERSION.SDK_INT == 21) {
Preferences p = Preferences.get();
p.setExpertMode(true);
p.setForceOldIndex(true);
}
InstalledAppProviderService.compareToPackageManager(this); InstalledAppProviderService.compareToPackageManager(this);
AppUpdateStatusService.scanDownloadedApks(this); AppUpdateStatusService.scanDownloadedApks(this);

Ver ficheiro

@ -120,6 +120,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
return preferences.getBoolean(PREF_FORCE_OLD_INDEX, DEFAULT_FORCE_OLD_INDEX); return preferences.getBoolean(PREF_FORCE_OLD_INDEX, DEFAULT_FORCE_OLD_INDEX);
} }
public void setForceOldIndex(boolean flag) {
preferences.edit().putBoolean(PREF_FORCE_OLD_INDEX, flag).apply();
}
/** /**
* Whether to use the Privileged Installer, based on if it is installed. Only the disabled * Whether to use the Privileged Installer, based on if it is installed. Only the disabled
* state is stored as a preference since the enabled state is based entirely on the presence * state is stored as a preference since the enabled state is based entirely on the presence
@ -225,6 +229,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
return preferences.getBoolean(PREF_EXPERT, DEFAULT_EXPERT); return preferences.getBoolean(PREF_EXPERT, DEFAULT_EXPERT);
} }
public void setExpertMode(boolean flag) {
preferences.edit().putBoolean(PREF_EXPERT, flag).apply();
}
public Theme getTheme() { public Theme getTheme() {
return Theme.valueOf(preferences.getString(Preferences.PREF_THEME, Preferences.DEFAULT_THEME)); return Theme.valueOf(preferences.getString(Preferences.PREF_THEME, Preferences.DEFAULT_THEME));
} }