Removed the behavior of changing request type when sending signal 61/237961/5
authorIlho Kim <ilho159.kim@samsung.com>
Fri, 19 Jun 2020 04:59:48 +0000 (13:59 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 22 Jul 2020 10:42:25 +0000 (19:42 +0900)
Changing request_type when installing multiple packages
can affect the request type of other packages

ex) When performing multiple recovery with 'b' option,
    original request_type is PKGMGR_REQ_RECOVER
    but if the first recovery is about update,
    the second recovery will perform update, not recovery

Change-Id: I1dd2c011aac131902eb2d11b1894bd8283590630
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
installer/pkgmgr_installer.c

index 21a9737..c7a07d5 100644 (file)
@@ -147,6 +147,9 @@ static const char *__get_signal_name(pkgmgr_installer *pi, const char *key,
                return PKGMGR_INSTALLER_UNINSTALL_EVENT_STR;
        else if (strcmp(pkg_type, PKGMGR_INSTALLER_CLEAR_CACHE_KEY_STR) == 0)
                return pkg_type;
+       else if (pi->is_upgrade)
+               return PKGMGR_INSTALLER_UPGRADE_EVENT_STR;
+
 
        switch (pi->request_type) {
        case PKGMGR_REQ_INSTALL:
@@ -915,10 +918,6 @@ pkgmgr_installer_send_signal(pkgmgr_installer *pi,
                return -1;
        }
 
-       if (strcmp(key, PKGMGR_INSTALLER_START_KEY_STR) == 0 &&
-                       strcmp(val, PKGMGR_INSTALLER_UPGRADE_EVENT_STR) == 0)
-               pi->request_type = PKGMGR_REQ_UPGRADE;
-
        r = __send_signal_for_event(pi, pkg_type, pkgid, NULL, key, val);
 
        return r;
@@ -952,10 +951,6 @@ API int pkgmgr_installer_send_signal_for_uid(pkgmgr_installer *pi,
                return -1;
        }
 
-       if (strcmp(key, PKGMGR_INSTALLER_START_KEY_STR) == 0 &&
-                       strcmp(val, PKGMGR_INSTALLER_UPGRADE_EVENT_STR) == 0)
-               pi->request_type = PKGMGR_REQ_UPGRADE;
-
        r = __send_signal_for_event_for_uid(pi, uid, pkg_type, pkgid, NULL,
                        key, val);