• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #ifndef POINTER_EVENT_STATISTICS_H
17 #define POINTER_EVENT_STATISTICS_H
18 
19 namespace OHOS {
20 namespace MMI {
21 class PointerEventStatistics {
22 public:
23     enum ExitPoint : int32_t {
24         FILTER_CONSUME = 0,
25         INTERCEPT_CONSUME,
26         STYLUS_INTERRUPT_TOUCH,
27         FOLD_INTERRUPT_TOUCH,
28         ANCO_CONSUME,
29         TRANSFORM_CANCEL,
30         DISPATCH,
31         AIBASE_GESTURE,
32         MULTI_FINGER_GESTURE,
33         MAX
34     };
35 
36     enum ErrnoCode : int32_t {
37         DISPLAY_NOT_FOUND = 65470476,
38         WINDOW_NOT_FOUND = 65470477,
39         SESSION_NOT_FOUND = 65470478
40     };
41 
PointerEventStatistics()42     PointerEventStatistics()
43     {
44         std::fill(std::begin(counters_), std::end(counters_), 0);
45     }
46 
AddExitPoint(ExitPoint exitPoint)47     void AddExitPoint(ExitPoint exitPoint)
48     {
49         counters_[static_cast<int>(exitPoint)]++;
50         callCount_++;
51     }
52 
ClearStats()53     void ClearStats()
54     {
55         std::fill(std::begin(counters_), std::end(counters_), 0);
56         callCount_ = 0;
57     }
58 
GetCallCount()59     int32_t GetCallCount()
60     {
61         return callCount_;
62     }
63 
64     int counters_[static_cast<int>(ExitPoint::MAX)];
65     int32_t callCount_{0};
66 }; // class PointerEventStatistics
67 } // namespace MMI
68 } // namespace OHOS
69 
70 #endif // POINTER_EVENT_STATISTICS_H
71