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

Commit a050ab34 authored by Ruslan Tkhakokhov's avatar Ruslan Tkhakokhov Committed by android-build-merger
Browse files

Merge "Restore can begin while clearing app data is in progress" into qt-dev am: c1da3249

am: b5a044d8

Change-Id: Ide10099cb4671e12e87f71e65813f1575fbe1798
parents 7a7fd9d8 b5a044d8
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -234,8 +234,10 @@ public class UserBackupManagerService {
    // CPU on bring-up and increase time-to-UI.
    private static final long INITIALIZATION_DELAY_MILLIS = 3000;

    // Timeout interval for deciding that a bind or clear-data has taken too long
    private static final long TIMEOUT_INTERVAL = 10 * 1000;
    // Timeout interval for deciding that a bind has taken too long.
    private static final long BIND_TIMEOUT_INTERVAL = 10 * 1000;
    // Timeout interval for deciding that a clear-data has taken too long.
    private static final long CLEAR_DATA_TIMEOUT_INTERVAL = 30 * 1000;

    // User confirmation timeout for a full backup/restore operation.  It's this long in
    // order to give them time to enter the backup password.
@@ -1449,7 +1451,7 @@ public class UserBackupManagerService {

                    // success; wait for the agent to arrive
                    // only wait 10 seconds for the bind to happen
                    long timeoutMark = System.currentTimeMillis() + TIMEOUT_INTERVAL;
                    long timeoutMark = System.currentTimeMillis() + BIND_TIMEOUT_INTERVAL;
                    while (mConnecting && mConnectedAgent == null
                            && (System.currentTimeMillis() < timeoutMark)) {
                        try {
@@ -1554,16 +1556,22 @@ public class UserBackupManagerService {
                // can't happen because the activity manager is in this process
            }

            // only wait 10 seconds for the clear data to happen
            long timeoutMark = System.currentTimeMillis() + TIMEOUT_INTERVAL;
            // Only wait 30 seconds for the clear data to happen.
            long timeoutMark = System.currentTimeMillis() + CLEAR_DATA_TIMEOUT_INTERVAL;
            while (mClearingData && (System.currentTimeMillis() < timeoutMark)) {
                try {
                    mClearDataLock.wait(5000);
                } catch (InterruptedException e) {
                    // won't happen, but still.
                    mClearingData = false;
                    Slog.w(TAG, "Interrupted while waiting for " + packageName
                            + " data to be cleared", e);
                }
            }

            if (mClearingData) {
                Slog.w(TAG, "Clearing app data for " + packageName + " timed out");
            }
        }
    }