diff options
4 files changed, 58 insertions, 0 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index 1c46f12f02cd..ece2bb9a9507 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -17,6 +17,7 @@ package com.android.systemui.shared.recents; import android.graphics.Rect; +import android.view.MotionEvent; /** * Temporary callbacks into SystemUI. @@ -60,4 +61,14 @@ interface ISystemUiProxy { * needed from current value */ void setBackButtonAlpha(float alpha, boolean animate) = 8; + + /** + * Proxies motion events from the homescreen UI to the status bar. Only called when + * swipe down is detected on WORKSPACE. The sender guarantees the following order of events on + * the tracking pointer. + * + * Normal gesture: DOWN, MOVE/POINTER_DOWN/POINTER_UP)*, UP or CANCLE + */ + void onStatusBarMotionEvent(in MotionEvent event) = 9; + } diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java index cafdc10beefa..bd2b7a577b3d 100644 --- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java @@ -32,6 +32,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; +import android.view.MotionEvent; import com.android.systemui.OverviewProxyService.OverviewProxyListener; import com.android.systemui.recents.events.EventBus; @@ -111,6 +112,21 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } } + public void onStatusBarMotionEvent(MotionEvent event) { + long token = Binder.clearCallingIdentity(); + try { + // TODO move this logic to message queue + mHandler.post(()->{ + StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class); + if (bar != null) { + bar.dispatchNotificationsPanelTouchEvent(event); + } + }); + } finally { + Binder.restoreCallingIdentity(token); + } + } + public void onSplitScreenInvoked() { if (!verifyCaller("onSplitScreenInvoked")) { return; 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 a318e151d725..6d742cd90fd1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -2148,6 +2148,22 @@ public class StatusBar extends SystemUI implements DemoMode, mStatusBarKeyguardViewManager.readyForKeyguardDone(); } + public void dispatchNotificationsPanelTouchEvent(MotionEvent ev) { + if (!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); + } + } + @Override public void animateExpandNotificationsPanel() { if (SPEW) Log.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index 46264f9dde1f..167bba60b390 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -279,6 +279,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat applyBrightness(state); applyHasTopUi(state); applySleepToken(state); + applyNotTouchable(state); if (mLp.copyFrom(mLpChanged) != 0) { mWindowManager.updateViewLayout(mStatusBarView, mLp); } @@ -330,6 +331,14 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat } } + private void applyNotTouchable(State state) { + if (state.notTouchable) { + mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE; + } else { + mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE; + } + } + public void setKeyguardShowing(boolean showing) { mCurrentState.keyguardShowing = showing; apply(mCurrentState); @@ -454,6 +463,11 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat apply(mCurrentState); } + public void setNotTouchable(boolean notTouchable) { + mCurrentState.notTouchable = notTouchable; + apply(mCurrentState); + } + public void setStateListener(OtherwisedCollapsedListener listener) { mListener = listener; } @@ -501,6 +515,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat boolean forceUserActivity; boolean backdropShowing; boolean wallpaperSupportsAmbientMode; + boolean notTouchable; /** * The {@link StatusBar} state from the status bar. |