summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2016-02-24 14:00:09 +0900
committerMyungki Lee <mk5004.lee@samsung.com>2016-02-24 14:00:09 +0900
commitf2921f6ccf543571e1dab8fa26628c0dbe3afc9d (patch)
treee9ceacccf2dbb65d897d1b7d70e9b0b481a677c4
parent57dd6f315447f95620ca9e9110b25fa5e65085ff (diff)
downloadapplication-f2921f6ccf543571e1dab8fa26628c0dbe3afc9d.tar.gz
application-f2921f6ccf543571e1dab8fa26628c0dbe3afc9d.tar.bz2
application-f2921f6ccf543571e1dab8fa26628c0dbe3afc9d.zip
Add new api to set/unset a default app
- default app for operation, mime-type, uri Change-Id: I5579b154f2ab5cf5e047fb2cc40b1a33a8abd4a4 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rw-r--r--app_control/app_control.c40
-rw-r--r--include/app_control.h37
2 files changed, 77 insertions, 0 deletions
diff --git a/app_control/app_control.c b/app_control/app_control.c
index 6771118..f455d7b 100644
--- a/app_control/app_control.c
+++ b/app_control/app_control.c
@@ -591,6 +591,46 @@ 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 *app_id)
+{
+ int ret;
+
+ if (app_control_validate(app_control) || app_id == NULL)
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+ ret = aul_svc_set_appid(app_control->data, app_id);
+ if (ret < 0)
+ return app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
+
+ ret = aul_set_default_app_by_operation(app_control->data);
+ if (ret < 0) {
+ if (ret == AUL_R_EILLACC)
+ return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
+ else
+ return app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_unset_defapp(const char *app_id)
+{
+ int ret;
+
+ if (app_id == NULL)
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+ ret = aul_unset_default_app_by_operation(app_id);
+ if (ret <0) {
+ if (ret == AUL_R_EILLACC)
+ return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
+ else
+ return 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..b6f879b 100644
--- a/include/app_control.h
+++ b/include/app_control.h
@@ -1078,6 +1078,43 @@ 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 ID of default application associated with operation, mime-type and uri.
+ *
+ * @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 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);
+
+/**
+ * @brief Unset default application setting of an application for app_controls.
+ *
+ * @details When an user call this API, all the default application settings for the app_id are unset.
+ *
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/systemsettings.admin
+ * @param[in] app_id The ID of the application
+ *
+ * @return 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);
/**
* @}
*/