From 3e9d442fa1e713d78174a4df72c0ada213dc1a77 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 Change-Id: Iaf5d8e35f556c72350cdb9b6665adb31fca26871 --- .../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 6a6b12f485..f5cc7b2d77 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 @@ -102,6 +102,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 {};