Remove Privileged Installer preference when appropriate.
Fixes #817. As discussed in #817, this preference is not useful on Android >= 5.0. As such, the preference should just be removed. However, it should stay if the privileged installer is already installed (e.g. via update.zip or included as part of the ROM).
This commit is contained in:
parent
109c795dd1
commit
2101ec4bbc
@ -166,7 +166,11 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Preferences.PREF_PRIVILEGED_INSTALLER:
|
case Preferences.PREF_PRIVILEGED_INSTALLER:
|
||||||
|
// We may have removed this preference if it is not suitable to show the user. So lets check it is here first.
|
||||||
|
final CheckBoxPreference pref = (CheckBoxPreference) findPreference(Preferences.PREF_PRIVILEGED_INSTALLER);
|
||||||
|
if (pref != null) {
|
||||||
checkSummary(key, R.string.system_installer_on);
|
checkSummary(key, R.string.system_installer_on);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Preferences.PREF_ENABLE_PROXY:
|
case Preferences.PREF_ENABLE_PROXY:
|
||||||
@ -214,6 +218,16 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
boolean enabled = p.isPrivilegedInstallerEnabled();
|
boolean enabled = p.isPrivilegedInstallerEnabled();
|
||||||
boolean installed = PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity())
|
boolean installed = PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity())
|
||||||
== PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES;
|
== PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES;
|
||||||
|
|
||||||
|
// On later versions of Android the privileged installer needs to be installed
|
||||||
|
// via flashing an update.zip or building into a rom. As such, if it isn't installed
|
||||||
|
// by the time the user boots, opens F-Droid, and views this settings page, then there
|
||||||
|
// is no benefit showing it to them (it will only be disabled and we can't offer any
|
||||||
|
// way to easily install from here.
|
||||||
|
if (Build.VERSION.SDK_INT > 19 && !installed) {
|
||||||
|
PreferenceCategory other = (PreferenceCategory) findPreference("pref_category_other");
|
||||||
|
other.removePreference(pref);
|
||||||
|
} else {
|
||||||
pref.setEnabled(installed);
|
pref.setEnabled(installed);
|
||||||
pref.setDefaultValue(installed);
|
pref.setDefaultValue(installed);
|
||||||
pref.setChecked(enabled && installed);
|
pref.setChecked(enabled && installed);
|
||||||
@ -232,6 +246,7 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initUpdatePrivilegedExtensionPreference() {
|
private void initUpdatePrivilegedExtensionPreference() {
|
||||||
if (Build.VERSION.SDK_INT > 19) {
|
if (Build.VERSION.SDK_INT > 19) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user