diff options
author | Svet Ganov <svetoslavganov@google.com> | 2015-04-27 09:33:40 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2015-04-27 16:52:03 +0000 |
commit | b128540dc741c424d4f652419686882b7a3bfa06 (patch) | |
tree | 726bf1896f0132b75a4c8aa291120c9ca1a55ceb /packages | |
parent | c87326127eea4a0483aa3b0a6d8c75c9b9819ff3 (diff) | |
download | frameworks_base-b128540dc741c424d4f652419686882b7a3bfa06.zip frameworks_base-b128540dc741c424d4f652419686882b7a3bfa06.tar.gz frameworks_base-b128540dc741c424d4f652419686882b7a3bfa06.tar.bz2 |
Do not clean up global/system settings on package unintalls.
Legacy apps can write their own entries in the system settings and
when they get uninstalled these are hanging around forever polluting
the settings table. We keep track of which settings an app added and
when the app is uninstalled we drop its custom entries. The trouble
was that we did the same thing for global and secure settings with
no explicit list of platform defined settings. Hence, if say a test
signed by the platform certificate touches platform defined global
or secure settings and is then uninstalled, we would drop the platform
defined entries portentially crippling the system.
bug:20113160
Change-Id: Ia21694f6326ad4a1795c4666027b366e26c05a23
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 15 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 0d61606..1953e75 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -1500,17 +1500,16 @@ public class SettingsProvider extends ContentProvider { } public void onPackageRemovedLocked(String packageName, int userId) { - final int globalKey = makeKey(SETTINGS_TYPE_GLOBAL, UserHandle.USER_OWNER); - SettingsState globalSettings = mSettingsStates.get(globalKey); - if (globalSettings != null) globalSettings.onPackageRemovedLocked(packageName); - - final int secureKey = makeKey(SETTINGS_TYPE_SECURE, userId); - SettingsState secureSettings = mSettingsStates.get(secureKey); - if (secureSettings != null) secureSettings.onPackageRemovedLocked(packageName); + // Global and secure settings are signature protected. Apps signed + // by the platform certificate are generally not uninstalled and + // the main exception is tests. We trust components signed + // by the platform certificate and do not do a clean up after them. final int systemKey = makeKey(SETTINGS_TYPE_SYSTEM, userId); SettingsState systemSettings = mSettingsStates.get(systemKey); - if (systemSettings != null) systemSettings.onPackageRemovedLocked(packageName); + if (systemSettings != null) { + systemSettings.onPackageRemovedLocked(packageName); + } } private SettingsState peekSettingsStateLocked(int key) { diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java index 8d99a64..f853f3f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java @@ -153,7 +153,7 @@ final class SettingsState { final int settingCount = mSettings.size(); for (int i = settingCount - 1; i >= 0; i--) { String name = mSettings.keyAt(i); - // Settings defined by use are never dropped. + // Settings defined by us are never dropped. if (Settings.System.PUBLIC_SETTINGS.contains(name) || Settings.System.PRIVATE_SETTINGS.contains(name)) { continue; |