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

Commit 41769959 authored by Mady Mellor's avatar Mady Mellor
Browse files

Change flag to sysprop because we need it in launcher too

Also introduces method to check if the bubble bar is showing since
it depends on being on a large screen and the flag is true.

Bug: 253318833
Bug: 256873975
Test: treehugger
Change-Id: I484c83c49e3f6722b544e43b9f5706f653d630a4
parent 9d2413c9
Loading
Loading
Loading
Loading
+14 −20
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import android.os.Binder;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.notification.NotificationListenerService;
@@ -125,6 +126,15 @@ public class BubbleController implements ConfigurationChangeListener {
    private static final String SYSTEM_DIALOG_REASON_KEY = "reason";
    private static final String SYSTEM_DIALOG_REASON_GESTURE_NAV = "gestureNav";

    // TODO(b/256873975) Should use proper flag when available to shell/launcher
    /**
     * Whether bubbles are showing in the bubble bar from launcher. This is only available
     * on large screens and {@link BubbleController#isShowingAsBubbleBar()} should be used
     * to check all conditions that indicate if the bubble bar is in use.
     */
    private static final boolean BUBBLE_BAR_ENABLED =
            SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false);

    private final Context mContext;
    private final BubblesImpl mImpl = new BubblesImpl();
    private Bubbles.BubbleExpandListener mExpandListener;
@@ -150,9 +160,6 @@ public class BubbleController implements ConfigurationChangeListener {

    private final ShellExecutor mBackgroundExecutor;

    // Whether or not we should show bubbles pinned at the bottom of the screen.
    private boolean mIsBubbleBarEnabled;

    private BubbleLogger mLogger;
    private BubbleData mBubbleData;
    @Nullable private BubbleStackView mStackView;
@@ -533,10 +540,10 @@ public class BubbleController implements ConfigurationChangeListener {
        mDataRepository.removeBubblesForUser(removedUserId, parentUserId);
    }

    // TODO(b/256873975): Should pass this into the constructor once flags are available to shell.
    /** Sets whether the bubble bar is enabled (i.e. bubbles pinned to bottom on large screens). */
    public void setBubbleBarEnabled(boolean enabled) {
        mIsBubbleBarEnabled = enabled;
    /** Whether bubbles are showing in the bubble bar. */
    public boolean isShowingAsBubbleBar() {
        // TODO(b/269670598): should also check that we're in gesture nav
        return BUBBLE_BAR_ENABLED && mBubblePositioner.isLargeScreen();
    }

    /** Whether this userId belongs to the current user. */
@@ -605,12 +612,6 @@ public class BubbleController implements ConfigurationChangeListener {
            mStackView.setUnbubbleConversationCallback(mSysuiProxy::onUnbubbleConversation);
        }

        if (mIsBubbleBarEnabled && mBubblePositioner.isLargeScreen()) {
            mBubblePositioner.setUsePinnedLocation(true);
        } else {
            mBubblePositioner.setUsePinnedLocation(false);
        }

        addToWindowManagerMaybe();
    }

@@ -1851,13 +1852,6 @@ public class BubbleController implements ConfigurationChangeListener {
            });
        }

        @Override
        public void setBubbleBarEnabled(boolean enabled) {
            mMainExecutor.execute(() -> {
                BubbleController.this.setBubbleBarEnabled(enabled);
            });
        }

        @Override
        public void onNotificationPanelExpandedChanged(boolean expanded) {
            mMainExecutor.execute(
+0 −5
Original line number Diff line number Diff line
@@ -257,11 +257,6 @@ public interface Bubbles {
     */
    void onUserRemoved(int removedUserId);

    /**
     * Sets whether bubble bar should be enabled or not.
     */
    void setBubbleBarEnabled(boolean enabled);

    /** Listener to find out about stack expansion / collapse events. */
    interface BubbleExpandListener {
        /**
+3 −1
Original line number Diff line number Diff line
@@ -423,7 +423,9 @@ object Flags {
        )

    // TODO(b/256873975): Tracking Bug
    @JvmField @Keep val WM_BUBBLE_BAR = unreleasedFlag(1111, "wm_bubble_bar")
    @JvmField
    @Keep
    val WM_BUBBLE_BAR = sysPropBooleanFlag(1111, "persist.wm.debug.bubble_bar", default = false)

    // TODO(b/260271148): Tracking bug
    @Keep
+0 −2
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static android.service.notification.NotificationListenerService.REASON_GR
import static android.service.notification.NotificationStats.DISMISSAL_BUBBLE;
import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL;

import static com.android.systemui.flags.Flags.WM_BUBBLE_BAR;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;

@@ -358,7 +357,6 @@ public class BubblesManager {
                });
            }
        };
        mBubbles.setBubbleBarEnabled(featureFlags.isEnabled(WM_BUBBLE_BAR));
        mBubbles.setSysuiProxy(mSysuiProxy);
    }