diff options
author | Jim Miller <jaggies@google.com> | 2012-09-18 20:52:55 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2012-09-18 21:02:08 -0700 |
commit | d2b82f70fede8c2ec4de34d8e6462ed4ece13c56 (patch) | |
tree | b8b827a08201fe8ce333ed43a5df2522a52fbe02 /policy | |
parent | 1e5aeecb64827d2b71f429d73a05c25ffe4a5be8 (diff) | |
download | frameworks_base-d2b82f70fede8c2ec4de34d8e6462ed4ece13c56.zip frameworks_base-d2b82f70fede8c2ec4de34d8e6462ed4ece13c56.tar.gz frameworks_base-d2b82f70fede8c2ec4de34d8e6462ed4ece13c56.tar.bz2 |
Fix wrong pattern count in keyguard pattern security view.
This fixes a bug introduced in I085c5ec8 where keyguard attempts to emulate
slippery windows with views. In order to do so, the code was overloading
dispatchTouchEvent(). It would allow the super (a ViewGroup) to dispatch
the events and then would dispatch them itself to sub views. In the case
where an event overlaps an actual child view, it would result in 2 copies of the event
per window layer (there are 2). This results in 2 events per layer for the
top two views in the hierarchy. So each actual pattern attempt would count as 4
attempts to the system.
The solution is to overload onTouchEvent() at each level in the view hierarchy,
which means that we ignore events that were already handled by a child window
of the parent.
This change also disables slippery windows for keyguard because it causes
vertical patterns to be ignored.
Fixes bug 7191277
Change-Id: I4df217f2bf382134d93113b8d55b0d71e0e23677
Diffstat (limited to 'policy')
4 files changed, 9 insertions, 9 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index 991f90b..929696f 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -109,8 +109,8 @@ public class KeyguardHostView extends KeyguardViewBase { } @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - boolean result = super.dispatchTouchEvent(ev); + public boolean onTouchEvent(MotionEvent ev) { + boolean result = super.onTouchEvent(ev); mTempRect.set(0, 0, 0, 0); offsetRectIntoDescendantCoords(mSecurityViewContainer, mTempRect); ev.offsetLocation(mTempRect.left, mTempRect.top); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java index 6de40e4..6e16bb4 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java @@ -157,8 +157,8 @@ public class KeyguardPatternView extends GridLayout implements KeyguardSecurityV } @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - boolean result = super.dispatchTouchEvent(ev); + public boolean onTouchEvent(MotionEvent ev) { + boolean result = super.onTouchEvent(ev); // as long as the user is entering a pattern (i.e sending a touch event that was handled // by this screen), keep poking the wake lock so that the screen will stay on. final long elapsed = SystemClock.elapsedRealtime() - mLastPokeTime; @@ -237,10 +237,11 @@ public class KeyguardPatternView extends GridLayout implements KeyguardSecurityV public void onPatternDetected(List<LockPatternView.Cell> pattern) { if (mLockPatternUtils.checkPattern(pattern)) { + mCallback.reportSuccessfulUnlockAttempt(); mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct); - mCallback.dismiss(true); // keyguardDone(true) KeyStore.getInstance().password(LockPatternUtils.patternToString(pattern)); mTotalFailedPatternAttempts = 0; + mCallback.dismiss(true); } else { if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { mCallback.userActivity(UNLOCK_PATTERN_WAKE_INTERVAL_MS); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityViewFlipper.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityViewFlipper.java index 911cfe0..c4e1607 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityViewFlipper.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityViewFlipper.java @@ -40,8 +40,8 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper { } @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - boolean result = super.dispatchTouchEvent(ev); + public boolean onTouchEvent(MotionEvent ev) { + boolean result = super.onTouchEvent(ev); mTempRect.set(0, 0, 0, 0); for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java index 4032db0..e6fb1a7 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java @@ -131,8 +131,7 @@ public class KeyguardViewManager { mKeyguardHost = new ViewManagerHost(mContext); int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN - | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER - | WindowManager.LayoutParams.FLAG_SLIPPERY; + | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; if (!mNeedsInput) { flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; |