1 /* 2 * Copyright (c) 2021-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 OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H 17 #define OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H 18 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace AAFwk { 23 /** 24 * @enum LaunchReason 25 * LaunchReason defines the reason of launching ability. 26 */ 27 enum LaunchReason { 28 LAUNCHREASON_UNKNOWN = 0, 29 LAUNCHREASON_START_ABILITY, 30 LAUNCHREASON_CALL, 31 LAUNCHREASON_CONTINUATION, 32 LAUNCHREASON_APP_RECOVERY 33 }; 34 35 /** 36 * @enum LastExitReason 37 * LastExitReason defines the reason of last exist. 38 */ 39 enum LastExitReason { 40 LASTEXITREASON_UNKNOWN = 0, 41 LASTEXITREASON_ABILITY_NOT_RESPONDING, 42 LASTEXITREASON_NORMAL 43 }; 44 45 /** 46 * @enum OnContinueResult 47 * OnContinueResult defines the result of onContinue. 48 */ 49 enum OnContinueResult { 50 ONCONTINUE_AGREE = 0, 51 ONCONTINUE_REJECT, 52 ONCONTINUE_MISMATCH 53 }; 54 55 /** 56 * @struct LaunchParam 57 * LaunchParam is used to save information about ability launch param. 58 */ 59 struct LaunchParam : public Parcelable { 60 LaunchReason launchReason = LaunchReason::LAUNCHREASON_UNKNOWN; 61 LastExitReason lastExitReason = LastExitReason::LASTEXITREASON_NORMAL; 62 63 bool ReadFromParcel(Parcel &parcel); 64 virtual bool Marshalling(Parcel &parcel) const override; 65 static LaunchParam *Unmarshalling(Parcel &parcel); 66 }; 67 } // namespace AAFwk 68 } // namespace OHOS 69 #endif // OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H 70