Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +30 −18 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { stateChecksums[STATE_LOCK_SETTINGS] = writeIfChanged(stateChecksums[STATE_LOCK_SETTINGS], KEY_LOCK_SETTINGS, lockSettingsData, data); if (getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) { if (isWatch()) { stateChecksums[STATE_SOFTAP_CONFIG] = 0; } else { stateChecksums[STATE_SOFTAP_CONFIG] = Loading @@ -269,6 +269,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { writeNewChecksums(stateChecksums, newState); } private boolean isWatch() { return getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); } @Override public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) { Loading Loading @@ -368,25 +372,27 @@ public class SettingsBackupAgent extends BackupAgentHelper { break; case KEY_SOFTAP_CONFIG : if (getBaseContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_WATCH)) { break; } byte[] softapData = new byte[size]; data.readEntityData(softapData, 0, size); if (!isWatch()) { restoreSoftApConfiguration(softapData); } break; case KEY_NETWORK_POLICIES: byte[] netPoliciesData = new byte[size]; data.readEntityData(netPoliciesData, 0, size); if (!isWatch()) { restoreNetworkPolicies(netPoliciesData); } break; case KEY_WIFI_NEW_CONFIG: byte[] restoredWifiNewConfigData = new byte[size]; data.readEntityData(restoredWifiNewConfigData, 0, size); if (!isWatch()) { restoreNewWifiConfigData(restoredWifiNewConfigData); } break; case KEY_DEVICE_SPECIFIC_CONFIG: Loading Loading @@ -415,7 +421,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { } // Do this at the end so that we also pull in the ipconfig data. if (restoredWifiSupplicantData != null) { if (restoredWifiSupplicantData != null && !isWatch()) { restoreSupplicantWifiConfigData( restoredWifiSupplicantData, restoredWifiIpConfigData); } Loading Loading @@ -499,8 +505,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (DEBUG_BACKUP) Log.d(TAG, ipconfig_size + " bytes of ip config data"); byte[] ipconfig_buffer = new byte[ipconfig_size]; in.readFully(ipconfig_buffer, 0, nBytes); if (!isWatch()) { restoreSupplicantWifiConfigData(supplicant_buffer, ipconfig_buffer); } } if (version >= FULL_BACKUP_ADDED_LOCK_SETTINGS) { nBytes = in.readInt(); Loading @@ -512,17 +520,17 @@ public class SettingsBackupAgent extends BackupAgentHelper { } } // softap config if (version >= FULL_BACKUP_ADDED_SOFTAP_CONF && !getBaseContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_WATCH)) { if (version >= FULL_BACKUP_ADDED_SOFTAP_CONF) { nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of softap config data"); if (nBytes > buffer.length) buffer = new byte[nBytes]; if (nBytes > 0) { in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreSoftApConfiguration(buffer); } } } // network policies if (version >= FULL_BACKUP_ADDED_NETWORK_POLICIES) { nBytes = in.readInt(); Loading @@ -530,17 +538,21 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (nBytes > buffer.length) buffer = new byte[nBytes]; if (nBytes > 0) { in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreNetworkPolicies(buffer); } } } // Restore full wifi config data if (version >= FULL_BACKUP_ADDED_WIFI_NEW) { nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of full wifi config data"); if (nBytes > buffer.length) buffer = new byte[nBytes]; in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreNewWifiConfigData(buffer); } } if (DEBUG_BACKUP) Log.d(TAG, "Full restore complete."); } else { Loading Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +30 −18 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { stateChecksums[STATE_LOCK_SETTINGS] = writeIfChanged(stateChecksums[STATE_LOCK_SETTINGS], KEY_LOCK_SETTINGS, lockSettingsData, data); if (getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) { if (isWatch()) { stateChecksums[STATE_SOFTAP_CONFIG] = 0; } else { stateChecksums[STATE_SOFTAP_CONFIG] = Loading @@ -269,6 +269,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { writeNewChecksums(stateChecksums, newState); } private boolean isWatch() { return getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); } @Override public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) { Loading Loading @@ -368,25 +372,27 @@ public class SettingsBackupAgent extends BackupAgentHelper { break; case KEY_SOFTAP_CONFIG : if (getBaseContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_WATCH)) { break; } byte[] softapData = new byte[size]; data.readEntityData(softapData, 0, size); if (!isWatch()) { restoreSoftApConfiguration(softapData); } break; case KEY_NETWORK_POLICIES: byte[] netPoliciesData = new byte[size]; data.readEntityData(netPoliciesData, 0, size); if (!isWatch()) { restoreNetworkPolicies(netPoliciesData); } break; case KEY_WIFI_NEW_CONFIG: byte[] restoredWifiNewConfigData = new byte[size]; data.readEntityData(restoredWifiNewConfigData, 0, size); if (!isWatch()) { restoreNewWifiConfigData(restoredWifiNewConfigData); } break; case KEY_DEVICE_SPECIFIC_CONFIG: Loading Loading @@ -415,7 +421,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { } // Do this at the end so that we also pull in the ipconfig data. if (restoredWifiSupplicantData != null) { if (restoredWifiSupplicantData != null && !isWatch()) { restoreSupplicantWifiConfigData( restoredWifiSupplicantData, restoredWifiIpConfigData); } Loading Loading @@ -499,8 +505,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (DEBUG_BACKUP) Log.d(TAG, ipconfig_size + " bytes of ip config data"); byte[] ipconfig_buffer = new byte[ipconfig_size]; in.readFully(ipconfig_buffer, 0, nBytes); if (!isWatch()) { restoreSupplicantWifiConfigData(supplicant_buffer, ipconfig_buffer); } } if (version >= FULL_BACKUP_ADDED_LOCK_SETTINGS) { nBytes = in.readInt(); Loading @@ -512,17 +520,17 @@ public class SettingsBackupAgent extends BackupAgentHelper { } } // softap config if (version >= FULL_BACKUP_ADDED_SOFTAP_CONF && !getBaseContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_WATCH)) { if (version >= FULL_BACKUP_ADDED_SOFTAP_CONF) { nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of softap config data"); if (nBytes > buffer.length) buffer = new byte[nBytes]; if (nBytes > 0) { in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreSoftApConfiguration(buffer); } } } // network policies if (version >= FULL_BACKUP_ADDED_NETWORK_POLICIES) { nBytes = in.readInt(); Loading @@ -530,17 +538,21 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (nBytes > buffer.length) buffer = new byte[nBytes]; if (nBytes > 0) { in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreNetworkPolicies(buffer); } } } // Restore full wifi config data if (version >= FULL_BACKUP_ADDED_WIFI_NEW) { nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of full wifi config data"); if (nBytes > buffer.length) buffer = new byte[nBytes]; in.readFully(buffer, 0, nBytes); if (!isWatch()) { restoreNewWifiConfigData(buffer); } } if (DEBUG_BACKUP) Log.d(TAG, "Full restore complete."); } else { Loading