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

Commit 4761c803 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Enable taskbar on phones when the flag is turned on

Bug: 348017501
Change-Id: I004b9ec4cba046ddcc388e7f97769c87bb6f2bb5
Test: N/A
Flag: com.android.wm.shell.enable_taskbar_on_phones
parent 15fddab1
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGAT
import static com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler.DEBUG_MISSING_GESTURE_TAG;
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
import static com.android.wm.shell.Flags.enableTaskbarOnPhones;

import android.content.Context;
import android.content.pm.ActivityInfo;
@@ -285,8 +286,10 @@ public class NavigationBarControllerImpl implements

    @VisibleForTesting
    boolean supportsTaskbar() {
        // Enable for tablets, unfolded state on a foldable device or (non handheld AND flag is set)
        return mIsLargeScreen || (!mIsPhone && enableTaskbarNavbarUnification());
        // Enable for tablets, unfolded state on a foldable device, (non handheld AND flag is set),
        // or handheld when enableTaskbarOnPhones() returns true.
        boolean foldedOrPhone = !mIsPhone || enableTaskbarOnPhones();
        return mIsLargeScreen || (foldedOrPhone && enableTaskbarNavbarUnification());
    }

    private final CommandQueue.Callbacks mCommandQueueCallbacks = new CommandQueue.Callbacks() {
+14 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.Display.INVALID_DISPLAY;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
import static com.android.wm.shell.Flags.enableTaskbarOnPhones;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -142,10 +143,11 @@ public class NavigationBarControllerImplTest extends SysuiTestCase {

    @Test
    public void testCreateNavigationBarsIncludeDefaultTrue() {
        assumeFalse(enableTaskbarNavbarUnification());
        assumeFalse(enableTaskbarNavbarUnification() && enableTaskbarOnPhones());

        // Large screens may be using taskbar and the logic is different
        mNavigationBarController.mIsLargeScreen = false;
        mNavigationBarController.mIsPhone = true;
        doNothing().when(mNavigationBarController).createNavigationBar(any(), any(), any());

        mNavigationBarController.createNavigationBars(true, null);
@@ -291,6 +293,17 @@ public class NavigationBarControllerImplTest extends SysuiTestCase {

    @Test
    public void testShouldRenderTaskbar_taskbarNotRenderedOnPhone() {
        assumeFalse(enableTaskbarOnPhones());

        mNavigationBarController.mIsLargeScreen = false;
        mNavigationBarController.mIsPhone = true;
        assertFalse(mNavigationBarController.supportsTaskbar());
    }

    @Test
    public void testShouldRenderTaskbar_taskbarRenderedOnPhone() {
        assumeTrue(enableTaskbarNavbarUnification() && enableTaskbarOnPhones());

        mNavigationBarController.mIsLargeScreen = false;
        mNavigationBarController.mIsPhone = true;
        assertFalse(mNavigationBarController.supportsTaskbar());