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

Commit d63c6668 authored by Hao Dong's avatar Hao Dong Committed by Automerger Merge Worker
Browse files

Merge "Add onUdfpsUiEvent() and callbacks on overlay shown in...

Merge "Add onUdfpsUiEvent() and callbacks on overlay shown in FingerprintManager." into udc-qpr-dev am: 751a3079

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23595372



Change-Id: If1099fb480a60ea45c297447dff9f438103bdd04
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b2c04833 751a3079
Loading
Loading
Loading
Loading
+44 −7
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
    private static final int MSG_UDFPS_POINTER_DOWN = 108;
    private static final int MSG_UDFPS_POINTER_UP = 109;
    private static final int MSG_POWER_BUTTON_PRESSED = 110;
    private static final int MSG_UDFPS_OVERLAY_SHOWN = 111;

    /**
     * @hide
@@ -120,6 +121,24 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
    @Retention(RetentionPolicy.SOURCE)
    public @interface EnrollReason {}

    /**
     * Udfps ui event of overlay is shown on the screen.
     * @hide
     */
    public static final int UDFPS_UI_OVERLAY_SHOWN = 1;
    /**
     * Udfps ui event of the udfps UI being ready (e.g. HBM illumination is enabled).
     * @hide
     */
    public static final int UDFPS_UI_READY = 2;

    /**
     * @hide
     */
    @IntDef({UDFPS_UI_OVERLAY_SHOWN, UDFPS_UI_READY})
    @Retention(RetentionPolicy.SOURCE)
    public @interface UdfpsUiEvent{}

    /**
     * Request authentication with any single sensor.
     * @hide
@@ -475,12 +494,17 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        /**
         * Called when a pointer down event has occurred.
         */
        public void onPointerDown(int sensorId){ }
        public void onUdfpsPointerDown(int sensorId){ }

        /**
         * Called when a pointer up event has occurred.
         */
        public void onPointerUp(int sensorId){ }
        public void onUdfpsPointerUp(int sensorId){ }

        /**
         * Called when udfps overlay is shown.
         */
        public void onUdfpsOverlayShown() { }
    }

    /**
@@ -1112,14 +1136,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void onUiReady(long requestId, int sensorId) {
    public void onUdfpsUiEvent(@UdfpsUiEvent int event, long requestId, int sensorId) {
        if (mService == null) {
            Slog.w(TAG, "onUiReady: no fingerprint service");
            Slog.w(TAG, "onUdfpsUiEvent: no fingerprint service");
            return;
        }

        try {
            mService.onUiReady(requestId, sensorId);
            mService.onUdfpsUiEvent(event, requestId, sensorId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -1365,6 +1389,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
                case MSG_POWER_BUTTON_PRESSED:
                    sendPowerPressed();
                    break;
                case MSG_UDFPS_OVERLAY_SHOWN:
                    sendUdfpsOverlayShown();
                default:
                    Slog.w(TAG, "Unknown message: " + msg.what);

@@ -1489,7 +1515,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }

        if (mEnrollmentCallback != null) {
            mEnrollmentCallback.onPointerDown(sensorId);
            mEnrollmentCallback.onUdfpsPointerDown(sensorId);
        }
    }

@@ -1500,7 +1526,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
            mAuthenticationCallback.onUdfpsPointerUp(sensorId);
        }
        if (mEnrollmentCallback != null) {
            mEnrollmentCallback.onPointerUp(sensorId);
            mEnrollmentCallback.onUdfpsPointerUp(sensorId);
        }
    }

@@ -1512,6 +1538,12 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }
    }

    private void sendUdfpsOverlayShown() {
        if (mEnrollmentCallback != null) {
            mEnrollmentCallback.onUdfpsOverlayShown();
        }
    }

    /**
     * @hide
     */
@@ -1787,6 +1819,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        public void onUdfpsPointerUp(int sensorId) {
            mHandler.obtainMessage(MSG_UDFPS_POINTER_UP, sensorId, 0).sendToTarget();
        }

        @Override
        public void onUdfpsOverlayShown() {
            mHandler.obtainMessage(MSG_UDFPS_OVERLAY_SHOWN).sendToTarget();
        }
    };

}
+5 −0
Original line number Diff line number Diff line
@@ -75,4 +75,9 @@ public class FingerprintServiceReceiver extends IFingerprintServiceReceiver.Stub
    public void onUdfpsPointerUp(int sensorId) throws RemoteException {

    }

    @Override
    public void onUdfpsOverlayShown() throws RemoteException {

    }
}
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ interface IFingerprintService {

    // Notifies about the fingerprint UI being ready (e.g. HBM illumination is enabled).
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    void onUiReady(long requestId, int sensorId);
    void onUdfpsUiEvent(int event, long requestId, int sensorId);

    // Sets the controller for managing the UDFPS overlay.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
+1 −0
Original line number Diff line number Diff line
@@ -32,4 +32,5 @@ oneway interface IFingerprintServiceReceiver {
    void onChallengeGenerated(int sensorId, int userId, long challenge);
    void onUdfpsPointerDown(int sensorId);
    void onUdfpsPointerUp(int sensorId);
    void onUdfpsOverlayShown();
}
+8 −2
Original line number Diff line number Diff line
@@ -356,7 +356,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                UdfpsController.this.mAlternateTouchProvider.onUiReady();
            } else {
                final long requestId = (mOverlay != null) ? mOverlay.getRequestId() : 0L;
                UdfpsController.this.mFingerprintManager.onUiReady(requestId, sensorId);
                UdfpsController.this.mFingerprintManager.onUdfpsUiEvent(
                        FingerprintManager.UDFPS_UI_READY, requestId, sensorId);
            }
        }
    }
@@ -956,6 +957,10 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            mOnFingerDown = false;
            mAttemptedToDismissKeyguard = false;
            mOrientationListener.enable();
            if (mFingerprintManager != null) {
                mFingerprintManager.onUdfpsUiEvent(FingerprintManager.UDFPS_UI_OVERLAY_SHOWN,
                        overlay.getRequestId(), mSensorProps.sensorId);
            }
        } else {
            Log.v(TAG, "showUdfpsOverlay | the overlay is already showing");
        }
@@ -1097,7 +1102,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
            });
        } else {
            mFingerprintManager.onUiReady(requestId, mSensorProps.sensorId);
            mFingerprintManager.onUdfpsUiEvent(FingerprintManager.UDFPS_UI_READY, requestId,
                    mSensorProps.sensorId);
            mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE);
        }
    }
Loading