Add APP_SET/UNSET_APP_CONTROL_DEFAULT_APP cmd 01/59901/4 accepted/tizen/ivi/20160223.232802 accepted/tizen/mobile/20160223.232706 accepted/tizen/tv/20160223.232721 accepted/tizen/wearable/20160223.232742 submit/tizen/20160223.113635
authorMyungki Lee <mk5004.lee@samsung.com>
Tue, 23 Feb 2016 05:40:42 +0000 (14:40 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Tue, 23 Feb 2016 05:40:42 +0000 (14:40 +0900)
Change-Id: I823457d7a73680c26021c27f1fba820c3042fb3b
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
include/aul.h
include/aul_cmd.h
src/pkginfo.c

index ff19011..5f4b1d0 100644 (file)
@@ -2101,6 +2101,70 @@ int aul_app_get_pid(const char *appid);
  **/
 int aul_delete_rua_history(bundle *b);
 
+
+/**
+ * @par Description:
+ * This function sets the default application(application id) associated with operatioin, uri and mime-type.
+ *
+ * @param[in] b Bundle object Target application id and operation, uri and mime-type.
+ *
+ * @return 0 if success, negative value(<0) if fail
+ * @see None
+ * @remarks This API is only for Appfw internally.
+ *
+ * @par Sample code:
+ * @code
+#include <aul.h>
+#include <aul_svc.h>
+
+...
+{
+    int r;
+    bundle *b = bundle_create();
+
+    const char *appid = "org.tizen.test";
+    const char *operation = "test_operation";
+    const char *mime_type = "test_mime";
+    const char *uri = "test_uri";
+
+    aul_svc_set_operation(b, operation);
+    aul_svc_set_mime(b, mime_type);
+    aul_svc_set_uri(b, uri);
+
+    aul_svc_set_appid(b, appid)
+
+    r = aul_set_default_app_by_operation(b);
+}
+
+ * @endcode
+ **/
+int aul_set_default_app_by_operation(bundle *b);
+
+/**
+ * @par Description:
+ * This API unset the default application(application id) associated with operation, uri and mime-type.
+ *
+ * @param[in] app_id    The ID of the application
+ *
+ * @return 0 if success, negative value(<0) if fail
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <aul.h>
+
+...
+{
+    aul_unset_default_app_by_operation("org.tizen.test");
+}
+ * @endcode
+ *
+ */
+int aul_unset_default_app_by_operation(const char *app_id);
 #ifdef __cplusplus
        }
 #endif
index 7d7aa79..709a572 100644 (file)
@@ -81,6 +81,8 @@ enum app_cmd {
        AGENT_DEAD_SIGNAL,
 
        APP_ALL_RUNNING_INFO,
+       APP_SET_APP_CONTROL_DEFAULT_APP,
+       APP_UNSET_APP_CONTROL_DEFAULT_APP,
        APP_CMD_MAX
 };
 
index ee009b3..3abadba 100644 (file)
@@ -337,3 +337,40 @@ API int aul_delete_rua_history(bundle *b)
        return result;
 }
 
+API int aul_set_default_app_by_operation(bundle *b)
+{
+       int ret;
+
+       if (b == NULL)
+               return AUL_R_EINVAL;
+
+       ret = aul_sock_send_bundle(AUL_UTIL_PID, getuid(),
+                       APP_SET_APP_CONTROL_DEFAULT_APP, b, AUL_SOCK_NONE);
+       if (ret != 0) {
+               if (ret == -EILLEGALACCESS)
+                       return AUL_R_EILLACC;
+               else
+                       return AUL_R_ERROR;
+       }
+
+       return AUL_R_OK;
+}
+
+API int aul_unset_default_app_by_operation(const char *app_id)
+{
+       int ret;
+
+       if (app_id == NULL)
+               return AUL_R_EINVAL;
+
+       ret = aul_sock_send_raw(AUL_UTIL_PID, getuid(), APP_UNSET_APP_CONTROL_DEFAULT_APP,
+                       (unsigned char *)app_id, strlen(app_id), AUL_SOCK_NONE);
+       if (ret != 0) {
+               if (ret == -EILLEGALACCESS)
+                       return AUL_R_EILLACC;
+               else
+                       return AUL_R_ERROR;
+       }
+
+       return AUL_R_OK;
+}