Restart service on package update event for dependent modules 09/228909/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 26 Mar 2020 08:59:36 +0000 (17:59 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 26 Mar 2020 09:10:22 +0000 (18:10 +0900)
Change-Id: I7dd06809a375e5410f9911197d6c409249077961

src/multi_assistant_service.c

index 14ed502..1375661 100644 (file)
@@ -1426,6 +1426,7 @@ static void _package_manager_event_cb(const char *type, const char *package, pac
        uid_t uid = getuid ();
        pkgmgrinfo_pkginfo_h handle = NULL;
        static bool in_progress = false;
+       bool should_exit = false;
 
        if (!package || !type)
                return;
@@ -1463,23 +1464,28 @@ static void _package_manager_event_cb(const char *type, const char *package, pac
        }
        if (1 == ret) {
                if (PACKAGE_MANAGER_EVENT_STATE_STARTED == event_state) {
-                       LOGD("processing PACKAGE_MANAGER_EVENT_STATE_STARTED event");
+                       LOGI("processing PACKAGE_MANAGER_EVENT_STATE_STARTED event : %d", event_type);
                        if (false == in_progress) {
                                in_progress = true;
                                deinit_plugin();
                        }
                } else if (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state) {
-                       LOGD("processing PACKAGE_MANAGER_EVENT_STATE_COMPLETED event");
-                       if (true == in_progress) {
-                               init_plugin();
-                               process_activated_setting();
-                               in_progress = false;
+                       LOGI("processing PACKAGE_MANAGER_EVENT_STATE_COMPLETED event : %d", event_type);
+                       if (false == in_progress) {
+                               deinit_plugin();
                        }
+                       should_exit = true;
+                       in_progress = false;
                }
        }
 
        pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
 
+       if (should_exit) {
+               LOGI("Now restarting multi-assistant-service for reloading updated modules");
+               service_app_exit();
+       }
+
        return;
 }