From cd425e62c66ca9a79f3a121b0e1cd65a75927218 Mon Sep 17 00:00:00 2001 From: Ruslan Tkhakokhov Date: Thu, 8 Apr 2021 01:07:29 +0100 Subject: [PATCH] [FSD2D] Remove left-over code from proof-of-concept This code was not meant to be shipped and was disabled by default. It was accidentally enabled when productionizing the final version of FSD2D. Bug: 184781934 Test: 1. atest CtsBackupTestCases 2. atest CtsBackupHostTestCases 3. Run a D2D transfer and verify system apps are properly restored Change-Id: I47dbc769a316b17a38b6c21d7a1294d7ff977491 --- core/java/android/app/ActivityThread.java | 13 +++---------- core/java/android/app/backup/BackupAgent.java | 14 -------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index e50432eaa2998..35890c811428b 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4335,17 +4335,10 @@ public final class ActivityThread extends ClientTransactionHandler private String getBackupAgentName(CreateBackupAgentData data) { String agentName = data.appInfo.backupAgentName; - if (!UserHandle.isCore(data.appInfo.uid) - && data.operationType == BackupManager.OperationType.MIGRATION) { - // If this is a migration, use the default backup agent regardless of the app's - // preferences. + // full backup operation but no app-supplied agent? use the default implementation + if (agentName == null && (data.backupMode == ApplicationThreadConstants.BACKUP_MODE_FULL + || data.backupMode == ApplicationThreadConstants.BACKUP_MODE_RESTORE_FULL)) { agentName = DEFAULT_FULL_BACKUP_AGENT; - } else { - // full backup operation but no app-supplied agent? use the default implementation - if (agentName == null && (data.backupMode == ApplicationThreadConstants.BACKUP_MODE_FULL - || data.backupMode == ApplicationThreadConstants.BACKUP_MODE_RESTORE_FULL)) { - agentName = DEFAULT_FULL_BACKUP_AGENT; - } } return agentName; } diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java index 94a4fde0131ec..084191016f8d2 100644 --- a/core/java/android/app/backup/BackupAgent.java +++ b/core/java/android/app/backup/BackupAgent.java @@ -544,11 +544,6 @@ public abstract class BackupAgent extends ContextWrapper { } private Set getExtraExcludeDirsIfAny(Context context) throws IOException { - if (isDeviceToDeviceMigration()) { - return Collections.emptySet(); - } - - // If this is not a migration, also exclude no-backup and cache dirs. Set excludedDirs = new HashSet<>(); excludedDirs.add(context.getCacheDir().getCanonicalPath()); excludedDirs.add(context.getCodeCacheDir().getCanonicalPath()); @@ -556,10 +551,6 @@ public abstract class BackupAgent extends ContextWrapper { return Collections.unmodifiableSet(excludedDirs); } - private boolean isDeviceToDeviceMigration() { - return mOperationType == OperationType.MIGRATION; - } - /** @hide */ @VisibleForTesting public IncludeExcludeRules getIncludeExcludeRules(FullBackup.BackupScheme backupScheme) @@ -905,11 +896,6 @@ public abstract class BackupAgent extends ContextWrapper { } private boolean isFileEligibleForRestore(File destination) throws IOException { - if (isDeviceToDeviceMigration()) { - // Everything is eligible for device-to-device migration. - return true; - } - FullBackup.BackupScheme bs = FullBackup.getBackupScheme(this, mOperationType); if (!bs.isFullRestoreEnabled()) { if (Log.isLoggable(FullBackup.TAG_XML_PARSER, Log.VERBOSE)) {