policy/impl: Add option to disable screen-unlock-on-slider-open

Signed-off-by: Dan Murphy <D.Murphy@motorola.com>
diff --git a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 44e893b..58905a1 100644
--- a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -66,6 +66,8 @@
     private boolean mInPortrait;
     private boolean mKeyboardOpen;
 
+    private boolean mKeyguardBypassEnabled;
+
     private boolean mDevicePluggedIn;
     
     private boolean mDeviceProvisioned;
@@ -162,6 +164,9 @@
             }
         };
 
+        mKeyguardBypassEnabled = context.getResources().getBoolean(
+                com.android.internal.R.bool.config_bypass_keyguard_if_slider_open);
+
         mDeviceProvisioned = Settings.Secure.getInt(
                 mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
      
@@ -505,6 +510,10 @@
         return mKeyboardOpen;
     }
 
+    public boolean isKeyguardBypassEnabled() {
+        return mKeyguardBypassEnabled;
+    }
+
     public boolean isDevicePluggedIn() {
         return mDevicePluggedIn;
     }
diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
index 043f727..b1ce746 100644
--- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -571,8 +571,8 @@
     public void onKeyboardChange(boolean isKeyboardOpen) {
         mKeyboardOpen = isKeyboardOpen;
 
-        if (mKeyboardOpen && !mKeyguardViewProperties.isSecure()
-                && mKeyguardViewManager.isShowing()) {
+        if (mUpdateMonitor.isKeyguardBypassEnabled() && mKeyboardOpen
+                && !mKeyguardViewProperties.isSecure() && mKeyguardViewManager.isShowing()) {
             if (DEBUG) Log.d(TAG, "bypassing keyguard on sliding open of keyboard with non-secure keyguard");
             keyguardDone(true);
         }
diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 31bfd47..332d580 100644
--- a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -521,7 +521,8 @@
         final IccCard.State simState = mUpdateMonitor.getSimState();
         if (stuckOnLockScreenBecauseSimMissing() || (simState == IccCard.State.PUK_REQUIRED)) {
             return Mode.LockScreen;
-        } else if (mUpdateMonitor.isKeyboardOpen() && isSecure()) {
+        } else if (mUpdateMonitor.isKeyguardBypassEnabled() && mUpdateMonitor.isKeyboardOpen()
+                && isSecure()) {
             return Mode.UnlockScreen;
         } else {
             return Mode.LockScreen;
diff --git a/policy/com/android/internal/policy/impl/LockScreen.java b/policy/com/android/internal/policy/impl/LockScreen.java
index 0495a76..f3f99a2 100644
--- a/policy/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/com/android/internal/policy/impl/LockScreen.java
@@ -358,7 +358,7 @@
     }
 
     public void onKeyboardChange(boolean isKeyboardOpen) {
-        if (isKeyboardOpen) {
+        if (mUpdateMonitor.isKeyguardBypassEnabled() && isKeyboardOpen) {
             mCallback.goToUnlockScreen();
         }
     }