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