From 22a964596bfcc0ccd10fee9fbc3db31255c63ba2 Mon Sep 17 00:00:00 2001 From: wendel Date: Thu, 11 Sep 2025 10:51:35 +0800 Subject: [PATCH] freeze Signed-off-by: wendel Change-Id: I28a5a2884572f561fd11e6348fd0e378d7a29c22 --- services/abilitymgr/src/ability_auto_startup_service.cpp | 3 ++- services/abilitymgr/src/ability_manager_service.cpp | 4 ++-- services/appmgr/src/app_mgr_service_inner.cpp | 9 +++++---- services/common/src/user_controller/user_controller.cpp | 3 ++- utils/server/constant/server_constant.h | 1 + 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/services/abilitymgr/src/ability_auto_startup_service.cpp b/services/abilitymgr/src/ability_auto_startup_service.cpp index bcf157ca5a5..621058ce7fe 100644 --- a/services/abilitymgr/src/ability_auto_startup_service.cpp +++ b/services/abilitymgr/src/ability_auto_startup_service.cpp @@ -24,6 +24,7 @@ #include "hilog_tag_wrapper.h" #include "in_process_call_wrapper.h" #include "permission_constants.h" +#include "server_constant.h" #include "user_controller/user_controller.h" namespace OHOS { @@ -429,7 +430,7 @@ int32_t AbilityAutoStartupService::GetValidUserId(int32_t userId) validUserId = IPCSkeleton::GetCallingUid() / AppExecFwk::Constants::BASE_USER_RANGE; } if (validUserId == U0_USER_ID || validUserId == U1_USER_ID) { - validUserId = UserController::GetInstance().GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId()); + validUserId = UserController::GetInstance().GetForegroundUserId(ServerConstant::DEFAULT_DISPLAY_ID); } return validUserId; } diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 66561abe711..b275d7fde94 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -12780,7 +12780,7 @@ void AbilityManagerService::NotifyConfigurationChange(const AppExecFwk::Configur void AbilityManagerService::NotifyStartResidentProcess(std::vector &bundleInfos) { int32_t callerUser = - AbilityRuntime::UserController::GetInstance().GetForegroundUserId(DisplayUtil::ObtainDefaultDisplayId()); + AbilityRuntime::UserController::GetInstance().GetForegroundUserId(ServerConstant::DEFAULT_DISPLAY_ID); std::vector bundleInfosForU0; std::map> bundleInfosMap; for (const auto &item: bundleInfos) { @@ -12823,7 +12823,7 @@ void AbilityManagerService::NotifyStartKeepAliveProcess(std::vector> bundleInfosMap; std::vector bundleInfosForU1; for (const auto &item: bundleInfos) { diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index e7a1ac8b66c..da0cc7ff5c3 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -304,6 +304,7 @@ constexpr int32_t PROCESS_START_FAILED_SUB_REASON_UNKNOWN = 0; constexpr int32_t MAX_SPECIFIED_PROCESS_NAME_LENGTH = 255; constexpr int32_t NWEB_PRELOAD_DELAY = 3000000; +constexpr uint64_t DEFAULT_DISPLAY_ID = 0; constexpr const char* APP_INSTANCE_KEY_0 = "app_instance_0"; @@ -583,7 +584,7 @@ int32_t AppMgrServiceInner::PreloadApplication(const std::string &bundleName, in if (userId == DEFAULT_INVAL_VALUE) { userId = GetUserIdByUid(IPCSkeleton::GetCallingUid()); if (userId == U0_USER_ID || userId == U1_USER_ID) { - userId = UserController::GetInstance().GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId()); + userId = UserController::GetInstance().GetForegroundUserId(DEFAULT_DISPLAY_ID); } } if (UserRecordManager::GetInstance().IsLogoutUser(userId)) { @@ -2324,7 +2325,7 @@ int32_t AppMgrServiceInner::ClearUpApplicationData(const std::string &bundleName if (userId == DEFAULT_INVAL_VALUE) { newUserId = GetUserIdByUid(callerUid); if (newUserId == U0_USER_ID || newUserId == U1_USER_ID) { - newUserId = UserController::GetInstance().GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId()); + newUserId = UserController::GetInstance().GetForegroundUserId(DEFAULT_DISPLAY_ID); } } TAG_LOGI(AAFwkTag::APPMGR, "bundleName: %{public}s, uId: %{public}d, appIndex: %{public}d", bundleName.c_str(), @@ -2346,7 +2347,7 @@ int32_t AppMgrServiceInner::ClearUpApplicationDataBySelf(int32_t callerUid, pid_ if (userId == DEFAULT_INVAL_VALUE) { newUserId = GetUserIdByUid(callerUid); if (newUserId == U0_USER_ID) { - newUserId = UserController::GetInstance().GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId()); + newUserId = UserController::GetInstance().GetForegroundUserId(DEFAULT_DISPLAY_ID); } } auto appCloneIndex = appRecord->GetAppIndex(); @@ -6027,7 +6028,7 @@ void AppMgrServiceInner::HandleConfigurationChange(const Configuration& config, for (const auto &item : appStateCallbacks_) { if (item.callback != nullptr && (userId == -1 || item.userId == 0 || item.userId == userId)) { item.callback->NotifyConfigurationChange(config, - UserController::GetInstance().GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId())); + UserController::GetInstance().GetForegroundUserId(DEFAULT_DISPLAY_ID)); } } } diff --git a/services/common/src/user_controller/user_controller.cpp b/services/common/src/user_controller/user_controller.cpp index 24fcbacb5b2..acd734740bc 100644 --- a/services/common/src/user_controller/user_controller.cpp +++ b/services/common/src/user_controller/user_controller.cpp @@ -31,6 +31,7 @@ constexpr int32_t U0_USER_ID = 0; constexpr int32_t U1_USER_ID = 1; constexpr int32_t USER_ID_DEFAULT = 100; constexpr int32_t ACCOUNT_MGR_SERVICE_UID = 3058; +constexpr uint64_t DEFAULT_DISPLAY_ID = 0; } UserController& UserController::GetInstance() { @@ -112,7 +113,7 @@ int32_t UserController::GetCallerUserId() int32_t callerUser = callerUid / BASE_USER_RANGE; TAG_LOGD(AAFwkTag::USER_CONTROLLER, "callerUser = %{public}d, CallingUid = %{public}d.", callerUser, callerUid); if (callerUser == U0_USER_ID || callerUser == U1_USER_ID) { - callerUser = GetForegroundUserId(AAFwk::DisplayUtil::ObtainDefaultDisplayId()); + callerUser = GetForegroundUserId(DEFAULT_DISPLAY_ID); } return callerUser; } diff --git a/utils/server/constant/server_constant.h b/utils/server/constant/server_constant.h index c7c4a8693b6..2faa2e20223 100644 --- a/utils/server/constant/server_constant.h +++ b/utils/server/constant/server_constant.h @@ -26,6 +26,7 @@ constexpr uint32_t SCENARIO_BACK_TO_CALLER_ABILITY_WITH_RESULT = 0x00000004; // skip onNewWant in these scenerios constexpr uint32_t SKIP_ON_NEW_WANT_SCENARIOS = SCENARIO_MOVE_MISSION_TO_FRONT | SCENARIO_SHOW_ABILITY | SCENARIO_BACK_TO_CALLER_ABILITY_WITH_RESULT; +constexpr uint64_t DEFAULT_DISPLAY_ID = 0; } // namespace ServerConstant } // namespace OHOS::AbilityRuntime #endif // OHOS_ABILITY_RUNTIME_SERVER_CONSTANT_H \ No newline at end of file -- Gitee