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

Commit 7fae4625 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Pass in navigation bar panel context created by task bar when taskbar navbar unification is on

When the flag is on, task bar is created with window context navigation bar. The floating rotation button window context should be in navigation bar panel.

Fixes: 309930089
Test: N/A
Change-Id: I730a4b898d9fb65cc5d7544dcb37dfe32d49a632
parent 1aaa3aa7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -18,12 +18,15 @@ package com.android.launcher3.taskbar;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_NOTIFICATIONS;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_QUICK_SETTINGS;

import android.content.Context;
import android.content.pm.ActivityInfo.Config;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import androidx.annotation.Nullable;

import com.android.launcher3.R;

/**
@@ -40,8 +43,8 @@ public class DesktopNavbarButtonsViewController extends NavbarButtonsViewControl
    private TaskbarControllers mControllers;

    public DesktopNavbarButtonsViewController(TaskbarActivityContext context,
            FrameLayout navButtonsView) {
        super(context, navButtonsView);
            @Nullable Context navigationBarPanelContext, FrameLayout navButtonsView) {
        super(context, navigationBarPanelContext, navButtonsView);
        mContext = context;
        mNavButtonsView = navButtonsView;
        mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons);
+9 −2
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.animation.ObjectAnimator;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
import android.content.Context;
import android.content.pm.ActivityInfo.Config;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -80,6 +81,8 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
@@ -146,6 +149,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
    private int mState;

    private final TaskbarActivityContext mContext;
    private final @Nullable Context mNavigationBarPanelContext;
    private final WindowManagerProxy mWindowManagerProxy;
    private final FrameLayout mNavButtonsView;
    private final LinearLayout mNavButtonContainer;
@@ -203,8 +207,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
    private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender();
    private ImageView mRecentsButton;

    public NavbarButtonsViewController(TaskbarActivityContext context, FrameLayout navButtonsView) {
    public NavbarButtonsViewController(TaskbarActivityContext context,
            @Nullable Context navigationBarPanelContext, FrameLayout navButtonsView) {
        mContext = context;
        mNavigationBarPanelContext = navigationBarPanelContext;
        mWindowManagerProxy = WindowManagerProxy.INSTANCE.get(mContext);
        mNavButtonsView = navButtonsView;
        mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons);
@@ -312,7 +318,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            rotationButton.hide();
            mControllers.rotationButtonController.setRotationButton(rotationButton, null);
        } else {
            mFloatingRotationButton = new FloatingRotationButton(mContext,
            mFloatingRotationButton = new FloatingRotationButton(
                    ENABLE_TASKBAR_NAVBAR_UNIFICATION ? mNavigationBarPanelContext : mContext,
                    R.string.accessibility_rotate_button,
                    R.layout.rotate_suggestion,
                    R.id.rotate_suggestion,
+9 −3
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    private static final String WINDOW_TITLE = "Taskbar";

    private final @Nullable Context mNavigationBarPanelContext;

    private final TaskbarDragLayer mDragLayer;
    private final TaskbarControllers mControllers;

@@ -178,11 +180,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    private DeviceProfile mPersistentTaskbarDeviceProfile;

    public TaskbarActivityContext(Context windowContext, DeviceProfile launcherDp,
    public TaskbarActivityContext(Context windowContext,
            @Nullable Context navigationBarPanelContext, DeviceProfile launcherDp,
            TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider
            unfoldTransitionProgressProvider) {
        super(windowContext);

        mNavigationBarPanelContext = navigationBarPanelContext;
        applyDeviceProfile(launcherDp);
        final Resources resources = getResources();

@@ -256,8 +260,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                new TaskbarDragController(this),
                buttonController,
                isDesktopMode
                        ? new DesktopNavbarButtonsViewController(this, navButtonsView)
                        : new NavbarButtonsViewController(this, navButtonsView),
                        ? new DesktopNavbarButtonsViewController(this, mNavigationBarPanelContext,
                                navButtonsView)
                        : new NavbarButtonsViewController(this, mNavigationBarPanelContext,
                                navButtonsView),
                rotationButtonController,
                new TaskbarDragLayerController(this, mDragLayer),
                new TaskbarViewController(this, taskbarView),
+7 −2
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ public class TaskbarManager {
            Settings.Secure.NAV_BAR_KIDS_MODE);

    private final Context mContext;
    private final @Nullable Context mNavigationBarPanelContext;
    private WindowManager mWindowManager;
    private FrameLayout mTaskbarRootLayout;
    private boolean mAddedWindow;
@@ -198,6 +199,9 @@ public class TaskbarManager {
        mContext = service.createWindowContext(display,
                ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL,
                null);
        mNavigationBarPanelContext = ENABLE_TASKBAR_NAVBAR_UNIFICATION
                ? service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null)
                : null;
        if (enableTaskbarNoRecreate()) {
            mWindowManager = mContext.getSystemService(WindowManager.class);
            mTaskbarRootLayout = new FrameLayout(mContext) {
@@ -435,8 +439,9 @@ public class TaskbarManager {
            }

            if (enableTaskbarNoRecreate() || mTaskbarActivityContext == null) {
                mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp,
                        mNavButtonController, mUnfoldProgressProvider);
                mTaskbarActivityContext = new TaskbarActivityContext(mContext,
                        mNavigationBarPanelContext, dp, mNavButtonController,
                        mUnfoldProgressProvider);
            } else {
                mTaskbarActivityContext.updateDeviceProfile(dp);
            }