Fixed EmulatedUserHal so it supports SwitchUserMessageType::VEHICLE_REQUEST

Test: adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default --set 299896584 a 1 i -42 i 4 i 11
Fixes: 161574356
Bug: 167588307

Change-Id: Iaf5d8e35f556c72350cdb9b6665adb31fca26871
Merged-In: Iaf5d8e35f556c72350cdb9b6665adb31fca26871
(cherry picked from commit 3e9d442fa1)
This commit is contained in:
felipeal 2020-07-17 18:24:35 -07:00 committed by Felipe Leme
parent 82120a8ce4
commit 5d40b783d1

View file

@ -155,6 +155,15 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetS
}
if (value.areaId != 0) {
if (value.value.int32Values.size() >= 2 &&
static_cast<SwitchUserMessageType>(value.value.int32Values[1]) ==
SwitchUserMessageType::VEHICLE_REQUEST) {
// User HAL can also request a user switch, so we need to check it first
ALOGD("set(SWITCH_USER) called from lshal to emulate a vehicle request: %s",
toString(value).c_str());
return std::unique_ptr<VehiclePropValue>(new VehiclePropValue(value));
}
// Otherwise, we store it
ALOGD("set(SWITCH_USER) called from lshal; storing it: %s", toString(value).c_str());
mSwitchUserResponseFromCmd.reset(new VehiclePropValue(value));
return {};