AML: Make Context#getOpPackageName() public

Bug: 119748678
Test: build
Change-Id: I79f7d057df5b61fa661987d36f20d24825eb1e5b
diff --git a/api/current.txt b/api/current.txt
index abd3c31..4ff67ad 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9546,6 +9546,7 @@
     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 @@
     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 1c01cf1..9e01eda 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -300,16 +300,11 @@
 
   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 cec8ef5..ff57b03 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -741,16 +741,22 @@
     /** 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 7842a1c..5b58dd5 100644
--- a/test-mock/api/current.txt
+++ b/test-mock/api/current.txt
@@ -80,6 +80,7 @@
     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 f1ec000..8b2c815 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);