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 #ifndef APP_INFO_H 17 #define APP_INFO_H 18 19 #include <string> 20 #include <iosfwd> 21 22 namespace OHOS { 23 namespace RME { 24 constexpr int RT_PRIO = 0; 25 constexpr int RT_NUM = 4; 26 27 enum class AppState { 28 APP_FOREGROUND, 29 APP_FOREGROUND_WITHOUT_RTG, 30 APP_BACKGROUND, 31 APP_TERMINATED, 32 APP_UNKNOWN, 33 }; 34 35 enum class CgroupPolicy { 36 SP_DEFAULT = 0, 37 SP_BACKGROUND = 1, 38 SP_FOREGROUND = 2, 39 SP_SYSTEM_BACKGROUND = 3, 40 SP_TOP_APP = 4, 41 SP_SYSTEM_DEFAULT = SP_DEFAULT 42 }; 43 44 class AppInfo { 45 public: 46 AppInfo(int pid, int uid); 47 ~AppInfo() = default; 48 49 void SetRenderTid(const int tid); 50 int GetRenderTid(); 51 void SetUiTid(const int tid); 52 int GetUiTid(); 53 void SetAppName(const std::string appName); 54 void SetAppState(AppState appState); 55 AppState GetAppState(); 56 void SetFocusState(const int isFocus); 57 int GetFocusState(); 58 void SetAppPid(const int pid); 59 int GetAppPid(); 60 int GetAppUid(); 61 void SetRtgrp(const int grpNum); 62 int GetRtgrp(); 63 private: 64 std::string m_appName; 65 int m_pid; 66 int m_uid; 67 int m_uiTid; 68 int m_renderTid; 69 int m_isFocus; 70 int m_rtGrp; 71 AppState m_appState; 72 }; 73 } // namespace RME 74 } // namespace OHOS 75 #endif 76