1 /* 2 * Copyright (c) 2025 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 MOCK_OHOS_ABILITY_BASE_WANT_H 17 #define MOCK_OHOS_ABILITY_BASE_WANT_H 18 19 #include <string> 20 #include <vector> 21 22 #include "iremote_object.h" 23 #include "uri.h" 24 #include "want_params.h" 25 #include "element_name.h" 26 #include "parcel.h" 27 28 namespace OHOS { 29 namespace AAFwk { 30 class Want final : public RefBase { 31 public: 32 static constexpr unsigned int FLAG_ABILITY_CONTINUATION = 0x00000008; 33 static constexpr unsigned int FLAG_INSTALL_ON_DEMAND = 0x00000800; 34 static constexpr unsigned int FLAG_ABILITY_PREPARE_CONTINUATION = 0x00001000; 35 Want()36 Want() {} GetFlags()37 unsigned int GetFlags() const 38 { 39 return 0; 40 } AddFlags(unsigned int flags)41 Want &AddFlags(unsigned int flags) 42 { 43 return *this; 44 } SetElementName(const std::string & bundleName,const std::string & abilityName)45 Want &SetElementName(const std::string &bundleName, const std::string &abilityName) 46 { 47 return *this; 48 } 49 50 Want &SetElementName(const std::string &deviceId, const std::string &bundleName, 51 const std::string &abilityName, const std::string &moduleName = "") 52 { 53 return *this; 54 } SetElement(const AppExecFwk::ElementName & element)55 Want &SetElement(const AppExecFwk::ElementName &element) 56 { 57 return *this; 58 } 59 GetElement()60 AppExecFwk::ElementName GetElement() const 61 { 62 AppExecFwk::ElementName element; 63 return element; 64 } 65 GetUri()66 Uri GetUri() const 67 { 68 Uri uri; 69 return uri; 70 } 71 GetUriString()72 std::string GetUriString() const 73 { 74 return ""; 75 } 76 GetAction()77 std::string GetAction() const 78 { 79 return ""; 80 } 81 SetAction(const std::string & action)82 Want &SetAction(const std::string &action) 83 { 84 return *this; 85 } 86 GetBundle()87 std::string GetBundle() const 88 { 89 return ""; 90 } 91 SetBundle(const std::string & bundleName)92 Want &SetBundle(const std::string &bundleName) 93 { 94 return *this; 95 } 96 AddEntity(const std::string & entity)97 Want &AddEntity(const std::string &entity) 98 { 99 return *this; 100 } 101 GetParams()102 const WantParams &GetParams() const 103 { 104 return parameters_; 105 } 106 GetBoolParam(const std::string & key,bool defaultValue)107 bool GetBoolParam(const std::string &key, bool defaultValue) const 108 { 109 return false; 110 } 111 GetIntParam(const std::string & key,int defaultValue)112 int GetIntParam(const std::string &key, int defaultValue) const 113 { 114 return 0; 115 } 116 SetParam(const std::string & key,int value)117 Want &SetParam(const std::string &key, int value) 118 { 119 return *this; 120 } 121 SetParam(const std::string & key,bool value)122 Want &SetParam(const std::string &key, bool value) 123 { 124 return *this; 125 } 126 SetParam(const std::string & key,const std::string & value)127 Want &SetParam(const std::string &key, const std::string &value) 128 { 129 return *this; 130 } 131 SetParam(const std::string & key,const sptr<IRemoteObject> & remoteObject)132 Want &SetParam(const std::string& key, const sptr<IRemoteObject>& remoteObject) 133 { 134 return *this; 135 } 136 SetParams(const WantParams & wantParams)137 Want &SetParams(const WantParams &wantParams) 138 { 139 return *this; 140 } 141 GetStringParam(const std::string & key)142 std::string GetStringParam(const std::string &key) const 143 { 144 return ""; 145 } 146 HasParameter(const std::string & key)147 bool HasParameter(const std::string &key) const 148 { 149 return false; 150 } 151 RemoveParam(const std::string & key)152 void RemoveParam(const std::string &key) {} ToString()153 std::string ToString() const 154 { 155 return ""; 156 } SetDeviceId(const std::string & deviceId)157 Want &SetDeviceId(const std::string &deviceId) 158 { 159 return *this; 160 } 161 GetDeviceId()162 std::string GetDeviceId() const 163 { 164 return ""; 165 } 166 SetModuleName(const std::string & moduleName)167 Want &SetModuleName(const std::string &moduleName) 168 { 169 return *this; 170 } 171 172 public: 173 // reserved param definition 174 inline static const std::string PARAM_RESV_DISPLAY_ID = ""; 175 inline static const std::string PARAM_RESV_WINDOW_FOCUSED = ""; 176 inline static const std::string PARAM_RESV_WINDOW_LEFT = ""; 177 inline static const std::string PARAM_RESV_WINDOW_TOP = ""; 178 inline static const std::string PARAM_RESV_WINDOW_WIDTH = ""; 179 inline static const std::string PARAM_RESV_WINDOW_HEIGHT = ""; 180 inline static const std::string PARAM_RESV_CALLER_TOKEN = ""; 181 inline static const std::string PARAM_RESV_CALLER_BUNDLE_NAME = ""; 182 inline static const std::string PARAM_RESV_CALLER_ABILITY_NAME = ""; 183 inline static const std::string PARAM_RESV_CALLER_NATIVE_NAME = ""; 184 inline static const std::string PARAM_RESV_CALLER_UID = ""; 185 inline static const std::string PARAM_RESV_FOR_RESULT = ""; 186 inline static const std::string PARAM_RESV_START_TIME = ""; 187 inline static const std::string PARAM_ABILITY_RECOVERY_RESTART = ""; 188 inline static const std::string PARAM_ASSERT_FAULT_SESSION_ID = ""; 189 inline static const std::string PARM_LAUNCH_REASON_MESSAGE = ""; 190 inline static const std::string PARAM_APP_AUTO_STARTUP_LAUNCH_REASON = ""; 191 inline static const std::string PARAM_APP_CLONE_INDEX_KEY = ""; 192 inline static const std::string APP_INSTANCE_KEY = ""; 193 inline static const std::string CREATE_APP_INSTANCE_KEY = ""; 194 195 WantParams parameters_; 196 }; 197 } // namespace AAFwk 198 } // namespace OHOS 199 #endif