Add forced app standby and app standby exemption app-ops to AppOpsManager
Bug: 246330879 Test: atest AppOpsTests Change-Id: Ia1de6dc91c12bdf43d66d9cf4d936dd908bdb962
This commit is contained in:
@@ -1368,9 +1368,31 @@ public class AppOpsManager {
|
||||
public static final int OP_READ_MEDIA_VISUAL_USER_SELECTED =
|
||||
AppProtoEnums.APP_OP_READ_MEDIA_VISUAL_USER_SELECTED;
|
||||
|
||||
/**
|
||||
* Prevent an app from being placed into app standby buckets.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Prevent an app from being placed into forced app standby.
|
||||
* {@link ActivityManager#isBackgroundRestricted()}
|
||||
* {@link #OP_RUN_ANY_IN_BACKGROUND}
|
||||
*
|
||||
* Only to be used by the system.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int OP_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY =
|
||||
AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY;
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public static final int _NUM_OP = 124;
|
||||
public static final int _NUM_OP = 126;
|
||||
|
||||
/** Access to coarse location information. */
|
||||
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
|
||||
@@ -1869,6 +1891,28 @@ public class AppOpsManager {
|
||||
*/
|
||||
public static final String OPSTR_RUN_LONG_JOBS = "android:run_long_jobs";
|
||||
|
||||
/**
|
||||
* Prevent an app from being placed into app standby buckets.
|
||||
*
|
||||
* Only to be used by the system.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY =
|
||||
"android:system_exempt_from_app_standby";
|
||||
|
||||
/**
|
||||
* Prevent an app from being placed into forced app standby.
|
||||
* {@link ActivityManager#isBackgroundRestricted()}
|
||||
* {@link #OP_RUN_ANY_IN_BACKGROUND}
|
||||
*
|
||||
* Only to be used by the system.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String OPSTR_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY =
|
||||
"android:system_exempt_from_forced_app_standby";
|
||||
|
||||
/** {@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} */
|
||||
@@ -2350,7 +2394,13 @@ public class AppOpsManager {
|
||||
new AppOpInfo.Builder(OP_READ_MEDIA_VISUAL_USER_SELECTED,
|
||||
OPSTR_READ_MEDIA_VISUAL_USER_SELECTED, "READ_MEDIA_VISUAL_USER_SELECTED")
|
||||
.setPermission(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)
|
||||
.setDefaultMode(AppOpsManager.MODE_ALLOWED).build()
|
||||
.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_FORCED_APP_STANDBY,
|
||||
OPSTR_SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY,
|
||||
"SYSTEM_EXEMPT_FROM_FORCED_APP_STANDBY").build()
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user