18e920a95Sopenharmony_ci/*
28e920a95Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
38e920a95Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48e920a95Sopenharmony_ci * you may not use this file except in compliance with the License.
58e920a95Sopenharmony_ci * You may obtain a copy of the License at
68e920a95Sopenharmony_ci *
78e920a95Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88e920a95Sopenharmony_ci *
98e920a95Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108e920a95Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118e920a95Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128e920a95Sopenharmony_ci * See the License for the specific language governing permissions and
138e920a95Sopenharmony_ci * limitations under the License.
148e920a95Sopenharmony_ci */
158e920a95Sopenharmony_ci
168e920a95Sopenharmony_ciuse hisysevent::EventType;
178e920a95Sopenharmony_ci
188e920a95Sopenharmony_ci/// report add key err by hisysevent
198e920a95Sopenharmony_cipub fn report_add_key_err(cert_type: &str, errcode: i32) {
208e920a95Sopenharmony_ci    hisysevent::write(
218e920a95Sopenharmony_ci        "CODE_SIGN",
228e920a95Sopenharmony_ci        "CS_ADD_KEY",
238e920a95Sopenharmony_ci        EventType::Fault,
248e920a95Sopenharmony_ci        &[
258e920a95Sopenharmony_ci            hisysevent::build_str_param!("STRING_SINGLE", cert_type),
268e920a95Sopenharmony_ci            hisysevent::build_number_param!("INT32_SINGLE", errcode),
278e920a95Sopenharmony_ci        ],
288e920a95Sopenharmony_ci    );
298e920a95Sopenharmony_ci}
308e920a95Sopenharmony_ci
318e920a95Sopenharmony_ci/// report parse local profile err by hisysevent
328e920a95Sopenharmony_cipub fn report_parse_profile_err(profile_path: &str, errcode: i32) {
338e920a95Sopenharmony_ci    hisysevent::write(
348e920a95Sopenharmony_ci        "CODE_SIGN",
358e920a95Sopenharmony_ci        "CS_ERR_PROFILE",
368e920a95Sopenharmony_ci        EventType::Security,
378e920a95Sopenharmony_ci        &[
388e920a95Sopenharmony_ci            hisysevent::build_str_param!("STRING_SINGLE", profile_path),
398e920a95Sopenharmony_ci            hisysevent::build_number_param!("INT32_SINGLE", errcode),
408e920a95Sopenharmony_ci        ],
418e920a95Sopenharmony_ci    );
428e920a95Sopenharmony_ci}