Add setting starting to app_status on RegisterPID() 78/299278/4
authorChanggyu Choi <changyu.choi@samsung.com>
Mon, 25 Sep 2023 05:04:05 +0000 (14:04 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Mon, 25 Sep 2023 08:32:42 +0000 (08:32 +0000)
For apps registered through RegisterPID(), initialization is
considered complete and the timer is not registered.

Change-Id: I51bee048931dbdb28fa40b63070b38ae59f12571
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/amd_app_status.cc
src/lib/app_status/app_status_manager.cc

index ab10624..f39dac9 100644 (file)
@@ -872,6 +872,7 @@ static int DispatchAppNotifyStart(request_h request) {
   auto handle = amd::AppStatusManager::GetInst().Find(pid);
   if (handle != nullptr && !handle->SocketExists()) {
     handle->SetStarting(true);
+    handle->UnsetStartupTimer();
     handle->SetSocketExists(true);
     handle->SetRealPID(pid);
 
index e0c3798..fb19eb5 100644 (file)
@@ -608,7 +608,10 @@ int AppStatusManager::RegisterPID(int pid, const std::string& appid,
   builder.SetUid(uid);
   builder.SetCallerPid(getpid());
   builder.SetEventListener(this);
-  AddAppInfo(std::shared_ptr<AppStatus>(builder.Build()));
+
+  app_status = std::shared_ptr<AppStatus>(builder.Build());
+  app_status->SetStarting(true);
+  AddAppInfo(std::move(app_status));
   _noti_send(AMD_NOTI_MSG_APP_STATUS_APP_REGISTER_PID, pid, 0, app_info.get(),
       nullptr);
 
@@ -756,6 +759,9 @@ void AppStatusManager::RemovePackageStatus(const AppStatusPtr& app_status) {
 }
 
 void AppStatusManager::Insert(AppStatusPtr app_status) {
+  if (!app_status->IsStarting())
+    app_status->SetStartupTimer();
+
   app_status_list_.push_back(app_status);
   pid_map_[app_status->GetPID()] = app_status;
 
@@ -801,9 +807,6 @@ AppStatusPtr AppStatusManager::AddAppInfo(AppStatusPtr app_status) {
   if (app_status == nullptr)
     return nullptr;
 
-  if (!app_status->IsStarting())
-    app_status->SetStartupTimer();
-
   _noti_send(AMD_NOTI_MSG_APP_STATUS_ADD, 0, 0, app_status.get(), nullptr);
   app_status_dao_->UpdateAppStatus(app_status);
   Insert(app_status);