diff options
author | 2016-07-21 11:10:44 -0700 | |
---|---|---|
committer | 2016-07-21 23:47:20 +0000 | |
commit | 1427fb74a37c34b56391f0fd791406258f3ce91c (patch) | |
tree | 227d30c77285dee374b3d08e94cb605b9e0d752d | |
parent | e94a30b9bef504e300dcae8a078c516e640b8822 (diff) |
Handle partial clip files by showing a failure notification.
Bug: 30221384
Change-Id: Ib32b6b5ca5b8f7be887b8f35b80daeeb33770cbe
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/services/CopyJob.java | 7 | ||||
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/services/DeleteJob.java | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/services/CopyJob.java b/packages/DocumentsUI/src/com/android/documentsui/services/CopyJob.java index c8f6a64e9a18..8eabbe41f666 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/services/CopyJob.java +++ b/packages/DocumentsUI/src/com/android/documentsui/services/CopyJob.java @@ -273,6 +273,8 @@ class CopyJob extends Job { try { final ContentResolver resolver = appContext.getContentResolver(); final Iterable<Uri> uris = srcs.getUris(appContext); + + int docProcessed = 0; for (Uri uri : uris) { DocumentInfo doc = DocumentInfo.fromUri(resolver, uri); if (canCopy(doc, stack.root)) { @@ -280,11 +282,16 @@ class CopyJob extends Job { } else { onFileFailed(doc); } + ++docProcessed; if (isCanceled()) { return; } } + + // If docProcessed is different than the count claimed by UrisSupplier, add the number + // to failedFileCount. + failedFileCount += (srcs.getItemCount() - docProcessed); } catch(IOException e) { failedFileCount += srcs.getItemCount(); throw new ResourceException("Failed to open the list of docs to copy.", e); diff --git a/packages/DocumentsUI/src/com/android/documentsui/services/DeleteJob.java b/packages/DocumentsUI/src/com/android/documentsui/services/DeleteJob.java index 64bc1a78f2de..5a36818369db 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/services/DeleteJob.java +++ b/packages/DocumentsUI/src/com/android/documentsui/services/DeleteJob.java @@ -120,6 +120,10 @@ final class DeleteJob extends Job { ++mDocsProcessed; } + + // If mDocProcessed is different than the count claimed by UrisSupplier, add the number + // to failedFileCount. + failedFileCount += (this.srcs.getItemCount() - mDocsProcessed); Metrics.logFileOperation(service, operationType, srcs, null); } catch(IOException e) { Log.e(TAG, "Failed to get list of docs or parent source.", e); |