1 /* 2 * Copyright (c) 2022-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_DISTRIBUTED_HISTSEVENT_REPORT_H 17 #define OHOS_DISTRIBUTED_HISTSEVENT_REPORT_H 18 19 #include <string> 20 #include "iosfwd" 21 22 namespace OHOS { 23 namespace DistributedSchedule { 24 namespace BehaviorEvent { 25 constexpr const char* START_REMOTE_ABILITY = "START_REMOTE_ABILITY"; 26 constexpr const char* CONNECT_REMOTE_ABILITY = "CONNECT_REMOTE_ABILITY"; 27 constexpr const char* DISCONNECT_REMOTE_ABILITY = "DISCONNECT_REMOTE_ABILITY"; 28 constexpr const char* START_REMOTE_ABILITY_BYCALL = "START_REMOTE_ABILITY_BYCALL"; 29 constexpr const char* RELEASE_REMOTE_ABILITY = "RELEASE_REMOTE_ABILITY"; 30 constexpr const char* START_CONTINUATION = "START_CONTINUATION"; 31 } 32 33 namespace FaultEvent { 34 constexpr const char* START_REMOTE_ABILITY = "START_ABILITY_FAILED"; 35 constexpr const char* CONNECT_REMOTE_ABILITY = "CONNECT_ABILITY_FAILED"; 36 constexpr const char* DISCONNECT_REMOTE_ABILITY = "DISCONNECT_ABILITY_FAILED"; 37 constexpr const char* START_REMOTE_ABILITY_BYCALL = "START_ABILITY_BYCALL_FAILED"; 38 constexpr const char* RELEASE_REMOTE_ABILITY = "RELEASE_ABILITY_FAILED"; 39 constexpr const char* START_CONTINUATION = "START_CONTINUATION_FAILED"; 40 } 41 42 namespace EventErrorType { 43 constexpr const char* GET_BUNDLE_MGR_FAILED = "GET_BUNDLE_MGR_FAILED"; 44 constexpr const char* GET_ABILITY_MGR_FAILED = "GET_ABILITY_MGR_FAILED"; 45 } 46 47 namespace EventCallingType { 48 constexpr const char* LOCAL = "LOCAL"; 49 constexpr const char* REMOTE = "REMOTE"; 50 } 51 52 struct BehaviorEventParam { 53 std::string callingType; 54 std::string eventName; 55 int32_t eventResult; 56 std::string bundleName = ""; 57 std::string abilityName = ""; 58 int32_t callingAppUid = -1; 59 std::string srcBundleName = ""; 60 std::string version = ""; 61 }; 62 63 class DmsHiSysEventReport { 64 public: 65 static int ReportBehaviorEvent(const BehaviorEventParam& param); 66 static int ReportFaultEvent(const std::string& eventName, const std::string& errorType); 67 }; 68 } // namespace DistributedSchedule 69 } // namespace OHOS 70 71 #endif /* OHOS_DISTRIBUTED_HISTSEVENT_REPORT_H */