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

Commit 6b4ba15d authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Enable taskbar on phones when the flag is turned on" into main

parents 6d408a9e 4761c803
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line 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.navigationbar.gestural.EdgeBackGestureHandler.DEBUG_MISSING_GESTURE_TAG;
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
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.enableTaskbarNavbarUnification;
import static com.android.wm.shell.Flags.enableTaskbarOnPhones;


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


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


    private final CommandQueue.Callbacks mCommandQueueCallbacks = new CommandQueue.Callbacks() {
    private final CommandQueue.Callbacks mCommandQueueCallbacks = new CommandQueue.Callbacks() {
+14 −1
Original line number Original line 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.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
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.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
@@ -142,10 +143,11 @@ public class NavigationBarControllerImplTest extends SysuiTestCase {


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


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


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


    @Test
    @Test
    public void testShouldRenderTaskbar_taskbarNotRenderedOnPhone() {
    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.mIsLargeScreen = false;
        mNavigationBarController.mIsPhone = true;
        mNavigationBarController.mIsPhone = true;
        assertFalse(mNavigationBarController.supportsTaskbar());
        assertFalse(mNavigationBarController.supportsTaskbar());