diff --git a/RDKShell/RDKShell.cpp b/RDKShell/RDKShell.cpp index 81f90535c6..e06f14ab73 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 @@ -53,7 +55,7 @@ #define API_VERSION_NUMBER_MAJOR 1 #define API_VERSION_NUMBER_MINOR 4 -#define API_VERSION_NUMBER_PATCH 14 +#define API_VERSION_NUMBER_PATCH 15 const string WPEFramework::Plugin::RDKShell::SERVICE_NAME = "org.rdk.RDKShell"; //methods @@ -211,6 +213,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 @@ -725,7 +732,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 = @@ -3973,6 +3984,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;