From eb955ce44223f7db57d162ef534ca70d12b3abef Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 16 May 2023 17:51:15 -0700 Subject: [PATCH] Add default implementation for setTvMessageEnabled Bug: 283016116 Test: mmm Change-Id: I1872cf28ad658c177a892f7c7587a91a34f445ff --- tv/input/aidl/default/TvInput.cpp | 8 +++++++- tv/input/aidl/default/TvInput.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp index c986ef1552..5f1f7a24dd 100644 --- a/tv/input/aidl/default/TvInput.cpp +++ b/tv/input/aidl/default/TvInput.cpp @@ -68,7 +68,13 @@ void TvInput::init() { ::ndk::ScopedAStatus TvInput::setTvMessageEnabled(int32_t deviceId, int32_t streamId, TvMessageEventType in_type, bool enabled) { ALOGV("%s", __FUNCTION__); - // TODO: Implement this + + if (mStreamConfigs.count(deviceId) == 0) { + ALOGW("Device with id %d isn't available", deviceId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + } + + mTvMessageEventEnabled[deviceId][streamId][in_type] = enabled; return ::ndk::ScopedAStatus::ok(); } diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h index 92e7d4ca69..23118c8c15 100644 --- a/tv/input/aidl/default/TvInput.h +++ b/tv/input/aidl/default/TvInput.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "TvInputDeviceInfoWrapper.h" #include "TvStreamConfigWrapper.h" @@ -38,6 +39,9 @@ namespace hardware { namespace tv { namespace input { +using TvMessageEnabledMap = std::unordered_map< + int32_t, std::unordered_map>>; + class TvInput : public BnTvInput { public: TvInput(); @@ -62,6 +66,7 @@ class TvInput : public BnTvInput { shared_ptr mCallback; map> mDeviceInfos; map>> mStreamConfigs; + TvMessageEnabledMap mTvMessageEventEnabled; }; } // namespace input