Modify sending AUL signal 42/282942/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 13 Oct 2022 10:43:10 +0000 (10:43 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 13 Oct 2022 10:43:10 +0000 (10:43 +0000)
Currently, the installer sends all events to AMD. AMD only needs
'start', 'error' and 'end' events.
This patch modifies sending events.

Change-Id: Ia436b72762dff3c66d7162df830b9bb23509759e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/common/pkgmgr_signal.cc

index 62d695d..1f5ba98 100644 (file)
@@ -190,18 +190,18 @@ bool PkgmgrSignal::SendSignal(
     const char* value,
     const std::string& type,
     const std::string& pkgid) const {
-
-  uid_t uid = pkgmgr_installer_get_uid(pi_);
-  tizen_base::Bundle b({
-    { AUL_K_PKGID, pkgid },
-    { AUL_K_PACKAGETYPE, type },
-    { AUL_K_PKG_EVENT_NAME, key },
-    { AUL_K_PKG_EVENT_RESULT, value }
-  });
-
-  int ret = aul_package_pre_event_send(uid, b.GetHandle());
-  if (ret != 0)
-    LOG(ERROR) << "aul_package_pre_event_send() is failed";
+  if (!strcmp(key, "start") || !strcmp(key, "error") || !strcmp(key, "end")) {
+    uid_t uid = pkgmgr_installer_get_uid(pi_);
+    tizen_base::Bundle b({
+        { AUL_K_PKGID, pkgid },
+        { AUL_K_PACKAGETYPE, type },
+        { AUL_K_PKG_EVENT_NAME, key },
+        { AUL_K_PKG_EVENT_RESULT, value }
+        });
+
+    if (aul_package_pre_event_send(uid, b.GetHandle()) != AUL_R_OK)
+      LOG(ERROR) << "aul_package_pre_event_send() is failed";
+  }
 
   // send pkgmgr signal
   if (pkgmgr_installer_send_signal(
@@ -227,18 +227,6 @@ bool PkgmgrSignal::SendSignal(
     const char* value,
     const std::string& type,
     const std::string& pkgid) const {
-
-  tizen_base::Bundle b({
-    { AUL_K_PKGID, pkgid },
-    { AUL_K_PACKAGETYPE, type},
-    { AUL_K_PKG_EVENT_NAME, key},
-    { AUL_K_PKG_EVENT_RESULT, value}
-  });
-
-  int ret = aul_package_pre_event_send(uid, b.GetHandle());
-  if (ret != 0)
-    LOG(ERROR) << "aul_package_pre_event_send() is failed";
-
   // send pkgmgr signal
   if (pkgmgr_installer_send_signal_for_uid(
         pi_,