Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +17 −1 Original line number 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.biometrics import android.annotation.MainThread Loading Loading @@ -25,7 +41,7 @@ constructor( shadeExpansionCollectorJob = scope.launch { // wait for it to emit true once shadeInteractorLazy.get().isAnyExpanding.first { it } shadeInteractorLazy.get().isUserInteracting.first { it } onShadeInteraction.run() } shadeExpansionCollectorJob?.invokeOnCompletion { shadeExpansionCollectorJob = null } Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +0 −8 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository import com.android.systemui.statusbar.policy.data.repository.DeviceProvisioningRepository import com.android.systemui.user.domain.interactor.UserSwitcherInteractor import com.android.systemui.util.kotlin.pairwise import javax.inject.Inject import javax.inject.Provider import kotlinx.coroutines.CoroutineScope Loading Loading @@ -140,13 +139,6 @@ constructor( /** Whether either the shade or QS is fully expanded. */ val isAnyFullyExpanded: Flow<Boolean> = anyExpansion.map { it >= 1f }.distinctUntilChanged() /** Whether either the shade or QS is expanding from a fully collapsed state. */ val isAnyExpanding: Flow<Boolean> = anyExpansion .pairwise(1f) .map { (prev, curr) -> curr > 0f && curr < 1f && prev < 1f } .distinctUntilChanged() /** * Whether either the shade or QS is partially or fully expanded, i.e. not fully collapsed. At * this time, this is not simply a matter of checking if either value in shadeExpansion and Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { runCurrent() // WHEN shade expands shadeRepository.setLegacyShadeTracking(true) shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() Loading Loading @@ -108,6 +109,7 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { // WHEN detector is disabled and shade opens detector.disable() shadeRepository.setLegacyShadeTracking(true) shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() Loading packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeInteractorTest.kt +0 −99 Original line number Diff line number Diff line Loading @@ -444,105 +444,6 @@ class ShadeInteractorTest : SysuiTestCase() { assertThat(underTest.anyExpansion.value).isEqualTo(.5f) } @Test fun expanding_shadeDraggedDown_expandingTrue() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade and QS collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade partially expanded shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() } @Test fun expanding_qsDraggedDown_expandingTrue() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade and QS collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade partially expanded shadeRepository.setQsExpansion(.5f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() } @Test fun expanding_shadeDraggedUpAndDown() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // WHEN shade starts collapsed then partially expanded shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setLegacyShadeExpansion(.5f) shadeRepository.setQsExpansion(0f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() // WHEN shade dragged up a bit shadeRepository.setLegacyShadeExpansion(.2f) runCurrent() // THEN anyExpanding is still true assertThat(actual).isTrue() // WHEN shade dragged down a bit shadeRepository.setLegacyShadeExpansion(.7f) runCurrent() // THEN anyExpanding is still true assertThat(actual).isTrue() // WHEN shade fully expanded shadeRepository.setLegacyShadeExpansion(1f) runCurrent() // THEN anyExpanding is now false assertThat(actual).isFalse() // WHEN shade dragged up a bit shadeRepository.setLegacyShadeExpansion(.7f) runCurrent() // THEN anyExpanding is still false assertThat(actual).isFalse() } @Test fun expanding_shadeDraggedDownThenUp_expandingFalse() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade starts collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade expands but doesn't complete shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() shadeRepository.setLegacyShadeExpansion(0f) runCurrent() // THEN anyExpanding is false assertThat(actual).isFalse() } @Test fun lockscreenShadeExpansion_idle_onScene() = testScope.runTest() { Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +17 −1 Original line number 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.biometrics import android.annotation.MainThread Loading Loading @@ -25,7 +41,7 @@ constructor( shadeExpansionCollectorJob = scope.launch { // wait for it to emit true once shadeInteractorLazy.get().isAnyExpanding.first { it } shadeInteractorLazy.get().isUserInteracting.first { it } onShadeInteraction.run() } shadeExpansionCollectorJob?.invokeOnCompletion { shadeExpansionCollectorJob = null } Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +0 −8 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository import com.android.systemui.statusbar.policy.data.repository.DeviceProvisioningRepository import com.android.systemui.user.domain.interactor.UserSwitcherInteractor import com.android.systemui.util.kotlin.pairwise import javax.inject.Inject import javax.inject.Provider import kotlinx.coroutines.CoroutineScope Loading Loading @@ -140,13 +139,6 @@ constructor( /** Whether either the shade or QS is fully expanded. */ val isAnyFullyExpanded: Flow<Boolean> = anyExpansion.map { it >= 1f }.distinctUntilChanged() /** Whether either the shade or QS is expanding from a fully collapsed state. */ val isAnyExpanding: Flow<Boolean> = anyExpansion .pairwise(1f) .map { (prev, curr) -> curr > 0f && curr < 1f && prev < 1f } .distinctUntilChanged() /** * Whether either the shade or QS is partially or fully expanded, i.e. not fully collapsed. At * this time, this is not simply a matter of checking if either value in shadeExpansion and Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { runCurrent() // WHEN shade expands shadeRepository.setLegacyShadeTracking(true) shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() Loading Loading @@ -108,6 +109,7 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { // WHEN detector is disabled and shade opens detector.disable() shadeRepository.setLegacyShadeTracking(true) shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() Loading
packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeInteractorTest.kt +0 −99 Original line number Diff line number Diff line Loading @@ -444,105 +444,6 @@ class ShadeInteractorTest : SysuiTestCase() { assertThat(underTest.anyExpansion.value).isEqualTo(.5f) } @Test fun expanding_shadeDraggedDown_expandingTrue() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade and QS collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade partially expanded shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() } @Test fun expanding_qsDraggedDown_expandingTrue() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade and QS collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade partially expanded shadeRepository.setQsExpansion(.5f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() } @Test fun expanding_shadeDraggedUpAndDown() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // WHEN shade starts collapsed then partially expanded shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setLegacyShadeExpansion(.5f) shadeRepository.setQsExpansion(0f) runCurrent() // THEN anyExpanding is true assertThat(actual).isTrue() // WHEN shade dragged up a bit shadeRepository.setLegacyShadeExpansion(.2f) runCurrent() // THEN anyExpanding is still true assertThat(actual).isTrue() // WHEN shade dragged down a bit shadeRepository.setLegacyShadeExpansion(.7f) runCurrent() // THEN anyExpanding is still true assertThat(actual).isTrue() // WHEN shade fully expanded shadeRepository.setLegacyShadeExpansion(1f) runCurrent() // THEN anyExpanding is now false assertThat(actual).isFalse() // WHEN shade dragged up a bit shadeRepository.setLegacyShadeExpansion(.7f) runCurrent() // THEN anyExpanding is still false assertThat(actual).isFalse() } @Test fun expanding_shadeDraggedDownThenUp_expandingFalse() = testScope.runTest() { val actual by collectLastValue(underTest.isAnyExpanding) // GIVEN shade starts collapsed shadeRepository.setLegacyShadeExpansion(0f) shadeRepository.setQsExpansion(0f) runCurrent() // WHEN shade expands but doesn't complete shadeRepository.setLegacyShadeExpansion(.5f) runCurrent() shadeRepository.setLegacyShadeExpansion(0f) runCurrent() // THEN anyExpanding is false assertThat(actual).isFalse() } @Test fun lockscreenShadeExpansion_idle_onScene() = testScope.runTest() { Loading