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 21 namespace OHOS { 22 namespace MiscServices { 23 namespace UeReporter { 24 using namespace OHOS::HiviewDFX; 25 constexpr const char* CROSS_FLAG = "IS_DISTRIBUTED_PASTEBOARD"; 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 32 constexpr const char* UE_COPY = "DISTRIBUTED_PASTEBOARD_COPY"; 33 constexpr const char* UE_PASTE = "DISTRIBUTED_PASTEBOARD_PASTE"; 34 constexpr const char* UE_SWITCH_STATUS = "PASTEBOARD_SWITCH_STATUS"; 35 constexpr const char* UE_SWITCH_OPERATION = "PASTEBOARD_SWITCH_OPERATION"; 36 37 constexpr const int32_t E_OK_OPERATION = 0; 38 39 constexpr char UE_DOMAIN[] = "PASTEBOARD_UE"; 40 41 enum SwitchStatus : std::int32_t { 42 SWITCH_CLOSE = 0, 43 SWITCH_OPEN = 1, 44 }; 45 46 #define UE_SWITCH(eventName, eventType, switchStatus, ...) \ 47 ({ \ 48 HiSysEventWrite(UeReporter::UE_DOMAIN, eventName, eventType, \ 49 "PNAMEID", "pasteboard_service", "PVERSIONID", UeReporter::VERSION, \ 50 "SWITCH_STATUS", switchStatus, \ 51 ##__VA_ARGS__); \ 52 }) 53 54 #define UE_REPORT(eventName, dataType, bundleName, pasteResult, deviceType, ...) \ 55 ({ \ 56 HiSysEventWrite(UeReporter::UE_DOMAIN, eventName, UeReporter::UE_OPERATION_TYPE, \ 57 "PNAMEID", "pasteboard_service", "PVERSIONID", UeReporter::VERSION, \ 58 "PASTEDATA_TYPE", dataType, "BUNDLE_NAME", bundleName, \ 59 "PASTE_RESULT", pasteResult, "DEVICE_TYPE", deviceType, \ 60 ##__VA_ARGS__); \ 61 }) 62 } 63 } 64 } 65 #endif //DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_UE_H