From 24cc2cea74f35b5118ef8b1247f1ac946c2a84ba Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 10 Jun 2016 11:30:56 -0700 Subject: Fixed check for visible volume. Previously it was checked if the volume was visible to user, but transient volumes (such as USB drives) are not marked as such. Fixes: 29174953 Change-Id: I5dbcc42c5b31c6856e01f73815d73482822785d9 --- .../documentsui/OpenExternalDirectoryActivity.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java b/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java index ddf87bbe6333..6588ee1c91c6 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/OpenExternalDirectoryActivity.java @@ -287,15 +287,16 @@ public class OpenExternalDirectoryActivity extends Activity { private static boolean isRightVolume(VolumeInfo volume, String root, int userId) { final File userPath = volume.getPathForUser(userId); final String path = userPath == null ? null : volume.getPathForUser(userId).getPath(); - final boolean isVisible = volume.isVisibleForWrite(userId); + final boolean isMounted = volume.isMountedReadable(); if (DEBUG) - Log.d(TAG, "Volume: " + volume + " userId: " + userId + " root: " + root - + " volumePath: " + volume.getPath() - + " pathForUser: " + path - + " internalPathForUser: " + volume.getInternalPath() - + " isVisible: " + isVisible); - - return isVisible && root.equals(path); + Log.d(TAG, "Volume: " + volume + + "\n\tuserId: " + userId + + "\n\tuserPath: " + userPath + + "\n\troot: " + root + + "\n\tpath: " + path + + "\n\tisMounted: " + isMounted); + + return isMounted && root.equals(path); } private static Uri getGrantedUriPermission(Context context, ContentProviderClient provider, -- cgit v1.2.3-59-g8ed1b