diff options
| author | 2019-06-27 16:53:29 +0000 | |
|---|---|---|
| committer | 2019-06-27 16:53:29 +0000 | |
| commit | 67232a88c2642f0dc39a167beb26f208dda79b07 (patch) | |
| tree | 133a3f5a995b97baae82b69923f58467826eb227 | |
| parent | 4ecc6562f6ce87a01a2970df08e80a7c2e4a264f (diff) | |
| parent | b59e15eab39edde7cd4fe0386c233d5b012285e4 (diff) | |
Merge "Transfer focus to open panel" into qt-r1-dev
4 files changed, 50 insertions, 23 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 99f9e99cf359..ed6f599b69a6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -119,7 +119,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private boolean mIsEnabled; private int mCurrentBoundedUserId = -1; private float mNavBarButtonAlpha; - private MotionEvent mStatusBarGestureDownEvent; + private boolean mInputFocusTransferStarted; private float mWindowCornerRadius; private boolean mSupportsRoundedCornersOnWindows; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; @@ -164,6 +164,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } } + // TODO: change the method signature to use (boolean inputFocusTransferStarted) @Override public void onStatusBarMotionEvent(MotionEvent event) { if (!verifyCaller("onStatusBarMotionEvent")) { @@ -175,16 +176,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mHandler.post(()->{ StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class); if (bar != null) { - bar.dispatchNotificationsPanelTouchEvent(event); int action = event.getActionMasked(); if (action == ACTION_DOWN) { - mStatusBarGestureDownEvent = MotionEvent.obtain(event); + mInputFocusTransferStarted = true; + } if (action == ACTION_UP || action == ACTION_CANCEL) { - mStatusBarGestureDownEvent.recycle(); - mStatusBarGestureDownEvent = null; + mInputFocusTransferStarted = false; } + bar.onInputFocusTransfer(mInputFocusTransferStarted); event.recycle(); } }); @@ -590,14 +591,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } public void cleanupAfterDeath() { - if (mStatusBarGestureDownEvent != null) { + if (mInputFocusTransferStarted) { mHandler.post(()-> { StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class); if (bar != null) { - mStatusBarGestureDownEvent.setAction(MotionEvent.ACTION_CANCEL); - bar.dispatchNotificationsPanelTouchEvent(mStatusBarGestureDownEvent); - mStatusBarGestureDownEvent.recycle(); - mStatusBarGestureDownEvent = null; + mInputFocusTransferStarted = false; + bar.onInputFocusTransfer(false); } }); } @@ -782,6 +781,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis pw.println(QuickStepContract.isBackGestureDisabled(mSysUiStateFlags)); pw.print(" assistantGestureDisabled="); pw.println(QuickStepContract.isAssistantGestureDisabled(mSysUiStateFlags)); + pw.print(" mInputFocusTransferStarted="); pw.println(mInputFocusTransferStarted); } public interface OverviewProxyListener { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 32dc96d75898..53ce167542f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -290,6 +290,8 @@ public class NotificationPanelView extends PanelView implements private boolean mIsFullWidth; private boolean mBlockingExpansionForCurrentTouch; + private boolean mExpectingOpenPanelGesture; + /** * Current dark amount that follows regular interpolation curve of animation. */ @@ -1246,6 +1248,28 @@ public class NotificationPanelView extends PanelView implements } } + /** + * Input focus transfer is about to happen. + */ + public void startWaitingForOpenPanelGesture() { + if (!isFullyCollapsed()) { + return; + } + mExpectingOpenPanelGesture = true; + onTrackingStarted(); + } + + /** + * Input focus transfer has already happened as this view decided to intercept + * very first down event. + */ + public void stopWaitingForOpenPanelGesture() { + if (mExpectingOpenPanelGesture) { + mExpectingOpenPanelGesture = false; + onTrackingStopped(false); + } + } + @Override protected boolean flingExpands(float vel, float vectorVel, float x, float y) { boolean expands = super.flingExpands(vel, vectorVel, x, y); @@ -1258,8 +1282,12 @@ public class NotificationPanelView extends PanelView implements } @Override - protected boolean hasConflictingGestures() { - return mBarState != StatusBarState.SHADE; + protected boolean shouldGestureWaitForTouchSlop() { + if (mExpectingOpenPanelGesture) { + mExpectingOpenPanelGesture = false; + return false; + } + return isFullyCollapsed() || mBarState != StatusBarState.SHADE; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index a9a3b2d866e1..a5b221bbad8c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -301,7 +301,7 @@ public abstract class PanelView extends FrameLayout { final float y = event.getY(pointerIndex); if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { - mGestureWaitForTouchSlop = isFullyCollapsed() || hasConflictingGestures(); + mGestureWaitForTouchSlop = shouldGestureWaitForTouchSlop(); mIgnoreXTouchSlop = isFullyCollapsed() || shouldGestureIgnoreXTouchSlop(x, y); } @@ -519,7 +519,7 @@ public abstract class PanelView extends FrameLayout { return (int) (mUnlockFalsingThreshold * factor); } - protected abstract boolean hasConflictingGestures(); + protected abstract boolean shouldGestureWaitForTouchSlop(); protected abstract boolean shouldGestureIgnoreXTouchSlop(float x, float y); 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 7db4afceee89..918896873a5f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -1918,19 +1918,18 @@ public class StatusBar extends SystemUI implements DemoMode, mStatusBarKeyguardViewManager.readyForKeyguardDone(); } - public void dispatchNotificationsPanelTouchEvent(MotionEvent ev) { + /** + * Called when another window is about to transfer it's input focus. + */ + public void onInputFocusTransfer(boolean start) { if (!mCommandQueue.panelsEnabled()) { return; } - mNotificationPanel.dispatchTouchEvent(ev); - int action = ev.getAction(); - if (action == MotionEvent.ACTION_DOWN) { - // Start ignoring all touch events coming to status bar window. - // TODO: handle case where ACTION_UP is not sent over the binder - mStatusBarWindowController.setNotTouchable(true); - } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { - mStatusBarWindowController.setNotTouchable(false); + if (start) { + mNotificationPanel.startWaitingForOpenPanelGesture(); + } else { + mNotificationPanel.stopWaitingForOpenPanelGesture(); } } |