diff options
| author | 2021-11-18 09:41:30 -0800 | |
|---|---|---|
| committer | 2021-12-02 18:05:33 +0000 | |
| commit | 5dff75b3d6ad2afb24317fbfddcfeb2a1e154f4c (patch) | |
| tree | e020d547b3306758900220743c7a0a9997f2fed8 | |
| parent | eb2333936ed591e0195368b763df8fd321c239e5 (diff) | |
Create a new key to backup Sim-specific data.
Bug: b/206309441
Test: b/206986278
Change-Id: I84b42690f8dd3de0cbd795cc13dd5f9ab5a7a725
Merged-In: I84b42690f8dd3de0cbd795cc13dd5f9ab5a7a725
| -rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index 9cd7083a2a11..c30c742fd9d9 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -98,6 +98,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { private static final String KEY_WIFI_NEW_CONFIG = "wifi_new_config"; private static final String KEY_DEVICE_SPECIFIC_CONFIG = "device_specific_config"; private static final String KEY_SIM_SPECIFIC_SETTINGS = "sim_specific_settings"; + // Restoring sim-specific data backed up from newer Android version to Android 12 was causing a + // fatal crash. Creating a backup with a different key will prevent Android 12 versions from + // restoring this data. + private static final String KEY_SIM_SPECIFIC_SETTINGS_2 = "sim_specific_settings_2"; // Versioning of the state file. Increment this version // number any time the set of state items is altered. @@ -253,7 +257,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { deviceSpecificInformation, data); stateChecksums[STATE_SIM_SPECIFIC_SETTINGS] = writeIfChanged(stateChecksums[STATE_SIM_SPECIFIC_SETTINGS], - KEY_SIM_SPECIFIC_SETTINGS, simSpecificSettingsData, data); + KEY_SIM_SPECIFIC_SETTINGS_2, simSpecificSettingsData, data); writeNewChecksums(stateChecksums, newState); } @@ -395,6 +399,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { break; case KEY_SIM_SPECIFIC_SETTINGS: + // Intentional fall through so that sim-specific backups from Android 12 will + // also be restored on newer Android versions. + case KEY_SIM_SPECIFIC_SETTINGS_2: byte[] restoredSimSpecificSettings = new byte[size]; data.readEntityData(restoredSimSpecificSettings, 0, size); restoreSimSpecificSettings(restoredSimSpecificSettings); |