diff options
| author | Martijn Coenen <maco@google.com> | 2020-04-20 15:08:36 +0200 |
|---|---|---|
| committer | Martijn Coenen <maco@google.com> | 2020-04-21 12:51:47 +0200 |
| commit | 1b981a3aea4e5011f070108ed0f307f134e22cb9 (patch) | |
| tree | c10844c19ed646e56af1038018d3227bf25c89cc /core/java/android | |
| parent | ddb33e9daf28c60aa275c73588fd9b334bc085e0 (diff) | |
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
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/storage/StorageManager.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index aee32ed769ac..a1a11ed54609 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -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(); |
