From 7a3d7c96fcddf3d484f83d4bb6af3e042341643b Mon Sep 17 00:00:00 2001 From: felipeal Date: Fri, 5 Jun 2020 17:09:29 -0700 Subject: [PATCH] Fixed EmulatedUserHal so it doesn't reply to a LEGECY_ANDROID_LEGACY request. Bug: 158336360 Test: m -j android.hardware.automotive.vehicle@2.0-service && adb push $OUT/vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service /vendor/bin/hw/ && adb shell kill `pid android.hardware.automotive.vehicle` Change-Id: I0b506ba5a4b53ada94bc4afc081d3e4222f5e92d --- .../2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp | 14 ++++++++++++++ 1 file changed, 14 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 f712ea20b3..2c2f23c4c6 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 @@ -158,6 +158,20 @@ android::base::Result> EmulatedUserHal::onSetS return sendUserHalResponse(std::move(mSwitchUserResponseFromCmd), requestId); } + if (value.value.int32Values.size() > 1) { + auto messageType = static_cast(value.value.int32Values[1]); + switch (messageType) { + case SwitchUserMessageType::LEGACY_ANDROID_SWITCH: + ALOGI("request is LEGACY_ANDROID_SWITCH; ignoring it"); + return {}; + case SwitchUserMessageType::ANDROID_POST_SWITCH: + ALOGI("request is ANDROID_POST_SWITCH; ignoring it"); + return {}; + default: + break; + } + } + // Returns default response auto updatedValue = std::unique_ptr(new VehiclePropValue); updatedValue->prop = SWITCH_USER;