light: convert to apex

This commit is contained in:
Konsta
2025-03-15 00:01:58 +02:00
parent 543cb97137
commit e288798b65
7 changed files with 43 additions and 8 deletions

View File

@@ -217,7 +217,7 @@ PRODUCT_COPY_FILES += \
# Lights
PRODUCT_PACKAGES += \
android.hardware.light-service.rpi
com.android.hardware.light.rpi4
# Media
PRODUCT_COPY_FILES += \

View File

@@ -7,15 +7,43 @@ cc_binary {
name: "android.hardware.light-service.rpi",
relative_install_path: "hw",
vendor: true,
init_rc: ["android.hardware.light-service.rpi.rc"],
vintf_fragments: ["android.hardware.light-service.rpi.xml"],
srcs: [
"Lights.cpp",
"main.cpp",
],
shared_libs: [
"android.hardware.light-V2-ndk",
"libbase",
"libbinder_ndk",
"android.hardware.light-V2-ndk",
],
installable: false,
}
prebuilt_etc {
name: "android.hardware.light-service.rpi.rc",
src: "android.hardware.light-service.rpi.rc",
installable: false,
}
prebuilt_etc {
name: "android.hardware.light-service.rpi.xml",
src: "android.hardware.light-service.rpi.xml",
sub_dir: "vintf",
installable: false,
}
apex {
name: "com.android.hardware.light.rpi4",
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.light-service.rpi"],
prebuilts: [
"android.hardware.light-service.rpi.rc",
"android.hardware.light-service.rpi.xml",
],
}

View File

@@ -4,7 +4,7 @@ on early-boot
chmod 660 /sys/class/backlight/11-0045/brightness
chmod 440 /sys/class/backlight/11-0045/max_brightness
service vendor.light-default /vendor/bin/hw/android.hardware.light-service.rpi
service vendor.light-rpi /apex/com.android.hardware.light.rpi4/bin/hw/android.hardware.light-service.rpi
class hal
user system
group system

3
light/apex_file_contexts Normal file
View File

@@ -0,0 +1,3 @@
(/.*)? u:object_r:vendor_file:s0
/etc(/.*)? u:object_r:vendor_configs_file:s0
/bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0

4
light/apex_manifest.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "com.android.hardware.light.rpi4",
"version": 1
}

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2025 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,5 +32,5 @@ int main() {
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reached
return EXIT_FAILURE; // should not reach
}

View File

@@ -31,7 +31,6 @@
# Lights
/sys/class/backlight/11-0045/brightness u:object_r:sysfs_leds:s0
/sys/class/backlight/11-0045/max_brightness u:object_r:sysfs_leds:s0
/vendor/bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0
# Partitions
/dev/block/mmcblk0p1 u:object_r:boot_block_device:s0