1 /* 2 * Copyright (c) 2021-2023 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_INNER_MISSION_INFO_H 17 #define OHOS_ABILITY_RUNTIME_INNER_MISSION_INFO_H 18 19 #include <string> 20 21 #include "mission_info.h" 22 23 namespace OHOS { 24 namespace AAFwk { 25 enum class JsonType { 26 NULLABLE, 27 BOOLEAN, 28 NUMBER, 29 OBJECT, 30 ARRAY, 31 STRING, 32 }; 33 enum class StartMethod { 34 START_NORMAL, 35 START_CALL, 36 }; 37 38 /** 39 * @struct InnerMissionInfo 40 * InnerMissionInfo is used to save informations about mission information. 41 */ 42 struct InnerMissionInfo { 43 MissionInfo missionInfo; 44 std::string missionName; 45 std::string missionAffinity; 46 int32_t launchMode; 47 int32_t startMethod; 48 std::string bundleName; 49 int32_t uid; 50 bool isTemporary; 51 std::string specifiedFlag; 52 bool hasRecoverInfo; 53 int32_t collaboratorType = 0; 54 55 std::string ToJsonStr() const; 56 bool FromJsonStr(const std::string &jsonStr); 57 void Dump(std::vector<std::string> &info) const; 58 bool CheckJsonNode(nlohmann::json &value, const std::string &node, JsonType jsonType); 59 60 void UpdateMissionInfo(const InnerMissionInfoDto &info); 61 InnerMissionInfoDto ConvertInnerMissionInfoDto(); 62 }; 63 } // namespace AAFwk 64 } // namespace OHOS 65 #endif // OHOS_ABILITY_RUNTIME_INNER_MISSION_INFO_H 66