Fix GoogleSettings check in PrivacySettings
GoogleSettingsProvider has moved to a new package as part of unbundling.
This broke the check used to decide whether to show the "Backup my
settings" preference. To make this more robust to package name changes,
I changed the code to look up the settings provider by authority
instead of looking for the package that contains it.
Fixes http://b/issue?id=2390945
Change-Id: Iaec3152faddbd938fc02f9f2dde748819c1d5cdf
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 2edb328..611af04 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -45,7 +45,7 @@
private static final String PREFS_USE_LOCATION = "use_location";
// Vendor specific
- private static final String GSETTINGS_PROVIDER = "com.google.android.providers.settings";
+ private static final String GSETTINGS_PROVIDER = "com.google.settings";
private static final String LOCATION_CATEGORY = "location_category";
private static final String SETTINGS_CATEGORY = "settings_category";
private static final String USE_LOCATION = "use_location";
@@ -69,11 +69,7 @@
mBackup = (CheckBoxPreference) getPreferenceScreen().findPreference(BACKUP_SETTINGS);
// Vendor specific
- try {
- if (mUseLocation != null) {
- getPackageManager().getPackageInfo(GSETTINGS_PROVIDER, 0);
- }
- } catch (NameNotFoundException nnfe) {
+ if (getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null) {
getPreferenceScreen().removePreference(findPreference(LOCATION_CATEGORY));
getPreferenceScreen().removePreference(findPreference(SETTINGS_CATEGORY));
}