Merge "[RefactoredBMS] Offload the mRunningFullBackupTask.handleCancel() call from the main thread to another thread"
This commit is contained in:
committed by
Android (Google) Code Review
commit
676b3d2b5e
@@ -2119,14 +2119,26 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
|
||||
// so tear down any ongoing backup task right away.
|
||||
@Override
|
||||
public void endFullBackup() {
|
||||
synchronized (mQueueLock) {
|
||||
if (mRunningFullBackupTask != null) {
|
||||
if (DEBUG_SCHEDULING) {
|
||||
Slog.i(TAG, "Telling running backup to stop");
|
||||
// offload the mRunningFullBackupTask.handleCancel() call to another thread,
|
||||
// as we might have to wait for mCancelLock
|
||||
Runnable endFullBackupRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PerformFullTransportBackupTask pftbt = null;
|
||||
synchronized (mQueueLock) {
|
||||
if (mRunningFullBackupTask != null) {
|
||||
pftbt = mRunningFullBackupTask;
|
||||
}
|
||||
}
|
||||
if (pftbt != null) {
|
||||
if (DEBUG_SCHEDULING) {
|
||||
Slog.i(TAG, "Telling running backup to stop");
|
||||
}
|
||||
pftbt.handleCancel(true);
|
||||
}
|
||||
mRunningFullBackupTask.handleCancel(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
new Thread(endFullBackupRunnable, "end-full-backup").start();
|
||||
}
|
||||
|
||||
// Used by both incremental and full restore
|
||||
|
||||
Reference in New Issue
Block a user