Do not pause/resume app if background support is enabled 62/189962/3
authorprathmesh.m <prathmesh.m@samsung.com>
Tue, 25 Sep 2018 06:13:03 +0000 (11:43 +0530)
committerprathmesh.m <prathmesh.m@samsung.com>
Wed, 26 Sep 2018 07:33:08 +0000 (13:03 +0530)
If background support is enabled then the javascript must run in
background even if the app is paused.
Currently on Pause the application is suspended and
hence the JS. With this patch if background support is enbaled
window will be sent to background by platform but engine will
run, ie. JS will be active in background

Change-Id: Ideb74215fcc4fe3f3d31a3458c4e0611ad2c258c
Signed-off-by: prathmesh.m <prathmesh.m@samsung.com>
atom/browser/browser.cc

index 808e9136c3542861bd86fe2279328367d2677ef1..7313bb29ca95cfc3d1c41750c7b0a12639394043 100644 (file)
@@ -257,7 +257,14 @@ void Browser::OnWindowAllClosed() {
 }
 
 #if defined(OS_TIZEN)
+// Function is same as suspend. This will be called from app lifecycle suspend
 void Browser::Hide() {
+  // If application is having background catagory enabled then do not suspend the app
+  auto appdata = common::ApplicationDataManager::GetCurrentAppData();
+  if (appdata->setting_info() != NULL && appdata->setting_info()->background_support_enabled()) {
+    return;
+  }
+
   NativeWindow *last_window = WindowList::GetLastWindow();
   if (!last_window)
     return;
@@ -267,7 +274,14 @@ void Browser::Hide() {
   atom::Browser::Get()->Suspend(rvh);
 }
 
+// Function is same as resume. This will be called from app lifecycle resume
 void Browser::Show() {
+  // If application is having background catagory enabled then do not resume the app
+  // as its has not suspend
+  auto appdata = common::ApplicationDataManager::GetCurrentAppData();
+  if (appdata->setting_info() != NULL && appdata->setting_info()->background_support_enabled()) {
+    return;
+  }
   NativeWindow *last_window = WindowList::GetLastWindow();
   if (!last_window)
     return;