Loading packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerContent.kt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. * limitations under the License. */ */ @file:OptIn(ExperimentalFoundationApi::class) package com.android.systemui.bouncer.ui.composable package com.android.systemui.bouncer.ui.composable import android.app.AlertDialog import android.app.AlertDialog Loading @@ -26,7 +24,6 @@ import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.snap import androidx.compose.animation.core.snap import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable Loading Loading @@ -99,7 +96,6 @@ import com.android.compose.animation.scene.transitions import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.bouncer.shared.model.BouncerActionButtonModel import com.android.systemui.bouncer.shared.model.BouncerActionButtonModel import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerMessageViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerMessageViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel Loading packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerSceneLayout.kt +48 −3 Original line number Original line Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.systemui.bouncer.ui.composable package com.android.systemui.bouncer.ui.composable import androidx.annotation.VisibleForTesting import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.helper.SizeClass import com.android.systemui.bouncer.ui.helper.calculateLayoutInternal /** /** * Returns the [BouncerSceneLayout] that should be used by the bouncer scene. If * Returns the [BouncerSceneLayout] that should be used by the bouncer scene. If Loading Loading @@ -57,3 +55,50 @@ private fun WindowHeightSizeClass.toEnum(): SizeClass { else -> error("Unsupported WindowHeightSizeClass \"$this\"") else -> error("Unsupported WindowHeightSizeClass \"$this\"") } } } } /** Enumerates all known adaptive layout configurations. */ enum class BouncerSceneLayout { /** The default UI with the bouncer laid out normally. */ STANDARD_BOUNCER, /** The bouncer is displayed vertically stacked with the user switcher. */ BELOW_USER_SWITCHER, /** The bouncer is displayed side-by-side with the user switcher or an empty space. */ BESIDE_USER_SWITCHER, /** The bouncer is split in two with both sides shown side-by-side. */ SPLIT_BOUNCER, } /** Enumerates the supported window size classes. */ enum class SizeClass { COMPACT, MEDIUM, EXPANDED, } /** * Internal version of `calculateLayout` in the System UI Compose library, extracted here to allow * for testing that's not dependent on Compose. */ @VisibleForTesting fun calculateLayoutInternal( width: SizeClass, height: SizeClass, isOneHandedModeSupported: Boolean, ): BouncerSceneLayout { return when (height) { SizeClass.COMPACT -> BouncerSceneLayout.SPLIT_BOUNCER SizeClass.MEDIUM -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } SizeClass.EXPANDED -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.BELOW_USER_SWITCHER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } }.takeIf { it != BouncerSceneLayout.BESIDE_USER_SWITCHER || isOneHandedModeSupported } ?: BouncerSceneLayout.STANDARD_BOUNCER } packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/helper/BouncerSceneLayoutTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/composable/BouncerSceneLayoutTest.kt +5 −5 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ * limitations under the License. * limitations under the License. */ */ package com.android.systemui.bouncer.ui.helper package com.android.systemui.bouncer.ui.composable import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.BELOW_USER_SWITCHER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.BELOW_USER_SWITCHER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.BESIDE_USER_SWITCHER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.BESIDE_USER_SWITCHER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.SPLIT_BOUNCER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.SPLIT_BOUNCER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.STANDARD_BOUNCER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.STANDARD_BOUNCER import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat import java.util.Locale import java.util.Locale import org.junit.Test import org.junit.Test Loading packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerSceneLayout.ktdeleted 100644 → 0 +0 −66 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.bouncer.ui.helper import androidx.annotation.VisibleForTesting /** Enumerates all known adaptive layout configurations. */ enum class BouncerSceneLayout { /** The default UI with the bouncer laid out normally. */ STANDARD_BOUNCER, /** The bouncer is displayed vertically stacked with the user switcher. */ BELOW_USER_SWITCHER, /** The bouncer is displayed side-by-side with the user switcher or an empty space. */ BESIDE_USER_SWITCHER, /** The bouncer is split in two with both sides shown side-by-side. */ SPLIT_BOUNCER, } /** Enumerates the supported window size classes. */ enum class SizeClass { COMPACT, MEDIUM, EXPANDED, } /** * Internal version of `calculateLayout` in the System UI Compose library, extracted here to allow * for testing that's not dependent on Compose. */ @VisibleForTesting fun calculateLayoutInternal( width: SizeClass, height: SizeClass, isOneHandedModeSupported: Boolean, ): BouncerSceneLayout { return when (height) { SizeClass.COMPACT -> BouncerSceneLayout.SPLIT_BOUNCER SizeClass.MEDIUM -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } SizeClass.EXPANDED -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.BELOW_USER_SWITCHER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } }.takeIf { it != BouncerSceneLayout.BESIDE_USER_SWITCHER || isOneHandedModeSupported } ?: BouncerSceneLayout.STANDARD_BOUNCER } packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerContentTest.kt +0 −1 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModelFactory import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModelFactory import com.android.systemui.flags.Flags import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.flags.fakeFeatureFlagsClassic Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerContent.kt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. * limitations under the License. */ */ @file:OptIn(ExperimentalFoundationApi::class) package com.android.systemui.bouncer.ui.composable package com.android.systemui.bouncer.ui.composable import android.app.AlertDialog import android.app.AlertDialog Loading @@ -26,7 +24,6 @@ import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.snap import androidx.compose.animation.core.snap import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable Loading Loading @@ -99,7 +96,6 @@ import com.android.compose.animation.scene.transitions import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.bouncer.shared.model.BouncerActionButtonModel import com.android.systemui.bouncer.shared.model.BouncerActionButtonModel import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerMessageViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerMessageViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel import com.android.systemui.bouncer.ui.viewmodel.BouncerSceneContentViewModel Loading
packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerSceneLayout.kt +48 −3 Original line number Original line Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.systemui.bouncer.ui.composable package com.android.systemui.bouncer.ui.composable import androidx.annotation.VisibleForTesting import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.helper.SizeClass import com.android.systemui.bouncer.ui.helper.calculateLayoutInternal /** /** * Returns the [BouncerSceneLayout] that should be used by the bouncer scene. If * Returns the [BouncerSceneLayout] that should be used by the bouncer scene. If Loading Loading @@ -57,3 +55,50 @@ private fun WindowHeightSizeClass.toEnum(): SizeClass { else -> error("Unsupported WindowHeightSizeClass \"$this\"") else -> error("Unsupported WindowHeightSizeClass \"$this\"") } } } } /** Enumerates all known adaptive layout configurations. */ enum class BouncerSceneLayout { /** The default UI with the bouncer laid out normally. */ STANDARD_BOUNCER, /** The bouncer is displayed vertically stacked with the user switcher. */ BELOW_USER_SWITCHER, /** The bouncer is displayed side-by-side with the user switcher or an empty space. */ BESIDE_USER_SWITCHER, /** The bouncer is split in two with both sides shown side-by-side. */ SPLIT_BOUNCER, } /** Enumerates the supported window size classes. */ enum class SizeClass { COMPACT, MEDIUM, EXPANDED, } /** * Internal version of `calculateLayout` in the System UI Compose library, extracted here to allow * for testing that's not dependent on Compose. */ @VisibleForTesting fun calculateLayoutInternal( width: SizeClass, height: SizeClass, isOneHandedModeSupported: Boolean, ): BouncerSceneLayout { return when (height) { SizeClass.COMPACT -> BouncerSceneLayout.SPLIT_BOUNCER SizeClass.MEDIUM -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } SizeClass.EXPANDED -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.BELOW_USER_SWITCHER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } }.takeIf { it != BouncerSceneLayout.BESIDE_USER_SWITCHER || isOneHandedModeSupported } ?: BouncerSceneLayout.STANDARD_BOUNCER }
packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/helper/BouncerSceneLayoutTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/composable/BouncerSceneLayoutTest.kt +5 −5 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ * limitations under the License. * limitations under the License. */ */ package com.android.systemui.bouncer.ui.helper package com.android.systemui.bouncer.ui.composable import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.BELOW_USER_SWITCHER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.BELOW_USER_SWITCHER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.BESIDE_USER_SWITCHER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.BESIDE_USER_SWITCHER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.SPLIT_BOUNCER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.SPLIT_BOUNCER import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout.STANDARD_BOUNCER import com.android.systemui.bouncer.ui.composable.BouncerSceneLayout.STANDARD_BOUNCER import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat import java.util.Locale import java.util.Locale import org.junit.Test import org.junit.Test Loading
packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerSceneLayout.ktdeleted 100644 → 0 +0 −66 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.bouncer.ui.helper import androidx.annotation.VisibleForTesting /** Enumerates all known adaptive layout configurations. */ enum class BouncerSceneLayout { /** The default UI with the bouncer laid out normally. */ STANDARD_BOUNCER, /** The bouncer is displayed vertically stacked with the user switcher. */ BELOW_USER_SWITCHER, /** The bouncer is displayed side-by-side with the user switcher or an empty space. */ BESIDE_USER_SWITCHER, /** The bouncer is split in two with both sides shown side-by-side. */ SPLIT_BOUNCER, } /** Enumerates the supported window size classes. */ enum class SizeClass { COMPACT, MEDIUM, EXPANDED, } /** * Internal version of `calculateLayout` in the System UI Compose library, extracted here to allow * for testing that's not dependent on Compose. */ @VisibleForTesting fun calculateLayoutInternal( width: SizeClass, height: SizeClass, isOneHandedModeSupported: Boolean, ): BouncerSceneLayout { return when (height) { SizeClass.COMPACT -> BouncerSceneLayout.SPLIT_BOUNCER SizeClass.MEDIUM -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } SizeClass.EXPANDED -> when (width) { SizeClass.COMPACT -> BouncerSceneLayout.STANDARD_BOUNCER SizeClass.MEDIUM -> BouncerSceneLayout.BELOW_USER_SWITCHER SizeClass.EXPANDED -> BouncerSceneLayout.BESIDE_USER_SWITCHER } }.takeIf { it != BouncerSceneLayout.BESIDE_USER_SWITCHER || isOneHandedModeSupported } ?: BouncerSceneLayout.STANDARD_BOUNCER }
packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/composable/BouncerContentTest.kt +0 −1 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.authentication.shared.model.AuthenticationMethodModel import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.BouncerDialogFactory import com.android.systemui.bouncer.ui.helper.BouncerSceneLayout import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModelFactory import com.android.systemui.bouncer.ui.viewmodel.bouncerSceneContentViewModelFactory import com.android.systemui.flags.Flags import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.flags.fakeFeatureFlagsClassic Loading