Skip to content

Commit 32ee831

Browse files
committed
Handle ISE when physical volume isn't mounted.
Bug: 7238149 Change-Id: I85081225a1a43a2c1b6f70b6275c6bbca0b3764e
1 parent 933a754 commit 32ee831

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

services/java/com/android/server/MountService.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,9 +1577,16 @@ public int[] getStorageUsers(String path) {
15771577

15781578
private void warnOnNotMounted() {
15791579
final StorageVolume primary = getPrimaryPhysicalVolume();
1580-
if (primary != null
1581-
&& Environment.MEDIA_MOUNTED.equals(getVolumeState(primary.getPath()))) {
1582-
Slog.w(TAG, "getSecureContainerList() called when storage not mounted");
1580+
if (primary != null) {
1581+
boolean mounted = false;
1582+
try {
1583+
mounted = Environment.MEDIA_MOUNTED.equals(getVolumeState(primary.getPath()));
1584+
} catch (IllegalStateException e) {
1585+
}
1586+
1587+
if (!mounted) {
1588+
Slog.w(TAG, "getSecureContainerList() called when storage not mounted");
1589+
}
15831590
}
15841591
}
15851592

0 commit comments

Comments
 (0)