Merge "Update IFace getFeatures/setFeature and feature names" into sc-dev

This commit is contained in:
Ilya Matyukhin 2021-04-15 17:35:30 +00:00 committed by Android (Google) Code Review
commit a3c97c77b1
9 changed files with 30 additions and 38 deletions

View file

@ -34,7 +34,7 @@
package android.hardware.biometrics.face;
@Backing(type="byte") @VintfStability
enum Feature {
WAVE_ATTENTION_REQUIREMENT = 0,
WAVE_DIVERSE_POSES_REQUIREMENT = 1,
REQUIRE_ATTENTION = 0,
REQUIRE_DIVERSE_POSES = 1,
DEBUG = 2,
}

View file

@ -41,8 +41,8 @@ interface ISession {
android.hardware.biometrics.common.ICancellationSignal detectInteraction();
void enumerateEnrollments();
void removeEnrollments(in int[] enrollmentIds);
void getFeatures(in int enrollmentId);
void setFeature(in android.hardware.keymaster.HardwareAuthToken hat, in int enrollmentId, in android.hardware.biometrics.face.Feature feature, boolean enabled);
void getFeatures();
void setFeature(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.Feature feature, boolean enabled);
void getAuthenticatorId();
void invalidateAuthenticatorId();
void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat);

View file

@ -47,8 +47,8 @@ interface ISessionCallback {
void onLockoutCleared();
void onInteractionDetected();
void onEnrollmentsEnumerated(in int[] enrollmentIds);
void onFeaturesRetrieved(in android.hardware.biometrics.face.Feature[] features, in int enrollmentId);
void onFeatureSet(in int enrollmentId, android.hardware.biometrics.face.Feature feature);
void onFeaturesRetrieved(in android.hardware.biometrics.face.Feature[] features);
void onFeatureSet(android.hardware.biometrics.face.Feature feature);
void onEnrollmentsRemoved(in int[] enrollmentIds);
void onAuthenticatorIdRetrieved(in long authenticatorId);
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);

View file

@ -20,20 +20,19 @@ package android.hardware.biometrics.face;
@Backing(type="byte")
enum Feature {
/**
* Do not require the user to look at the device during enrollment and authentication. Note
* this is to accommodate people who have limited vision.
* Require the user to look at the device during enrollment and authentication. This feature
* can be disabled to accommodate people who have limited vision.
*/
WAVE_ATTENTION_REQUIREMENT,
REQUIRE_ATTENTION,
/**
* Do not require a diverse set of poses during enrollment. This is to accommodate people with
* limited mobility.
* Require a diverse set of poses during enrollment. This feature can be disabled to accommodate
* people with limited mobility.
*/
WAVE_DIVERSE_POSES_REQUIREMENT,
REQUIRE_DIVERSE_POSES,
/**
* Enable debugging functionality.
*/
DEBUG,
}

View file

@ -249,38 +249,34 @@ interface ISession {
/**
* getFeatures:
*
* Returns a list of currently enabled features for the provided enrollmentId.
* Returns a list of currently enabled features for this (sensorId, userId) pair.
*
* If the enrollmentId is invalid, the HAL must invoke ISessionCallback#onError with
* If the user is not enrolled, the HAL must invoke ISessionCallback#onError with
* Error::UNABLE_TO_PROCESS.
*
* The HAL must notify the framework about the result by calling
* ISessionCallback#onFeaturesRetrieved.
*
* @param enrollmentId the ID of the enrollment for which the features are requested.
*/
void getFeatures(in int enrollmentId);
void getFeatures();
/**
* setFeature:
*
* Enables or disables a feature for the given enrollmentId. Because certain features may
* Enables or disables a feature for this (sensorId, userId) pair. Because certain features may
* decrease security, the user must enter their password before this method is invoked
* (see @param hat). The HAL must verify the hat before changing any feature state.
*
* If either the hat or enrollmentId is invalid, the HAL must invoke ISessionCallback#onError
* with Error::UNABLE_TO_PROCESS.
* If the hat is invalid or if the user is not enrolled, the HAL must invoke
* ISessionCallback#onError with Error::UNABLE_TO_PROCESS.
*
* After the feature is successfully set, the HAL must notify the framework by calling
* ISessionCallback#onFeatureSet.
*
* @param hat HardwareAuthToken See above documentation.
* @param enrollmentId the ID of the enrollment for which the feature update is requested.
* @param feature The feature to be enabled or disabled.
* @param enabled Whether the provided features should be enabled or disabled.
*/
void setFeature(
in HardwareAuthToken hat, in int enrollmentId, in Feature feature, boolean enabled);
void setFeature(in HardwareAuthToken hat, in Feature feature, boolean enabled);
/**
* getAuthenticatorId:

View file

@ -172,22 +172,21 @@ interface ISessionCallback {
/**
* This method must only be used to notify the framework during ISession#getFeatures.
*
* Provides a list of features that are currently enabled for the given enrollmentId.
* Provides a list of features that are currently enabled for the session's (userId, sensorId)
* pair.
*
* @param features A list of currently enabled features. See the Feature enum.
* @param enrollmentId The enrollment for which the features were requested.
*/
void onFeaturesRetrieved(in Feature[] features, in int enrollmentId);
void onFeaturesRetrieved(in Feature[] features);
/**
* This method must only be used to notify the framework during ISession#setFeature.
*
* Notifies the framework that ISession#setFeature has completed.
*
* @param enrollmentId The enrollment for which a feature was set.
* @param feature The feature that was set.
*/
void onFeatureSet(in int enrollmentId, Feature feature);
void onFeatureSet(Feature feature);
/**
* This method must only be used to notify the framework during

View file

@ -92,14 +92,13 @@ ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& /*enro
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::getFeatures(int32_t /*enrollmentId*/) {
ndk::ScopedAStatus Session::getFeatures() {
LOG(INFO) << "getFeatures";
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::setFeature(const keymaster::HardwareAuthToken& /*hat*/,
int32_t /*enrollmentId*/, Feature /*feature*/,
bool /*enabled*/) {
Feature /*feature*/, bool /*enabled*/) {
LOG(INFO) << "setFeature";
return ndk::ScopedAStatus::ok();
}

View file

@ -50,10 +50,10 @@ class Session : public BnSession {
ndk::ScopedAStatus removeEnrollments(const std::vector<int32_t>& enrollmentIds) override;
ndk::ScopedAStatus getFeatures(int32_t enrollmentId) override;
ndk::ScopedAStatus getFeatures() override;
ndk::ScopedAStatus setFeature(const keymaster::HardwareAuthToken& hat, int32_t enrollmentId,
Feature feature, bool enabled) override;
ndk::ScopedAStatus setFeature(const keymaster::HardwareAuthToken& hat, Feature feature,
bool enabled) override;
ndk::ScopedAStatus getAuthenticatorId() override;

View file

@ -104,12 +104,11 @@ class SessionCallback : public BnSessionCallback {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onFeaturesRetrieved(const std::vector<Feature>& /*features*/,
int32_t /*enrollmentId*/) override {
ndk::ScopedAStatus onFeaturesRetrieved(const std::vector<Feature>& /*features*/) override {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus onFeatureSet(int32_t /*enrollmentId*/, Feature /*feature*/) override {
ndk::ScopedAStatus onFeatureSet(Feature /*feature*/) override {
return ndk::ScopedAStatus::ok();
}