mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 18:04:35 -05:00
7251c3f1d1
Signed-off-by: Tavi <tavi@divested.dev>
101 lines
5.1 KiB
Diff
101 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Makoto Onuki <omakoto@google.com>
|
|
Date: Fri, 11 Oct 2019 20:19:58 -0700
|
|
Subject: [PATCH] Explicitly take flags in createContextAsUser()
|
|
|
|
Bug: 142472686
|
|
Test: atest android.content.cts.ContextTest#testCreateContextAsUser
|
|
Change-Id: Id2e3d5ffe5887a4916e0872a7e85d62cbb439744
|
|
---
|
|
api/system-current.txt | 2 +-
|
|
api/test-current.txt | 2 +-
|
|
core/java/android/app/ContextImpl.java | 4 ++--
|
|
core/java/android/content/Context.java | 2 +-
|
|
core/java/android/content/ContextWrapper.java | 4 ++--
|
|
test-mock/src/android/test/mock/MockContext.java | 2 +-
|
|
6 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/api/system-current.txt b/api/system-current.txt
|
|
index 02e348309fff..c08667a02b4b 100644
|
|
--- a/api/system-current.txt
|
|
+++ b/api/system-current.txt
|
|
@@ -1346,7 +1346,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();
|
|
diff --git a/api/test-current.txt b/api/test-current.txt
|
|
index 5f53b2a40a49..29c580da327f 100644
|
|
--- a/api/test-current.txt
|
|
+++ b/api/test-current.txt
|
|
@@ -638,7 +638,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();
|
|
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
|
|
index 1f3c3a46792a..9c46b23d8df8 100644
|
|
--- a/core/java/android/app/ContextImpl.java
|
|
+++ b/core/java/android/app/ContextImpl.java
|
|
@@ -2201,9 +2201,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());
|
|
}
|
|
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
|
|
index 713287d26f80..c161f8183584 100644
|
|
--- a/core/java/android/content/Context.java
|
|
+++ b/core/java/android/content/Context.java
|
|
@@ -5216,7 +5216,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!");
|
|
}
|
|
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
|
|
index f7cd51e7ffbc..7993ea192424 100644
|
|
--- a/core/java/android/content/ContextWrapper.java
|
|
+++ b/core/java/android/content/ContextWrapper.java
|
|
@@ -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 */
|
|
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
|
|
index fcd4701c7630..5053ceedc703 100644
|
|
--- a/test-mock/src/android/test/mock/MockContext.java
|
|
+++ b/test-mock/src/android/test/mock/MockContext.java
|
|
@@ -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();
|
|
}
|
|
|