aul API's removed 64/195264/4
authorShubhojeet <shubhojeet.y@samsung.com>
Tue, 11 Dec 2018 17:43:11 +0000 (23:13 +0530)
committerShubhojeet <shubhojeet.y@samsung.com>
Wed, 12 Dec 2018 18:02:12 +0000 (23:32 +0530)
Change-Id: I06e0319040be2b028d2efd77acf5bf87e77273e5

inc/util.h
src/home_app_manager.c
src/util.c

index 34171bde9bfaa9afb9a9ecb7f9c527eff11daaf1..2be3ed74e7d2bf9163d2cd7de5c59ec067a53c1a 100755 (executable)
@@ -277,11 +277,6 @@ extern int util_is_arbic();
 extern int util_host_vender_id_get(void);
 
 //apps
-extern void apps_util_launch(Evas_Object *win, const char *package, const char *name);
-extern void apps_util_launch_main_operation(Evas_Object *win, const char *app_id, const char *name);
-extern void apps_util_launch_with_arg(Evas_Object *win, const char *app_id, const char *arg, const char *name);
-extern void apps_util_launch_with_bundle(Evas_Object *win, const char *app_id, bundle *b, const char *name);
-
 extern void apps_util_post_message_for_launch_fail(const char *name);
 extern void apps_util_notify_to_home(int pid);
 
index 4102f54b08076fd2e27a9a7c03d6d55f66821999..14cb6f376fbd92f937b4818c85eba24273660dfa 100755 (executable)
@@ -56,7 +56,6 @@
 
 #include <stdbool.h>
 #include <appcore-common.h>
-#include <aul.h>
 #include <bundle.h>
 #include <Ecore.h>
 #include <efl_extension.h>
@@ -74,6 +73,7 @@
 #include <device/callback.h>
 #include <device/battery.h>
 #include <watch_control.h>
+#include <app_manager.h>
 
 #define HOME_SERVICE_KEY "home_op"
 #define HOME_SERVICE_VALUE_POWERKEY_UNFOCUSED "powerkey_unfocused"
@@ -479,14 +479,21 @@ static void _execute_cbs(int state)
 
 
 
-static int _dead_cb(int pid, void *data)
+static void _dead_cb(app_context_h app_context, app_context_event_e event, void *data)
 {
-       _D("PID(%d) is dead", pid);
+       int ret = 0;
+       pid_t pid = 0;
+       if (event == APP_CONTEXT_EVENT_TERMINATED) {
        /* Who manages the idle clock? home_item_idle_clock_app_dead_cb */
-
-       clock_try_to_launch(pid);
-
-       return 1;
+               ret = app_context_get_pid(app_context, &pid);
+               if (ret == APP_MANAGER_ERROR_NONE)
+                       _D("PID(%d) is dead", pid);
+               else {
+                       _D("Failed to get PID");
+                       return;
+               }
+               clock_try_to_launch(pid);
+       }
 }
 
 
@@ -958,7 +965,7 @@ bool app_create(void *data)
         * Dead callback should be called after initialize all services.
         * So we should register this at the last of this function.
         */
-       aul_listen_app_dead_signal(_dead_cb, NULL);
+       app_manager_set_app_context_event_cb(_dead_cb, NULL);
 
        layout_info_s *layout_info = evas_object_data_get(main_info.layout, DATA_KEY_LAYOUT_INFO);
        if (layout_info && layout_info->scroller)
index e8a2634dba5c6f1c656d3097fc98cb54e55e6cf7..2f6682caa10368ce363d1d05c5f3a0a6ed1de9e0 100755 (executable)
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-#include <aul.h>
 #include <app.h>
 #include <appsvc.h>
 #include <bundle.h>
@@ -32,6 +31,7 @@
 #include <pkgmgr-info.h>
 #include <widget_service.h>
 #include <bundle_internal.h>
+#include <app_control.h>
 
 #include <unicode/unum.h>
 #include <unicode/ustring.h>
 
 HAPI int util_launch_app(const char *appid, const char *key, const char *value)
 {
-       int pid = 0;
 
        retv_if(!appid, W_HOME_ERROR_INVALID_PARAMETER);
 
-       if (key && value) {
-               bundle *b = bundle_create();
-               retv_if(!b, 0);
-
-               bundle_add(b, key, value);
-               home_dbus_cpu_booster_signal_send();
-               pid = aul_launch_app(appid, b);
-               bundle_free(b);
-       } else {
-               home_dbus_cpu_booster_signal_send();
-               pid = aul_launch_app(appid, NULL);
-       }
-
-       if (pid < 0)
-               _E("Failed to launch %s(%d)", appid, pid);
+       int ret = APP_CONTROL_ERROR_NONE;
+       app_control_h app_control = NULL;
+       ret = app_control_create(&app_control);
+       app_control_set_app_id(app_control, appid);
+       home_dbus_cpu_booster_signal_send();
+       if (key && value)
+               app_control_add_extra_data(app_control, key, value);
+       ret = app_control_send_launch_request(app_control, NULL, NULL);
+       if(ret != APP_CONTROL_ERROR_NONE)
+               _E("app_control_send_launch_request failed!");
+       app_control_destroy(app_control);
 
-       return pid;
+       return ret;
 }
 
 
@@ -381,230 +376,6 @@ static bool _launch_special_package(const char *package, const char *name)
 
 
 #define LAYOUT_BLOCK_INTERVAL          1.0
-HAPI void apps_util_launch(Evas_Object *win, const char *package, const char *name)
-{
-       ret_if(NULL == package);
-
-       if (!name) name = package;
-       if (LAUNCH_WITH_SPECIAL_ROUTINE && _launch_special_package(package, name))
-               return;
-
-       home_dbus_cpu_booster_signal_send();
-
-       int ret_aul = aul_open_app(package);
-       if (ret_aul < AUL_R_OK) {
-
-               if (ret_aul == AUL_R_EREJECTED && cooldown_mode_warning_get()) {
-                       util_create_toast_popup(win, _("IDS_SM_BODY_THE_DEVICE_TEMPERATURE_IS_TOO_HIGH"));
-               } else {
-                       char* inform;
-                       char* inform_with_ret;
-                       int len;
-
-                       // IDS_AT_TPOP_UNABLE_TO_OPEN_PS : "Unable to open %s"
-                       len = strlen(_("IDS_AT_TPOP_UNABLE_TO_OPEN_PS")) + strlen(name) + SPARE_LEN;
-
-                       inform = calloc(len, sizeof(char));
-                       if (!inform) {
-                               _E("cannot calloc for information");
-                               return;
-                       }
-                       snprintf(inform, len, _("IDS_AT_TPOP_UNABLE_TO_OPEN_PS"), name);
-
-                       inform_with_ret = calloc(len, sizeof(char));
-                       if (!inform_with_ret) {
-                               _E("cannot calloc for information");
-                               free(inform);
-                               return;
-                       }
-                       snprintf(inform_with_ret, len, "%s(%d)", inform, ret_aul);
-                       notification_status_message_post(inform_with_ret);
-
-                       free(inform);
-                       free(inform_with_ret);
-               }
-       } else {
-               _D("Launch app's ret : [%d]", ret_aul);
-               _T(package);
-
-               Evas_Object *layout = evas_object_data_get(win, DATA_KEY_LAYOUT);
-               ret_if(NULL == layout);
-               ecore_timer_add(LAYOUT_BLOCK_INTERVAL, _unblock_cb, layout);
-       }
-}
-
-
-
-HAPI void apps_util_launch_main_operation(Evas_Object *win, const char *app_id, const char *name)
-{
-       ret_if(NULL == app_id);
-
-       if (!name) name = app_id;
-       app_control_h service = NULL;
-       ret_if(APP_CONTROL_ERROR_NONE != app_control_create(&service));
-       ret_if(NULL == service);
-
-       app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
-       app_control_set_app_id(service, app_id);
-
-       home_dbus_cpu_booster_signal_send();
-
-       int ret = app_control_send_launch_request(service, NULL, NULL);
-       if (APP_CONTROL_ERROR_NONE != ret) {
-
-               if (ret == APP_CONTROL_ERROR_LAUNCH_REJECTED && cooldown_mode_warning_get()) {
-                       util_create_toast_popup(win, _("IDS_SM_BODY_THE_DEVICE_TEMPERATURE_IS_TOO_HIGH"));
-               } else {
-                       char* inform;
-                       char* inform_with_ret;
-                       int len;
-
-                       // IDS_AT_TPOP_UNABLE_TO_OPEN_PS : "Unable to open %s"
-                       len = strlen(_("IDS_AT_TPOP_UNABLE_TO_OPEN_PS")) + strlen(name) + SPARE_LEN;
-
-                       inform = calloc(len, sizeof(char));
-                       if (!inform) {
-                               _E("cannot calloc for information");
-                               goto ERROR;
-                       }
-                       snprintf(inform, len, _("IDS_AT_TPOP_UNABLE_TO_OPEN_PS"), name);
-
-                       inform_with_ret = calloc(len, sizeof(char));
-                       if (!inform_with_ret) {
-                               _E("cannot calloc for information");
-                               free(inform);
-                               goto ERROR;
-                       }
-                       snprintf(inform_with_ret, len, "%s(%d)", inform, ret);
-                       notification_status_message_post(inform_with_ret);
-
-                       free(inform);
-                       free(inform_with_ret);
-               }
-       } else {
-               _SD("Launch an app(%s:%s) ret : [%d]", app_id, name, ret);
-               _T(app_id);
-
-               Evas_Object *layout = evas_object_data_get(win, DATA_KEY_LAYOUT);
-               ret_if(NULL == layout);
-               ecore_timer_add(LAYOUT_BLOCK_INTERVAL, _unblock_cb, layout);
-       }
-
-ERROR:
-       app_control_destroy(service);
-}
-
-
-
-HAPI void apps_util_launch_with_arg(Evas_Object *win, const char *app_id, const char *arg, const char *name)
-{
-       ret_if(NULL == app_id);
-       ret_if(NULL == arg);
-
-       if (!name) name = app_id;
-       if (LAUNCH_WITH_SPECIAL_ROUTINE && _launch_special_package(app_id, name))
-               return;
-
-       _SD("Argument:(%s)", arg);
-       int len = strlen(arg);
-
-       bundle *b = NULL;
-       b = bundle_decode((bundle_raw *) arg, len);
-
-       /* AUL requests : Reset the caller appid as App-tray */
-       const char *value = (char *)bundle_get_val(b, AUL_K_CALLER_APPID);
-       if (value) bundle_del(b, AUL_K_CALLER_APPID);
-
-       home_dbus_cpu_booster_signal_send();
-
-       int ret = aul_launch_app(app_id, b);
-       bundle_free(b);
-
-       if (0 > ret) {
-               char* inform;
-               char* inform_with_ret;
-               int len;
-
-               // IDS_AT_TPOP_UNABLE_TO_OPEN_PS : "Unable to open %s"
-               len = strlen(_("IDS_AT_TPOP_UNABLE_TO_OPEN_PS")) + strlen(name) + SPARE_LEN;
-
-               inform = calloc(len, sizeof(char));
-               if (!inform) {
-                       _E("cannot calloc for information");
-                       return;
-               }
-               snprintf(inform, len, _("IDS_AT_TPOP_UNABLE_TO_OPEN_PS"), name);
-
-               inform_with_ret = calloc(len, sizeof(char));
-               if (!inform_with_ret) {
-                       _E("cannot calloc for information");
-                       free(inform);
-                       return;
-               }
-               snprintf(inform_with_ret, len, "%s(%d)", inform, ret);
-               notification_status_message_post(inform_with_ret);
-
-               free(inform);
-               free(inform_with_ret);
-       } else {
-               _SD("Launch an app(%s:%s) ret : [%d]", app_id, name, ret);
-               _T(app_id);
-
-               Evas_Object *layout = evas_object_data_get(win, DATA_KEY_LAYOUT);
-               ret_if(NULL == layout);
-               ecore_timer_add(LAYOUT_BLOCK_INTERVAL, _unblock_cb, layout);
-       }
-}
-
-
-
-HAPI void apps_util_launch_with_bundle(Evas_Object *win, const char *app_id, bundle *b, const char *name)
-{
-       ret_if(NULL == app_id);
-       ret_if(NULL == b);
-
-       if (!name) name = app_id;
-       if (LAUNCH_WITH_SPECIAL_ROUTINE && _launch_special_package(app_id, name))
-               return;
-
-       home_dbus_cpu_booster_signal_send();
-
-       int ret = aul_launch_app(app_id, b);
-       if (0 > ret) {
-               char* inform;
-               char* inform_with_ret;
-               int len;
-
-               // IDS_AT_TPOP_UNABLE_TO_OPEN_PS : "Unable to open %s"
-               len = strlen(_("IDS_AT_TPOP_UNABLE_TO_OPEN_PS")) + strlen(name) + SPARE_LEN;
-
-               inform = calloc(len, sizeof(char));
-               if (!inform) {
-                       _E("cannot calloc for information");
-                       return;
-               }
-               snprintf(inform, len, _("IDS_AT_TPOP_UNABLE_TO_OPEN_PS"), name);
-
-               inform_with_ret = calloc(len, sizeof(char));
-               if (!inform_with_ret) {
-                       _E("cannot calloc for information");
-                       free(inform);
-                       return;
-               }
-               snprintf(inform_with_ret, len, "%s(%d)", inform, ret);
-               notification_status_message_post(inform_with_ret);
-
-               free(inform);
-               free(inform_with_ret);
-       } else {
-               _SD("Launch an app(%s:%s) ret : [%d]", app_id, name, ret);
-               _T(app_id);
-
-               Evas_Object *layout = evas_object_data_get(win, DATA_KEY_LAYOUT);
-               ret_if(NULL == layout);
-               ecore_timer_add(LAYOUT_BLOCK_INTERVAL, _unblock_cb, layout);
-       }
-}