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

Commit fa4a9fe4 authored by Austin Delgado's avatar Austin Delgado
Browse files

Remove AlternateUdfpsTouchProvider

Bug: 303470930
Test: atest SystemUITests:com.android.systemui.biometrics
Change-Id: I7053bef7459b83bceb140a6d612f3b12996020e5
parent 1b17e347
Loading
Loading
Loading
Loading
+0 −54
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.biometrics

/**
 * Interface for controlling the on finger down & on finger up events.
 */
interface AlternateUdfpsTouchProvider {

    /**
     * onPointerDown:
     *
     * This operation is used to notify the Fingerprint HAL that
     * a fingerprint has been detected on the device's screen.
     *
     * See fingerprint/ISession#onPointerDown for more details.
     */
    fun onPointerDown(pointerId: Long, x: Int, y: Int, minor: Float, major: Float)

    /**
     * onPointerUp:
     *
     * This operation can be invoked when the HAL is performing any one of: ISession#authenticate,
     * ISession#enroll, ISession#detectInteraction. This operation is used to indicate
     * that a fingerprint that was previously down, is now up.
     *
     * See fingerprint/ISession#onPointerUp for more details.
     */
    fun onPointerUp(pointerId: Long)

    /**
     * onUiReady:
     *
     * This operation is used by the callee to notify the Fingerprint HAL that SystemUI is
     * correctly configured for the fingerprint capture.
     *
     * See fingerprint/ISession#onUiReady for more details.
     */
    fun onUiReady()
}
+10 −47
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import kotlin.Unit;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Executor;

@@ -176,7 +175,6 @@ public class UdfpsController implements DozeReceiver, Dumpable {
    @VisibleForTesting @NonNull UdfpsOverlayParams mOverlayParams = new UdfpsOverlayParams();
    // TODO(b/229290039): UDFPS controller should manage its dimensions on its own. Remove this.
    @Nullable private Runnable mAuthControllerUpdateUdfpsLocation;
    @Nullable private final AlternateUdfpsTouchProvider mAlternateTouchProvider;
    @Nullable private UdfpsDisplayModeProvider mUdfpsDisplayMode;

    // The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active.
@@ -358,15 +356,11 @@ public class UdfpsController implements DozeReceiver, Dumpable {
         * Debug to run onUiReady
         */
        public void debugOnUiReady(int sensorId) {
            if (UdfpsController.this.mAlternateTouchProvider != null) {
                UdfpsController.this.mAlternateTouchProvider.onUiReady();
            } else {
            final long requestId = (mOverlay != null) ? mOverlay.getRequestId() : 0L;
            UdfpsController.this.mFingerprintManager.onUdfpsUiEvent(
                    FingerprintManager.UDFPS_UI_READY, requestId, sensorId);
        }
    }
    }

    /**
     * Updates the overlay parameters and reconstructs or redraws the overlay, if necessary.
@@ -642,7 +636,6 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            @NonNull SystemUIDialogManager dialogManager,
            @NonNull LatencyTracker latencyTracker,
            @NonNull ActivityLaunchAnimator activityLaunchAnimator,
            @NonNull Optional<Provider<AlternateUdfpsTouchProvider>> alternateTouchProvider,
            @NonNull @BiometricsBackground Executor biometricsExecutor,
            @NonNull PrimaryBouncerInteractor primaryBouncerInteractor,
            @NonNull SinglePointerTouchProcessor singlePointerTouchProcessor,
@@ -681,7 +674,6 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
        mLatencyTracker = latencyTracker;
        mActivityLaunchAnimator = activityLaunchAnimator;
        mAlternateTouchProvider = alternateTouchProvider.map(Provider::get).orElse(null);
        mSensorProps = new FingerprintSensorPropertiesInternal(
                -1 /* sensorId */,
                SensorProperties.STRENGTH_CONVENIENCE,
@@ -950,17 +942,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
    }

    private void dispatchOnUiReady(long requestId) {
        if (mAlternateTouchProvider != null) {
            mBiometricExecutor.execute(() -> {
                mAlternateTouchProvider.onUiReady();
                mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
            });
        } else {
        mFingerprintManager.onUdfpsUiEvent(FingerprintManager.UDFPS_UI_READY, requestId,
                mSensorProps.sensorId);
        mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
    }
    }

    private void onFingerDown(
            long requestId,
@@ -1019,19 +1004,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            }
        }
        mOnFingerDown = true;
        if (mAlternateTouchProvider != null) {
            mBiometricExecutor.execute(() -> {
                mAlternateTouchProvider.onPointerDown(requestId, (int) x, (int) y, minor, major);
            });
            mFgExecutor.execute(() -> {
                if (mKeyguardUpdateMonitor.isFingerprintDetectionRunning()) {
                    mKeyguardUpdateMonitor.onUdfpsPointerDown((int) requestId);
                }
            });
        } else {
        mFingerprintManager.onPointerDown(requestId, mSensorProps.sensorId, pointerId, x, y,
                minor, major, orientation, time, gestureStart, isAod);
        }
        Trace.endAsyncSection("UdfpsController.e2e.onPointerDown", 0);
        final UdfpsView view = mOverlay.getOverlayView();
        if (view != null && isOptical()) {
@@ -1078,19 +1052,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        mActivePointerId = -1;
        mAcquiredReceived = false;
        if (mOnFingerDown) {
            if (mAlternateTouchProvider != null) {
                mBiometricExecutor.execute(() -> {
                    mAlternateTouchProvider.onPointerUp(requestId);
                });
                mFgExecutor.execute(() -> {
                    if (mKeyguardUpdateMonitor.isFingerprintDetectionRunning()) {
                        mKeyguardUpdateMonitor.onUdfpsPointerUp((int) requestId);
                    }
                });
            } else {
            mFingerprintManager.onPointerUp(requestId, mSensorProps.sensorId, pointerId, x,
                    y, minor, major, orientation, time, gestureStart, isAod);
            }
            for (Callback cb : mCallbacks) {
                cb.onFingerUp();
            }
+0 −4
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.systemui.aconfig.AConfigModule;
import com.android.systemui.appops.dagger.AppOpsModule;
import com.android.systemui.assist.AssistModule;
import com.android.systemui.authentication.AuthenticationModule;
import com.android.systemui.biometrics.AlternateUdfpsTouchProvider;
import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider;
import com.android.systemui.biometrics.FingerprintReEnrollNotification;
import com.android.systemui.biometrics.UdfpsDisplayModeProvider;
@@ -299,9 +298,6 @@ public abstract class SystemUIModule {
    @BindsOptionalOf
    abstract UdfpsDisplayModeProvider optionalUdfpsDisplayModeProvider();

    @BindsOptionalOf
    abstract AlternateUdfpsTouchProvider optionalUdfpsTouchProvider();

    @BindsOptionalOf
    abstract FingerprintInteractiveToAuthProvider optionalFingerprintInteractiveToAuthProvider();