diff options
author | Christopher Tate <ctate@android.com> | 2009-09-11 16:35:39 -0700 |
---|---|---|
committer | Christopher Tate <ctate@android.com> | 2009-09-11 16:35:39 -0700 |
commit | 0738e8893540e8f7fac7c193be5fe24b67f04672 (patch) | |
tree | 7df84f31b4b81566887d7745d8ea723a76d3376d /packages | |
parent | b14a14194c64094cdffadeca1480b08c943215a9 (diff) | |
download | frameworks_base-0738e8893540e8f7fac7c193be5fe24b67f04672.zip frameworks_base-0738e8893540e8f7fac7c193be5fe24b67f04672.tar.gz frameworks_base-0738e8893540e8f7fac7c193be5fe24b67f04672.tar.bz2 |
Don't backup/restore telephony material from secure settings
* Remove several nonportable telephony settings from the set to be included in
the backed-up dataset
* Explicitly ignore those settings if they're encountered during a restore
operation, so that we don't inadvertently do things like configure a GSM
phone to use CDMA logic.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index 13db005..8cfd956 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -50,6 +50,7 @@ import android.util.Log; * List of settings that are backed up are stored in the Settings.java file */ public class SettingsBackupAgent extends BackupHelperAgent { + private static final boolean DEBUG = true; private static final String KEY_SYSTEM = "system"; private static final String KEY_SECURE = "secure"; @@ -242,6 +243,13 @@ public class SettingsBackupAgent extends BackupHelperAgent { pos += length; if (!TextUtils.isEmpty(settingName) && !TextUtils.isEmpty(settingValue)) { //Log.i(TAG, "Restore " + settingName + " = " + settingValue); + + // TODO: versioning rather than just an ad hoc blacklist to handle + // older varieties of backed-up data + if (invalidSavedSetting(contentUri, settingName, settingValue)) { + continue; + } + if (mSettingsHelper.restoreValue(settingName, settingValue)) { cv.clear(); cv.put(Settings.NameValueTable.NAME, settingName); @@ -252,6 +260,22 @@ public class SettingsBackupAgent extends BackupHelperAgent { } } + private boolean invalidSavedSetting(Uri contentUri, String settingName, String settingValue) { + // Even if these settings were stored, don't use them on restore + if (contentUri.equals(Settings.Secure.CONTENT_URI)) { + if (settingName.equals(Settings.Secure.PREFERRED_NETWORK_MODE) + || settingName.equals(Settings.Secure.PREFERRED_TTY_MODE) + || settingName.equals(Settings.Secure.CDMA_CELL_BROADCAST_SMS) + || settingName.equals(Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION) + || settingName.equals(Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED)) { + if (DEBUG) Log.v(TAG, "Ignoring restore datum: " + settingName); + return true; + } + } + + return false; + } + private String[] copyAndSort(String[] keys) { String[] sortedKeys = new String[keys.length]; System.arraycopy(keys, 0, sortedKeys, 0, keys.length); |