Skip to content

Commit

Permalink
RDKShell: checkpoint native apps on each suspend state change
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianM27 committed Oct 27, 2023
1 parent 9148d26 commit fbec2a3
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions RDKShell/RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ bool sForceResidentAppLaunch = false;
static bool sRunning = true;
bool needsScreenshot = false;

#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED
std::mutex nativeAppWasResumedMutex;
map<string,bool> nativeAppWasResumed;
#endif

#define ANY_KEY 65536
#define RDKSHELL_THUNDER_TIMEOUT 20000
#define RDKSHELL_POWER_TIME_WAIT 2.5
Expand Down Expand Up @@ -622,10 +617,7 @@ namespace WPEFramework {
if (Utils::getRFCConfig("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AppHibernate.Enable", param)
&& strncasecmp(param.value, "true", 4) == 0)
{
nativeAppWasResumedMutex.lock();
if ((mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos)
&& nativeAppWasResumed.find(mCallSign) != nativeAppWasResumed.end()
&& nativeAppWasResumed[mCallSign])
if ((mCallSign.find("Netflix") != std::string::npos || mCallSign.find("Cobalt") != std::string::npos))
{
// call RDKShell.checkpoint
std::thread requestsThread =
Expand All @@ -638,15 +630,9 @@ namespace WPEFramework {

requestsThread.detach();
}
nativeAppWasResumedMutex.unlock();
}
#endif
}
#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED
nativeAppWasResumedMutex.lock();
nativeAppWasResumed[mCallSign] = (state == PluginHost::IStateControl::RESUMED);
nativeAppWasResumedMutex.unlock();
#endif

}

Expand Down Expand Up @@ -1049,11 +1035,6 @@ namespace WPEFramework {
}
gExitReasonMutex.lock();
gApplicationsExitReason[service->Callsign()] = AppLastExitReason::DEACTIVATED;
#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED
nativeAppWasResumedMutex.lock();
nativeAppWasResumed[service->Callsign()] = false;
nativeAppWasResumedMutex.unlock();
#endif
if(service->Reason() == PluginHost::IShell::FAILURE)
{
gApplicationsExitReason[service->Callsign()] = AppLastExitReason::CRASH;
Expand Down Expand Up @@ -1117,11 +1098,6 @@ namespace WPEFramework {
if ((currentState == PluginHost::IShell::DEACTIVATED) || (currentState == PluginHost::IShell::DESTROYED))
{
gApplicationsExitReason[service->Callsign()] = AppLastExitReason::DEACTIVATED;
#ifdef HIBERNATE_NATIVE_APPS_ON_SUSPENDED
nativeAppWasResumedMutex.lock();
nativeAppWasResumed[service->Callsign()] = false;
nativeAppWasResumedMutex.unlock();
#endif
}
if(service->Reason() == PluginHost::IShell::FAILURE)
{
Expand Down

0 comments on commit fbec2a3

Please sign in to comment.