diff options
author | Junghoon Park <jh9216.park@samsung.com> | 2015-12-17 20:49:58 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2015-12-17 20:49:58 -0800 |
commit | f0db2d790946023970eee88ab86b9c5b838f555b (patch) | |
tree | 5fd7d596ad82b9093c462d221a92f88027ab5a77 | |
parent | 92057e07b706fa570ca9baf99557d4ee9a92c5c3 (diff) | |
parent | b3d010cbf995bd1a21c01c86b56c53f0e1812570 (diff) | |
download | aul-1-f0db2d790946023970eee88ab86b9c5b838f555b.tar.gz aul-1-f0db2d790946023970eee88ab86b9c5b838f555b.tar.bz2 aul-1-f0db2d790946023970eee88ab86b9c5b838f555b.zip |
Merge "Add delete rua history feature" into tizen
-rw-r--r-- | am_daemon/amd_request.c | 16 | ||||
-rw-r--r-- | include/app_sock.h | 1 | ||||
-rw-r--r-- | include/aul.h | 36 | ||||
-rw-r--r-- | src/app_sock.c | 3 | ||||
-rw-r--r-- | src/pkginfo.c | 28 | ||||
-rwxr-xr-x | src/service.c | 1 |
6 files changed, 84 insertions, 1 deletions
diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c index 9b0355b7..f61997da 100644 --- a/am_daemon/amd_request.c +++ b/am_daemon/amd_request.c @@ -620,6 +620,21 @@ err_out: 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; @@ -1136,6 +1151,7 @@ static app_cmd_dispatch_func dispatch_table[APP_CMD_MAX] = { [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, diff --git a/include/app_sock.h b/include/app_sock.h index 6cc97aee..89211f17 100644 --- a/include/app_sock.h +++ b/include/app_sock.h @@ -33,6 +33,7 @@ enum app_cmd { APP_CANCEL, APP_KILL_BY_PID, APP_ADD_HISTORY, + APP_REMOVE_HISTORY, APP_RUNNING_INFO, APP_RUNNING_INFO_RESULT, APP_IS_RUNNING, diff --git a/include/aul.h b/include/aul.h index b52493f0..c332b9f0 100644 --- a/include/aul.h +++ b/include/aul.h @@ -112,6 +112,11 @@ typedef enum _aul_type{ /** 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 */ @@ -1965,6 +1970,37 @@ int aul_remove_loader(int loader_id); */ 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 diff --git a/src/app_sock.c b/src/app_sock.c index 270f546f..f2d81141 100644 --- a/src/app_sock.c +++ b/src/app_sock.c @@ -904,7 +904,8 @@ app_pkt_t *__app_send_cmd_with_result_for_uid(int pid, uid_t uid, int cmd, unsig } 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); diff --git a/src/pkginfo.c b/src/pkginfo.c index 438f2341..537023e3 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -250,3 +250,31 @@ API int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len) 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; +} + diff --git a/src/service.c b/src/service.c index 4a2f8dcc..f15bcaa9 100755 --- a/src/service.c +++ b/src/service.c @@ -31,6 +31,7 @@ #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" |