• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "font_event_publish.h"
17 
18 #include <common_event_data.h>
19 #include <common_event_manager.h>
20 #include <common_event_publish_info.h>
21 #include <common_event_support.h>
22 #include <want.h>
23 
24 namespace OHOS {
25 namespace Global {
26 namespace FontManager {
27 static const std::string FONT_UPDATE_FOR_POLICY = "usual.event.FONT_UPDATE_FOR_POLICY";
28 static const std::string FONT_EVENT_TYPE = "eventType";
29 static const std::string FONT_EVENT_FONT_NAMES = "fontFullNames";
30 
PublishFontUpdate(const FontEventType eventType,const std::string & fullName)31 bool FontEventPublish::PublishFontUpdate(const FontEventType eventType, const std::string &fullName)
32 {
33     OHOS::EventFwk::CommonEventPublishInfo publishInfo;
34     publishInfo.SetOrdered(false);
35 
36     OHOS::AAFwk::Want updateWant;
37     updateWant.SetAction(FONT_UPDATE_FOR_POLICY);
38     updateWant.SetParam(FONT_EVENT_TYPE, eventType);
39     updateWant.SetParam(FONT_EVENT_FONT_NAMES, fullName);
40 
41     OHOS::EventFwk::CommonEventData event(updateWant);
42     return OHOS::EventFwk::CommonEventManager::PublishCommonEvent(event, publishInfo, nullptr);
43 }
44 } // namespace FontManager
45 } // namespace Global
46 } // namespace OHOS
47