Sync with 3.0 branch : Apply for Appcontrol implementation 50/155050/1 accepted/tizen/unified/20171016.144021 submit/tizen/20171013.045632 submit/tizen/20171015.234740
authorjh8801.jung <jh8801.jung@samsung.com>
Thu, 12 Oct 2017 02:46:48 +0000 (11:46 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 12 Oct 2017 04:00:50 +0000 (04:00 +0000)
Signed-off-by: jh8801.jung <jh8801.jung@samsung.com>
Change-Id: I53690e131c3fbbf0dccdce9db3834a71de40badc

mobile/src/ug-nfc-setting-main.c
mobile/ug-nfc-efl.xml
packaging/ug-nfc-efl.spec
wearable/app/include/nsa-debug.h
wearable/app/include/nsa-main.h
wearable/app/src/nsa-main.c
wearable/app/src/nsa-ui-widget.c
wearable/app/src/nsa-view-main.c
wearable/app/src/nsa-view-tap-n-pay.c

index 63277b8..850f439 100755 (executable)
@@ -77,8 +77,12 @@ static bool __reply_to_launch_request(app_control_h service, app_control_result_
 
                if (operation != NULL) {
                        LOGD("reply to launch request : operation %s", operation);
-                       app_control_reply_to_launch_request(reply, service, result);
-                       ret = true;
+                       if (strncmp(operation, APP_CONTROL_OPERATION_SETTING_NFC,
+                               strlen(APP_CONTROL_OPERATION_SETTING_NFC)) == 0) {
+                               LOGD("reply to launch request : operation %s", operation);
+                               app_control_reply_to_launch_request(reply, service, result);
+                               ret = true;
+                       }
                }
 
                app_control_destroy(reply);
index 694fe54..5c58950 100755 (executable)
@@ -10,4 +10,8 @@
                        <operation name="http://tizen.org/appcontrol/operation/setting/nfc"/>
                </app-control>
        </ui-application>
+       <privileges>
+               <privilege>http://tizen.org/privilege/nfc</privilege>
+               <privilege>http://tizen.org/privilege/nfc.admin</privilege>
+       </privileges>
 </manifest>
index 2659473..45c9e14 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ug-nfc-efl
 Summary:    NFC Setting UI
-Version:    3.1.7
+Version:    3.1.8
 Release:    0
 Group:      App/Network
 License:    Flora-1.1
@@ -180,6 +180,8 @@ mv wearable_ins/* %{buildroot}/%{_prefix}/apps/org.tizen.nfc-setting-app/
 # if common || tv || ivi || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "mobile"
 %post profile_common
+mkdir -p /usr/ug/bin/
+ln -sf /usr/bin/ug-client /usr/ug/bin/ug-nfc-efl
 mkdir -p /usr/ug/lib
 ln -sf /usr/ug/common/lib/libug-nfc-efl* /usr/ug/lib/
 
@@ -191,6 +193,8 @@ rm /usr/ug/lib/libug-nfc-efl*
 # if mobile || "undefined"
 %if "%{?profile}" != "common" && "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
 %post profile_mobile
+mkdir -p /usr/ug/bin/
+ln -sf /usr/bin/ug-client /usr/ug/bin/ug-nfc-efl
 mkdir -p /usr/ug/lib
 ln -sf /usr/ug/mobile/lib/libug-nfc-efl* /usr/ug/lib/
 
index 39e13e0..4ca1040 100644 (file)
@@ -141,4 +141,5 @@ extern "C"
 #ifdef __cplusplus
 }
 #endif
-#endif /* __NFC_SETTING_APP_DEBUG_H__ */
\ No newline at end of file
+
+#endif /* __NFC_SETTING_APP_DEBUG_H__ */
index 8b2c1ef..93cbca0 100755 (executable)
@@ -80,6 +80,7 @@ typedef struct {
        Evas_Object *radio_main;
 
        nsa_operation_type op_type;
+       app_control_h service;
 } appdata;
 
 #ifdef __cplusplus
index 482cf04..57c0845 100755 (executable)
@@ -115,22 +115,17 @@ static void __parse_service(app_control_h service, void *user_data)
        NSA_DEBUG("extra data [%s] >>>>> ", GET_SAFE_STRING(ex_data));
 
        ad->op_type = NSA_OP_NFC;
-       if (!ex_data) {
-               NSA_DEBUG_ERR("extra data is NULL");
-               goto end;
-       }
 
        if (strncmp(operation, APP_CONTROL_OPERATION_SETTING_NFC,
                        strlen(APP_CONTROL_OPERATION_SETTING_NFC)) == 0) {
                        /* launched by app-control */
-                       if (strncmp(ex_data, "nfc", strlen("nfc")) == 0) {
+                       app_control_clone(&(ad->service), service);
+                       if (!ex_data || strncmp(ex_data, "nfc", strlen("nfc")) == 0)
                                ad->op_type = NSA_OP_NFC;
-                       } else if (strncmp(ex_data, "tap_n_pay", strlen("tap_n_pay")) == 0) {
+                       else if (strncmp(ex_data, "tap_n_pay", strlen("tap_n_pay")) == 0)
                                ad->op_type = NSA_OP_TAP_N_PAY;
-                       }
        }
 
-end:
        NSA_MEM_FREE(operation);
        NSA_MEM_FREE(app_id);
        NSA_MEM_FREE(ex_data);
@@ -177,11 +172,10 @@ void _nsa_main_app_service(app_control_h service, void *user_data)
        __parse_service(service, ad);
 
        /* launch nss */
-       if (ad->op_type == NSA_OP_TAP_N_PAY){
+       if (ad->op_type == NSA_OP_TAP_N_PAY)
                _nsa_view_tap_n_pay_create(ad);
-       } else {
+       else
                _nsa_view_main_create(ad);
-       }
 
        elm_win_activate(ad->main_win);
 
index 1e8e677..4033c0f 100755 (executable)
@@ -139,7 +139,7 @@ Evas_Object* nsa_create_edj_layout(Evas_Object* parent,
 
        elm_object_focus_set(layout, EINA_FALSE);
 
-       if(edc_path != NULL)
+       if (edc_path != NULL)
                elm_layout_file_set(layout, EDJ_FILE, edc_path);
 
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
index b2cb7ff..55e5172 100755 (executable)
 #include "nsa-popup.h"
 #include "nsa-string.h"
 
+static bool __reply_to_launch_request(app_control_h service, app_control_result_e result)
+{
+       app_control_h reply;
+       bool ret = false;
+
+       LOGD("BEGIN >>>>");
+
+       if (service != NULL) {
+               LOGD("launched by NFC appcontrol");
+               app_control_create(&reply);
+               app_control_reply_to_launch_request(reply, service, result);
+               app_control_destroy(reply);
+               ret = true;
+       }
+
+       LOGD("END >>>>");
+       return ret;
+}
+
 static void __get_payment_handler(char **handler)
 {
        char *appid;
@@ -44,9 +63,8 @@ static void __get_payment_handler(char **handler)
                int ret;
 
                ret = pkgmgrinfo_pkginfo_get_pkginfo(appid, &pkginfo);
-               if (ret != 0) {
+               if (ret != 0)
                        return;
-               }
 
                ret = pkgmgrinfo_pkginfo_get_label(pkginfo, &label);
                if (ret != 0) {
@@ -98,6 +116,9 @@ static void __nfc_activation_completed_cb(nfc_error_e error,
        /* update ui after activation is completed */
        __update_onoff_obj(ad);
        __update_tap_and_pay_obj(ad);
+
+       if (__reply_to_launch_request(ad->service, APP_CONTROL_RESULT_SUCCEEDED) == true)
+               ui_app_exit();
 }
 
 static void __change_nfc_onoff_setting(void *data)
@@ -110,7 +131,7 @@ static void __change_nfc_onoff_setting(void *data)
        NSA_BEGIN();
 
        /* V1.9 : instead of toast popup, disable item during operation */
-       if(ad->on_off != NULL)
+       if (ad->on_off != NULL)
                elm_object_item_disabled_set(ad->on_off, true);
 
        result = nfc_manager_set_activation(!nfc_manager_is_activated(),
@@ -175,11 +196,10 @@ static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj,
 static char *__gl_text_get_nfc(void *data, Evas_Object *obj,
        const char *part)
 {
-       if (!strcmp(part, "elm.text")) {
+       if (!strcmp(part, "elm.text"))
                return strdup(IDS_NFC_NFC);
-       } else {
+       else
                return NULL;
-       }
 }
 
 static char *__gl_text_get_tap_n_pay(void *data, Evas_Object *obj,
@@ -193,9 +213,9 @@ static char *__gl_text_get_tap_n_pay(void *data, Evas_Object *obj,
                if (ad->payment_handler != NULL) {
                        NSA_DEBUG("ad->payment_handler : %s", ad->payment_handler);
                        return strdup(ad->payment_handler);
-               }
-               else
+               } else {
                        return NULL;
+               }
        } else {
                return NULL;
        }
@@ -271,7 +291,7 @@ static Evas_Object *__create_nfc_setting_list(void *data)
        return genlist;
 }
 
-static void __payment_handler_vconf_key_changed (keynode_t *key,
+static void __payment_handler_vconf_key_changed(keynode_t *key,
        void *data)
 {
        appdata *ad = data;
index d144887..cb1050c 100755 (executable)
@@ -188,16 +188,14 @@ static char *__get_launch_app_id(char *pkgid)
        NSA_DEBUG("__get_launch_app_id [%s]", pkgid);
 
        ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo);
-       if (ret != 0) {
+       if (ret != 0)
                return strdup(pkgid);
-       }
 
        ret = pkgmgrinfo_pkginfo_get_mainappid(pkginfo, &main_appid);
-       if (ret == 0) {
+       if (ret == 0)
                return strdup(main_appid);
-       } else {
+       else
                return strdup(pkgid);
-       }
 }
 
 static void __launch_application(char *appid)
@@ -225,9 +223,8 @@ static void __launch_application(char *appid)
        }
 
        ret = app_control_send_launch_request(service, NULL, NULL);
-       if(ret != APP_CONTROL_ERROR_NONE) {
+       if (ret != APP_CONTROL_ERROR_NONE)
                NSA_DEBUG_ERR("app_control_send_launch_request failed[%d]", ret);
-       }
 
 END:
        app_control_destroy(service);
@@ -321,11 +318,10 @@ static void __gl_list_clicked_cb(void *data, Evas_Object *obj,
 static char *__gl_text_get_title(void *data, Evas_Object *obj,
        const char *part)
 {
-       if (!strcmp(part, "elm.text")) {
+       if (!strcmp(part, "elm.text"))
                return strdup(IDS_TAP_AND_PAY);
-       } else {
+       else
                return NULL;
-       }
 }
 
 static char *__gl_text_get(void *data, Evas_Object *obj,