Fix duplicate execution problem 86/301786/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 22 Nov 2023 23:28:53 +0000 (08:28 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 22 Nov 2023 23:28:53 +0000 (08:28 +0900)
When a new app is launched by receiving a request to execute it,
if the onboot feature is activated, the app process is duplicated.
This problem occurs because the CheckStatus() method does not properly handle
the confirmation of pending items.
The problem is fixed by modifying the socket option.

Change-Id: Icc4478766a25fdf34073dd331dc878478c577b58
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_launch.cc
src/lib/request/request_manager.cc
src/lib/request/request_manager.hh

index 629f4f1b1f45f641048b3fd93f1482a76d0dbd65..4b9b23bfce3b76f08af0842f3a4c37489bd80167 100644 (file)
@@ -1453,7 +1453,7 @@ int _launch_start_app_local_with_bundle(uid_t uid, const char* appid,
   b.Delete(AUL_K_APPID);
   b.Add(AUL_K_APPID, appid);
   amd::RequestPtr req = amd::RequestManager::GetInst().CreateRequestLocal(
-      APP_START, uid, getpid(), kb);
+      APP_START, uid, getpid(), kb, AUL_SOCK_QUEUE | AUL_SOCK_BUNDLE);
   if (req == nullptr) {
     _E("Out of memory");
     return -1;
index d19a09dc01441685b3a22b12d700469a7b78e709..ceca5fb6b6c79f4facfe8911e0d010c0ae400009 100644 (file)
@@ -117,14 +117,14 @@ RequestPtr RequestManager::DecodeRequestFromPacket(int client_fd,
 }
 
 RequestPtr RequestManager::CreateRequestLocal(int cmd, uid_t uid, int pid,
-    bundle* kb) {
+    bundle* kb, int opt) {
   auto builder = Request::Builder()
       .SetPID(pid)
       .SetTargetPID(0)
       .SetUID(getuid())
       .SetTargetUID(uid)
       .SetCmd(cmd)
-      .SetOption(AUL_SOCK_NONE)
+      .SetOption(opt)
       .SetEventListener(this);
 
   if (kb != nullptr)
index fb1c272f6b5717d36b09757e69413b1ecb147861..c7325b23389324f0c601c6ba85dc56750dd3bcfc 100644 (file)
@@ -47,7 +47,8 @@ class RequestManager : public Request::IEvent {
   RequestManager& operator=(const RequestManager&) = delete;
 
   bool RegisterCommands(const request_cmd_dispatch* cmds, int cnt);
-  RequestPtr CreateRequestLocal(int cmd, uid_t uid, int pid, bundle* kb);
+  RequestPtr CreateRequestLocal(int cmd, uid_t uid, int pid, bundle* kb,
+      int opt = AUL_SOCK_NONE);
   void PushRequest(RequestPtr req, amd_priority_e priority);
   bool UserInit(uid_t uid);
   bool Init();