1 /* 2 * Copyright (c) 2022 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_EVENT_REPORT_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_EVENT_REPORT_H 18 19 #include <unordered_map> 20 21 #include "event_report.h" 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 class InnerEventReport { 26 public: 27 /** 28 * @brief Send system events. 29 * @param eventType Indicates the bms eventInfo. 30 * @param eventInfo Indicates the eventInfo. 31 */ 32 static void SendSystemEvent(BMSEventType eventType, const EventInfo& eventInfo); 33 34 private: 35 // fault event 36 static void InnerSendBundleInstallExceptionEvent(const EventInfo& eventInfo); 37 static void InnerSendBundleUninstallExceptionEvent(const EventInfo& eventInfo); 38 static void InnerSendBundleUpdateExceptionEvent(const EventInfo& eventInfo); 39 static void InnerSendPreBundleRecoverExceptionEvent(const EventInfo& eventInfo); 40 static void InnerSendBundleStateChangeExceptionEvent(const EventInfo& eventInfo); 41 static void InnerSendBundleCleanCacheExceptionEvent(const EventInfo& eventInfo); 42 43 // behavior event 44 static void InnerSendBootScanStartEvent(const EventInfo& eventInfo); 45 static void InnerSendBootScanEndEvent(const EventInfo& eventInfo); 46 static void InnerSendBundleInstallEvent(const EventInfo& eventInfo); 47 static void InnerSendBundleUninstallEvent(const EventInfo& eventInfo); 48 static void InnerSendBundleUpdateEvent(const EventInfo& eventInfo); 49 static void InnerSendPreBundleRecoverEvent(const EventInfo& eventInfo); 50 static void InnerSendBundleStateChangeEvent(const EventInfo& eventInfo); 51 static void InnerSendBundleCleanCacheEvent(const EventInfo& eventInfo); 52 53 template<typename... Types> 54 static void InnerEventWrite(const std::string &eventName, 55 HiSysEventType type, Types... keyValues); 56 57 static std::unordered_map<BMSEventType, void (*)(const EventInfo& eventInfo)> bmsSysEventMap_; 58 }; 59 } // namespace AppExecFwk 60 } // namespace OHOS 61 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_EVENT_REPORT_H 62