diff options
| author | Felipe Leme <felipeal@google.com> | 2016-04-12 20:44:05 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-04-12 20:44:06 +0000 |
| commit | 93c442e44f3aa6bd7a27ef74770aeeb2dfb4880d (patch) | |
| tree | f6a6ad614a8c179800f3e4487128aa20289f3374 /core/java | |
| parent | 4db2f1f6020a82012bcd3141a22bd59e0baed1d5 (diff) | |
| parent | c250e45eda7ab38c88b3e5e7e302917cd001d3af (diff) | |
Merge "Make getStorageVolume(File file) public." into nyc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/storage/StorageManager.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index ece12280bb80..da215c61641a 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -824,7 +824,9 @@ public class StorageManager { } } - /** {@hide} */ + /** + * Return the {@link StorageVolume} that contains the given file, or {@code null} if none. + */ public @Nullable StorageVolume getStorageVolume(File file) { return getStorageVolume(getVolumeList(), file); } @@ -836,9 +838,13 @@ public class StorageManager { /** {@hide} */ private static @Nullable StorageVolume getStorageVolume(StorageVolume[] volumes, File file) { + if (file == null) { + return null; + } try { file = file.getCanonicalFile(); } catch (IOException ignored) { + Slog.d(TAG, "Could not get canonical path for " + file); return null; } for (StorageVolume volume : volumes) { |
