Skip to content

Commit

Permalink
RDKTV-30518: Disable Auto Hibernation for Launch to Suspended
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianM27 committed May 13, 2024
1 parent 3079363 commit 9034cc1
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions RDKShell/RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
* limitations under the License.
**/


#include "RDKShell.h"
#include <string>
#include <memory>
#include <iostream>
#include <mutex>
#include <thread>
#include <fstream>
#include <set>
#include <sstream>
#include <condition_variable>
#include <unistd.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -211,6 +213,11 @@ int gHibernateBlocked;
std::condition_variable gHibernateBlockedCondVariable;
#endif

#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED
std::set<std::string> gLaunchedToSuspended;
std::mutex gLaunchedToSuspendedMutex;
#endif

#define ANY_KEY 65536
#define RDKSHELL_THUNDER_TIMEOUT 20000
#define RDKSHELL_POWER_TIME_WAIT 2.5
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9034cc1

Please sign in to comment.