1 /* 2 * Copyright (c) 2023-2024 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_EXECUTE_PARAM_URI[] = "ohos.insightIntent.executeParam.uris"; 44 constexpr char INSIGHT_INTENT_EXECUTE_PARAM_FLAGS[] = "ohos.insightIntent.executeParam.flags"; 45 constexpr char INSIGHT_INTENT_SRC_ENTRY[] = "ohos.insightIntent.srcEntry"; 46 47 constexpr int32_t INVALID_DISPLAY_ID = -1; 48 49 class InsightIntentExecuteParam : public Parcelable { 50 public: 51 InsightIntentExecuteParam() = default; 52 ~InsightIntentExecuteParam() = default; 53 54 bool ReadFromParcel(Parcel &parcel); 55 virtual bool Marshalling(Parcel &parcel) const override; 56 static InsightIntentExecuteParam *Unmarshalling(Parcel &parcel); 57 static bool IsInsightIntentExecute(const AAFwk::Want &want); 58 static bool GenerateFromWant(const AAFwk::Want &want, InsightIntentExecuteParam &executeParam); 59 static bool RemoveInsightIntent(AAFwk::Want &want); 60 static void UpdateInsightIntentCallerInfo(const WantParams &wantParams, WantParams &insightIntentParam); 61 62 int32_t executeMode_ = -1; 63 int32_t displayId_ = INVALID_DISPLAY_ID; 64 int32_t flags_ = 0; 65 uint64_t insightIntentId_ = 0; 66 std::shared_ptr<WantParams> insightIntentParam_; 67 std::string bundleName_; 68 std::string moduleName_; 69 std::string abilityName_; 70 std::string insightIntentName_; 71 std::vector<std::string> uris_; 72 }; 73 } // namespace AppExecFwk 74 } // namespace OHOS 75 #endif // OHOS_ABILITY_RUNTIME_INSIGHT_INTENT_EXECUTE_PARAM_H 76