• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_INSIGHT_INTENT_EXECUTE_PARAM_H
17 #define OHOS_ABILITY_RUNTIME_INSIGHT_INTENT_EXECUTE_PARAM_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "parcel.h"
23 #include "want.h"
24 
25 namespace OHOS {
26 namespace AppExecFwk {
27 using WantParams = OHOS::AAFwk::WantParams;
28 /**
29  * @enum ExecuteMode
30  * ExecuteMode defines the supported execute mode.
31  */
32 enum ExecuteMode {
33     UI_ABILITY_FOREGROUND = 0,
34     UI_ABILITY_BACKGROUND,
35     UI_EXTENSION_ABILITY,
36     SERVICE_EXTENSION_ABILITY,
37 };
38 
39 constexpr char INSIGHT_INTENT_EXECUTE_PARAM_NAME[] = "ohos.insightIntent.executeParam.name";
40 constexpr char INSIGHT_INTENT_EXECUTE_PARAM_PARAM[] = "ohos.insightIntent.executeParam.param";
41 constexpr char INSIGHT_INTENT_EXECUTE_PARAM_MODE[] = "ohos.insightIntent.executeParam.mode";
42 constexpr char INSIGHT_INTENT_EXECUTE_PARAM_ID[] = "ohos.insightIntent.executeParam.id";
43 constexpr char INSIGHT_INTENT_SRC_ENTRY[] = "ohos.insightIntent.srcEntry";
44 
45 class InsightIntentExecuteParam : public Parcelable {
46 public:
47     InsightIntentExecuteParam() = default;
48     ~InsightIntentExecuteParam() = default;
49 
50     bool ReadFromParcel(Parcel &parcel);
51     virtual bool Marshalling(Parcel &parcel) const override;
52     static InsightIntentExecuteParam *Unmarshalling(Parcel &parcel);
53     static bool IsInsightIntentExecute(const AAFwk::Want &want);
54     static bool GenerateFromWant(const AAFwk::Want &want, InsightIntentExecuteParam &executeParam);
55     static bool RemoveInsightIntent(AAFwk::Want &want);
56 
57     std::string bundleName_;
58     std::string moduleName_;
59     std::string abilityName_;
60     std::string insightIntentName_;
61     std::shared_ptr<WantParams> insightIntentParam_;
62     int32_t executeMode_ = -1;
63     uint64_t insightIntentId_ = 0;
64 };
65 } // namespace AppExecFwk
66 } // namespace OHOS
67 #endif  // OHOS_ABILITY_RUNTIME_INSIGHT_INTENT_EXECUTE_PARAM_H
68