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

Commit 4c64a1cd authored by Beverly's avatar Beverly
Browse files

Move AlternateBouncer scrim to the KeyguardRootView

So that the alternate bouncer scrim will render
underneath the device entry icon view. This handles
the case when the alternate bouncer shows on the lockscreen
WITHOUT the shade expanded.

Also, when the device_entry_udfps_refactor flag is enabled,
the AlternateBouncer availability is driven by the supported
fingerprint sensor type on the device instead of by
the (Udfps/SideFPS) controllers.

Note: click listener stopped working when the alternate bouncer
view was moved. Alternate bouncer needs to support swiping gesture
in the future, so the touch gesture/click will be updated in a
future CL.

Test: atest AlternateBouncerInteractorTest
Test: atest SystemUITests
Bug: 287599719
Bug: 305234447
Flag: ACONFIG com.android.systemui.device_entry_udfps_refactor DEVELOPMENT
Change-Id: Ibfe3474606d381d0cdc85242c0714e006b3fb176
parent 831a9637
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@
    android:focusable="true"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    android:layout_height="match_parent"
    android:visibility="invisible">

    <com.android.systemui.scrim.ScrimView
        android:id="@+id/alternate_bouncer_scrim"
+0 −5
Original line number Diff line number Diff line
@@ -119,11 +119,6 @@
        android:inflatedId="@+id/multi_shade"
        android:layout="@layout/multi_shade" />

    <include layout="@layout/alternate_bouncer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="invisible" />

    <com.android.systemui.biometrics.AuthRippleView
        android:id="@+id/auth_ripple"
        android:layout_width="match_parent"
+5 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.dump.DumpManager
import com.android.systemui.res.R
import com.android.systemui.util.boundsOnScreen
@@ -190,7 +191,10 @@ constructor(
    }

    private fun listenForAlternateBouncerVisibility() {
        if (!DeviceEntryUdfpsRefactor.isEnabled) {
            alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, "SideFpsController")
        }

        scope.launch {
            alternateBouncerInteractor.isVisible.collect { isVisible: Boolean ->
                if (isVisible) {
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.EX
import com.android.systemui.bouncer.shared.model.BouncerShowMessageModel
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.log.dagger.BouncerTableLog
import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.log.table.logDiffsForTable
@@ -208,6 +209,7 @@ constructor(
    }

    override fun setAlternateBouncerUIAvailable(isAvailable: Boolean) {
        DeviceEntryUdfpsRefactor.assertInLegacyMode()
        _alternateBouncerUIAvailable.value = isAvailable
    }

+27 −1
Original line number Diff line number Diff line
@@ -17,14 +17,23 @@
package com.android.systemui.bouncer.domain.interactor

import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.biometrics.data.repository.FingerprintPropertyRepository
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
import com.android.systemui.bouncer.data.repository.KeyguardBouncerRepository
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.util.time.SystemClock
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn

/** Encapsulates business logic for interacting with the lock-screen alternate bouncer. */
@SysUISingleton
@@ -34,13 +43,29 @@ constructor(
    private val statusBarStateController: StatusBarStateController,
    private val keyguardStateController: KeyguardStateController,
    private val bouncerRepository: KeyguardBouncerRepository,
    fingerprintPropertyRepository: FingerprintPropertyRepository,
    private val biometricSettingsRepository: BiometricSettingsRepository,
    private val systemClock: SystemClock,
    private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
    @Application scope: CoroutineScope,
) {
    var receivedDownTouch = false
    val isVisible: Flow<Boolean> = bouncerRepository.alternateBouncerVisible
    private val alternateBouncerUiAvailableFromSource: HashSet<String> = HashSet()
    private val alternateBouncerSupported: StateFlow<Boolean> =
        if (DeviceEntryUdfpsRefactor.isEnabled) {
            fingerprintPropertyRepository.sensorType
                .map { sensorType ->
                    sensorType.isUdfps() || sensorType == FingerprintSensorType.POWER_BUTTON
                }
                .stateIn(
                    scope = scope,
                    started = SharingStarted.Eagerly,
                    initialValue = false,
                )
        } else {
            bouncerRepository.alternateBouncerUIAvailable
        }

    /**
     * Sets the correct bouncer states to show the alternate bouncer if it can show.
@@ -71,6 +96,7 @@ constructor(
    }

    fun setAlternateBouncerUIAvailable(isAvailable: Boolean, token: String) {
        DeviceEntryUdfpsRefactor.assertInLegacyMode()
        if (isAvailable) {
            alternateBouncerUiAvailableFromSource.add(token)
        } else {
@@ -82,7 +108,7 @@ constructor(
    }

    fun canShowAlternateBouncerForFingerprint(): Boolean {
        return bouncerRepository.alternateBouncerUIAvailable.value &&
        return alternateBouncerSupported.value &&
            biometricSettingsRepository.isFingerprintAuthCurrentlyAllowed.value &&
            !keyguardUpdateMonitor.isFingerprintLockedOut &&
            !keyguardStateController.isUnlocked &&
Loading