am 69d53b0e: Merge "Enforcing falsing-threshold on touch when using AoD" into lmp-dev

* commit '69d53b0ee95c7b27223d12a67bbf653b3b8c9004':
  Enforcing falsing-threshold on touch when using AoD
This commit is contained in:
Selim Cinek
2014-09-23 19:34:28 +00:00
committed by Android Git Automerger
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();
@@ -2118,10 +2119,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
@@ -3909,6 +3914,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
public void onScreenTurnedOff() {
mScreenOnFromKeyguard = false;
mScreenOnComingFromTouch = false;
mStackScroller.setAnimationsEnabled(false);
}
@@ -4011,10 +4017,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) {