From ebb8450cd06c8506406c483f2b10716b6e0fc87b Mon Sep 17 00:00:00 2001 From: "Garfield, Tan" Date: Mon, 25 Jul 2016 09:59:34 -0700 Subject: [PATCH] DO NOT MERGE: Change the order of 2 statements to remove race. When we finish action mode we access to the cursor of model in main thread to remove selection. When we transfer documents we have a GetDocumentsTask that access the cursor in background. This creates a race condition that contaminates the final copy result. Temporary solution is to finish action mode first and then transfer documents so that when GetDocumentsTask is running action mode is already finished. Permanent solution is provided as part of ag/1138398 which removes GetDocumentsTask. Bug: 30082168 Change-Id: I5bffe2093a58c856044026913d038f80a3fd7d55 --- .../src/com/android/documentsui/dirlist/DirectoryFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java index 47df940bb1b51..b7c0a9c1be1b2 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java @@ -664,10 +664,10 @@ public class DirectoryFragment extends Fragment return true; case R.id.menu_copy_to: - transferDocuments(selection, FileOperationService.OPERATION_COPY); // TODO: Only finish selection mode if copy-to is not canceled. // Need to plum down into handling the way we do with deleteDocuments. mode.finish(); + transferDocuments(selection, FileOperationService.OPERATION_COPY); return true; case R.id.menu_move_to: