Merge "Expose PermissionManager as TestApi and fix SplitPermissionInfo equality" into qt-dev
am: d703395fcb
Change-Id: Id965c774d70ad823de8f32d0e63b6d0ce0471754
diff --git a/api/test-current.txt b/api/test-current.txt
index 309ad4d..83e47c7 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -646,6 +646,7 @@
method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
field public static final String BUGREPORT_SERVICE = "bugreport";
field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
+ field public static final String PERMISSION_SERVICE = "permission";
field public static final String ROLLBACK_SERVICE = "rollback";
field public static final String STATUS_BAR_SERVICE = "statusbar";
field public static final String TEST_NETWORK_SERVICE = "test_network";
@@ -2214,6 +2215,18 @@
method public abstract void onRevokeRuntimePermissions(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>>);
}
+ public final class PermissionManager {
+ method @IntRange(from=0) @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public int getRuntimePermissionsVersion();
+ method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions();
+ method @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public void setRuntimePermissionsVersion(@IntRange(from=0) int);
+ }
+
+ public static final class PermissionManager.SplitPermissionInfo {
+ method @NonNull public java.util.List<java.lang.String> getNewPermissions();
+ method @NonNull public String getSplitPermission();
+ method public int getTargetSdk();
+ }
+
public final class RuntimePermissionPresentationInfo implements android.os.Parcelable {
ctor public RuntimePermissionPresentationInfo(@NonNull CharSequence, boolean, boolean);
method public int describeContents();
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 941eda8..529677a 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4126,6 +4126,7 @@
* @see #getSystemService(String)
* @hide
*/
+ @TestApi
@SystemApi
public static final String PERMISSION_SERVICE = "permission";
diff --git a/core/java/android/permission/PermissionManager.java b/core/java/android/permission/PermissionManager.java
index e15659d..182a2ff 100644
--- a/core/java/android/permission/PermissionManager.java
+++ b/core/java/android/permission/PermissionManager.java
@@ -39,6 +39,7 @@
*
* @hide
*/
+@TestApi
@SystemApi
@SystemService(Context.PERMISSION_SERVICE)
public final class PermissionManager {
@@ -140,12 +141,13 @@
if (o == null || getClass() != o.getClass()) return false;
SplitPermissionInfo that = (SplitPermissionInfo) o;
return mTargetSdk == that.mTargetSdk
- && Objects.equals(mSplitPerm, that.mSplitPerm);
+ && mSplitPerm.equals(that.mSplitPerm)
+ && mNewPerms.equals(that.mNewPerms);
}
@Override
public int hashCode() {
- return Objects.hash(mSplitPerm, mTargetSdk);
+ return Objects.hash(mSplitPerm, mNewPerms, mTargetSdk);
}
/**