From b09a630d6305f168e8e1dd6b7dec4eca30d0ec6d Mon Sep 17 00:00:00 2001 From: Anton Philippov Date: Mon, 24 Apr 2017 11:07:54 +0100 Subject: [PATCH] Call removeMessages() only for certain operations in BackupManagerService#handleCancel() Only remove messages of types OP_TYPE_BACKUP_WAIT and OP_TYPE_RESTORE_WAIT, since OP_TYPE_BACKUP cannot time out and doesn't require cancellation. This will prevent some unncecessary (false) warnings in logcat. Bug: 36570881 Test: manual Change-Id: I72ecf98438fff18616354b04638b7db5c943aa61 --- .../com/android/server/backup/BackupManagerService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index aa5083dfeb15c..3eddc77b4840a 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -2625,8 +2625,12 @@ public class BackupManagerService { // Can't delete op from mCurrentOperations here. waitUntilOperationComplete may be // called after we receive cancel here. We need this op's state there. - // Remove all pending timeout messages for this operation type. - mBackupHandler.removeMessages(getMessageIdForOperationType(op.type)); + // Remove all pending timeout messages of types OP_TYPE_BACKUP_WAIT and + // OP_TYPE_RESTORE_WAIT. On the other hand, OP_TYPE_BACKUP cannot time out and + // doesn't require cancellation. + if (op.type == OP_TYPE_BACKUP_WAIT || op.type == OP_TYPE_RESTORE_WAIT) { + mBackupHandler.removeMessages(getMessageIdForOperationType(op.type)); + } } mCurrentOpLock.notifyAll(); }