Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -118,12 +118,12 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { } @Test fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() = fun getTopEdgeSplitFraction_wideScreen_splitInHalf() = testScope.runTest { // Ensure isShadeLayoutWide is collected. val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) kosmos.shadeRepository.setShadeLayoutWide(true) assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f) assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f) } } packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +1 −5 Original line number Diff line number Diff line Loading @@ -79,11 +79,7 @@ interface ShadeInteractor : BaseShadeInteractor { * The fraction between [0..1] (i.e., percentage) of screen width to consider the threshold * between "top-left" and "top-right" for the purposes of dual-shade invocation. * * When the dual-shade is not wide, this always returns 0.5 (the top edge is evenly split). On * wide layouts however, a larger fraction is returned because only the area of the system * status icons is considered top-right. * * Note that this fraction only determines the split between the absolute left and right * Note that this fraction only determines the *split* between the absolute left and right * directions. In RTL layouts, the "top-start" edge will resolve to "top-right", and "top-end" * will resolve to "top-left". */ Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +3 −13 Original line number Diff line number Diff line Loading @@ -76,10 +76,8 @@ interface ShadeModeInteractor { class ShadeModeInteractorImpl @Inject constructor( @Application applicationScope: CoroutineScope, private val repository: ShadeRepository, ) : ShadeModeInteractor { constructor(@Application applicationScope: CoroutineScope, repository: ShadeRepository) : ShadeModeInteractor { override val isShadeLayoutWide: StateFlow<Boolean> = repository.isShadeLayoutWide Loading @@ -92,15 +90,7 @@ constructor( initialValue = determineShadeMode(isShadeLayoutWide.value), ) @FloatRange(from = 0.0, to = 1.0) override fun getTopEdgeSplitFraction(): Float { // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This // assumption allows us to query its value on demand (during swipe source detection) instead // of running another infinite coroutine. // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based // on the position of system-status icons in the status bar. return if (repository.isShadeLayoutWide.value) 0.8f else 0.5f } @FloatRange(from = 0.0, to = 1.0) override fun getTopEdgeSplitFraction(): Float = 0.5f private fun determineShadeMode(isShadeLayoutWide: Boolean): ShadeMode { return when { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractorImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -118,12 +118,12 @@ class ShadeModeInteractorImplTest : SysuiTestCase() { } @Test fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() = fun getTopEdgeSplitFraction_wideScreen_splitInHalf() = testScope.runTest { // Ensure isShadeLayoutWide is collected. val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide) kosmos.shadeRepository.setShadeLayoutWide(true) assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f) assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f) } }
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +1 −5 Original line number Diff line number Diff line Loading @@ -79,11 +79,7 @@ interface ShadeInteractor : BaseShadeInteractor { * The fraction between [0..1] (i.e., percentage) of screen width to consider the threshold * between "top-left" and "top-right" for the purposes of dual-shade invocation. * * When the dual-shade is not wide, this always returns 0.5 (the top edge is evenly split). On * wide layouts however, a larger fraction is returned because only the area of the system * status icons is considered top-right. * * Note that this fraction only determines the split between the absolute left and right * Note that this fraction only determines the *split* between the absolute left and right * directions. In RTL layouts, the "top-start" edge will resolve to "top-right", and "top-end" * will resolve to "top-left". */ Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeModeInteractor.kt +3 −13 Original line number Diff line number Diff line Loading @@ -76,10 +76,8 @@ interface ShadeModeInteractor { class ShadeModeInteractorImpl @Inject constructor( @Application applicationScope: CoroutineScope, private val repository: ShadeRepository, ) : ShadeModeInteractor { constructor(@Application applicationScope: CoroutineScope, repository: ShadeRepository) : ShadeModeInteractor { override val isShadeLayoutWide: StateFlow<Boolean> = repository.isShadeLayoutWide Loading @@ -92,15 +90,7 @@ constructor( initialValue = determineShadeMode(isShadeLayoutWide.value), ) @FloatRange(from = 0.0, to = 1.0) override fun getTopEdgeSplitFraction(): Float { // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This // assumption allows us to query its value on demand (during swipe source detection) instead // of running another infinite coroutine. // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based // on the position of system-status icons in the status bar. return if (repository.isShadeLayoutWide.value) 0.8f else 0.5f } @FloatRange(from = 0.0, to = 1.0) override fun getTopEdgeSplitFraction(): Float = 0.5f private fun determineShadeMode(isShadeLayoutWide: Boolean): ShadeMode { return when { Loading