Merge branch 'tizen_5.5' into tizen 90/232490/1 accepted/tizen/unified/20200507.052320 submit/tizen/20200506.035916
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 6 May 2020 01:49:02 +0000 (10:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 6 May 2020 01:49:09 +0000 (10:49 +0900)
Change-Id: Iddd8f60d5f63c6bf53d0e2740ba6a76bd7715481

12 files changed:
consumer/sticker_consumer.c
doc/sticker_doc.h
include/sticker_consumer.h
include/sticker_data.h
include/sticker_provider.h
packaging/capi-ui-sticker.spec
receiver/inc/config.h
receiver/inc/ft.h
receiver/src/ft.cpp
receiver/src/main.cpp
receiver/tizen-manifest.xml
sticker-parser/sticker-parser.c

index 91de924..1c11f19 100644 (file)
@@ -539,7 +539,7 @@ EXPORT_API int sticker_consumer_add_recent_data(sticker_consumer_h consumer_hand
 
     int ret;
 
-    if (!consumer_handle || !data_handle || (data_handle->sticker_info_id > 0) || !data_handle->uri)
+    if (!consumer_handle || !data_handle || (data_handle->sticker_info_id <= 0) || !data_handle->uri)
         return STICKER_ERROR_INVALID_PARAMETER;
 
     ret = sticker_dbus_insert_recent_sticker_info(consumer_handle->gdbus_connection, data_handle->sticker_info_id);
@@ -599,7 +599,7 @@ cleanup:
     return ret;
 }
 
-EXPORT_API int sticker_consumer_set_event_callback(sticker_consumer_h consumer_handle, sticker_consumer_event_cb callback, void *user_data)
+EXPORT_API int sticker_consumer_set_event_cb(sticker_consumer_h consumer_handle, sticker_consumer_event_cb callback, void *user_data)
 {
     CHECK_STICKER_FEATURE();
 
@@ -612,7 +612,7 @@ EXPORT_API int sticker_consumer_set_event_callback(sticker_consumer_h consumer_h
     return STICKER_ERROR_NONE;
 }
 
-EXPORT_API int sticker_consumer_unset_event_callback(sticker_consumer_h consumer_handle)
+EXPORT_API int sticker_consumer_unset_event_cb(sticker_consumer_h consumer_handle)
 {
     CHECK_STICKER_FEATURE();
 
index 4c3b325..9938252 100644 (file)
@@ -25,6 +25,8 @@
  *
  * @section CAPI_UIX_STICKER_MODULE_OVERVIEW Overview
  * Using sticker library, a sticker application can provide sticker information to applications that want to read the sticker information as the standard specification.
+ * A <a href="https://en.wikipedia.org/wiki/Sticker_(messaging)">sticker</a> is an image (possibly animated) that is used in an IM conversation.
+ * The Sticker API covers the exchange of sticker data between applications. How the images are used depends on a particular sticker consumer application.
  *
  * @section CAPI_UIX_STICKER_MODULE_FEATURE Related Feature
  * This API is related with the following feature:\n
index 7231f26..322379c 100644 (file)
@@ -40,9 +40,9 @@ extern "C" {
  * @since_tizen 5.5
  */
 typedef enum {
-    STICKER_CONSUMER_EVENT_TYPE_INSERT, /**< Insert event type */
-    STICKER_CONSUMER_EVENT_TYPE_DELETE, /**< Delete event type */
-    STICKER_CONSUMER_EVENT_TYPE_UPDATE, /**< Update event type */
+    STICKER_CONSUMER_EVENT_TYPE_INSERT, /**< A sticker data has been added */
+    STICKER_CONSUMER_EVENT_TYPE_DELETE, /**< A sticker data has been removed */
+    STICKER_CONSUMER_EVENT_TYPE_UPDATE, /**< A sticker data has been updated */
 } sticker_consumer_event_type_e;
 
 /**
@@ -100,14 +100,14 @@ typedef void (*sticker_consumer_keyword_list_foreach_cb)(const char *keyword, vo
  * @since_tizen 5.5
  * @remarks @a data_handle should not be freed and can be used only in the callback.
  *          If you want to use it outside of the callback, you need to use a clone which can be obtained sticker_data_clone().
- *          When the @a event_type is STICKER_CONSUMER_EVENT_TYPE_DELETE, sticker data can be obtained using @a data_handle,
- *          but unable to access file because it has been deleted.
- * @param[in] event_type The event type of sticker
+ *          When the @a event_type is #STICKER_CONSUMER_EVENT_TYPE_DELETE, sticker data can be obtained using @a data_handle,
+ *          but the files have been already deleted.
+ * @param[in] event_type The event type
  * @param[in] data_handle The sticker data handle
- * @param[in] user_data The user data passed from sticker_consumer_set_event_callback()
- * @pre The callback can be registered using sticker_consumer_set_event_callback()
- * @see sticker_consumer_set_event_callback()
- * @see sticker_consumer_unset_event_callback()
+ * @param[in] user_data The user data passed from sticker_consumer_set_event_cb()
+ * @pre The callback can be registered using sticker_consumer_set_event_cb()
+ * @see sticker_consumer_set_event_cb()
+ * @see sticker_consumer_unset_event_cb()
  */
 typedef void (*sticker_consumer_event_cb)(sticker_consumer_event_type_e event_type, sticker_data_h data_handle, void *user_data);
 
@@ -289,7 +289,7 @@ int sticker_consumer_keyword_list_foreach_all(sticker_consumer_h consumer_handle
 int sticker_consumer_data_foreach_by_display_type(sticker_consumer_h consumer_handle, int offset, int count, int *result, sticker_data_display_type_e type, sticker_consumer_data_foreach_cb callback, void *user_data);
 
 /**
- * @brief Retrieves all group name in the sticker database using display type.
+ * @brief Retrieves all group names assigned to stickers with a matching display @a type.
  * @since_tizen 5.5
  * @param[in] consumer_handle The sticker consumer handle
  * @param[in] type The display type of the sticker for getting sticker data
@@ -306,7 +306,7 @@ int sticker_consumer_data_foreach_by_display_type(sticker_consumer_h consumer_ha
 int sticker_consumer_group_list_foreach_by_display_type(sticker_consumer_h consumer_handle, sticker_data_display_type_e type, sticker_consumer_group_list_foreach_cb callback, void *user_data);
 
 /**
- * @brief Add history to recently used stickers list
+ * @brief Adds entry to recently used stickers list.
  * @since_tizen 5.5
  * @param[in] consumer_handle The sticker consumer handle
  * @param[in] data_handle The sticker data handle
@@ -315,7 +315,7 @@ int sticker_consumer_group_list_foreach_by_display_type(sticker_consumer_h consu
  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
- * @see sticker_consumer_get_recent_list()
+ * @see sticker_consumer_get_recent_data_list()
  */
 int sticker_consumer_add_recent_data(sticker_consumer_h consumer_handle, sticker_data_h data_handle);
 
@@ -354,9 +354,9 @@ int sticker_consumer_get_recent_data_list(sticker_consumer_h consumer_handle, in
  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
  * @see sticker_consumer_event_cb()
- * @see sticker_consumer_unset_event_callback()
+ * @see sticker_consumer_unset_event_cb()
  */
-int sticker_consumer_set_event_callback(sticker_consumer_h consumer_handle, sticker_consumer_event_cb callback, void *user_data);
+int sticker_consumer_set_event_cb(sticker_consumer_h consumer_handle, sticker_consumer_event_cb callback, void *user_data);
 
 /**
  * @brief Unregisters a callback function.
@@ -368,9 +368,9 @@ int sticker_consumer_set_event_callback(sticker_consumer_h consumer_handle, stic
  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
  * @see sticker_consumer_event_cb()
- * @see sticker_consumer_set_event_callback()
+ * @see sticker_consumer_set_event_cb()
  */
-int sticker_consumer_unset_event_callback(sticker_consumer_h consumer_handle);
+int sticker_consumer_unset_event_cb(sticker_consumer_h consumer_handle);
 
 /**
  * @}
index e27197c..2a59af1 100644 (file)
@@ -50,7 +50,12 @@ typedef enum {
  */
 typedef enum {
     STICKER_DATA_DISP_EMOJI = 1, /**< Emoji type */
-    STICKER_DATA_DISP_WALLPAPER, /**< Wallpaper type */
+    /**
+     * @brief Wallpaper type
+     * @details The stickers of the wallpaper type are intended to be used by
+     * a wallpaper application and usually have larger size.
+     */
+    STICKER_DATA_DISP_WALLPAPER,
 } sticker_data_display_type_e;
 
 /**
@@ -219,7 +224,7 @@ int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword)
  * @retval #STICKER_ERROR_NONE Successful
  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sticker_data_get_group()
+ * @see sticker_data_get_group_name()
  */
 int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
 
@@ -234,7 +239,7 @@ int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #STICKER_ERROR_NO_DATA No data available
- * @see sticker_data_set_group()
+ * @see sticker_data_set_group_name()
  */
 int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
 
index 8271ad7..cdfbac4 100644 (file)
@@ -98,7 +98,7 @@ int sticker_provider_destroy(sticker_provider_h provider_handle);
  * @brief Inserts a sticker data to the sticker database.
  * @since_tizen 5.5
  * @remarks All data except thumbnail, description, display_type must be set in the @a data_handle to insert the sticker data.
- *          If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
+ *          If the URI type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
  *          It is recommended to delete your sticker file after inserting a sticker data.
  * @param[in] provider_handle The sticker provider handle
  * @param[in] data_handle The sticker data handle to be saved
@@ -115,15 +115,15 @@ int sticker_provider_destroy(sticker_provider_h provider_handle);
 int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_data_h data_handle);
 
 /**
- * @brief Inserts a sticker data using json file.
+ * @brief Inserts a sticker data using JSON file.
  * @details @a json_path must be a relative path like '/data/message_sticker.json'.
  * @since_tizen 5.5
- * @remarks All data except thumbnail, description, display_type must be set in the json file to insert the sticker data.
+ * @remarks All data except thumbnail, description, display_type must be set in the JSON file to insert the sticker data.
  *          @a json_path must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned.
- *          If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
+ *          If the URI type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
  *          It is recommended to delete your sticker files after inserting a sticker data.
  * @param[in] provider_handle The sticker provider handle
- * @param[in] json_path The path of json file containing sticker information to be saved
+ * @param[in] json_path The path of JSON file containing sticker information to be saved
  * @param[in] callback The callback function to invoke
  * @param[in] user_data The user data to be passed to the callback function
  * @return 0 on success, otherwise a negative error value
@@ -135,7 +135,7 @@ int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_dat
  * @see sticker_provider_insert_finished_cb()
  *
  * @code
- //json file format
+ //JSON file format
  {
     "sticker":
     [
@@ -201,7 +201,8 @@ int sticker_provider_update_data(sticker_provider_h provider_handle, sticker_dat
 int sticker_provider_delete_data(sticker_provider_h provider_handle, sticker_data_h data_handle);
 
 /**
- * @brief Deletes a sticker data in the sticker database using URI.
+ * @brief Deletes a sticker data with the given @a uri from the sticker database.
+ * @details If the database does not have a sticker that matches the given @a uri, the STICKER_ERROR_NO_SUCH_FILE error is returned.
  * @since_tizen 5.5
  * @param[in] provider_handle The sticker provider handle
  * @param[in] uri The URI of the sticker data to be deleted
index f68f19d..6a72000 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-ui-sticker
 Summary:    Sticker client library and daemon
-Version:    0.1.35
+Version:    0.1.40
 Release:    1
 Group:      Graphics & UI Framework/Input
 License:    Apache-2.0
index 10b742f..ecc3c10 100644 (file)
@@ -21,6 +21,7 @@
 #define ACCESSORY_SERVICE_CHANNEL_ID 107
 
 #define SYNC_INTERVAL 12*60*60
+#define MAX_WAIT_TIME 48*60*60
 
 #define REMOTE_APP_ID "com.samsung.w-input-selector"
 #define MESSAGE_PORT_REMOTE_NAME REMOTE_APP_ID"_msg_port_rcv"
index 90d506f..6c91c66 100644 (file)
@@ -35,6 +35,7 @@ void request_all_sticker_data(const char *mode, const char *type);
 bool request_sticker_data(const char *mode, const char *category, const char *type);
 void request_sticker_feature();
 void send_disconnect_message();
+void request_show_sync_notification();
 
 bool get_job_progress();
 
index 2d231d0..ae52546 100644 (file)
@@ -48,6 +48,7 @@
 #define STICKER_SYNC_FEATURE_REQ "sticker-sync-feature-req"
 #define STICKER_SYNC_FEATURE_RSP "sticker-sync-feature-rsp"
 #define STICKER_REQUEST_SYNC_REQ "sticker-request-sync-req"
+#define STICKER_REQUEST_NOTI_REQ "sticker-request-noti-req"
 #define STICKER_SYNC_START_REQ "sticker-sync-start-req"
 #define STICKER_SYNC_START_RSP "sticker-sync-start-rsp"
 #define STICKER_SEND_START_REQ "sticker-send-start-req"
@@ -211,7 +212,7 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
                 char thumb_path[PATH_MAX];
                 char *data_path = NULL;
                 data_path = app_get_shared_data_path();
-                sprintf(thumb_path, "%s/thumbnail/%s", data_path, incoming_file_name.c_str());
+                snprintf(thumb_path, sizeof(thumb_path), "%s/thumbnail/%s", data_path, incoming_file_name.c_str());
                 sticker_data.thumbnail_path = string(thumb_path);
 
                 if (data_path)
@@ -318,7 +319,7 @@ void accept_file()
 
     data_path = app_get_shared_data_path();
     LOGI("Path : %s", data_path);
-    sprintf(file_path, "%s/%s", data_path, incoming_file_name.c_str());
+    snprintf(file_path, sizeof(file_path), "%s/%s", data_path, incoming_file_name.c_str());
     LOGI("Receive filepath : %s", file_path);
     sticker_data.file_path = string(file_path);
 
@@ -346,7 +347,7 @@ static int _create_thumbnail_directory()
     char thumb_path[PATH_MAX];
     char *data_path = NULL;
     data_path = app_get_shared_data_path();
-    sprintf(thumb_path, "%s/thumbnail", data_path);
+    snprintf(thumb_path, sizeof(thumb_path), "%s/thumbnail", data_path);
 
     if (data_path)
         free(data_path);
@@ -488,6 +489,25 @@ void send_disconnect_message()
     json_object_unref(j_object);
 }
 
+void request_show_sync_notification()
+{
+    JsonObject *j_object = NULL;
+    j_object = json_object_new();
+    if (j_object == NULL) {
+        LOGE("json object create error");
+        return;
+    }
+
+    json_object_set_string_member(j_object, "msgId", STICKER_REQUEST_NOTI_REQ);
+    json_object_set_int_member(j_object, "tID", ++t_id);
+
+    if (_send_json_data(j_object) == FALSE) {
+        LOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
+    }
+
+    json_object_unref(j_object);
+}
+
 void reject_file()
 {
     int ret = sap_file_transfer_reject(priv_data.file_socket);
@@ -666,7 +686,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
     json_msgid = json_object_get_string_member(root_obj, "msgId");
     msg_id = string(json_msgid ? json_msgid : "");
     if (msg_id == STICKER_REQUEST_SYNC_REQ) {
-        request_all_sticker_data("auto", "input");
+        request_all_sticker_data("manual", "input");
     } else if (msg_id == STICKER_SYNC_FEATURE_RSP) {
         LOGD("msg : %s", msg_id.c_str());
 #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
index 0de1ef9..c959151 100644 (file)
@@ -99,10 +99,16 @@ static bool check_sync_time_condition()
 
         // compare time
         LOGD("current time : %f, last_sync_time : %f", ecore_time_get(), last_sync_time);
-        if (ecore_time_get() - last_sync_time > SYNC_INTERVAL)
-            result = true;
-        else
+
+        if (ecore_time_get() - last_sync_time > MAX_WAIT_TIME) {
+            request_show_sync_notification();
             result = false;
+        } else {
+            if (ecore_time_get() - last_sync_time > SYNC_INTERVAL)
+                result = true;
+            else
+                result = false;
+        }
     }
     else
     {
index 083dee3..829c920 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="org.tizen.sticker-receiver" version="1.0.35">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="org.tizen.sticker-receiver" version="1.0.40">
         <profile name="wearable" />
         <service-application appid="org.tizen.sticker-receiver" exec="sticker-receiver" type="capp" multiple="false" taskmanage="false" nodisplay="true" launch_mode="single">
             <label>sticker-receiver</label>
index 9d73dd3..a9c92ea 100644 (file)
@@ -605,8 +605,10 @@ static int __get_sticker_info_from_json(const char *appid, const char *file_path
                 goto free_memory;
 
             char *rel_thumbnail = __get_string_from_object(info_object, "thumbnail");
-            if (rel_thumbnail && rel_thumbnail[0] != '\0') {
-                thumbnail_path = __convert_sticker_uri(rel_thumbnail, appid, app_path);
+            if (rel_thumbnail) {
+                if (rel_thumbnail[0] != '\0')
+                    thumbnail_path = __convert_sticker_uri(rel_thumbnail, appid, app_path);
+
                 free(rel_thumbnail);
             }