From 67ad368d4d549b431d826936e40a679099fefec8 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Tue, 26 Jun 2012 17:42:00 -0400 Subject: [PATCH] Disable assist gesture when keyguard is active Prevent search gesture from firing when keyguard is in restricted input mode, e.g. in Emergency Dialer. Also disable the Home touch listener in this mode to avoid bringing up the ring. Affects both phone and tablets. Bug: 6723749 Change-Id: I60f0aebfcce4cf7f66798ee1212ea326bdad3ef0 --- .../src/com/android/systemui/statusbar/BaseStatusBar.java | 5 +++++ .../com/android/systemui/statusbar/DelegateViewHelper.java | 3 ++- .../com/android/systemui/statusbar/phone/PhoneStatusBar.java | 2 +- .../android/systemui/statusbar/tablet/TabletStatusBar.java | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 04cff96e46ab4..0866d181b4a64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -953,4 +953,9 @@ public abstract class BaseStatusBar extends SystemUI implements } return false; } + + public boolean inKeyguardRestrictedInputMode() { + KeyguardManager km = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); + return km.inKeyguardRestrictedInputMode(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java index 96afbb602a687..4f33e23187156 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java @@ -48,7 +48,8 @@ public class DelegateViewHelper { } public boolean onInterceptTouchEvent(MotionEvent event) { - if (mSourceView == null || mDelegateView == null || mBar.shouldDisableNavbarGestures()) { + if (mSourceView == null || mDelegateView == null + || mBar.shouldDisableNavbarGestures() || mBar.inKeyguardRestrictedInputMode()) { return false; } 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 eff6061c18a37..c0838c2ca7c60 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -608,7 +608,7 @@ public class PhoneStatusBar extends BaseStatusBar { public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: - if (!shouldDisableNavbarGestures()) { + if (!shouldDisableNavbarGestures() && !inKeyguardRestrictedInputMode()) { mHandler.removeCallbacks(mShowSearchPanel); mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 29d8c9807b39d..5cab636564358 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -201,7 +201,7 @@ public class TabletStatusBar extends BaseStatusBar implements public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: - if (!shouldDisableNavbarGestures()) { + if (!shouldDisableNavbarGestures() && !inKeyguardRestrictedInputMode()) { mHandler.removeCallbacks(mShowSearchPanel); mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff); }