• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include "base/ressched/ressched_report.h"
17 
18 namespace OHOS::Ace {
GetInstance()19 ResSchedReport& ResSchedReport::GetInstance()
20 {
21     static ResSchedReport instance;
22     return instance;
23 }
24 
25 namespace {
26     constexpr char ABILITY_OR_PAGE_SWITCH_START[] = "ability_or_page_switch_start";
27     constexpr char ABILITY_OR_PAGE_SWITCH_END[] = "ability_or_page_switch_end";
28     constexpr uint64_t RES_TYPE_ABILITY_OR_PAGE_SWITCH = 156;
29 }
30 
ResSchedReport()31 ResSchedReport::ResSchedReport()
32 {}
33 
ResSchedDataReport(const char * name,const std::unordered_map<std::string,std::string> & param,int64_t tid)34 void ResSchedReport::ResSchedDataReport(
35     const char* name, const std::unordered_map<std::string, std::string>& param,
36     int64_t tid)
37 {
38     reportDataFunc_ = nullptr;
39     if (std::strcmp(ABILITY_OR_PAGE_SWITCH_START, name) == 0 || std::strcmp(ABILITY_OR_PAGE_SWITCH_END, name) == 0) {
40         keyEventCountMS = RES_TYPE_ABILITY_OR_PAGE_SWITCH;
41     }
42 }
43 
ResSchedDataReport(uint32_t resType,int32_t value,const std::unordered_map<std::string,std::string> & payload)44 void ResSchedReport::ResSchedDataReport(
45     uint32_t resType, int32_t value, const std::unordered_map<std::string, std::string>& payload)
46 {}
47 
OnTouchEvent(const TouchEvent & touchEvent,const ReportConfig & config)48 void ResSchedReport::OnTouchEvent(const TouchEvent& touchEvent, const ReportConfig& config) {}
49 
OnKeyEvent(const KeyEvent & event)50 void ResSchedReport::OnKeyEvent(const KeyEvent& event) {}
51 
HandlePageTransition(const std::string & fromPage,const std::string & toPage,const std::string & mode)52 void ResSchedReport::HandlePageTransition(const std::string& fromPage,
53     const std::string& toPage, const std::string& mode)
54 {}
55 
TriggerModuleSerializer()56 void ResSchedReport::TriggerModuleSerializer()
57 {
58     loadPageOn_ = true;
59 }
60 
ResSchedReportScope(const std::string & name,const std::unordered_map<std::string,std::string> & param)61 ResSchedReportScope::ResSchedReportScope(
62     const std::string& name, const std::unordered_map<std::string, std::string>& param)
63     : name_(name), payload_(param)
64 {}
65 
66 ResSchedReportScope::~ResSchedReportScope() = default;
67 } // namespace OHOS::Ace
68