[mobile] Change API launching an application : aul_launch_app() -> app_control_send_l... 08/74208/1 submit/tizen/20160617.081804
authorgs86.lee <gs86.lee@samsung.com>
Mon, 13 Jun 2016 07:52:54 +0000 (16:52 +0900)
committergs86.lee <gs86.lee@samsung.com>
Mon, 13 Jun 2016 07:52:54 +0000 (16:52 +0900)
Change-Id: Ibd3c56c90756fcf0939431467f1e6cf501ba1c8a

include/dbus_util.h
include/mobile/home_mgr.h
src/dbus_util.c
src/mobile/home_mgr.c
src/mobile/hw_key.c
src/process_mgr.c

index c958416..f4343df 100644 (file)
@@ -39,7 +39,6 @@
 #define MEMBER_LCD_ON                  "LCDOn"
 #define MEMBER_LCD_OFF                 "LCDOff"
 
-extern void dbus_util_send_home_raise_signal(void);
 extern int dbus_util_send_oomadj(int pid, int oom_adj_value);
 extern void dbus_util_send_cpu_booster_signal(void);
 extern void dbus_util_send_poweroff_signal(void);
index 2130a3f..8b08df6 100644 (file)
@@ -30,6 +30,5 @@ void home_mgr_relaunch_homescreen(void);
 void home_mgr_relaunch_volume(void);
 void home_mgr_relaunch_indicator(void);
 void home_mgr_relaunch_quickpanel(void);
-extern int home_mgr_open_home(const char *pkgname);
-
+extern void home_mgr_open_home(const char *appid, const char *key, const char *val);
 // End of a file
index 4980358..b9f0547 100644 (file)
@@ -202,6 +202,7 @@ static int _invoke_dbus_method_async(const char *dest, const char *path,
 
 
 
+#if 0
 static int _dbus_message_send(const char *path, const char *interface, const char *member)
 {
        int ret = 0;
@@ -229,19 +230,7 @@ static int _dbus_message_send(const char *path, const char *interface, const cha
        _D("dbus_connection_send, ret=%d", ret);
        return 0;
 }
-
-
-
-void dbus_util_send_home_raise_signal(void)
-{
-       int ret = 0;
-
-       ret = _dbus_message_send(
-                       DBUS_HOME_RAISE_PATH,
-                       DBUS_HOME_RAISE_INTERFACE,
-                       DBUS_HOME_RAISE_MEMBER);
-       _E("Sending HOME RAISE signal, result:%d", ret);
-}
+#endif
 
 
 
index 6c92937..45e391a 100644 (file)
@@ -126,9 +126,7 @@ static int _change_home_cb(const char *appid, const char *key, const char *value
 
 
 
-#define SERVICE_OPERATION_MAIN_KEY "__APP_SVC_OP_TYPE__"
-#define SERVICE_OPERATION_MAIN_VALUE "http://tizen.org/appcontrol/operation/main"
-void home_mgr_open_home(const char *appid)
+void home_mgr_open_home(const char *appid, const char *key, const char *val)
 {
        char *home_appid = NULL;
 
@@ -148,7 +146,7 @@ void home_mgr_open_home(const char *appid)
        home_appid = MENU_SCREEN_PKG_NAME;
 #endif
 
-       process_mgr_must_launch(home_appid, SERVICE_OPERATION_MAIN_KEY, SERVICE_OPERATION_MAIN_VALUE, _change_home_cb, _after_launch_home);
+       process_mgr_must_launch(home_appid, key, val, _change_home_cb, _after_launch_home);
 }
 
 
@@ -200,7 +198,7 @@ static int _show_home_cb(status_active_key_e key, void *data)
                        }
                }
 
-               home_mgr_open_home(NULL);
+               home_mgr_open_home(NULL, NULL, NULL);
                break;
        default:
                _E("False sequence [%d]", seq);
@@ -251,7 +249,7 @@ static int _change_selected_package_name(status_active_key_e key, void *data)
                }
        }
 
-       home_mgr_open_home(appid);
+       home_mgr_open_home(appid, NULL, NULL);
 
        return 1;
 }
index 27e814c..03f3771 100644 (file)
@@ -117,18 +117,15 @@ static void _release_multimedia_key(const char *value)
 
 
 
+#define HOME_OP_KEY "__HOME_OP__"
+#define HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
 static Eina_Bool _launch_by_home_key(void *data)
 {
-       int ret = 0;
-
        if (status_passive_get()->idle_lock_state > VCONFKEY_IDLE_UNLOCK) {
                return ECORE_CALLBACK_CANCEL;
        }
 
-       ret = home_mgr_open_home(NULL);
-       if(ret > 0) {
-               dbus_util_send_home_raise_signal();
-       }
+       home_mgr_open_home(NULL, HOME_OP_KEY, HOME_OP_VAL_LAUNCH_BY_HOME_KEY);
 
        return ECORE_CALLBACK_CANCEL;
 }
@@ -141,7 +138,7 @@ static Eina_Bool _home_multi_press_timer_cb(void *data)
 
        key_info.home_multi_press_timer = NULL;
 
-       if(0 == key_info.homekey_count % 2) {
+       if (0 == key_info.homekey_count % 2) {
                key_info.homekey_count = 0;
                return ECORE_CALLBACK_CANCEL;
        } else if(key_info.homekey_count >= 3) {
@@ -656,18 +653,15 @@ static Eina_Bool _launch_taskmgr_cb(void* data)
 
 
 
+#define HOME_OP_KEY "__HOME_OP__"
+#define HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
 static Eina_Bool _launch_by_home_key(void *data)
 {
-       int ret = 0;
-
        if (status_passive_get()->idle_lock_state > VCONFKEY_IDLE_UNLOCK) {
                return ECORE_CALLBACK_CANCEL;
        }
 
-       ret = home_mgr_open_home(NULL);
-       if(ret > 0) {
-               dbus_util_send_home_raise_signal();
-       }
+       home_mgr_open_home(NULL, HOME_OP_KEY, HOME_OP_VAL_LAUNCH_BY_HOME_KEY);
 
        return ECORE_CALLBACK_CANCEL;
 }
@@ -680,7 +674,7 @@ static Eina_Bool _home_multi_press_timer_cb(void *data)
 
        key_info.home_multi_press_timer = NULL;
 
-       if(0 == key_info.homekey_count % 2) {
+       if (0 == key_info.homekey_count % 2) {
                key_info.homekey_count = 0;
                return ECORE_CALLBACK_CANCEL;
        } else if(key_info.homekey_count >= 3) {
index 1624217..8ce3a22 100644 (file)
@@ -21,6 +21,8 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <bundle_internal.h>
+#include <app_manager.h>
+#include <app_control.h>
 
 #include "process_mgr.h"
 #include "util.h"
@@ -47,26 +49,70 @@ typedef struct _launch_info_s {
 static int _try_to_launch(const char *appid, const char *key, const char *value, after_func afn)
 {
        int pid = -1;
-       bundle *b = NULL;
 
        retv_if(!appid, -1);
 
-       if (key) {
-               b = bundle_create();
-               if (!b) {
-                       _E("Failed to create a bundle");
+       int ret = 0;
+       app_control_h app_control_handle = NULL;
+       app_context_h app_context_handle = NULL;
+
+       ret = app_control_create(&app_control_handle);
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               _E("Failed to create appcontrol");
+               return -1;
+       }
+
+       ret = app_control_set_operation(app_control_handle, APP_CONTROL_OPERATION_DEFAULT);
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               _E("Failed to set operation to appcontrol");
+               app_control_destroy(app_control_handle);
+               return -1;
+       }
+
+       if (key && value) {
+               _D("key(%s), value(%s)", key, value);
+               ret = app_control_add_extra_data(app_control_handle, key, value);
+               if (ret != APP_CONTROL_ERROR_NONE) {
+                       _E("Failed to add extra data to appcontrol");
+                       app_control_destroy(app_control_handle);
                        return -1;
                }
-               bundle_add(b, key, value);
        }
 
-       pid = aul_launch_app(appid, b);
-       if (b) bundle_free(b);
-       if (pid > 0) {
-               _D("Succeed to launch %s", appid);
-               if (afn) afn(pid);
+       ret = app_control_set_app_id(app_control_handle, appid);
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               _E("Failed to set app id to appcontrol");
+               app_control_destroy(app_control_handle);
+               return -1;
+       }
+
+       ret = app_control_send_launch_request(app_control_handle, NULL, NULL);
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               _E("Failed to send launch request : %s", appid);
+               app_control_destroy(app_control_handle);
+               return -1;
+       }
+
+       app_control_destroy(app_control_handle);
+
+       ret = app_manager_get_app_context(appid, &app_context_handle);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               _E("Failed to get app context : %s", appid);
+               return -1;
        }
 
+       ret = app_context_get_pid(app_context_handle, &pid);
+       if (ret != APP_MANAGER_ERROR_NONE) {
+               _E("Failed to get pid : %s", appid);
+               app_context_destroy(app_context_handle);
+               return -1;
+       }
+
+       app_context_destroy(app_context_handle);
+
+       _D("Succeed to launch : %s(%d)", appid, pid);
+       if (afn) afn(pid);
+
        return pid;
 }
 
@@ -115,7 +161,7 @@ void process_mgr_must_launch(const char *appid, const char *key, const char *val
        launch_info_s *launch_info = NULL;
        int pid = -1;
 
-       _D("Must launch %s", appid);
+       _D("Must launch %s", appid);
 
        pid = _try_to_launch(appid, key, value, afn);
        if (pid > 0) return;