Make minor fix after manifest modifications 57/119357/4 submit/tizen/20170404.083520
authorOleksander Kostenko <o.kostenko@samsung.com>
Thu, 16 Mar 2017 11:54:24 +0000 (13:54 +0200)
committerOleksandr Kostenko <o.kostenko@samsung.com>
Fri, 17 Mar 2017 08:53:49 +0000 (01:53 -0700)
Add instance id parameter for launching applications, and change package name.

Change-Id: Ib473695c388893af109d2ddffadb48ccb72091ba
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
inc/Config.h
src/App/inc/TaskMngrService.h
src/App/src/MainController.cpp
src/App/src/TaskMngrService.cpp

index 8d8b7ea..9f418ec 100644 (file)
 #define Config_h_
 
 #if !defined(PACKAGE_NAME)
-#define PACKAGE_NAME "org.tizen.task-mgr"
+#define PACKAGE_NAME "org.tizen.w-task-mgr"
 #endif
 
 #if !defined(PROJECT_NAME)
-#define PROJECT_NAME "task-mgr"
+#define PROJECT_NAME "w-task-mgr"
 #endif
 
 #ifdef  LOGGER_TAG
index 68ea032..51b044a 100644 (file)
@@ -52,11 +52,12 @@ namespace TaskMngr {
             * @brief Resumes the given application.
             *
             * @param[in] appid The ID of the application
+            * @param[in] instanceId The instance ID of the application
             * @param[in] uri The URI of the data
             *
             * @return true or false on failure
             */
-            bool launchApp(const std::string &appid, const std::string &uri = std::string());
+            bool launchApp(const std::string &appid, const std::string &instanceId = std::string(), const std::string &uri = std::string());
             /**
             * @brief Get or create list of launched applications
             *
index 26e380a..2e9f75e 100644 (file)
@@ -119,7 +119,7 @@ void MainController::onCurrentPageChanged(TaskListView &obj)
 void MainController::onClicked(TaskListViewItem &item)
 {
     LOG("");
-    App::getInst().getTaskMngr().launchApp(item.getAppInfo().appid, item.getAppInfo().uri);
+    App::getInst().getTaskMngr().launchApp(item.getAppInfo().appid, item.getAppInfo().instanceId, item.getAppInfo().uri);
 }
 
 void MainController::onItemBeforeDelete(TaskListViewItem &item)
index 14f3e49..c42c225 100644 (file)
@@ -63,11 +63,27 @@ bool TaskMngrService::killApp(const std::string &appid, const std::string &insta
     return !ret;
 }
 
-bool TaskMngrService::launchApp(const std::string &appid, const std::string &uri)
+bool TaskMngrService::launchApp(const std::string &appid, const std::string &instanceId, const std::string &uri)
 {
     TRACE;
     int ret = 0;
     app_control_h service = nullptr;
+    app_context_h context = nullptr;
+
+    if (!instanceId.empty())
+        app_manager_get_app_context_by_instance_id(appid.c_str(), instanceId.c_str(), &context);
+    else
+        app_manager_get_app_context(appid.c_str(), &context);
+
+    if (context) {
+        LOG("Application ID is running ", appid);
+        ret = app_manager_resume_app(context);
+        app_context_destroy(context);
+        if (ret == APP_MANAGER_ERROR_NONE)
+            return true;
+        else
+            LOG("Failed to resume application ", appid);
+    }
 
     app_control_create(&service);
     if (!service)
@@ -147,11 +163,6 @@ bool TaskMngrService::appInfoCb(app_info_h appInfo)
         item.pkgid = variable;
         free(variable);
         variable = nullptr;
-
-        if (item.pkgid == "org.tizen.task-mgr" || item.pkgid == "org.tizen.taskmanager") {
-            LOG_WARN("ignoring app: ", item.pkgid);
-            return false;
-        }
     }
 
     app_info_get_app_id(appInfo, &variable);