Loading core/java/android/app/admin/DevicePolicyManagerInternal.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +24 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading Loading @@ -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 Loading Loading @@ -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); } } Loading
core/java/android/app/admin/DevicePolicyManagerInternal.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +24 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading Loading @@ -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 Loading Loading @@ -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); } }