1 /*
2 * Copyright (c) 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 "app_info.h"
17
18 namespace OHOS {
19 namespace RME {
20 namespace {
21 constexpr int RTG_GRP_INIT = -1;
22 }
23
AppInfo(std::string appName,int pid,int uiTid,int renderTid,int isFocus,AppState state)24 AppInfo::AppInfo(std::string appName, int pid, int uiTid, int renderTid, int isFocus, AppState state)
25 : m_appName(appName),
26 m_pid(pid),
27 m_uiTid(uiTid),
28 m_renderTid(renderTid),
29 m_isFocus(isFocus),
30 m_rtGrp(RTG_GRP_INIT),
31 m_appState(state)
32 {}
33
AppInfo(int pid)34 AppInfo::AppInfo(int pid)
35 : m_appName(""),
36 m_pid(pid),
37 m_uiTid(0),
38 m_renderTid(0),
39 m_isFocus(0),
40 m_rtGrp(0),
41 m_appState(AppState::APP_TERMINATED)
42 {}
43
SetRenderTid(const int tid)44 void AppInfo::SetRenderTid(const int tid)
45 {
46 this->m_renderTid = tid;
47 }
48
GetRenderTid()49 int AppInfo::GetRenderTid()
50 {
51 return m_renderTid;
52 }
53
SetUiTid(const int tid)54 void AppInfo::SetUiTid(const int tid)
55 {
56 this->m_uiTid = tid;
57 }
58
GetUiTid()59 int AppInfo::GetUiTid()
60 {
61 return m_uiTid;
62 }
63
SetAppName(const std::string appName)64 void AppInfo::SetAppName(const std::string appName)
65 {
66 this->m_appName = appName;
67 }
68
SetFocusState(const int isFocus)69 void AppInfo::SetFocusState(const int isFocus)
70 {
71 this->m_isFocus = isFocus;
72 }
73
GetFocusState()74 int AppInfo::GetFocusState()
75 {
76 return m_isFocus;
77 }
78
SetAppState(AppState appState)79 void AppInfo::SetAppState(AppState appState)
80 {
81 this->m_appState = appState;
82 }
83
SetAppPid(const int pid)84 void AppInfo::SetAppPid(const int pid)
85 {
86 this->m_pid = pid;
87 }
88
GetAppPid()89 int AppInfo::GetAppPid()
90 {
91 return m_pid;
92 }
93
GetAppState()94 AppState AppInfo::GetAppState()
95 {
96 return m_appState;
97 }
98
SetRtgrp(const int grpNum)99 void AppInfo::SetRtgrp(const int grpNum)
100 {
101 this->m_rtGrp = grpNum;
102 }
103
GetRtgrp()104 int AppInfo::GetRtgrp()
105 {
106 return m_rtGrp;
107 }
108 } // namespace RME
109 } // namespace OHOS
110