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

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

Merge changes from topic "IFace-explicit-close" into sc-dev

* changes:
  Update default HAL with close and reset methods
  Add IFace#reset and ISession#close methods
parents 7fff3d59 e52cae0f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,4 +35,5 @@ package android.hardware.biometrics.face;
interface IFace {
  android.hardware.biometrics.face.SensorProps[] getSensorProps();
  android.hardware.biometrics.face.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.face.ISessionCallback cb);
  void reset();
}
+1 −0
Original line number Diff line number Diff line
@@ -45,4 +45,5 @@ interface ISession {
  void getAuthenticatorId(in int cookie);
  void invalidateAuthenticatorId(in int cookie);
  void resetLockout(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat);
  void close(in int cookie);
}
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ package android.hardware.biometrics.face;
@Backing(type="byte") @VintfStability
enum SessionState {
  IDLING = 0,
  TERMINATED = 1,
  CLOSED = 1,
  GENERATING_CHALLENGE = 2,
  REVOKING_CHALLENGE = 3,
  ENROLLING = 4,
+13 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ interface IFace {
     * Creates a session that can be used by the framework to perform operations such as
     * enroll, authenticate, etc. for the given sensorId and userId.
     *
     * Calling this method while there is an active session is considered an error. If the
     * framework is in a bad state and for some reason cannot close its session, it should use
     * the reset method below.
     *
     * Implementations must store user-specific state or metadata in /data/vendor_de/<user>/facedata
     * as specified by the SELinux policy. The directory /data/vendor_de is managed by vold (see
     * vold_prepare_subdirs.cpp). Implementations may store additional user-specific data, such as
@@ -47,4 +51,13 @@ interface IFace {
     */
    ISession createSession(in int sensorId, in int userId, in ISessionCallback cb);

    /**
     * Resets the HAL into a clean state, forcing it to cancel all of the pending operations, close
     * its current session, and release all of the acquired resources.
     *
     * This should be used as a last resort to recover the HAL if the current session becomes
     * unresponsive. The implementation might choose to restart the HAL process to get back into a
     * good state.
     */
    void reset();
}
+26 −8
Original line number Diff line number Diff line
@@ -17,12 +17,13 @@
package android.hardware.biometrics.face;

import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.biometrics.face.Feature;
import android.hardware.biometrics.face.EnrollmentType;
import android.hardware.keymaster.HardwareAuthToken;
import android.hardware.biometrics.face.Feature;
import android.hardware.common.NativeHandle;
import android.hardware.keymaster.HardwareAuthToken;

/** * A session is a collection of immutable state (sensorId, userId), mutable state (SessionState),
/**
 * A session is a collection of immutable state (sensorId, userId), mutable state (SessionState),
 * methods available for the framework to call, and a callback (ISessionCallback) to notify the
 * framework about the events and results. A session is used to establish communication between
 * the framework and the HAL.
@@ -134,9 +135,9 @@ interface ISession {
     * @param hat See above documentation.
     * @param enrollmentType See the EnrollmentType enum.
     * @param features See the Feature enum.
     * @param previewSurface A surface provided by the framework if SensorProps#halControlsPreview is
     *                       set to true. The HAL must send the preview frames to previewSurface if
     *                       it's not null.
     * @param previewSurface A surface provided by the framework if SensorProps#halControlsPreview
     *                       is set to true. The HAL must send the preview frames to previewSurface
     *                       if it's not null.
     * @return ICancellationSignal An object that can be used by the framework to cancel this
     * operation.
     */
@@ -420,5 +421,22 @@ interface ISession {
     * @param hat HardwareAuthToken See above documentation.
     */
    void resetLockout(in int cookie, in HardwareAuthToken hat);
}

    /*
     * Close this session and allow the HAL to release the resources associated with this session.
     *
     * A session can only be closed when it's in SessionState::IDLING. Closing a session will
     * result in a ISessionCallback#onStateChanged call with SessionState::CLOSED.
     *
     * If a session is unresponsive or stuck in a state other than SessionState::CLOSED,
     * IFace#reset could be used as a last resort to terminate the session and recover the HAL
     * from a bad state.
     *
     * All sessions must be explicitly closed. Calling IFace#createSession while there is an active
     * session is considered an error.
     *
     * @param cookie An identifier used to track subsystem operations related to this call path. The
     *               client must guarantee that it is unique per ISession.
     */
    void close(in int cookie);
}
Loading