Avoid runtime restart when storage is missing.

When primary shared storage is completely missing, catch the thrown
exception and treat as if ejected.

Bug: 29461637
Change-Id: I8eb5cdeb01983efbf26da3d32ab19a6630662156
This commit is contained in:
Jeff Sharkey
2016-06-22 10:35:29 -06:00
parent a31460ce12
commit 11f197c3fe

View File

@@ -12526,13 +12526,12 @@ public class PackageManagerService extends IPackageManager.Stub {
}
if (mSuccess) {
final boolean mounted;
if (Environment.isExternalStorageEmulated()) {
mounted = true;
} else {
boolean mounted = false;
try {
final String status = Environment.getExternalStorageState();
mounted = (Environment.MEDIA_MOUNTED.equals(status)
|| Environment.MEDIA_MOUNTED_READ_ONLY.equals(status));
} catch (Exception e) {
}
if (mounted) {