Add UpdateAppStatusDAO() method 80/299880/2
authorChanggyu Choi <changyu.choi@samsung.com>
Wed, 11 Oct 2023 09:31:54 +0000 (18:31 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Wed, 11 Oct 2023 09:49:25 +0000 (18:49 +0900)
To update the starting flag on AppStatusDAO,
this api has been added on AppStatusManager.

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

index f39dac9..d289c42 100644 (file)
@@ -252,7 +252,14 @@ int _app_status_update_is_starting(app_status_h app_status, bool is_starting) {
     return -1;
 
   auto* handle = static_cast<amd::AppStatus*>(app_status);
+  if (!is_starting)
+    handle->SetStartupTimer();
+  else
+    handle->UnsetStartupTimer();
+
   handle->SetStarting(is_starting);
+  amd::AppStatusManager::GetInst().
+      UpdateAppStatusDAO(handle->shared_from_this());
   return 0;
 }
 
@@ -873,6 +880,7 @@ static int DispatchAppNotifyStart(request_h request) {
   if (handle != nullptr && !handle->SocketExists()) {
     handle->SetStarting(true);
     handle->UnsetStartupTimer();
+    amd::AppStatusManager::GetInst().UpdateAppStatusDAO(handle);
     handle->SetSocketExists(true);
     handle->SetRealPID(pid);
 
index b32e390..d2e0bd7 100644 (file)
@@ -898,6 +898,7 @@ static int DispatchAppStartupSignal(request_h request) {
 
   app_status->SetStarting(true);
   app_status->UnsetStartupTimer();
+  amd::AppStatusManager::GetInst().UpdateAppStatusDAO(app_status);
   if (app_status->GetAppType() == AT_UI_APP &&
       app_status->GetStatus() != STATUS_VISIBLE)
     amd::ForegroundManager::GetInst().Add(pid);
index e41b6c9..1d2a2b0 100644 (file)
@@ -886,6 +886,10 @@ bool AppStatusManager::IsHomeApp(AppStatus* app_status) {
   return app_status->GetAppID() == home_appid_;
 }
 
+void AppStatusManager::UpdateAppStatusDAO(const AppStatusPtr& app_status) {
+  app_status_dao_->UpdateAppStatus(app_status);
+}
+
 void AppStatusManager::VconfSetLimitBgAppsCallback(keynode_t* key, void* data) {
   auto* manager = static_cast<AppStatusManager*>(data);
   const char* name = vconf_keynode_get_name(key);
index 1d55754..cbf6b23 100644 (file)
@@ -83,6 +83,7 @@ class AppStatusManager : public AppStatus::IEvent {
       bool update_group_info);
   int GetProcessCnt(std::string appid);
   bool IsHomeApp(AppStatus* app);
+  void UpdateAppStatusDAO(const AppStatusPtr& app_status);
 
   int UserInit(uid_t uid);
   void UserFinish(uid_t uid);