Enforcing falsing-threshold on touch when using AoD

Also increased the threshold by a factor of 1.5 if
we are waking up due to a touch.

Bug: 17350239
Change-Id: Ida8bad234b3815abf80ca57f8004f3bc5df003cd
This commit is contained in:
Selim Cinek
2014-09-23 20:44:35 +02:00
parent ee3ef2b8af
commit 29ed3c92ef
3 changed files with 19 additions and 5 deletions

View File

@@ -317,7 +317,7 @@ public abstract class PanelView extends FrameLayout {
}
mJustPeeked = false;
}
if (-h >= mUnlockFalsingThreshold) {
if (-h >= getFalsingThreshold()) {
mTouchAboveFalsingThreshold = true;
}
if (!mJustPeeked && (!waitForTouchSlop || mTracking) && !isTrackingBlocked()) {
@@ -370,6 +370,11 @@ public abstract class PanelView extends FrameLayout {
return !waitForTouchSlop || mTracking;
}
private int getFalsingThreshold() {
float factor = mStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f;
return (int) (mUnlockFalsingThreshold * factor);
}
protected abstract boolean hasConflictingGestures();
protected void onTrackingStopped(boolean expand) {

View File

@@ -262,6 +262,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private StatusBarWindowManager mStatusBarWindowManager;
private UnlockMethodCache mUnlockMethodCache;
private DozeServiceHost mDozeServiceHost;
private boolean mScreenOnComingFromTouch;
int mPixelFormat;
Object mQueueLock = new Object();
@@ -2112,10 +2113,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return mNotificationPanel.isQsExpanded();
}
public boolean isScreenOnComingFromTouch() {
return mScreenOnComingFromTouch;
}
public boolean isFalsingThresholdNeeded() {
boolean onKeyguard = getBarState() == StatusBarState.KEYGUARD;
boolean isMethodInsecure = mUnlockMethodCache.isMethodInsecure();
return onKeyguard && (isMethodInsecure || mDozing);
return onKeyguard && (isMethodInsecure || mDozing || mScreenOnComingFromTouch);
}
@Override // NotificationData.Environment
@@ -3903,6 +3908,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
public void onScreenTurnedOff() {
mScreenOnFromKeyguard = false;
mScreenOnComingFromTouch = false;
mStackScroller.setAnimationsEnabled(false);
}
@@ -4005,10 +4011,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return !mNotificationData.getActiveNotifications().isEmpty();
}
public void wakeUpIfDozing(long time) {
public void wakeUpIfDozing(long time, boolean fromTouch) {
if (mDozing && mScrimController.isPulsing()) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(time);
if (fromTouch) {
mScreenOnComingFromTouch = true;
}
}
}

View File

@@ -132,7 +132,7 @@ public class StatusBarWindowView extends FrameLayout {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
if (down) {
mService.wakeUpIfDozing(event.getEventTime());
mService.wakeUpIfDozing(event.getEventTime(), false);
}
}
if (mService.interceptMediaKey(event)) {
@@ -164,7 +164,7 @@ public class StatusBarWindowView extends FrameLayout {
intercept = mDragDownHelper.onInterceptTouchEvent(ev);
// wake up on a touch down event, if dozing
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
mService.wakeUpIfDozing(ev.getEventTime());
mService.wakeUpIfDozing(ev.getEventTime(), true);
}
}
if (!intercept) {