Merge "Don't dismiss keyguard when enabling it" into qt-dev
am: 785a88846a

Change-Id: Ife6f87734f0e8c215a7b439d5dfa0fbc5247d0ce
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 8b61208..e5518d0 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -11018,7 +11018,11 @@
                 return false;
             }
             mLockPatternUtils.setLockScreenDisabled(disabled, userId);
-            mInjector.getIWindowManager().dismissKeyguard(null /* callback */, null /* message */);
+            if (disabled) {
+                mInjector
+                        .getIWindowManager()
+                        .dismissKeyguard(null /* callback */, null /* message */);
+            }
             DevicePolicyEventLogger
                     .createEvent(DevicePolicyEnums.SET_KEYGUARD_DISABLED)
                     .setAdmin(who)