From ecfeaffdfa19bea836f24fd399376825c377eaa9 Mon Sep 17 00:00:00 2001 From: Bjorn Bringert Date: Mon, 25 Jan 2010 20:30:39 +0000 Subject: [PATCH] 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 --- src/com/android/settings/PrivacySettings.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java index 2edb3284055..611af04b5cb 100644 --- a/src/com/android/settings/PrivacySettings.java +++ b/src/com/android/settings/PrivacySettings.java @@ -45,7 +45,7 @@ public class PrivacySettings extends PreferenceActivity implements 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 @@ public class PrivacySettings extends PreferenceActivity implements 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)); }