From: Myungki Lee Date: Mon, 15 Feb 2016 08:26:47 +0000 (+0900) Subject: Add new api to set default app X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff33a72887ee27d462d2ab879ed2ad711b6ca9e9;p=platform%2Fcore%2Fapi%2Fapplication.git Add new api to set default app Change-Id: I4817da7afaf042182333f3aec045eb7da64ed988 Signed-off-by: Myungki Lee --- diff --git a/app_control/app_control.c b/app_control/app_control.c index 6771118..f12a3f3 100644 --- a/app_control/app_control.c +++ b/app_control/app_control.c @@ -591,6 +591,34 @@ int app_control_get_launch_mode(app_control_h app_control, return APP_CONTROL_ERROR_NONE; } +int app_control_set_defapp(app_control_h app_control, const char *defapp) +{ + int ret; + const char *op; + const char *mime_type; + const char *uri; + + if (app_control == NULL || defapp == NULL) + app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); + + /* get op */ + op = appsvc_get_operation(app_control->data); + if (op == NULL) + app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); + + /* get mime_type */ + mime_type = appsvc_get_mime(app_control->data); + + /* get uri */ + uri = appsvc_get_uri(app_control->data); + + ret = aul_svc_set_defapp(op, mime_type, uri, defapp); + if (ret < 0) + app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL); + + return APP_CONTROL_ERROR_NONE; +} + static void __update_launch_pid(int launched_pid, void *data) { app_control_h app_control; diff --git a/include/app_control.h b/include/app_control.h index 2de89a6..adb21c4 100644 --- a/include/app_control.h +++ b/include/app_control.h @@ -1078,6 +1078,23 @@ int app_control_get_launch_mode(app_control_h app_control, * @see #APP_CONTROL_RESULT_APP_STARTED */ int app_control_enable_app_started_result_event(app_control_h app_control); + +/** + * @brief Set the default application(package name) associated with op, uri and mime-type. + * + * @since_tizen 3.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/systemsettings.admin + * @param[in] app_control The app_control handle + * @param[in] defapp default application + * + * @return 0 on success, otherwise a negative error value + * @retval #APP_CONTROL_ERROR_NONE Successful + * @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 *defapp); /** * @} */