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 UDMF_RADAR_REPORTER_H 17 #define UDMF_RADAR_REPORTER_H 18 19 #include "hisysevent_c.h" 20 #include "visibility.h" 21 #include <string> 22 23 namespace OHOS { 24 namespace UDMF { 25 namespace RadarReporter { 26 enum BizScene : int32_t { 27 SET_DATA = 1, 28 SYNC_DATA = 2, 29 GET_DATA = 3, 30 UTD_REGISTER = 4 31 }; 32 33 enum SetDataStage : int32_t { 34 SET_DATA_BEGIN = 1, 35 SET_DATA_SERVICE_BEGIN = 2, 36 VERIFY_SHARE_PERMISSIONS = 3, 37 GERERATE_DFS_URI = 4, 38 SET_DATA_END = 5 39 }; 40 41 enum SyncDataStage : int32_t { 42 SYNC_BEGIN = 1, 43 SYNC_END = 2 44 }; 45 46 enum GetDataStage : int32_t { 47 GET_DATA_BEGIN = 1, 48 VERIFY_PRIVILEGE = 2, 49 GRANT_URI_PERMISSION = 3, 50 GET_DATA_END = 4 51 }; 52 53 enum UtdRegisterStage : int32_t { 54 UTD_REGISTER_BEGIN = 1, 55 UTD_REGISTER_END = 2, 56 }; 57 58 enum StageRes : int32_t { 59 IDLE = 0, 60 SUCCESS = 1, 61 FAILED = 2, 62 CANCELLED = 3 63 }; 64 65 enum BizState : int32_t { 66 DFX_BEGIN = 1, 67 DFX_END = 2 68 }; 69 const constexpr char DOMAIN[] = "DISTDATAMGR"; 70 const constexpr char EVENT_NAME[] = "DISTRIBUTED_UDMF_BEHAVIOR"; 71 const constexpr char ORG_PKG[] = "distributeddata"; 72 } // namespace RadarReporter 73 74 class API_EXPORT RadarReporterAdapter { 75 public: 76 static void ReportNormal(std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t state); 77 static void ReportNormal(std::string func, int32_t scene, int32_t stage, int32_t stageRes); 78 static void ReportNormal(std::string func, int32_t scene, int32_t stage, int32_t stageRes, std::string &bundleName); 79 static void ReportFail( 80 std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state); 81 static void ReportFail(std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode); 82 }; 83 } // namespace UDMF 84 } // namespace OHOS 85 #endif // UDMF_RADAR_REPORTER_H