From 5d40b783d139050bdaa680c6de36be21fed5a439 Mon Sep 17 00:00:00 2001 From: felipeal Date: Fri, 17 Jul 2020 18:24:35 -0700 Subject: [PATCH] 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 3e9d442fa1e713d78174a4df72c0ada213dc1a77) --- .../2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp index ea38cb3941..d0011a831e 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp @@ -155,6 +155,15 @@ android::base::Result> EmulatedUserHal::onSetS } if (value.areaId != 0) { + if (value.value.int32Values.size() >= 2 && + static_cast(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(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 {};