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

Commit f9ae7178 authored by Toshiki Kikuchi's avatar Toshiki Kikuchi Committed by Android (Google) Code Review
Browse files

Merge "Allow to show pinned taskbar when Launcher is visible" into main

parents a9a90a58 6ddfe9b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;

import java.io.PrintWriter;
import java.util.Arrays;
@@ -210,6 +211,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
     */
    @Override
    public void onLauncherVisibilityChanged(boolean isVisible) {
        if (DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(mLauncher)) {
            DisplayController.handleInfoChangeForLauncherVisibilityChanged(mLauncher);
        }
        onLauncherVisibilityChanged(isVisible, false /* fromInit */);
    }

+5 −1
Original line number Diff line number Diff line
@@ -147,7 +147,11 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
                defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.bubbleBarBounds)
            }
        }
        if (taskbarStashController.isInApp || taskbarStashController.isInOverview) {
        if (
            taskbarStashController.isInApp ||
                taskbarStashController.isInOverview ||
                DisplayController.showLockedTaskbarOnHome(context)
        ) {
            // only add the taskbar touch region if not on home
            val bottom = windowLayoutParams.height
            val top = bottom - taskbarTouchableHeight
+5 −2
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.RecentsAnimationController;
@@ -662,6 +663,9 @@ public class TaskbarLauncherStateController {
     * This refers to the intended state - a transition to this state might be in progress.
     */
    public boolean isTaskbarAlignedWithHotseat() {
        if (DisplayController.showLockedTaskbarOnHome(mLauncher) && isInLauncher()) {
            return false;
        }
        return mLauncherState.isTaskbarAlignedWithHotseat(mLauncher);
    }

@@ -673,8 +677,7 @@ public class TaskbarLauncherStateController {
            boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher);
            boolean willStashVisually = isInStashedState
                    && mControllers.taskbarStashController.supportsVisualStashing();
            boolean isTaskbarAlignedWithHotseat =
                    mLauncherState.isTaskbarAlignedWithHotseat(mLauncher);
            boolean isTaskbarAlignedWithHotseat = isTaskbarAlignedWithHotseat();
            return isTaskbarAlignedWithHotseat && !willStashVisually;
        } else {
            return false;
+21 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.quickstep.util;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.view.Display.DEFAULT_DISPLAY;

import android.content.Context;
@@ -30,6 +31,8 @@ import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.util.WindowBounds;
import com.android.launcher3.util.window.CachedDisplayInfo;
import com.android.launcher3.util.window.WindowManagerProxy;
import com.android.quickstep.SystemUiProxy;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;

import java.util.List;
import java.util.Set;
@@ -65,6 +68,24 @@ public class SystemWindowManagerProxy extends WindowManagerProxy {
        return desktopController != null && desktopController.areDesktopTasksVisible();
    }

    @Override
    public boolean showLockedTaskbarOnHome(Context displayInfoContext) {
        if (!DesktopModeStatus.canEnterDesktopMode(displayInfoContext)) {
            return false;
        }
        if (!DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(displayInfoContext)) {
            return false;
        }
        final boolean isFreeformDisplay = displayInfoContext.getResources().getConfiguration()
                .windowConfiguration.getWindowingMode() == WINDOWING_MODE_FREEFORM;
        return isFreeformDisplay;
    }

    @Override
    public boolean isHomeVisible(Context context) {
        return SystemUiProxy.INSTANCE.get(context).getHomeVisibilityState().isHomeVisible();
    }

    @Override
    public int getRotation(Context displayInfoContext) {
        return displayInfoContext.getResources().getConfiguration().windowConfiguration
+32 −1
Original line number Diff line number Diff line
@@ -194,6 +194,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
        INSTANCE.get(context).handleInfoChange(context.getDisplay());
    }

    /**
     * Handles info change for launcher visibility.
     */
    public static void handleInfoChangeForLauncherVisibilityChanged(Context context) {
        INSTANCE.get(context).handleInfoChange(context.getDisplay());
    }

    /**
     * Enables transient taskbar status for tests.
     */
@@ -217,6 +224,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
        return INSTANCE.get(context).getInfo().isPinnedTaskbar();
    }

    /**
     * Returns whether the taskbar is forced to be pinned when home is visible.
     */
    public static boolean showLockedTaskbarOnHome(Context context) {
        return INSTANCE.get(context).getInfo().showLockedTaskbarOnHome();
    }

    @Override
    public void close() {
        mDestroyed = true;
@@ -345,7 +359,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
        }
        if ((newInfo.mIsTaskbarPinned != oldInfo.mIsTaskbarPinned)
                || (newInfo.mIsTaskbarPinnedInDesktopMode
                    != oldInfo.mIsTaskbarPinnedInDesktopMode)) {
                    != oldInfo.mIsTaskbarPinnedInDesktopMode)
                || newInfo.isPinnedTaskbar() != oldInfo.isPinnedTaskbar()) {
            change |= CHANGE_TASKBAR_PINNING;
        }
        if (newInfo.mIsInDesktopMode != oldInfo.mIsInDesktopMode) {
@@ -399,6 +414,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {

        private final boolean mIsInDesktopMode;

        private final boolean mShowLockedTaskbarOnHome;
        private final boolean mIsHomeVisible;

        public Info(Context displayInfoContext) {
            /* don't need system overrides for external displays */
            this(displayInfoContext, new WindowManagerProxy(), new ArrayMap<>());
@@ -460,6 +478,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
            mIsTaskbarPinnedInDesktopMode = LauncherPrefs.get(displayInfoContext).get(
                    TASKBAR_PINNING_IN_DESKTOP_MODE);
            mIsInDesktopMode = wmProxy.isInDesktopMode();
            mShowLockedTaskbarOnHome = wmProxy.showLockedTaskbarOnHome(displayInfoContext);
            mIsHomeVisible = wmProxy.isHomeVisible(displayInfoContext);
        }

        /**
@@ -476,6 +496,10 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
                return sTransientTaskbarStatusForTests;
            }
            if (enableTaskbarPinning()) {
                // If Launcher is visible on the freeform display, ensure the taskbar is pinned.
                if (mShowLockedTaskbarOnHome && mIsHomeVisible) {
                    return false;
                }
                if (mIsInDesktopMode) {
                    return !mIsTaskbarPinnedInDesktopMode;
                }
@@ -543,6 +567,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
                return TYPE_PHONE;
            }
        }

        /**
         * Returns whether the taskbar is forced to be pinned when home is visible.
         */
        public boolean showLockedTaskbarOnHome() {
            return mShowLockedTaskbarOnHome;
        }
    }

    /**
Loading