Add a new function for setting caller instance ID 25/202525/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 29 Mar 2019 10:44:08 +0000 (19:44 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 29 Mar 2019 10:44:08 +0000 (19:44 +0900)
Adds:
 - app_control_set_caller_instance_id()

Change-Id: I8cc5769dfd423457ad9723fd080aea55b685075b
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/app_control_internal.h
src/app_control.c

index 52262f7cb50bad218334837e57996f905c1231ef..59eb6b2b7dc7be0df4f522d5791cd5732fcb17b4 100644 (file)
@@ -78,13 +78,13 @@ extern "C" {
  * @brief Replaces all data in the app_control with the bundle.
  *
  * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control.
- * @param [in] app_control The app_control handle
- * @param [in] data The bundle handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_export_as_bundle()
+ * @param [in]  app_control     The app_control handle
+ * @param [in]  data            The bundle handle
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @see         app_control_export_as_bundle()
  * @code
  *
  * #include <bundle.h>
@@ -103,13 +103,13 @@ int app_control_import_from_bundle(app_control_h app_control, bundle *data);
  * @brief Returns a new bundle containing all data contained int the app_control.
  *
  * @remarks The @a data must be released with bundle_free() by you.
- * @param [in] app_control The app_control handle
- * @param [out] data The bundle handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see app_control_import_from_bundle()
+ * @param [in]  app_control     The app_control handle
+ * @param [out] data            The bundle handle
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @see         app_control_import_from_bundle()
  * @code
  *
  * #include <bundle.h>
@@ -132,14 +132,14 @@ int app_control_to_bundle(app_control_h app_control, bundle **data);
  * @brief Sets the window ID of the application.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_get_window()
+ * @param[in]   app_control      The app_control handle
+ * @param[in]   id               The window ID of the caller application (if the @a id is not positive, it clears the previous value)
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval      #APP_CONTROL_ERROR_OUT_OF_MEMORY        Out of memory
+ * @see         app_control_get_window()
  */
 int app_control_set_window(app_control_h app_control, unsigned int id);
 
@@ -147,14 +147,14 @@ int app_control_set_window(app_control_h app_control, unsigned int id);
  * @brief Gets the window ID of the application.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[out] id The window ID of the caller application
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_app_id()
+ * @param[in]   app_control     The app_control handle
+ * @param[out]  id              The window ID of the caller application
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval      #APP_CONTROL_ERROR_OUT_OF_MEMORY        Out of memory
+ * @see         app_control_set_app_id()
  */
 int app_control_get_window(app_control_h app_control, unsigned int *id);
 
@@ -165,14 +165,14 @@ typedef int (*app_control_host_res_fn)(void *data);
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
- * @param[in] app_control The app_control handle
- * @param[in] callee_id The callee window ID
- * @param[in] cbfunc The callback function to be called when the transient is requested
- * @param[in] data A data pointer to pass to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]   app_control     The app_control handle
+ * @param[in]   callee_id       The callee window ID
+ * @param[in]   cbfunc          The callback function to be called when the transient is requested
+ * @param[in]   data            A data pointer to pass to the callback function
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
  */
 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
 
@@ -183,16 +183,15 @@ int app_control_request_transient_app(app_control_h app_control, unsigned int ca
  * @since_tizen 3.0
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/systemsettings.admin
- * @param[in] app_control The app_control handle
- * @param[in] app_id The ID of the application
- *
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]   app_control     The app_control handle
+ * @param[in]   app_id          The ID of the application
  *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE Successful
+ * @retval      #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval      #APP_CONTROL_ERROR_IO_ERROR             IO error
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
  */
 int app_control_set_defapp(app_control_h app_control, const char *app_id);
 
@@ -205,46 +204,59 @@ int app_control_set_defapp(app_control_h app_control, const char *app_id);
  * @since_tizen 3.0
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/systemsettings.admin
- * @param[in] app_id The ID of the application
- *
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]   app_id          The ID of the application
  *
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_PERMISSION_DENIED    Permission denied
+ * @retval      #APP_CONTROL_ERROR_IO_ERROR             IO error
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
  */
 int app_control_unset_defapp(const char *app_id);
 
 /**
  * @brief Sets the instance ID of the application.
  *
- * @since_tizen tizen_3.0
- * @param[in] app_control The app_control handle
- * @param[in] instance_id The instance ID of the application
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_OUT_OF_MEMORY Out of memory
+ * @since_tizen 3.0
+ * @param[in]   app_control     The app_control handle
+ * @param[in]   instance_id     The instance ID of the application
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval      #APP_CONTROL_ERROR_OUT_OF_MEMORY        Out of memory
  */
 int app_control_set_instance_id(app_control_h app_control, const char *instance_id);
 
 /**
  * @brief Gets the instance ID of the application.
  *
- * @since_tizen tizen_3.0
- * @param[in] app_control The app_control handle
- * @param[out] instance_id The instance ID of the application
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_OUT_OF_MEMORY Out of memory
+ * @since_tizen 3.0
+ * @param[in]   app_control     The app_control handle
+ * @param[out]  instance_id     The instance ID of the application
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval      #APP_CONTROL_ERROROUT_OF_MEMORY         Out of memory
  */
 int app_control_get_instance_id(app_control_h app_control, char **instance_id);
 
+/**
+ * @brief Sets the instance ID of the caller.
+ *
+ * @since_tizen 5.5
+ * @param[in]   app_control     The app_control handle
+ * @param[in]   instance_id     The instance ID of the caller
+ * @return      @c on success,
+ *              otherwise a negative error value
+ * @retval      #APP_CONTROL_ERROR_NONE                 Successful
+ * @retval      #APP_CONTROL_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval      #APP_CONTROL_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int app_control_set_caller_instance_id(app_control_h app_control, const char *instance_id);
+
 /**
  * @}
  */
index a6326ff9c1044b15e6ac97d84159ee3a14cd4392..e575de1bb0664baa9f49e0b04ef96c77def9b3bc 100644 (file)
@@ -1774,3 +1774,28 @@ int app_control_remove_action_handler(app_control_action_h handle)
 
        return APP_CONTROL_ERROR_NONE;
 }
+
+int app_control_set_caller_instance_id(app_control_h app_control,
+               const char *instance_id)
+{
+       int r;
+
+       if (app_control_validate(app_control)) {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                               __FUNCTION__, "Invalid parameter");
+       }
+
+       if (instance_id != NULL) {
+               r = aul_svc_set_caller_instance_id(app_control->data,
+                               instance_id);
+               if (r != AUL_SVC_RET_OK) {
+                       return app_control_error(
+                                       APP_CONTROL_ERROR_OUT_OF_MEMORY,
+                                       __FUNCTION__, "Out of memory");
+               }
+       } else {
+               aul_svc_set_caller_instance_id(app_control->data, instance_id);
+       }
+
+       return APP_CONTROL_ERROR_NONE;
+}