Don't update quota for non-emulated volumes.

Since they don't support quota. Also, don't throw an exception if we
can't find a volume for the passed-in path, but warn instead: the volume
may be unstable and have disappeared by the time we do this.

Bug: 152618535
Test: boot emulated image; verify no crashes when inserting media on
      public storage
Change-Id: I0e6b8f5c9f9f35b80b7bd5f6255a70e210a30474
This commit is contained in:
Martijn Coenen
2020-04-20 15:08:36 +02:00
parent ddb33e9daf
commit 1b981a3aea

View File

@@ -2447,7 +2447,12 @@ public class StorageManager {
final String filePath = path.getCanonicalPath();
final StorageVolume volume = getStorageVolume(path);
if (volume == null) {
throw new IllegalStateException("Failed to update quota type for " + filePath);
Log.w(TAG, "Failed to update quota type for " + filePath);
return;
}
if (!volume.isEmulated()) {
// We only support quota tracking on emulated filesystems
return;
}
final int userId = volume.getOwner().getIdentifier();