From 5c6d18489b2e773b94b2964ae05e009d3f779a0e Mon Sep 17 00:00:00 2001 From: LY Date: Mon, 11 Nov 2024 15:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E4=BA=8B=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: LY --- services/include/i18n_service_event.h | 2 ++ services/src/i18n_service_event.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/services/include/i18n_service_event.h b/services/include/i18n_service_event.h index 5e7cdac4..8ceac43e 100644 --- a/services/include/i18n_service_event.h +++ b/services/include/i18n_service_event.h @@ -59,6 +59,8 @@ private: std::shared_ptr subscriber = nullptr; static const int RETRY; + static const int32_t OS_ACCOUNT_UID; + static const std::string OS_ACCOUNT_PERMISSION; }; } // namespace I18n } // namespace Global diff --git a/services/src/i18n_service_event.cpp b/services/src/i18n_service_event.cpp index 8cc92cb9..78af1586 100644 --- a/services/src/i18n_service_event.cpp +++ b/services/src/i18n_service_event.cpp @@ -26,6 +26,8 @@ namespace OHOS { namespace Global { namespace I18n { const int I18nServiceEvent::RETRY = 3; +const int32_t I18nServiceEvent::OS_ACCOUNT_UID = 3058; +const std::string I18nServiceEvent::OS_ACCOUNT_PERMISSION = "ohos.permission.MANAGE_LOCAL_ACCOUNTS"; I18nServiceEvent::I18nServiceEvent() { @@ -53,6 +55,8 @@ void I18nServiceEvent::SubscriberEvent() matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_ADDED); matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_REMOVED); EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills); + subscribeInfo.SetPublisherUid(OS_ACCOUNT_UID); + subscribeInfo.SetPermission(OS_ACCOUNT_PERMISSION); subscriber = std::make_shared(subscribeInfo, *this); int32_t retry = RETRY;