summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI
diff options
context:
space:
mode:
authorBen Kwa <kenobi@google.com>2015-05-27 21:34:10 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-05-27 21:34:10 +0000
commitc016b3ba7df9a4c85eac39e1cc353f1857d1a4a4 (patch)
tree91d28cc790c803b7f30970fbea82c0d1ab6bf602 /packages/DocumentsUI
parent2b5505ca2425b1fc92cdc4b1157ddf0bec97030a (diff)
parent7a3b2012ea4d079a50edb8aa101a353830219d29 (diff)
downloadframeworks_base-c016b3ba7df9a4c85eac39e1cc353f1857d1a4a4.zip
frameworks_base-c016b3ba7df9a4c85eac39e1cc353f1857d1a4a4.tar.gz
frameworks_base-c016b3ba7df9a4c85eac39e1cc353f1857d1a4a4.tar.bz2
am 7a3b2012: Merge "Ensure that the copy notification is always cancelable." into mnc-dev
* commit '7a3b2012ea4d079a50edb8aa101a353830219d29': Ensure that the copy notification is always cancelable.
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/CopyService.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/CopyService.java b/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
index 6e050c6..506ec58 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
@@ -173,8 +173,6 @@ public class CopyService extends IntentService {
.setAutoCancel(true);
mNotificationManager.notify(mJobId, 0, errorBuilder.build());
}
-
- // TODO: Display a toast if the copy was cancelled.
}
}
@@ -306,13 +304,15 @@ public class CopyService extends IntentService {
private void handleCancel(Intent intent) {
final String cancelledId = intent.getStringExtra(EXTRA_CANCEL);
// Do nothing if the cancelled ID doesn't match the current job ID. This prevents racey
- // cancellation requests from affecting unrelated copy jobs.
- if (Objects.equals(mJobId, cancelledId)) {
+ // cancellation requests from affecting unrelated copy jobs. However, if the current job ID
+ // is null, the service most likely crashed and was revived by the incoming cancel intent.
+ // In that case, always allow the cancellation to proceed.
+ if (Objects.equals(mJobId, cancelledId) || mJobId == null) {
// Set the cancel flag. This causes the copy loops to exit.
mIsCancelled = true;
// Dismiss the progress notification here rather than in the copy loop. This preserves
// interactivity for the user in case the copy loop is stalled.
- mNotificationManager.cancel(mJobId, 0);
+ mNotificationManager.cancel(cancelledId, 0);
}
}