• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "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     LAUNCHREASON_SHARE,
34     LAUNCHREASON_START_EXTENSION,
35     LAUNCHREASON_CONNECT_EXTENSION
36 };
37 
38 /**
39  * @enum LastExitReason
40  * LastExitReason defines the reason of last exist.
41  */
42 enum LastExitReason {
43     LASTEXITREASON_UNKNOWN = 0,
44     LASTEXITREASON_ABILITY_NOT_RESPONDING,
45     LASTEXITREASON_NORMAL,
46     LASTEXITREASON_CPP_CRASH,
47     LASTEXITREASON_JS_ERROR,
48     LASTEXITREASON_APP_FREEZE,
49     LASTEXITREASON_PERFORMANCE_CONTROL,
50     LASTEXITREASON_RESOURCE_CONTROL,
51     LASTEXITREASON_UPGRADE
52 };
53 
54 /**
55  * @enum OnContinueResult
56  * OnContinueResult defines the result of onContinue.
57  */
58 enum OnContinueResult {
59     ONCONTINUE_AGREE = 0,
60     ONCONTINUE_REJECT,
61     ONCONTINUE_MISMATCH
62 };
63 
64 /**
65  * @struct LaunchParam
66  * LaunchParam is used to save information about ability launch param.
67  */
68 struct LaunchParam : public Parcelable {
69     LaunchReason launchReason = LaunchReason::LAUNCHREASON_UNKNOWN;
70     LastExitReason lastExitReason = LastExitReason::LASTEXITREASON_NORMAL;
71 
72     bool ReadFromParcel(Parcel &parcel);
73     virtual bool Marshalling(Parcel &parcel) const override;
74     static LaunchParam *Unmarshalling(Parcel &parcel);
75 };
76 }  // namespace AAFwk
77 }  // namespace OHOS
78 #endif  // OHOS_ABILITY_RUNTIME_LAUNCH_PARAM_H
79