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

Commit 22f83b56 authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by Android (Google) Code Review
Browse files

Merge "Split onPointerDown to onPointerDown and onUiReady" into sc-dev

parents 9f60cc78 7f317645
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -925,6 +925,23 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }
    }

    /**
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void onUiReady(int sensorId) {
        if (mService == null) {
            Slog.w(TAG, "onUiReady: no fingerprint service");
            return;
        }

        try {
            mService.onUiReady(sensorId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Determine if there is at least one fingerprint enrolled.
     *
@@ -1450,7 +1467,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        @Override // binder call
        public void onUdfpsPointerUp(int sensorId) {
            mHandler.obtainMessage(MSG_UDFPS_POINTER_UP, sensorId, 0).sendToTarget();

        }
    };

+3 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ interface IFingerprintService {
    // Notifies about a finger leaving the sensor area.
    void onPointerUp(int sensorId);

    // Notifies about the fingerprint UI being ready (e.g. HBM illumination is enabled).
    void onUiReady(int sensorId);

    // Sets the controller for managing the UDFPS overlay.
    void setUdfpsOverlayController(in IUdfpsOverlayController controller);

+5 −4
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
                }
                if (isWithinSensorArea(udfpsView, event.getX(), event.getY(), fromUdfpsView)) {
                    Trace.beginAsyncSection(
                            "UdfpsController.mOnTouchListener#isWithinSensorArea", 1);
                            "UdfpsController#ACTION_DOWN", 1);
                    // The pointer that causes ACTION_DOWN is always at index 0.
                    // We need to persist its ID to track it during ACTION_MOVE that could include
                    // data for many other pointers because of multi-touch support.
@@ -382,8 +382,6 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
                                minor, major, v, exceedsVelocityThreshold);
                        final long sinceLastLog = SystemClock.elapsedRealtime() - mTouchLogTime;
                        if (!isFingerDown && !exceedsVelocityThreshold) {
                            Trace.endAsyncSection(
                                    "UdfpsController.mOnTouchListener#isWithinSensorArea", 1);
                            onFingerDown((int) x, (int) y, minor, major);
                            Log.v(TAG, "onTouch | finger down: " + touchInfo);
                            mTouchLogTime = SystemClock.elapsedRealtime();
@@ -761,10 +759,13 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
            Log.w(TAG, "Null view in onFingerDown");
            return;
        }
        mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
        Trace.endAsyncSection(
                "UdfpsController#ACTION_DOWN", 1);
        Trace.beginAsyncSection("UdfpsController#startIllumination", 1);
        mView.startIllumination(() -> {
            mFingerprintManager.onUiReady(mSensorProps.sensorId);
            Trace.endAsyncSection("UdfpsController#startIllumination", 1);
            mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
        });
    }

+6 −4
Original line number Diff line number Diff line
@@ -232,12 +232,14 @@ public class UdfpsControllerTest extends SysuiTestCase {
        MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
        mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
        moveEvent.recycle();
        // THEN illumination begins
        // AND onIlluminatedRunnable that notifies FingerprintManager is set
        verify(mUdfpsView).startIllumination(mOnIlluminatedRunnableCaptor.capture());
        mOnIlluminatedRunnableCaptor.getValue().run();
        // THEN FingerprintManager is notified about onPointerDown
        verify(mFingerprintManager).onPointerDown(eq(mUdfpsController.mSensorProps.sensorId), eq(0),
                eq(0), eq(0f), eq(0f));
        // AND illumination begins
        verify(mUdfpsView).startIllumination(mOnIlluminatedRunnableCaptor.capture());
        // AND onIlluminatedRunnable notifies FingerprintManager about onUiReady
        mOnIlluminatedRunnableCaptor.getValue().run();
        verify(mFingerprintManager).onUiReady(eq(mUdfpsController.mSensorProps.sensorId));
    }

    @Test
+2 −2
Original line number Diff line number Diff line
@@ -167,13 +167,13 @@ public class ClientMonitorCallbackConverter {

    // Fingerprint-specific callbacks for FingerprintManager only

    public void onUdfpsPointerDown(int sensorId, int cookie) throws RemoteException {
    public void onUdfpsPointerDown(int sensorId) throws RemoteException {
        if (mFingerprintServiceReceiver != null) {
            mFingerprintServiceReceiver.onUdfpsPointerDown(sensorId);
        }
    }

    public void onUdfpsPointerUp(int sensorId, int cookie) throws RemoteException {
    public void onUdfpsPointerUp(int sensorId) throws RemoteException {
        if (mFingerprintServiceReceiver != null) {
            mFingerprintServiceReceiver.onUdfpsPointerUp(sensorId);
        }
Loading