From 7a16e48e48999ce964c5df7534de32de35ad4e02 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Wed, 13 Sep 2023 13:12:53 +0900 Subject: [PATCH] Add thermal HAL APEX This is used by Cuttlefish as of now. Bug: 300011386 Test: VtsHalThermalTargetTest Change-Id: I814d007df40d77e7fd723fd67687ef663dbb050c --- thermal/aidl/default/Android.bp | 42 +++++++++++++++++++------ thermal/aidl/default/apex_file_contexts | 3 ++ thermal/aidl/default/apex_manifest.json | 4 +++ thermal/aidl/default/thermal-example.rc | 2 +- 4 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 thermal/aidl/default/apex_file_contexts create mode 100644 thermal/aidl/default/apex_manifest.json diff --git a/thermal/aidl/default/Android.bp b/thermal/aidl/default/Android.bp index 49a578b45e..451e1e2c88 100644 --- a/thermal/aidl/default/Android.bp +++ b/thermal/aidl/default/Android.bp @@ -24,26 +24,50 @@ package { cc_binary { name: "android.hardware.thermal-service.example", relative_install_path: "hw", - init_rc: [":android.hardware.thermal.example.rc"], - vintf_fragments: [":android.hardware.thermal.example.xml"], vendor: true, - shared_libs: [ - "libbase", - "libbinder_ndk", + stl: "c++_static", + static_libs: [ "android.hardware.thermal-V1-ndk", + "libbase", + ], + shared_libs: [ + "libbinder_ndk", + "liblog", ], srcs: [ "main.cpp", "Thermal.cpp", ], + installable: false, } -filegroup { +prebuilt_etc { name: "android.hardware.thermal.example.xml", - srcs: ["thermal-example.xml"], + src: "thermal-example.xml", + sub_dir: "vintf", + installable: false, } -filegroup { +prebuilt_etc { name: "android.hardware.thermal.example.rc", - srcs: ["thermal-example.rc"], + src: "thermal-example.rc", + installable: false, +} + +apex { + name: "com.android.hardware.thermal", + manifest: "apex_manifest.json", + file_contexts: "apex_file_contexts", + key: "com.android.hardware.key", + certificate: ":com.android.hardware.certificate", + updatable: false, + vendor: true, + + binaries: [ + "android.hardware.thermal-service.example", + ], + prebuilts: [ + "android.hardware.thermal.example.xml", + "android.hardware.thermal.example.rc", + ], } diff --git a/thermal/aidl/default/apex_file_contexts b/thermal/aidl/default/apex_file_contexts new file mode 100644 index 0000000000..9fa5339d6b --- /dev/null +++ b/thermal/aidl/default/apex_file_contexts @@ -0,0 +1,3 @@ +(/.*)? u:object_r:vendor_file:s0 +/etc(/.*)? u:object_r:vendor_configs_file:s0 +/bin/hw/android\.hardware\.thermal-service\.example u:object_r:hal_thermal_default_exec:s0 diff --git a/thermal/aidl/default/apex_manifest.json b/thermal/aidl/default/apex_manifest.json new file mode 100644 index 0000000000..80420d5c43 --- /dev/null +++ b/thermal/aidl/default/apex_manifest.json @@ -0,0 +1,4 @@ +{ + "name": "com.android.hardware.thermal", + "version": 1 +} diff --git a/thermal/aidl/default/thermal-example.rc b/thermal/aidl/default/thermal-example.rc index 591ca036bd..36dde0d389 100644 --- a/thermal/aidl/default/thermal-example.rc +++ b/thermal/aidl/default/thermal-example.rc @@ -1,4 +1,4 @@ -service vendor.thermal-example /vendor/bin/hw/android.hardware.thermal-service.example +service vendor.thermal-example /apex/com.android.hardware.thermal/bin/hw/android.hardware.thermal-service.example class hal user nobody group system