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

am: c1da324980

Change-Id: I3cb6ae4fda47ee82e608f3c7ab64ffedc5c65f1e
This commit is contained in:
Ruslan Tkhakokhov
2019-04-30 10:06:23 -07:00
committed by android-build-merger

View File

@@ -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");
}
}
}