From f9ebfc9af0968fff10bd5536bc7b54d26446777d Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Sat, 23 Mar 2019 11:54:43 -0600 Subject: Helper methods for constructing MediaStore Uris. Bug: 128787096 Test: atest MediaProviderTests Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: I2848feb616df1c4df0b1bb71544769f61b9d84e8 --- core/java/android/provider/MediaStore.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index 368ba3c1de30..20d3c9139bbe 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -1380,6 +1380,11 @@ public final class MediaStore { .appendPath("downloads").build(); } + /** @hide */ + public static @NonNull Uri getContentUri(@NonNull String volumeName, long id) { + return ContentUris.withAppendedId(getContentUri(volumeName), id); + } + /** @hide */ public static @NonNull Uri getContentUriForPath(@NonNull String path) { return getContentUri(getVolumeName(new File(path))); @@ -1752,6 +1757,11 @@ public final class MediaStore { .appendPath("media").build(); } + /** @hide */ + public static @NonNull Uri getContentUri(@NonNull String volumeName, long id) { + return ContentUris.withAppendedId(getContentUri(volumeName), id); + } + /** * The content:// style URI for the internal storage. */ @@ -2240,6 +2250,11 @@ public final class MediaStore { .appendPath("media").build(); } + /** @hide */ + public static @NonNull Uri getContentUri(@NonNull String volumeName, long id) { + return ContentUris.withAppendedId(getContentUri(volumeName), id); + } + /** * Get the content:// style URI for the given audio media file. * @@ -3018,6 +3033,11 @@ public final class MediaStore { .appendPath("media").build(); } + /** @hide */ + public static @NonNull Uri getContentUri(@NonNull String volumeName, long id) { + return ContentUris.withAppendedId(getContentUri(volumeName), id); + } + /** * The content:// style URI for the internal storage. */ -- cgit v1.2.3-59-g8ed1b