From: Hwankyu Jhun Date: Fri, 29 Mar 2019 10:44:08 +0000 (+0900) Subject: Add a new function for setting caller instance ID X-Git-Tag: submit/tizen/20190405.011027~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cf50354122c1efe00d86dde0804d726967f2ea5;p=platform%2Fcore%2Fapi%2Fapp-control.git Add a new function for setting caller instance ID Adds: - app_control_set_caller_instance_id() Change-Id: I8cc5769dfd423457ad9723fd080aea55b685075b Signed-off-by: Hwankyu Jhun --- diff --git a/include/app_control_internal.h b/include/app_control_internal.h index 52262f7..59eb6b2 100644 --- a/include/app_control_internal.h +++ b/include/app_control_internal.h @@ -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 @@ -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 @@ -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); + /** * @} */ diff --git a/src/app_control.c b/src/app_control.c index a6326ff..e575de1 100644 --- a/src/app_control.c +++ b/src/app_control.c @@ -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; +}