1 /* 2 * Copyright (C) 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 #ifndef APP_DOMAIN_VERIFY_HISYSTEM_EVENT_H 16 #define APP_DOMAIN_VERIFY_HISYSTEM_EVENT_H 17 #include <string> 18 #include "hisysevent.h" 19 20 namespace OHOS { 21 namespace AppDomainVerify { 22 static constexpr char APP_DOMAIN_VERIFY[] = "APPDOMAINVERIFY"; 23 namespace EventType { 24 const std::string APP_INSTALL_EVENT = "PKG_INSTALL"; 25 const std::string APP_DELETE_EVENT = "PKG_UNINSTALL"; 26 const std::string APP_VERIFY_EVENT = "PKG_VERIFY_RESULT"; 27 } 28 namespace EventParamKey { 29 const std::string APP_ID = "APP_ID"; 30 const std::string BUNDLE_NAME = "BUNDLE_NAME"; 31 const std::string VERIFY_STATUS = "VERIFY_STATUS"; 32 const std::string VERIFY_WAY = "VERIFY_WAY"; 33 } 34 typedef enum EnumTaskType { 35 IMMEDIATE_TASK, 36 BOOT_REFRESH_TASK, 37 SCHEDULE_REFRESH_TASK, 38 UNKNOWN_TASK 39 } TaskType; 40 41 #define INSTALL_EVENT(appIdentifier, bundleName) \ 42 do { \ 43 HiSysEventWrite(APP_DOMAIN_VERIFY, EventType::APP_INSTALL_EVENT, \ 44 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, EventParamKey::APP_ID, (appIdentifier), \ 45 EventParamKey::BUNDLE_NAME, (bundleName)); \ 46 } while (0) 47 48 #define UNINSTALL_EVENT(appIdentifier, bundleName) \ 49 do { \ 50 HiSysEventWrite(APP_DOMAIN_VERIFY, EventType::APP_DELETE_EVENT, \ 51 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, EventParamKey::APP_ID, (appIdentifier), \ 52 EventParamKey::BUNDLE_NAME, (bundleName)); \ 53 } while (0) 54 55 #define VERIFY_RESULT_EVENT(appIdentifier, bundleName, type, status) \ 56 do { \ 57 HiSysEventWrite(APP_DOMAIN_VERIFY, EventType::APP_VERIFY_EVENT, \ 58 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, EventParamKey::APP_ID, (appIdentifier), \ 59 EventParamKey::BUNDLE_NAME, (bundleName), EventParamKey::VERIFY_WAY, (type), EventParamKey::VERIFY_STATUS, \ 60 (status)); \ 61 } while (0) 62 } 63 } 64 #endif