Fix api for aulctl 02/270902/4
authorChanggyu Choi <changyu.choi@samsung.com>
Fri, 11 Feb 2022 02:22:52 +0000 (11:22 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Fri, 11 Feb 2022 04:29:05 +0000 (13:29 +0900)
Changes:
 - Removes internal keys from args.
 - Removes mutex from boot_sequence api

Change-Id: I1d8630a7125cd85797b5b0de0e9368e3459fa28d
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
aul/boot_sequence/app_info.cc
aul/boot_sequence/boot_sequence_manager.cc
aul/boot_sequence/boot_sequence_manager.hh

index 93483f3..dc22cc8 100644 (file)
@@ -78,12 +78,20 @@ AppInfo::Builder& AppInfo::Builder::SetConflicts(
 
 AppInfo::Builder& AppInfo::Builder::SetArgs(
     const tizen_base::Bundle& args) {
+  static const std::vector<std::string> internal_keys{
+    "__AUL_APPID__",
+    "__AUL_STARTTIME__",
+    "__K_BG_LAUNCH"
+  };
   auto arg_json = args.GetString(AUL_K_ARGS);
   bundle* b = nullptr;
-  if (bundle_from_json(arg_json.c_str(), &b) != BUNDLE_ERROR_NONE)
+  if (bundle_from_json(arg_json.c_str(), &b) != BUNDLE_ERROR_NONE) {
     _E("bundle_from_json() is failed");
-  else
+  } else {
     args_ = tizen_base::Bundle(b, false, true);
+    for (auto& key : internal_keys)
+      args_.Delete(key);
+  }
 
   return *this;
 }
index c0ef3ba..dc8677f 100644 (file)
@@ -29,7 +29,6 @@ namespace aul::internal {
 namespace boot_sequence {
 
 AppInfoPtr BootSequenceManager::CreateAppInfoFromBundle(tizen_base::Bundle b) {
-  /* TODO(changyu.choi): Implement decoding appinfo from bundle. */
   auto builder = AppInfo::Builder()
       .SetAppId(b)
       .SetUid(b)
@@ -81,19 +80,16 @@ BootSequenceManager& BootSequenceManager::GetInst() {
 }
 
 int BootSequenceManager::Reload(uid_t uid) const {
-  std::unique_lock<std::mutex> lock(mutex_);
   return AppRequest(BOOT_SEQUENCE_RELOAD, uid).SendSimply();
 }
 
 int BootSequenceManager::StartApp(const std::string& appid) const {
-  std::unique_lock<std::mutex> lock(mutex_);
   return AppRequest(BOOT_SEQUENCE_START_APP, getuid())
       .SetAppId(appid)
       .SendSimply();
 }
 
 std::vector<AppInfoPtr> BootSequenceManager::GetAppInfoList(uid_t uid) const {
-  std::unique_lock<std::mutex> lock(mutex_);
   int fd = AppRequest(BOOT_SEQUENCE_GET_APPINFO_LIST, uid)
       .SendSimply(AUL_SOCK_ASYNC);
 
index 1085de9..b718371 100644 (file)
@@ -25,7 +25,6 @@
 #include <bundle_cpp.h>
 
 #include <memory>
-#include <mutex>
 #include <string>
 #include <vector>
 
@@ -55,7 +54,6 @@ class BootSequenceManager {
   static void InsertAppInfoCb(app_pkt_t* pkt, void* data);
 
   AppInfoPtr CreateAppInfoFromBundle(tizen_base::Bundle b);
-  mutable std::mutex mutex_;
 };
 
 }  // namespace boot_sequence