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

Commit bad63261 authored by Federico Baron's avatar Federico Baron Committed by Android (Google) Code Review
Browse files

Merge "Add device profile dump flag guarding for OneGrid" into main

parents 287b9027 9b2f38fa
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ abstract class AbstractDeviceProfileTest {
        deviceSpec: DeviceSpec,
        isGestureMode: Boolean = true,
        isVerticalBar: Boolean = false,
        isFixedLandscape: Boolean = false,
    ) {
        val (naturalX, naturalY) = deviceSpec.naturalSize
        val windowsBounds = phoneWindowsBounds(deviceSpec, isGestureMode, naturalX, naturalY)
@@ -138,6 +139,7 @@ abstract class AbstractDeviceProfileTest {
            rotation = if (isVerticalBar) Surface.ROTATION_90 else Surface.ROTATION_0,
            isGestureMode,
            densityDpi = deviceSpec.densityDpi,
            isFixedLandscape = isFixedLandscape,
        )
    }

@@ -166,6 +168,7 @@ abstract class AbstractDeviceProfileTest {
        isLandscape: Boolean = false,
        isGestureMode: Boolean = true,
        isFolded: Boolean = false,
        isFixedLandscape: Boolean = false,
    ) {
        val (unfoldedNaturalX, unfoldedNaturalY) = deviceSpecUnfolded.naturalSize
        val unfoldedWindowsBounds =
@@ -192,6 +195,7 @@ abstract class AbstractDeviceProfileTest {
                rotation = if (isLandscape) Surface.ROTATION_90 else Surface.ROTATION_0,
                isGestureMode = isGestureMode,
                densityDpi = deviceSpecFolded.densityDpi,
                isFixedLandscape = isFixedLandscape,
            )
        } else {
            initializeCommonVars(
@@ -200,6 +204,7 @@ abstract class AbstractDeviceProfileTest {
                rotation = if (isLandscape) Surface.ROTATION_0 else Surface.ROTATION_90,
                isGestureMode = isGestureMode,
                densityDpi = deviceSpecUnfolded.densityDpi,
                isFixedLandscape = isFixedLandscape,
            )
        }
    }
@@ -274,6 +279,7 @@ abstract class AbstractDeviceProfileTest {
        rotation: Int,
        isGestureMode: Boolean = true,
        densityDpi: Int,
        isFixedLandscape: Boolean = false,
    ) {
        setFlagsRule.setFlags(true, Flags.FLAG_ENABLE_TWOLINE_TOGGLE)
        LauncherPrefs.get(testContext).put(LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE, true)
@@ -307,7 +313,7 @@ abstract class AbstractDeviceProfileTest {

        whenever(launcherPrefs.get(LauncherPrefs.TASKBAR_PINNING)).thenReturn(false)
        whenever(launcherPrefs.get(LauncherPrefs.TASKBAR_PINNING_IN_DESKTOP_MODE)).thenReturn(true)
        whenever(launcherPrefs.get(LauncherPrefs.FIXED_LANDSCAPE_MODE)).thenReturn(false)
        whenever(launcherPrefs.get(LauncherPrefs.FIXED_LANDSCAPE_MODE)).thenReturn(isFixedLandscape)
        whenever(launcherPrefs.get(LauncherPrefs.HOTSEAT_COUNT)).thenReturn(-1)
        whenever(launcherPrefs.get(LauncherPrefs.DEVICE_TYPE)).thenReturn(-1)
        whenever(launcherPrefs.get(LauncherPrefs.WORKSPACE_SIZE)).thenReturn("")
+10 −9
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.launcher3.AbstractDeviceProfileTest
import com.android.launcher3.DeviceProfile
import com.android.launcher3.Flags
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.util.rule.setFlags
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -35,11 +36,11 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {

    @Before
    fun setUp() {
        if (instance.decoupleDepth) {
            setFlagsRule.enableFlags(Flags.FLAG_ENABLE_SCALING_REVEAL_HOME_ANIMATION)
        } else {
            setFlagsRule.disableFlags(Flags.FLAG_ENABLE_SCALING_REVEAL_HOME_ANIMATION)
        }
        setFlagsRule.setFlags(
            instance.decoupleDepth,
            Flags.FLAG_ENABLE_SCALING_REVEAL_HOME_ANIMATION,
        )
        setFlagsRule.setFlags(false, Flags.FLAG_ONE_GRID_SPECS)
    }

    @Test
@@ -105,13 +106,13 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
                initializeVarsForTablet(
                    deviceSpec = deviceSpec,
                    isLandscape = isLandscape,
                    isGestureMode = isGestureMode
                    isGestureMode = isGestureMode,
                )
            else ->
                initializeVarsForPhone(
                    deviceSpec = deviceSpec,
                    isVerticalBar = isLandscape,
                    isGestureMode = isGestureMode
                    isGestureMode = isGestureMode,
                )
        }
    }
@@ -136,7 +137,7 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
                    "twopanel-tablet",
                    gridName = "4_by_4",
                    isTaskbarPresentInApps = true,
                    decoupleDepth = true
                    decoupleDepth = true,
                ),
            )
        }
@@ -145,7 +146,7 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
            val deviceName: String,
            val gridName: String,
            val isTaskbarPresentInApps: Boolean = false,
            val decoupleDepth: Boolean = false
            val decoupleDepth: Boolean = false,
        ) {
            fun filename(testName: String = ""): String {
                val device =