From f18c37e8813a5e9ee26af387ee0180909a8d5ee6 Mon Sep 17 00:00:00 2001 From: Adrian Muzyka Date: Fri, 3 Nov 2023 10:08:44 +0100 Subject: [PATCH] RDKShell: Skip SetFocus to false for Hibernated plugins --- RDKShell/RDKShell.cpp | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index b1f27c4c19..e70ca9594b 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -6605,14 +6605,40 @@ namespace WPEFramework { std::string compositorName = toLower(previousFocusedIterator->first); if (compositorName == previousFocusedClient) { +#ifdef HIBERNATE_SUPPORT_ENABLED std::cout << "setting the focus of " << compositorName << " to false " << std::endl; - Exchange::IFocus *focusedCallsign = mCurrentService->QueryInterfaceByCallsign(previousFocusedIterator->first); - if (focusedCallsign != NULL) + //Check plugin state, skip for hibernated state + string method = "status@" + previousFocusedIterator->first; + Core::JSON::ArrayType joResult; + auto thunderController = getThunderControllerClient(); + uint32_t ret = thunderController->Get>(RDKSHELL_THUNDER_TIMEOUT, method.c_str(), joResult); + bool isHibernated = false; + if (ret == Core::ERROR_NONE && joResult.Length() > 0) + { + PluginHost::MetaData::Service service = joResult[0]; + if (service.JSONState == PluginHost::MetaData::Service::state::HIBERNATED) + { + isHibernated = true; + } + } + + if (isHibernated == false) + { +#endif + Exchange::IFocus *focusedCallsign = mCurrentService->QueryInterfaceByCallsign(previousFocusedIterator->first); + if (focusedCallsign != NULL) + { + uint32_t status = focusedCallsign->Focused(false); + std::cout << "result of set focus to false: " << status << std::endl; + focusedCallsign->Release(); + } +#ifdef HIBERNATE_SUPPORT_ENABLED + } + else { - uint32_t status = focusedCallsign->Focused(false); - std::cout << "result of set focus to false: " << status << std::endl; - focusedCallsign->Release(); + std::cout << "setting the focus for " << compositorName << " to false skipped, plugin hibernated " << std::endl; } +#endif break; } }