From 15be2ee0d26575f78ea4dd5463859892bece33c3 Mon Sep 17 00:00:00 2001 From: Alex Johnston Date: Wed, 15 Feb 2023 22:58:45 +0000 Subject: [PATCH] Clean up unused system exempt appop These appops were introduced in Android U and have not been used yet. Bug: 246330879 Test: atest AtomTests Change-Id: Ia63c5e88dfeafa1c63ca40c44c88a97a7a4c2716 --- core/java/android/app/AppOpsManager.java | 94 ++++++------------------ 1 file changed, 23 insertions(+), 71 deletions(-) diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 52e202447a2e3..40ed269f57fd9 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1371,14 +1371,14 @@ public class AppOpsManager { AppProtoEnums.APP_OP_READ_MEDIA_VISUAL_USER_SELECTED; /** - * Prevent an app from being placed into app standby buckets. + * Prevent an app from being suspended. * * Only to be used by the system. * * @hide */ - public static final int OP_SYSTEM_EXEMPT_FROM_APP_STANDBY = - AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_APP_STANDBY; + public static final int OP_SYSTEM_EXEMPT_FROM_SUSPENSION = + AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_SUSPENSION; /** * Prevent an app from dismissible notifications. Starting from Android U, notifications with @@ -1421,16 +1421,14 @@ public class AppOpsManager { AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS; /** - * Exempt from start foreground service from background with while in user permission - * restriction. + * Prevent an app from being placed into hibernation. * * Only to be used by the system. * * @hide */ - public static final int OP_SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION = - AppProtoEnums - .APP_OP_SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION; + public static final int OP_SYSTEM_EXEMPT_FROM_HIBERNATION = + AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_HIBERNATION; /** * Allows an application to start an activity while running in the background. @@ -1462,25 +1460,9 @@ public class AppOpsManager { */ public static final int OP_USE_FULL_SCREEN_INTENT = AppProtoEnums.APP_OP_USE_FULL_SCREEN_INTENT; - /** - * Prevent an app from being placed into hibernation. - * - * @hide - */ - public static final int OP_SYSTEM_EXEMPT_FROM_HIBERNATION = - AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_HIBERNATION; - - /** - * Prevent an app from being suspended. - * - * @hide - */ - public static final int OP_SYSTEM_EXEMPT_FROM_SUSPENSION = - AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_SUSPENSION; - /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 136; + public static final int _NUM_OP = 134; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1989,14 +1971,14 @@ public class AppOpsManager { public static final String OPSTR_RUN_USER_INITIATED_JOBS = "android:run_user_initiated_jobs"; /** - * Prevent an app from being placed into app standby buckets. + * Prevent an app from being suspended. * * Only to be used by the system. * * @hide */ - public static final String OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY = - "android:system_exempt_from_app_standby"; + public static final String OPSTR_SYSTEM_EXEMPT_FROM_SUSPENSION = + "android:system_exempt_from_suspension"; /** * Allow an application to create non-dismissible notifications. Starting from Android U, @@ -2032,16 +2014,15 @@ public class AppOpsManager { "android:system_exempt_from_power_restrictions"; /** - * Exempt from start foreground service from background with while in user permission - * restriction. + * Prevent an app from being placed into hibernation. * * Only to be used by the system. * * @hide */ - public static final String - OPSTR_SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION = - "android:system_exempt_from_fgs_bg_start_while_in_use_permission_restriction"; + @SystemApi + public static final String OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION = + "android:system_exempt_from_hibernation"; /** * Allows an application to start an activity while running in the background. @@ -2074,27 +2055,6 @@ public class AppOpsManager { */ public static final String OPSTR_USE_FULL_SCREEN_INTENT = "android:use_full_screen_intent"; - /** - * Prevent an app from being placed into hibernation. - * - * Only to be used by the system. - * - * @hide - */ - @SystemApi - public static final String OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION = - "android:system_exempt_from_hibernation"; - - /** - * Prevent an app from being suspended. - * - * Only to be used by the system. - * - * @hide - */ - public static final String OPSTR_SYSTEM_EXEMPT_FROM_SUSPENSION = - "android:system_exempt_from_suspension"; - /** {@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} */ @@ -2582,9 +2542,10 @@ public class AppOpsManager { OPSTR_READ_MEDIA_VISUAL_USER_SELECTED, "READ_MEDIA_VISUAL_USER_SELECTED") .setPermission(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(), - new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_APP_STANDBY, - OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY, - "SYSTEM_EXEMPT_FROM_APP_STANDBY").build(), + new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_SUSPENSION, + OPSTR_SYSTEM_EXEMPT_FROM_SUSPENSION, + "SYSTEM_EXEMPT_FROM_SUSPENSION") + .setDisableReset(true).build(), new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS, OPSTR_SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS, "SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS") @@ -2598,11 +2559,10 @@ public class AppOpsManager { OPSTR_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS, "SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS") .setDisableReset(true).build(), - new AppOpInfo.Builder( - OP_SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION, - OPSTR_SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION, - "SYSTEM_EXEMPT_FROM_FGS_BG_START_WHILE_IN_USE_PERMISSION_RESTRICTION") - .build(), + new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_HIBERNATION, + OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION, + "SYSTEM_EXEMPT_FROM_HIBERNATION") + .setDisableReset(true).build(), new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_ACTIVITY_BG_START_RESTRICTION, OPSTR_SYSTEM_EXEMPT_FROM_ACTIVITY_BG_START_RESTRICTION, "SYSTEM_EXEMPT_FROM_ACTIVITY_BG_START_RESTRICTION") @@ -2620,15 +2580,7 @@ public class AppOpsManager { .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(), new AppOpInfo.Builder(OP_USE_FULL_SCREEN_INTENT, OPSTR_USE_FULL_SCREEN_INTENT, "USE_FULL_SCREEN_INTENT").setPermission(Manifest.permission.USE_FULL_SCREEN_INTENT) - .build(), - new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_HIBERNATION, - OPSTR_SYSTEM_EXEMPT_FROM_HIBERNATION, - "SYSTEM_EXEMPT_FROM_HIBERNATION") - .setDisableReset(true).build(), - new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_SUSPENSION, - OPSTR_SYSTEM_EXEMPT_FROM_SUSPENSION, - "SYSTEM_EXEMPT_FROM_SUSPENSION") - .setDisableReset(true).build() + .build() }; // The number of longs needed to form a full bitmask of app ops