Add a definition to receive clear_cache event 42/313442/2
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 26 Jun 2024 01:16:19 +0000 (10:16 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 26 Jun 2024 04:24:02 +0000 (13:24 +0900)
This is a patch for internal developers

Change-Id: I0e3f6bd6667f8fe307f86e51f199681f2e0c01e8
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/package_manager.c

index eac3582..8c70d6e 100644 (file)
@@ -33,6 +33,9 @@
 
 #define PRIV_SHARED_RES "priv_shared_res"
 
+#define PACKAGE_MANAGER_INTERNAL_EVENT_TYPE_CLEAR_CACHE 1000
+#define PACKAGE_MANAGER_INTERNAL_STATUS_TYPE_CLEAR_CACHE 0x800
+
 typedef struct _request_event_info {
        int req_id;
        package_manager_event_type_e event_type;
@@ -428,6 +431,8 @@ static int package_manager_get_event_type(const char *key,
                *event_type = PACKAGE_MANAGER_EVENT_TYPE_RES_REMOVE;
        else if (strcasecmp(key, PKGMGR_INSTALLER_RES_UNINSTALL_EVENT_STR) == 0)
                *event_type = PACKAGE_MANAGER_EVENT_TYPE_RES_UNINSTALL;
+       else if (strcasecmp(key, PKGMGR_INSTALLER_CLEAR_CACHE_KEY_STR) == 0)
+               *event_type = PACKAGE_MANAGER_INTERNAL_EVENT_TYPE_CLEAR_CACHE;
        else
                return PACKAGE_MANAGER_ERROR_INVALID_PARAMETER;
 
@@ -1607,6 +1612,8 @@ static int __convert_status_type(package_manager_status_type_e status_type)
                type |= PKGMGR_CLIENT_STATUS_RES_REMOVE;
        if (status_type & PACKAGE_MANAGER_STATUS_TYPE_RES_UNINSTALL)
                type |= PKGMGR_CLIENT_STATUS_RES_UNINSTALL;
+       if (status_type & PACKAGE_MANAGER_INTERNAL_STATUS_TYPE_CLEAR_CACHE)
+               type |= PKGMGR_CLIENT_STATUS_CLEAR_CACHE;
        /* LCOV_EXCL_STOP */
 
        return type;
@@ -1626,7 +1633,8 @@ API int package_manager_set_event_status(package_manager_h manager, int status_t
                PACKAGE_MANAGER_STATUS_TYPE_RES_COPY |
                PACKAGE_MANAGER_STATUS_TYPE_RES_CREATE_DIR |
                PACKAGE_MANAGER_STATUS_TYPE_RES_REMOVE |
-               PACKAGE_MANAGER_STATUS_TYPE_RES_UNINSTALL;
+               PACKAGE_MANAGER_STATUS_TYPE_RES_UNINSTALL |
+               PACKAGE_MANAGER_INTERNAL_STATUS_TYPE_CLEAR_CACHE;
 
        if (manager == NULL)
                return package_manager_error(PACKAGE_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);