Loading packages/LocalTransport/src/com/android/localtransport/LocalTransport.java +5 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class LocalTransport extends BackupTransport { private static final String INCREMENTAL_DIR = "_delta"; private static final String FULL_DATA_DIR = "_full"; private static final String DEVICE_NAME_FOR_D2D_RESTORE_SET = "D2D"; private static final String DEFAULT_DEVICE_NAME_FOR_RESTORE_SET = "flash"; // The currently-active restore set always has the same (nonzero!) token private static final long CURRENT_SET_TOKEN = 1; Loading Loading @@ -603,8 +605,10 @@ public class LocalTransport extends BackupTransport { existing[num++] = CURRENT_SET_TOKEN; RestoreSet[] available = new RestoreSet[num]; String deviceName = mParameters.isDeviceTransfer() ? DEVICE_NAME_FOR_D2D_RESTORE_SET : DEFAULT_DEVICE_NAME_FOR_RESTORE_SET; for (int i = 0; i < available.length; i++) { available[i] = new RestoreSet("Local disk image", "flash", existing[i]); available[i] = new RestoreSet("Local disk image", deviceName, existing[i]); } return available; } Loading services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java +16 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.backup.restore; import static android.app.backup.BackupManager.OperationType; import static com.android.server.backup.BackupManagerService.DEBUG; import static com.android.server.backup.BackupManagerService.MORE_DEBUG; import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT; Loading @@ -24,6 +26,7 @@ import static com.android.server.backup.internal.BackupHandler.MSG_RUN_RESTORE; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.backup.BackupManager; import android.app.backup.IBackupManagerMonitor; import android.app.backup.IRestoreObserver; import android.app.backup.IRestoreSession; Loading Loading @@ -51,6 +54,7 @@ import java.util.function.BiFunction; */ public class ActiveRestoreSession extends IRestoreSession.Stub { private static final String TAG = "RestoreSession"; private static final String DEVICE_NAME_FOR_D2D_SET = "D2D"; private final TransportManager mTransportManager; private final String mTransportName; Loading Loading @@ -174,6 +178,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { for (int i = 0; i < mRestoreSets.length; i++) { if (token == mRestoreSets[i].token) { final long oldId = Binder.clearCallingIdentity(); RestoreSet restoreSet = mRestoreSets[i]; try { return sendRestoreToHandlerLocked( (transportClient, listener) -> Loading @@ -183,7 +188,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { monitor, token, listener, mBackupEligibilityRules), getBackupEligibilityRules(restoreSet)), "RestoreSession.restoreAll()"); } finally { Binder.restoreCallingIdentity(oldId); Loading Loading @@ -266,6 +271,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { for (int i = 0; i < mRestoreSets.length; i++) { if (token == mRestoreSets[i].token) { final long oldId = Binder.clearCallingIdentity(); RestoreSet restoreSet = mRestoreSets[i]; try { return sendRestoreToHandlerLocked( (transportClient, listener) -> Loading @@ -277,7 +283,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { packages, /* isSystemRestore */ packages.length > 1, listener, mBackupEligibilityRules), getBackupEligibilityRules(restoreSet)), "RestoreSession.restorePackages(" + packages.length + " packages)"); } finally { Binder.restoreCallingIdentity(oldId); Loading @@ -290,6 +296,14 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { return -1; } private BackupEligibilityRules getBackupEligibilityRules(RestoreSet restoreSet) { // TODO(b/182986784): Remove device name comparison once a designated field for operation // type is added to RestoreSet object. int operationType = DEVICE_NAME_FOR_D2D_SET.equals(restoreSet.device) ? OperationType.MIGRATION : OperationType.BACKUP; return mBackupManagerService.getEligibilityRulesForOperation(operationType); } public synchronized int restorePackage(String packageName, IRestoreObserver observer, IBackupManagerMonitor monitor) { if (DEBUG) { Loading Loading
packages/LocalTransport/src/com/android/localtransport/LocalTransport.java +5 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class LocalTransport extends BackupTransport { private static final String INCREMENTAL_DIR = "_delta"; private static final String FULL_DATA_DIR = "_full"; private static final String DEVICE_NAME_FOR_D2D_RESTORE_SET = "D2D"; private static final String DEFAULT_DEVICE_NAME_FOR_RESTORE_SET = "flash"; // The currently-active restore set always has the same (nonzero!) token private static final long CURRENT_SET_TOKEN = 1; Loading Loading @@ -603,8 +605,10 @@ public class LocalTransport extends BackupTransport { existing[num++] = CURRENT_SET_TOKEN; RestoreSet[] available = new RestoreSet[num]; String deviceName = mParameters.isDeviceTransfer() ? DEVICE_NAME_FOR_D2D_RESTORE_SET : DEFAULT_DEVICE_NAME_FOR_RESTORE_SET; for (int i = 0; i < available.length; i++) { available[i] = new RestoreSet("Local disk image", "flash", existing[i]); available[i] = new RestoreSet("Local disk image", deviceName, existing[i]); } return available; } Loading
services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java +16 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.backup.restore; import static android.app.backup.BackupManager.OperationType; import static com.android.server.backup.BackupManagerService.DEBUG; import static com.android.server.backup.BackupManagerService.MORE_DEBUG; import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT; Loading @@ -24,6 +26,7 @@ import static com.android.server.backup.internal.BackupHandler.MSG_RUN_RESTORE; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.backup.BackupManager; import android.app.backup.IBackupManagerMonitor; import android.app.backup.IRestoreObserver; import android.app.backup.IRestoreSession; Loading Loading @@ -51,6 +54,7 @@ import java.util.function.BiFunction; */ public class ActiveRestoreSession extends IRestoreSession.Stub { private static final String TAG = "RestoreSession"; private static final String DEVICE_NAME_FOR_D2D_SET = "D2D"; private final TransportManager mTransportManager; private final String mTransportName; Loading Loading @@ -174,6 +178,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { for (int i = 0; i < mRestoreSets.length; i++) { if (token == mRestoreSets[i].token) { final long oldId = Binder.clearCallingIdentity(); RestoreSet restoreSet = mRestoreSets[i]; try { return sendRestoreToHandlerLocked( (transportClient, listener) -> Loading @@ -183,7 +188,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { monitor, token, listener, mBackupEligibilityRules), getBackupEligibilityRules(restoreSet)), "RestoreSession.restoreAll()"); } finally { Binder.restoreCallingIdentity(oldId); Loading Loading @@ -266,6 +271,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { for (int i = 0; i < mRestoreSets.length; i++) { if (token == mRestoreSets[i].token) { final long oldId = Binder.clearCallingIdentity(); RestoreSet restoreSet = mRestoreSets[i]; try { return sendRestoreToHandlerLocked( (transportClient, listener) -> Loading @@ -277,7 +283,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { packages, /* isSystemRestore */ packages.length > 1, listener, mBackupEligibilityRules), getBackupEligibilityRules(restoreSet)), "RestoreSession.restorePackages(" + packages.length + " packages)"); } finally { Binder.restoreCallingIdentity(oldId); Loading @@ -290,6 +296,14 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { return -1; } private BackupEligibilityRules getBackupEligibilityRules(RestoreSet restoreSet) { // TODO(b/182986784): Remove device name comparison once a designated field for operation // type is added to RestoreSet object. int operationType = DEVICE_NAME_FOR_D2D_SET.equals(restoreSet.device) ? OperationType.MIGRATION : OperationType.BACKUP; return mBackupManagerService.getEligibilityRulesForOperation(operationType); } public synchronized int restorePackage(String packageName, IRestoreObserver observer, IBackupManagerMonitor monitor) { if (DEBUG) { Loading