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

Commit 0a3d244d authored by Jason Parks's avatar Jason Parks
Browse files

Fix setSecondaryLockscreenEnabled flag behavior.

setSecondaryLockscreenEnabled now checks for the flag and
if mSupervisionManagerInternal is not null to call into the
SupervisionService. This allows for the old behavior to remain intact.

This fixes CTS breakage when both flags are not enabled.

Test: atest -c 'CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSecondaryLockscreen'
Bug: 379041099
Bug: 379976391
Bug: 383360361
Flag: android.app.admin.flags.secondary_lockscreen_api_enabled
Change-Id: I84e14508184f8e249cdab1e755d377bccd0272ee
parent 775913ed
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -14669,7 +14669,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    @Override
    public void setSecondaryLockscreenEnabled(ComponentName who, boolean enabled,
            PersistableBundle options) {
        if (Flags.secondaryLockscreenApiEnabled()) {
        if (Flags.secondaryLockscreenApiEnabled() && mSupervisionManagerInternal != null) {
            final CallerIdentity caller = getCallerIdentity();
            final boolean isRoleHolder = isCallerSystemSupervisionRoleHolder(caller);
            synchronized (getLockObject()) {
@@ -14680,16 +14680,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                        caller.getUserId());
            }
            if (mSupervisionManagerInternal != null) {
            mSupervisionManagerInternal.setSupervisionLockscreenEnabledForUser(
                    caller.getUserId(), enabled, options);
            } else {
                synchronized (getLockObject()) {
                    DevicePolicyData policy = getUserData(caller.getUserId());
                    policy.mSecondaryLockscreenEnabled = enabled;
                    saveSettingsLocked(caller.getUserId());
                }
            }
        } else {
            Objects.requireNonNull(who, "ComponentName is null");