mirror of
				https://github.com/oplus-giulia-dev/android_hardware_oplus
				synced 2025-11-04 05:45:34 +08:00 
			
		
		
		
	Introduce vendor.oplus.hardware.osense.client-service
Change-Id: I5b9e1324a70966e1505e45fca54273ea22028be5
This commit is contained in:
		
							
								
								
									
										1
									
								
								aidl/osense-client/.clang-format
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								aidl/osense-client/.clang-format
									
									
									
									
									
										Symbolic link
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
../../../../build/soong/scripts/system-clang-format
 | 
			
		||||
							
								
								
									
										22
									
								
								aidl/osense-client/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								aidl/osense-client/Android.bp
									
									
									
									
									
										Normal 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",
 | 
			
		||||
    ],
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										51
									
								
								aidl/osense-client/OsenseAidlHalReporter.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								aidl/osense-client/OsenseAidlHalReporter.cpp
									
									
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										37
									
								
								aidl/osense-client/OsenseAidlHalReporter.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								aidl/osense-client/OsenseAidlHalReporter.h
									
									
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										27
									
								
								aidl/osense-client/service.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								aidl/osense-client/service.cpp
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,4 @@
 | 
			
		||||
service vendor.osense_client /vendor/bin/hw/vendor.oplus.hardware.osense.client-service
 | 
			
		||||
    class hal
 | 
			
		||||
    user system
 | 
			
		||||
    group system
 | 
			
		||||
@@ -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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user