Merge "Rename createContentUriAsUser to createContentUriForUser" into sc-dev

This commit is contained in:
Corina Grigoras
2021-04-13 16:43:00 +00:00
committed by Android (Google) Code Review
3 changed files with 4 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ package android.app.usage {
package android.content { package android.content {
public abstract class ContentProvider implements android.content.ComponentCallbacks2 { public abstract class ContentProvider implements android.content.ComponentCallbacks2 {
method @NonNull public static android.net.Uri createContentUriAsUser(@NonNull android.net.Uri, @NonNull android.os.UserHandle); method @NonNull public static android.net.Uri createContentUriForUser(@NonNull android.net.Uri, @NonNull android.os.UserHandle);
} }
public abstract class Context { public abstract class Context {

View File

@@ -2655,7 +2655,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
*/ */
@NonNull @NonNull
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static Uri createContentUriAsUser( public static Uri createContentUriForUser(
@NonNull Uri contentUri, @NonNull UserHandle userHandle) { @NonNull Uri contentUri, @NonNull UserHandle userHandle) {
if (!ContentResolver.SCHEME_CONTENT.equals(contentUri.getScheme())) { if (!ContentResolver.SCHEME_CONTENT.equals(contentUri.getScheme())) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(

View File

@@ -89,9 +89,9 @@ public class ContentProviderTest {
} }
@Test @Test
public void testCreateContentUriAsUser() { public void testCreateContentUriForUser() {
Uri uri = Uri.parse("content://com.example/foo/bar"); Uri uri = Uri.parse("content://com.example/foo/bar");
Uri expectedUri = Uri.parse("content://7@com.example/foo/bar"); Uri expectedUri = Uri.parse("content://7@com.example/foo/bar");
assertEquals(expectedUri, ContentProvider.createContentUriAsUser(uri, UserHandle.of(7))); assertEquals(expectedUri, ContentProvider.createContentUriForUser(uri, UserHandle.of(7)));
} }
} }