Modify setting auto restart handler 06/298006/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 30 Aug 2023 03:46:51 +0000 (12:46 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 30 Aug 2023 03:46:51 +0000 (12:46 +0900)
After this patch is applied, amd sends the notification message when
the registration or deregistration of setting auto restart is successful.

Change-Id: I71b8c060ae93bcd43216785b1012754674168a46
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_restart_manager.cc

index 681f0e6..6a80a86 100644 (file)
@@ -55,7 +55,7 @@ int DispatchSetAutoRestart(request_h request) {
   bool enable = b->GetString(AUL_K_AUTO_RESTART) == "true";
   auto& inst = amd::restart::RestartManager::GetInst();
   int ret;
-  bundle* extra_data = nullptr;
+  tizen_base::Bundle extra_data;
   if (enable) {
     std::shared_ptr<tizen_base::Bundle> extra;
     auto extra_raw = b->GetString(AUL_K_RESTART_EXTRA);
@@ -63,7 +63,7 @@ int DispatchSetAutoRestart(request_h request) {
       extra = std::make_shared<tizen_base::Bundle>(extra_raw);
       extra->Delete(AUL_K_APPID);
       extra->Delete(AUL_K_PKG_NAME);
-      extra_data = extra->GetHandle();
+      extra_data = *extra;
     }
 
     ret = inst.RegisterRestartApp(appid, std::move(extra)) ? 0 : -1;
@@ -73,8 +73,11 @@ int DispatchSetAutoRestart(request_h request) {
 
   req->SendResult(ret);
 
-  _noti_send(AMD_NOTI_MSG_RESTART_MANAGER_SET_AUTO_RESTART,
-      static_cast<int>(enable), 0, app_status.get(), extra_data);
+  if (ret == 0) {
+    _noti_send(AMD_NOTI_MSG_RESTART_MANAGER_SET_AUTO_RESTART,
+        static_cast<int>(enable), 0, app_status.get(), extra_data.GetHandle());
+  }
+
   return ret;
 }