am 69abccc3: Merge "MediaStore.Audio.Media.getContentUriForPath() returns unexpected content"
# By Jan Bjernler # Via Gerrit Code Review * commit '69abccc3cdacee354dec8867865a0577a4e14e63': MediaStore.Audio.Media.getContentUriForPath() returns unexpected content
This commit is contained in:
@@ -1324,6 +1324,18 @@ public final class MediaStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final class Media implements AudioColumns {
|
public static final class Media implements AudioColumns {
|
||||||
|
|
||||||
|
private static final String[] EXTERNAL_PATHS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
String secondary_storage = System.getenv("SECONDARY_STORAGE");
|
||||||
|
if (secondary_storage != null) {
|
||||||
|
EXTERNAL_PATHS = secondary_storage.split(":");
|
||||||
|
} else {
|
||||||
|
EXTERNAL_PATHS = new String[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the content:// style URI for the audio media table on the
|
* Get the content:// style URI for the audio media table on the
|
||||||
* given volume.
|
* given volume.
|
||||||
@@ -1337,6 +1349,12 @@ public final class MediaStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getContentUriForPath(String path) {
|
public static Uri getContentUriForPath(String path) {
|
||||||
|
for (String ep : EXTERNAL_PATHS) {
|
||||||
|
if (path.startsWith(ep)) {
|
||||||
|
return EXTERNAL_CONTENT_URI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (path.startsWith(Environment.getExternalStorageDirectory().getPath()) ?
|
return (path.startsWith(Environment.getExternalStorageDirectory().getPath()) ?
|
||||||
EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI);
|
EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user