From fbcb245833f0afca82b3d2ede5cd9b8a241df606 Mon Sep 17 00:00:00 2001 From: Michal Karpinski Date: Tue, 9 Jan 2018 17:06:19 +0000 Subject: [PATCH] Drop support for full backup of com.android.providers.settings The only reason it was still there was adb backup. It's no longer needed since we support adb backup K/V since Oreo. Full restore code has to stay for backwards compatibility, but will not need to be made forward-compatible, since no backups will be made on P+. Test: adb backup com.android.providers.settings Bug: 71746093 Change-Id: I2e8f90d57ed73bb3e050c0e345afef4ad2d3fb82 --- .../settings/SettingsBackupAgent.java | 62 +------------------ 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index f1fb208b1e10d..ae882275de7c3 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -288,65 +288,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { @Override public void onFullBackup(FullBackupDataOutput data) throws IOException { - byte[] systemSettingsData = getSystemSettings(); - byte[] secureSettingsData = getSecureSettings(); - byte[] globalSettingsData = getGlobalSettings(); - byte[] lockSettingsData = getLockSettings(UserHandle.myUserId()); - byte[] locale = mSettingsHelper.getLocaleData(); - byte[] softApConfigData = getSoftAPConfiguration(); - byte[] netPoliciesData = getNetworkPolicies(); - byte[] wifiFullConfigData = getNewWifiConfigData(); - - // Write the data to the staging file, then emit that as our tarfile - // representation of the backed-up settings. - String root = getFilesDir().getAbsolutePath(); - File stage = new File(root, STAGE_FILE); - try { - FileOutputStream filestream = new FileOutputStream(stage); - BufferedOutputStream bufstream = new BufferedOutputStream(filestream); - DataOutputStream out = new DataOutputStream(bufstream); - - if (DEBUG_BACKUP) Log.d(TAG, "Writing flattened data version " + FULL_BACKUP_VERSION); - out.writeInt(FULL_BACKUP_VERSION); - - if (DEBUG_BACKUP) Log.d(TAG, systemSettingsData.length + " bytes of settings data"); - out.writeInt(systemSettingsData.length); - out.write(systemSettingsData); - if (DEBUG_BACKUP) { - Log.d(TAG, secureSettingsData.length + " bytes of secure settings data"); - } - out.writeInt(secureSettingsData.length); - out.write(secureSettingsData); - if (DEBUG_BACKUP) { - Log.d(TAG, globalSettingsData.length + " bytes of global settings data"); - } - out.writeInt(globalSettingsData.length); - out.write(globalSettingsData); - if (DEBUG_BACKUP) Log.d(TAG, locale.length + " bytes of locale data"); - out.writeInt(locale.length); - out.write(locale); - if (DEBUG_BACKUP) Log.d(TAG, lockSettingsData.length + " bytes of lock settings data"); - out.writeInt(lockSettingsData.length); - out.write(lockSettingsData); - if (DEBUG_BACKUP) Log.d(TAG, softApConfigData.length + " bytes of softap config data"); - out.writeInt(softApConfigData.length); - out.write(softApConfigData); - if (DEBUG_BACKUP) Log.d(TAG, netPoliciesData.length + " bytes of net policies data"); - out.writeInt(netPoliciesData.length); - out.write(netPoliciesData); - if (DEBUG_BACKUP) { - Log.d(TAG, wifiFullConfigData.length + " bytes of wifi config data"); - } - out.writeInt(wifiFullConfigData.length); - out.write(wifiFullConfigData); - - out.flush(); // also flushes downstream - - // now we're set to emit the tar stream - fullBackupFile(stage, data); - } finally { - stage.delete(); - } + // Full backup of SettingsBackupAgent support was removed in Android P. If you want to adb + // backup com.android.providers.settings package use \"-keyvalue\" flag. + // Full restore of SettingsBackupAgent is still available for backwards compatibility. } @Override