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
This commit is contained in:
Hans-Christoph Steiner 2017-10-23 21:58:26 +02:00
parent 0f05e95b2a
commit 4b0eb32d30
2 changed files with 17 additions and 0 deletions

View File

@ -285,6 +285,15 @@ public class FDroidApp extends Application {
curTheme = Preferences.get().getTheme();
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);
AppUpdateStatusService.scanDownloadedApks(this);

View File

@ -120,6 +120,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
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
* 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);
}
public void setExpertMode(boolean flag) {
preferences.edit().putBoolean(PREF_EXPERT, flag).apply();
}
public Theme getTheme() {
return Theme.valueOf(preferences.getString(Preferences.PREF_THEME, Preferences.DEFAULT_THEME));
}