summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Oleynik <aoleynik@luxoft.com>2016-07-12 17:56:37 +0300
committerAndrey Oleynik <aoleynik@luxoft.com>2016-07-13 14:49:32 +0300
commit9d645d5c4ef6d4ada791bb1b85bad8643d367d78 (patch)
tree7a69a448e51775438437b2e1e07029607bc75a5f
parentdf47d1ff87a06f30f3f3529465d669d265b97732 (diff)
downloadsdl_core-9d645d5c4ef6d4ada791bb1b85bad8643d367d78.tar.gz
Fixes LAUNCH_APP flow
On invoking of SDL.ActivateApp SDL has to search through the registered and to-be-regisetered apps in order to find necessary app to launch. In case of registered app SDL has just to start it. In case of to-be-registered app SDL has to send LAUNCH_APP request via foregrounded SDL4.0-enabled application. If there is no such app - request has to be sent via all registered SDL4.0-enabled application on the same device as application requested to be launched. Relates-to: APPLINK-23987
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
index 9c4ff8c41e..67418aa22e 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
@@ -58,6 +58,24 @@ void SDLActivateAppRequest::Run() {
LOG4CXX_ERROR(
logger_,
"Can't find application within regular apps: " << application_id);
+
+ // Here is the hack - in fact SDL gets hmi_app_id in appID field and
+ // replaces it with connection_key only for normally registered apps, but
+ // for apps_to_be_registered (waiting) it keeps original value (hmi_app_id)
+ // so method does lookup for hmi_app_id
+ app = application_manager_.app_to_be_registered(application_id);
+
+ if (!app) {
+ LOG4CXX_WARN(
+ logger_,
+ "Can't find application within waiting apps: " << application_id);
+ return;
+ }
+ }
+
+ if (app->IsRegistered()) {
+ application_manager_.GetPolicyHandler().OnActivateApp(application_id,
+ correlation_id());
return;
}
@@ -71,34 +89,22 @@ void SDLActivateAppRequest::Run() {
return;
}
- if (!app->IsRegistered()) {
- if (devices_apps.first) {
- MessageHelper::SendLaunchApp(devices_apps.first->app_id(),
- app->SchemaUrl(),
- app->PackageName(),
- application_manager_);
- } else {
- std::vector<ApplicationSharedPtr>::const_iterator it =
- devices_apps.second.begin();
- for (; it != devices_apps.second.end(); ++it) {
- MessageHelper::SendLaunchApp((*it)->app_id(),
- app->SchemaUrl(),
- app->PackageName(),
- application_manager_);
- }
- }
- subscribe_on_event(BasicCommunication_OnAppRegistered);
+ if (devices_apps.first) {
+ MessageHelper::SendLaunchApp(devices_apps.first->app_id(),
+ app->SchemaUrl(),
+ app->PackageName(),
+ application_manager_);
} else {
- if (devices_apps.first) {
- MessageHelper::SendLaunchApp(devices_apps.first->app_id(),
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ devices_apps.second.begin();
+ for (; it != devices_apps.second.end(); ++it) {
+ MessageHelper::SendLaunchApp((*it)->app_id(),
app->SchemaUrl(),
app->PackageName(),
application_manager_);
- } else {
- const uint32_t application_id = app_id();
- application_manager_.GetPolicyHandler().OnActivateApp(application_id,
- correlation_id());
}
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ return;
}
}