OverlayPlugin uses StatusBarTouchableRegionManager
Instead of using OtherwisedCollapsedListener to update the
touchable region, use StatusBarTouchableRegionManager so there aren't
conflicting InternalInsetsInfo set.
Filed a bug to deprecate use of "setCollapseDesired" in OverlayPlugin:
b/133841810
Test: manual
Fixes: 133125670
Change-Id: I31b276bfb9b3296168c82fb3c109adce96a5b3bb
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
index e949ade..3d25749 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
@@ -26,7 +26,6 @@
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import com.android.systemui.Dependency;
-import com.android.systemui.assist.AssistManager;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
@@ -38,7 +37,6 @@
public final class StatusBarTouchableRegionManager implements
OnComputeInternalInsetsListener, ConfigurationListener {
- private final AssistManager mAssistManager = Dependency.get(AssistManager.class);
private final BubbleController mBubbleController = Dependency.get(BubbleController.class);
private final Context mContext;
private final HeadsUpManagerPhone mHeadsUpManager;
@@ -48,6 +46,7 @@
private int mStatusBarHeight;
private final View mStatusBarWindowView;
private boolean mForceCollapsedUntilLayout = false;
+ private final StatusBarWindowController mStatusBarWindowController;
public StatusBarTouchableRegionManager(@NonNull Context context,
HeadsUpManagerPhone headsUpManager,
@@ -57,12 +56,17 @@
mHeadsUpManager = headsUpManager;
mStatusBar = statusBar;
mStatusBarWindowView = statusBarWindowView;
+ mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
initResources();
mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
updateTouchableRegion();
});
+
+ mStatusBarWindowController.setForcePluginOpenListener((forceOpen) -> {
+ updateTouchableRegion();
+ });
Dependency.get(ConfigurationController.class).addCallback(this);
}
@@ -77,7 +81,8 @@
mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpManager.isHeadsUpGoingAway()
|| mBubbleController.hasBubbles()
|| mForceCollapsedUntilLayout
- || hasCutoutInset;
+ || hasCutoutInset
+ || mStatusBarWindowController.getForcePluginOpen();
if (shouldObserve == mShouldAdjustInsets) {
return;
}
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 631920c..f08db1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -80,6 +80,7 @@
private float mScreenBrightnessDoze;
private final State mCurrentState = new State();
private OtherwisedCollapsedListener mListener;
+ private ForcePluginOpenListener mForcePluginOpenListener;
private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class);
@@ -477,6 +478,16 @@
public void setForcePluginOpen(boolean forcePluginOpen) {
mCurrentState.forcePluginOpen = forcePluginOpen;
apply(mCurrentState);
+ if (mForcePluginOpenListener != null) {
+ mForcePluginOpenListener.onChange(forcePluginOpen);
+ }
+ }
+
+ /**
+ * The forcePluginOpen state for the status bar.
+ */
+ public boolean getForcePluginOpen() {
+ return mCurrentState.forcePluginOpen;
}
public void setNotTouchable(boolean notTouchable) {
@@ -525,6 +536,10 @@
mListener = listener;
}
+ public void setForcePluginOpenListener(ForcePluginOpenListener listener) {
+ mForcePluginOpenListener = listener;
+ }
+
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("StatusBarWindowController state:");
pw.println(mCurrentState);
@@ -637,4 +652,14 @@
public interface OtherwisedCollapsedListener {
void setWouldOtherwiseCollapse(boolean otherwiseCollapse);
}
+
+ /**
+ * Listener to indicate forcePluginOpen has changed
+ */
+ public interface ForcePluginOpenListener {
+ /**
+ * Called when mState.forcePluginOpen is changed
+ */
+ void onChange(boolean forceOpen);
+ }
}