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

Commit 21af9267 authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Switch to pulsing state whenever fingerprint acquisition starts" into main

parents ab4ae770 865a3681
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -25,15 +25,14 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

import android.graphics.Point;
import android.os.PowerManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.View;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.keyguard.KeyguardUpdateMonitor;
@@ -68,7 +67,7 @@ import java.util.Collections;
import java.util.HashSet;

@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWith(AndroidJUnit4.class)
@RunWithLooper(setAsMainLooper = true)
public class DozeServiceHostTest extends SysuiTestCase {

@@ -181,6 +180,7 @@ public class DozeServiceHostTest extends SysuiTestCase {
                        DozeLog.PULSE_REASON_DOCKING,
                        DozeLog.REASON_SENSOR_WAKE_UP_PRESENCE,
                        DozeLog.REASON_SENSOR_QUICK_PICKUP,
                        DozeLog.PULSE_REASON_FINGERPRINT_ACTIVATED,
                        DozeLog.REASON_SENSOR_TAP));
        HashSet<Integer> reasonsThatDontPulse = new HashSet<>(
                Arrays.asList(DozeLog.REASON_SENSOR_PICKUP,
@@ -232,7 +232,7 @@ public class DozeServiceHostTest extends SysuiTestCase {
    public void onSlpiTap_doesnt_pass_negative_values() {
        mDozeServiceHost.onSlpiTap(-1, 200);
        mDozeServiceHost.onSlpiTap(100, -2);
        verifyZeroInteractions(mDozeInteractor);
        verify(mDozeInteractor, never()).setLastTapToWakePosition(any());
    }
    @Test
    public void dozeTimeTickSentToDozeInteractor() {
+7 −1
Original line number Diff line number Diff line
@@ -962,11 +962,17 @@
    <!-- Whether to show bottom sheets edge to edge -->
    <bool name="config_edgeToEdgeBottomSheetDialog">true</bool>

    <!--
    Time in milliseconds the user has to touch the side FPS sensor to successfully authenticate when
    the screen is turned off with AOD not enabled.
    TODO(b/302332976) Get this value from the HAL if they can provide an API for it.
    -->
    <integer name="config_restToUnlockDurationScreenOff">500</integer>
    <!--
    Time in milliseconds the user has to touch the side FPS sensor to successfully authenticate
    TODO(b/302332976) Get this value from the HAL if they can provide an API for it.
    -->
    <integer name="config_restToUnlockDuration">300</integer>
    <integer name="config_restToUnlockDurationDefault">300</integer>

    <!--
    Width in pixels of the Side FPS sensor.
+18 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import com.android.systemui.biometrics.shared.model.DisplayRotation
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
import com.android.systemui.biometrics.shared.model.isDefaultOrientation
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.log.SideFpsLogger
import com.android.systemui.res.R
import java.util.Optional
@@ -47,6 +49,7 @@ constructor(
    windowManager: WindowManager,
    displayStateInteractor: DisplayStateInteractor,
    fingerprintInteractiveToAuthProvider: Optional<FingerprintInteractiveToAuthProvider>,
    keyguardTransitionInteractor: KeyguardTransitionInteractor,
    private val logger: SideFpsLogger,
) {

@@ -62,8 +65,21 @@ constructor(
    val isAvailable: Flow<Boolean> =
        fingerprintPropertyRepository.sensorType.map { it == FingerprintSensorType.POWER_BUTTON }

    val authenticationDuration: Long =
        context.resources?.getInteger(R.integer.config_restToUnlockDuration)?.toLong() ?: 0L
    val authenticationDuration: Flow<Long> =
        keyguardTransitionInteractor
            .isFinishedInStateWhere { it == KeyguardState.OFF || it == KeyguardState.DOZING }
            .map {
                if (it)
                    context.resources
                        ?.getInteger(R.integer.config_restToUnlockDurationScreenOff)
                        ?.toLong()
                else
                    context.resources
                        ?.getInteger(R.integer.config_restToUnlockDurationDefault)
                        ?.toLong()
            }
            .map { it ?: 0L }
            .onEach { logger.authDurationChanged(it) }

    val isProlongedTouchRequiredForAuthentication: Flow<Boolean> =
        if (fingerprintInteractiveToAuthProvider.isEmpty) {
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.deviceentry.domain.interactor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.DeviceEntryFingerprintAuthRepository
import com.android.systemui.keyguard.shared.model.FailFingerprintAuthenticationStatus
import com.android.systemui.keyguard.shared.model.FingerprintAuthenticationStatus
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterIsInstance
@@ -31,4 +32,11 @@ constructor(
) {
    val fingerprintFailure: Flow<FailFingerprintAuthenticationStatus> =
        repository.authenticationStatus.filterIsInstance<FailFingerprintAuthenticationStatus>()

    /** Whether fingerprint authentication is currently running or not */
    val isRunning: Flow<Boolean> = repository.isRunning

    /** Provide the current status of fingerprint authentication. */
    val authenticationStatus: Flow<FingerprintAuthenticationStatus> =
        repository.authenticationStatus
}
+5 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ public interface DozeHost {
         * Called when the dozing state may have been updated.
         */
        default void onDozingChanged(boolean isDozing) {}

        /**
         * Called when fingerprint acquisition has started and screen state might need updating.
         */
        default void onSideFingerprintAcquisitionStarted() {}
    }

    interface PulseCallback {
Loading