Check disabled app info
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 2 Apr 2024 00:25:32 +0000 (09:25 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 2 Apr 2024 00:36:44 +0000 (09:36 +0900)
If amd cannot find the appinfo from the memory & db when getting
the launch request, amd should check whether the disabled app info exists
or not.
This patch is for debugging.

Change-Id: I88c893bcf5e51bdae17b18755a0f0461c57cd41e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_info/app_info_manager.cc
src/lib/app_info/app_info_manager.hh
src/lib/launch/step_prepare_starting_app.cc

index f0586b9aac58ec2e2f959de3a332efe54bea6179..e573546913e965b5c6a3d6d56c75eff0e1a314b9 100644 (file)
 #include <utility>
 
 #include "lib/amd_app_property.h"
-#include "lib/app_status/app_status_manager.hh"
 #include "lib/amd_launch.h"
 #include "lib/amd_restart_manager.h"
-
 #include "lib/api/amd_api_noti.hh"
 #include "lib/app_status/app_status_manager.hh"
 #include "lib/common/log_private.hh"
@@ -901,4 +899,18 @@ int AppInfoManager::PkgmgrEventUpdateHandler(const pkgmgrinfo_appinfo_h handle,
   return 0;
 }
 
+bool AppInfoManager::CheckDisabledAppInfo(uid_t uid, const std::string& appid) {
+  pkgmgrinfo_appinfo_h handle;
+  int ret = pkgmgrinfo_appinfo_get_usr_disabled_appinfo(appid.c_str(), uid,
+                                                        &handle);
+  if (ret != PMINFO_R_OK) {
+    _E("Failed to get disabled appinfo. appid(%s), uid(%u)",
+        appid.c_str(), uid);
+    return false;
+  }
+
+  pkgmgrinfo_appinfo_destroy_appinfo(handle);
+  return true;
+}
+
 }  // namespace amd
index 5cd99804e1acef65505950ff20027c771afa1ce9..c997ab0fd690581db6c23376c3992afaae1d7f58 100644 (file)
@@ -48,6 +48,7 @@ class AppInfoManager : public PkgmgrClient::IEvent {
   bool IsUninstalling(const std::string& pkgid);
   void OnPkgmgrEvent(std::shared_ptr<PkgmgrEventArgs> args) override;
   int InsertAppInfo(uid_t uid, const std::string& appid);
+  bool CheckDisabledAppInfo(uid_t uid, const std::string& appid);
 
  private:
   AppInfoManager();
index ea26fc6bc519e4cecee4fb2a25c0ecd901254232..7d21011c2d450e5d2d4c1e202af9ecdf1319b7ee 100644 (file)
@@ -568,6 +568,11 @@ int StepPrepareStartingApp::FindAndSetAppInfo(LaunchContext* context) {
     if (app_info == nullptr) {
       _E("[SECOND] Failed to find appinfo of %u:%s",
           context->GetTargetUid(), context->GetAppId().c_str());
+      if (AppInfoManager::GetInst().CheckDisabledAppInfo(
+            context->GetTargetUid(), context->GetAppId())) {
+        _E("%u:%s is disabled",
+            context->GetTargetUid(), context->GetAppId().c_str());
+      }
       return -ENOENT;
     }
   }