1 /* 2 * Copyright (c) 2021 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 OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H 17 #define OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H 18 19 #include <string> 20 #include <vector> 21 22 #include "ability_info.h" 23 #include "app_mgr_constants.h" 24 #include "parcel.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 enum class AppProcessState { 29 APP_STATE_CREATE = 0, 30 APP_STATE_READY, 31 APP_STATE_FOREGROUND, 32 APP_STATE_FOCUS, 33 APP_STATE_BACKGROUND, 34 APP_STATE_TERMINATED, 35 APP_STATE_END, 36 }; 37 38 enum class WeightReasonCode { 39 REASON_UNKNOWN = 0, 40 WEIGHT_FOREGROUND = 100, 41 WEIGHT_FOREGROUND_SERVICE = 125, 42 WEIGHT_VISIBLE = 200, 43 WEIGHT_PERCEPTIBLE = 230, 44 WEIGHT_SERVICE = 300, 45 WEIGHT_TOP_SLEEPING = 325, 46 WEIGHT_CANT_SAVE_STATE = 350, 47 WEIGHT_CACHED = 400, 48 WEIGHT_GONE = 1000, 49 }; 50 51 struct RunningProcessInfo : public Parcelable { 52 std::string processName_; 53 std::int32_t pid_; 54 std::int32_t uid_; 55 AppProcessState state_; 56 std::vector<std::string> bundleNames; 57 std::int64_t startTimeMillis_; 58 bool isContinuousTask = false; 59 bool isKeepAlive = false; 60 bool isFocused = false; 61 bool isTestProcess = false; 62 bool isAbilityForegrounding = false; 63 64 bool ReadFromParcel(Parcel &parcel); 65 virtual bool Marshalling(Parcel &parcel) const override; 66 static RunningProcessInfo *Unmarshalling(Parcel &parcel); 67 ProcessType processType_ = ProcessType::NORMAL; 68 ExtensionAbilityType extensionType_ = ExtensionAbilityType::UNSPECIFIED; 69 }; 70 } // namespace AppExecFwk 71 } // namespace OHOS 72 73 #endif // OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H 74