校验事件发布方

Signed-off-by: LY <liuyong235@huawei.com>
This commit is contained in:
LY 2024-11-11 15:41:31 +08:00
parent a41e526047
commit 5c6d18489b
2 changed files with 6 additions and 0 deletions

View File

@ -59,6 +59,8 @@ private:
std::shared_ptr<I18nServiceSubscriber> subscriber = nullptr;
static const int RETRY;
static const int32_t OS_ACCOUNT_UID;
static const std::string OS_ACCOUNT_PERMISSION;
};
} // namespace I18n
} // namespace Global

View File

@ -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<I18nServiceSubscriber>(subscribeInfo, *this);
int32_t retry = RETRY;