Loading packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bouncer.domain.interactor import android.util.Log import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.biometrics.data.repository.FingerprintPropertyRepository import com.android.systemui.bouncer.data.repository.KeyguardBouncerRepository Loading Loading @@ -46,6 +47,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn /** Encapsulates business logic for interacting with the lock-screen alternate bouncer. */ Loading Loading @@ -137,6 +139,8 @@ constructor( flowOf(false) } } .distinctUntilChanged() .onEach { Log.d(TAG, "canShowAlternateBouncer changed to $it") } .stateIn( scope = scope, started = WhileSubscribed(), Loading Loading @@ -234,5 +238,7 @@ constructor( companion object { private const val MIN_VISIBILITY_DURATION_UNTIL_TOUCHES_DISMISS_ALTERNATE_BOUNCER_MS = 200L private const val TAG = "AlternateBouncerInteractor" } } packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -530,6 +530,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb this::consumeKeyguardAuthenticatedBiometricsHandled ); } else { // Collector that keeps the AlternateBouncerInteractor#canShowAlternateBouncer flow hot. mListenForCanShowAlternateBouncer = mJavaAdapter.alwaysCollectFlow( mAlternateBouncerInteractor.getCanShowAlternateBouncer(), this::consumeCanShowAlternateBouncer Loading Loading @@ -578,8 +579,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } private void consumeCanShowAlternateBouncer(boolean canShow) { // do nothing, we only are registering for the flow to ensure that there's at least // one subscriber that will update AlternateBouncerInteractor.canShowAlternateBouncer.value // Hack: this is required to fix issues where // KeyguardBouncerRepository#alternateBouncerVisible state is incorrectly set and then never // reset. This is caused by usages of show()/forceShow() that only read this flow to set the // alternate bouncer visible state, if there is a race condition between when that flow // changes to false and when the read happens, the flow will be set to an incorrect value // and not reset on time. if (!canShow) { Log.d(TAG, "canShowAlternateBouncer turned false, maybe try hiding the alternate " + "bouncer if it is already visible"); mAlternateBouncerInteractor.maybeHide(); } } /** Register a callback, to be invoked by the Predictive Back system. */ Loading Loading
packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/AlternateBouncerInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bouncer.domain.interactor import android.util.Log import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.biometrics.data.repository.FingerprintPropertyRepository import com.android.systemui.bouncer.data.repository.KeyguardBouncerRepository Loading Loading @@ -46,6 +47,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn /** Encapsulates business logic for interacting with the lock-screen alternate bouncer. */ Loading Loading @@ -137,6 +139,8 @@ constructor( flowOf(false) } } .distinctUntilChanged() .onEach { Log.d(TAG, "canShowAlternateBouncer changed to $it") } .stateIn( scope = scope, started = WhileSubscribed(), Loading Loading @@ -234,5 +238,7 @@ constructor( companion object { private const val MIN_VISIBILITY_DURATION_UNTIL_TOUCHES_DISMISS_ALTERNATE_BOUNCER_MS = 200L private const val TAG = "AlternateBouncerInteractor" } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -530,6 +530,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb this::consumeKeyguardAuthenticatedBiometricsHandled ); } else { // Collector that keeps the AlternateBouncerInteractor#canShowAlternateBouncer flow hot. mListenForCanShowAlternateBouncer = mJavaAdapter.alwaysCollectFlow( mAlternateBouncerInteractor.getCanShowAlternateBouncer(), this::consumeCanShowAlternateBouncer Loading Loading @@ -578,8 +579,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } private void consumeCanShowAlternateBouncer(boolean canShow) { // do nothing, we only are registering for the flow to ensure that there's at least // one subscriber that will update AlternateBouncerInteractor.canShowAlternateBouncer.value // Hack: this is required to fix issues where // KeyguardBouncerRepository#alternateBouncerVisible state is incorrectly set and then never // reset. This is caused by usages of show()/forceShow() that only read this flow to set the // alternate bouncer visible state, if there is a race condition between when that flow // changes to false and when the read happens, the flow will be set to an incorrect value // and not reset on time. if (!canShow) { Log.d(TAG, "canShowAlternateBouncer turned false, maybe try hiding the alternate " + "bouncer if it is already visible"); mAlternateBouncerInteractor.maybeHide(); } } /** Register a callback, to be invoked by the Predictive Back system. */ Loading