mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 16:26:47 +00:00
Revert "Revert "Moving DeviceProfile properties into DevicePrope..."
Revert submission 33716851-revert-33672643-DataDeviceProfile1-XHYRAPLEBK Reason for revert: Error is fixed Reverted changes: /q/submissionid:33716851-revert-33672643-DataDeviceProfile1-XHYRAPLEBK Change-Id: Ib86824134955903c11e51e52dbfd6368aba1cd50
This commit is contained in:
committed by
Sebastian Franco
parent
1bec329180
commit
e1d31e5406
@@ -625,7 +625,8 @@ class TaskbarOverflowTest {
|
||||
return getOnUiThread {
|
||||
val iconLayoutBounds =
|
||||
taskbarViewController.transientTaskbarIconLayoutBoundsInParent
|
||||
val availableWidth = taskbarUnitTestRule.activityContext.deviceProfile.widthPx
|
||||
val availableWidth =
|
||||
taskbarUnitTestRule.activityContext.deviceProfile.deviceProperties.widthPx
|
||||
iconLayoutBounds.left - (availableWidth - iconLayoutBounds.right) < 2
|
||||
}
|
||||
}
|
||||
@@ -633,7 +634,7 @@ class TaskbarOverflowTest {
|
||||
private val taskbarEndMargin: Int
|
||||
get() {
|
||||
return getOnUiThread {
|
||||
taskbarUnitTestRule.activityContext.deviceProfile.widthPx -
|
||||
taskbarUnitTestRule.activityContext.deviceProfile.deviceProperties.widthPx -
|
||||
taskbarViewController.transientTaskbarIconLayoutBoundsInParent.right
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.test.runner.AndroidJUnit4
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION
|
||||
import com.android.launcher3.deviceprofile.DeviceProperties
|
||||
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_END_CONTEXTUAL_BUTTONS
|
||||
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_END_NAV_BUTTONS
|
||||
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_START_CONTEXTUAL_BUTTONS
|
||||
@@ -50,6 +51,8 @@ class NavButtonLayoutFactoryTest {
|
||||
whenever(mockNavLayout.findViewById<View>(R.id.back)).thenReturn(mockBackButton)
|
||||
whenever(mockNavLayout.findViewById<View>(R.id.home)).thenReturn(mockHomeButton)
|
||||
whenever(mockNavLayout.findViewById<View>(R.id.recent_apps)).thenReturn(mockRecentsButton)
|
||||
val devicePropertiesMock: DeviceProperties = mock()
|
||||
whenever(mockDeviceProfile.deviceProperties).thenReturn(devicePropertiesMock)
|
||||
|
||||
// Init top level layout
|
||||
whenever(mockParentButtonContainer.requireViewById<LinearLayout>(ID_END_NAV_BUTTONS))
|
||||
@@ -73,7 +76,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = false,
|
||||
phoneMode = false,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is KidsNavLayoutter)
|
||||
}
|
||||
@@ -88,7 +91,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = true,
|
||||
isThreeButtonNav = false,
|
||||
phoneMode = false,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is SetupNavLayoutter)
|
||||
}
|
||||
@@ -103,7 +106,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = false,
|
||||
phoneMode = false,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is TaskbarNavLayoutter)
|
||||
}
|
||||
@@ -117,7 +120,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = false,
|
||||
phoneMode = false,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -131,7 +134,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = true,
|
||||
phoneMode = true,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is PhonePortraitNavLayoutter)
|
||||
}
|
||||
@@ -147,7 +150,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = true,
|
||||
phoneMode = true,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is PhoneLandscapeNavLayoutter)
|
||||
}
|
||||
@@ -163,7 +166,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = true,
|
||||
phoneMode = true,
|
||||
surfaceRotation = ROTATION_270
|
||||
surfaceRotation = ROTATION_270,
|
||||
)
|
||||
assert(layoutter is PhoneSeascapeNavLayoutter)
|
||||
}
|
||||
@@ -178,16 +181,13 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup = false,
|
||||
isThreeButtonNav = false,
|
||||
phoneMode = true,
|
||||
surfaceRotation = surfaceRotation
|
||||
surfaceRotation = surfaceRotation,
|
||||
)
|
||||
assert(layoutter is PhoneGestureLayoutter)
|
||||
}
|
||||
|
||||
private fun setDeviceProfileLandscape() {
|
||||
// Use reflection to modify landscape field
|
||||
val landscapeField = mockDeviceProfile.javaClass.getDeclaredField("isLandscape")
|
||||
landscapeField.isAccessible = true
|
||||
landscapeField.set(mockDeviceProfile, true)
|
||||
whenever(mockDeviceProfile.deviceProperties.isLandscape).thenReturn(true)
|
||||
}
|
||||
|
||||
private fun getLayoutter(
|
||||
@@ -195,7 +195,7 @@ class NavButtonLayoutFactoryTest {
|
||||
isInSetup: Boolean,
|
||||
isThreeButtonNav: Boolean,
|
||||
phoneMode: Boolean,
|
||||
@Rotation surfaceRotation: Int
|
||||
@Rotation surfaceRotation: Int,
|
||||
): NavButtonLayoutFactory.NavButtonLayoutter {
|
||||
return NavButtonLayoutFactory.getUiLayoutter(
|
||||
deviceProfile = mockDeviceProfile,
|
||||
|
||||
@@ -50,7 +50,7 @@ class TaskbarModeRuleTest {
|
||||
fun testTaskbarMode_transient_overridesDeviceProfile() {
|
||||
val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context)
|
||||
assertThat(dp.isTransientTaskbar).isTrue()
|
||||
assertThat(dp.isGestureMode).isTrue()
|
||||
assertThat(dp.deviceProperties.isGestureMode).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +66,7 @@ class TaskbarModeRuleTest {
|
||||
fun testTaskbarMode_pinned_overridesDeviceProfile() {
|
||||
val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context)
|
||||
assertThat(dp.isTransientTaskbar).isFalse()
|
||||
assertThat(dp.isGestureMode).isTrue()
|
||||
assertThat(dp.deviceProperties.isGestureMode).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -83,6 +83,6 @@ class TaskbarModeRuleTest {
|
||||
fun testTaskbarMode_threeButtons_overridesDeviceProfile() {
|
||||
val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context)
|
||||
assertThat(dp.isTransientTaskbar).isFalse()
|
||||
assertThat(dp.isGestureMode).isFalse()
|
||||
assertThat(dp.deviceProperties.isGestureMode).isFalse()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user