From 96e4b93e132904444b05e670c72d932890357be9 Mon Sep 17 00:00:00 2001 From: lihehe Date: Wed, 17 Apr 2024 19:29:01 +0800 Subject: [PATCH] decoupling component of screenlock_mgr Signed-off-by: lihehe Change-Id: I961bfe53fba5da340209891fc9f366ee6ee3d100 --- code_signature.gni | 5 +++++ services/key_enable/utils/BUILD.gn | 8 +++++++- services/key_enable/utils/src/unlock_event_helper.cpp | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/code_signature.gni b/code_signature.gni index c14b176..0661084 100644 --- a/code_signature.gni +++ b/code_signature.gni @@ -24,4 +24,9 @@ declare_args() { code_signature_support_oh_code_sign = false code_signature_enable_xpm_mode = false code_signature_support_oh_release_app = true + code_signature_screenlock_mgr_enable = false + if (defined(global_parts_info) && + defined(global_parts_info.theme_screenlock_mgr)) { + code_signature_screenlock_mgr_enable = true + } } diff --git a/services/key_enable/utils/BUILD.gn b/services/key_enable/utils/BUILD.gn index 6977888..29687ad 100644 --- a/services/key_enable/utils/BUILD.gn +++ b/services/key_enable/utils/BUILD.gn @@ -38,8 +38,14 @@ ohos_static_library("libkey_enable_utils") { "hilog:libhilog", "init:libbegetutil", "samgr:samgr_proxy", - "screenlock_mgr:screenlock_client", ] + + defines = [] + if (code_signature_screenlock_mgr_enable) { + defines += [ "SCREENLOCK_MANAGER_ENABLED" ] + external_deps += [ "screenlock_mgr:screenlock_client" ] + } + subsystem_name = "security" part_name = "code_signature" } diff --git a/services/key_enable/utils/src/unlock_event_helper.cpp b/services/key_enable/utils/src/unlock_event_helper.cpp index 2693d1d..23d97a1 100644 --- a/services/key_enable/utils/src/unlock_event_helper.cpp +++ b/services/key_enable/utils/src/unlock_event_helper.cpp @@ -19,7 +19,10 @@ #include "datetime_ex.h" #include "log.h" + +#ifdef SCREENLOCK_MANAGER_ENABLED #include "screenlock_manager.h" +#endif namespace OHOS { namespace Security { @@ -48,6 +51,7 @@ UnlockEventHelper &UnlockEventHelper::GetInstance() bool UnlockEventHelper::CheckUserUnlockByScreenLockManager() { std::lock_guard lock(unlockMutex_); +#ifdef SCREENLOCK_MANAGER_ENABLED if (hasUnLocked_) { return true; } @@ -58,6 +62,7 @@ bool UnlockEventHelper::CheckUserUnlockByScreenLockManager() } else { LOG_ERROR(LABEL, "unable get lock screen status"); } +#endif return hasUnLocked_; } -- Gitee