Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f556491 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Create a new key to backup Sim-specific data." into sc-v2-dev am: 353f5de3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16296209

Change-Id: Iea9c1967116f644ad49ecddd14527d2c1e9ebc96
parents a0dce98e 353f5de3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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);