Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d62d63b2 authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "Hide the stop button for the device admin app in the task manager" into tm-dev

parents 0fe49ee5 8ee51fbd
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -379,6 +379,11 @@ public class PowerExemptionManager {
     * @hide
     */
    public static final int REASON_DISALLOW_APPS_CONTROL = 323;
    /**
     * Active device admin package.
     * @hide
     */
    public static final int REASON_ACTIVE_DEVICE_ADMIN = 324;

    /** @hide The app requests out-out. */
    public static final int REASON_OPT_OUT_REQUESTED = 1000;
@@ -459,6 +464,7 @@ public class PowerExemptionManager {
            REASON_OPT_OUT_REQUESTED,
            REASON_DPO_PROTECTED_APP,
            REASON_DISALLOW_APPS_CONTROL,
            REASON_ACTIVE_DEVICE_ADMIN,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ReasonCode {}
@@ -669,6 +675,8 @@ public class PowerExemptionManager {
                return AppBackgroundRestrictionsInfo.REASON_DPO_PROTECTED_APP;
            case REASON_DISALLOW_APPS_CONTROL:
                return AppBackgroundRestrictionsInfo.REASON_DISALLOW_APPS_CONTROL;
            case REASON_ACTIVE_DEVICE_ADMIN:
                return AppBackgroundRestrictionsInfo.REASON_ACTIVE_DEVICE_ADMIN;
            default:
                return AppBackgroundRestrictionsInfo.REASON_DENIED;
        }
@@ -818,6 +826,8 @@ public class PowerExemptionManager {
                return "DPO_PROTECTED_APP";
            case REASON_DISALLOW_APPS_CONTROL:
                return "DISALLOW_APPS_CONTROL";
            case REASON_ACTIVE_DEVICE_ADMIN:
                return "ACTIVE_DEVICE_ADMIN";
            case REASON_OPT_OUT_REQUESTED:
                return "REASON_OPT_OUT_REQUESTED";
            default:
+5 −0
Original line number Diff line number Diff line
@@ -218,6 +218,11 @@ public interface AppStandbyInternal {

    void setActiveAdminApps(Set<String> adminPkgs, int userId);

    /**
     * @return {@code true} if the given package is an active device admin app.
     */
    boolean isActiveDeviceAdmin(String packageName, int userId);

    void onAdminDataAvailable();

    void clearCarrierPrivilegedApps();
+2 −1
Original line number Diff line number Diff line
@@ -1799,7 +1799,8 @@ public class AppStandbyController
    }

    @VisibleForTesting
    boolean isActiveDeviceAdmin(String packageName, int userId) {
    @Override
    public boolean isActiveDeviceAdmin(String packageName, int userId) {
        synchronized (mActiveAdminApps) {
            final Set<String> adminPkgs = mActiveAdminApps.get(userId);
            return adminPkgs != null && adminPkgs.contains(packageName);
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ message AppBackgroundRestrictionsInfo {
        REASON_CARRIER_PRIVILEGED_APP = 321;
        REASON_DPO_PROTECTED_APP = 322;
        REASON_DISALLOW_APPS_CONTROL = 323;
        REASON_ACTIVE_DEVICE_ADMIN = 324;
        // app requested to be exempt
        REASON_OPT_OUT_REQUESTED = 1000;
    }
+1 −0
Original line number Diff line number Diff line
@@ -462,6 +462,7 @@ class FgsManagerController @Inject constructor(
                PowerExemptionManager.REASON_DISALLOW_APPS_CONTROL,
                PowerExemptionManager.REASON_DPO_PROTECTED_APP,
                PowerExemptionManager.REASON_PROFILE_OWNER,
                PowerExemptionManager.REASON_ACTIVE_DEVICE_ADMIN,
                PowerExemptionManager.REASON_PROC_STATE_PERSISTENT,
                PowerExemptionManager.REASON_PROC_STATE_PERSISTENT_UI,
                PowerExemptionManager.REASON_ROLE_DIALER,
Loading