diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index b3bfc40bf2..8a29ae470f 100755 --- a/RDKShell/RDKShell.cpp +++ b/RDKShell/RDKShell.cpp @@ -17,6 +17,7 @@ * limitations under the License. **/ + #include "RDKShell.h" #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -214,6 +216,11 @@ int gHibernateBlocked; std::condition_variable gHibernateBlockedCondVariable; #endif +#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED +std::set gLaunchedToSuspended; +std::mutex gLaunchedToSuspendedMutex; +#endif + #define ANY_KEY 65536 #define RDKSHELL_THUNDER_TIMEOUT 20000 #define RDKSHELL_POWER_TIME_WAIT 2.5 @@ -772,7 +779,11 @@ namespace WPEFramework { if (Utils::getRFCConfig("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AppHibernate.Enable", param) && strncasecmp(param.value, "true", 4) == 0) { - if ((mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos)) + gLaunchedToSuspendedMutex.lock(); + bool l2s = (gLaunchedToSuspended.find(mCallSign) != gLaunchedToSuspended.end()); + gLaunchedToSuspendedMutex.unlock(); + + if (!l2s && (mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos)) { // call RDKShell.hibernate std::thread requestsThread = @@ -4051,6 +4062,18 @@ namespace WPEFramework { } gSuspendedOrHibernatedApplicationsMutex.unlock(); #endif +#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED + gLaunchedToSuspendedMutex.lock(); + if (suspend) + { + gLaunchedToSuspended.insert(appCallsign); + } + else + { + gLaunchedToSuspended.erase(appCallsign); + } + gLaunchedToSuspendedMutex.unlock(); +#endif //check to see if plugin already exists bool newPluginFound = false;