aidl: fingerprint: Initial stub service

Change-Id: I1e0594b88d5230f8c99a6efb0a7dafcbf6ea137a
urubino
Tim Zimmermann 10 months ago
parent 4ac17a878f
commit 37b235d802
No known key found for this signature in database
GPG Key ID: 6DC21A63F819C5EF
  1. 26
      aidl/fingerprint/Android.bp
  2. 29
      aidl/fingerprint/Fingerprint.cpp
  3. 33
      aidl/fingerprint/Fingerprint.h
  4. 115
      aidl/fingerprint/Session.cpp
  5. 62
      aidl/fingerprint/Session.h
  6. 5
      aidl/fingerprint/android.hardware.biometrics.fingerprint-service.samsung.rc
  7. 6
      aidl/fingerprint/android.hardware.biometrics.fingerprint-service.samsung.xml
  8. 25
      aidl/fingerprint/service.cpp

@ -0,0 +1,26 @@
//
// Copyright (C) 2024 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "android.hardware.biometrics.fingerprint-service.samsung",
relative_install_path: "hw",
init_rc: ["android.hardware.biometrics.fingerprint-service.samsung.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint-service.samsung.xml"],
srcs: [
"Fingerprint.cpp",
"Session.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"android.hardware.biometrics.fingerprint-V3-ndk",
"android.hardware.biometrics.common-V3-ndk",
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.util",
],
vendor: true,
}

@ -0,0 +1,29 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "Fingerprint.h"
namespace aidl {
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t /*userId*/,
const std::shared_ptr<ISessionCallback>& /*cb*/,
std::shared_ptr<ISession>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

@ -0,0 +1,33 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h>
using ::aidl::android::hardware::biometrics::fingerprint::ISession;
using ::aidl::android::hardware::biometrics::fingerprint::ISessionCallback;
using ::aidl::android::hardware::biometrics::fingerprint::SensorProps;
namespace aidl {
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
class Fingerprint : public BnFingerprint {
public:
ndk::ScopedAStatus getSensorProps(std::vector<SensorProps>* _aidl_return) override;
ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
const std::shared_ptr<ISessionCallback>& cb,
std::shared_ptr<ISession>* out) override;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

@ -0,0 +1,115 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "Session.h"
namespace aidl {
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
ndk::ScopedAStatus Session::generateChallenge() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::revokeChallenge(int64_t /*challenge*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::enroll(const HardwareAuthToken& /*hat*/,
std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::authenticate(int64_t /*operationId*/,
std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::detectInteraction(std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::enumerateEnrollments() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& /*enrollmentIds*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::getAuthenticatorId() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::invalidateAuthenticatorId() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::resetLockout(const HardwareAuthToken& /*hat*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::close() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/, float /*minor*/,
float /*major*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onPointerUp(int32_t /*pointerId*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onUiReady() {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::authenticateWithContext(
int64_t /*operationId*/, const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::enrollWithContext(const HardwareAuthToken& /*hat*/,
const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::detectInteractionWithContext(const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* /*out*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onPointerDownWithContext(const PointerContext& /*context*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& /*context*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onContextChanged(const OperationContext& /*context*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::onPointerCancelWithContext(const PointerContext& /*context*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus Session::setIgnoreDisplayTouches(bool /*shouldIgnore*/) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

@ -0,0 +1,62 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/android/hardware/biometrics/fingerprint/BnSession.h>
using ::aidl::android::hardware::biometrics::common::ICancellationSignal;
using ::aidl::android::hardware::biometrics::common::OperationContext;
using ::aidl::android::hardware::biometrics::fingerprint::PointerContext;
using ::aidl::android::hardware::keymaster::HardwareAuthToken;
namespace aidl {
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
class Session : public BnSession {
public:
ndk::ScopedAStatus generateChallenge() override;
ndk::ScopedAStatus revokeChallenge(int64_t challenge) override;
ndk::ScopedAStatus enroll(const HardwareAuthToken& hat,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus authenticate(int64_t operationId,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteraction(
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus enumerateEnrollments() override;
ndk::ScopedAStatus removeEnrollments(const std::vector<int32_t>& enrollmentIds) override;
ndk::ScopedAStatus getAuthenticatorId() override;
ndk::ScopedAStatus invalidateAuthenticatorId() override;
ndk::ScopedAStatus resetLockout(const HardwareAuthToken& hat) override;
ndk::ScopedAStatus close() override;
ndk::ScopedAStatus onPointerDown(int32_t pointerId, int32_t x, int32_t y, float minor,
float major) override;
ndk::ScopedAStatus onPointerUp(int32_t pointerId) override;
ndk::ScopedAStatus onUiReady() override;
ndk::ScopedAStatus authenticateWithContext(
int64_t operationId, const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus enrollWithContext(
const HardwareAuthToken& hat, const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteractionWithContext(
const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override;
ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override;
ndk::ScopedAStatus onContextChanged(const OperationContext& context) override;
ndk::ScopedAStatus onPointerCancelWithContext(const PointerContext& context) override;
ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

@ -0,0 +1,5 @@
service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.samsung
class hal
user system
group system input uhid
shutdown critical

@ -0,0 +1,6 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<fqname>IFingerprint/default</fqname>
</hal>
</manifest>

@ -0,0 +1,25 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "Fingerprint.h"
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android-base/logging.h>
using ::aidl::android::hardware::biometrics::fingerprint::Fingerprint;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Fingerprint> fingerprint = ndk::SharedRefBase::make<Fingerprint>();
const std::string instance = std::string() + Fingerprint::descriptor + "/default";
binder_status_t status = AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}
Loading…
Cancel
Save