Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +2 −4 Original line number Diff line number Diff line Loading @@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun quickAffordance_doNotSendUpdatesWhileShadeExpandingAndStillHidden() = fun quickAffordance_updateOncePerShadeExpansion() = testScope.runTest { val shadeExpansion = MutableStateFlow(0f) whenever(shadeInteractor.anyExpansion).thenReturn(shadeExpansion) Loading @@ -365,9 +365,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { shadeExpansion.value = i / 10f } assertThat(collectedValue[0]) .isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) assertThat(collectedValue.size).isEqualTo(initialSize) assertThat(collectedValue.size).isEqualTo(initialSize + 1) } @Test Loading packages/SystemUI/src/com/android/systemui/dock/DockManagerExtensions.kt +7 −9 Original line number Diff line number Diff line Loading @@ -19,11 +19,10 @@ 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 @@ -33,4 +32,3 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> = awaitClose { removeListener(callback) } } No newline at end of file .distinctUntilChanged() packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +25 −27 Original line number Diff line number Diff line Loading @@ -116,8 +116,7 @@ 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 @@ -133,7 +132,6 @@ 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.CREATED) { repeatOnLifecycle(Lifecycle.State.STARTED) { 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 +4 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ 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 @@ -81,8 +80,8 @@ object KeyguardQuickAffordanceViewBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.collect") { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { viewModel.collect { buttonModel -> updateButton( view = button, Loading @@ -94,7 +93,7 @@ object KeyguardQuickAffordanceViewBinder { } } launch("$TAG#updateButtonAlpha") { launch { updateButtonAlpha( view = button, viewModel = viewModel, Loading @@ -102,7 +101,7 @@ object KeyguardQuickAffordanceViewBinder { ) } launch("$TAG#configurationBasedDimensions") { launch { configurationBasedDimensions.collect { dimensions -> button.updateLayoutParams<ViewGroup.LayoutParams> { width = dimensions.buttonSizePx.width Loading Loading @@ -324,6 +323,4 @@ 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 +2 −4 Original line number Diff line number Diff line Loading @@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun quickAffordance_doNotSendUpdatesWhileShadeExpandingAndStillHidden() = fun quickAffordance_updateOncePerShadeExpansion() = testScope.runTest { val shadeExpansion = MutableStateFlow(0f) whenever(shadeInteractor.anyExpansion).thenReturn(shadeExpansion) Loading @@ -365,9 +365,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { shadeExpansion.value = i / 10f } assertThat(collectedValue[0]) .isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) assertThat(collectedValue.size).isEqualTo(initialSize) assertThat(collectedValue.size).isEqualTo(initialSize + 1) } @Test Loading
packages/SystemUI/src/com/android/systemui/dock/DockManagerExtensions.kt +7 −9 Original line number Diff line number Diff line Loading @@ -19,11 +19,10 @@ 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 @@ -33,4 +32,3 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> = awaitClose { removeListener(callback) } } No newline at end of file .distinctUntilChanged()
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +25 −27 Original line number Diff line number Diff line Loading @@ -116,8 +116,7 @@ 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 @@ -133,7 +132,6 @@ 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.CREATED) { repeatOnLifecycle(Lifecycle.State.STARTED) { 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 +4 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ 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 @@ -81,8 +80,8 @@ object KeyguardQuickAffordanceViewBinder { val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.collect") { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { viewModel.collect { buttonModel -> updateButton( view = button, Loading @@ -94,7 +93,7 @@ object KeyguardQuickAffordanceViewBinder { } } launch("$TAG#updateButtonAlpha") { launch { updateButtonAlpha( view = button, viewModel = viewModel, Loading @@ -102,7 +101,7 @@ object KeyguardQuickAffordanceViewBinder { ) } launch("$TAG#configurationBasedDimensions") { launch { configurationBasedDimensions.collect { dimensions -> button.updateLayoutParams<ViewGroup.LayoutParams> { width = dimensions.buttonSizePx.width Loading Loading @@ -324,6 +323,4 @@ object KeyguardQuickAffordanceViewBinder { private data class ConfigurationBasedDimensions( val buttonSizePx: Size, ) private const val TAG = "KeyguardQuickAffordanceViewBinder" }