From: Hyunyoung Song Date: Tue, 2 Jul 2019 20:39:05 +0000 (-0700) Subject: swipe down to open noti shade fling support X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=43a8cad44b91096fe81f2daa1f62b9c5e71bf6c4;p=android-x86%2Fframeworks-base.git swipe down to open noti shade fling support Bug: 136431648 Test: go/swipe-down-home-open-notishade Change-Id: Idef337ae0977e8ec3fb6288eb0cc84fc48619ca1 --- diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index ed6f599b69a6..19edc94a3871 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -120,6 +120,8 @@ public class OverviewProxyService implements CallbackControllerACTION_UP may happen immediately + // without any ACTION_MOVE event. + // In such case, simply expand the panel instead of being stuck at the bottom bar. + if (mLastEventSynthesizedDown && event.getAction() == MotionEvent.ACTION_UP) { + expand(true /* animate */); + } + initDownStates(event); if (!mIsExpanding && !shouldQuickSettingsIntercept(mDownX, mDownY, 0) && mPulseExpansionHandler.onTouchEvent(event)) { // We're expanding all the other ones shouldn't get this anymore @@ -1255,17 +1274,28 @@ public class NotificationPanelView extends PanelView implements if (!isFullyCollapsed()) { return; } - mExpectingOpenPanelGesture = true; + mExpectingSynthesizedDown = true; onTrackingStarted(); } /** - * Input focus transfer has already happened as this view decided to intercept - * very first down event. + * Called when this view is no longer waiting for input focus transfer. + * + * There are two scenarios behind this function call. First, input focus transfer + * has successfully happened and this view already received synthetic DOWN event. + * (mExpectingSynthesizedDown == false). Do nothing. + * + * Second, before input focus transfer finished, user may have lifted finger + * in previous window and this window never received synthetic DOWN event. + * (mExpectingSynthesizedDown == true). + * In this case, we use the velocity to trigger fling event. + * + * @param velocity unit is in px / millis */ - public void stopWaitingForOpenPanelGesture() { - if (mExpectingOpenPanelGesture) { - mExpectingOpenPanelGesture = false; + public void stopWaitingForOpenPanelGesture(float velocity) { + if (mExpectingSynthesizedDown) { + mExpectingSynthesizedDown = false; + fling(velocity > 1f ? 1000f * velocity : 0, true /* animate */); onTrackingStopped(false); } } @@ -1283,8 +1313,8 @@ public class NotificationPanelView extends PanelView implements @Override protected boolean shouldGestureWaitForTouchSlop() { - if (mExpectingOpenPanelGesture) { - mExpectingOpenPanelGesture = false; + if (mExpectingSynthesizedDown) { + mExpectingSynthesizedDown = false; return false; } return isFullyCollapsed() || mBarState != StatusBarState.SHADE; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 55f61fa8a6a0..e0755384c148 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -80,7 +80,6 @@ import android.metrics.LogMaker; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; -import android.os.Debug; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -1930,7 +1929,7 @@ public class StatusBar extends SystemUI implements DemoMode, /** * Called when another window is about to transfer it's input focus. */ - public void onInputFocusTransfer(boolean start) { + public void onInputFocusTransfer(boolean start, float velocity) { if (!mCommandQueue.panelsEnabled()) { return; } @@ -1938,7 +1937,7 @@ public class StatusBar extends SystemUI implements DemoMode, if (start) { mNotificationPanel.startWaitingForOpenPanelGesture(); } else { - mNotificationPanel.stopWaitingForOpenPanelGesture(); + mNotificationPanel.stopWaitingForOpenPanelGesture(velocity); } }