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

Commit e41e6185 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Make the bubble bar flag dynamic in Launcher.

Changing the flag currently requires a reboot, because it is read once when the process starts and never changes.
This change triggers a re-read of the flag value from SystemProperties whenever Taskbar is recreated.
This allows setting the flag as part of integration tests for bubble bar.

Bug: 273994695
Test: Manual:
       - turn flag off
       - create bubbles
       - observe floating bubbles are added
       - turn flag on
       - change navigation mode to gesture navigation
       - observe bubble bar becomes visible
Change-Id: I277ea6aa2c8d3ab04094537bf4cd31630310dfec
parent 8502a7fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
    }

    public boolean isBubbleBarEnabled() {
        return BubbleBarController.BUBBLE_BAR_ENABLED;
        return BubbleBarController.isBubbleBarEnabled();
    }

    /** Whether the bubble bar has any bubbles. */
+2 −1
Original line number Diff line number Diff line
@@ -218,7 +218,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

        // If Bubble bar is present, TaskbarControllers depends on it so build it first.
        Optional<BubbleControllers> bubbleControllersOptional = Optional.empty();
        if (BubbleBarController.BUBBLE_BAR_ENABLED && bubbleBarView != null) {
        BubbleBarController.onTaskbarRecreated();
        if (BubbleBarController.isBubbleBarEnabled() && bubbleBarView != null) {
            bubbleControllersOptional = Optional.of(new BubbleControllers(
                    new BubbleBarController(this, bubbleBarView),
                    new BubbleBarViewController(this, bubbleBarView),
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ package com.android.launcher3.taskbar;

import static android.view.View.VISIBLE;

import static com.android.launcher3.taskbar.bubbles.BubbleBarController.BUBBLE_BAR_ENABLED;
import static com.android.launcher3.taskbar.bubbles.BubbleBarController.isBubbleBarEnabled;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED;
import static com.android.wm.shell.common.bubbles.BubbleConstants.BUBBLE_EXPANDED_SCRIM_ALPHA;
@@ -83,7 +83,7 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa
     * Updates the scrim state based on the flags.
     */
    public void updateStateForSysuiFlags(int stateFlags, boolean skipAnim) {
        if (BUBBLE_BAR_ENABLED && DisplayController.isTransientTaskbar(mActivity)) {
        if (isBubbleBarEnabled() && DisplayController.isTransientTaskbar(mActivity)) {
            // These scrims aren't used if bubble bar & transient taskbar are active.
            return;
        }
+20 −6
Original line number Diff line number Diff line
@@ -85,17 +85,31 @@ import java.util.concurrent.Executors;
 * information to render each of the bubbles & dispatches changes to
 * {@link BubbleBarViewController} which will then update {@link BubbleBarView} as needed.
 *
 * For details around the behavior of the bubble bar, see {@link BubbleBarView}.
 * <p>For details around the behavior of the bubble bar, see {@link BubbleBarView}.
 */
public class BubbleBarController extends IBubblesListener.Stub {

    private static final String TAG = BubbleBarController.class.getSimpleName();
    private static final boolean DEBUG = false;

    // Whether bubbles are showing in the bubble bar from launcher
    public static final boolean BUBBLE_BAR_ENABLED =
    /**
     * Determines whether bubbles can be shown in the bubble bar. This value updates when the
     * taskbar is recreated.
     *
     * @see #onTaskbarRecreated()
     */
    private static boolean sBubbleBarEnabled =
            SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false);

    /** Whether showing bubbles in the launcher bubble bar is enabled. */
    public static boolean isBubbleBarEnabled() {
        return sBubbleBarEnabled;
    }

    /** Re-reads the value of the flag from SystemProperties when taskbar is recreated. */
    public static void onTaskbarRecreated() {
        sBubbleBarEnabled = SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false);
    }
    private static final int MASK_HIDE_BUBBLE_BAR = SYSUI_STATE_BOUNCER_SHOWING
            | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
            | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
@@ -167,7 +181,7 @@ public class BubbleBarController extends IBubblesListener.Stub {

        mSystemUiProxy = SystemUiProxy.INSTANCE.get(context);

        if (BUBBLE_BAR_ENABLED) {
        if (sBubbleBarEnabled) {
            mSystemUiProxy.setBubblesListener(this);
        }
        mMainExecutor = MAIN_EXECUTOR;
@@ -191,9 +205,9 @@ public class BubbleBarController extends IBubblesListener.Stub {

        bubbleControllers.runAfterInit(() -> {
            mBubbleBarViewController.setHiddenForBubbles(
                    !BUBBLE_BAR_ENABLED || mBubbles.isEmpty());
                    !sBubbleBarEnabled || mBubbles.isEmpty());
            mBubbleStashedHandleViewController.setHiddenForBubbles(
                    !BUBBLE_BAR_ENABLED || mBubbles.isEmpty());
                    !sBubbleBarEnabled || mBubbles.isEmpty());
            mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse(
                    key -> setSelectedBubble(mBubbles.get(key)));
        });