From 7e03c5c6cd02efebfa48c3cb7452b684974e6260 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 | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index b1f27c4c19..d37abd77bc 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -6606,12 +6606,34 @@ namespace WPEFramework { if (compositorName == previousFocusedClient) { 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) { - uint32_t status = focusedCallsign->Focused(false); - std::cout << "result of set focus to false: " << status << std::endl; - focusedCallsign->Release(); + PluginHost::MetaData::Service service = joResult[0]; + if (service.JSONState == PluginHost::MetaData::Service::state::HIBERNATED) + { + isHibernated = true; + } + } + + if (isHibernated == false) + { + 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(); + } + } + else + { + std::cout << "setting the focus for " << compositorName << " to false skipped, plugin hibernated " << std::endl; } break; }