Add "Keep profiles running" feature check.
Bug: 258425381 Test: adb shell device_config set device_policy_manager enable_keep_profiles_running true Change-Id: I8d141c69fb3da0c9f5648fbaff71a0a60e5a15db
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user