Skip to content

Commit

Permalink
Support special parameter 'displayAffinity' for addLaunchPoint
Browse files Browse the repository at this point in the history
: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 <[email protected]>
Reviewed-by: Sangwoo Kang <[email protected]>
Tested-by: Sangwoo Kang <[email protected]>
  • Loading branch information
sangwoo-kang committed Mar 11, 2020
1 parent 64aeabb commit 545d696
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
22 changes: 17 additions & 5 deletions src/base/LaunchPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <string>

#include "base/AppDescription.h"
#include "base/LunaTask.h"
#include "util/JValueUtil.h"

using namespace std;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bus/client/NativeContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 6 additions & 7 deletions src/bus/client/WAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand All @@ -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);
Expand Down

0 comments on commit 545d696

Please sign in to comment.