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

Commit a2063a9d authored by Pavel Grafov's avatar Pavel Grafov Committed by Android (Google) Code Review
Browse files

Merge "Add "Keep profiles running" feature check."

parents 34acc79f 5e8aed6e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -269,4 +269,9 @@ public abstract class DevicePolicyManagerInternal {
     * {@link #supportsResetOp(int)} is true.
     */
    public abstract void resetOp(int op, String packageName, @UserIdInt int userId);

    /**
     * Returns whether new "turn off work" behavior is enabled via feature flag.
     */
    public abstract boolean isKeepProfilesRunningEnabled();
}
+24 −0
Original line number Diff line number Diff line
@@ -718,6 +718,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private static final String ENABLE_COEXISTENCE_FLAG = "enable_coexistence";
    private static final boolean DEFAULT_ENABLE_COEXISTENCE_FLAG = false;
    // TODO(b/258425381) remove the flag after rollout.
    private static final String KEEP_PROFILES_RUNNING_FLAG = "enable_keep_profiles_running";
    private static final boolean DEFAULT_KEEP_PROFILES_RUNNING_FLAG = false;
    /**
     * This feature flag is checked once after boot and this value us used until the next reboot to
     * avoid needing to handle the flag changing on the fly.
     */
    private final boolean mKeepProfilesRunning = isKeepProfilesRunningFlagEnabled();
    /**
     * For apps targeting U+
     * Enable multiple admins to coexist on the same device.
@@ -9892,6 +9902,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                            (size == 1 ? "" : "s"));
                }
                pw.println();
                pw.println("Keep profiles running: " + mKeepProfilesRunning);
                pw.println();
                mPolicyCache.dump(pw);
                pw.println();
@@ -13533,6 +13545,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            }
        }
        @Override
        public boolean isKeepProfilesRunningEnabled() {
            return mKeepProfilesRunning;
        }
        private @Mode int findInteractAcrossProfilesResetMode(String packageName) {
            return getDefaultCrossProfilePackages().contains(packageName)
                    ? AppOpsManager.MODE_ALLOWED
@@ -19167,4 +19184,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                ENABLE_COEXISTENCE_FLAG,
                DEFAULT_ENABLE_COEXISTENCE_FLAG);
    }
    private static boolean isKeepProfilesRunningFlagEnabled() {
        return DeviceConfig.getBoolean(
                NAMESPACE_DEVICE_POLICY_MANAGER,
                KEEP_PROFILES_RUNNING_FLAG,
                DEFAULT_KEEP_PROFILES_RUNNING_FLAG);
    }
}