Introduce vendor.oplus.hardware.urcc-service

Change-Id: I7fe1a4e9b590d077f43bbaac03e483724d3198e0
This commit is contained in:
LuK1337
2025-09-13 16:54:17 +02:00
committed by madmax7896
parent dff1a1af0c
commit 690071580e
7 changed files with 221 additions and 0 deletions

21
aidl/urcc/Android.bp Normal file
View File

@@ -0,0 +1,21 @@
//
// SPDX-FileCopyrightText: 2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "vendor.oplus.hardware.urcc-service",
vendor: true,
relative_install_path: "hw",
init_rc: ["vendor.oplus.hardware.urcc-service.rc"],
vintf_fragments: ["vendor.oplus.hardware.urcc-service.xml"],
srcs: [
"Urcc.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"vendor.oplus.hardware.urcc-V1-ndk",
],
}

115
aidl/urcc/Urcc.cpp Normal file
View File

@@ -0,0 +1,115 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include "Urcc.h"
#include <android-base/logging.h>
#define LOG_TAG "vendor.oplus.hardware.urcc-service"
namespace aidl {
namespace vendor {
namespace oplus {
namespace hardware {
namespace urcc {
ndk::ScopedAStatus Urcc::urccInit() {
LOG(INFO) << __func__;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccResCtlRequest(const UrccRequestParcel& mUrccRequestParcel,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccResCtlRelease(int32_t mhandle, int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccResStateRequest(const UrccRequestParcel& mUrccRequestParcel,
std::vector<UrccRequestData>* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = {};
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccResListeningRegister(
const UrccRequestParcel& mUrccRequestParcel,
const std::shared_ptr<IUrccCallback>& urccCallback, int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccResListeningUnRegister(int32_t mhandle, int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccPropertyGet(const std::string& name, std::string* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = "";
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccPropertySet(const std::string& name, const std::string& value,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccThermalListeningRegister(
const std::vector<int32_t>& types, const std::shared_ptr<IUrccCallback>& urccCallback,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccThermalListeningUnRegister(int32_t mhandle, int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::uahNotifyExt(int32_t src, int32_t type, const std::vector<int32_t>& args,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::setRelatedSysInfo(int32_t cmd, const std::vector<uint8_t>& info,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::urccRuleCtl(int32_t ruleId, int32_t status,
const std::vector<UrccRequestData>& ruleData,
int32_t* _aidl_return) {
LOG(INFO) << __func__;
*_aidl_return = 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Urcc::uahResCtlRequestBypass(const UrccRequestParcel& mRequestParcel) {
LOG(INFO) << __func__;
return ndk::ScopedAStatus::ok();
}
} // namespace urcc
} // namespace hardware
} // namespace oplus
} // namespace vendor
} // namespace aidl

49
aidl/urcc/Urcc.h Normal file
View File

@@ -0,0 +1,49 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/oplus/hardware/urcc/BnUrcc.h>
namespace aidl {
namespace vendor {
namespace oplus {
namespace hardware {
namespace urcc {
class Urcc : public BnUrcc {
ndk::ScopedAStatus urccInit() override;
ndk::ScopedAStatus urccResCtlRequest(const UrccRequestParcel& mUrccRequestParcel,
int32_t* _aidl_return) override;
ndk::ScopedAStatus urccResCtlRelease(int32_t mhandle, int32_t* _aidl_return) override;
ndk::ScopedAStatus urccResStateRequest(const UrccRequestParcel& mUrccRequestParcel,
std::vector<UrccRequestData>* _aidl_return) override;
ndk::ScopedAStatus urccResListeningRegister(const UrccRequestParcel& mUrccRequestParcel,
const std::shared_ptr<IUrccCallback>& urccCallback,
int32_t* _aidl_return) override;
ndk::ScopedAStatus urccResListeningUnRegister(int32_t mhandle, int32_t* _aidl_return) override;
ndk::ScopedAStatus urccPropertyGet(const std::string& name, std::string* _aidl_return) override;
ndk::ScopedAStatus urccPropertySet(const std::string& name, const std::string& value,
int32_t* _aidl_return) override;
ndk::ScopedAStatus urccThermalListeningRegister(
const std::vector<int32_t>& types, const std::shared_ptr<IUrccCallback>& urccCallback,
int32_t* _aidl_return) override;
ndk::ScopedAStatus urccThermalListeningUnRegister(int32_t mhandle,
int32_t* _aidl_return) override;
ndk::ScopedAStatus uahNotifyExt(int32_t src, int32_t type, const std::vector<int32_t>& args,
int32_t* _aidl_return) override;
ndk::ScopedAStatus setRelatedSysInfo(int32_t cmd, const std::vector<uint8_t>& info,
int32_t* _aidl_return) override;
ndk::ScopedAStatus urccRuleCtl(int32_t ruleId, int32_t status,
const std::vector<UrccRequestData>& ruleData,
int32_t* _aidl_return) override;
ndk::ScopedAStatus uahResCtlRequestBypass(const UrccRequestParcel& mRequestParcel) override;
};
} // namespace urcc
} // namespace hardware
} // namespace oplus
} // namespace vendor
} // namespace aidl

24
aidl/urcc/service.cpp Normal file
View File

@@ -0,0 +1,24 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include "Urcc.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using ::aidl::vendor::oplus::hardware::urcc::Urcc;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Urcc> urcc = ndk::SharedRefBase::make<Urcc>();
const std::string instance = std::string() + Urcc::descriptor + "/default";
binder_status_t status = AServiceManager_addService(urcc->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 oplus.urcc.hal.service /vendor/bin/hw/vendor.oplus.hardware.urcc-service
class hal
user system
group system

View File

@@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>vendor.oplus.hardware.urcc</name>
<version>1</version>
<fqname>IUrcc/default</fqname>
</hal>
</manifest>

View File

@@ -188,6 +188,7 @@
# URCC
/(odm|vendor/odm)/bin/hw/vendor\.oplus\.hardware\.urcc-service u:object_r:hal_oplus_urcc_aidl_exec:s0
/vendor/bin/hw/vendor\.oplus\.hardware\.urcc-service u:object_r:hal_oplus_urcc_aidl_exec:s0
# Vibrator
/dev/awinic_haptic u:object_r:aac_richtap_device:s0