Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ec838b6 authored by Beverly's avatar Beverly
Browse files

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
parent cd22b37b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.view.ViewTreeObserver;
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 @@ import com.android.systemui.statusbar.policy.ConfigurationController.Configurati
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 @@ public final class StatusBarTouchableRegionManager implements
    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 @@ public final class StatusBarTouchableRegionManager implements
        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 @@ public final class StatusBarTouchableRegionManager implements
                mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpManager.isHeadsUpGoingAway()
                        || mBubbleController.hasBubbles()
                        || mForceCollapsedUntilLayout
                        || hasCutoutInset;
                        || hasCutoutInset
                        || mStatusBarWindowController.getForcePluginOpen();
        if (shouldObserve == mShouldAdjustInsets) {
            return;
        }
+25 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
    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 class StatusBarWindowController implements Callback, Dumpable, Configurat
    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 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
        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 class StatusBarWindowController implements Callback, Dumpable, Configurat
    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);
    }
}