From c99603520ed1ff55f227456611b3f14a5f1afc50 Mon Sep 17 00:00:00 2001 From: Zim Date: Wed, 19 Aug 2020 10:39:55 +0100 Subject: [PATCH] Avoid notifying the FUSE daemon for invisible volumes Invisible volumes/USB OTG volumes are neither exposed to apps nor the MediaStore. Calling into the FUSE daemon for invisible volumes can lead to unexpected exceptions if the MediaProvider tries to get more information about the StorageVolume from the StorageManagerService Test: Manual Bug: 163679723 Change-Id: I9e5e3418c1da15e61942fbedcf440ecca6cdca8c --- .../com/android/server/storage/StorageSessionController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/storage/StorageSessionController.java b/services/core/java/com/android/server/storage/StorageSessionController.java index 6dc1d6921dbb7..0abeac890df1e 100644 --- a/services/core/java/com/android/server/storage/StorageSessionController.java +++ b/services/core/java/com/android/server/storage/StorageSessionController.java @@ -336,11 +336,12 @@ public final class StorageSessionController { } /** - * Returns {@code true} if {@code vol} is an emulated or public volume, + * Returns {@code true} if {@code vol} is an emulated or visible public volume, * {@code false} otherwise **/ public static boolean isEmulatedOrPublic(VolumeInfo vol) { - return vol.type == VolumeInfo.TYPE_EMULATED || vol.type == VolumeInfo.TYPE_PUBLIC; + return vol.type == VolumeInfo.TYPE_EMULATED + || (vol.type == VolumeInfo.TYPE_PUBLIC && vol.isVisible()); } /** Exception thrown when communication with the {@link ExternalStorageService} fails. */