• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_FORM_FWK_FORM_EVENT_REPORT_H
17 #define OHOS_FORM_FWK_FORM_EVENT_REPORT_H
18 
19 #include <string>
20 
21 #include "hisysevent.h"
22 
23 using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType;
24 using HiSysEvent = OHOS::HiviewDFX::HiSysEvent;
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 struct FormEventInfo {
29     int64_t formId = -1;
30     std::string bundleName;
31     std::string moduleName;
32     std::string abilityName;
33     std::string hostBundleName = "";
34 };
35 
36 enum class FormEventName {
37     // form behavior event
38     ADD_FORM,
39     REQUEST_FORM,
40     DELETE_FORM,
41     CASTTEMP_FORM,
42     ACQUIREFORMSTATE_FORM,
43     MESSAGE_EVENT_FORM,
44     ROUTE_EVENT_FORM,
45     BACKGROUND_EVENT_FORM,
46     RELEASE_FORM,
47     DELETE_INVALID_FORM,
48     SET_NEXT_REFRESH_TIME_FORM,
49     FORM_RENDER_BLOCK,
50 };
51 
52 class FormEventReport {
53 public:
54     static void SendFormEvent(const FormEventName &eventName, HiSysEventType type, const FormEventInfo &eventInfo);
55     static void SendSecondFormEvent(const FormEventName &eventName, HiSysEventType type,
56         const FormEventInfo &eventInfo);
57 
58 private:
59     static std::string ConvertEventName(const FormEventName &eventName);
60 };
61 } // namespace AppExecFwk
62 } // namespace OHOS
63 #endif // OHOS_FORM_FWK_FORM_EVENT_REPORT_H
64