1bc03f14fSopenharmony_ci/* 2bc03f14fSopenharmony_ci * Copyright (C) 2022-2023 Huawei Device Co., Ltd. 3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License. 5bc03f14fSopenharmony_ci * You may obtain a copy of the License at 6bc03f14fSopenharmony_ci * 7bc03f14fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc03f14fSopenharmony_ci * 9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc03f14fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and 13bc03f14fSopenharmony_ci * limitations under the License. 14bc03f14fSopenharmony_ci */ 15bc03f14fSopenharmony_ci 16bc03f14fSopenharmony_ci#ifndef DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_DFX_H 17bc03f14fSopenharmony_ci#define DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_DFX_H 18bc03f14fSopenharmony_ci 19bc03f14fSopenharmony_ci#include "hisysevent.h" 20bc03f14fSopenharmony_cinamespace OHOS { 21bc03f14fSopenharmony_cinamespace MiscServices { 22bc03f14fSopenharmony_cinamespace RadarReporter { 23bc03f14fSopenharmony_ciusing namespace OHOS::HiviewDFX; 24bc03f14fSopenharmony_cienum BizScene : std::int32_t { 25bc03f14fSopenharmony_ci DFX_SET_PASTEBOARD = 1, 26bc03f14fSopenharmony_ci DFX_DISTRIBUTED_PASTEBOARD_BROADCAST_SEND = 2, 27bc03f14fSopenharmony_ci DFX_DISTRIBUTED_PASTEBOARD_BROADCAST_RECEIVE = 3, 28bc03f14fSopenharmony_ci DFX_DISTRIBUTED_PASTEBOARD_BROADCAST_PULL = 4, 29bc03f14fSopenharmony_ci DFX_GET_PASTEBOARD = 5, 30bc03f14fSopenharmony_ci DFX_CLEAR_PASTEBOARD = 6, 31bc03f14fSopenharmony_ci DFX_OBSERVER = 7, 32bc03f14fSopenharmony_ci DFX_PLUGIN_CREATE_DESTROY = 8, 33bc03f14fSopenharmony_ci}; 34bc03f14fSopenharmony_ci 35bc03f14fSopenharmony_cienum BizStageSetPasteboard : std::int32_t { 36bc03f14fSopenharmony_ci DFX_SET_BIZ_SCENE = 0, 37bc03f14fSopenharmony_ci DFX_CHECK_SET_SERVER = 1, 38bc03f14fSopenharmony_ci DFX_CHECK_SET_DELAY_COPY = 2, 39bc03f14fSopenharmony_ci DFX_CHECK_SET_AUTHORITY = 3, 40bc03f14fSopenharmony_ci DFX_CHECK_ONLINE_DEVICE = 4, 41bc03f14fSopenharmony_ci DFX_LOAD_DISTRIBUTED_PLUGIN = 5, 42bc03f14fSopenharmony_ci}; 43bc03f14fSopenharmony_ci 44bc03f14fSopenharmony_cienum BizStageBroadcastSend : std::int32_t { 45bc03f14fSopenharmony_ci DFX_REGISTER_SEND_LISTEN = 1, 46bc03f14fSopenharmony_ci DFX_RECORD_SEND_BROADCAST = 2, 47bc03f14fSopenharmony_ci}; 48bc03f14fSopenharmony_ci 49bc03f14fSopenharmony_cienum BizStageBroadcastReceive : std::int32_t { 50bc03f14fSopenharmony_ci DFX_REGISTER_RECEIVE_LISTEN = 1, 51bc03f14fSopenharmony_ci DFX_RECORD_RECEIVE_BROADCAST = 2, 52bc03f14fSopenharmony_ci}; 53bc03f14fSopenharmony_ci 54bc03f14fSopenharmony_cienum BizStageBroadcastPull : std::int32_t { 55bc03f14fSopenharmony_ci DFX_PRE_SYNC = 1, 56bc03f14fSopenharmony_ci DFX_GET_PASTE_DATA_SYNC = 2, 57bc03f14fSopenharmony_ci DFX_SYNC_DETAIL = 3, 58bc03f14fSopenharmony_ci}; 59bc03f14fSopenharmony_ci 60bc03f14fSopenharmony_cienum BizStageGetPasteboard : std::int32_t { 61bc03f14fSopenharmony_ci DFX_GET_BIZ_SCENE = 0, 62bc03f14fSopenharmony_ci DFX_CHECK_GET_SERVER = 1, 63bc03f14fSopenharmony_ci DFX_CHECK_GET_DELAY_PASTE = 2, 64bc03f14fSopenharmony_ci DFX_CHECK_GET_AUTHORITY = 3, 65bc03f14fSopenharmony_ci DFX_GET_DATA_INFO = 4, 66bc03f14fSopenharmony_ci DFX_LOCAL_PASTE_END = 5, 67bc03f14fSopenharmony_ci DFX_DISTRIBUTED_PASTE_END = 6, 68bc03f14fSopenharmony_ci DFX_DISTRIBUTED_FILE_START = 7, 69bc03f14fSopenharmony_ci DFX_DISTRIBUTED_FILE_END = 8, 70bc03f14fSopenharmony_ci}; 71bc03f14fSopenharmony_ci 72bc03f14fSopenharmony_cienum BizStageClearPasteboard : std::int32_t { 73bc03f14fSopenharmony_ci DFX_MANUAL_CLEAR = 1, 74bc03f14fSopenharmony_ci DFX_AUTO_CLEAR = 2, 75bc03f14fSopenharmony_ci}; 76bc03f14fSopenharmony_ci 77bc03f14fSopenharmony_cienum BizStageObserver : std::int32_t { 78bc03f14fSopenharmony_ci DFX_ADD_OBSERVER = 1, 79bc03f14fSopenharmony_ci DFX_REMOVE_SINGLE_OBSERVER = 2, 80bc03f14fSopenharmony_ci DFX_REMOVE_ALL_OBSERVER = 3, 81bc03f14fSopenharmony_ci}; 82bc03f14fSopenharmony_ci 83bc03f14fSopenharmony_cienum BizStagePlugin : std::int32_t { 84bc03f14fSopenharmony_ci DFX_PLUGIN_CREATE = 1, 85bc03f14fSopenharmony_ci DFX_PLUGIN_DESTROY = 2, 86bc03f14fSopenharmony_ci}; 87bc03f14fSopenharmony_ci 88bc03f14fSopenharmony_cienum StageRes : std::int32_t { 89bc03f14fSopenharmony_ci DFX_IDLE = 0, 90bc03f14fSopenharmony_ci DFX_SUCCESS = 1, 91bc03f14fSopenharmony_ci DFX_FAILED = 2, 92bc03f14fSopenharmony_ci DFX_CANCELLED = 3, 93bc03f14fSopenharmony_ci}; 94bc03f14fSopenharmony_ci 95bc03f14fSopenharmony_cienum BizState : std::int32_t { 96bc03f14fSopenharmony_ci DFX_BEGIN = 1, 97bc03f14fSopenharmony_ci DFX_END = 2, 98bc03f14fSopenharmony_ci}; 99bc03f14fSopenharmony_ci 100bc03f14fSopenharmony_ciclass PasteboardDfxUntil { 101bc03f14fSopenharmony_cipublic: 102bc03f14fSopenharmony_ci static std::string GetAnonymousID(const std::string &deviceId); 103bc03f14fSopenharmony_ci 104bc03f14fSopenharmony_ciprivate: 105bc03f14fSopenharmony_ci static constexpr int minIdLen = 10; 106bc03f14fSopenharmony_ci static constexpr int maskIdLen = 5; 107bc03f14fSopenharmony_ci}; 108bc03f14fSopenharmony_ci 109bc03f14fSopenharmony_ciconstexpr char DOMAIN[] = "DISTDATAMGR"; 110bc03f14fSopenharmony_ciconstexpr const char *EVENT_NAME = "DISTRIBUTED_PASTEBOARD_BEHAVIOR"; 111bc03f14fSopenharmony_ciconstexpr const char *ORG_PKG = "distributeddata"; 112bc03f14fSopenharmony_ciconstexpr const char *BIZ_STATE = "BIZ_STATE"; 113bc03f14fSopenharmony_ciconstexpr const char *ERROR_CODE = "ERROR_CODE"; 114bc03f14fSopenharmony_ciconstexpr const char *SET_DATA_APP = "SET_DATA_APP"; 115bc03f14fSopenharmony_ciconstexpr const char *SET_DATA_TYPE = "SET_DATA_TYPE"; 116bc03f14fSopenharmony_ciconstexpr const char *GET_DATA_APP = "GET_DATA_APP"; 117bc03f14fSopenharmony_ciconstexpr const char *GET_DATA_TYPE = "GET_DATA_TYPE"; 118bc03f14fSopenharmony_ciconstexpr const char *LOCAL_DEV_TYPE = "LOCAL_DEV_TYPE"; 119bc03f14fSopenharmony_ciconstexpr const char *COVER_DELAY_DATA = "COVER_DELAY_DATA"; 120bc03f14fSopenharmony_ciconstexpr const char *SEND_BROADCAST_TIME = "SEND_BROADCAST_TIME_64"; 121bc03f14fSopenharmony_ciconstexpr const char *RECEIVE_BROADCAST_TIME = "RECEIVE_BROADCAST_TIME_64"; 122bc03f14fSopenharmony_ciconstexpr const char *SEQ_ID = "SEQ_ID"; 123bc03f14fSopenharmony_ciconstexpr const char *CONCURRENT_ID = "CONCURRENT_ID"; 124bc03f14fSopenharmony_ciconstexpr const char *DIS_SYNC_TIME = "DIS_SYNC_TIME"; 125bc03f14fSopenharmony_ciconstexpr const char *PACKAGE_NAME = "PACKAGE_NAME"; 126bc03f14fSopenharmony_ciconstexpr const char *PEER_NET_ID = "PEER_NET_ID"; 127bc03f14fSopenharmony_ciconstexpr const char *PEER_UDID = "PEER_UDID"; 128bc03f14fSopenharmony_ciconstexpr HiviewDFX::HiSysEvent::EventType TYPE = HiviewDFX::HiSysEvent::EventType::BEHAVIOR; 129bc03f14fSopenharmony_ci 130bc03f14fSopenharmony_ci#define RADAR_REPORT(bizScene, bizStage, stageRes, ...) \ 131bc03f14fSopenharmony_ci ({ \ 132bc03f14fSopenharmony_ci HiSysEventWrite(RadarReporter::DOMAIN, RadarReporter::EVENT_NAME, RadarReporter::TYPE, "ORG_PKG", \ 133bc03f14fSopenharmony_ci RadarReporter::ORG_PKG, "FUNC", __FUNCTION__, "BIZ_SCENE", bizScene, "BIZ_STAGE", bizStage, "STAGE_RES", \ 134bc03f14fSopenharmony_ci stageRes, ##__VA_ARGS__); \ 135bc03f14fSopenharmony_ci }) 136bc03f14fSopenharmony_ci} // namespace RadarReporter 137bc03f14fSopenharmony_ci} // namespace MiscServices 138bc03f14fSopenharmony_ci} // namespace OHOS 139bc03f14fSopenharmony_ci#endif // DISTRIBUTEDDATAMGR_PASTEBOARD_EVENT_DFX_H 140