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

Commit 7a3d7c96 authored by felipeal's avatar felipeal
Browse files

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
parent ac4ee962
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -158,6 +158,20 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetS
        return sendUserHalResponse(std::move(mSwitchUserResponseFromCmd), requestId);
    }

    if (value.value.int32Values.size() > 1) {
        auto messageType = static_cast<SwitchUserMessageType>(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<VehiclePropValue>(new VehiclePropValue);
    updatedValue->prop = SWITCH_USER;