Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +4 −2 Original line number Diff line number Diff line Loading @@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun quickAffordance_updateOncePerShadeExpansion() = fun quickAffordance_doNotSendUpdatesWhileShadeExpandingAndStillHidden() = testScope.runTest { val shadeExpansion = MutableStateFlow(0f) whenever(shadeInteractor.anyExpansion).thenReturn(shadeExpansion) Loading @@ -365,7 +365,9 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { shadeExpansion.value = i / 10f } assertThat(collectedValue.size).isEqualTo(initialSize + 1) assertThat(collectedValue[0]) .isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) assertThat(collectedValue.size).isEqualTo(initialSize) } @Test Loading packages/SystemUI/src/com/android/systemui/dock/DockManagerExtensions.kt +9 −7 Original line number Diff line number Diff line Loading @@ -19,10 +19,11 @@ package com.android.systemui.dock import com.android.systemui.common.coroutine.ConflatedCallbackFlow import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged /** * Retrieves whether or not the device is docked according to DockManager. Emits a starting value * of isDocked. * Retrieves whether or not the device is docked according to DockManager. Emits a starting value of * isDocked. */ fun DockManager.retrieveIsDocked(): Flow<Boolean> = ConflatedCallbackFlow.conflatedCallbackFlow { Loading @@ -32,3 +33,4 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> = awaitClose { removeListener(callback) } } .distinctUntilChanged() packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +27 −25 Original line number Diff line number Diff line Loading @@ -116,7 +116,8 @@ constructor( is ObservableTransitionState.Idle -> it.currentScene == Scenes.Lockscreen is ObservableTransitionState.Transition -> it.fromScene == Scenes.Lockscreen || it.toScene == Scenes.Lockscreen it.fromScene == Scenes.Lockscreen || it.toScene == Scenes.Lockscreen } } .distinctUntilChanged() Loading @@ -132,6 +133,7 @@ constructor( KeyguardQuickAffordanceModel.Hidden } } .distinctUntilChanged() } /** Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ object KeyguardIndicationAreaBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.alpha") { // Do not independently apply alpha, as [KeyguardRootViewModel] should work // for this and all its children Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +7 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launch import com.android.settingslib.Utils import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableImageView Loading Loading @@ -80,8 +81,8 @@ object KeyguardQuickAffordanceViewBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.collect") { viewModel.collect { buttonModel -> updateButton( view = button, Loading @@ -93,7 +94,7 @@ object KeyguardQuickAffordanceViewBinder { } } launch { launch("$TAG#updateButtonAlpha") { updateButtonAlpha( view = button, viewModel = viewModel, Loading @@ -101,7 +102,7 @@ object KeyguardQuickAffordanceViewBinder { ) } launch { launch("$TAG#configurationBasedDimensions") { configurationBasedDimensions.collect { dimensions -> button.updateLayoutParams<ViewGroup.LayoutParams> { width = dimensions.buttonSizePx.width Loading Loading @@ -323,4 +324,6 @@ object KeyguardQuickAffordanceViewBinder { private data class ConfigurationBasedDimensions( val buttonSizePx: Size, ) private const val TAG = "KeyguardQuickAffordanceViewBinder" } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +4 −2 Original line number Diff line number Diff line Loading @@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun quickAffordance_updateOncePerShadeExpansion() = fun quickAffordance_doNotSendUpdatesWhileShadeExpandingAndStillHidden() = testScope.runTest { val shadeExpansion = MutableStateFlow(0f) whenever(shadeInteractor.anyExpansion).thenReturn(shadeExpansion) Loading @@ -365,7 +365,9 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { shadeExpansion.value = i / 10f } assertThat(collectedValue.size).isEqualTo(initialSize + 1) assertThat(collectedValue[0]) .isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) assertThat(collectedValue.size).isEqualTo(initialSize) } @Test Loading
packages/SystemUI/src/com/android/systemui/dock/DockManagerExtensions.kt +9 −7 Original line number Diff line number Diff line Loading @@ -19,10 +19,11 @@ package com.android.systemui.dock import com.android.systemui.common.coroutine.ConflatedCallbackFlow import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged /** * Retrieves whether or not the device is docked according to DockManager. Emits a starting value * of isDocked. * Retrieves whether or not the device is docked according to DockManager. Emits a starting value of * isDocked. */ fun DockManager.retrieveIsDocked(): Flow<Boolean> = ConflatedCallbackFlow.conflatedCallbackFlow { Loading @@ -32,3 +33,4 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> = awaitClose { removeListener(callback) } } .distinctUntilChanged()
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +27 −25 Original line number Diff line number Diff line Loading @@ -116,7 +116,8 @@ constructor( is ObservableTransitionState.Idle -> it.currentScene == Scenes.Lockscreen is ObservableTransitionState.Transition -> it.fromScene == Scenes.Lockscreen || it.toScene == Scenes.Lockscreen it.fromScene == Scenes.Lockscreen || it.toScene == Scenes.Lockscreen } } .distinctUntilChanged() Loading @@ -132,6 +133,7 @@ constructor( KeyguardQuickAffordanceModel.Hidden } } .distinctUntilChanged() } /** Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ object KeyguardIndicationAreaBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.alpha") { // Do not independently apply alpha, as [KeyguardRootViewModel] should work // for this and all its children Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +7 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launch import com.android.settingslib.Utils import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableImageView Loading Loading @@ -80,8 +81,8 @@ object KeyguardQuickAffordanceViewBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.collect") { viewModel.collect { buttonModel -> updateButton( view = button, Loading @@ -93,7 +94,7 @@ object KeyguardQuickAffordanceViewBinder { } } launch { launch("$TAG#updateButtonAlpha") { updateButtonAlpha( view = button, viewModel = viewModel, Loading @@ -101,7 +102,7 @@ object KeyguardQuickAffordanceViewBinder { ) } launch { launch("$TAG#configurationBasedDimensions") { configurationBasedDimensions.collect { dimensions -> button.updateLayoutParams<ViewGroup.LayoutParams> { width = dimensions.buttonSizePx.width Loading Loading @@ -323,4 +324,6 @@ object KeyguardQuickAffordanceViewBinder { private data class ConfigurationBasedDimensions( val buttonSizePx: Size, ) private const val TAG = "KeyguardQuickAffordanceViewBinder" }