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

Commit a91fa8b2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Increase timeout for ADB backup/restore of SharedStorage."

parents 6c2f7870 25c50f98
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -3866,9 +3866,14 @@ public class BackupManagerService implements BackupManagerServiceInterface {
                        writeApkToBackup(mPackage, output);
                        writeApkToBackup(mPackage, output);
                    }
                    }
                    final boolean isSharedStorage =
                            mPackage.packageName.equals(SHARED_BACKUP_AGENT_PACKAGE);
                    final long timeout = isSharedStorage ?
                            TIMEOUT_SHARED_BACKUP_INTERVAL : TIMEOUT_FULL_BACKUP_INTERVAL;
                    if (DEBUG) Slog.d(TAG, "Calling doFullBackup() on " + mPackage.packageName);
                    if (DEBUG) Slog.d(TAG, "Calling doFullBackup() on " + mPackage.packageName);
                    prepareOperationTimeout(mToken, TIMEOUT_FULL_BACKUP_INTERVAL,
                    prepareOperationTimeout(mToken, timeout, mTimeoutMonitor /* in parent class */,
                            mTimeoutMonitor /* in parent class */, OP_TYPE_BACKUP_WAIT);
                            OP_TYPE_BACKUP_WAIT);
                    mAgent.doFullBackup(mPipe, mQuota, mToken, mBackupManagerBinder);
                    mAgent.doFullBackup(mPipe, mQuota, mToken, mBackupManagerBinder);
                } catch (IOException e) {
                } catch (IOException e) {
                    Slog.e(TAG, "Error running full backup for " + mPackage.packageName);
                    Slog.e(TAG, "Error running full backup for " + mPackage.packageName);
@@ -7554,9 +7559,12 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                        if (okay) {
                        if (okay) {
                            boolean agentSuccess = true;
                            boolean agentSuccess = true;
                            long toCopy = info.size;
                            long toCopy = info.size;
                            final boolean isSharedStorage = pkg.equals(SHARED_BACKUP_AGENT_PACKAGE);
                            final long timeout = isSharedStorage ?
                                    TIMEOUT_SHARED_BACKUP_INTERVAL : TIMEOUT_RESTORE_INTERVAL;
                            final int token = generateRandomIntegerToken();
                            final int token = generateRandomIntegerToken();
                            try {
                            try {
                                prepareOperationTimeout(token, TIMEOUT_RESTORE_INTERVAL, null,
                                prepareOperationTimeout(token, timeout, null,
                                        OP_TYPE_RESTORE_WAIT);
                                        OP_TYPE_RESTORE_WAIT);
                                if (FullBackup.OBB_TREE_TOKEN.equals(info.domain)) {
                                if (FullBackup.OBB_TREE_TOKEN.equals(info.domain)) {
                                    if (DEBUG) Slog.d(TAG, "Restoring OBB file for " + pkg
                                    if (DEBUG) Slog.d(TAG, "Restoring OBB file for " + pkg
+1 −1
Original line number Original line Diff line number Diff line
@@ -212,7 +212,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
    // Timeout intervals for agent backup & restore operations
    // Timeout intervals for agent backup & restore operations
    public static final long TIMEOUT_BACKUP_INTERVAL = 30 * 1000;
    public static final long TIMEOUT_BACKUP_INTERVAL = 30 * 1000;
    public static final long TIMEOUT_FULL_BACKUP_INTERVAL = 5 * 60 * 1000;
    public static final long TIMEOUT_FULL_BACKUP_INTERVAL = 5 * 60 * 1000;
    private static final long TIMEOUT_SHARED_BACKUP_INTERVAL = 30 * 60 * 1000;
    public static final long TIMEOUT_SHARED_BACKUP_INTERVAL = 30 * 60 * 1000;
    public static final long TIMEOUT_RESTORE_INTERVAL = 60 * 1000;
    public static final long TIMEOUT_RESTORE_INTERVAL = 60 * 1000;
    public static final long TIMEOUT_RESTORE_FINISHED_INTERVAL = 30 * 1000;
    public static final long TIMEOUT_RESTORE_FINISHED_INTERVAL = 30 * 1000;


+8 −1
Original line number Original line Diff line number Diff line
@@ -120,13 +120,20 @@ public class FullBackupEngine {
                    writeApkToBackup(mPackage, output);
                    writeApkToBackup(mPackage, output);
                }
                }


                final boolean isSharedStorage =
                        mPackage.packageName.equals(
                                RefactoredBackupManagerService.SHARED_BACKUP_AGENT_PACKAGE);
                final long timeout = isSharedStorage ?
                        RefactoredBackupManagerService.TIMEOUT_SHARED_BACKUP_INTERVAL :
                        RefactoredBackupManagerService.TIMEOUT_FULL_BACKUP_INTERVAL;

                if (RefactoredBackupManagerService.DEBUG) {
                if (RefactoredBackupManagerService.DEBUG) {
                    Slog.d(RefactoredBackupManagerService.TAG,
                    Slog.d(RefactoredBackupManagerService.TAG,
                            "Calling doFullBackup() on " + mPackage.packageName);
                            "Calling doFullBackup() on " + mPackage.packageName);
                }
                }
                backupManagerService
                backupManagerService
                        .prepareOperationTimeout(mToken,
                        .prepareOperationTimeout(mToken,
                                RefactoredBackupManagerService.TIMEOUT_FULL_BACKUP_INTERVAL,
                                timeout,
                                mTimeoutMonitor /* in parent class */,
                                mTimeoutMonitor /* in parent class */,
                                RefactoredBackupManagerService.OP_TYPE_BACKUP_WAIT);
                                RefactoredBackupManagerService.OP_TYPE_BACKUP_WAIT);
                mAgent.doFullBackup(mPipe, mQuota, mToken,
                mAgent.doFullBackup(mPipe, mQuota, mToken,
+6 −1
Original line number Original line Diff line number Diff line
@@ -373,9 +373,14 @@ public class FullRestoreEngine extends RestoreEngine {
                    if (okay) {
                    if (okay) {
                        boolean agentSuccess = true;
                        boolean agentSuccess = true;
                        long toCopy = info.size;
                        long toCopy = info.size;
                        final boolean isSharedStorage = pkg.equals(
                                RefactoredBackupManagerService.SHARED_BACKUP_AGENT_PACKAGE);
                        final long timeout = isSharedStorage ?
                                RefactoredBackupManagerService.TIMEOUT_SHARED_BACKUP_INTERVAL :
                                RefactoredBackupManagerService.TIMEOUT_RESTORE_INTERVAL;
                        try {
                        try {
                            backupManagerService.prepareOperationTimeout(token,
                            backupManagerService.prepareOperationTimeout(token,
                                    RefactoredBackupManagerService.TIMEOUT_FULL_BACKUP_INTERVAL,
                                    timeout,
                                    mMonitorTask,
                                    mMonitorTask,
                                    RefactoredBackupManagerService.OP_TYPE_RESTORE_WAIT);
                                    RefactoredBackupManagerService.OP_TYPE_RESTORE_WAIT);