Merge "Make getStorageVolume(File file) public." into nyc-dev

This commit is contained in:
Felipe Leme
2016-04-12 20:44:05 +00:00
committed by Android (Google) Code Review
4 changed files with 10 additions and 1 deletions

View File

@@ -29584,6 +29584,7 @@ package android.os.storage {
public class StorageManager {
method public java.lang.String getMountedObbPath(java.lang.String);
method public android.os.storage.StorageVolume getPrimaryStorageVolume();
method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
method public java.util.List<android.os.storage.StorageVolume> getStorageVolumes();
method public boolean isEncrypted(java.io.File);
method public boolean isObbMounted(java.lang.String);

View File

@@ -31890,6 +31890,7 @@ package android.os.storage {
public class StorageManager {
method public java.lang.String getMountedObbPath(java.lang.String);
method public android.os.storage.StorageVolume getPrimaryStorageVolume();
method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
method public java.util.List<android.os.storage.StorageVolume> getStorageVolumes();
method public boolean isEncrypted(java.io.File);
method public boolean isObbMounted(java.lang.String);

View File

@@ -29653,6 +29653,7 @@ package android.os.storage {
public class StorageManager {
method public java.lang.String getMountedObbPath(java.lang.String);
method public android.os.storage.StorageVolume getPrimaryStorageVolume();
method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
method public java.util.List<android.os.storage.StorageVolume> getStorageVolumes();
method public boolean isEncrypted(java.io.File);
method public boolean isObbMounted(java.lang.String);

View File

@@ -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) {