Merge change 24797 into eclair
* changes: Don't backup/restore telephony material from secure settings
This commit is contained in:
@@ -2401,11 +2401,6 @@ public final class Settings {
|
|||||||
WIFI_NUM_ALLOWED_CHANNELS,
|
WIFI_NUM_ALLOWED_CHANNELS,
|
||||||
WIFI_NUM_OPEN_NETWORKS_KEPT,
|
WIFI_NUM_OPEN_NETWORKS_KEPT,
|
||||||
BACKGROUND_DATA,
|
BACKGROUND_DATA,
|
||||||
PREFERRED_NETWORK_MODE,
|
|
||||||
PREFERRED_TTY_MODE,
|
|
||||||
CDMA_CELL_BROADCAST_SMS,
|
|
||||||
PREFERRED_CDMA_SUBSCRIPTION,
|
|
||||||
ENHANCED_VOICE_PRIVACY_ENABLED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import android.util.Log;
|
|||||||
* List of settings that are backed up are stored in the Settings.java file
|
* List of settings that are backed up are stored in the Settings.java file
|
||||||
*/
|
*/
|
||||||
public class SettingsBackupAgent extends BackupHelperAgent {
|
public class SettingsBackupAgent extends BackupHelperAgent {
|
||||||
|
private static final boolean DEBUG = true;
|
||||||
|
|
||||||
private static final String KEY_SYSTEM = "system";
|
private static final String KEY_SYSTEM = "system";
|
||||||
private static final String KEY_SECURE = "secure";
|
private static final String KEY_SECURE = "secure";
|
||||||
@@ -242,6 +243,13 @@ public class SettingsBackupAgent extends BackupHelperAgent {
|
|||||||
pos += length;
|
pos += length;
|
||||||
if (!TextUtils.isEmpty(settingName) && !TextUtils.isEmpty(settingValue)) {
|
if (!TextUtils.isEmpty(settingName) && !TextUtils.isEmpty(settingValue)) {
|
||||||
//Log.i(TAG, "Restore " + settingName + " = " + 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)) {
|
if (mSettingsHelper.restoreValue(settingName, settingValue)) {
|
||||||
cv.clear();
|
cv.clear();
|
||||||
cv.put(Settings.NameValueTable.NAME, settingName);
|
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) {
|
private String[] copyAndSort(String[] keys) {
|
||||||
String[] sortedKeys = new String[keys.length];
|
String[] sortedKeys = new String[keys.length];
|
||||||
System.arraycopy(keys, 0, sortedKeys, 0, keys.length);
|
System.arraycopy(keys, 0, sortedKeys, 0, keys.length);
|
||||||
|
|||||||
Reference in New Issue
Block a user