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

Commit 12a107af authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6618402 from 39963aef to mainline-release

Change-Id: I570c7b47d74fab12bd3eee14339321d451805abf
parents 616a3ca6 39963aef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2262,6 +2262,7 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {

    // Allocate buffers to use
    hidl_vec<BufferDesc> buffers;
    buffers.resize(kBuffersToHold);
    for (auto i = 0; i < kBuffersToHold; ++i) {
        unsigned pixelsPerLine;
        buffer_handle_t memHandle = nullptr;
+32 −24
Original line number Diff line number Diff line
@@ -71,32 +71,42 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetP
}

android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetProperty(
        int32_t prop) {
    ALOGV("onGetProperty(%d)", prop);
    switch (prop) {
        const VehiclePropValue& value) {
    ALOGV("onGetProperty(%s)", toString(value).c_str());
    switch (value.prop) {
        case INITIAL_USER_INFO:
        case SWITCH_USER:
        case CREATE_USER:
        case REMOVE_USER:
            ALOGE("onGetProperty(): %d is only supported on SET", prop);
            ALOGE("onGetProperty(): %d is only supported on SET", value.prop);
            return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
                   << "only supported on SET";
        case USER_IDENTIFICATION_ASSOCIATION:
            return onGetUserIdentificationAssociation(value);
        default:
            ALOGE("onGetProperty(): %d is not supported", value.prop);
            return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
                   << "not supported by User HAL";
    }
}

android::base::Result<std::unique_ptr<VehiclePropValue>>
EmulatedUserHal::onGetUserIdentificationAssociation(const VehiclePropValue& value) {
    if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) {
                ALOGI("onGetProperty(%d): returning %s", prop,
        ALOGI("get(USER_IDENTIFICATION_ASSOCIATION): returning %s",
              toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str());
                auto value = std::unique_ptr<VehiclePropValue>(
        auto newValue = std::unique_ptr<VehiclePropValue>(
                new VehiclePropValue(*mSetUserIdentificationAssociationResponseFromCmd));
                return value;
        // Must use the same requestId
        if (value.value.int32Values.size() > 0) {
            newValue->value.int32Values[0] = value.value.int32Values[0];
        } else {
            ALOGE("get(USER_IDENTIFICATION_ASSOCIATION): no requestId on %s",
                  toString(value).c_str());
        }
            ALOGE("onGetProperty(%d): USER_IDENTIFICATION_ASSOCIATION not set by lshal", prop);
            return android::base::Error(static_cast<int>(StatusCode::NOT_AVAILABLE))
                   << "not set by lshal";
        default:
            ALOGE("onGetProperty(): %d is not supported", prop);
            return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
                   << "not supported by User HAL";
        return newValue;
    }
    return defaultUserIdentificationAssociation(value);
}

android::base::Result<std::unique_ptr<VehiclePropValue>>
@@ -250,16 +260,14 @@ EmulatedUserHal::onSetUserIdentificationAssociation(const VehiclePropValue& valu
    }

    // Returns default response
    auto updatedValue = std::unique_ptr<VehiclePropValue>(new VehiclePropValue);
    updatedValue->prop = USER_IDENTIFICATION_ASSOCIATION;
    updatedValue->timestamp = elapsedRealtimeNano();
    updatedValue->value.int32Values.resize(1);
    updatedValue->value.int32Values[0] = requestId;
    updatedValue->value.stringValue = "Response not set by LSHAL";

    ALOGI("no lshal response; replying with an error message: %s", toString(*updatedValue).c_str());
    return defaultUserIdentificationAssociation(value);
}

    return updatedValue;
android::base::Result<std::unique_ptr<VehiclePropValue>>
EmulatedUserHal::defaultUserIdentificationAssociation(const VehiclePropValue& request) {
    // TODO(b/159498909): return a response with NOT_ASSOCIATED_ANY_USER for all requested types
    ALOGE("no lshal response for %s; replying with NOT_AVAILABLE", toString(request).c_str());
    return android::base::Error(static_cast<int>(StatusCode::NOT_AVAILABLE)) << "not set by lshal";
}

android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::sendUserHalResponse(
+16 −2
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ class EmulatedUserHal {
     *
     * @return property value and StatusCode
     */
    android::base::Result<std::unique_ptr<VehiclePropValue>> onGetProperty(int32_t prop);
    android::base::Result<std::unique_ptr<VehiclePropValue>> onGetProperty(
            const VehiclePropValue& value);

    /**
     * Shows the User HAL emulation help.
@@ -111,12 +112,25 @@ class EmulatedUserHal {
            const VehiclePropValue& value);

    /**
     * Used to emulate USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for
     * Used to emulate set USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for
     * usage.
     */
    android::base::Result<std::unique_ptr<VehiclePropValue>> onSetUserIdentificationAssociation(
            const VehiclePropValue& value);

    /**
     * Used to emulate get USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for
     * usage.
     */
    android::base::Result<std::unique_ptr<VehiclePropValue>> onGetUserIdentificationAssociation(
            const VehiclePropValue& value);

    /**
     * Creates a default USER_IDENTIFICATION_ASSOCIATION when it was not set by lshal.
     */
    android::base::Result<std::unique_ptr<VehiclePropValue>> defaultUserIdentificationAssociation(
            const VehiclePropValue& request);

    android::base::Result<std::unique_ptr<VehiclePropValue>> sendUserHalResponse(
            std::unique_ptr<VehiclePropValue> response, int32_t requestId);

+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get(
        default:
            if (mEmulatedUserHal != nullptr && mEmulatedUserHal->isSupported(propId)) {
                ALOGI("get(): getting value for prop %d from User HAL", propId);
                const auto& ret = mEmulatedUserHal->onGetProperty(propId);
                const auto& ret = mEmulatedUserHal->onGetProperty(requestedPropValue);
                if (!ret.ok()) {
                    ALOGE("get(): User HAL returned error: %s", ret.error().message().c_str());
                    *outStatus = StatusCode(ret.error().code());
+1 −0
Original line number Diff line number Diff line
@@ -74,5 +74,6 @@ cc_defaults {
    // TODO(b/64437680): Assume these libs are always available on the device.
    shared_libs: [
        "libstagefright_foundation",
        "libstagefright_omx_utils",
    ],
}
Loading