Move ICancellationSignal to common, add supportsNavigationGestures

Bug: 168842956
Test: Builds
Test: make -j56 android.hardware.biometrics.common-update-api
Test: make -j56 android.hardware.biometrics.fingerprint-update-api
Test: make -j56 VtsHalBiometricsFingerprintTargetTest

Change-Id: Ie35ccc2ea8b7ef710914e9a18fc28f49c2d6f0be
This commit is contained in:
Kevin Chyn
2020-09-18 10:31:50 -07:00
parent c306b76f7f
commit e33abd6456
11 changed files with 27 additions and 16 deletions

View File

@@ -15,7 +15,7 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.biometrics.fingerprint;
package android.hardware.biometrics.common;
@VintfStability
interface ICancellationSignal {
oneway void cancel();

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package android.hardware.biometrics.fingerprint;
package android.hardware.biometrics.common;
@VintfStability
oneway interface ICancellationSignal {

View File

@@ -18,9 +18,9 @@
package android.hardware.biometrics.fingerprint;
@VintfStability
interface ISession {
android.hardware.biometrics.fingerprint.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat);
android.hardware.biometrics.fingerprint.ICancellationSignal authenticate(in int cookie, in long keystoreOperationId);
android.hardware.biometrics.fingerprint.ICancellationSignal detectInteraction(in int cookie);
android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat);
android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long keystoreOperationId);
android.hardware.biometrics.common.ICancellationSignal detectInteraction(in int cookie);
void enumerateEnrollments(in int cookie);
void removeEnrollments(in int cookie, in int[] enrollmentIds);
void getAuthenticatorId(in int cookie);

View File

@@ -20,6 +20,7 @@ package android.hardware.biometrics.fingerprint;
parcelable SensorProps {
android.hardware.biometrics.common.CommonProps commonProps;
android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType;
boolean supportsNavigationGestures;
int sensorLocationX;
int sensorLocationY;
int sensorRadius;

View File

@@ -16,7 +16,7 @@
package android.hardware.biometrics.fingerprint;
import android.hardware.biometrics.fingerprint.ICancellationSignal;
import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.keymaster.HardwareAuthToken;
@VintfStability

View File

@@ -32,6 +32,12 @@ parcelable SensorProps {
*/
FingerprintSensorType sensorType;
/**
* Must be set to true for sensors that support "swipe" gestures via
* android.view.KeyEvent#KEYCODE_SYSTEM_NAVIGATION_*.
*/
boolean supportsNavigationGestures;
/**
* The location of the center of the sensor if applicable. For example,
* sensors of FingerprintSensorType::UNDER_DISPLAY_* would report this

View File

@@ -8,6 +8,7 @@ cc_binary {
"libbase",
"libbinder_ndk",
"android.hardware.biometrics.fingerprint-ndk_platform",
"android.hardware.biometrics.common-unstable-ndk_platform",
],
srcs: [
"main.cpp",

View File

@@ -23,6 +23,7 @@ const int kSensorId = 0;
const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
const int kMaxEnrollmentsPerUser = 5;
const FingerprintSensorType kSensorType = FingerprintSensorType::REAR;
const bool kSupportsNavigationGestures = true;
const std::string kHwDeviceName = "fingerprintSensor";
const std::string kHardwareVersion = "vendor/model/revision";
const std::string kFirmwareVersion = "1.01";
@@ -44,6 +45,7 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* return_
hardwareInfos};
SensorProps props = {commonProps,
kSensorType,
kSupportsNavigationGestures,
0 /* sensorLocationX */,
0 /* sensorLocationY */,
0 /* sensorRadius */,

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
#include <aidl/android/hardware/biometrics/fingerprint/BnCancellationSignal.h>
#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h>
#include "Session.h"
namespace aidl::android::hardware::biometrics::fingerprint {
class CancellationSignal : public BnCancellationSignal {
class CancellationSignal : public common::BnCancellationSignal {
public:
ndk::ScopedAStatus cancel() override { return ndk::ScopedAStatus::ok(); }
};
@@ -28,12 +28,12 @@ class CancellationSignal : public BnCancellationSignal {
Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
ndk::ScopedAStatus Session::enroll(int32_t /*cookie*/, const keymaster::HardwareAuthToken& /*hat*/,
std::shared_ptr<ICancellationSignal>* /*return_val*/) {
std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::authenticate(int32_t /*cookie*/, int64_t /*keystoreOperationId*/,
std::shared_ptr<ICancellationSignal>* return_val) {
std::shared_ptr<common::ICancellationSignal>* return_val) {
if (cb_) {
cb_->onStateChanged(0, SessionState::AUTHENTICATING);
}
@@ -42,7 +42,7 @@ ndk::ScopedAStatus Session::authenticate(int32_t /*cookie*/, int64_t /*keystoreO
}
ndk::ScopedAStatus Session::detectInteraction(
int32_t /*cookie*/, std::shared_ptr<ICancellationSignal>* /*return_val*/) {
int32_t /*cookie*/, std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
return ndk::ScopedAStatus::ok();
}

View File

@@ -21,20 +21,21 @@
namespace aidl::android::hardware::biometrics::fingerprint {
namespace aidl::android::hardware::keymaster = keymaster;
namespace common = aidl::android::hardware::biometrics::common;
namespace keymaster = aidl::android::hardware::keymaster;
class Session : public BnSession {
public:
explicit Session(std::shared_ptr<ISessionCallback> cb);
ndk::ScopedAStatus enroll(int32_t cookie, const keymaster::HardwareAuthToken& hat,
std::shared_ptr<ICancellationSignal>* return_val) override;
std::shared_ptr<common::ICancellationSignal>* return_val) override;
ndk::ScopedAStatus authenticate(int32_t cookie, int64_t keystoreOperationId,
std::shared_ptr<ICancellationSignal>* return_val) override;
std::shared_ptr<common::ICancellationSignal>* return_val) override;
ndk::ScopedAStatus detectInteraction(int32_t cookie,
std::shared_ptr<ICancellationSignal>* return_val) override;
std::shared_ptr<common::ICancellationSignal>* return_val) override;
ndk::ScopedAStatus enumerateEnrollments(int32_t cookie) override;

View File

@@ -114,7 +114,7 @@ TEST_P(Fingerprint, AuthenticateTest) {
std::shared_ptr<ISession> session;
ASSERT_TRUE(hal_->createSession(kSensorId, kUserId, session_cb, &session).isOk());
std::shared_ptr<ICancellationSignal> cancel_cb;
std::shared_ptr<common::ICancellationSignal> cancel_cb;
ASSERT_TRUE(session->authenticate(0, 0, &cancel_cb).isOk());
ASSERT_EQ(invocation_future.wait_for(kCallbackTimeout), std::future_status::ready);