diff options
author | 2024-01-22 17:09:45 -0800 | |
---|---|---|
committer | 2024-01-24 10:18:31 -0800 | |
commit | d9d56047f3dc04c70e543f40ffa82581049a43de (patch) | |
tree | ce9f601997235b8cfa676778e2ca29474e708196 | |
parent | b354559c5103d24c4669617e603d020581c9e1d9 (diff) |
[ECM] Add RequiresPermission annotations
We've recently created a new permission:
MANAGE_ENHANCED_CONFIRMATION_STATES
The EnhancedConfirmationManager API should be gated by this permission.
So, add the RequiresPermission annotations.
Bug: 320512579
Test: presubmit
Change-Id: Ia04678c8049e46bdd27ae24dd23e7c842e240c63
-rw-r--r-- | framework-s/api/system-current.txt | 6 | ||||
-rw-r--r-- | framework-s/java/android/app/ecm/EnhancedConfirmationManager.java | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/framework-s/api/system-current.txt b/framework-s/api/system-current.txt index e8d1b8992..02ab5b562 100644 --- a/framework-s/api/system-current.txt +++ b/framework-s/api/system-current.txt @@ -2,10 +2,10 @@ package android.app.ecm { @FlaggedApi("android.permission.flags.enhanced_confirmation_mode_apis_enabled") public final class EnhancedConfirmationManager { - method public void clearRestriction(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; + method @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public void clearRestriction(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; method @NonNull public android.app.PendingIntent getRestrictedSettingDialogIntent(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; - method public boolean isClearRestrictionAllowed(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; - method public boolean isRestricted(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; + method @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public boolean isClearRestrictionAllowed(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; + method @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public boolean isRestricted(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException; } } diff --git a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java index 4f1edb092..c8ef3fe0c 100644 --- a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java +++ b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java @@ -18,6 +18,7 @@ package android.app.ecm; import android.annotation.FlaggedApi; import android.annotation.IntDef; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TargetApi; @@ -245,6 +246,7 @@ public final class EnhancedConfirmationManager { * @return {@code true} if the setting is restricted from the app * @throws NameNotFoundException if the provided package was not found */ + @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public boolean isRestricted(@NonNull String packageName, @NonNull String settingIdentifier) throws NameNotFoundException { return isSettingEcmProtected(settingIdentifier) && isPackageEcmGuarded(packageName); @@ -260,6 +262,7 @@ public final class EnhancedConfirmationManager { * @param packageName package name of the application to remove protection from * @throws NameNotFoundException if the provided package was not found */ + @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public void clearRestriction(@NonNull String packageName) throws NameNotFoundException { if (!isClearRestrictionAllowed(packageName)) { throw new IllegalStateException("Clear restriction attempted but not allowed"); @@ -279,6 +282,7 @@ public final class EnhancedConfirmationManager { * restrictions from the provided app * @throws NameNotFoundException if the provided package was not found */ + @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public boolean isClearRestrictionAllowed(@NonNull String packageName) throws NameNotFoundException { int state = getAppEcmState(packageName); @@ -296,6 +300,7 @@ public final class EnhancedConfirmationManager { * * @hide */ + @RequiresPermission(android.Manifest.permission.MANAGE_ENHANCED_CONFIRMATION_STATES) public void setClearRestrictionAllowed(@NonNull String packageName) throws NameNotFoundException { if (isPackageEcmGuarded(packageName)) { |