From cb15d66f1c7e0175acdf0c0a71d774e841e0b21b Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 10 Nov 2015 11:11:15 -0800 Subject: [PATCH] Once system is provisioned, lock the screen on system user If the device provisioning is complete, check if we need to show the keyguard. We don't want it to show launcher after finishing with setupwizard in the system user. Bug: 25326078 Change-Id: I326069e29122ebf19a59fc00a9120cd5de70f231 --- core/java/android/provider/Settings.java | 5 ++++- .../android/systemui/keyguard/KeyguardViewMediator.java | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 37f2c04778875..9034cc9369416 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6285,7 +6285,10 @@ public final class Settings { public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled"; /** - * Whether the device has been provisioned (0 = false, 1 = true) + * Whether the device has been provisioned (0 = false, 1 = true). + *

On a multiuser device with a separate system user, the screen may be locked + * as soon as this is set to true and further activities cannot be launched on the + * system user unless they are marked to show over keyguard. */ public static final String DEVICE_PROVISIONED = "device_provisioned"; diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 7ef5187bae6a8..eee685fe3e7a8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -379,6 +379,13 @@ public class KeyguardViewMediator extends SystemUI { @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); + synchronized (KeyguardViewMediator.this) { + // If system user is provisioned, we might want to lock now to avoid showing launcher + if (UserManager.isSplitSystemUser() + && KeyguardUpdateMonitor.getCurrentUser() == UserHandle.USER_SYSTEM) { + doKeyguardLocked(null); + } + } } @Override