2 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <Elementary.h>
22 #include <efl_assist.h>
27 #include <privilege_info.h>
28 #include <package-manager.h>
29 #include <package-manager-types.h>
31 #include "installer.h"
32 #include "installer_package_manager.h"
33 #include "installer_util.h"
35 #define KEY_MIME_CONTENT "__AUL_MIME_CONTENT__"
36 #define KEY_MIME_CONTENT_NEW "__APP_SVC_URI__"
38 #define LOCALE_FILE_NAME "org.tizen.installer"
39 #define LOCALEDIR "/usr/apps/org.tizen.installer/res/locale"
41 #define POP_MSG_SIZE 512
43 typedef struct _appdata
54 package_manager_pkg_detail_info_t *install_pkginfo;
57 typedef struct _item_data
68 struct text_part main_txt[] =
70 {"txt_title", N_("Installer"),},
71 {"txt_mesg", N_("install"),},
74 int create_base_gui(appdata *ad);
75 int create_popup_base_gui(appdata *ad);
76 static void _create_reinstall_popup(appdata *ad, const char* btn_str, const char* detail);
77 static void _create_error_popup(appdata *ad);
79 package_manager_pkg_detail_info_t *g_package_info = NULL;
83 static char *_gl_label_get(void *data, Evas_Object *obj, const char *part)
85 LOGD("%s part(%s)", __func__, part);
86 if (!strcmp(part, "elm.text.main.left.top"))
89 item_data *item = (item_data *)data;
91 privilege_info_get_privilege_display_name(item->privilege, &name);
94 else if (!strcmp(part, "elm.text.sub.left.bottom"))
96 char *description = NULL;
97 item_data *item = (item_data *)data;
99 privilege_info_get_privilege_description(item->privilege, &description);
102 else if (!strcmp(part, "elm.text.multiline"))
104 return strdup((char *)data);
111 static char *_gl_text_get(void *data, Evas_Object *obj, const char *part)
113 LOGD("%s part(%s)", __func__, part);
114 if (!strcmp(part, "elm.text.multiline"))
118 return strdup(_("IDS_APINST_BODY_THIS_APPLICATION_MAY_BE_HARMFUL_AND_DAMAGE_YOUR_DEVICE_OR_DATA"));
125 static char *_gl_group_text_get(void *data, Evas_Object *obj, const char *part)
127 LOGD("%s part(%s)", __func__, part);
128 if (!strcmp(part, "elm.text.multiline"))
132 return strdup(_("IDS_APINST_HEADER_WARNING"));
134 else if ((int)data == 1)
136 return strdup(_("IDS_APINST_HEADER_PERMISSION_REQUESTS_ABB"));
142 static void _gl_exp_ndepth(void *data, Evas_Object *obj, void *event_info)
145 Elm_Object_Item *parent = event_info;
146 Evas_Object *gl = elm_object_item_widget_get(parent);
148 char content[1024] = {0,};
149 char *name = NULL, *description = NULL;
151 item_data *item = (item_data *)elm_object_item_data_get(parent);
156 LOGD("%s is_selected(%d)", __func__, item->is_selected);
158 if (item->is_selected)
160 item->is_selected = false;
161 elm_genlist_item_subitems_clear(event_info);
165 res = privilege_info_get_privilege_display_name(item->privilege, &name);
168 LOGE("%s privilege_info_get_privilege_display_name() failed. (privilege: %s)", __func__, item->privilege);
171 res = privilege_info_get_privilege_description(item->privilege, &description);
174 LOGE("%s privilege_info_get_privilege_description() failed. (privilege: %s)", __func__, item->privilege);
176 snprintf(content, sizeof(content), "%s<br><br>%s", name, description);
178 Elm_Genlist_Item_Class *itc1;
179 itc1 = elm_genlist_item_class_new();
181 LOGE("out of memory");
190 itc1->item_style = "multiline_sub";
191 itc1->func.text_get = _gl_label_get;
193 it = elm_genlist_item_append(gl, itc1, content, parent, ELM_GENLIST_ITEM_NONE, NULL, NULL);
194 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
196 item->is_selected = true;
197 elm_genlist_item_class_free(itc1);
206 void _region_changed(app_event_info_h event_info, void* user_data)
208 LOGD("%s", __func__);
211 void update_ts(Evas_Object *eo, struct text_part *tp, int size)
213 LOGD("%s", __func__);
216 if (eo == NULL || tp == NULL || size < 0) {
220 for (i = 0; i < size; i++) {
221 if (tp[i].part && tp[i].msgid) {
222 edje_object_part_text_set(eo, tp[i].part, _(tp[i].msgid));
228 void _lang_changed(app_event_info_h event_info, void* user_data)
230 LOGD("%s", __func__);
231 appdata* ad = user_data;
233 if (ad->layout == NULL) {
237 update_ts(elm_layout_edje_get(ad->layout), main_txt, sizeof(main_txt)/sizeof(main_txt[0]));
241 void _orient_changed(app_event_info_h event_info, void* user_data)
243 LOGD("%s", __func__);
244 appdata* ap = (appdata*)user_data;
245 app_device_orientation_e orientation = app_get_device_orientation();
251 case APP_DEVICE_ORIENTATION_0:
256 case APP_DEVICE_ORIENTATION_90:
261 case APP_DEVICE_ORIENTATION_180:
266 case APP_DEVICE_ORIENTATION_270:
275 elm_win_rotation_with_resize_set(ap->win, degree);
280 bool _keydown_cb(void *data, int type, void *event)
282 LOGD("%s",__func__ );
283 Ecore_Event_Key* ev = event;
284 if (!strcmp(ev->keyname, KEY_END)) {
290 void _main_quit_cb(void* user_data, Evas_Object* obj, void *event_info)
292 LOGD("%s", __func__);
296 void _main_quit_signal_cb(void* data, Evas_Object* obj, const char *emission, const char *source)
298 LOGD("%s", __func__);
302 void _reinstall_cb(void* user_data, Evas_Object* obj, void *event_info)
304 LOGD("%s", __func__);
309 LOGE("user_data is NULL.");
312 ad = (appdata*)user_data;
314 res = create_base_gui(ad);
317 LOGE("%s create_base_gui() failed.(%d)", __func__, res);
319 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,(Ecore_Event_Handler_Cb)_keydown_cb, NULL); // Control back key
322 static void _create_reinstall_popup(appdata *ad, const char* btn_str, const char* detail)
326 Evas_Object *ly = ad->win;
329 popup = elm_popup_add(ly);
330 ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
331 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
332 elm_object_text_set(popup, detail);
335 btn = elm_button_add(popup);
336 elm_object_style_set(btn, "popup");
337 elm_object_text_set(btn, _("IDS_360V_BUTTON_CANCEL_ABB"));
338 ea_theme_object_color_replace(btn, "W011", "W0112");
339 elm_object_part_content_set(popup, "button1", btn);
340 evas_object_smart_callback_add(btn, "clicked", _main_quit_cb, ad);
342 /* Reinstall button */
343 btn = elm_button_add(popup);
344 elm_object_style_set(btn, "popup");
345 elm_object_text_set(btn, btn_str);
346 ea_theme_object_color_replace(btn, "W011", "W0111");
347 elm_object_part_content_set(popup, "button2", btn);
348 evas_object_smart_callback_add(btn, "clicked", _reinstall_cb, ad);
350 evas_object_show(popup);
354 static void _create_error_popup(appdata *ad)
358 Evas_Object *win = ad->win;
361 popup = elm_popup_add(win);
362 ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
363 elm_object_part_text_set(popup, "title,text", "Error.");
364 elm_object_text_set(popup, _("IDS_APINST_POP_UNABLE_TO_INSTALL_THIS_FILE_THE_FORMAT_IS_INVALID"));
367 btn = elm_button_add(popup);
368 elm_object_style_set(btn, "popup");
369 elm_object_text_set(btn, "OK");
370 elm_object_part_content_set(popup, "button1", btn);
371 evas_object_smart_callback_add(btn, "clicked", _main_quit_cb, ad);
372 evas_object_show(popup);
377 win_delete_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
379 /* To make your application go to background,
380 Call the elm_win_lower() instead
381 Evas_Object *win = (Evas_Object *) data;
382 elm_win_lower(win); */
387 static int __parse_argv(int argc, char **argv, char **file_path)
389 LOGD("%s", __func__);
390 static bundle *b = NULL;
396 b = bundle_import_from_argv(argc, argv);
399 LOGD("%s bundle for bundle_import_from_argv is NULL", __func__);
403 if(bundle_get_val(b, KEY_MIME_CONTENT_NEW))
405 *file_path = (char *)bundle_get_val(b, KEY_MIME_CONTENT_NEW);
409 *file_path = (char *)bundle_get_val(b, KEY_MIME_CONTENT);
419 static void _button_clicked_cb(void *data, Evas_Object * obj, void *event_info)
424 SECURE_LOGD("pkg_name(%s), pkgid(%s) label(%s)",
425 ad->install_pkginfo->pkg_name,
426 ad->install_pkginfo->pkgid,
427 ad->install_pkginfo->label
430 int res = launch_install_service(ad->file_path, ad->install_pkginfo);
433 LOGE("%s launch_install_service() failed.", __func__);
437 static void _gl_sel(void *data, Evas_Object *obj, void *ei)
440 Eina_Bool expanded = EINA_FALSE;
442 elm_genlist_item_selected_set(ei, EINA_FALSE);
444 expanded = elm_genlist_item_expanded_get(ei);
445 elm_genlist_item_expanded_set(ei, !expanded);
448 static Evas_Object *_gl_btn_text_get(void *data, Evas_Object *obj, const char *part)
450 LOGD("%s part(%s)", __func__, part);
451 if (!strcmp(part, "elm.icon.entry"))
453 Evas_Object *btn = elm_button_add(obj);
454 elm_object_style_set(btn, "popup");
455 elm_object_text_set(btn, _("IDS_APINST_BUTTON_ALLOW_AND_INSTALL_ABB"));
456 evas_object_propagate_events_set(btn, EINA_FALSE);
457 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1);
458 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459 evas_object_smart_callback_add(btn, "clicked", _button_clicked_cb, data);
467 static Evas_Object *_create_content(appdata *data)
472 Evas_Object *genlist;
473 Evas_Object *nf = ad->nf;
474 Elm_Object_Item *git;
475 item_data *item = NULL;
477 Elm_Genlist_Item_Class *itc, *itc_group, *itc_sep_empty, *itc_expandable_box, *itc_btn_install;
479 itc = elm_genlist_item_class_new();
483 itc_group = elm_genlist_item_class_new();
484 if (itc_group == NULL) {
485 elm_genlist_item_class_free(itc);
489 itc_sep_empty = elm_genlist_item_class_new();
490 if (itc_sep_empty == NULL) {
491 elm_genlist_item_class_free(itc_group);
492 elm_genlist_item_class_free(itc);
496 itc_expandable_box = elm_genlist_item_class_new();
497 if (itc_expandable_box == NULL) {
498 elm_genlist_item_class_free(itc_sep_empty);
499 elm_genlist_item_class_free(itc_group);
500 elm_genlist_item_class_free(itc);
504 itc_btn_install = elm_genlist_item_class_new();
505 if (itc_btn_install == NULL) {
506 elm_genlist_item_class_free(itc_expandable_box);
507 elm_genlist_item_class_free(itc_sep_empty);
508 elm_genlist_item_class_free(itc_group);
509 elm_genlist_item_class_free(itc);
513 itc_group->item_style = "multiline_main";
514 itc_group->func.text_get = _gl_group_text_get;
516 itc->item_style = "multiline_sub";
517 itc->func.text_get = _gl_text_get;
519 itc_sep_empty->item_style = "empty_area";
521 itc_expandable_box->item_style = "2line.top";
522 itc_expandable_box->func.text_get = _gl_label_get;
524 itc_btn_install->item_style = "entry";
525 itc_btn_install->func.content_get = _gl_btn_text_get;
527 genlist = elm_genlist_add(nf);
528 elm_genlist_realization_mode_set(genlist, EINA_TRUE);
530 // If multiline text (multiline entry or multiline textblock or sliding mode)
531 // is used, use compress mode for compressing width to fit the viewport width.
532 // So genlist can calculate item's height correctly.
533 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
534 printf("Compress mode enabled\n");
537 // In dialogue group ***********************************
538 git = elm_genlist_item_append(genlist, itc_group, (void *)0, NULL,
539 ELM_GENLIST_ITEM_NONE, NULL, NULL);
540 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
542 git = elm_genlist_item_append(genlist, itc, (void *)0, NULL,
543 ELM_GENLIST_ITEM_NONE, NULL, NULL);
544 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
546 // Expandable box in dialogue group
547 if (g_list_length(ad->install_pkginfo->privilege_list) > 0)
551 git = elm_genlist_item_append(genlist, itc_group, (void *)1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
552 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
554 for (i=0; i< g_list_length(ad->install_pkginfo->privilege_list); i++)
557 item = calloc(sizeof(item_data), 1);
559 LOGE("out of memory");
563 item->is_selected = false;
564 item->privilege = g_list_nth_data(ad->install_pkginfo->privilege_list, i);
566 elm_genlist_item_append(genlist, itc_expandable_box, item
567 , NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, NULL
570 evas_object_smart_callback_add(genlist, "selected", _gl_exp_ndepth, genlist);
573 // Install button in dialogue group
574 elm_genlist_item_append(genlist, itc_btn_install, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
577 elm_genlist_item_class_free(itc);
578 elm_genlist_item_class_free(itc_group);
579 elm_genlist_item_class_free(itc_sep_empty);
580 elm_genlist_item_class_free(itc_expandable_box);
581 elm_genlist_item_class_free(itc_btn_install);
587 create_view(appdata *ad)
589 Evas_Object *nf = ad->nf;
590 Evas_Object *content, *ic;
591 Elm_Object_Item *navi_it;
592 char buf[PATH_MAX] = {0,};
593 package_manager_pkg_detail_info_t *package_info = (package_manager_pkg_detail_info_t *)ad->install_pkginfo;
595 content = _create_content(ad);
598 navi_it = elm_naviframe_item_push(nf, package_info->label, NULL, NULL, content, NULL);
601 ic = elm_image_add(nf);
602 snprintf(buf, sizeof(buf), "%s", ICON_PATH);
603 elm_image_file_set(ic, buf, NULL);
604 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
605 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
606 elm_object_item_part_content_set(navi_it, "elm.swallow.icon", ic);
610 static Evas_Object *__create_win(const char *name)
616 eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
618 elm_win_title_set(eo, name);
619 elm_win_borderless_set(eo, EINA_TRUE);
621 elm_win_alpha_set(eo, EINA_TRUE);
623 evas_object_smart_callback_add(eo, "delete,request", win_delete_request_cb, NULL);
624 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
625 evas_object_resize(eo, w, h);
627 ea_screen_reader_support_set(eo, EINA_TRUE);
633 static Evas_Object *__create_layout_main(Evas_Object * parent)
640 layout = elm_layout_add(parent);
644 elm_layout_theme_set(layout, "layout", "application", "default");
645 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
648 edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,content", "elm");
650 evas_object_show(layout);
655 int create_popup_base_gui(appdata *ad)
661 win = __create_win(PACKAGE);
667 ly = __create_layout_main(ad->win);
673 edje_object_signal_emit(elm_layout_edje_get(ad->layout), "elm,bg,show,transparent", "elm");
675 if (elm_win_wm_rotation_supported_get(ad->win))
677 int rots[4] = { 0, 90, 180, 270 };
678 elm_win_wm_rotation_available_rotations_set(ad->win, (const int*)(&rots), 4);
682 LOGE("%s win rotation no supported", __func__);
686 evas_object_show(win);
692 int create_base_gui(appdata *ad)
702 ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
703 elm_win_wm_desktop_layout_support_set(ad->win, EINA_TRUE);
704 elm_win_conformant_set(ad->win, EINA_TRUE);
705 elm_win_autodel_set(ad->win, EINA_TRUE);
707 if (elm_win_wm_rotation_supported_get(ad->win)) {
708 int rots[4] = { 0, 90, 180, 270 };
709 elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
712 evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
715 ad->conform = elm_conformant_add(ad->win);
716 evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
717 elm_win_resize_object_add(ad->win, ad->conform);
718 evas_object_show(ad->conform);
721 ad->layout = elm_layout_add(ad->conform);
722 evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
723 elm_layout_theme_set(ad->layout, "layout", "application", "default");
724 evas_object_show(ad->layout);
725 elm_object_content_set(ad->conform, ad->layout);
728 ad->nf = elm_naviframe_add(ad->layout);
729 elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
732 elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
736 /* Show window after base gui is set up */
737 evas_object_show(ad->win);
739 ea_object_event_callback_add(ad->nf, EA_CALLBACK_BACK, ea_naviframe_back_cb, NULL);
740 ea_object_event_callback_add(ad->nf, EA_CALLBACK_MORE, ea_naviframe_more_cb, NULL);
747 package_manager_pkg_detail_info_t* _get_packageInfo(char *file_path)
749 package_manager_pkg_detail_info_t *package_info = NULL;
751 if (file_path == NULL)
753 LOGE("%s file_path is NULL.", __func__);
757 package_info = (package_manager_pkg_detail_info_t*)get_package_info_from_file(file_path);
758 if (package_info == NULL)
760 LOGE("%s package_info is NULL", __func__);
764 SECURE_LOGD("%s filepath(%s) package(%s) pkgid(%s) version(%s) type(%s) description(%s), label(%s), icon_size(%d), icon_buf(%s)"
767 , package_info->pkg_name
768 , package_info->pkgid
769 , package_info->version
770 , package_info->pkg_type
771 , package_info->pkg_description
772 , package_info->label
773 , package_info->icon_size
774 , package_info->icon_buf
780 static bool _app_create(void* user_data)
782 LOGD("%s", __func__);
788 bind = bindtextdomain(LOCALE_FILE_NAME, LOCALEDIR);
791 LOGE("bindtextdomain failed.");
793 LOGD("LOCALE file name is %s", bind);
796 LOGE("user_data is NULL.");
799 ad = (appdata*)user_data;
801 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,(Ecore_Event_Handler_Cb)_keydown_cb, NULL); // Control back key
806 ad->install_pkginfo = _get_packageInfo(ad->file_path);
807 if (ad->install_pkginfo == NULL)
809 LOGE("%s _get_packageInfo() failed.", __func__);
810 create_popup_base_gui(ad);
811 _create_error_popup(ad);
815 if (is_valid_version(ad->install_pkginfo->version) < 0)
817 LOGE("%s is_valid_version() failed. Package version is invalid.", __func__);
818 res = create_popup_base_gui(ad);
819 _create_error_popup(ad);
823 if (is_package_installed(ad->install_pkginfo->pkgid))
825 res = create_popup_base_gui(ad);
828 LOGE("%s create_popup_base_gui() failed(%d).", __func__, res);
832 char *current_pkg_version = NULL;
834 res = get_package_version(ad->install_pkginfo->pkgid, ¤t_pkg_version);
837 LOGE("%s get_package_version() failed(%d).", __func__, res);
838 _create_error_popup(ad);
842 res = compare_version(current_pkg_version, ad->install_pkginfo->version);
845 LOGE("%s compare_version() failed.", __func__);
846 _create_error_popup(ad);
847 free(current_pkg_version);
850 LOGI("compare_version() = %d (old:%s, new:%s)", res, current_pkg_version, ad->install_pkginfo->version);
852 if (res == VERSION_SAME)
854 LOGI("VERSION_SAME");
855 char popup_msg[POP_MSG_SIZE] = {0, };
856 char *inst_ver = NULL;
857 char *dwnl_ver = NULL;
858 temp = strdup(_("IDS_APINST_POP_THIS_VERSION_IS_ALREADY_INSTALLED_ON_YOUR_DEVICE_IT_WILL_BE_REINSTALLED"));
861 LOGE("strdup has failed");
864 inst_ver = strdup(_("IDS_APINST_BODY_INSTALLED_VERSION_C_ABB"));
867 LOGE("inst_ver string is null");
869 dwnl_ver = strdup(_("IDS_APINST_BODY_DOWNLOADED_VERSION_C_ABB"));
872 LOGE("downloaded version string is null");
874 sprintf(popup_msg, "%s<br><br> %s %s<br> %s %s", temp, inst_ver, current_pkg_version, dwnl_ver, ad->install_pkginfo->version);
875 _create_reinstall_popup(ad, _("IDS_APINST_BUTTON_REINSTALL"), popup_msg);
884 else if (res == VERSION_NEW)
887 char popup_msg[POP_MSG_SIZE] = {0, };
888 char *inst_ver = NULL;
889 char *dwnl_ver = NULL;
890 temp = strdup(_("IDS_APINST_POP_AN_OLDER_VERSION_IS_ALREADY_INSTALLED_ON_YOUR_DEVICE_IT_WILL_BE_UPDATED"));
893 LOGE("strdup has failed");
896 inst_ver = strdup(_("IDS_APINST_BODY_INSTALLED_VERSION_C_ABB"));
899 LOGE("inst_ver string is null");
901 dwnl_ver = strdup(_("IDS_APINST_BODY_DOWNLOADED_VERSION_C_ABB"));
904 LOGE("downloaded version string is null");
906 sprintf(popup_msg, "%s<br><br> %s %s<br> %s %s", temp, inst_ver, current_pkg_version, dwnl_ver, ad->install_pkginfo->version);
907 _create_reinstall_popup(ad, _("IDS_APINST_BUTTON_UPDATE"), popup_msg);
916 else if (res == VERSION_OLD)
919 char popup_msg[POP_MSG_SIZE] = {0, };
920 char *inst_ver = NULL;
921 char *dwnl_ver = NULL;
922 temp = strdup(_("IDS_APINST_POP_A_NEWER_VERSION_IS_ALREADY_INSTALLED_ON_YOUR_DEVICE_IT_WILL_BE_REPLACED_WITH_THE_OLDER_VERSION"));
925 LOGE("strdup has failed");
927 inst_ver = strdup(_("IDS_APINST_BODY_INSTALLED_VERSION_C_ABB"));
930 LOGE("inst_ver string is null");
932 dwnl_ver = strdup(_("IDS_APINST_BODY_DOWNLOADED_VERSION_C_ABB"));
935 LOGE("downloaded version string is null");
937 sprintf(popup_msg, "%s<br><br> %s %s<br> %s %s", temp, inst_ver, current_pkg_version, dwnl_ver, ad->install_pkginfo->version);
938 _create_reinstall_popup(ad, _("IDS_APINST_BUTTON_REINSTALL"), popup_msg);
948 free(current_pkg_version);
953 LOGI("%s create_base_gui() called.", __func__);
954 res = create_base_gui(ad);
957 LOGE("%s create_base_gui() failed(%d).", __func__, res);
967 static void _app_pause(void* user_data)
969 LOGD("%s", __func__);
973 static void _app_resume(void* user_data)
975 LOGD("%s", __func__);
978 static void _app_terminate(void* user_data)
980 LOGD("%s", __func__);
984 int main(int argc, char* argv[])
986 LOGD("Start installer main()");
988 ui_app_lifecycle_callback_s event_callback = {0,};
990 app_event_handler_h lang_changed_handler;
991 app_event_handler_h orient_changed_handler;
992 app_event_handler_h region_changed_handler;
994 event_callback.create = _app_create;
995 event_callback.terminate = _app_terminate;
996 event_callback.pause = _app_pause;
997 event_callback.resume = _app_resume;
999 ui_app_add_event_handler(&lang_changed_handler, APP_EVENT_LANGUAGE_CHANGED, _lang_changed, &ad);
1000 ui_app_add_event_handler(&orient_changed_handler, APP_EVENT_DEVICE_ORIENTATION_CHANGED, _orient_changed, &ad);
1001 ui_app_add_event_handler(®ion_changed_handler, APP_EVENT_REGION_FORMAT_CHANGED, _region_changed, &ad);
1004 const char *extension;
1006 if (__parse_argv(argc, argv, &file_path))
1008 LOGE("%s Failed to parse argv!", __func__);
1012 if (strncmp(file_path, "file", 4) == 0)
1014 ad.file_path = modify_file_path(file_path);
1018 ad.file_path = file_path;
1021 extension = get_file_extension(file_path);
1022 ad.extension = (char*)extension;
1024 SECURE_LOGI("%s install file_path(%s), extension(%s)", __func__, ad.file_path, ad.extension);
1026 int ret = ui_app_main(argc, argv, &event_callback, &ad);
1027 if (ret != APP_ERROR_NONE) {
1028 LOGE("ui_app_main() is failed. err = %d", ret);
1031 LOGD("End installer main()");