undeprecate getApplicationRestrictions
Keep getApplicationRestrictions which only returns restrictions set by
the DPC admin, apps wishing to retrieve app restrictions set by all
admins can call RestrictionsManager#getApplicationRestrictionsPerAdmin
Bug: 271108424
Test: N/A
Change-Id: I0aeb2afe9161bbe418598e8b53843a664766ae67
diff --git a/core/api/current.txt b/core/api/current.txt
index eced9aa..02de1cd 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -11404,7 +11404,7 @@
public class RestrictionsManager {
method public static android.os.Bundle convertRestrictionsToBundle(java.util.List<android.content.RestrictionEntry>);
method public android.content.Intent createLocalApprovalIntent();
- method @Deprecated public android.os.Bundle getApplicationRestrictions();
+ method public android.os.Bundle getApplicationRestrictions();
method @NonNull @WorkerThread public java.util.List<android.os.Bundle> getApplicationRestrictionsPerAdmin();
method public java.util.List<android.content.RestrictionEntry> getManifestRestrictions(String);
method public boolean hasRestrictionsProvider();
@@ -33867,7 +33867,7 @@
public class UserManager {
method public static android.content.Intent createUserCreationIntent(@Nullable String, @Nullable String, @Nullable String, @Nullable android.os.PersistableBundle);
- method @Deprecated @WorkerThread public android.os.Bundle getApplicationRestrictions(String);
+ method @WorkerThread public android.os.Bundle getApplicationRestrictions(String);
method public long getSerialNumberForUser(android.os.UserHandle);
method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.CREATE_USERS"}) public int getUserCount();
method public long getUserCreationTime(android.os.UserHandle);
diff --git a/core/java/android/content/RestrictionsManager.java b/core/java/android/content/RestrictionsManager.java
index 8115292..44a84e4 100644
--- a/core/java/android/content/RestrictionsManager.java
+++ b/core/java/android/content/RestrictionsManager.java
@@ -427,11 +427,12 @@
* @return the application restrictions as a Bundle. Returns null if there
* are no restrictions.
*
- * @deprecated Use {@link #getApplicationRestrictionsPerAdmin} instead.
- * Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, it is
- * possible for there to be multiple managing agents on the device with the ability to set
- * restrictions. This API will only to return the restrictions set by device policy controllers
- * (DPCs)
+ * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
+ * it is possible for there to be multiple managing apps on the device with the ability to set
+ * restrictions, e.g. a Device Policy Controller (DPC) and a Supervision admin.
+ * This API will only return the restrictions set by the DPCs. To retrieve restrictions
+ * set by all managing apps, use
+ * {@link android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
*
* @see DevicePolicyManager
*/
@@ -453,8 +454,8 @@
* stable between multiple calls.
*
* <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
- * it is possible for there to be multiple managing agents on the device with the ability to set
- * restrictions, e.g. an Enterprise DPC and a Supervision admin.
+ * it is possible for there to be multiple managing apps on the device with the ability to set
+ * restrictions, e.g. an Enterprise Device Policy Controller (DPC) and a Supervision admin.
*
* <p>Each {@link Bundle} consists of key-value pairs, as defined by the application,
* where the types of values may be:
@@ -471,6 +472,7 @@
* package. Returns an empty {@link List} if there are no saved restrictions.
*
* @see UserManager#KEY_RESTRICTIONS_PENDING
+ * @see DevicePolicyManager
*/
@WorkerThread
@UserHandleAware
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 290f929..86e678d 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -5601,16 +5601,15 @@
*
* @see #KEY_RESTRICTIONS_PENDING
*
- * @deprecated Use
+ * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
+ * it is possible for there to be multiple managing apps on the device with the ability to set
+ * restrictions, e.g. an Enterprise Device Policy Controller (DPC) and a Supervision admin.
+ * This API will only to return the restrictions set by the DPCs. To retrieve restrictions
+ * set by all managing apps, use
* {@link android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
- * Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, it is
- * possible for there to be multiple managing agents on the device with the ability to set
- * restrictions. This API will only to return the restrictions set by device policy controllers
- * (DPCs)
*
* @see DevicePolicyManager
*/
- @Deprecated
@WorkerThread
@UserHandleAware(enabledSinceTargetSdkVersion = Build.VERSION_CODES.TIRAMISU)
public Bundle getApplicationRestrictions(String packageName) {
@@ -5623,12 +5622,15 @@
}
/**
- * @deprecated Use
+ * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
+ * it is possible for there to be multiple managing apps on the device with the ability to set
+ * restrictions, e.g. an Enterprise Device Policy Controller (DPC) and a Supervision admin.
+ * This API will only to return the restrictions set by the DPCs. To retrieve restrictions
+ * set by all managing apps, use
* {@link android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
*
* @hide
*/
- @Deprecated
@WorkerThread
public Bundle getApplicationRestrictions(String packageName, UserHandle user) {
try {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index cc40363..fdc2aff 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -5865,20 +5865,24 @@
}
/**
- * @deprecated Use {@link
- * android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
+ * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
+ * it is possible for there to be multiple managing agents on the device with the ability to set
+ * restrictions, e.g. an Enterprise DPC and a Supervision admin. This API will only to return
+ * the restrictions set by the DPCs. To retrieve restrictions set by all agents, use
+ * {@link android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
*/
- @Deprecated
@Override
public Bundle getApplicationRestrictions(String packageName) {
return getApplicationRestrictionsForUser(packageName, UserHandle.getCallingUserId());
}
/**
- * @deprecated Use {@link
- * android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
+ * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
+ * it is possible for there to be multiple managing agents on the device with the ability to set
+ * restrictions, e.g. an Enterprise DPC and a Supervision admin. This API will only to return
+ * the restrictions set by the DPCs. To retrieve restrictions set by all agents, use
+ * {@link android.content.RestrictionsManager#getApplicationRestrictionsPerAdmin} instead.
*/
- @Deprecated
@Override
public Bundle getApplicationRestrictionsForUser(String packageName, @UserIdInt int userId) {
if (UserHandle.getCallingUserId() != userId