1 /*
2  * Copyright (c) 2024 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 #ifndef I_APP_THR_EXECUTOR_H
16 #define I_APP_THR_EXECUTOR_H
17 
18 #include <string>
19 
20 class IAppThrExecutor {
21 public:
22 
23     struct AppEvtData {
24         uint64_t time{0};
25         std::string domain{""};
26         std::string eventName{""};
27         std::string bundleName{""};
28         std::string abilityName{""};
29         std::string processName{""};
30         std::string pageUrl{""};
31         std::string sceneId{""};
32         std::string sourceType{""};
33         uint64_t inputTime{0};
34         uint64_t animationStartTime{0};
35         uint64_t renderTime{0};
36         uint64_t responseLatency{0};
37         std::string moduleName{""};
38         int32_t versionCode{0};
39         std::string versionName{""};
40         int32_t startType{0};
41         uint64_t startupTime{0};
42         int32_t startupAbilityType{0};
43         int32_t startupExtensionType{0};
44         int32_t callerUid{0};
45         std::string callerProcessName{""};
46         std::string callerBundleName{""};
47         int32_t appPid{0};
48         int32_t appUid{0};
49         std::string windowName{""};
50         uint64_t animationStartLatency{0};
51         uint64_t animationEndLatency{0};
52         uint64_t e2eLatency{0};
53         int32_t bundleType{0};
54         uint64_t exitTime{0};
55         int32_t exitResult{0};
56         int32_t exitPid{0};
57         std::string note{""};
58     };
59 
60     class IProcessAppEvtTask {
61     public:
62         virtual void ExecuteProcessAppEvtTaskInMainThr(const AppEvtData& data) = 0;
63 
64         virtual ~IProcessAppEvtTask() = default;
65     };
66 
67     virtual void ExecuteHandleEvtInMainThr(IProcessAppEvtTask* task, const AppEvtData& data) = 0;
68 
69     virtual ~IAppThrExecutor() = default;
70 };
71 #endif