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

Commit 484ff0fe authored by mpodolian's avatar mpodolian
Browse files

Integrated new BubbleStashControllers into the existing code.

Integrated the PersistentTaskbarStashController and the
TransientTaskbarStashController into the launcher code. Made changes to
the TaskbarInsetsController to set appropriate touchable zones. Updated
the TaskbarUIController to not start the overview transition on clicks
for the collapsed bubble bar.

Bug: 346391377
Fixes: 350065038
Fixes: 355664783
Flag: com.android.wm.shell.enable_bubble_bar_in_persistent_task_bar
Test: com.android.launcher3.taskbar package tests

persistent taskbar and transient taskbar manual testing:
- on launcher home screen expand bubble bar, switch between bubbles,
remove bubble via bubble menu, add bubble, remove bubble with the drug
gesture, add bubble, collapse bubble bar
- repeat previous test on launcher overview screen and inside any
application
- after last test drag expanded bubble view to the opposite side of the
screen

Change-Id: I50f2c510854c4895fdfc9bd453a261c2103286fd
parent 369a5e74
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -35,6 +35,18 @@
        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_with_pointer"
        android:layout_marginHorizontal="@dimen/transient_taskbar_bottom_margin"
        android:paddingTop="@dimen/bubblebar_pointer_visible_size"
        android:visibility="gone"
        android:gravity="center"
        android:layout_gravity="bottom"
        android:clipChildren="false"
        android:elevation="@dimen/bubblebar_elevation" />

    <com.android.launcher3.taskbar.navbutton.NearestTouchFrame
        android:id="@+id/navbuttons_view"
        android:layout_width="match_parent"
+29 −9
Original line number Diff line number Diff line
@@ -110,8 +110,12 @@ import com.android.launcher3.taskbar.bubbles.BubbleControllers;
import com.android.launcher3.taskbar.bubbles.BubbleDismissController;
import com.android.launcher3.taskbar.bubbles.BubbleDragController;
import com.android.launcher3.taskbar.bubbles.BubblePinController;
import com.android.launcher3.taskbar.bubbles.BubbleStashController;
import com.android.launcher3.taskbar.bubbles.BubbleStashedHandleViewController;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.TaskbarHotseatDimensionsProvider;
import com.android.launcher3.taskbar.bubbles.stashing.DeviceProfileDimensionsProviderAdapter;
import com.android.launcher3.taskbar.bubbles.stashing.PersistentBubbleStashController;
import com.android.launcher3.taskbar.bubbles.stashing.TransientBubbleStashController;
import com.android.launcher3.taskbar.customization.TaskbarFeatureEvaluator;
import com.android.launcher3.taskbar.customization.TaskbarSpecsEvaluator;
import com.android.launcher3.taskbar.navbutton.NearestTouchFrame;
@@ -149,6 +153,7 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
import com.android.systemui.unfold.updates.RotationChangeProvider;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
import com.android.wm.shell.Flags;

import java.io.PrintWriter;
import java.util.Collections;
@@ -247,15 +252,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mWindowManager = c.getSystemService(WindowManager.class);

        // Inflate views.
        int taskbarLayout = DisplayController.isTransientTaskbar(this) && !isPhoneMode()
                ? R.layout.transient_taskbar
                : R.layout.taskbar;
        final boolean isTransientTaskbar = DisplayController.isTransientTaskbar(this)
                && !isPhoneMode();
        int taskbarLayout = isTransientTaskbar ? R.layout.transient_taskbar : R.layout.taskbar;
        mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(taskbarLayout, null, false);
        TaskbarView taskbarView = mDragLayer.findViewById(R.id.taskbar_view);
        TaskbarScrimView taskbarScrimView = mDragLayer.findViewById(R.id.taskbar_scrim);
        NearestTouchFrame navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
        StashedHandleView stashedHandleView = mDragLayer.findViewById(R.id.stashed_handle);
        BubbleBarView bubbleBarView = mDragLayer.findViewById(R.id.taskbar_bubbles);
        BubbleBarView bubbleBarView = null;
        if (isTransientTaskbar || Flags.enableBubbleBarInPersistentTaskBar()) {
            bubbleBarView = mDragLayer.findViewById(R.id.taskbar_bubbles);
        }
        StashedHandleView bubbleHandleView = mDragLayer.findViewById(R.id.stashed_bubble_handle);

        mAccessibilityDelegate = new TaskbarShortcutMenuAccessibilityDelegate(this);
@@ -264,11 +272,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        Optional<BubbleControllers> bubbleControllersOptional = Optional.empty();
        BubbleBarController.onTaskbarRecreated();
        if (BubbleBarController.isBubbleBarEnabled() && bubbleBarView != null) {
            Optional<BubbleStashedHandleViewController> bubbleHandleController = Optional.empty();
            if (isTransientTaskbar) {
                bubbleHandleController = Optional.of(
                        new BubbleStashedHandleViewController(this, bubbleHandleView));
            }
            TaskbarHotseatDimensionsProvider dimensionsProvider =
                    new DeviceProfileDimensionsProviderAdapter(this);
            BubbleStashController bubbleStashController = isTransientTaskbar
                    ? new TransientBubbleStashController(dimensionsProvider, getResources())
                    : new PersistentBubbleStashController(dimensionsProvider);
            bubbleControllersOptional = Optional.of(new BubbleControllers(
                    new BubbleBarController(this, bubbleBarView),
                    new BubbleBarViewController(this, bubbleBarView),
                    new BubbleStashController(this),
                    new BubbleStashedHandleViewController(this, bubbleHandleView),
                    bubbleStashController,
                    bubbleHandleController,
                    new BubbleDragController(this),
                    new BubbleDismissController(this, mDragLayer),
                    new BubbleBarPinController(this, mDragLayer,
@@ -890,8 +908,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mControllers.uiController.updateStateForSysuiFlags(systemUiStateFlags);
        mControllers.bubbleControllers.ifPresent(controllers -> {
            controllers.bubbleBarController.updateStateForSysuiFlags(systemUiStateFlags);
            controllers.bubbleStashedHandleViewController.setIsHomeButtonDisabled(
                    mControllers.navbarButtonsViewController.isHomeDisabled());
            controllers.bubbleStashedHandleViewController.ifPresent(controller ->
                    controller.setIsHomeButtonDisabled(
                            mControllers.navbarButtonsViewController.isHomeDisabled()));
        });
    }

@@ -929,6 +948,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
    public void onTransitionModeUpdated(int barMode, boolean checkBarModes) {
        mControllers.navbarButtonsViewController.onTransitionModeUpdated(barMode, checkBarModes);
    }

    public void onNavButtonsDarkIntensityChanged(float darkIntensity) {
        mControllers.navbarButtonsViewController.getTaskbarNavButtonDarkIntensity()
                .updateValue(darkIntensity);
+1 −1
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ public class TaskbarControllers {
        taskbarOverlayController.init(this);
        taskbarAllAppsController.init(this, sharedState.allAppsVisible);
        navButtonController.init(this);
        bubbleControllers.ifPresent(controllers -> controllers.init(this));
        taskbarInsetsController.init(this);
        voiceInteractionWindowController.init(this);
        taskbarRecentAppsController.init(this);
@@ -172,7 +173,6 @@ public class TaskbarControllers {
        taskbarEduTooltipController.init(this);
        keyboardQuickSwitchController.init(this);
        taskbarPinningController.init(this, mSharedState);
        bubbleControllers.ifPresent(controllers -> controllers.init(this));

        mControllersToLog = new LoggableTaskbarController[] {
                taskbarDragController, navButtonController, navbarButtonsViewController,
+9 −11
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
        val taskbarTouchableHeight = controllers.taskbarStashController.touchableHeight
        val bubblesTouchableHeight =
            if (controllers.bubbleControllers.isPresent) {
                controllers.bubbleControllers.get().bubbleStashController.touchableHeight
                controllers.bubbleControllers.get().bubbleStashController.getTouchableHeight()
            } else {
                0
            }
@@ -139,7 +139,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas

        if (
            controllers.bubbleControllers.isPresent &&
                controllers.bubbleControllers.get().bubbleStashController.isBubblesShowingOnHome
                controllers.bubbleControllers.get().bubbleStashController.isBubbleBarVisible()
        ) {
            val iconBounds =
                controllers.bubbleControllers.get().bubbleBarViewController.bubbleBarBounds
@@ -162,8 +162,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
                controllers.bubbleControllers
                    .getOrNull()
                    ?.bubbleBarViewController
                    ?.isAnimatingNewBubble
                    ?: false
                    ?.isAnimatingNewBubble ?: false
            if (isAnimatingNewBubble) {
                val iconBounds =
                    controllers.bubbleControllers.get().bubbleBarViewController.bubbleBarBounds
@@ -358,13 +357,6 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
     */
    fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
        insetsInfo.touchableRegion.setEmpty()
        // Always have nav buttons be touchable
        controllers.navbarButtonsViewController.addVisibleButtonsRegion(
            context.dragLayer,
            insetsInfo.touchableRegion
        )
        debugTouchableRegion.lastSetTouchableBounds.set(insetsInfo.touchableRegion.bounds)

        val bubbleBarVisible =
            controllers.bubbleControllers.isPresent &&
                controllers.bubbleControllers.get().bubbleBarViewController.isBubbleBarVisible()
@@ -443,6 +435,12 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
            debugTouchableRegion.lastSetTouchableReason =
                "Icons are not visible, but other components such as 3 buttons might be"
        }
        // Always have nav buttons be touchable
        controllers.navbarButtonsViewController.addVisibleButtonsRegion(
            context.dragLayer,
            insetsInfo.touchableRegion
        )
        debugTouchableRegion.lastSetTouchableBounds.set(insetsInfo.touchableRegion.bounds)
        context.excludeFromMagnificationRegion(insetsIsTouchableRegion)
    }

+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
        mControllers.taskbarDragLayerController.setTranslationYForSwipe(transY);
        mControllers.bubbleControllers.ifPresent(controllers -> {
            controllers.bubbleBarViewController.setTranslationYForSwipe(transY);
            controllers.bubbleStashedHandleViewController.setTranslationYForSwipe(transY);
            controllers.bubbleStashedHandleViewController.ifPresent(
                    controller -> controller.setTranslationYForSwipe(transY));
        });
    }

Loading