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