summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jaewan Kim <jaewan@google.com> 2018-11-28 23:55:15 +0900
committer Jaewan Kim <jaewan@google.com> 2018-11-29 12:48:38 +0900
commit0980c7f092c8c0a30518c69e669378c1f13666e5 (patch)
tree5a8ad2c568837c37c947070b5e53c34a4f855c28
parent50f84e882913d3d1e140fa42d82fa046abc92eab (diff)
AML: Make Context#getOpPackageName() public
Bug: 119748678 Test: build Change-Id: I79f7d057df5b61fa661987d36f20d24825eb1e5b
-rw-r--r--api/current.txt2
-rw-r--r--api/test-current.txt5
-rw-r--r--core/java/android/content/Context.java20
-rw-r--r--test-mock/api/current.txt1
-rw-r--r--test-mock/api/test-current.txt4
5 files changed, 16 insertions, 16 deletions
diff --git a/api/current.txt b/api/current.txt
index abd3c312e7e6..4ff67add1363 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9546,6 +9546,7 @@ package android.content {
method public abstract java.io.File getNoBackupFilesDir();
method public abstract java.io.File getObbDir();
method public abstract java.io.File[] getObbDirs();
+ method public abstract java.lang.String getOpPackageName();
method public abstract java.lang.String getPackageCodePath();
method public abstract android.content.pm.PackageManager getPackageManager();
method public abstract java.lang.String getPackageName();
@@ -9756,6 +9757,7 @@ package android.content {
method public java.io.File getNoBackupFilesDir();
method public java.io.File getObbDir();
method public java.io.File[] getObbDirs();
+ method public java.lang.String getOpPackageName();
method public java.lang.String getPackageCodePath();
method public android.content.pm.PackageManager getPackageManager();
method public java.lang.String getPackageName();
diff --git a/api/test-current.txt b/api/test-current.txt
index 1c01cf1daf18..9e01edaeb358 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -300,16 +300,11 @@ package android.content {
public abstract class Context {
method public android.content.Context createPackageContextAsUser(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
- method public abstract java.lang.String getOpPackageName();
method public android.os.UserHandle getUser();
method public int getUserId();
method public void setAutofillCompatibilityEnabled(boolean);
}
- public class ContextWrapper extends android.content.Context {
- method public java.lang.String getOpPackageName();
- }
-
}
package android.content.pm {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index cec8ef59b961..ff57b0311d60 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -741,16 +741,22 @@ public abstract class Context {
/** Return the name of this application's package. */
public abstract String getPackageName();
- /** @hide Return the name of the base context this context is derived from. */
+ /**
+ * @hide Return the name of the base context this context is derived from.
+ * This is the same as {@link #getOpPackageName()} except in
+ * cases where system components are loaded into other app processes, in which
+ * case {@link #getOpPackageName()} will be the name of the primary package in
+ * that process (so that app ops uid verification will work with the name).
+ */
@UnsupportedAppUsage
public abstract String getBasePackageName();
- /** @hide Return the package name that should be used for app ops calls from
- * this context. This is the same as {@link #getBasePackageName()} except in
- * cases where system components are loaded into other app processes, in which
- * case this will be the name of the primary package in that process (so that app
- * ops uid verification will work with the name). */
- @TestApi
+ /**
+ * Return the package name that should be used for {@link android.app.AppOpsManager} calls from
+ * this context, so that app ops manager's uid verification will work with the name.
+ * <p>
+ * This is not generally intended for third party application developers.
+ */
public abstract String getOpPackageName();
/** Return the full application info for this context's package. */
diff --git a/test-mock/api/current.txt b/test-mock/api/current.txt
index 7842a1cd03b3..5b58dd5d758b 100644
--- a/test-mock/api/current.txt
+++ b/test-mock/api/current.txt
@@ -80,6 +80,7 @@ package android.test.mock {
method public java.io.File getNoBackupFilesDir();
method public java.io.File getObbDir();
method public java.io.File[] getObbDirs();
+ method public java.lang.String getOpPackageName();
method public java.lang.String getPackageCodePath();
method public android.content.pm.PackageManager getPackageManager();
method public java.lang.String getPackageName();
diff --git a/test-mock/api/test-current.txt b/test-mock/api/test-current.txt
index f1ec000dfa6a..8b2c815432ea 100644
--- a/test-mock/api/test-current.txt
+++ b/test-mock/api/test-current.txt
@@ -1,9 +1,5 @@
package android.test.mock {
- public class MockContext extends android.content.Context {
- method public java.lang.String getOpPackageName();
- }
-
public deprecated class MockPackageManager extends android.content.pm.PackageManager {
method public boolean arePermissionsIndividuallyControlled();
method public java.lang.String getDefaultBrowserPackageNameAsUser(int);