Loading packages/SystemUI/res/xml/combined_qs_header_scene.xml +3 −14 Original line number Diff line number Diff line Loading @@ -124,20 +124,9 @@ </KeyFrameSet> </Transition> <Transition android:id="@+id/large_screen_header_transition" app:constraintSetStart="@id/large_screen_header_constraint" app:constraintSetEnd="@id/large_screen_header_constraint"/> <!-- Placeholder ConstraintSet. They are populated in the controller for this class. This is needed because there's no easy way to just refer to a `ConstraintSet` file. The options are either a layout file or inline the ConstraintSets. --> <ConstraintSet android:id="@id/qqs_header_constraint"/> <ConstraintSet android:id="@id/qs_header_constraint"/> <Include app:constraintSet="@xml/large_screen_shade_header"/> <ConstraintSet android:id="@id/large_screen_header_constraint" /> <Include app:constraintSet="@xml/qs_header"/> <Include app:constraintSet="@xml/qqs_header"/> </MotionScene> packages/SystemUI/res/xml/qqs_header.xml +0 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height" app:layout_constraintStart_toEndOf="@id/date" app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon" Loading @@ -75,7 +74,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height" app:layout_constraintStart_toEndOf="@id/statusIcons" app:layout_constraintEnd_toEndOf="@id/end_guide" Loading Loading @@ -112,5 +110,4 @@ app:layout_constraintHorizontal_bias="1" /> </Constraint> </ConstraintSet> No newline at end of file packages/SystemUI/res/xml/qs_header.xml +1 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/space" app:layout_constraintBottom_toBottomOf="parent" Loading Loading @@ -88,7 +89,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintStart_toEndOf="@id/space" app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon" app:layout_constraintTop_toTopOf="@id/date" Loading packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt +4 −14 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.android.systemui.qs.carrier.QSCarrierGroup import com.android.systemui.qs.carrier.QSCarrierGroupController import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.HEADER_TRANSITION_ID import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.LARGE_SCREEN_HEADER_TRANSITION_ID import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.QS_HEADER_CONSTRAINT import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider Loading @@ -73,11 +72,9 @@ import javax.inject.Named * expansion of the headers in small screen portrait. * * [header] will be a [MotionLayout] if [Flags.COMBINED_QS_HEADERS] is enabled. In this case, the * [MotionLayout] has 2 transitions: * [MotionLayout] has one transitions: * * [HEADER_TRANSITION_ID]: [QQS_HEADER_CONSTRAINT] <-> [QS_HEADER_CONSTRAINT] for portrait * handheld device configuration. * * [LARGE_SCREEN_HEADER_TRANSITION_ID]: [LARGE_SCREEN_HEADER_CONSTRAINT] (to itself) for all * other configurations */ @CentralSurfacesScope class LargeScreenShadeHeaderController @Inject constructor( Loading @@ -104,8 +101,6 @@ class LargeScreenShadeHeaderController @Inject constructor( @VisibleForTesting internal val HEADER_TRANSITION_ID = R.id.header_transition @VisibleForTesting internal val LARGE_SCREEN_HEADER_TRANSITION_ID = R.id.large_screen_header_transition @VisibleForTesting internal val QQS_HEADER_CONSTRAINT = R.id.qqs_header_constraint @VisibleForTesting internal val QS_HEADER_CONSTRAINT = R.id.qs_header_constraint Loading @@ -120,10 +115,6 @@ class LargeScreenShadeHeaderController @Inject constructor( } } init { loadConstraints() } private val combinedHeaders = featureFlags.isEnabled(Flags.COMBINED_QS_HEADERS) private lateinit var iconManager: StatusBarIconController.TintedIconManager Loading Loading @@ -438,7 +429,6 @@ class LargeScreenShadeHeaderController @Inject constructor( } header as MotionLayout if (largeScreenActive) { header.setTransition(LARGE_SCREEN_HEADER_TRANSITION_ID) header.getConstraintSet(LARGE_SCREEN_HEADER_CONSTRAINT).applyTo(header) } else { header.setTransition(HEADER_TRANSITION_ID) Loading packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt +31 −0 Original line number Diff line number Diff line Loading @@ -23,9 +23,11 @@ import androidx.constraintlayout.widget.ConstraintSet.START import androidx.test.filters.SmallTest import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith Loading @@ -37,6 +39,9 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() { private lateinit var qsConstraint: ConstraintSet private lateinit var largeScreenConstraint: ConstraintSet @get:Rule val expect: Expect = Expect.create() @Before fun setUp() { qqsConstraint = ConstraintSet().apply { Loading Loading @@ -343,6 +348,32 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() { } } @Test fun testCheckViewsDontChangeSizeBetweenAnimationConstraints() { val views = mapOf( R.id.clock to "clock", R.id.date to "date", R.id.statusIcons to "icons", R.id.privacy_container to "privacy", R.id.carrier_group to "carriers", R.id.batteryRemainingIcon to "battery", ) views.forEach { (id, name) -> expect.withMessage("$name changes height") .that(qqsConstraint.getConstraint(id).layout.mHeight.fromConstraint()) .isEqualTo(qsConstraint.getConstraint(id).layout.mHeight.fromConstraint()) expect.withMessage("$name changes width") .that(qqsConstraint.getConstraint(id).layout.mWidth.fromConstraint()) .isEqualTo(qsConstraint.getConstraint(id).layout.mWidth.fromConstraint()) } } private fun Int.fromConstraint() = when (this) { -1 -> "MATCH_PARENT" -2 -> "WRAP_CONTENT" else -> toString() } @Test fun testEmptyCutoutDateIconsAreConstrainedWidth() { CombinedShadeHeadersConstraintManagerImpl.emptyCutoutConstraints()() Loading Loading
packages/SystemUI/res/xml/combined_qs_header_scene.xml +3 −14 Original line number Diff line number Diff line Loading @@ -124,20 +124,9 @@ </KeyFrameSet> </Transition> <Transition android:id="@+id/large_screen_header_transition" app:constraintSetStart="@id/large_screen_header_constraint" app:constraintSetEnd="@id/large_screen_header_constraint"/> <!-- Placeholder ConstraintSet. They are populated in the controller for this class. This is needed because there's no easy way to just refer to a `ConstraintSet` file. The options are either a layout file or inline the ConstraintSets. --> <ConstraintSet android:id="@id/qqs_header_constraint"/> <ConstraintSet android:id="@id/qs_header_constraint"/> <Include app:constraintSet="@xml/large_screen_shade_header"/> <ConstraintSet android:id="@id/large_screen_header_constraint" /> <Include app:constraintSet="@xml/qs_header"/> <Include app:constraintSet="@xml/qqs_header"/> </MotionScene>
packages/SystemUI/res/xml/qqs_header.xml +0 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height" app:layout_constraintStart_toEndOf="@id/date" app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon" Loading @@ -75,7 +74,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintHeight_min="@dimen/new_qs_header_non_clickable_element_height" app:layout_constraintStart_toEndOf="@id/statusIcons" app:layout_constraintEnd_toEndOf="@id/end_guide" Loading Loading @@ -112,5 +110,4 @@ app:layout_constraintHorizontal_bias="1" /> </Constraint> </ConstraintSet> No newline at end of file
packages/SystemUI/res/xml/qs_header.xml +1 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/space" app:layout_constraintBottom_toBottomOf="parent" Loading Loading @@ -88,7 +89,6 @@ <Layout android:layout_width="wrap_content" android:layout_height="@dimen/new_qs_header_non_clickable_element_height" app:layout_constrainedWidth="true" app:layout_constraintStart_toEndOf="@id/space" app:layout_constraintEnd_toStartOf="@id/batteryRemainingIcon" app:layout_constraintTop_toTopOf="@id/date" Loading
packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt +4 −14 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.android.systemui.qs.carrier.QSCarrierGroup import com.android.systemui.qs.carrier.QSCarrierGroupController import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.HEADER_TRANSITION_ID import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.LARGE_SCREEN_HEADER_TRANSITION_ID import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT import com.android.systemui.shade.LargeScreenShadeHeaderController.Companion.QS_HEADER_CONSTRAINT import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider Loading @@ -73,11 +72,9 @@ import javax.inject.Named * expansion of the headers in small screen portrait. * * [header] will be a [MotionLayout] if [Flags.COMBINED_QS_HEADERS] is enabled. In this case, the * [MotionLayout] has 2 transitions: * [MotionLayout] has one transitions: * * [HEADER_TRANSITION_ID]: [QQS_HEADER_CONSTRAINT] <-> [QS_HEADER_CONSTRAINT] for portrait * handheld device configuration. * * [LARGE_SCREEN_HEADER_TRANSITION_ID]: [LARGE_SCREEN_HEADER_CONSTRAINT] (to itself) for all * other configurations */ @CentralSurfacesScope class LargeScreenShadeHeaderController @Inject constructor( Loading @@ -104,8 +101,6 @@ class LargeScreenShadeHeaderController @Inject constructor( @VisibleForTesting internal val HEADER_TRANSITION_ID = R.id.header_transition @VisibleForTesting internal val LARGE_SCREEN_HEADER_TRANSITION_ID = R.id.large_screen_header_transition @VisibleForTesting internal val QQS_HEADER_CONSTRAINT = R.id.qqs_header_constraint @VisibleForTesting internal val QS_HEADER_CONSTRAINT = R.id.qs_header_constraint Loading @@ -120,10 +115,6 @@ class LargeScreenShadeHeaderController @Inject constructor( } } init { loadConstraints() } private val combinedHeaders = featureFlags.isEnabled(Flags.COMBINED_QS_HEADERS) private lateinit var iconManager: StatusBarIconController.TintedIconManager Loading Loading @@ -438,7 +429,6 @@ class LargeScreenShadeHeaderController @Inject constructor( } header as MotionLayout if (largeScreenActive) { header.setTransition(LARGE_SCREEN_HEADER_TRANSITION_ID) header.getConstraintSet(LARGE_SCREEN_HEADER_CONSTRAINT).applyTo(header) } else { header.setTransition(HEADER_TRANSITION_ID) Loading
packages/SystemUI/tests/src/com/android/systemui/shade/CombinedShadeHeaderConstraintsTest.kt +31 −0 Original line number Diff line number Diff line Loading @@ -23,9 +23,11 @@ import androidx.constraintlayout.widget.ConstraintSet.START import androidx.test.filters.SmallTest import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith Loading @@ -37,6 +39,9 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() { private lateinit var qsConstraint: ConstraintSet private lateinit var largeScreenConstraint: ConstraintSet @get:Rule val expect: Expect = Expect.create() @Before fun setUp() { qqsConstraint = ConstraintSet().apply { Loading Loading @@ -343,6 +348,32 @@ class CombinedShadeHeaderConstraintsTest : SysuiTestCase() { } } @Test fun testCheckViewsDontChangeSizeBetweenAnimationConstraints() { val views = mapOf( R.id.clock to "clock", R.id.date to "date", R.id.statusIcons to "icons", R.id.privacy_container to "privacy", R.id.carrier_group to "carriers", R.id.batteryRemainingIcon to "battery", ) views.forEach { (id, name) -> expect.withMessage("$name changes height") .that(qqsConstraint.getConstraint(id).layout.mHeight.fromConstraint()) .isEqualTo(qsConstraint.getConstraint(id).layout.mHeight.fromConstraint()) expect.withMessage("$name changes width") .that(qqsConstraint.getConstraint(id).layout.mWidth.fromConstraint()) .isEqualTo(qsConstraint.getConstraint(id).layout.mWidth.fromConstraint()) } } private fun Int.fromConstraint() = when (this) { -1 -> "MATCH_PARENT" -2 -> "WRAP_CONTENT" else -> toString() } @Test fun testEmptyCutoutDateIconsAreConstrainedWidth() { CombinedShadeHeadersConstraintManagerImpl.emptyCutoutConstraints()() Loading