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

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

Adds BubbleControllers to TaskbarControllers

* BubbleControllers is optionally available (gated behind a flag).
* The bubble bar controllers follow init & onDestroy after the taskbar
  controllers.
* Adds the relevant views used by the bubble controllers to the
  transient taskbar layout.

Bug: 253318833
Test: manual, with other CLs, see go/bubble-bar-tests
Flag: WM_BUBBLE_BAR
Change-Id: I685163cdcc912768b1a720952762f4cbc602b14b
parent 50e8d0ff
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -38,6 +38,20 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <com.android.launcher3.taskbar.bubbles.BubbleBarView
        android:id="@+id/taskbar_bubbles"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/bubblebar_size"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/transient_taskbar_bottom_margin"
        android:layout_marginBottom="@dimen/transient_taskbar_bottom_margin"
        android:paddingEnd="@dimen/taskbar_icon_spacing"
        android:paddingStart="@dimen/taskbar_icon_spacing"
        android:visibility="gone"
        android:gravity="center"
        android:clipChildren="false"
        />

    <FrameLayout
        android:id="@+id/navbuttons_view"
        android:layout_width="match_parent"
@@ -74,8 +88,18 @@
    <com.android.launcher3.taskbar.StashedHandleView
        android:id="@+id/stashed_handle"
        tools:comment1="The actual size and shape will be set as a ViewOutlineProvider at runtime"
        android:layout_width="match_parent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/taskbar_stashed_handle_dark_color"
        android:clipToOutline="true"
        android:layout_gravity="bottom"/>

    <com.android.launcher3.taskbar.StashedHandleView
        android:id="@+id/stashed_bubble_handle"
        tools:comment1="The actual size and shape will be set as a ViewOutlineProvider at runtime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:background="@color/taskbar_stashed_handle_dark_color"
        android:clipToOutline="true"
        android:layout_gravity="bottom"/>
+21 −1
Original line number Diff line number Diff line
@@ -83,6 +83,12 @@ import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.AutohideSuspendFlag;
import com.android.launcher3.taskbar.TaskbarTranslationController.TransitionCallback;
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsController;
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
import com.android.launcher3.taskbar.bubbles.BubbleBarView;
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController;
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
import com.android.launcher3.taskbar.bubbles.BubbleStashController;
import com.android.launcher3.taskbar.bubbles.BubbleStashedHandleViewController;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -106,6 +112,7 @@ import com.android.systemui.unfold.updates.RotationChangeProvider;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;

import java.io.PrintWriter;
import java.util.Optional;

/**
 * The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements
@@ -195,11 +202,23 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        TaskbarScrimView taskbarScrimView = mDragLayer.findViewById(R.id.taskbar_scrim);
        FrameLayout navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
        StashedHandleView stashedHandleView = mDragLayer.findViewById(R.id.stashed_handle);
        BubbleBarView bubbleBarView = mDragLayer.findViewById(R.id.taskbar_bubbles);
        StashedHandleView bubbleHandleView = mDragLayer.findViewById(R.id.stashed_bubble_handle);

        mAccessibilityDelegate = new TaskbarShortcutMenuAccessibilityDelegate(this);

        final boolean isDesktopMode = getPackageManager().hasSystemFeature(FEATURE_PC);

        // If Bubble bar is present, TaskbarControllers depends on it so build it first.
        Optional<BubbleControllers> bubbleControllersOptional = Optional.empty();
        if (BubbleBarController.BUBBLE_BAR_ENABLED) {
            bubbleControllersOptional = Optional.of(new BubbleControllers(
                    new BubbleBarController(this, bubbleBarView),
                    new BubbleBarViewController(this, bubbleBarView),
                    new BubbleStashController(this),
                    new BubbleStashedHandleViewController(this, bubbleHandleView)));
        }

        // Construct controllers.
        mControllers = new TaskbarControllers(this,
                new TaskbarDragController(this),
@@ -239,7 +258,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                        : TaskbarRecentAppsController.DEFAULT,
                new TaskbarEduTooltipController(this),
                new KeyboardQuickSwitchController(),
                new TaskbarDividerPopupController(this));
                new TaskbarDividerPopupController(this),
                bubbleControllersOptional);
    }

    public void init(@NonNull TaskbarSharedState sharedState) {
+8 −1
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ import androidx.annotation.VisibleForTesting;

import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsController;
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.systemui.shared.rotation.RotationButtonController;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Hosts various taskbar controllers to facilitate passing between one another.
@@ -61,6 +63,7 @@ public class TaskbarControllers {
    public final TaskbarEduTooltipController taskbarEduTooltipController;
    public final KeyboardQuickSwitchController keyboardQuickSwitchController;
    public final TaskbarDividerPopupController taskbarPinningController;
    public final Optional<BubbleControllers> bubbleControllers;

    @Nullable private LoggableTaskbarController[] mControllersToLog = null;
    @Nullable private BackgroundRendererController[] mBackgroundRendererControllers = null;
@@ -107,7 +110,8 @@ public class TaskbarControllers {
            TaskbarRecentAppsController taskbarRecentAppsController,
            TaskbarEduTooltipController taskbarEduTooltipController,
            KeyboardQuickSwitchController keyboardQuickSwitchController,
            TaskbarDividerPopupController taskbarPinningController) {
            TaskbarDividerPopupController taskbarPinningController,
            Optional<BubbleControllers> bubbleControllers) {
        this.taskbarActivityContext = taskbarActivityContext;
        this.taskbarDragController = taskbarDragController;
        this.navButtonController = navButtonController;
@@ -133,6 +137,7 @@ public class TaskbarControllers {
        this.taskbarEduTooltipController = taskbarEduTooltipController;
        this.keyboardQuickSwitchController = keyboardQuickSwitchController;
        this.taskbarPinningController = taskbarPinningController;
        this.bubbleControllers = bubbleControllers;
    }

    /**
@@ -167,6 +172,7 @@ public class TaskbarControllers {
        taskbarEduTooltipController.init(this);
        keyboardQuickSwitchController.init(this);
        taskbarPinningController.init(this);
        bubbleControllers.ifPresent(controllers -> controllers.init(this));

        mControllersToLog = new LoggableTaskbarController[] {
                taskbarDragController, navButtonController, navbarButtonsViewController,
@@ -226,6 +232,7 @@ public class TaskbarControllers {
        taskbarRecentAppsController.onDestroy();
        keyboardQuickSwitchController.onDestroy();
        taskbarStashController.onDestroy();
        bubbleControllers.ifPresent(controllers -> controllers.onDestroy());

        mControllersToLog = null;
        mBackgroundRendererControllers = null;
+4 −0
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@
package com.android.launcher3.taskbar

import com.android.launcher3.taskbar.allapps.TaskbarAllAppsController
import com.android.launcher3.taskbar.bubbles.BubbleControllers
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController
import com.android.systemui.shared.rotation.RotationButtonController
import java.util.Optional
import org.junit.Before
import org.mockito.Mock
import org.mockito.MockitoAnnotations
@@ -54,6 +56,7 @@ abstract class TaskbarBaseTestCase {
    @Mock lateinit var taskbarEduTooltipController: TaskbarEduTooltipController
    @Mock lateinit var keyboardQuickSwitchController: KeyboardQuickSwitchController
    @Mock lateinit var taskbarPinningController: TaskbarDividerPopupController
    @Mock lateinit var optionalBubbleControllers: Optional<BubbleControllers>

    lateinit var taskbarControllers: TaskbarControllers

@@ -94,6 +97,7 @@ abstract class TaskbarBaseTestCase {
                taskbarEduTooltipController,
                keyboardQuickSwitchController,
                taskbarPinningController,
                optionalBubbleControllers,
            )
    }
}