Merge "Move message ids to BackupHandler."

This commit is contained in:
Artem Iglikov
2017-05-03 10:13:20 +00:00
committed by Android (Google) Code Review
9 changed files with 104 additions and 79 deletions

View File

@@ -18,6 +18,22 @@ package com.android.server.backup;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_BACKUP_IN_FOREGROUND;
import static com.android.server.backup.internal.BackupHandler.MSG_BACKUP_OPERATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_FULL_CONFIRMATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_OP_COMPLETE;
import static com.android.server.backup.internal.BackupHandler.MSG_REQUEST_BACKUP;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_RETRY_CLEAR;
import static com.android.server.backup.internal.BackupHandler.MSG_RETRY_INIT;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_ADB_BACKUP;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_ADB_RESTORE;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_BACKUP;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_CLEAR;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_INITIALIZE;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_RESTORE;
import static com.android.server.backup.internal.BackupHandler.MSG_SCHEDULE_BACKUP_PACKAGE;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.AppGlobals;
@@ -189,27 +205,6 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
public static final String RUN_BACKUP_ACTION = "android.app.backup.intent.RUN";
public static final String RUN_INITIALIZE_ACTION = "android.app.backup.intent.INIT";
public static final int MSG_RUN_BACKUP = 1;
public static final int MSG_RUN_ADB_BACKUP = 2;
public static final int MSG_RUN_RESTORE = 3;
public static final int MSG_RUN_CLEAR = 4;
public static final int MSG_RUN_INITIALIZE = 5;
public static final int MSG_RUN_GET_RESTORE_SETS = 6;
public static final int MSG_RESTORE_SESSION_TIMEOUT = 8;
public static final int MSG_FULL_CONFIRMATION_TIMEOUT = 9;
public static final int MSG_RUN_ADB_RESTORE = 10;
public static final int MSG_RETRY_INIT = 11;
public static final int MSG_RETRY_CLEAR = 12;
public static final int MSG_WIDGET_BROADCAST = 13;
public static final int MSG_RUN_FULL_TRANSPORT_BACKUP = 14;
public static final int MSG_REQUEST_BACKUP = 15;
public static final int MSG_SCHEDULE_BACKUP_PACKAGE = 16;
public static final int MSG_BACKUP_OPERATION_TIMEOUT = 17;
public static final int MSG_RESTORE_OPERATION_TIMEOUT = 18;
// backup task state machine tick
public static final int MSG_BACKUP_RESTORE_STEP = 20;
public static final int MSG_OP_COMPLETE = 21;
// Timeout interval for deciding that a bind or clear-data has taken too long
private static final long TIMEOUT_INTERVAL = 10 * 1000;

View File

@@ -55,6 +55,27 @@ import java.util.HashSet;
*/
public class BackupHandler extends Handler {
public static final int MSG_RUN_BACKUP = 1;
public static final int MSG_RUN_ADB_BACKUP = 2;
public static final int MSG_RUN_RESTORE = 3;
public static final int MSG_RUN_CLEAR = 4;
public static final int MSG_RUN_INITIALIZE = 5;
public static final int MSG_RUN_GET_RESTORE_SETS = 6;
public static final int MSG_RESTORE_SESSION_TIMEOUT = 8;
public static final int MSG_FULL_CONFIRMATION_TIMEOUT = 9;
public static final int MSG_RUN_ADB_RESTORE = 10;
public static final int MSG_RETRY_INIT = 11;
public static final int MSG_RETRY_CLEAR = 12;
public static final int MSG_WIDGET_BROADCAST = 13;
public static final int MSG_RUN_FULL_TRANSPORT_BACKUP = 14;
public static final int MSG_REQUEST_BACKUP = 15;
public static final int MSG_SCHEDULE_BACKUP_PACKAGE = 16;
public static final int MSG_BACKUP_OPERATION_TIMEOUT = 17;
public static final int MSG_RESTORE_OPERATION_TIMEOUT = 18;
// backup task state machine tick
public static final int MSG_BACKUP_RESTORE_STEP = 20;
public static final int MSG_OP_COMPLETE = 21;
private RefactoredBackupManagerService backupManagerService;
public BackupHandler(
@@ -66,7 +87,7 @@ public class BackupHandler extends Handler {
public void handleMessage(Message msg) {
switch (msg.what) {
case RefactoredBackupManagerService.MSG_RUN_BACKUP: {
case MSG_RUN_BACKUP: {
backupManagerService.setLastBackupPass(System.currentTimeMillis());
IBackupTransport transport =
@@ -117,8 +138,7 @@ public class BackupHandler extends Handler {
backupManagerService, transport, dirName, queue,
oldJournal, null, null, Collections.<String>emptyList(), false,
false /* nonIncremental */);
Message pbtMessage = obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, pbt);
Message pbtMessage = obtainMessage(MSG_BACKUP_RESTORE_STEP, pbt);
sendMessage(pbtMessage);
} catch (Exception e) {
// unable to ask the transport its dir name -- transient failure, since
@@ -144,7 +164,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP: {
case MSG_BACKUP_RESTORE_STEP: {
try {
BackupRestoreTask task = (BackupRestoreTask) msg.obj;
if (RefactoredBackupManagerService.MORE_DEBUG) {
@@ -159,7 +179,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_OP_COMPLETE: {
case MSG_OP_COMPLETE: {
try {
Pair<BackupRestoreTask, Long> taskWithResult =
(Pair<BackupRestoreTask, Long>) msg.obj;
@@ -171,7 +191,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_RUN_ADB_BACKUP: {
case MSG_RUN_ADB_BACKUP: {
// TODO: refactor full backup to be a looper-based state machine
// similar to normal backup/restore.
AdbBackupParams params = (AdbBackupParams) msg.obj;
@@ -185,13 +205,13 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_RUN_FULL_TRANSPORT_BACKUP: {
case MSG_RUN_FULL_TRANSPORT_BACKUP: {
PerformFullTransportBackupTask task = (PerformFullTransportBackupTask) msg.obj;
(new Thread(task, "transport-backup")).start();
break;
}
case RefactoredBackupManagerService.MSG_RUN_RESTORE: {
case MSG_RUN_RESTORE: {
RestoreParams params = (RestoreParams) msg.obj;
Slog.d(RefactoredBackupManagerService.TAG,
"MSG_RUN_RESTORE observer=" + params.observer);
@@ -215,15 +235,14 @@ public class BackupHandler extends Handler {
Slog.d(RefactoredBackupManagerService.TAG, "Starting restore.");
}
backupManagerService.setRestoreInProgress(true);
Message restoreMsg = obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, task);
Message restoreMsg = obtainMessage(MSG_BACKUP_RESTORE_STEP, task);
sendMessage(restoreMsg);
}
}
break;
}
case RefactoredBackupManagerService.MSG_RUN_ADB_RESTORE: {
case MSG_RUN_ADB_RESTORE: {
// TODO: refactor full restore to be a looper-based state machine
// similar to normal backup/restore.
AdbRestoreParams params = (AdbRestoreParams) msg.obj;
@@ -235,21 +254,21 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_RUN_CLEAR: {
case MSG_RUN_CLEAR: {
ClearParams params = (ClearParams) msg.obj;
(new PerformClearTask(backupManagerService, params.transport,
params.packageInfo)).run();
break;
}
case RefactoredBackupManagerService.MSG_RETRY_CLEAR: {
case MSG_RETRY_CLEAR: {
// reenqueues if the transport remains unavailable
ClearRetryParams params = (ClearRetryParams) msg.obj;
backupManagerService.clearBackupData(params.transportName, params.packageName);
break;
}
case RefactoredBackupManagerService.MSG_RUN_INITIALIZE: {
case MSG_RUN_INITIALIZE: {
HashSet<String> queue;
// Snapshot the pending-init queue and work on that
@@ -262,7 +281,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_RETRY_INIT: {
case MSG_RETRY_INIT: {
synchronized (backupManagerService.getQueueLock()) {
backupManagerService.recordInitPendingLocked(msg.arg1 != 0, (String) msg.obj);
backupManagerService.getAlarmManager().set(AlarmManager.RTC_WAKEUP,
@@ -272,7 +291,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_RUN_GET_RESTORE_SETS: {
case MSG_RUN_GET_RESTORE_SETS: {
// Like other async operations, this is entered with the wakelock held
RestoreSet[] sets = null;
RestoreGetSetsParams params = (RestoreGetSetsParams) msg.obj;
@@ -302,9 +321,9 @@ public class BackupHandler extends Handler {
}
// Done: reset the session timeout clock
removeMessages(RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
removeMessages(MSG_RESTORE_SESSION_TIMEOUT);
sendEmptyMessageDelayed(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT,
MSG_RESTORE_SESSION_TIMEOUT,
RefactoredBackupManagerService.TIMEOUT_RESTORE_INTERVAL);
backupManagerService.getWakelock().release();
@@ -312,15 +331,15 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_BACKUP_OPERATION_TIMEOUT:
case RefactoredBackupManagerService.MSG_RESTORE_OPERATION_TIMEOUT: {
case MSG_BACKUP_OPERATION_TIMEOUT:
case MSG_RESTORE_OPERATION_TIMEOUT: {
Slog.d(RefactoredBackupManagerService.TAG,
"Timeout message received for token=" + Integer.toHexString(msg.arg1));
backupManagerService.handleCancel(msg.arg1, false);
break;
}
case RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT: {
case MSG_RESTORE_SESSION_TIMEOUT: {
synchronized (backupManagerService) {
if (backupManagerService.getActiveRestoreSession() != null) {
// Client app left the restore session dangling. We know that it
@@ -338,7 +357,7 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_FULL_CONFIRMATION_TIMEOUT: {
case MSG_FULL_CONFIRMATION_TIMEOUT: {
synchronized (backupManagerService.getAdbBackupRestoreConfirmations()) {
AdbParams params = backupManagerService.getAdbBackupRestoreConfirmations().get(
msg.arg1);
@@ -368,13 +387,13 @@ public class BackupHandler extends Handler {
break;
}
case RefactoredBackupManagerService.MSG_WIDGET_BROADCAST: {
case MSG_WIDGET_BROADCAST: {
final Intent intent = (Intent) msg.obj;
backupManagerService.getContext().sendBroadcastAsUser(intent, UserHandle.SYSTEM);
break;
}
case RefactoredBackupManagerService.MSG_REQUEST_BACKUP: {
case MSG_REQUEST_BACKUP: {
BackupParams params = (BackupParams) msg.obj;
if (RefactoredBackupManagerService.MORE_DEBUG) {
Slog.d(RefactoredBackupManagerService.TAG,
@@ -392,13 +411,12 @@ public class BackupHandler extends Handler {
params.transport, params.dirName,
kvQueue, null, params.observer, params.monitor, params.fullPackages, true,
params.nonIncrementalBackup);
Message pbtMessage = obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, pbt);
Message pbtMessage = obtainMessage(MSG_BACKUP_RESTORE_STEP, pbt);
sendMessage(pbtMessage);
break;
}
case RefactoredBackupManagerService.MSG_SCHEDULE_BACKUP_PACKAGE: {
case MSG_SCHEDULE_BACKUP_PACKAGE: {
String pkgName = (String) msg.obj;
if (RefactoredBackupManagerService.MORE_DEBUG) {
Slog.d(RefactoredBackupManagerService.TAG,

View File

@@ -16,6 +16,9 @@
package com.android.server.backup.internal;
import static com.android.server.backup.internal.BackupHandler.MSG_BACKUP_OPERATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_BACKUP_RESTORE_STEP;
import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
import android.app.backup.BackupDataInput;
@@ -322,7 +325,7 @@ public class PerformBackupTask implements BackupRestoreTask {
// backup callback and returned. Blow away the lingering (spurious)
// pending timeout message for it.
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_BACKUP_OPERATION_TIMEOUT);
MSG_BACKUP_OPERATION_TIMEOUT);
}
}
@@ -846,8 +849,7 @@ public class PerformBackupTask implements BackupRestoreTask {
BackupManagerMonitor.EXTRA_LOG_ILLEGAL_KEY,
key));
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService
.MSG_BACKUP_OPERATION_TIMEOUT);
MSG_BACKUP_OPERATION_TIMEOUT);
BackupObserverUtils
.sendBackupOnPackageResult(mObserver, pkgName,
BackupManager.ERROR_AGENT_FAILURE);
@@ -885,8 +887,7 @@ public class PerformBackupTask implements BackupRestoreTask {
"operationComplete(): sending data to transport for "
+ pkgName);
}
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_BACKUP_OPERATION_TIMEOUT);
backupManagerService.getBackupHandler().removeMessages(MSG_BACKUP_OPERATION_TIMEOUT);
clearAgentState();
backupManagerService.addBackupTrace("operation complete");
@@ -1115,7 +1116,7 @@ public class PerformBackupTask implements BackupRestoreTask {
backupManagerService.addBackupTrace("executeNextState => " + nextState);
mCurrentState = nextState;
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, this);
MSG_BACKUP_RESTORE_STEP, this);
backupManagerService.getBackupHandler().sendMessage(msg);
}
}

View File

@@ -16,6 +16,8 @@
package com.android.server.backup.internal;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_BACKUP;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -66,7 +68,7 @@ public class RunBackupReceiver extends BroadcastReceiver {
backupManagerService.getWakelock().acquire();
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_BACKUP);
MSG_RUN_BACKUP);
backupManagerService.getBackupHandler().sendMessage(msg);
} else {
Slog.i(RefactoredBackupManagerService.TAG,

View File

@@ -16,6 +16,8 @@
package com.android.server.backup.internal;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_INITIALIZE;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -44,7 +46,7 @@ public class RunInitializeReceiver extends BroadcastReceiver {
backupManagerService.getWakelock().acquire();
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_INITIALIZE);
MSG_RUN_INITIALIZE);
backupManagerService.getBackupHandler().sendMessage(msg);
}
}

View File

@@ -16,6 +16,10 @@
package com.android.server.backup.restore;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_GET_RESTORE_SETS;
import static com.android.server.backup.internal.BackupHandler.MSG_RUN_RESTORE;
import android.app.backup.IBackupManagerMonitor;
import android.app.backup.IRestoreObserver;
import android.app.backup.IRestoreSession;
@@ -87,13 +91,12 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
// We know we're doing legit work now, so halt the timeout
// until we're done. It gets started again when the result
// comes in.
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
backupManagerService.getBackupHandler().removeMessages(MSG_RESTORE_SESSION_TIMEOUT);
// spin off the transport request to our service thread
backupManagerService.getWakelock().acquire();
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_GET_RESTORE_SETS,
MSG_RUN_GET_RESTORE_SETS,
new RestoreGetSetsParams(mRestoreTransport, this, observer,
monitor));
backupManagerService.getBackupHandler().sendMessage(msg);
@@ -150,7 +153,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
if (token == mRestoreSets[i].token) {
// Real work, so stop the session timeout until we finalize the restore
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
MSG_RESTORE_SESSION_TIMEOUT);
long oldId = Binder.clearCallingIdentity();
backupManagerService.getWakelock().acquire();
@@ -158,7 +161,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
Slog.d(TAG, "restoreAll() kicking off");
}
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_RESTORE);
MSG_RUN_RESTORE);
msg.obj = new RestoreParams(mRestoreTransport, dirName,
observer, monitor, token);
backupManagerService.getBackupHandler().sendMessage(msg);
@@ -243,7 +246,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
if (token == mRestoreSets[i].token) {
// Stop the session timeout until we finalize the restore
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
MSG_RESTORE_SESSION_TIMEOUT);
long oldId = Binder.clearCallingIdentity();
backupManagerService.getWakelock().acquire();
@@ -251,7 +254,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
Slog.d(TAG, "restoreSome() of " + packages.length + " packages");
}
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_RESTORE);
MSG_RUN_RESTORE);
msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, monitor,
token, packages, packages.length > 1);
backupManagerService.getBackupHandler().sendMessage(msg);
@@ -341,16 +344,14 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
}
// Stop the session timeout until we finalize the restore
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
backupManagerService.getBackupHandler().removeMessages(MSG_RESTORE_SESSION_TIMEOUT);
// Ready to go: enqueue the restore request and claim success
backupManagerService.getWakelock().acquire();
if (RefactoredBackupManagerService.MORE_DEBUG) {
Slog.d(TAG, "restorePackage() : " + packageName);
}
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_RUN_RESTORE);
Message msg = backupManagerService.getBackupHandler().obtainMessage(MSG_RUN_RESTORE);
msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, monitor,
token, app);
backupManagerService.getBackupHandler().sendMessage(msg);

View File

@@ -16,6 +16,8 @@
package com.android.server.backup.restore;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
import android.app.backup.FullBackup;
@@ -489,7 +491,7 @@ public class FullRestoreEngine extends RestoreEngine {
Slog.w(RefactoredBackupManagerService.TAG,
"Agent failure restoring " + pkg + "; ending restore");
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_OPERATION_TIMEOUT);
MSG_RESTORE_OPERATION_TIMEOUT);
tearDownPipes();
tearDownAgent(mTargetApp);
mAgent = null;

View File

@@ -16,6 +16,8 @@
package com.android.server.backup.restore;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
import android.app.backup.FullBackup;
@@ -722,7 +724,7 @@ public class PerformAdbRestoreTask implements Runnable {
"Agent failure restoring " + pkg + "; now ignoring");
}
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_OPERATION_TIMEOUT);
MSG_RESTORE_OPERATION_TIMEOUT);
tearDownPipes();
tearDownAgent(mTargetApp, false);
mPackagePolicies.put(pkg, RestorePolicy.IGNORE);

View File

@@ -16,6 +16,10 @@
package com.android.server.backup.restore;
import static com.android.server.backup.internal.BackupHandler.MSG_BACKUP_RESTORE_STEP;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_SESSION_TIMEOUT;
import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
import android.app.backup.BackupDataInput;
@@ -392,7 +396,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
// synchronous we also know that we should cancel the pending timeout
// message.
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_OPERATION_TIMEOUT);
MSG_RESTORE_OPERATION_TIMEOUT);
// Verify that the backup set includes metadata. If not, we can't do
// signature/version verification etc, so we simply do not proceed with
@@ -409,7 +413,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
"Package manager restore metadata missing");
mStatus = BackupTransport.TRANSPORT_ERROR;
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, this);
MSG_BACKUP_RESTORE_STEP, this);
executeNextState(UnifiedRestoreState.FINAL);
return;
}
@@ -427,7 +431,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
BackupManagerMonitor.LOG_EVENT_CATEGORY_TRANSPORT, null);
mStatus = BackupTransport.TRANSPORT_ERROR;
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, this);
MSG_BACKUP_RESTORE_STEP, this);
executeNextState(UnifiedRestoreState.FINAL);
return;
}
@@ -1072,8 +1076,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
}
// Clear any ongoing session timeout.
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT);
backupManagerService.getBackupHandler().removeMessages(MSG_RESTORE_SESSION_TIMEOUT);
// If we have a PM token, we must under all circumstances be sure to
// handshake when we've finished.
@@ -1089,7 +1092,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
// We were invoked via an active restore session, not by the Package
// Manager, so start up the session timeout again.
backupManagerService.getBackupHandler().sendEmptyMessageDelayed(
RefactoredBackupManagerService.MSG_RESTORE_SESSION_TIMEOUT,
MSG_RESTORE_SESSION_TIMEOUT,
RefactoredBackupManagerService.TIMEOUT_RESTORE_INTERVAL);
}
@@ -1116,7 +1119,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
PerformUnifiedRestoreTask task = backupManagerService.getPendingRestores().remove();
backupManagerService.getBackupHandler().sendMessage(
backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, task));
MSG_BACKUP_RESTORE_STEP, task));
} else {
backupManagerService.setRestoreInProgress(false);
@@ -1215,8 +1218,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
// The caller is responsible for reestablishing the state machine; our
// responsibility here is to clear the decks for whatever comes next.
backupManagerService.getBackupHandler().removeMessages(
RefactoredBackupManagerService.MSG_RESTORE_OPERATION_TIMEOUT, this);
backupManagerService.getBackupHandler().removeMessages(MSG_RESTORE_OPERATION_TIMEOUT, this);
}
@Override
@@ -1306,7 +1308,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
}
mState = nextState;
Message msg = backupManagerService.getBackupHandler().obtainMessage(
RefactoredBackupManagerService.MSG_BACKUP_RESTORE_STEP, this);
MSG_BACKUP_RESTORE_STEP, this);
backupManagerService.getBackupHandler().sendMessage(msg);
}