Merge branch 'fix-1014' into 'master'

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

Closes #1014, #1202, and #1208

See merge request fdroid/fdroidclient!602
This commit is contained in:
Marcus 2017-10-23 20:49:17 +00:00
commit 7e767d0f44
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));
}