Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +15 −9 Original line number Diff line number Diff line Loading @@ -37,17 +37,23 @@ constructor( @MainThread fun enable(onShadeInteraction: Runnable) { if (shadeExpansionCollectorJob == null) { if (shadeExpansionCollectorJob != null) { Log.e(TAG, "Already enabled") return } if (shadeInteractorLazy.get().isUserInteracting.value) { Log.e(TAG, "isUserInteracting already true, skipping enable") return } shadeExpansionCollectorJob = scope.launch { Log.i(TAG, "Enable detector") // wait for it to emit true once shadeInteractorLazy.get().isUserInteracting.first { it } Log.i(TAG, "Detector detected shade interaction") onShadeInteraction.run() } shadeExpansionCollectorJob?.invokeOnCompletion { shadeExpansionCollectorJob = null } } else { Log.e(TAG, "Already enabled") } } @MainThread Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ interface ShadeInteractor : BaseShadeInteractor { * input (i.e. dragging a pointer). This will be true even if the user's input gesture had ended * but a transition they initiated is still animating. */ val isUserInteracting: Flow<Boolean> val isUserInteracting: StateFlow<Boolean> /** Are touches allowed on the notification panel? */ val isShadeTouchable: Flow<Boolean> Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor { override val isAnyExpanded: StateFlow<Boolean> = inactiveFlowBoolean override val isUserInteractingWithShade: Flow<Boolean> = inactiveFlowBoolean override val isUserInteractingWithQs: Flow<Boolean> = inactiveFlowBoolean override val isUserInteracting: Flow<Boolean> = inactiveFlowBoolean override val isUserInteracting: StateFlow<Boolean> = inactiveFlowBoolean override val isShadeTouchable: Flow<Boolean> = inactiveFlowBoolean override val isExpandToQsEnabled: Flow<Boolean> = inactiveFlowBoolean } packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt +2 −1 Original line number Diff line number Diff line Loading @@ -65,9 +65,10 @@ constructor( override val isShadeFullyExpanded: Flow<Boolean> = baseShadeInteractor.shadeExpansion.map { it >= 1f }.distinctUntilChanged() override val isUserInteracting: Flow<Boolean> = override val isUserInteracting: StateFlow<Boolean> = combine(isUserInteractingWithShade, isUserInteractingWithQs) { shade, qs -> shade || qs } .distinctUntilChanged() .stateIn(scope, SharingStarted.Eagerly, false) override val isShadeTouchable: Flow<Boolean> = combine( Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +12 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,18 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { verify(action).run() } @Test fun enableDetector_isUserInteractingTrue_shouldNotPostRunnable() = testComponent.runTest { // GIVEN isInteracting starts true shadeRepository.setLegacyShadeTracking(true) runCurrent() detector.enable(action) // THEN action was not run verifyZeroInteractions(action) } @Test fun enableDetector_shadeExpandImmediate_shouldNotPostRunnable() = testComponent.runTest { Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +15 −9 Original line number Diff line number Diff line Loading @@ -37,17 +37,23 @@ constructor( @MainThread fun enable(onShadeInteraction: Runnable) { if (shadeExpansionCollectorJob == null) { if (shadeExpansionCollectorJob != null) { Log.e(TAG, "Already enabled") return } if (shadeInteractorLazy.get().isUserInteracting.value) { Log.e(TAG, "isUserInteracting already true, skipping enable") return } shadeExpansionCollectorJob = scope.launch { Log.i(TAG, "Enable detector") // wait for it to emit true once shadeInteractorLazy.get().isUserInteracting.first { it } Log.i(TAG, "Detector detected shade interaction") onShadeInteraction.run() } shadeExpansionCollectorJob?.invokeOnCompletion { shadeExpansionCollectorJob = null } } else { Log.e(TAG, "Already enabled") } } @MainThread Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ interface ShadeInteractor : BaseShadeInteractor { * input (i.e. dragging a pointer). This will be true even if the user's input gesture had ended * but a transition they initiated is still animating. */ val isUserInteracting: Flow<Boolean> val isUserInteracting: StateFlow<Boolean> /** Are touches allowed on the notification panel? */ val isShadeTouchable: Flow<Boolean> Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorEmptyImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor { override val isAnyExpanded: StateFlow<Boolean> = inactiveFlowBoolean override val isUserInteractingWithShade: Flow<Boolean> = inactiveFlowBoolean override val isUserInteractingWithQs: Flow<Boolean> = inactiveFlowBoolean override val isUserInteracting: Flow<Boolean> = inactiveFlowBoolean override val isUserInteracting: StateFlow<Boolean> = inactiveFlowBoolean override val isShadeTouchable: Flow<Boolean> = inactiveFlowBoolean override val isExpandToQsEnabled: Flow<Boolean> = inactiveFlowBoolean }
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt +2 −1 Original line number Diff line number Diff line Loading @@ -65,9 +65,10 @@ constructor( override val isShadeFullyExpanded: Flow<Boolean> = baseShadeInteractor.shadeExpansion.map { it >= 1f }.distinctUntilChanged() override val isUserInteracting: Flow<Boolean> = override val isUserInteracting: StateFlow<Boolean> = combine(isUserInteractingWithShade, isUserInteractingWithQs) { shade, qs -> shade || qs } .distinctUntilChanged() .stateIn(scope, SharingStarted.Eagerly, false) override val isShadeTouchable: Flow<Boolean> = combine( Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +12 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,18 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { verify(action).run() } @Test fun enableDetector_isUserInteractingTrue_shouldNotPostRunnable() = testComponent.runTest { // GIVEN isInteracting starts true shadeRepository.setLegacyShadeTracking(true) runCurrent() detector.enable(action) // THEN action was not run verifyZeroInteractions(action) } @Test fun enableDetector_shadeExpandImmediate_shouldNotPostRunnable() = testComponent.runTest { Loading