diff options
author | Steve Paik <spaik@google.com> | 2018-10-18 17:57:12 -0700 |
---|---|---|
committer | Steve Paik <spaik@google.com> | 2018-10-22 16:29:27 +0000 |
commit | d217630d4097d9a0496c4d7f8aab5a0c932e0f70 (patch) | |
tree | a57662a4bc5875022c65f01a927f17acf5e566c8 /automotive/vehicle | |
parent | 85d87d6b43015f238fd75bb8efa834f021f118e5 (diff) | |
download | android_hardware_interfaces-d217630d4097d9a0496c4d7f8aab5a0c932e0f70.tar.gz android_hardware_interfaces-d217630d4097d9a0496c4d7f8aab5a0c932e0f70.tar.bz2 android_hardware_interfaces-d217630d4097d9a0496c4d7f8aab5a0c932e0f70.zip |
Fix Default VHAL to send ON request when device boots
Bug: 117947229
Test: Reboot Mojave, it stays on
Change-Id: Ia36d71343e43d59c07dc76b3cc7b7d45376d898c
(cherry picked from commit b91f9c3bad3948cb5804949a858835219e9aeac3)
Diffstat (limited to 'automotive/vehicle')
-rw-r--r-- | automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp | 35 | ||||
-rw-r--r-- | automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp index 4f773480e..ba81a521a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp @@ -156,6 +156,29 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { // Placeholder for future implementation of VMS property in the default hal. For // now, just returns OK; otherwise, hal clients crash with property not supported. return StatusCode::OK; + case AP_POWER_STATE_REPORT: + switch (propValue.value.int32Values[0]) { + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): + case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): + case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): + // CPMS is in WAIT_FOR_VHAL state, simply move to ON + doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::ON, 0)); + break; + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): + case toInt(VehicleApPowerStateReport::SHUTDOWN_START): + // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command + doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0)); + break; + case toInt(VehicleApPowerStateReport::ON): + case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE): + case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE): + // Do nothing + break; + default: + // Unknown state + break; + } + break; } } @@ -401,6 +424,18 @@ StatusCode EmulatedVehicleHal::handleGenerateFakeDataRequest(const VehiclePropVa return StatusCode::OK; } +VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createApPowerStateReq( + VehicleApPowerStateReq state, int32_t param) { + auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2); + req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); + req->areaId = 0; + req->timestamp = elapsedRealtimeNano(); + req->status = VehiclePropertyStatus::AVAILABLE; + req->value.int32Values[0] = toInt(state); + req->value.int32Values[1] = param; + return req; +} + VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createHwInputKeyProp( VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) { auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3); diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h index ec59690ff..78895e3db 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h @@ -67,6 +67,7 @@ private: StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); void onFakeValueGenerated(const VehiclePropValue& value); + VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param); VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); |