return -1;
}
+static int __dispatch_remove_history(int clifd, const app_pkt_t *pkt, struct ucred *cr)
+{
+/*
+ int result = 0;
+ bundle *b = NULL;
+ b = bundle_decode(pkt->data, pkt->len);
+ result = rua_delete_history_from_db(b);
+ bundle_free(b);
+
+ __send_result_data(clifd, APP_REMOVE_HISTORY,
+ (unsigned char *)&result, sizeof(int));
+*/
+ return 0;
+}
+
static int __dispatch_app_group_get_window(int clifd, const app_pkt_t *pkt, struct ucred *cr)
{
bundle *b;
[APP_CANCEL] = __dispatch_app_result,
[APP_KILL_BY_PID] = __dispatch_app_term,
[APP_ADD_HISTORY] = NULL,
+ [APP_REMOVE_HISTORY] = __dispatch_remove_history,
[APP_RUNNING_INFO] = __dispatch_app_running_info,
[APP_RUNNING_INFO_RESULT] = NULL,
[APP_IS_RUNNING] = __dispatch_app_is_running,
APP_CANCEL,
APP_KILL_BY_PID,
APP_ADD_HISTORY,
+ APP_REMOVE_HISTORY,
APP_RUNNING_INFO,
APP_RUNNING_INFO_RESULT,
APP_IS_RUNNING,
/** AUL public key - To support rua stat */
#define AUL_SVC_K_RUA_STAT_CALLER "__K_RUA_STAT_CALLER__"
#define AUL_SVC_K_RUA_STAT_TAG "__K_RUA_STAT_TAG__"
+/** AUL public key - To support rua delete */
+#define AUL_K_RUA_PKGNAME "__K_RUA_PKGNAME"
+/** AUL public key - To support rua delete */
+#define AUL_K_RUA_APPPATH "__K_RUA_APPPATH"
+
/** AUL internal private key */
*/
int aul_app_get_pid(const char *appid);
+
+/**
+ * @par Description:
+ * This function delete rua history.
+ *
+ * @param[in] b Bundle object Target Package name or app path. If NULL or has no value, delete all rua history.
+ *
+ * @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>
+
+...
+{
+ int r;
+ bundle *b = bundle_create();
+ if (pkg_name)
+ bundle_add_str(b, AUL_K_RUA_PKGNAME, pkg_name);
+ else if (app_path)
+ bundle_add_str(b, AUL_K_RUA_APPPATH, app_path);
+
+ r = aul_delete_rua_history(b);
+}
+
+ * @endcode
+ **/
+int aul_delete_rua_history(bundle *b);
+
#ifdef __cplusplus
}
#endif
}
pkt->cmd = cmd;
pkt->len = datalen;
- memcpy(pkt->data, kb_data, pkt->len);
+ if (kb_data)
+ memcpy(pkt->data, kb_data, pkt->len);
while (sent != AUL_PKT_HEADER_SIZE + pkt->len) {
len = send(fd, pkt, AUL_PKT_HEADER_SIZE + pkt->len - sent, 0);
return aul_app_get_pkgid_bypid_for_uid(pid, pkgid, len, getuid());
}
+SLPAPI int aul_delete_rua_history(bundle *b)
+{
+ app_pkt_t *ret = NULL;
+ bundle_raw *br = NULL;
+ int datalen = 0;
+ int result = 0;
+
+ /* b can be NULL if b is NULL delete all rua history */
+ if (b != NULL)
+ bundle_encode(b, &br, &datalen);
+
+ ret = __app_send_cmd_with_result(AUL_UTIL_PID, APP_REMOVE_HISTORY, br,
+ datalen);
+
+ if (ret != NULL) {
+ if (ret->len > 0) {
+ memcpy(&result, ret->data, ret->len);
+ } else {
+ if (br != NULL)
+ free(br);
+ return -1;
+ }
+ }
+ if (br != NULL)
+ free(br);
+ return result;
+}
+
#include "aul.h"
#include "aul_api.h"
#include "aul_svc.h"
+#include "app_sock.h"
#include "aul_svc_db.h"
#include "simple_util.h"
#include "aul_svc_priv_key.h"