From 19297bef6c0f9f581477e0b69f641743a042d6f5 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 Suspended or Hibernated plugins --- RDKShell/RDKShell.cpp | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index 6bb572483f..35097607f8 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -6591,13 +6591,40 @@ 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) +#ifdef HIBERNATE_SUPPORT_ENABLED + //Check plugin state. Skip for suspended and hibernated state, since not needed + 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 skipFocus = false; + if (ret == Core::ERROR_NONE && joResult.Length() > 0) + { + PluginHost::MetaData::Service service = joResult[0]; + if (service.JSONState == PluginHost::MetaData::Service::state::SUSPENDED + || service.JSONState == PluginHost::MetaData::Service::state::HIBERNATED) + { + skipFocus = true; + } + } + + if (skipFocus == 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; } }