Expose APIs used by CtsPermissionTestCases
Test: atest CtsPermissionTestCases
Bug: 77604428
Change-Id: Ib5e9b678e98aab86dac90610ed071eb89f14fce9
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 7424862..b8cc665 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -317,6 +317,7 @@
/** @hide Any app start foreground service. */
public static final int OP_START_FOREGROUND = 76;
/** @hide */
+ @TestApi
public static final int _NUM_OP = 77;
/** Access to coarse location information. */
@@ -1376,6 +1377,7 @@
* Retrieve the permission associated with an operation, or null if there is not one.
* @hide
*/
+ @TestApi
public static String opToPermission(int op) {
return sOpPerms[op];
}
@@ -1394,6 +1396,7 @@
* to the corresponding app op.
* @hide
*/
+ @TestApi
public static int permissionToOpCode(String permission) {
Integer boxedOpCode = sPermToOp.get(permission);
return boxedOpCode != null ? boxedOpCode : OP_NONE;
@@ -1993,6 +1996,7 @@
/**
* {@hide}
*/
+ @TestApi
public static int strOpToOp(String op) {
Integer val = sOpStrToOp.get(op);
if (val == null) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index ede7ee4..64998a3 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -729,6 +729,7 @@
* 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
public abstract String getOpPackageName();
/** Return the full application info for this context's package. */
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 4d4f31d..66ebbdb 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -145,6 +145,7 @@
* "it's system", because of isolated UIDs. Use {@link #isCore} for that.
* @hide
*/
+ @TestApi
public static boolean isApp(int uid) {
if (uid > 0) {
final int appId = getAppId(uid);
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index c94da9a..f7409d0 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -20,6 +20,7 @@
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
+import android.annotation.TestApi;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -5050,6 +5051,7 @@
*
* @hide
*/
+ @TestApi
public static final Uri CORP_CONTENT_URI =
Uri.withAppendedPath(AUTHORITY_URI, "raw_contact_entities_corp");
@@ -6057,6 +6059,7 @@
*
* @hide
*/
+ @TestApi
public static final Uri ENTERPRISE_CONTENT_URI =
Uri.withAppendedPath(Data.ENTERPRISE_CONTENT_URI, "phones");
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index da494d4..637fff0 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -726,7 +726,7 @@
android:description="@string/permdesc_receiveMms"
android:protectionLevel="dangerous" />
- <!-- Allows an application to read previously received cell broadcast
+ <!-- @TestApi Allows an application to read previously received cell broadcast
messages and to register a content observer to get notifications when
a cell broadcast has been received and added to the database. For
emergency alerts, the database is updated immediately after the
@@ -3324,7 +3324,7 @@
<permission android:name="android.permission.OBSERVE_APP_USAGE"
android:protectionLevel="signature|privileged" />
- <!-- @hide @SystemApi Allows an application to change the app idle state of an app.
+ <!-- @hide @TestApi @SystemApi Allows an application to change the app idle state of an app.
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.CHANGE_APP_IDLE_STATE"
android:protectionLevel="signature|privileged" />
@@ -3550,7 +3550,7 @@
<permission android:name="android.permission.UPDATE_LOCK"
android:protectionLevel="signature|privileged" />
- <!-- @SystemApi Allows an application to read the current set of notifications, including
+ <!-- @SystemApi @TestApi Allows an application to read the current set of notifications, including
any metadata and intents attached.
@hide -->
<permission android:name="android.permission.ACCESS_NOTIFICATIONS"