Add new api to set/unset a default app 34/59534/5
authorMyungki Lee <mk5004.lee@samsung.com>
Wed, 24 Feb 2016 05:00:09 +0000 (14:00 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Wed, 24 Feb 2016 05:00:09 +0000 (14:00 +0900)
- default app for operation, mime-type, uri

Change-Id: I5579b154f2ab5cf5e047fb2cc40b1a33a8abd4a4
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
app_control/app_control.c
include/app_control.h

index 6771118..f455d7b 100644 (file)
@@ -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;
index 2de89a6..b6f879b 100644 (file)
@@ -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);
 /**
  * @}
  */