From 89b425717bdbe4fedda4505f8a85a415084c5855 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Aug 2025 22:09:11 +0800 Subject: [PATCH] code optimize Signed-off-by: unknown --- .../include/ability_manager_service.h | 5 ----- .../abilitymgr/src/ability_manager_service.cpp | 18 ++++++++---------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 9cb30a266e2..309aeb2b601 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -2722,11 +2722,6 @@ private: * TRUE: When Caller-Application is Launcher or SystemUI, use old rule. * FALSE: Apply new rule to all application */ - bool newRuleExceptLauncherSystemUI_ = true; - /** Indicates the criteria for judging whether the Caller-Application is in the background - * TRUE: Determine the state by AAFwk::AppState::FOREGROUND. - * FALSE: Determine the state by AppExecFwk::AppProcessState::APP_STATE_FOCUS. - */ bool backgroundJudgeFlag_ = true; /** The applications in white list can associatedWakeUp * TRUE: white list enable. diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 0b40f8d0c8b..3b4d1f77b8f 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -164,7 +164,6 @@ constexpr const char* IS_DELEGATOR_CALL = "isDelegatorCall"; // Startup rule switch constexpr const char* COMPONENT_STARTUP_NEW_RULES = "component.startup.newRules"; -constexpr const char* NEW_RULES_EXCEPT_LAUNCHER_SYSTEMUI = "component.startup.newRules.except.LauncherSystemUI"; constexpr const char* BACKGROUND_JUDGE_FLAG = "component.startup.backgroundJudge.flag"; constexpr const char* WHITE_LIST_ASS_WAKEUP_FLAG = "component.startup.whitelist.associatedWakeUp"; @@ -294,6 +293,7 @@ constexpr int32_t SIZE_10 = 10; constexpr int32_t HIDUMPER_SERVICE_UID = 1212; constexpr int32_t ACCOUNT_MGR_SERVICE_UID = 3058; constexpr int32_t DMS_UID = 5522; +constexpr int32_t WMS_UID = 5555; constexpr int32_t BOOTEVENT_COMPLETED_DELAY_TIME = 1000; constexpr int32_t BOOTEVENT_BOOT_ANIMATION_READY_SIZE = 6; constexpr const char* BUNDLE_NAME_KEY = "bundleName"; @@ -517,7 +517,6 @@ void AbilityManagerService::InitPushTask() void AbilityManagerService::InitStartupFlag() { startUpNewRule_ = CheckNewRuleSwitchState(COMPONENT_STARTUP_NEW_RULES); - newRuleExceptLauncherSystemUI_ = CheckNewRuleSwitchState(NEW_RULES_EXCEPT_LAUNCHER_SYSTEMUI); backgroundJudgeFlag_ = CheckNewRuleSwitchState(BACKGROUND_JUDGE_FLAG); whiteListassociatedWakeUpFlag_ = CheckNewRuleSwitchState(WHITE_LIST_ASS_WAKEUP_FLAG); } @@ -9001,10 +9000,10 @@ void AbilityManagerService::DisconnectBeforeCleanupByUserId(int32_t userId) { int AbilityManagerService::RegisterSnapshotHandler(const sptr& handler) { - auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall(); - if (!isSaCall) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s:permission verification failed", __func__); - return 0; + if (IPCSkeleton::GetCallingUid() != WMS_UID) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "register snapshot handler permission fail:%{public}d", + IPCSkeleton::GetCallingUid()); + return CHECK_PERMISSION_FAILED; } auto missionListManager = GetCurrentMissionListManager(); @@ -10448,14 +10447,13 @@ int AbilityManagerService::SetMissionIcon(const sptr &token, int AbilityManagerService::RegisterWindowManagerServiceHandler(const sptr &handler, bool animationEnabled) { - auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall(); - if (!isSaCall) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "permission verify failed"); + if (IPCSkeleton::GetCallingUid() != WMS_UID) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "register wms handler permission fail:%{public}d", IPCSkeleton::GetCallingUid()); return CHECK_PERMISSION_FAILED; } wmsHandler_ = handler; isAnimationEnabled_ = animationEnabled; - TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s: WMS handler registered successfully.", __func__); + TAG_LOGI(AAFwkTag::ABILITYMGR, "WMS handler registered successfully."); return ERR_OK; } -- Gitee