Modify starting time of apps 08/303508/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 29 Dec 2023 03:20:55 +0000 (12:20 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 29 Dec 2023 03:20:55 +0000 (12:20 +0900)
To send a launch request to the launchpad-process-pool properly, amd
should start the boot sequence feature when the state of user session is
'online' or 'active'.

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

index 28774ed..b42e940 100644 (file)
@@ -24,6 +24,7 @@
 #include <iostream>
 
 #include "lib/amd_launch.h"
+#include "lib/amd_login_monitor.h"
 #include "lib/amd_noti.h"
 #include "lib/amd_signal.h"
 #include "lib/app_info/app_info_manager.hh"
@@ -72,8 +73,8 @@ void BootSequencer::Init() {
   _noti_listen(AMD_NOTI_MSG_APP_STATUS_SET_REAL_PID, OnAppStatusSetRealPid);
   _noti_listen(AMD_NOTI_MSG_APP_STATUS_CLEANUP, OnAppStatusCleanup);
   _noti_listen(AMD_NOTI_MSG_APP_STATUS_ADD, OnAppStatusAdd);
-  _noti_listen(AMD_NOTI_MSG_APPINFO_LOAD, OnAppInfoLoad);
   _noti_listen(AMD_NOTI_MSG_APPINFO_REMOVE, OnAppInfoRemove);
+  _noti_listen(AMD_NOTI_MSG_LOGIN_MONITOR_LOGIN, OnLoginMonitorLogin);
   disposed_ = false;
 }
 
@@ -509,15 +510,6 @@ int BootSequencer::OnAppStatusAdd(const char* msg, int arg1, int arg2,
   return NOTI_CONTINUE;
 }
 
-int BootSequencer::OnAppInfoLoad(const char* msg, int arg1, int arg2,
-                                 void* arg3, bundle* arg4) {
-  uid_t uid = static_cast<uid_t>(arg1);
-  auto& inst = BootSequencer::GetInst();
-  inst.Load(uid);
-  inst.Start(uid);
-  return NOTI_CONTINUE;
-}
-
 int BootSequencer::OnAppInfoRemove(const char* msg, int arg1, int arg2,
     void* arg3, bundle* arg4) {
   uid_t uid = static_cast<uid_t>(arg1);
@@ -553,6 +545,19 @@ int BootSequencer::OnLaunchAppStartEnd(const char* msg, int arg1, int arg2,
   return NOTI_CONTINUE;
 }
 
+int BootSequencer::OnLoginMonitorLogin(const char* msg, int arg1, int arg2,
+    void* arg3, bundle* arg4) {
+  uid_state state = static_cast<uid_state>(arg2);
+  if (state == UID_STATE_ONLINE || state == UID_STATE_ACTIVE) {
+    uid_t uid = static_cast<uid_t>(arg1);
+    auto& inst = BootSequencer::GetInst();
+    inst.Load(uid);
+    inst.Start(uid);
+  }
+
+  return NOTI_CONTINUE;
+}
+
 void BootSequencer::PrintLog(const char* tag, const char* format, ...) {
   if (logger_ == nullptr)
     return;
index 46be967..f1f2aab 100644 (file)
@@ -69,12 +69,12 @@ class BootSequencer {
                                 bundle* arg4);
   static int OnAppStatusAdd(const char* msg, int arg1, int arg2, void* arg3,
                             bundle* arg4);
-  static int OnAppInfoLoad(const char* msg, int arg1, int arg2, void* arg3,
-                           bundle* arg4);
   static int OnAppInfoRemove(const char* msg, int arg1, int arg2, void* arg3,
                              bundle* arg4);
   static int OnLaunchAppStartEnd(const char* msg, int arg1, int arg2,
                                  void* arg3, bundle* arg4);
+  static int OnLoginMonitorLogin(const char* msg, int arg1, int arg2,
+                                 void* arg3, bundle* arg4);
 
   void PrintLog(const char* tag, const char* format, ...);
   void PrintDependencies(const std::shared_ptr<AppInfo>& app_info);