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

Commit 35a34be8 authored by Grace Cheng's avatar Grace Cheng Committed by Cherrypicker Worker
Browse files

Cleanup SFPS indicator code

Prevent duplicate show requests for indicator, ensure stale views remove lottie listeners, ensure overlayView is attached before updating

Flag: NONE
Fixes: 324372928
Fixes: 329434115
Test: (manual) repro steps from above bugs, not seeing reported issue anymore
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7d42eee84854172a7f6c0c9d3ae6c5b48ce4add5)
Merged-In: I33660b853c6f266378e3a9433c933bcd3f2a70a1
Change-Id: I33660b853c6f266378e3a9433c933bcd3f2a70a1
parent f13c1bb2
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ constructor(
            field?.let { oldView ->
                val lottie = oldView.requireViewById(R.id.sidefps_animation) as LottieAnimationView
                lottie.pauseAnimation()
                lottie.removeAllLottieOnCompositionLoadedListener()
                windowManager.removeView(oldView)
                orientationListener.disable()
            }
@@ -288,7 +289,7 @@ constructor(
    }

    private fun onOrientationChanged(@BiometricRequestConstants.RequestReason reason: Int) {
        if (overlayView != null) {
        if (overlayView?.isAttachedToWindow == true) {
            createOverlayForDisplay(reason)
        }
    }
@@ -322,7 +323,7 @@ constructor(
        )
        lottie.addLottieOnCompositionLoadedListener {
            // Check that view is not stale, and that overlayView has not been hidden/removed
            if (overlayView != null && overlayView == view) {
            if (overlayView?.isAttachedToWindow == true && overlayView == view) {
                updateOverlayParams(display, it.bounds)
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.systemui.biometrics.shared.model.AuthenticationReason.Setting
import com.android.systemui.keyguard.shared.model.FingerprintAuthenticationStatus
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map

/** Encapsulates business logic for interacting with biometric authentication state. */
@@ -52,7 +53,7 @@ constructor(
            } else {
                AuthenticationReason.NotRunning
            }
        }
        }.distinctUntilChanged()

    override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> =
        biometricStatusRepository.fingerprintAcquiredStatus