From c12199f40ee2351f53eb6cf44a7c0c05a2d5aabe Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Tue, 9 Jun 2020 14:41:34 -0400 Subject: [PATCH] Fix obscured touchable region code. This fixes the issue where bubbles are untouchable after being opened from the shade, as well as issues with the animation CL. The root cause here was that the obscured touchable region is only updated after an explicit call to ActivityView.onLocationChanged(). We were only calling this when the Bubble initially expanded, and at that point, the notification shade was expanded, so we set the touchable region to empty. When the shade collapses, the AV's onLocationChanged() is never called again, so the touchable region remains empty. Fixing this is actually very easy - we originally needed to empty the touchable region when the shade was expanded because we were in its window (and didn't want to steal its touches). Now that we are in our own window, we don't need to worry about that, so the shade check can be deleted entirely. This also adds a check for mExpanded = false, since a collapsed stack should never be able to dispatch touch events to the AV. Test: expand bubbs from shade Fixes: 157756567 Change-Id: I8350670f34660f6b725904309c5d6c70abb8a33e --- .../src/com/android/systemui/bubbles/BubbleController.java | 2 +- .../src/com/android/systemui/bubbles/BubbleStackView.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index cf793f021a294..2dd236ab53e8b 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -617,7 +617,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mStackView == null) { mStackView = new BubbleStackView( mContext, mBubbleData, mSurfaceSynchronizer, mFloatingContentCoordinator, - mSysUiState, mNotificationShadeWindowController, this::onAllBubblesAnimatedOut, + mSysUiState, this::onAllBubblesAnimatedOut, this::onImeVisibilityChanged); mStackView.addView(mBubbleScrim); if (mExpandListener != null) { diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 95c8d08841df1..22951cf6c0243 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -348,8 +348,6 @@ public class BubbleStackView extends FrameLayout @NonNull private final SurfaceSynchronizer mSurfaceSynchronizer; - private final NotificationShadeWindowController mNotificationShadeWindowController; - /** * Callback to run when the IME visibility changes - BubbleController uses this to update the * Bubbles window focusability flags with the WindowManager. @@ -682,7 +680,6 @@ public class BubbleStackView extends FrameLayout @Nullable SurfaceSynchronizer synchronizer, FloatingContentCoordinator floatingContentCoordinator, SysUiState sysUiState, - NotificationShadeWindowController notificationShadeWindowController, Runnable allBubblesAnimatedOutAction, Consumer onImeVisibilityChanged) { super(context); @@ -691,7 +688,6 @@ public class BubbleStackView extends FrameLayout mInflater = LayoutInflater.from(context); mSysUiState = sysUiState; - mNotificationShadeWindowController = notificationShadeWindowController; Resources res = getResources(); mMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered); @@ -1802,7 +1798,7 @@ public class BubbleStackView extends FrameLayout public void subtractObscuredTouchableRegion(Region touchableRegion, View view) { // If the notification shade is expanded, or the manage menu is open, we shouldn't let the // ActivityView steal any touch events from any location. - if (mNotificationShadeWindowController.getPanelExpanded() || mShowingManage) { + if (!mIsExpanded || mShowingManage) { touchableRegion.setEmpty(); } }