Loading apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,16 @@ public class PowerExemptionManager { * @hide */ public static final int REASON_CARRIER_PRIVILEGED_APP = 321; /** * Device/Profile owner protected apps. * @hide */ public static final int REASON_DPO_PROTECTED_APP = 322; /** * Apps control is disallowed for the user. * @hide */ public static final int REASON_DISALLOW_APPS_CONTROL = 323; /** @hide The app requests out-out. */ public static final int REASON_OPT_OUT_REQUESTED = 1000; Loading Loading @@ -447,6 +457,8 @@ public class PowerExemptionManager { REASON_SYSTEM_MODULE, REASON_CARRIER_PRIVILEGED_APP, REASON_OPT_OUT_REQUESTED, REASON_DPO_PROTECTED_APP, REASON_DISALLOW_APPS_CONTROL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReasonCode {} Loading Loading @@ -653,6 +665,10 @@ public class PowerExemptionManager { return AppBackgroundRestrictionsInfo.REASON_ROLE_DIALER; case REASON_ROLE_EMERGENCY: return AppBackgroundRestrictionsInfo.REASON_ROLE_EMERGENCY; case REASON_DPO_PROTECTED_APP: return AppBackgroundRestrictionsInfo.REASON_DPO_PROTECTED_APP; case REASON_DISALLOW_APPS_CONTROL: return AppBackgroundRestrictionsInfo.REASON_DISALLOW_APPS_CONTROL; default: return AppBackgroundRestrictionsInfo.REASON_DENIED; } Loading Loading @@ -798,6 +814,10 @@ public class PowerExemptionManager { return "SYSTEM_MODULE"; case REASON_CARRIER_PRIVILEGED_APP: return "CARRIER_PRIVILEGED_APP"; case REASON_DPO_PROTECTED_APP: return "DPO_PROTECTED_APP"; case REASON_DISALLOW_APPS_CONTROL: return "DISALLOW_APPS_CONTROL"; case REASON_OPT_OUT_REQUESTED: return "REASON_OPT_OUT_REQUESTED"; default: Loading core/proto/android/os/appbackgroundrestrictioninfo.proto +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,8 @@ message AppBackgroundRestrictionsInfo { REASON_ROLE_EMERGENCY = 319; REASON_SYSTEM_MODULE = 320; REASON_CARRIER_PRIVILEGED_APP = 321; REASON_DPO_PROTECTED_APP = 322; REASON_DISALLOW_APPS_CONTROL = 323; // app requested to be exempt REASON_OPT_OUT_REQUESTED = 1000; } Loading packages/SystemUI/src/com/android/systemui/qs/FgsManagerController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -422,6 +422,8 @@ class FgsManagerController @Inject constructor( PowerExemptionManager.REASON_ALLOWLISTED_PACKAGE, PowerExemptionManager.REASON_DEVICE_OWNER, PowerExemptionManager.REASON_DISALLOW_APPS_CONTROL, PowerExemptionManager.REASON_DPO_PROTECTED_APP, PowerExemptionManager.REASON_PROFILE_OWNER, PowerExemptionManager.REASON_PROC_STATE_PERSISTENT, PowerExemptionManager.REASON_PROC_STATE_PERSISTENT_UI, Loading services/core/java/com/android/server/am/AppRestrictionController.java +10 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ import static android.os.PowerExemptionManager.REASON_COMPANION_DEVICE_MANAGER; import static android.os.PowerExemptionManager.REASON_DENIED; import static android.os.PowerExemptionManager.REASON_DEVICE_DEMO_MODE; import static android.os.PowerExemptionManager.REASON_DEVICE_OWNER; import static android.os.PowerExemptionManager.REASON_DISALLOW_APPS_CONTROL; import static android.os.PowerExemptionManager.REASON_DPO_PROTECTED_APP; import static android.os.PowerExemptionManager.REASON_OP_ACTIVATE_PLATFORM_VPN; import static android.os.PowerExemptionManager.REASON_OP_ACTIVATE_VPN; import static android.os.PowerExemptionManager.REASON_PROC_STATE_PERSISTENT; Loading Loading @@ -2616,6 +2618,11 @@ public final class AppRestrictionController { if (UserManager.isDeviceInDemoMode(mContext)) { return REASON_DEVICE_DEMO_MODE; } final int userId = UserHandle.getUserId(uid); if (mInjector.getUserManagerInternal() .hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL, userId)) { return REASON_DISALLOW_APPS_CONTROL; } if (am.isDeviceOwner(uid)) { return REASON_DEVICE_OWNER; } Loading @@ -2631,6 +2638,7 @@ public final class AppRestrictionController { final String[] packages = mInjector.getPackageManager().getPackagesForUid(uid); if (packages != null) { final AppOpsManager appOpsManager = mInjector.getAppOpsManager(); final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); for (String pkg : packages) { if (appOpsManager.checkOpNoThrow(AppOpsManager.OP_ACTIVATE_VPN, uid, pkg) == AppOpsManager.MODE_ALLOWED) { Loading @@ -2646,6 +2654,8 @@ public final class AppRestrictionController { return REASON_SYSTEM_ALLOW_LISTED; } else if (mConstantsObserver.mBgRestrictionExemptedPackages.contains(pkg)) { return REASON_ALLOWLISTED_PACKAGE; } else if (pm.isPackageStateProtected(pkg, userId)) { return REASON_DPO_PROTECTED_APP; } } } Loading Loading
apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,16 @@ public class PowerExemptionManager { * @hide */ public static final int REASON_CARRIER_PRIVILEGED_APP = 321; /** * Device/Profile owner protected apps. * @hide */ public static final int REASON_DPO_PROTECTED_APP = 322; /** * Apps control is disallowed for the user. * @hide */ public static final int REASON_DISALLOW_APPS_CONTROL = 323; /** @hide The app requests out-out. */ public static final int REASON_OPT_OUT_REQUESTED = 1000; Loading Loading @@ -447,6 +457,8 @@ public class PowerExemptionManager { REASON_SYSTEM_MODULE, REASON_CARRIER_PRIVILEGED_APP, REASON_OPT_OUT_REQUESTED, REASON_DPO_PROTECTED_APP, REASON_DISALLOW_APPS_CONTROL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReasonCode {} Loading Loading @@ -653,6 +665,10 @@ public class PowerExemptionManager { return AppBackgroundRestrictionsInfo.REASON_ROLE_DIALER; case REASON_ROLE_EMERGENCY: return AppBackgroundRestrictionsInfo.REASON_ROLE_EMERGENCY; case REASON_DPO_PROTECTED_APP: return AppBackgroundRestrictionsInfo.REASON_DPO_PROTECTED_APP; case REASON_DISALLOW_APPS_CONTROL: return AppBackgroundRestrictionsInfo.REASON_DISALLOW_APPS_CONTROL; default: return AppBackgroundRestrictionsInfo.REASON_DENIED; } Loading Loading @@ -798,6 +814,10 @@ public class PowerExemptionManager { return "SYSTEM_MODULE"; case REASON_CARRIER_PRIVILEGED_APP: return "CARRIER_PRIVILEGED_APP"; case REASON_DPO_PROTECTED_APP: return "DPO_PROTECTED_APP"; case REASON_DISALLOW_APPS_CONTROL: return "DISALLOW_APPS_CONTROL"; case REASON_OPT_OUT_REQUESTED: return "REASON_OPT_OUT_REQUESTED"; default: Loading
core/proto/android/os/appbackgroundrestrictioninfo.proto +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,8 @@ message AppBackgroundRestrictionsInfo { REASON_ROLE_EMERGENCY = 319; REASON_SYSTEM_MODULE = 320; REASON_CARRIER_PRIVILEGED_APP = 321; REASON_DPO_PROTECTED_APP = 322; REASON_DISALLOW_APPS_CONTROL = 323; // app requested to be exempt REASON_OPT_OUT_REQUESTED = 1000; } Loading
packages/SystemUI/src/com/android/systemui/qs/FgsManagerController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -422,6 +422,8 @@ class FgsManagerController @Inject constructor( PowerExemptionManager.REASON_ALLOWLISTED_PACKAGE, PowerExemptionManager.REASON_DEVICE_OWNER, PowerExemptionManager.REASON_DISALLOW_APPS_CONTROL, PowerExemptionManager.REASON_DPO_PROTECTED_APP, PowerExemptionManager.REASON_PROFILE_OWNER, PowerExemptionManager.REASON_PROC_STATE_PERSISTENT, PowerExemptionManager.REASON_PROC_STATE_PERSISTENT_UI, Loading
services/core/java/com/android/server/am/AppRestrictionController.java +10 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ import static android.os.PowerExemptionManager.REASON_COMPANION_DEVICE_MANAGER; import static android.os.PowerExemptionManager.REASON_DENIED; import static android.os.PowerExemptionManager.REASON_DEVICE_DEMO_MODE; import static android.os.PowerExemptionManager.REASON_DEVICE_OWNER; import static android.os.PowerExemptionManager.REASON_DISALLOW_APPS_CONTROL; import static android.os.PowerExemptionManager.REASON_DPO_PROTECTED_APP; import static android.os.PowerExemptionManager.REASON_OP_ACTIVATE_PLATFORM_VPN; import static android.os.PowerExemptionManager.REASON_OP_ACTIVATE_VPN; import static android.os.PowerExemptionManager.REASON_PROC_STATE_PERSISTENT; Loading Loading @@ -2616,6 +2618,11 @@ public final class AppRestrictionController { if (UserManager.isDeviceInDemoMode(mContext)) { return REASON_DEVICE_DEMO_MODE; } final int userId = UserHandle.getUserId(uid); if (mInjector.getUserManagerInternal() .hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL, userId)) { return REASON_DISALLOW_APPS_CONTROL; } if (am.isDeviceOwner(uid)) { return REASON_DEVICE_OWNER; } Loading @@ -2631,6 +2638,7 @@ public final class AppRestrictionController { final String[] packages = mInjector.getPackageManager().getPackagesForUid(uid); if (packages != null) { final AppOpsManager appOpsManager = mInjector.getAppOpsManager(); final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); for (String pkg : packages) { if (appOpsManager.checkOpNoThrow(AppOpsManager.OP_ACTIVATE_VPN, uid, pkg) == AppOpsManager.MODE_ALLOWED) { Loading @@ -2646,6 +2654,8 @@ public final class AppRestrictionController { return REASON_SYSTEM_ALLOW_LISTED; } else if (mConstantsObserver.mBgRestrictionExemptedPackages.contains(pkg)) { return REASON_ALLOWLISTED_PACKAGE; } else if (pm.isPackageStateProtected(pkg, userId)) { return REASON_DPO_PROTECTED_APP; } } } Loading