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_LAUNCH_PARAM_H 17 #define OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H 18 19 #include <string> 20 21 #include "parcel.h" 22 23 namespace OHOS { 24 namespace AAFwk { 25 /** 26 * @enum LaunchReason 27 * LaunchReason defines the reason of launching ability. 28 */ 29 enum LaunchReason { 30 LAUNCHREASON_UNKNOWN = 0, 31 LAUNCHREASON_START_ABILITY, 32 LAUNCHREASON_CALL, 33 LAUNCHREASON_CONTINUATION, 34 LAUNCHREASON_APP_RECOVERY, 35 LAUNCHREASON_SHARE, 36 LAUNCHREASON_START_EXTENSION, 37 LAUNCHREASON_CONNECT_EXTENSION, 38 LAUNCHREASON_AUTO_STARTUP, 39 LAUNCHREASON_INSIGHT_INTENT, 40 LAUNCHREASON_PREPARE_CONTINUATION 41 }; 42 43 /** 44 * @enum LastExitReason 45 * LastExitReason defines the reason of last exist. 46 */ 47 enum LastExitReason { 48 LASTEXITREASON_UNKNOWN = 0, 49 LASTEXITREASON_ABILITY_NOT_RESPONDING, 50 LASTEXITREASON_NORMAL, 51 LASTEXITREASON_CPP_CRASH, 52 LASTEXITREASON_JS_ERROR, 53 LASTEXITREASON_APP_FREEZE, 54 LASTEXITREASON_PERFORMANCE_CONTROL, 55 LASTEXITREASON_RESOURCE_CONTROL, 56 LASTEXITREASON_UPGRADE 57 }; 58 59 /** 60 * @enum OnContinueResult 61 * OnContinueResult defines the result of onContinue. 62 */ 63 enum OnContinueResult { 64 ONCONTINUE_AGREE = 0, 65 ONCONTINUE_REJECT, 66 ONCONTINUE_MISMATCH 67 }; 68 69 /** 70 * @struct LaunchParam 71 * LaunchParam is used to save information about ability launch param. 72 */ 73 struct LaunchParam : public Parcelable { 74 LaunchReason launchReason = LaunchReason::LAUNCHREASON_UNKNOWN; 75 LastExitReason lastExitReason = LastExitReason::LASTEXITREASON_NORMAL; 76 std::string lastExitMessage = ""; 77 78 bool ReadFromParcel(Parcel &parcel); 79 virtual bool Marshalling(Parcel &parcel) const override; 80 static LaunchParam *Unmarshalling(Parcel &parcel); 81 }; 82 } // namespace AAFwk 83 } // namespace OHOS 84 #endif // OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H 85