From 521fcc503b0cad14017181cd2bb63a295346c480 Mon Sep 17 00:00:00 2001 From: Nate Myren Date: Mon, 30 Dec 2024 10:21:48 -0800 Subject: Separate per-package and global restricted ECM settings If an ECM setting is restricted only by global device state, then it should not be checked for a per-package restriction. Fixes: 385317771 Test: atest EnhancedConfirmationInCallTest Flag: android.permission.flags.enhanced_confirmation_in_call_apis_enabled Relnote: 25Q2 feature work LOW_COVERAGE_REASON=b/387927331 Change-Id: Ia78acdca3071af6310d5bd5ce2c4db0c30195478 --- framework-s/java/android/app/ecm/EnhancedConfirmationManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'framework-s/java') diff --git a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java index 290388558..4248a429c 100644 --- a/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java +++ b/framework-s/java/android/app/ecm/EnhancedConfirmationManager.java @@ -213,7 +213,7 @@ public final class EnhancedConfirmationManager { * 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"; + public static final String REASON_PACKAGE_RESTRICTED = "package_restricted"; /** A map of ECM states to their corresponding app op states */ @@ -367,8 +367,9 @@ public final class EnhancedConfirmationManager { 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())); + String restrictionReason = mService.getRestrictionReason(packageName, + settingIdentifier, UserHandle.getUserHandleForUid(uid).getIdentifier()); + intent.putExtra(Intent.EXTRA_REASON, restrictionReason); } 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 -- cgit v1.2.3-59-g8ed1b