health: properly support charger mode.
Use charger_vendor SELinux context.
Also update readme to reflect the change.
Test: manual in offline-charging mode
Bug: 177269435
Change-Id: Icf5cd9d579b3365037e2d360fcc29b0ef4be1b15
diff --git a/health/aidl/README.md b/health/aidl/README.md
index 53a4f91..b32a773 100644
--- a/health/aidl/README.md
+++ b/health/aidl/README.md
@@ -63,8 +63,7 @@
* You may ignore the `service` line. The name of the service does not matter.
* If your service belongs to additional classes beside `charger`, you need a
custom health AIDL service.
-* You may ignore the `seclabel` line. When the health AIDL service runs in
- charger mode, its original SELinux domain is kept.
+* Modify the `seclabel` line. Replace `charger` with `charger_vendor`.
* If your service has a different `user` (not `system`), you need a custom
health AIDL service.
* If your service belongs to additional `group`s beside
@@ -211,6 +210,8 @@
```text
service vendor.charger-tuna /vendor/bin/hw/android.hardware.health-service-tuna --charger
+ class charger
+ seclabel u:r:charger_vendor:s0
# ...
```
@@ -286,8 +287,7 @@
`hal_health_tuna`:
```text
-type hal_health_tuna, charger_type, domain;
-hal_server_domain(hal_health_default, hal_health)
+domain_trans(init, hal_health_tuna_exec, charger_vendor)
```
[comment: TODO(b/170338625): explain recovery]: #
diff --git a/health/aidl/default/android.hardware.health-service.example.rc b/health/aidl/default/android.hardware.health-service.example.rc
index dee3d11..4258890 100644
--- a/health/aidl/default/android.hardware.health-service.example.rc
+++ b/health/aidl/default/android.hardware.health-service.example.rc
@@ -7,6 +7,7 @@
service vendor.charger-default /vendor/bin/hw/android.hardware.health-service.example --charger
class charger
+ seclabel u:r:charger_vendor:s0
user system
group system wakelock input
capabilities SYS_BOOT