#include "lib/api/amd_api_app_request_broker.h"
#include "lib/api/amd_api_inotify.h"
#include "lib/app_status/app_status_dao_implementation.hh"
+#include "lib/launch/foreground_manager.hh"
#include "lib/request/request.hh"
namespace amd {
_noti_send(AMD_NOTI_MSG_APP_STATUS_APP_REGISTER_PID, pid, 0, app_info.get(),
nullptr);
- if (component_type != APP_TYPE_SERVICE) {
- _signal_get_proc_status_async(pid,
- [](int pid, int status, int focused, void* data) -> void {
- auto* manager = static_cast<AppStatusManager*>(data);
- if (focused == 1)
- _launch_set_focused_pid(pid);
-
- if (status == PROC_STATUS_FG)
- status = STATUS_VISIBLE;
- else if (status == PROC_STATUS_BG)
- status = STATUS_BG;
- else
- return;
-
- auto app = manager->Find(pid);
- if (app == nullptr)
- return;
-
- manager->Update(app, status, false, true);
- }, this);
- }
+ if (component_type != APP_TYPE_SERVICE)
+ return 0;
+
+ ForegroundManager::GetInst().Add(pid);
+ _signal_get_proc_status_async(pid,
+ [](int pid, int status, int focused, void* data) -> void {
+ auto* manager = static_cast<AppStatusManager*>(data);
+ if (focused == 1)
+ _launch_set_focused_pid(pid);
+
+ if (status == PROC_STATUS_FG)
+ status = STATUS_VISIBLE;
+ else
+ status = STATUS_BG;
+
+ ForegroundManager::GetInst().Remove(pid);
+ auto app = manager->Find(pid);
+ if (app == nullptr)
+ return;
+
+ manager->Update(app, status, false, true);
+ }, this);
return 0;
}