DivestOS/Patches/LineageOS-17.1/android_frameworks_base/399084.patch

101 lines
5.2 KiB
Diff

From fdc2deb5be6920d00e8c3fbc84fc0f158a0d3c55 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 02e348309fff1..c08667a02b4b1 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 5f53b2a40a49e..29c580da327f0 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 1f3c3a46792a6..9c46b23d8df87 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -2201,9 +2201,9 @@ public Context createPackageContextAsUser(String packageName, int flags, UserHan
}
@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 713287d26f80c..c161f81835844 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -5216,7 +5216,7 @@ public Context createPackageContextAsUser(
@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 f7cd51e7ffbca..7993ea192424b 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -885,8 +885,8 @@ public Context createPackageContextAsUser(String packageName, int flags, UserHan
/** @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 fcd4701c76307..5053ceedc7031 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -758,7 +758,7 @@ public Context createPackageContextAsUser(String packageName, int flags, UserHan
/** {@hide} */
@Override
- public Context createContextAsUser(UserHandle user) {
+ public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) {
throw new UnsupportedOperationException();
}