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

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

Merge "Guard taskbar / navbar unification logic with whether the device is a...

Merge "Guard taskbar / navbar unification logic with whether the device is a phone on top of the flag" into main
parents e34a1b64 89f72882
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static com.android.launcher3.uioverrides.flags.FlagsFactory.getDebugFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getReleaseFlag;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;

import android.content.res.Resources;
import android.view.ViewConfiguration;

import androidx.annotation.VisibleForTesting;
@@ -222,7 +223,19 @@ public final class FeatureFlags {
            TEAMFOOD, "Sends a notification whenever launcher encounters an uncaught exception.");

    public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION =
            enableTaskbarNavbarUnification();
            enableTaskbarNavbarUnification() && !isPhone();

    private static boolean isPhone() {
        final boolean isPhone;
        int foldedDeviceStatesId = Resources.getSystem().getIdentifier(
                "config_foldedDeviceStates", "array", "android");
        if (foldedDeviceStatesId != 0) {
            isPhone = Resources.getSystem().getIntArray(foldedDeviceStatesId).length == 0;
        } else {
            isPhone = true;
        }
        return isPhone;
    }

    // Aconfig migration complete for ENABLE_TASKBAR_NO_RECREATION.
    public static final BooleanFlag ENABLE_TASKBAR_NO_RECREATION = getDebugFlag(299193589,
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.testing;

import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.config.FeatureFlags.enableSplitContextually;
import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD;
@@ -182,6 +183,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTablet);
                return response;

            case TestProtocol.REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION:
                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        ENABLE_TASKBAR_NAVBAR_UNIFICATION);
                return response;

            case TestProtocol.REQUEST_NUM_ALL_APPS_COLUMNS:
                response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        mDeviceProfile.numShownAllAppsColumns);
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ public final class TestProtocol {
    public static final String REQUEST_CLEAR_DATA = "clear-data";
    public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names";
    public static final String REQUEST_IS_TABLET = "is-tablet";
    public static final String REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION =
            "enable-taskbar-navbar-unification";
    public static final String REQUEST_NUM_ALL_APPS_COLUMNS = "num-all-apps-columns";
    public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
    public static final String REQUEST_CELL_LAYOUT_BOARDER_HEIGHT = "cell-layout-boarder-height";
+7 −1
Original line number Diff line number Diff line
@@ -405,6 +405,11 @@ public final class LauncherInstrumentation {
                .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    public boolean isTaskbarNavbarUnificationEnabled() {
        return getTestInfo(TestProtocol.REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION)
                .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    public boolean isTwoPanels() {
        return getTestInfo(TestProtocol.REQUEST_IS_TWO_PANELS)
                .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
@@ -845,7 +850,8 @@ public final class LauncherInstrumentation {
    }

    private String getNavigationButtonResPackage() {
        return isTablet() ? getLauncherPackageName() : SYSTEMUI_PACKAGE;
        return isTablet() || isTaskbarNavbarUnificationEnabled()
                ? getLauncherPackageName() : SYSTEMUI_PACKAGE;
    }

    UiObject2 verifyContainerType(ContainerType containerType) {