Introduce vendor.oplus.hardware.osense.client-service

Change-Id: I5b9e1324a70966e1505e45fca54273ea22028be5
This commit is contained in:
LuK1337
2024-08-26 17:48:31 +02:00
parent 5c748014ea
commit 276b1e0c0b
7 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1 @@
../../../../build/soong/scripts/system-clang-format

View File

@@ -0,0 +1,22 @@
//
// Copyright (C) 2024 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "vendor.oplus.hardware.osense.client-service",
vendor: true,
relative_install_path: "hw",
init_rc: ["vendor.oplus.hardware.osense.client-service.rc"],
vintf_fragments: ["vendor.oplus.hardware.osense.client-service.xml"],
srcs: [
"OsenseAidlHalReporter.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"vendor.oplus.hardware.osense.client-V1-ndk",
],
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "OsenseAidlHalReporter.h"
namespace aidl {
namespace vendor {
namespace oplus {
namespace hardware {
namespace osense {
namespace client {
ndk::ScopedAStatus OsenseAidlHalReporter::checkAccessPermission(const std::string& identity,
int32_t* _aidl_return) {
*_aidl_return = 1;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus OsenseAidlHalReporter::osenseClrSceneAction(const std::string& identity,
int64_t request) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus OsenseAidlHalReporter::osenseSetNotification(
const std::string& identity, const OsenseAidlHalNotifyRequest& osenseHalNotifyRequest) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus OsenseAidlHalReporter::osenseSetSceneAction(
const std::string& identity, const OsenseAidlHalSaRequest& osenseHalSaRequest) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus OsenseAidlHalReporter::osenseResetCtrlData(const std::string& identity) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus OsenseAidlHalReporter::osenseSetCtrlData(const std::string& identity,
const OsenseControlInfo& ctrldata) {
return ndk::ScopedAStatus::ok();
}
} // namespace client
} // namespace osense
} // namespace hardware
} // namespace oplus
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/oplus/hardware/osense/client/BnOsenseAidlHalReporter.h>
namespace aidl {
namespace vendor {
namespace oplus {
namespace hardware {
namespace osense {
namespace client {
struct OsenseAidlHalReporter : public BnOsenseAidlHalReporter {
ndk::ScopedAStatus checkAccessPermission(const std::string& identity,
int32_t* _aidl_return) final;
ndk::ScopedAStatus osenseClrSceneAction(const std::string& identity, int64_t request) final;
ndk::ScopedAStatus osenseSetNotification(
const std::string& identity,
const OsenseAidlHalNotifyRequest& osenseHalNotifyRequest) final;
ndk::ScopedAStatus osenseSetSceneAction(const std::string& identity,
const OsenseAidlHalSaRequest& osenseHalSaRequest) final;
ndk::ScopedAStatus osenseResetCtrlData(const std::string& identity) final;
ndk::ScopedAStatus osenseSetCtrlData(const std::string& identity,
const OsenseControlInfo& ctrldata) final;
};
} // namespace client
} // namespace osense
} // namespace hardware
} // namespace oplus
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "OsenseAidlHalReporter.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using ::aidl::vendor::oplus::hardware::osense::client::OsenseAidlHalReporter;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<OsenseAidlHalReporter> reporter =
ndk::SharedRefBase::make<OsenseAidlHalReporter>();
const std::string instance = std::string() + OsenseAidlHalReporter::descriptor + "/default";
binder_status_t status =
AServiceManager_addService(reporter->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}

View File

@@ -0,0 +1,4 @@
service vendor.osense_client /vendor/bin/hw/vendor.oplus.hardware.osense.client-service
class hal
user system
group system

View File

@@ -0,0 +1,6 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>vendor.oplus.hardware.osense.client</name>
<fqname>IOsenseAidlHalReporter/default</fqname>
</hal>
</manifest>