Add debugging log for disabled pkg/app for cache 30/289530/1
authorilho kim <ilho159.kim@samsung.com>
Fri, 3 Mar 2023 01:15:12 +0000 (10:15 +0900)
committerilho kim <ilho159.kim@samsung.com>
Thu, 9 Mar 2023 07:40:10 +0000 (16:40 +0900)
Change-Id: I360d3bd833b7f05db225ae437bdab35adc5555af
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
(cherry picked from commit 669898d06afe072322181aa82643bb3717b900d2)

src/server/filter_checker/app_filter_checker/app_disable_app_filter_checker.cc
src/server/filter_checker/app_filter_checker/pkg_disable_app_filter_checker.cc
src/server/filter_checker/pkg_filter_checker/disable_pkg_filter_checker.cc

index c01f04c5c12b22439451ea7efc734dfcbb89237f..3707b1bb7db8ab21343caae53706fa843c273ad7 100644 (file)
 
 #include "app_disable_app_filter_checker.hh"
 
-#include <string.h>
-
 #include "pkgmgrinfo_basic.h"
 #include "pkgmgrinfo_private.h"
 
+#include "utils/logging.hh"
+
 namespace pkgmgr_server {
 namespace database {
 
 bool AppDisableAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
     application_x* app_info, package_x* pkg_info) {
-  return (node->value != nullptr && app_info->is_disabled != nullptr &&
-          strcasecmp(node->value, app_info->is_disabled) == 0);
+  if (node->value == nullptr || app_info->is_disabled == nullptr)
+    return false;
+
+  if (strcasecmp(node->value, app_info->is_disabled) != 0) {
+    if (strcasecmp(app_info->is_disabled, "true") == 0)
+      LOG(WARNING) << "The application [" << app_info->appid << "] is disabled";
+    return false;
+  }
+
+  return true;
 }
 
 }  // namespace database
index f4667f4ab58b86fea055075e27b3a7627ef0baf9..1c2efdea3177b954f981c9cfe716b84c36787dc4 100644 (file)
 #include "pkgmgrinfo_basic.h"
 #include "pkgmgrinfo_private.h"
 
+#include "utils/logging.hh"
+
 namespace pkgmgr_server {
 namespace database {
 
 bool PkgDisableAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
     application_x* app_info, package_x* pkg_info) {
-  return (node->value != nullptr &&
-      strcasecmp(node->value, pkg_info->is_disabled) == 0);
+  if (node->value == nullptr || pkg_info->is_disabled == nullptr)
+    return false;
+
+  if (strcasecmp(node->value, pkg_info->is_disabled) != 0) {
+    if (strcasecmp(pkg_info->is_disabled, "true") == 0)
+      LOG(WARNING) << "The pacakge [" << pkg_info->package
+          << "] to which the application ["
+          << app_info->appid << "] belongs is disabled";
+    return false;
+  }
+
+  return true;
 }
 
 }  // namespace database
index ccd9d4a9f91414b0cc83fa396361fe6e4aef3844..e80d125e9b9f251df9950dfaf594b069dc1ee4ce 100644 (file)
 
 #include "disable_pkg_filter_checker.hh"
 
+#include "utils/logging.hh"
+
 namespace pkgmgr_server {
 namespace database {
 
 bool DisablePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
                                         package_x* info) {
-  return (node->value != nullptr && info->is_disabled != nullptr &&
-          strcasecmp(node->value, info->is_disabled) == 0);
+  if (node->value == nullptr || info->is_disabled == nullptr)
+    return false;
+
+  if (strcasecmp(node->value, info->is_disabled) != 0) {
+    if (strcasecmp(info->is_disabled, "true") == 0)
+      LOG(WARNING) << "The package [" << info->package << "] is disabled";
+    return false;
+  }
+
+  return true;
 }
 
 }  // namespace database