• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 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 #include "fold_app_usage_event.h"
16 
17 #include "usage_event_common.h"
18 
19 namespace OHOS {
20 namespace HiviewDFX {
21 using namespace FoldAppUsageEventSpace;
22 
FoldAppUsageEvent(const std::string & name,HiSysEvent::EventType type)23 FoldAppUsageEvent::FoldAppUsageEvent(const std::string &name, HiSysEvent::EventType type)
24     : LoggerEvent(name, type)
25 {
26     this->paramMap_ = {
27         {std::string(KEY_OF_PACKAGE), std::string(DEFAULT_STRING)},
28         {std::string(KEY_OF_VERSION), std::string(DEFAULT_STRING)},
29         {std::string(KEY_OF_FOLD_VER_USAGE), DEFAULT_UINT32},
30         {std::string(KEY_OF_FOLD_HOR_USAGE), DEFAULT_UINT32},
31         {std::string(KEY_OF_FOLD_VER_SPLIT_USAGE), DEFAULT_UINT32},
32         {std::string(KEY_OF_FOLD_HOR_SPLIT_USAGE), DEFAULT_UINT32},
33         {std::string(KEY_OF_FOLD_VER_FLOATING_USAGE), DEFAULT_UINT32},
34         {std::string(KEY_OF_FOLD_HOR_FLOATING_USAGE), DEFAULT_UINT32},
35         {std::string(KEY_OF_FOLD_VER_MIDSCENE_USAGE), DEFAULT_UINT32},
36         {std::string(KEY_OF_FOLD_HOR_MIDSCENE_USAGE), DEFAULT_UINT32},
37         {std::string(KEY_OF_EXPD_VER_USAGE), DEFAULT_UINT32},
38         {std::string(KEY_OF_EXPD_HOR_USAGE), DEFAULT_UINT32},
39         {std::string(KEY_OF_EXPD_VER_SPLIT_USAGE), DEFAULT_UINT32},
40         {std::string(KEY_OF_EXPD_HOR_SPLIT_USAGE), DEFAULT_UINT32},
41         {std::string(KEY_OF_EXPD_VER_FLOATING_USAGE), DEFAULT_UINT32},
42         {std::string(KEY_OF_EXPD_HOR_FLOATING_USAGE), DEFAULT_UINT32},
43         {std::string(KEY_OF_EXPD_VER_MIDSCENE_USAGE), DEFAULT_UINT32},
44         {std::string(KEY_OF_EXPD_HOR_MIDSCENE_USAGE), DEFAULT_UINT32},
45         {std::string(KEY_OF_G_VER_FULL_USAGE), DEFAULT_UINT32},
46         {std::string(KEY_OF_G_HOR_FULL_USAGE), DEFAULT_UINT32},
47         {std::string(KEY_OF_G_VER_SPLIT_USAGE), DEFAULT_UINT32},
48         {std::string(KEY_OF_G_HOR_SPLIT_USAGE), DEFAULT_UINT32},
49         {std::string(KEY_OF_G_VER_FLOATING_USAGE), DEFAULT_UINT32},
50         {std::string(KEY_OF_G_HOR_FLOATING_USAGE), DEFAULT_UINT32},
51         {std::string(KEY_OF_G_VER_MIDSCENE_USAGE), DEFAULT_UINT32},
52         {std::string(KEY_OF_G_HOR_MIDSCENE_USAGE), DEFAULT_UINT32},
53         {std::string(KEY_OF_USAGE), DEFAULT_UINT32},
54         {std::string(KEY_OF_DATE), std::string(DEFAULT_STRING)},
55         {std::string(KEY_OF_START_NUM), DEFAULT_UINT32}
56     };
57 }
58 
Report()59 void FoldAppUsageEvent::Report()
60 {
61     HiSysEventWrite(HiSysEvent::Domain::HIVIEWDFX, this->eventName_, this->eventType_,
62         KEY_OF_PACKAGE, this->paramMap_[KEY_OF_PACKAGE].GetString(),
63         KEY_OF_VERSION, this->paramMap_[KEY_OF_VERSION].GetString(),
64         KEY_OF_FOLD_VER_USAGE, this->paramMap_[KEY_OF_FOLD_VER_USAGE].GetUint32(),
65         KEY_OF_FOLD_HOR_USAGE, this->paramMap_[KEY_OF_FOLD_HOR_USAGE].GetUint32(),
66         KEY_OF_EXPD_VER_USAGE, this->paramMap_[KEY_OF_EXPD_VER_USAGE].GetUint32(),
67         KEY_OF_EXPD_HOR_USAGE, this->paramMap_[KEY_OF_EXPD_HOR_USAGE].GetUint32(),
68         KEY_OF_USAGE, this->paramMap_[KEY_OF_USAGE].GetUint32(),
69         KEY_OF_DATE, this->paramMap_[KEY_OF_DATE].GetString(),
70         KEY_OF_START_NUM, this->paramMap_[KEY_OF_START_NUM].GetUint32(),
71         KEY_OF_EXPD_VER_SPLIT_USAGE, this->paramMap_[KEY_OF_EXPD_VER_SPLIT_USAGE].GetUint32(),
72         KEY_OF_EXPD_VER_FLOATING_USAGE, this->paramMap_[KEY_OF_EXPD_VER_FLOATING_USAGE].GetUint32(),
73         KEY_OF_EXPD_VER_MIDSCENE_USAGE, this->paramMap_[KEY_OF_EXPD_VER_MIDSCENE_USAGE].GetUint32(),
74         KEY_OF_EXPD_HOR_SPLIT_USAGE, this->paramMap_[KEY_OF_EXPD_HOR_SPLIT_USAGE].GetUint32(),
75         KEY_OF_EXPD_HOR_FLOATING_USAGE, this->paramMap_[KEY_OF_EXPD_HOR_FLOATING_USAGE].GetUint32(),
76         KEY_OF_EXPD_HOR_MIDSCENE_USAGE, this->paramMap_[KEY_OF_EXPD_HOR_MIDSCENE_USAGE].GetUint32(),
77         KEY_OF_FOLD_VER_SPLIT_USAGE, this->paramMap_[KEY_OF_FOLD_VER_SPLIT_USAGE].GetUint32(),
78         KEY_OF_FOLD_VER_FLOATING_USAGE, this->paramMap_[KEY_OF_FOLD_VER_FLOATING_USAGE].GetUint32(),
79         KEY_OF_FOLD_VER_MIDSCENE_USAGE, this->paramMap_[KEY_OF_FOLD_VER_MIDSCENE_USAGE].GetUint32(),
80         KEY_OF_FOLD_HOR_SPLIT_USAGE, this->paramMap_[KEY_OF_FOLD_HOR_SPLIT_USAGE].GetUint32(),
81         KEY_OF_FOLD_HOR_FLOATING_USAGE, this->paramMap_[KEY_OF_FOLD_HOR_FLOATING_USAGE].GetUint32(),
82         KEY_OF_FOLD_HOR_MIDSCENE_USAGE, this->paramMap_[KEY_OF_FOLD_HOR_MIDSCENE_USAGE].GetUint32(),
83         KEY_OF_G_VER_FULL_USAGE, this->paramMap_[KEY_OF_G_VER_FULL_USAGE].GetUint32(),
84         KEY_OF_G_VER_SPLIT_USAGE, this->paramMap_[KEY_OF_G_VER_SPLIT_USAGE].GetUint32(),
85         KEY_OF_G_VER_FLOATING_USAGE, this->paramMap_[KEY_OF_G_VER_FLOATING_USAGE].GetUint32(),
86         KEY_OF_G_VER_MIDSCENE_USAGE, this->paramMap_[KEY_OF_G_VER_MIDSCENE_USAGE].GetUint32(),
87         KEY_OF_G_HOR_FULL_USAGE, this->paramMap_[KEY_OF_G_HOR_FULL_USAGE].GetUint32(),
88         KEY_OF_G_HOR_SPLIT_USAGE, this->paramMap_[KEY_OF_G_HOR_SPLIT_USAGE].GetUint32(),
89         KEY_OF_G_HOR_FLOATING_USAGE, this->paramMap_[KEY_OF_G_HOR_FLOATING_USAGE].GetUint32(),
90         KEY_OF_G_HOR_MIDSCENE_USAGE, this->paramMap_[KEY_OF_G_HOR_MIDSCENE_USAGE].GetUint32());
91 }
92 } // namespace HiviewDFX
93 } // namespace OHOS
94