diff options
| -rw-r--r-- | core/api/system-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 32 | ||||
| -rw-r--r-- | core/java/android/view/contentprotection/flags/content_protection_flags.aconfig | 7 |
3 files changed, 37 insertions, 3 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 5674aec97ff5..183b925cefd5 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -627,6 +627,7 @@ package android.app { field public static final String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service"; field public static final String OPSTR_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD = "android:capture_consentless_bugreport_on_userdebug_build"; field public static final String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state"; + field @FlaggedApi("android.view.contentprotection.flags.create_accessibility_overlay_app_op_enabled") public static final String OPSTR_CREATE_ACCESSIBILITY_OVERLAY = "android:create_accessibility_overlay"; field public static final String OPSTR_ESTABLISH_VPN_MANAGER = "android:establish_vpn_manager"; field public static final String OPSTR_ESTABLISH_VPN_SERVICE = "android:establish_vpn_service"; field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 7e84ceb4a61d..b03bd59c305e 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -16,10 +16,13 @@ package android.app; +import static android.view.contentprotection.flags.Flags.FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED; + import static java.lang.Long.max; import android.Manifest; import android.annotation.CallbackExecutor; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; @@ -1495,9 +1498,17 @@ public class AppOpsManager { public static final int OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA = AppProtoEnums.APP_OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA; + /** + * Creation of an overlay using accessibility services + * + * @hide + */ + public static final int OP_CREATE_ACCESSIBILITY_OVERLAY = + AppProtoEnums.APP_OP_CREATE_ACCESSIBILITY_OVERLAY; + /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 138; + public static final int _NUM_OP = 139; /** * All app ops represented as strings. @@ -1641,7 +1652,8 @@ public class AppOpsManager { OPSTR_CAMERA_SANDBOXED, OPSTR_RECORD_AUDIO_SANDBOXED, OPSTR_RECEIVE_SANDBOX_TRIGGER_AUDIO, - OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA + OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA, + OPSTR_CREATE_ACCESSIBILITY_OVERLAY, }) public @interface AppOpString {} @@ -2270,6 +2282,16 @@ public class AppOpsManager { public static final String OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA = "android:RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA"; + /** + * Creation of an overlay using accessibility services + * + * @hide + */ + @SystemApi + @FlaggedApi(FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED) + public static final String OPSTR_CREATE_ACCESSIBILITY_OVERLAY = + "android:create_accessibility_overlay"; + /** {@link #sAppOpsToNote} not initialized yet for this op */ private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0; /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */ @@ -2819,7 +2841,11 @@ public class AppOpsManager { OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA, "RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA") .setPermission(Manifest.permission.RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA) - .setDefaultMode(AppOpsManager.MODE_DEFAULT).build() + .setDefaultMode(AppOpsManager.MODE_DEFAULT).build(), + new AppOpInfo.Builder(OP_CREATE_ACCESSIBILITY_OVERLAY, + OPSTR_CREATE_ACCESSIBILITY_OVERLAY, + "CREATE_ACCESSIBILITY_OVERLAY") + .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(), }; // The number of longs needed to form a full bitmask of app ops diff --git a/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig b/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig index f6ee061fdd89..f3dc33cd2cc9 100644 --- a/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig +++ b/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig @@ -20,3 +20,10 @@ flag { description: "If true, content protection setting ui is displayed in Settings > Privacy & Security > More security & privacy." bug: "305792348" } + +flag { + name: "create_accessibility_overlay_app_op_enabled" + namespace: "content_protection" + description: "If true, an appop is logged on creation of accessibility overlays." + bug: "289081465" +} |