16ea96550Sopenharmony_ci/* 26ea96550Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 36ea96550Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 46ea96550Sopenharmony_ci * you may not use this file except in compliance with the License. 56ea96550Sopenharmony_ci * You may obtain a copy of the License at 66ea96550Sopenharmony_ci * 76ea96550Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 86ea96550Sopenharmony_ci * 96ea96550Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 106ea96550Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 116ea96550Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 126ea96550Sopenharmony_ci * See the License for the specific language governing permissions and 136ea96550Sopenharmony_ci * limitations under the License. 146ea96550Sopenharmony_ci */ 156ea96550Sopenharmony_ci 166ea96550Sopenharmony_ci#include "bigdata.h" 176ea96550Sopenharmony_ci 186ea96550Sopenharmony_ci#include "hisysevent.h" 196ea96550Sopenharmony_ci 206ea96550Sopenharmony_cinamespace OHOS::Security::SecurityGuard { 216ea96550Sopenharmony_cinamespace { 226ea96550Sopenharmony_ci constexpr const char* CALLER_PID = "CALLER_PID"; 236ea96550Sopenharmony_ci constexpr const char* CALL_TIME = "CALL_TIME"; 246ea96550Sopenharmony_ci constexpr const char* EVENT_SIZE = "EVENT_SIZE"; 256ea96550Sopenharmony_ci constexpr const char* EVENT_INFO = "EVENT_INFO"; 266ea96550Sopenharmony_ci constexpr const char* RISK_STATUS = "RISK_STATUS"; 276ea96550Sopenharmony_ci constexpr const char* EVENT_ID = "EVENT_ID"; 286ea96550Sopenharmony_ci constexpr const char* SUB_RET = "SUB_RET"; 296ea96550Sopenharmony_ci constexpr const char* UNSUB_RET = "UNSUB_RET"; 306ea96550Sopenharmony_ci constexpr const char* CONFIG_PATH = "CONFIG_PATH"; 316ea96550Sopenharmony_ci constexpr const char* RET = "RET"; 326ea96550Sopenharmony_ci} 336ea96550Sopenharmony_ci 346ea96550Sopenharmony_civoid BigData::ReportObatinDataEvent(const ObatinDataEvent &event) 356ea96550Sopenharmony_ci{ 366ea96550Sopenharmony_ci HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY_GUARD, "OBTAIN_DATA", 376ea96550Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, CALLER_PID, event.pid, 386ea96550Sopenharmony_ci CALL_TIME, event.time, EVENT_SIZE, event.size); 396ea96550Sopenharmony_ci} 406ea96550Sopenharmony_ci 416ea96550Sopenharmony_civoid BigData::ReportClassifyEvent(const ClassifyEvent &event) 426ea96550Sopenharmony_ci{ 436ea96550Sopenharmony_ci HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY_GUARD, "RISK_ANALYSIS", 446ea96550Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, CALLER_PID, event.pid, 456ea96550Sopenharmony_ci CALL_TIME, event.time, EVENT_INFO, event.eventInfo, RISK_STATUS, event.status); 466ea96550Sopenharmony_ci} 476ea96550Sopenharmony_ci 486ea96550Sopenharmony_civoid BigData::ReportSgSubscribeEvent(const SgSubscribeEvent &event) 496ea96550Sopenharmony_ci{ 506ea96550Sopenharmony_ci HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY_GUARD, "SG_EVENT_SUBSCRIBE", 516ea96550Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, CALLER_PID, event.pid, 526ea96550Sopenharmony_ci CALL_TIME, event.time, EVENT_ID, event.eventId, SUB_RET, event.ret); 536ea96550Sopenharmony_ci} 546ea96550Sopenharmony_ci 556ea96550Sopenharmony_civoid BigData::ReportSgUnsubscribeEvent(const SgUnsubscribeEvent &event) 566ea96550Sopenharmony_ci{ 576ea96550Sopenharmony_ci HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY_GUARD, "SG_EVENT_UNSUBSCRIBE", 586ea96550Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, CALLER_PID, event.pid, 596ea96550Sopenharmony_ci CALL_TIME, event.time, UNSUB_RET, event.ret); 606ea96550Sopenharmony_ci} 616ea96550Sopenharmony_ci 626ea96550Sopenharmony_civoid BigData::ReportConfigUpdateEvent(const ConfigUpdateEvent &event) 636ea96550Sopenharmony_ci{ 646ea96550Sopenharmony_ci HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY_GUARD, "SG_UPDATE_CONFIG", 656ea96550Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, CONFIG_PATH, event.path, 666ea96550Sopenharmony_ci CALL_TIME, event.time, RET, event.ret); 676ea96550Sopenharmony_ci} 686ea96550Sopenharmony_ci}