Explicitly take flags in createContextAsUser()
Bug: 142472686 Test: atest android.content.cts.ContextTest#testCreateContextAsUser Change-Id: Id2e3d5ffe5887a4916e0872a7e85d62cbb439744
This commit is contained in:
@@ -1358,7 +1358,7 @@ package android.content {
|
||||
|
||||
public abstract class Context {
|
||||
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public boolean bindServiceAsUser(@RequiresPermission android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle);
|
||||
method @NonNull public android.content.Context createContextAsUser(@NonNull android.os.UserHandle);
|
||||
method @NonNull public android.content.Context createContextAsUser(@NonNull android.os.UserHandle, int);
|
||||
method public abstract android.content.Context createCredentialProtectedStorageContext();
|
||||
method @NonNull public android.content.Context createPackageContextAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
method @Nullable public abstract java.io.File getPreloadsFileCache();
|
||||
|
||||
@@ -659,7 +659,7 @@ package android.content {
|
||||
}
|
||||
|
||||
public abstract class Context {
|
||||
method @NonNull public android.content.Context createContextAsUser(@NonNull android.os.UserHandle);
|
||||
method @NonNull public android.content.Context createContextAsUser(@NonNull android.os.UserHandle, int);
|
||||
method @NonNull public android.content.Context createPackageContextAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public abstract android.view.Display getDisplay();
|
||||
method public abstract int getDisplayId();
|
||||
|
||||
@@ -2212,9 +2212,9 @@ class ContextImpl extends Context {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context createContextAsUser(UserHandle user) {
|
||||
public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) {
|
||||
try {
|
||||
return createPackageContextAsUser(getPackageName(), mFlags, user);
|
||||
return createPackageContextAsUser(getPackageName(), flags, user);
|
||||
} catch (NameNotFoundException e) {
|
||||
throw new IllegalStateException("Own package not found: package=" + getPackageName());
|
||||
}
|
||||
|
||||
@@ -5237,7 +5237,7 @@ public abstract class Context {
|
||||
@SystemApi
|
||||
@TestApi
|
||||
@NonNull
|
||||
public Context createContextAsUser(@NonNull UserHandle user) {
|
||||
public Context createContextAsUser(@NonNull UserHandle user, @CreatePackageOptions int flags) {
|
||||
if (Build.IS_ENG) {
|
||||
throw new IllegalStateException("createContextAsUser not overridden!");
|
||||
}
|
||||
|
||||
@@ -885,8 +885,8 @@ public class ContextWrapper extends Context {
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public Context createContextAsUser(UserHandle user) {
|
||||
return mBase.createContextAsUser(user);
|
||||
public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) {
|
||||
return mBase.createContextAsUser(user, flags);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -758,7 +758,7 @@ public class MockContext extends Context {
|
||||
|
||||
/** {@hide} */
|
||||
@Override
|
||||
public Context createContextAsUser(UserHandle user) {
|
||||
public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user