diff options
author | eray orçunus <erayorcunus@gmail.com> | 2015-06-17 16:12:19 +0300 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-02-08 15:05:19 -0800 |
commit | 5711b9e460e76ee6dd6c3bbcf5565dcb650cd111 (patch) | |
tree | afbd7d0c4f701d5d09ac5a048356b1a5d0ae5ba4 /packages | |
parent | 6bb3b08281651b997526a9e3edffb2ec31a0096d (diff) | |
download | frameworks_base-5711b9e460e76ee6dd6c3bbcf5565dcb650cd111.zip frameworks_base-5711b9e460e76ee6dd6c3bbcf5565dcb650cd111.tar.gz frameworks_base-5711b9e460e76ee6dd6c3bbcf5565dcb650cd111.tar.bz2 |
lockscreen: Add option for showing unlock screen directly (1/3)
* Option appears on PIN,pattern and password methods
* User should press back button to see swipe-up-to-unlock screen.
* Instantly hides keyguard if Smart Lock has unlocked phone.
CYNGNOS-1873
Change-Id: I2ceeed348d7e61632b8344f35431f30cba62ca4f
Signed-off-by: eray orçunus <erayorcunus@gmail.com>
Diffstat (limited to 'packages')
5 files changed, 66 insertions, 26 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index ad4a614..2b5c14f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -726,6 +726,7 @@ class DatabaseHelper extends SQLiteOpenHelper { Secure.LOCK_PATTERN_ENABLED, Secure.LOCK_PATTERN_VISIBLE, Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, + CMSettings.Secure.LOCK_PASS_TO_SECURITY_VIEW, Secure.LOCK_PATTERN_SIZE, Secure.LOCK_DOTS_VISIBLE, Secure.LOCK_SHOW_ERROR_PATH, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 17fadbd..3024c27 100755 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1726,7 +1726,7 @@ public class KeyguardViewMediator extends SystemUI { private void handleReset() { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleReset"); - mStatusBarKeyguardViewManager.reset(); + mStatusBarKeyguardViewManager.reset(false); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 395f350..65e2096 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -32,6 +32,8 @@ import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.DejankUtils; +import org.cyanogenmod.internal.util.CmLockPatternUtils; + import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.keyguard.KeyguardSecurityModel.SecurityMode; @@ -40,9 +42,14 @@ import static com.android.keyguard.KeyguardSecurityModel.SecurityMode; */ public class KeyguardBouncer { + public static final int UNLOCK_SEQUENCE_DEFAULT = 0; + public static final int UNLOCK_SEQUENCE_BOUNCER_FIRST = 1; + public static final int UNLOCK_SEQUENCE_FORCE_BOUNCER = 2; + private Context mContext; private ViewMediatorCallback mCallback; private LockPatternUtils mLockPatternUtils; + private CmLockPatternUtils mCmLockPatternUtils; private ViewGroup mContainer; private StatusBarWindowManager mWindowManager; private KeyguardHostView mKeyguardView; @@ -65,6 +72,7 @@ public class KeyguardBouncer { mLockPatternUtils = lockPatternUtils; mContainer = container; mWindowManager = windowManager; + mCmLockPatternUtils = new CmLockPatternUtils(mContext); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback); } @@ -207,28 +215,42 @@ public class KeyguardBouncer { } /** - * @return True if and only if the security method should be shown before showing the - * notifications on Keyguard, like SIM PIN/PUK. + * @return Whether the bouncer should be shown first, this could be because of SIM PIN/PUK + * or it just could be chosen to be shown first. */ - public boolean needsFullscreenBouncer() { + public int needsFullscreenBouncer() { ensureView(); if (mKeyguardView != null) { SecurityMode mode = mKeyguardView.getSecurityMode(); - return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk; + if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk) + return UNLOCK_SEQUENCE_FORCE_BOUNCER; + // "Bouncer first" mode currently only available to some security methods. + else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password + || mode == SecurityMode.PIN) && (mLockPatternUtils != null && + mCmLockPatternUtils.shouldPassToSecurityView( + KeyguardUpdateMonitor.getCurrentUser()))) + return UNLOCK_SEQUENCE_BOUNCER_FIRST; } - return false; + return UNLOCK_SEQUENCE_DEFAULT; } /** * Like {@link #needsFullscreenBouncer}, but uses the currently visible security method, which * makes this method much faster. */ - public boolean isFullscreenBouncer() { + public int isFullscreenBouncer() { if (mKeyguardView != null) { SecurityMode mode = mKeyguardView.getCurrentSecurityMode(); - return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk; + if (mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk) + return UNLOCK_SEQUENCE_FORCE_BOUNCER; + // "Bouncer first" mode currently only available to some security methods. + else if ((mode == SecurityMode.Pattern || mode == SecurityMode.Password + || mode == SecurityMode.PIN) && (mLockPatternUtils != null && + mCmLockPatternUtils.shouldPassToSecurityView( + KeyguardUpdateMonitor.getCurrentUser()))) + return UNLOCK_SEQUENCE_BOUNCER_FIRST; } - return false; + return UNLOCK_SEQUENCE_DEFAULT; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 41fd86a..a17d589 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -5211,6 +5211,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE"); mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested(); } + mWindowManagerService vibrateForCameraGesture(); if (!mStatusBarKeyguardViewManager.isShowing()) { startActivity(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 2347a33..df642fd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -114,23 +114,38 @@ public class StatusBarKeyguardViewManager { mShowing = true; mStatusBarWindowManager.setKeyguardShowing(true); mScrimController.abortKeyguardFadingOut(); - reset(); + reset(false); } /** * Shows the notification keyguard or the bouncer depending on * {@link KeyguardBouncer#needsFullscreenBouncer()}. */ - private void showBouncerOrKeyguard() { - if (mBouncer.needsFullscreenBouncer()) { - - // The keyguard might be showing (already). So we need to hide it. - mPhoneStatusBar.hideKeyguard(); - mBouncer.show(true /* resetSecuritySelection */); - } else { - mPhoneStatusBar.showKeyguard(); - mBouncer.hide(false /* destroyView */); - mBouncer.prepare(); + private void showBouncerOrKeyguard(boolean isBackPressed) { + switch (mBouncer.needsFullscreenBouncer()) { + case KeyguardBouncer.UNLOCK_SEQUENCE_FORCE_BOUNCER: + // SIM PIN/PUK + // The keyguard might be showing (already). So we need to hide it. + mPhoneStatusBar.hideKeyguard(); + mBouncer.show(true /* resetSecuritySelection */); + break; + case KeyguardBouncer.UNLOCK_SEQUENCE_BOUNCER_FIRST: + // Pattern/PIN/Password with "Directly pass to security view" enabled + if (isBackPressed) { + mPhoneStatusBar.showKeyguard(); + mBouncer.hide(false /* destroyView */); + mBouncer.prepare(); + } else { + // The keyguard might be showing (already). So we need to hide it. + mPhoneStatusBar.hideKeyguard(); + mBouncer.show(true /* resetSecuritySelection */); + } + break; + case KeyguardBouncer.UNLOCK_SEQUENCE_DEFAULT: + mPhoneStatusBar.showKeyguard(); + mBouncer.hide(false /* destroyView */); + mBouncer.prepare(); + break; } } @@ -157,14 +172,14 @@ public class StatusBarKeyguardViewManager { /** * Reset the state of the view. */ - public void reset() { + public void reset(boolean isBackPressed) { if (mShowing) { if (mOccluded) { mPhoneStatusBar.hideKeyguard(); mPhoneStatusBar.stopWaitingForKeyguardExit(); mBouncer.hide(false /* destroyView */); } else { - showBouncerOrKeyguard(); + showBouncerOrKeyguard(isBackPressed); } KeyguardUpdateMonitor.getInstance(mContext).sendKeyguardReset(); updateStates(); @@ -233,7 +248,7 @@ public class StatusBarKeyguardViewManager { @Override public void run() { mStatusBarWindowManager.setKeyguardOccluded(mOccluded); - reset(); + reset(false); } }); return; @@ -245,7 +260,7 @@ public class StatusBarKeyguardViewManager { if (mUnlockFab != null && mUnlockFab.isAttachedToWindow() && !occluded) { hideUnlockFab(); } - reset(); + reset(false); } public boolean isOccluded() { @@ -416,7 +431,7 @@ public class StatusBarKeyguardViewManager { public boolean onBackPressed() { if (mBouncer.isShowing()) { mPhoneStatusBar.endAffordanceLaunch(); - reset(); + reset(true); return true; } return false; @@ -449,7 +464,8 @@ public class StatusBarKeyguardViewManager { boolean showing = mShowing; boolean occluded = mOccluded; boolean bouncerShowing = mBouncer.isShowing(); - boolean bouncerDismissible = !mBouncer.isFullscreenBouncer(); + boolean bouncerDismissible = (mBouncer.isFullscreenBouncer() != + KeyguardBouncer.UNLOCK_SEQUENCE_FORCE_BOUNCER); if ((bouncerDismissible || !showing) != (mLastBouncerDismissible || !mLastShowing) || mFirstUpdate) { |