Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d40b783 authored by felipeal's avatar felipeal Committed by Felipe Leme
Browse files

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 3e9d442f)
parent 82120a8c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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 {};