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