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