From ee15bc8b865ec6d7ad5c1aef08e4b27ccbc97cf9 Mon Sep 17 00:00:00 2001 From: Adrian Muzyka Date: Tue, 25 Jun 2024 12:03:20 +0200 Subject: [PATCH 1/7] Delay Hibernation for native apps * For L2S case delay by 15sec * For others, by 5 sec This will give some extra time for suspended app to seattle down --- RDKShell/RDKShell.cpp | 269 ++++++++++++++++++++++++++++++------- RDKShell/RDKShell.h | 35 +++++ docs/api/RDKShellPlugin.md | 7 +- 3 files changed, 255 insertions(+), 56 deletions(-) diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index 679ecbc2b9..d4c87c9784 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -25,9 +25,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -220,6 +218,8 @@ std::condition_variable gHibernateBlockedCondVariable; #ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED std::set gLaunchedToSuspended; std::mutex gLaunchedToSuspendedMutex; +#define HIBERNATION_DELAY_FOR_LAUNCHED_TO_SUSPENDED_MS 15000 +#define HIBERNATION_DELAY_FOR_RESUMED_TO_SUSPENDED_MS 5000 #endif #define ANY_KEY 65536 @@ -781,8 +781,13 @@ namespace WPEFramework { gLaunchedToSuspendedMutex.lock(); bool l2s = (gLaunchedToSuspended.find(mCallSign) != gLaunchedToSuspended.end()); gLaunchedToSuspendedMutex.unlock(); + uint32_t delay = HIBERNATION_DELAY_FOR_RESUMED_TO_SUSPENDED_MS; + if (l2s) + { + delay = HIBERNATION_DELAY_FOR_LAUNCHED_TO_SUSPENDED_MS; + } - if (!l2s && (mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos)) + if (mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos) { // call RDKShell.hibernate std::thread requestsThread = @@ -791,6 +796,7 @@ namespace WPEFramework { JsonObject hibernateParams; JsonObject hibernatetResponse; hibernateParams["callsign"] = mCallSign; + hibernateParams["delay"] = delay; mRDKShell.getThunderControllerClient("org.rdk.RDKShell.1")->Invoke(0, "hibernate", hibernateParams, hibernatetResponse); }); requestsThread.detach(); @@ -1501,6 +1507,185 @@ namespace WPEFramework { } } +#ifdef HIBERNATE_SUPPORT_ENABLED + RDKShell::HibernateExecutor::HibernateExecutor(RDKShell& shell): + mShell(shell), + mRunning(true) + { + mThread = std::thread(&RDKShell::HibernateExecutor::run, this); + } + + RDKShell::HibernateExecutor::~HibernateExecutor() + { + mRunning = false; + mCondition.notify_one(); + mThread.join(); + } + + void RDKShell::HibernateExecutor::schedule(std::string callsign, uint32_t timeout, uint32_t delayMs) + { + std::unique_lock lock(mMutex); + std::chrono::steady_clock::time_point executionTime = std::chrono::steady_clock::now() + + std::chrono::milliseconds(delayMs); + mCallsignsExecTimeMap[callsign] = RDKShell::HibernateExecutor::Params{executionTime, timeout}; + lock.unlock(); + mCondition.notify_one(); + } + + void RDKShell::HibernateExecutor::abort(std::string callsign) + { + std::unique_lock lock(mMutex); + // Remove pending hibernation + mCallsignsExecTimeMap.erase(callsign); + // If hibernation ongoing, abort it by call to activate + while (mCallsignsHibernating.find(callsign) != mCallsignsHibernating.end()) + { + lock.unlock(); + auto thunderController = RDKShell::getThunderControllerClient(); + JsonObject request, result, eventMsg; + request["callsign"] = callsign; + + uint32_t error = thunderController->Invoke(RDKSHELL_THUNDER_TIMEOUT, "activate", request, result); + lock.lock(); + if (error == Core::ERROR_NONE) + { + mCallsignsHibernating.erase(callsign); + } + } + } + + void RDKShell::HibernateExecutor::run() + { + while (mRunning) + { + std::unique_lock lock(mMutex); + std::chrono::milliseconds nextWakeUp(std::chrono::milliseconds::max()); + + // Get the item to execute or calculate the next sleep time + std::string callsign; + uint32_t timeoutMs = 0; + + for (auto it = mCallsignsExecTimeMap.begin(); it != mCallsignsExecTimeMap.end();) + { + // Check if the execution time has passed or not + const auto execDelay = std::chrono::duration_cast(it->second.timePoint - std::chrono::steady_clock::now()); + if (execDelay <= std::chrono::milliseconds(0)) + { + callsign = it->first; + timeoutMs = it->second.timeoutMs; + mCallsignsExecTimeMap.erase(it); + mCallsignsHibernating.insert(callsign); + // Break to execute + break; + } + else + { + // Calculate the next sleep time + nextWakeUp = std::min(nextWakeUp, execDelay); + it++; + } + } + + if (!callsign.empty()) + { + // Execute the pending hibernate outside lock and iterate again + lock.unlock(); + LOGINFO("Executing hibernate for callsign: %s", callsign.c_str()); + hibernateInternal(callsign, timeoutMs); + lock.lock(); + // Hibernate done, remove from progress list + mCallsignsHibernating.erase(callsign); + } + else + { + if (nextWakeUp != std::chrono::milliseconds::max()) + { + mCondition.wait_for(lock, nextWakeUp); + } + else + { + mCondition.wait(lock, [this] + { return !mCallsignsExecTimeMap.empty(); }); + } + } + } + } + void RDKShell::HibernateExecutor::hibernateInternal(std::string callsign, uint32_t timeoutMs) + { + if (!waitForHibernateUnblocked(RDKSHELL_THUNDER_TIMEOUT)) + { + std::cout << "Hibernation of " << callsign << " ignored!" << std::endl; + JsonObject eventMsg; + eventMsg["success"] = false; + eventMsg["message"] = "hibernation blocked"; + mShell.notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); + return; + } + + bool isApplicationBeingDestroyed = false; + gLaunchDestroyMutex.lock(); + if (gDestroyApplications.find(callsign) != gDestroyApplications.end()) + { + isApplicationBeingDestroyed = true; + } + if (gExternalDestroyApplications.find(callsign) != gExternalDestroyApplications.end()) + { + isApplicationBeingDestroyed = true; + } + gLaunchDestroyMutex.unlock(); + + if (isApplicationBeingDestroyed) + { + JsonObject eventMsg; + LOGINFO("Ignoring hibernate for %s as it is being destroyed", callsign.c_str()); + eventMsg["success"] = false; + eventMsg["message"] = "failed to hibernate application, is being destroyed"; + mShell.notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); + return; + } + + if (callsign.find("Netflix") != string::npos || callsign.find("Cobalt") != string::npos) + { + // Check if native app is suspended + bool suspendedOrHibernated = false; + gSuspendedOrHibernatedApplicationsMutex.lock(); + if (gSuspendedOrHibernatedApplications.find(callsign) != gSuspendedOrHibernatedApplications.end()) + { + suspendedOrHibernated = gSuspendedOrHibernatedApplications[callsign]; + } + gSuspendedOrHibernatedApplicationsMutex.unlock(); + if (!suspendedOrHibernated) + { + JsonObject eventMsg; + LOGINFO("Ignoring hibernate for %s as it is not suspended", callsign.c_str()); + eventMsg["success"] = false; + eventMsg["message"] = "failed to hibernate native application, not suspended"; + mShell.notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); + return; + } + } + + auto thunderController = RDKShell::getThunderControllerClient(); + JsonObject request, result, eventMsg; + request["callsign"] = callsign; + request["timeout"] = timeoutMs; + uint32_t errCode = thunderController->Invoke(RDKSHELL_THUNDER_TIMEOUT, "hibernate", request, result); + if (errCode > 0) + { + eventMsg["success"] = false; + eventMsg["message"] = result; + } + else + { + eventMsg["success"] = true; + gSuspendedOrHibernatedApplicationsMutex.lock(); + gSuspendedOrHibernatedApplications[callsign] = true; + gSuspendedOrHibernatedApplicationsMutex.unlock(); + } + mShell.notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); + } +#endif + RDKShell::RDKShell() : PluginHost::JSONRPC(), mEnableUserInactivityNotification(true), @@ -1511,6 +1696,9 @@ namespace WPEFramework { mEnableEasterEggs(true), mScreenCapture(this), mErmEnabled(false) +#ifdef HIBERNATE_SUPPORT_ENABLED + , mHibernateExecutor(*this) +#endif { LOGINFO("ctor"); RDKShell::_instance = this; @@ -4094,14 +4282,20 @@ namespace WPEFramework { } #ifdef HIBERNATE_SUPPORT_ENABLED //Reset app suspended/hibernated for launch + bool suspendedOrHibernated = false; gSuspendedOrHibernatedApplicationsMutex.lock(); auto suspendedOrHibernatedIt = gSuspendedOrHibernatedApplications.find(appCallsign); if (suspendedOrHibernatedIt != gSuspendedOrHibernatedApplications.end()) { gSuspendedOrHibernatedApplications.erase(suspendedOrHibernatedIt); + suspendedOrHibernated = true; } gSuspendedOrHibernatedApplicationsMutex.unlock(); -#endif + // Make sure app is not hibernating + if (suspendedOrHibernated) + { + mHibernateExecutor.abort(appCallsign); + } #ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED gLaunchedToSuspendedMutex.lock(); if (suspend) @@ -4113,6 +4307,7 @@ namespace WPEFramework { gLaunchedToSuspended.erase(appCallsign); } gLaunchedToSuspendedMutex.unlock(); +#endif #endif //check to see if plugin already exists @@ -6565,61 +6760,33 @@ namespace WPEFramework { if( callsign.find("Netflix") != string::npos || callsign.find("Cobalt") != string::npos ) { //Check if native app is suspended - WPEFramework::Core::JSON::String stateString; - const string callsignWithVersion = callsign + ".1"; - auto thunderPlugin = getThunderControllerClient(callsignWithVersion); - uint32_t stateStatus = 0; - stateStatus = thunderPlugin->Get(RDKSHELL_THUNDER_TIMEOUT, "state", stateString); - if(stateStatus || stateString != "suspended") + bool suspendedOrHibernated = false; + gSuspendedOrHibernatedApplicationsMutex.lock(); + if (gSuspendedOrHibernatedApplications.find(callsign) != gSuspendedOrHibernatedApplications.end()) { - std::cout << "ignoring hibenrate for " << callsign << " as it is not suspended " << std::endl; + suspendedOrHibernated = gSuspendedOrHibernatedApplications[callsign]; + } + gSuspendedOrHibernatedApplicationsMutex.unlock(); + if (!suspendedOrHibernated) + { + std::cout << "ignoring hibernate for " << callsign << " as it is not suspended " << std::endl; status = false; response["message"] = "failed to hibernate native application, not suspended"; returnResponse(status); } } - - std::thread requestsThread = - std::thread([=]() + uint32_t timeout = RDKSHELL_THUNDER_TIMEOUT; + uint32_t delay = 0; //execute instantly + if(parameters.HasLabel("timeout")) { - if (!waitForHibernateUnblocked(RDKSHELL_THUNDER_TIMEOUT)) - { - std::cout << "Hibernation of " << callsign << " ignored!" << std::endl; - JsonObject eventMsg; - eventMsg["success"] = false; - eventMsg["message"] = "hibernation blocked"; - notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); - return; - } + timeout = parameters["timeout"].Number(); + } + if(parameters.HasLabel("delay")) + { + delay = parameters["delay"].Number(); + } - auto thunderController = RDKShell::getThunderControllerClient(); - JsonObject request, result, eventMsg; - request["callsign"] = callsign; - request["timeout"] = RDKSHELL_THUNDER_TIMEOUT; - if(parameters.HasLabel("timeout")) - { - request["timeout"] = parameters["timeout"]; - } - if(parameters.HasLabel("procsequence")) - { - request["procsequence"] = parameters["procsequence"]; - } - uint32_t errCode = thunderController->Invoke(RDKSHELL_THUNDER_TIMEOUT, "hibernate", request, result); - if(errCode > 0) - { - eventMsg["success"] = false; - eventMsg["message"] = result; - } - else - { - eventMsg["success"] = true; - gSuspendedOrHibernatedApplicationsMutex.lock(); - gSuspendedOrHibernatedApplications[callsign] = true; - gSuspendedOrHibernatedApplicationsMutex.unlock(); - } - notify(RDKShell::RDKSHELL_EVENT_ON_HIBERNATED, eventMsg); - }); - requestsThread.detach(); + mHibernateExecutor.schedule(callsign, timeout, delay); status = true; } diff --git a/RDKShell/RDKShell.h b/RDKShell/RDKShell.h index 0a6c0c9513..05ba9b59e5 100755 --- a/RDKShell/RDKShell.h +++ b/RDKShell/RDKShell.h @@ -20,6 +20,8 @@ #pragma once #include +#include +#include #include "Module.h" #include #include @@ -469,6 +471,36 @@ namespace WPEFramework { RDKShell* mShell; std::vectormCaptureStorers; }; +#ifdef HIBERNATE_SUPPORT_ENABLED + class HibernateExecutor { + public: + HibernateExecutor(RDKShell& shell); + HibernateExecutor(const HibernateExecutor&) = delete; + HibernateExecutor& operator=(const HibernateExecutor&) = delete; + ~HibernateExecutor(); + + void schedule(std::string callsign, uint32_t timeoutMs, uint32_t delayMs = 0); + void abort(std::string callsign); + + private: + + struct Params { + std::chrono::steady_clock::time_point timePoint; + uint32_t timeoutMs; + }; + + void run(); + void hibernateInternal(std::string callsign, uint32_t timeoutMs); + + RDKShell &mShell; + std::thread mThread; + std::mutex mMutex; + std::condition_variable mCondition; + std::unordered_map mCallsignsExecTimeMap; + std::set mCallsignsHibernating; + bool mRunning; + }; +#endif private/*members*/: bool mRemoteShell; @@ -487,6 +519,9 @@ namespace WPEFramework { #ifdef ENABLE_RIALTO_FEATURE std::shared_ptr rialtoConnector; #endif //ENABLE_RIALTO_FEATURE +#ifdef HIBERNATE_SUPPORT_ENABLED + HibernateExecutor mHibernateExecutor; +#endif }; struct PluginData diff --git a/docs/api/RDKShellPlugin.md b/docs/api/RDKShellPlugin.md index 0d8b0e8a14..26329373ea 100644 --- a/docs/api/RDKShellPlugin.md +++ b/docs/api/RDKShellPlugin.md @@ -4373,8 +4373,7 @@ Hibernate an application. | params | object | | | params.callsign | string | The application callsign | | params?.timeout | number | *(optional)* Timeout in ms for hibernate procedure | -| params?.procsequence | array | *(optional)* Hibernate sequence of application processes | -| params?.procsequence[#] | string | *(optional)* | +| params?.delay | number | *(optional)* Hibernate execution delay in ms | ### Result @@ -4395,9 +4394,7 @@ Hibernate an application. "params": { "callsign": "Cobalt", "timeout": 10000, - "procsequence": [ - "LightningApp-0" - ] + "delay": 5000 } } ``` From a2f7d033a84907264afc57e799f7ad5b3f7473c7 Mon Sep 17 00:00:00 2001 From: Vishnu Dinakaran <59993407+vdinak240@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:59:44 +0530 Subject: [PATCH 2/7] DELIA-65448 : Add timeout to gstreamer source element on flex2.0 (#5497) Reason for change: Add timeout to gstreamer source element when requesting from cloud Test Procedure: Mentioned in ticket Risks: Low Signed-off-by: vdinak240 --- TextToSpeech/impl/TTSSpeaker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TextToSpeech/impl/TTSSpeaker.cpp b/TextToSpeech/impl/TTSSpeaker.cpp index 6d89a86c22..d0ee0b45b4 100644 --- a/TextToSpeech/impl/TTSSpeaker.cpp +++ b/TextToSpeech/impl/TTSSpeaker.cpp @@ -801,7 +801,12 @@ void TTSSpeaker::createPipeline(PipelineType type) { #if defined(PLATFORM_AMLOGIC) g_object_set(G_OBJECT(m_audioSink), "tts-mode", TRUE, NULL); #endif - + if(m_defaultConfig.hasValidLocalEndpoint() && type == MP3 ) + { + //timeout + TTSLOG_WARNING("Adding timeout 2 sec"); + g_object_set(G_OBJECT(m_source), "timeout", 2, NULL); + } g_object_set(G_OBJECT(m_source), "location", tts_url.c_str(), NULL); } From 9613f3f918d9c6c4900651183adb0aa2410ef0e7 Mon Sep 17 00:00:00 2001 From: dhivyapriya Date: Mon, 8 Jul 2024 14:05:42 +0000 Subject: [PATCH 3/7] RDKVREFPLT-2194 - [Memcr]Callsign added for YouTube and Amazon Reason for change: Callsign changes got conflicts so repushed the changes Test Procedure: Build and verified Risks: Low Signed-off-by: Dhivya Priya M --- RDKShell/RDKShell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index d4c87c9784..2f804cc73e 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -787,7 +787,7 @@ namespace WPEFramework { delay = HIBERNATION_DELAY_FOR_LAUNCHED_TO_SUSPENDED_MS; } - if (mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos) + if (mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos || mCallSign.find("Amazon") != std::string::npos || mCallSign.find("YouTube") != std::string::npos) { // call RDKShell.hibernate std::thread requestsThread = @@ -6757,7 +6757,7 @@ namespace WPEFramework { returnResponse(status); } - if( callsign.find("Netflix") != string::npos || callsign.find("Cobalt") != string::npos ) + if( callsign.find("Netflix") != string::npos || callsign.find("Cobalt") != string::npos || callsign.find("Amazon") != string::npos || callsign.find("YouTube") != string::npos ) { //Check if native app is suspended bool suspendedOrHibernated = false; From b3b15580a28a997f21d5736104e403903faa26d0 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Mon, 8 Jul 2024 16:53:52 +0300 Subject: [PATCH 4/7] DELIA-65243 : Update secure store endpoints Reason for change: All other devices (This includes Foxtel) - No default. Test Procedure: None Risks: None Signed-off-by: Nikita Poltorapavlo --- .github/workflows/L2-PersistentStore.yml | 2 +- PersistentStore/CMakeLists.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/L2-PersistentStore.yml b/.github/workflows/L2-PersistentStore.yml index 6dc09ba171..73b1b41762 100644 --- a/.github/workflows/L2-PersistentStore.yml +++ b/.github/workflows/L2-PersistentStore.yml @@ -31,7 +31,7 @@ jobs: - name: Build working-directory: ${{github.workspace}} run: | - cmake -S ${GITHUB_REPOSITORY}/PersistentStore -B build/PersistentStore -DCMAKE_INSTALL_PREFIX="install" -DCMAKE_CXX_FLAGS="-Wall -Werror" -DPLUGIN_PERSISTENTSTORE_PATH="/tmp/persistentstore/l2test/test" + cmake -S ${GITHUB_REPOSITORY}/PersistentStore -B build/PersistentStore -DCMAKE_INSTALL_PREFIX="install" -DCMAKE_CXX_FLAGS="-Wall -Werror" -DPLUGIN_PERSISTENTSTORE_PATH="/tmp/persistentstore/l2test/test" -DPLUGIN_PERSISTENTSTORE_WITH_ACCOUNT_SCOPE=true -DPLUGIN_PERSISTENTSTORE_MODE=Local -DPLUGIN_PERSISTENTSTORE_URI=ss.eu.prod.developer.comcast.com:443 cmake --build build/PersistentStore --target install # Usage: diff --git a/PersistentStore/CMakeLists.txt b/PersistentStore/CMakeLists.txt index 429bec4f2a..b2994838cd 100644 --- a/PersistentStore/CMakeLists.txt +++ b/PersistentStore/CMakeLists.txt @@ -29,8 +29,8 @@ set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) set(CMAKE_CXX_STANDARD 11) -set(PLUGIN_PERSISTENTSTORE_MODE "Local" CACHE STRING "Controls if the plugin should run in its own process, in process or remote") -set(PLUGIN_PERSISTENTSTORE_URI "ss.eu.prod.developer.comcast.com:443" CACHE STRING "Account scope endpoint") +set(PLUGIN_PERSISTENTSTORE_MODE "Off" CACHE STRING "Controls if the plugin should run in its own process, in process or remote") +set(PLUGIN_PERSISTENTSTORE_URI "" CACHE STRING "Account scope endpoint") set(PLUGIN_PERSISTENTSTORE_PATH "/opt/secure/persistent/rdkservicestore" CACHE STRING "Path") set(PLUGIN_PERSISTENTSTORE_LEGACYPATH "/opt/persistent/rdkservicestore" CACHE STRING "Previously used path") set(PLUGIN_PERSISTENTSTORE_KEY "" CACHE STRING "Encryption key") @@ -39,7 +39,7 @@ set(PLUGIN_PERSISTENTSTORE_MAXVALUE "3000" CACHE STRING "For single text data, i set(PLUGIN_PERSISTENTSTORE_LIMIT "10000" CACHE STRING "Default for all text data in namespace, in bytes") set(PLUGIN_PERSISTENTSTORE_TOKEN_COMMAND "" CACHE STRING "Shell command to get the service access token") set(PLUGIN_PERSISTENTSTORE_STARTUPORDER "" CACHE STRING "To configure startup order of PersistentStore plugin") -set(PLUGIN_PERSISTENTSTORE_WITH_ACCOUNT_SCOPE true CACHE BOOL "Enable account scope") +set(PLUGIN_PERSISTENTSTORE_WITH_ACCOUNT_SCOPE false CACHE BOOL "Enable account scope") add_library(${MODULE_NAME} SHARED PersistentStore.cpp From 9babe92c03efc2414511ede364b631159d924458 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Mon, 8 Jul 2024 17:03:58 +0300 Subject: [PATCH 5/7] Revert "adapt to the recent changes in Thunder master branch" This reverts commit 255cdd5454730fd98ba61c40395c277f483b92c8. --- PersistentStore/CMakeLists.txt | 6 ------ PersistentStore/PersistentStore.cpp | 4 ---- PersistentStore/grpc/l0test/CMakeLists.txt | 6 ------ PersistentStore/l0test/CMakeLists.txt | 6 ------ PersistentStore/l1test/CMakeLists.txt | 6 ------ PersistentStore/sqlite/l1test/CMakeLists.txt | 8 +------- 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/PersistentStore/CMakeLists.txt b/PersistentStore/CMakeLists.txt index b2994838cd..650a1c9042 100644 --- a/PersistentStore/CMakeLists.txt +++ b/PersistentStore/CMakeLists.txt @@ -19,12 +19,6 @@ cmake_minimum_required(VERSION 3.14) set(PLUGIN_NAME PersistentStore) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) set(CMAKE_CXX_STANDARD 11) diff --git a/PersistentStore/PersistentStore.cpp b/PersistentStore/PersistentStore.cpp index 9a67d6f437..da9f31b23e 100644 --- a/PersistentStore/PersistentStore.cpp +++ b/PersistentStore/PersistentStore.cpp @@ -31,11 +31,7 @@ namespace WPEFramework { namespace { -#ifdef WITH_THUNDER_NAMESPACE - static Thunder::Plugin::Metadata metadata( -#else static Plugin::Metadata metadata( -#endif // Version (Major, Minor, Patch) API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH, // Preconditions diff --git a/PersistentStore/grpc/l0test/CMakeLists.txt b/PersistentStore/grpc/l0test/CMakeLists.txt index 520fb656df..8e4aa0ab13 100644 --- a/PersistentStore/grpc/l0test/CMakeLists.txt +++ b/PersistentStore/grpc/l0test/CMakeLists.txt @@ -35,12 +35,6 @@ FetchContent_MakeAvailable(googletest) target_link_libraries(${PROJECT_NAME} PRIVATE gmock_main) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE ${NAMESPACE}Plugins::${NAMESPACE}Plugins) diff --git a/PersistentStore/l0test/CMakeLists.txt b/PersistentStore/l0test/CMakeLists.txt index 8a7675f16d..d8f1e6ee20 100644 --- a/PersistentStore/l0test/CMakeLists.txt +++ b/PersistentStore/l0test/CMakeLists.txt @@ -29,12 +29,6 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/l1test/CMakeLists.txt b/PersistentStore/l1test/CMakeLists.txt index 13edcf8f87..67d7b50ff5 100644 --- a/PersistentStore/l1test/CMakeLists.txt +++ b/PersistentStore/l1test/CMakeLists.txt @@ -29,12 +29,6 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/sqlite/l1test/CMakeLists.txt b/PersistentStore/sqlite/l1test/CMakeLists.txt index b69de898b7..698833ebf3 100644 --- a/PersistentStore/sqlite/l1test/CMakeLists.txt +++ b/PersistentStore/sqlite/l1test/CMakeLists.txt @@ -28,13 +28,7 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) -find_package(WPEFramework) -if (NOT WPEFramework_FOUND) - find_package(Thunder) - if (Thunder_FOUND) - add_compile_definitions(WITH_THUNDER_NAMESPACE) - endif () -endif () +find_package(WPEFramework REQUIRED) find_package(${NAMESPACE}Plugins REQUIRED) add_executable(${PROJECT_NAME} From 9d157b1e69fc4245dfe17268a7a4e6c33f532b73 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Mon, 8 Jul 2024 17:12:23 +0300 Subject: [PATCH 6/7] adapt to the recent changes in Thunder master branch --- PersistentStore/CMakeLists.txt | 2 +- PersistentStore/PersistentStore.cpp | 26 ++++++++++---------- PersistentStore/grpc/l0test/CMakeLists.txt | 2 +- PersistentStore/l0test/CMakeLists.txt | 2 +- PersistentStore/l1test/CMakeLists.txt | 2 +- PersistentStore/sqlite/l1test/CMakeLists.txt | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/PersistentStore/CMakeLists.txt b/PersistentStore/CMakeLists.txt index 650a1c9042..3a19f4c1fb 100644 --- a/PersistentStore/CMakeLists.txt +++ b/PersistentStore/CMakeLists.txt @@ -18,7 +18,7 @@ cmake_minimum_required(VERSION 3.14) set(PLUGIN_NAME PersistentStore) -find_package(WPEFramework) +find_package(WPEFramework NAMES WPEFramework Thunder) set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) set(CMAKE_CXX_STANDARD 11) diff --git a/PersistentStore/PersistentStore.cpp b/PersistentStore/PersistentStore.cpp index da9f31b23e..f508217482 100644 --- a/PersistentStore/PersistentStore.cpp +++ b/PersistentStore/PersistentStore.cpp @@ -29,21 +29,21 @@ namespace WPEFramework { -namespace { - - static Plugin::Metadata metadata( - // Version (Major, Minor, Patch) - API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH, - // Preconditions - {}, - // Terminations - {}, - // Controls - {}); -} - namespace Plugin { + namespace { + + static Metadata metadata( + // Version (Major, Minor, Patch) + API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH, + // Preconditions + {}, + // Terminations + {}, + // Controls + {}); + } + SERVICE_REGISTRATION(PersistentStore, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH); const string PersistentStore::Initialize(PluginHost::IShell* service) diff --git a/PersistentStore/grpc/l0test/CMakeLists.txt b/PersistentStore/grpc/l0test/CMakeLists.txt index 8e4aa0ab13..bbfa97c27c 100644 --- a/PersistentStore/grpc/l0test/CMakeLists.txt +++ b/PersistentStore/grpc/l0test/CMakeLists.txt @@ -34,7 +34,7 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) target_link_libraries(${PROJECT_NAME} PRIVATE gmock_main) -find_package(WPEFramework) +find_package(WPEFramework NAMES WPEFramework Thunder) find_package(${NAMESPACE}Plugins REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE ${NAMESPACE}Plugins::${NAMESPACE}Plugins) diff --git a/PersistentStore/l0test/CMakeLists.txt b/PersistentStore/l0test/CMakeLists.txt index d8f1e6ee20..0d930a75c7 100644 --- a/PersistentStore/l0test/CMakeLists.txt +++ b/PersistentStore/l0test/CMakeLists.txt @@ -28,7 +28,7 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) -find_package(WPEFramework) +find_package(WPEFramework NAMES WPEFramework Thunder) find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/l1test/CMakeLists.txt b/PersistentStore/l1test/CMakeLists.txt index 67d7b50ff5..456dc98abc 100644 --- a/PersistentStore/l1test/CMakeLists.txt +++ b/PersistentStore/l1test/CMakeLists.txt @@ -28,7 +28,7 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) -find_package(WPEFramework) +find_package(WPEFramework NAMES WPEFramework Thunder) find_package(${NAMESPACE}Plugins REQUIRED) find_package(${NAMESPACE}Definitions REQUIRED) diff --git a/PersistentStore/sqlite/l1test/CMakeLists.txt b/PersistentStore/sqlite/l1test/CMakeLists.txt index 698833ebf3..bec8ff220e 100644 --- a/PersistentStore/sqlite/l1test/CMakeLists.txt +++ b/PersistentStore/sqlite/l1test/CMakeLists.txt @@ -28,7 +28,7 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(googletest) -find_package(WPEFramework REQUIRED) +find_package(WPEFramework NAMES WPEFramework Thunder) find_package(${NAMESPACE}Plugins REQUIRED) add_executable(${PROJECT_NAME} From d8dccf80b0c48b715418914d078ef209b879bb92 Mon Sep 17 00:00:00 2001 From: tabbas651 <74683978+tabbas651@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:36:42 -0400 Subject: [PATCH 7/7] DELIA-65745: Monitor the NetworkManager process by adding into Monitor Plugin Config List (#5502) Reason for change: Added NetworkManager Process into Monitor Plugin Config list Test Procedure: Verify in Jenkin Build Risks: Medium Signed-off-by: Thamim Razith Co-authored-by: Karunakaran A <48997923+karuna2git@users.noreply.github.com> --- Monitor/CMakeLists.txt | 3 +++ Monitor/Monitor.conf.in | 12 ++++++++++++ Monitor/Monitor.config | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/Monitor/CMakeLists.txt b/Monitor/CMakeLists.txt index e90191511c..d8e4234de5 100644 --- a/Monitor/CMakeLists.txt +++ b/Monitor/CMakeLists.txt @@ -34,6 +34,8 @@ set(PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP "${PLUGIN_WEBKITBROWSER_RESIDENT_A set(PLUGIN_MONITOR_WEBKITBROWSER_UX "${PLUGIN_WEBKITBROWSER_UX}" CACHE BOOL "Enable monitor for the WebKitBrowser UX plugin") set(PLUGIN_MONITOR_WEBKITBROWSER_YOUTUBE "${PLUGIN_WEBKITBROWSER_YOUTUBE}" CACHE BOOL "Enable monitor for the WebKitBrowser Youtube plugin") set(PLUGIN_MONITOR_SYSTEMAUDIOPLAYER "${PLUGIN_SYSTEMAUDIOPLAYER}" CACHE BOOL "Enable monitor for the SystemAudioPlayer plugin") +# By Default NetworkManager plugin Monitor is in ON state +set(PLUGIN_MONITOR_NETWORKMANAGER ON) # Plugins built from outside of this repository have to be enabled manually set(PLUGIN_MONITOR_AMAZON OFF CACHE BOOL "Enable monitor for the Amazon plugin") @@ -51,6 +53,7 @@ set(PLUGIN_MONITOR_WEBKITBROWSER_APPS_MEMORYLIMIT "614400" CACHE STRING "monitor set(PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP_MEMORYLIMIT "614400" CACHE STRING "monitor resident app memory limit") set(PLUGIN_MONITOR_WEBKITBROWSER_UX_MEMORYLIMIT "614400" CACHE STRING "monitor ux memory limit") set(PLUGIN_MONITOR_WEBKITBROWSER_YOUTUBE_MEMORYLIMIT "614400" CACHE STRING "monitor youtube memory limit") +set(PLUGIN_MONITOR_NETWORKMANAGER_MEMORYLIMIT "614400" CACHE STRING "monitor networkmanager memory limit") # deprecated/legacy flags support if(PLUGIN_MONITOR_APPS_MEMORYLIMIT) diff --git a/Monitor/Monitor.conf.in b/Monitor/Monitor.conf.in index 6cb8458bd3..4c76c75655 100644 --- a/Monitor/Monitor.conf.in +++ b/Monitor/Monitor.conf.in @@ -155,6 +155,18 @@ if boolean("@PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP@"): observable_config.add("restart", restart_config) observable_list.append(observable_config) +if boolean("@PLUGIN_MONITOR_NETWORKMANAGER@"): + observable_config = JSON() + observable_config.add("callsign", "org.rdk.NetworkManager") + observable_config.add("memory", "5") + observable_config.add("memorylimit", "@PLUGIN_MONITOR_NETWORKMANAGER_MEMORYLIMIT@") + observable_config.add("operational", "1") + restart_config = JSON() + restart_config.add("window", "60") + restart_config.add("limit", "3") + observable_config.add("restart", restart_config) + observable_list.append(observable_config) + if boolean("@PLUGIN_MONITOR_CLONED_APPS@"): observable_config = JSON() observable_config.add("callsign", "SearchAndDiscovery") diff --git a/Monitor/Monitor.config b/Monitor/Monitor.config index 24d6d6b3f4..11d77e3837 100644 --- a/Monitor/Monitor.config +++ b/Monitor/Monitor.config @@ -208,6 +208,23 @@ if(PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP) map_append(${configuration} observables ${RESIDENT_APP_MONITOR_CONFIG}) endif() +if(PLUGIN_MONITOR_NETWORKMANAGER) + map() + kv(callsign org.rdk.NetworkManager) + kv(memory 5) + kv(memorylimit ${PLUGIN_MONITOR_NETWORKMANAGER_MEMORYLIMIT}) + kv(operational 1) + key(restart) + map() + kv(window 60) + kv(limit 3) + end() + end() + ans(NETWORK_MANAGER_MONITOR_CONFIG) + map_append(${configuration} observables ___array___) + map_append(${configuration} observables ${NETWORK_MANAGER_MONITOR_CONFIG}) +endif() + if(PLUGIN_MONITOR_INSTANCES_LIST) # 'PLUGIN_MONITOR_INSTANCES_LIST' contains a semi-colon (';') separated list of Monitor observable