Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f7e0582 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix persisting SFPS indicator issue." into main

parents 4c8d86bd 070817ba
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
@@ -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. */
@@ -137,6 +139,8 @@ constructor(
                    flowOf(false)
                }
            }
            .distinctUntilChanged()
            .onEach { Log.d(TAG, "canShowAlternateBouncer changed to $it") }
            .stateIn(
                scope = scope,
                started = WhileSubscribed(),
@@ -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"
    }
}
+12 −2
Original line number Diff line number Diff line
@@ -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
@@ -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. */