summaryrefslogtreecommitdiff
path: root/framework-s/java
diff options
context:
space:
mode:
author Nate Myren <ntmyren@google.com> 2024-12-19 15:42:02 -0800
committer Nate Myren <ntmyren@google.com> 2024-12-30 11:58:59 -0800
commit91adae30e12397c3f55c4c7e4e251da344f2e086 (patch)
treeb27c0c98a55cf951279cc75876e165a9f3b1ea69 /framework-s/java
parent2bd68623fd928b42cc7af6f7815b0b69ab965d1d (diff)
Block accessibility service enabling while in a call
This also adds a "reason" to the ecm dialog, to be used in determining which version of the dialog to show Bug: 364535720 Test: manual Flag: android.permission.flags.enhanced_confirmation_in_call_apis_enabled Relnote: 25Q2 feature work Change-Id: I4be7e63d616d80ac196e88524b2f4cbda2d0c405
Diffstat (limited to 'framework-s/java')
-rw-r--r--framework-s/java/android/app/ecm/EnhancedConfirmationManager.java24
-rw-r--r--framework-s/java/android/app/ecm/IEnhancedConfirmationManager.aidl2
2 files changed, 25 insertions, 1 deletions
diff --git a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
index db05a0af6..290388558 100644
--- a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
+++ b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java
@@ -33,6 +33,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.RemoteException;
+import android.os.UserHandle;
import android.permission.flags.Flags;
import android.util.ArraySet;
@@ -202,6 +203,19 @@ public final class EnhancedConfirmationManager {
public static final String ACTION_SHOW_ECM_RESTRICTED_SETTING_DIALOG =
"android.app.ecm.action.SHOW_ECM_RESTRICTED_SETTING_DIALOG";
+ /**
+ * The setting is restricted because of the phone state of the device
+ * @hide
+ */
+ public static final String REASON_PHONE_STATE = "phone_state";
+
+ /**
+ * The setting is restricted because the restricted app op is set for the given package
+ * @hide
+ */
+ public static final String REASON_APP_OP_RESTRICTED = "app_op_restricted";
+
+
/** A map of ECM states to their corresponding app op states */
@Retention(java.lang.annotation.RetentionPolicy.SOURCE)
@IntDef(prefix = {"ECM_STATE_"}, value = {EcmState.ECM_STATE_NOT_GUARDED,
@@ -349,8 +363,16 @@ public final class EnhancedConfirmationManager {
@NonNull String settingIdentifier) throws NameNotFoundException {
Intent intent = new Intent(ACTION_SHOW_ECM_RESTRICTED_SETTING_DIALOG);
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
- intent.putExtra(Intent.EXTRA_UID, getPackageUid(packageName));
+ int uid = getPackageUid(packageName);
+ intent.putExtra(Intent.EXTRA_UID, uid);
intent.putExtra(Intent.EXTRA_SUBJECT, settingIdentifier);
+ try {
+ intent.putExtra(Intent.EXTRA_REASON, mService.getRestrictionReason(packageName,
+ settingIdentifier, UserHandle.getUserHandleForUid(uid).getIdentifier()));
+ } catch (SecurityException | RemoteException e) {
+ // The caller of this method does not have permission to read the ECM state, so we
+ // won't include it in the return
+ }
return intent;
}
diff --git a/framework-s/java/android/app/ecm/IEnhancedConfirmationManager.aidl b/framework-s/java/android/app/ecm/IEnhancedConfirmationManager.aidl
index 5149daa49..79d2322bd 100644
--- a/framework-s/java/android/app/ecm/IEnhancedConfirmationManager.aidl
+++ b/framework-s/java/android/app/ecm/IEnhancedConfirmationManager.aidl
@@ -25,6 +25,8 @@ interface IEnhancedConfirmationManager {
boolean isRestricted(in String packageName, in String settingIdentifier, int userId);
+ String getRestrictionReason(in String packageName, in String settingIdentifier, int userId);
+
void clearRestriction(in String packageName, int userId);
boolean isClearRestrictionAllowed(in String packageName, int userId);