Merge "Better iteration over mCurrentOperations in cancelBackups"

This commit is contained in:
Shreyas Basarge
2017-02-16 16:42:55 +00:00
committed by Android (Google) Code Review

View File

@@ -2400,14 +2400,19 @@ public class BackupManagerService {
}
final long oldToken = Binder.clearCallingIdentity();
try {
List<Integer> operationsToCancel = new ArrayList<>();
synchronized (mCurrentOpLock) {
for (int i = 0; i < mCurrentOperations.size(); i++) {
Operation op = mCurrentOperations.valueAt(i);
int token = mCurrentOperations.keyAt(i);
if (op.type == OP_TYPE_BACKUP) {
handleCancel(token, true /* cancelAll */);
operationsToCancel.add(token);
}
}
for (Integer token : operationsToCancel) {
handleCancel(token, true /* cancelAll */);
}
}
// We don't want the backup jobs to kick in any time soon.