From 545d6963a1a20e6663ea78fe7f22cc42dfd99fec Mon Sep 17 00:00:00 2001 From: Sangwoo Kang Date: Wed, 11 Mar 2020 15:09:30 +0900 Subject: [PATCH] Support special parameter 'displayAffinity' for addLaunchPoint :Release Notes: Support special parameter 'displayAffinity' for addLaunchPoint :Detailed Notes: Support special parameter 'displayAffinity' for addLaunchPoint :Testing Performed: Local test passed :Issues Addressed: [PLAT-101402] [webOS Auto] Enact browser: Doesn't relaunch with "target" url in launch param Change-Id: I796520afa1e01a3997a1b8c4a32979765220757a Reviewed-on: http://gpro.lge.com/c/webosose/sam/+/270914 Reviewed-by: OSE Helper Bot Reviewed-by: Sangwoo Kang Tested-by: Sangwoo Kang --- src/base/LaunchPoint.h | 22 +++++++++++++++++----- src/bus/client/NativeContainer.cpp | 2 +- src/bus/client/WAM.cpp | 13 ++++++------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/base/LaunchPoint.h b/src/base/LaunchPoint.h index 738734a..9845d65 100644 --- a/src/base/LaunchPoint.h +++ b/src/base/LaunchPoint.h @@ -25,6 +25,7 @@ #include #include "base/AppDescription.h" +#include "base/LunaTask.h" #include "util/JValueUtil.h" using namespace std; @@ -153,13 +154,24 @@ friend class LaunchPointList; return largeIcon; } - const JValue getParams() const + const JValue getParams(LunaTaskPtr lunaTask) const { - JValue params; - if (JValueUtil::getValue(m_database, "params", params)) { - return params; + JValue paramsInRequest = lunaTask->getParams().duplicate(); + JValue paramsInDatabase = pbnjson::Object(); + int displayAffinity = -1; + + JValueUtil::getValue(m_database, "params", paramsInDatabase); + paramsInDatabase = paramsInDatabase.duplicate(); + + if (paramsInRequest.objectSize() == 0) { + return paramsInDatabase; + } else if (paramsInRequest.objectSize() == 1 && + JValueUtil::getValue(paramsInRequest, "displayAffinity", displayAffinity)) { + paramsInDatabase.put("displayAffinity", displayAffinity); + return paramsInDatabase; + } else { + return paramsInRequest; } - return pbnjson::Object(); } const string getTitle() const diff --git a/src/bus/client/NativeContainer.cpp b/src/bus/client/NativeContainer.cpp index af8f380..680f91b 100644 --- a/src/bus/client/NativeContainer.cpp +++ b/src/bus/client/NativeContainer.cpp @@ -98,7 +98,7 @@ void NativeContainer::launch(RunningAppPtr runningApp, LunaTaskPtr lunaTask) params.put("appId", runningApp->getLaunchPoint()->getAppDesc()->getAppId()); params.put("params", lunaTask->getParams()); } else { - params = lunaTask->getParams().objectSize() == 0 ? runningApp->getLaunchPoint()->getParams().duplicate() : lunaTask->getParams().duplicate(); + params = runningApp->getLaunchPoint()->getParams(lunaTask); params.put("event", "launch"); params.put("reason", lunaTask->getReason()); params.put("appId", lunaTask->getAppId()); diff --git a/src/bus/client/WAM.cpp b/src/bus/client/WAM.cpp index 6d76ce8..b1a14bf 100644 --- a/src/bus/client/WAM.cpp +++ b/src/bus/client/WAM.cpp @@ -152,7 +152,11 @@ bool WAM::onLaunchApp(LSHandle* sh, LSMessage* message, void* context) if (!runningApp->getPreload().empty()) { runningApp->setLifeStatus(LifeStatus::LifeStatus_PRELOADED); } else if (runningApp->isHidden()) { - runningApp->setLifeStatus(LifeStatus::LifeStatus_BACKGROUND); + if (runningApp->isKeepAlive()) { + runningApp->setLifeStatus(LifeStatus::LifeStatus_PAUSED); + } else { + runningApp->setLifeStatus(LifeStatus::LifeStatus_BACKGROUND); + } } } @@ -179,12 +183,7 @@ void WAM::launch(RunningAppPtr runningApp, LunaTaskPtr lunaTask) requestPayload.put("reason", lunaTask->getReason()); requestPayload.put("launchingAppId", lunaTask->getCaller()); requestPayload.put("launchingProcId", ""); - - if (lunaTask->getParams().objectSize() != 0) { - requestPayload.put("parameters", lunaTask->getParams()); - } else { - requestPayload.put("parameters", runningApp->getLaunchPoint()->getParams()); - } + requestPayload.put("parameters", runningApp->getLaunchPoint()->getParams(lunaTask)); if (runningApp->isKeepAlive()) { requestPayload.put("keepAlive", true);