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

Commit 8995c298 authored by David Zhao's avatar David Zhao Committed by Android (Google) Code Review
Browse files

Merge "Update TVInput impl and vts to create and validate queue" into main

parents 9d64b4f3 0dc2bc65
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ void TvInput::init() {
                                      new TvStreamConfigWrapper(11, 360, 480, false))}};
    mStreamConfigs[3] = {{5, shared_ptr<TvStreamConfigWrapper>(
                                     new TvStreamConfigWrapper(5, 1080, 1920, false))}};

    mQueue = shared_ptr<AidlMessageQueue<int8_t, SynchronizedReadWrite>>(
            new (std::nothrow) AidlMessageQueue<int8_t, SynchronizedReadWrite>(8));
}

::ndk::ScopedAStatus TvInput::setCallback(const shared_ptr<ITvInputCallback>& in_callback) {
@@ -74,7 +77,9 @@ void TvInput::init() {
        return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
    }

    // When calling notifyTvMessage, make sure to verify against this map.
    mTvMessageEventEnabled[deviceId][streamId][in_type] = enabled;

    return ::ndk::ScopedAStatus::ok();
}

@@ -82,11 +87,17 @@ void TvInput::init() {
        MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
        int32_t in_streamId) {
    ALOGV("%s", __FUNCTION__);
    ::ndk::ScopedAStatus status = ::ndk::ScopedAStatus::ok();
    if (mStreamConfigs.count(in_deviceId) == 0) {
        ALOGW("Device with id %d isn't available", in_deviceId);
        return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
    }
    return ::ndk::ScopedAStatus::ok();
        status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
    } else if (!mQueue->isValid()) {
        ALOGE("Tv Message Queue was not properly initialized");
        status = ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
    } else {
        *out_queue = mQueue->dupeDesc();
    }
    return status;
}

::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId,
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ class TvInput : public BnTvInput {
    map<int32_t, shared_ptr<TvInputDeviceInfoWrapper>> mDeviceInfos;
    map<int32_t, map<int32_t, shared_ptr<TvStreamConfigWrapper>>> mStreamConfigs;
    TvMessageEnabledMap mTvMessageEventEnabled;
    shared_ptr<AidlMessageQueue<int8_t, SynchronizedReadWrite>> mQueue;
};

}  // namespace input
+6 −2
Original line number Diff line number Diff line
@@ -355,8 +355,12 @@ TEST_P(TvInputAidlTest, GetTvMessageQueueTest) {
    }
    int32_t stream_id = streamConfigs[0].streamId;
    ALOGD("GetTvMessageQueueTest: device_id=%d, stream_id=%d", device_id, stream_id);
    MQDescriptor<int8_t, SynchronizedReadWrite> queue;
    tv_input_->getTvMessageQueueDesc(&queue, device_id, stream_id);
    MQDescriptor<int8_t, SynchronizedReadWrite> queueDescriptor;
    AidlMessageQueue<int8_t, SynchronizedReadWrite>* queue;
    tv_input_->getTvMessageQueueDesc(&queueDescriptor, device_id, stream_id);
    queue = new (std::nothrow) AidlMessageQueue<int8_t, SynchronizedReadWrite>(queueDescriptor);
    ASSERT_TRUE(queue->isValid());
    delete queue;
}

INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest,