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

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

Add a flag for the bubble bar

This is an UnreleasedFlag which is only available in SysUI, so we
set it on Bubbles via BubblesManager which is part of SysUI.

Changes to support bubble bar will happen behind this flag.

Bug: 253318833
Bug: 256873975
Test: manual - enable flag and add a bubble on a large screen device
             - observe that the bubbles are pinned to the bottom
Change-Id: I0d86a71b66db683837bf639d9067d92703b4364e
parent 46faccde
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -150,6 +150,9 @@ 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;
@@ -210,7 +213,6 @@ public class BubbleController implements ConfigurationChangeListener {
    /** Drag and drop controller to register listener for onDragStarted. */
    private DragAndDropController mDragAndDropController;

  
    public BubbleController(Context context,
            ShellInit shellInit,
            ShellCommandHandler shellCommandHandler,
@@ -526,6 +528,12 @@ 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 this userId belongs to the current user. */
    private boolean isCurrentProfile(int userId) {
        return userId == UserHandle.USER_ALL
@@ -592,6 +600,12 @@ public class BubbleController implements ConfigurationChangeListener {
            mStackView.setUnbubbleConversationCallback(mSysuiProxy::onUnbubbleConversation);
        }

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

        addToWindowManagerMaybe();
    }

@@ -1794,6 +1808,13 @@ 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(
+5 −0
Original line number Diff line number Diff line
@@ -242,6 +242,11 @@ 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 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.systemui.demomode.dagger.DemoModeModule;
import com.android.systemui.doze.dagger.DozeComponent;
import com.android.systemui.dreams.dagger.DreamModule;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.FlagsModule;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.data.BouncerViewModule;
@@ -240,6 +241,7 @@ public abstract class SystemUIModule {
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
            FeatureFlags featureFlags,
            @Main Executor sysuiMainExecutor) {
        return Optional.ofNullable(BubblesManager.create(context,
                bubblesOptional,
@@ -256,6 +258,7 @@ public abstract class SystemUIModule {
                notifCollection,
                notifPipeline,
                sysUiState,
                featureFlags,
                sysuiMainExecutor));
    }

+3 −0
Original line number Diff line number Diff line
@@ -283,6 +283,9 @@ object Flags {
    val ENABLE_PIP_KEEP_CLEAR_ALGORITHM =
        SysPropBooleanFlag(1110, "persist.wm.debug.enable_pip_keep_clear_algorithm", false)

    // TODO(b/256873975): Tracking Bug
    @JvmField @Keep val WM_BUBBLE_BAR = UnreleasedFlag(1111)

    // 1200 - predictive back
    @JvmField
    @Keep
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ 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;

@@ -51,6 +52,7 @@ import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.model.SysUiState;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shared.system.QuickStepContract;
@@ -129,6 +131,7 @@ public class BubblesManager {
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
            FeatureFlags featureFlags,
            Executor sysuiMainExecutor) {
        if (bubblesOptional.isPresent()) {
            return new BubblesManager(context,
@@ -146,6 +149,7 @@ public class BubblesManager {
                    notifCollection,
                    notifPipeline,
                    sysUiState,
                    featureFlags,
                    sysuiMainExecutor);
        } else {
            return null;
@@ -168,6 +172,7 @@ public class BubblesManager {
            CommonNotifCollection notifCollection,
            NotifPipeline notifPipeline,
            SysUiState sysUiState,
            FeatureFlags featureFlags,
            Executor sysuiMainExecutor) {
        mContext = context;
        mBubbles = bubbles;
@@ -352,6 +357,7 @@ public class BubblesManager {
                });
            }
        };
        mBubbles.setBubbleBarEnabled(featureFlags.isEnabled(WM_BUBBLE_BAR));
        mBubbles.setSysuiProxy(mSysuiProxy);
    }

Loading