• 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 #ifndef DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_UE_H
17 #define DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_UE_H
18 
19 #include "hisysevent.h"
20 #include "pasteboard_event_common.h"
21 
22 namespace OHOS {
23 namespace MiscServices {
24 namespace UeReporter {
25 using namespace OHOS::HiviewDFX;
26 
27 constexpr HiviewDFX::HiSysEvent::EventType UE_OPERATION_TYPE = HiviewDFX::HiSysEvent::EventType::BEHAVIOR;
28 constexpr HiviewDFX::HiSysEvent::EventType UE_STATUS_TYPE = HiviewDFX::HiSysEvent::EventType::STATISTIC;
29 
30 constexpr const char *VERSION = "1.0";
31 constexpr char UE_DOMAIN[] = "PASTEBOARD_UE";
32 
33 enum SwitchStatus : std::int32_t {
34     SWITCH_CLOSE = 0,
35     SWITCH_OPEN = 1,
36 };
37 
38 #define UE_SWITCH(eventName, eventType, switchStatus, ...)                                                          \
39     ({                                                                                                              \
40         HiSysEventWrite(UeReporter::UE_DOMAIN, eventName, eventType, "PNAMEID", "pasteboard_service", "PVERSIONID", \
41             UeReporter::VERSION, "SWITCH_STATUS", switchStatus, ##__VA_ARGS__);                                     \
42     })
43 
44 #define UE_REPORT(eventName, reportInfo, ...)                                \
45     ({                                                                                                          \
46         HiSysEventWrite(UeReporter::UE_DOMAIN, eventName, UeReporter::UE_OPERATION_TYPE, "PNAMEID",             \
47             "pasteboard_service", "PVERSIONID", UeReporter::VERSION,                                            \
48             "RECORD_NUM", reportInfo.description.recordNum, "ENTRY_NUM", reportInfo.description.entryNum,       \
49             "PASTEDATA_TYPE", reportInfo.description.mimeTypes, "BUNDLE_NAME", reportInfo.bundleName,           \
50             "PASTE_RESULT", reportInfo.ret, "DEVICE_TYPE", reportInfo.commonInfo.deviceType,                    \
51             "DATA_SIZE", reportInfo.commonInfo.dataSize,                                                        \
52             "CURRENT_ACCOUNT_ID", reportInfo.commonInfo.currentAccountId, ##__VA_ARGS__);                       \
53     })
54 } // namespace UeReporter
55 } // namespace MiscServices
56 } // namespace OHOS
57 #endif //DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_UE_H