lights: Add state to the example service
Add a Light struct to the example service so it can hold a HwLight and
its associated HwLightState. Also added a HashMap of ids -> Light to the
LightService and updated the HAL methods implementation to make the
service stateful.
Now instantiating a LightService requires that a list of HwLights is
provided, so a default implementation was provided as a convenience. The
android.hardware.light rust API version had to be bumped since we rely
on new derive statements added to the AIDL files.
Tested: built VtsHalLightTargetTest and ran in Cuttlefish
Bug: 286106270
Change-Id: Id2b17a6a2290295c7b0b5405ac9815eaa28303c6
diff --git a/light/aidl/default/main.rs b/light/aidl/default/main.rs
index ffe33fe..8f32470 100644
--- a/light/aidl/default/main.rs
+++ b/light/aidl/default/main.rs
@@ -35,7 +35,7 @@
binder::ProcessState::set_thread_pool_max_thread_count(0);
- let lights_service = LightsService;
+ let lights_service = LightsService::default();
let lights_service_binder = BnLights::new_binder(lights_service, BinderFeatures::default());
let service_name = format!("{}/default", LightsService::get_descriptor());