From 64c342d2253d4d4fc419c634883eb24f847fef36 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 37df5481d3c4b..0d059ae389e9c 100644 --- a/services/core/java/com/android/server/storage/StorageSessionController.java +++ b/services/core/java/com/android/server/storage/StorageSessionController.java @@ -338,11 +338,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. */