1 /* 2 * Copyright (c) 2021 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 KIT_TEST_COMMON_INFO_H 17 #define KIT_TEST_COMMON_INFO_H 18 19 namespace OHOS { 20 namespace AppExecFwk { 21 constexpr int pressureTimes = 3; 22 const std::string g_EVENT_REQU_FIRST = "requ_com_ohos_amsst_appkit_first"; 23 const std::string g_EVENT_RESP_FIRST = "resp_com_ohos_amsst_appkit_first"; 24 const std::string g_EVENT_RESP_FIRST_LIFECYCLE = "resp_com_ohos_amsst_appkit_first_lifecycle"; 25 const std::string g_EVENT_RESP_FIRST_LIFECYCLE_CALLBACK = "resp_com_ohos_amsst_appkit_first_lifecycle_callbacks"; 26 const std::string g_EVENT_RESP_FIRST_LIFECYCLE_OBSERVER = "resp_com_ohos_amsst_appkit_first_lifecycle_observer"; 27 const std::string g_EVENT_RESP_FIRST_LIFECYCLE_OBSERVER2 = "resp_com_ohos_amsst_appkit_first_lifecycle_observer2"; 28 const std::string g_EVENT_RESP_FIRST_ON_ABILITY_RESULT = "resp_com_ohos_amsst_appkit_first_onabilityresult"; 29 const std::string g_EVENT_RESP_FIRST_ON_BACK_PRESSED = "resp_com_ohos_amsst_appkit_first_onbackpressed"; 30 const std::string g_EVENT_RESP_FIRST_ON_NEW_WANT = "resp_com_ohos_amsst_appkit_first_onnewwant"; 31 const std::string g_EVENT_REQU_FIRSTB = "requ_com_ohos_amsst_appkit_firstb"; 32 const std::string g_EVENT_RESP_FIRSTB = "resp_com_ohos_amsst_appkit_firstb"; 33 const std::string g_EVENT_RESP_FIRSTB_LIFECYCLE = "resp_com_ohos_amsst_appkit_firstb_lifecycle"; 34 const std::string g_EVENT_REQU_SECOND = "requ_com_ohos_amsst_appkit_second"; 35 const std::string g_EVENT_RESP_SECOND = "resp_com_ohos_amsst_appkit_second"; 36 const std::string g_EVENT_RESP_SECOND_LIFECYCLE = "resp_com_ohos_amsst_appkit_second_lifecycle"; 37 const std::string g_EVENT_RESP_SECOND_ABILITY_CONTEXT = "resp_com_ohos_amsst_appkit_secondability_ability_context"; 38 const std::string g_EVENT_RESP_SECOND_ABILITY_API = "resp_com_ohos_amsst_appkit_secondability_ability_api"; 39 // PageAbility: ThirdAbility Constants to use 40 const std::string g_respPageThirdAbilityST = "resp_com_ohos_amsst_appkit_third_ability"; 41 const std::string g_requPageThirdAbilityST = "requ_com_ohos_amsst_appkit_third_ability"; 42 const std::vector<const std::string> g_requPageThirdAbilitySTVector = {g_requPageThirdAbilityST}; 43 // PageAbility: FourthAbility Constants to use 44 const std::string g_respPageFourthAbilityST = "resp_com_ohos_amsst_appkit_fourth_ability"; 45 const std::string g_requPageFourthAbilityST = "requ_com_ohos_amsst_appkit_fourth_ability"; 46 const std::vector<const std::string> g_requPageFourthAbilitySTVector = {g_requPageFourthAbilityST}; 47 // PageAbility: SixthAbility Constants to use 48 const std::string g_respPageSixthAbilityST = "resp_com_ohos_amsst_appkit_sixth_ability"; 49 const std::string g_respPageSixthAbilityLifecycleCallbacks = "resp_sixth_ability_lifecycle_callback"; 50 const std::string g_requPageSixthAbilityST = "requ_com_ohos_amsst_appkit_sixth_ability"; 51 const std::vector<const std::string> g_requPageSixthAbilitySTVector = {g_requPageSixthAbilityST}; 52 // PageAbility: KitTestAbilityManager Constants to use 53 const std::string g_respPageManagerAbilityST = "resp_com_ohos_amsst_appkit_manager_ability"; 54 const std::string g_requPageManagerAbilityST = "requ_com_ohos_amsst_appkit_manager_ability"; 55 const std::vector<const std::string> g_requPageManagerAbilitySTVector = {g_requPageManagerAbilityST}; 56 // PageAbility: KitTestAbilityManagerSecond Constants to use 57 const std::string g_respPageManagerSecondAbilityST = "resp_com_ohos_amsst_appkit_manager_second_ability"; 58 const std::string g_requPageManagerSecondAbilityST = "requ_com_ohos_amsst_appkit_manager_second_ability"; 59 const std::vector<const std::string> g_requPageManagerSecondAbilitySTVector = {g_requPageManagerSecondAbilityST}; 60 const std::string g_onAbilityStart = ":OnAbilityStart"; 61 const std::string g_onAbilityInactive = ":OnAbilityInactive"; 62 const std::string g_onAbilityBackground = ":OnAbilityBackground"; 63 const std::string g_onAbilityForeground = ":OnAbilityForeground"; 64 const std::string g_onAbilityActive = ":OnAbilityActive"; 65 const std::string g_onAbilityStop = ":OnAbilityStop"; 66 const std::string g_onAbilitySaveState = ":OnAbilitySaveState"; 67 const std::string g_memoryLevel = ":OnMemoryLevel"; 68 const std::string g_configuration = ":OnConfigurationUpdated"; 69 const std::string g_abilityStateOnStart = ":OnStart"; 70 const std::string g_abilityStateOnStop = ":OnStop"; 71 const std::string g_abilityStateOnActive = ":OnActive"; 72 const std::string g_abilityStateOnInactive = ":OnInactive"; 73 const std::string g_abilityStateOnBackground = ":OnBackground"; 74 const std::string g_abilityStateOnForeground = ":OnForeground"; 75 const std::string g_abilityStateOnNewWant = ":OnNewWant"; 76 const std::string g_EVENT_REQU_FIFTH = "requ_com_ohos_amsst_appkit_fifth"; 77 const std::string g_EVENT_RESP_FIFTH = "resp_com_ohos_amsst_appkit_fifth"; 78 79 enum class WantApi { 80 WantCopy, 81 WantAssign, 82 AddEntity, 83 AddFlags, 84 ClearWant, 85 CountEntities, 86 FormatMimeType, 87 FormatType, 88 FormatUri, 89 FormatUriAndType, 90 GetAction, 91 GetBundle, 92 GetEntities, 93 GetElement, 94 GetUri, 95 GetUriString, 96 GetFlags, 97 GetScheme, 98 GetType, 99 HasEntity, 100 MakeMainAbility, 101 Marshalling, 102 ParseUri, 103 RemoveEntity, 104 RemoveFlags, 105 SetAction, 106 SetBundle, 107 SetElement, 108 SetElementName_String_String, 109 SetElementName_String_String_String, 110 SetFlags, 111 SetType, 112 SetUri, 113 SetUriAndType, 114 ToUri, 115 Unmarshalling, 116 WantParseUri, 117 WantToUri, 118 GetParams, 119 GetByteParam, 120 GetByteArrayParam, 121 GetBoolParam, 122 GetBoolArrayParam, 123 GetCharParam, 124 GetCharArrayParam, 125 GetIntParam, 126 GetIntArrayParam, 127 GetDoubleParam, 128 GetDoubleArrayParam, 129 GetFloatParam, 130 GetFloatArrayParam, 131 GetLongParam, 132 GetLongArrayParam, 133 GetShortParam, 134 GetShortArrayParam, 135 GetStringParam, 136 GetStringArrayParam, 137 SetParam_WantParams, 138 SetParam_byte, 139 SetParam_byte_array, 140 SetParam_bool, 141 SetParam_bool_array, 142 SetParam_char, 143 SetParam_char_array, 144 SetParam_int, 145 SetParam_int_array, 146 SetParam_double, 147 SetParam_double_array, 148 SetParam_float, 149 SetParam_float_array, 150 SetParam_long, 151 SetParam_long_array, 152 SetParam_short, 153 SetParam_short_array, 154 SetParam_string, 155 SetParam_string_array, 156 HasParameter, 157 ReplaceParams_WantParams, 158 ReplaceParams_Want, 159 RemoveParam, 160 GetOperation, 161 SetOperation, 162 OperationEquals, 163 CloneOperation, 164 End 165 }; 166 167 enum class SkillsApi { 168 AddAction = (int)WantApi::End, 169 CountActions, 170 GetAction, 171 HasAction, 172 RemoveAction, 173 AddEntity, 174 CountEntities, 175 GetEntity, 176 HasEntity, 177 RemoveEntity, 178 AddAuthority, 179 CountAuthorities, 180 GetAuthority, 181 HasAuthority, 182 RemoveAuthority, 183 AddScheme, 184 CountSchemes, 185 GetScheme, 186 HasScheme, 187 RemoveScheme, 188 AddSchemeSpecificPart, 189 CountSchemeSpecificParts, 190 GetSchemeSpecificPart, 191 HasSchemeSpecificPart, 192 RemoveSchemeSpecificPart, 193 AddPath_String, 194 AddPath_String_MatchType, 195 AddPath_PatternMatcher, 196 AddPath_String_CountPaths, 197 AddPath_String_MatchType_CountPaths, 198 AddPath_PatternMatcher_CountPaths, 199 CountPaths, 200 AddPath_String_GetPath, 201 AddPath_String_MatchType_GetPath, 202 AddPath_PatternMatcher_GetPath, 203 GetPath, 204 AddPath_String_HasPath, 205 AddPath_String_MatchType_HasPath, 206 AddPath_PatternMatcher_HasPath, 207 HasPath, 208 RemovePath_String, 209 RemovePath_String_MatchType, 210 RemovePath_PatternMatcher, 211 RemovePath_Other, 212 AddType_String, 213 AddType_String_MatchType, 214 AddType_PatternMatcher, 215 AddType_String_CountTypes, 216 AddType_String_MatchType_CountTypes, 217 AddType_PatternMatcher_CountTypes, 218 CountTypes, 219 AddType_String_GetType, 220 AddType_String_MatchType_GetType, 221 AddType_PatternMatcher_GetType, 222 GetType, 223 AddType_String_HasType, 224 AddType_String_MatchType_HasType, 225 AddType_PatternMatcher_HasType, 226 HasType, 227 RemoveType_String, 228 RemoveType_String_MatchType, 229 RemoveType_PatternMatcher, 230 RemoveType_Other, 231 GetEntities, 232 GetWantParams, 233 Match, 234 Unmarshalling, 235 Marshalling, 236 Skills, 237 Skills_Skills, 238 End 239 }; 240 241 enum class AbilityApi { 242 GetAbilityName = (int)SkillsApi::End, 243 GetAbilityPackage, 244 GetLifecycle, 245 GetWant, 246 GetWindow, 247 Dump, 248 OnStart, 249 OnActive, 250 OnBackground, 251 OnInactive, 252 OnStop, 253 OnForeground, 254 OnAbilityResult, 255 OnBackPressed, 256 OnNewWant, 257 Reload, 258 SetResult, 259 SetWant, 260 StartAbilityForResult_Want_int, 261 StartAbility_Want, 262 StartAbility_Want_AbilityStartSetting, 263 TerminateAbility, 264 BatchInsert, 265 GetType, 266 OnKeyDown, 267 OnKeyUp, 268 OnTouchEvent, 269 End 270 }; 271 272 enum class AbilityContextApi { 273 GetApplicationInfo = (int)AbilityApi::End, 274 GetCacheDir, 275 GetCodeCacheDir, 276 GetDatabaseDir, 277 GetDataDir, 278 GetDir, 279 GetNoBackupFilesDir, 280 GetBundleManager, 281 VerifyCallingPermission, 282 VerifyPermission, 283 VerifySelfPermission, 284 GetBundleCodePath, 285 GetBundleName, 286 GetBundleResourcePath, 287 CanRequestPermission, 288 GetApplicationContext, 289 GetCallingAbility, 290 GetContext, 291 GetAbilityManager, 292 GetProcessInfo, 293 GetAppType, 294 GetCallingBundle, 295 StartAbility_Want_int, 296 TerminateAbility, 297 GetElementName, 298 GetHapModuleInfo, 299 End 300 }; 301 302 enum class LifeCycleApi { 303 GetLifecycleState = (int)AbilityContextApi::End, 304 AddObserver, 305 DispatchLifecycle_Event_Want, 306 DispatchLifecycle_Event, 307 RemoveObserver, 308 End 309 }; 310 311 enum class AbilityLifecycleCallbacksApi { 312 OnAbilityStart = (int)LifeCycleApi::End, 313 OnAbilityInactive, 314 OnAbilityBackground, 315 OnAbilityForeground, 316 OnAbilityActive, 317 OnAbilityStop, 318 OnAbilitySaveState, 319 End 320 }; 321 322 enum class AbilityManagerApi { 323 ClearUpApplicationData = (int)AbilityLifecycleCallbacksApi::End, 324 GetAllRunningProcesses, 325 GetAllStackInfo, 326 QueryRecentAbilityMissionInfo, 327 QueryRunningAbilityMissionInfo, 328 MoveMissionToTop, 329 End 330 }; 331 332 enum class ContextApi { 333 CanRequestPermission = (int)AbilityManagerApi::End, 334 DeleteFile, 335 GetAbilityInfo, 336 GetApplicationInfo, 337 GetApplicationContext, 338 GetBundleCodePath, 339 GetBundleManager, 340 GetBundleName, 341 GetBundleResourcePath, 342 GetCallingBundle, 343 GetCacheDir, 344 GetCodeCacheDir, 345 GetDatabaseDir, 346 GetDataDir, 347 GetDir, 348 GetFilesDir, 349 GetHapModuleInfo, 350 GetNoBackupFilesDir, 351 GetProcessName, 352 GetResourceManager, 353 VerifyCallingPermission, 354 VerifySelfPermission, 355 StartAbility_Want_int, 356 TerminateAbility_int, 357 CreateBundleContext, 358 VerifyCallingOrSelfPermission, 359 VerifyPermission, 360 End 361 }; 362 363 enum class ElementNameApi { 364 SetElementDeviceID = (int)ContextApi::End, 365 SetElementBundleName, 366 SetElementAbilityName, 367 ClearElement, 368 End 369 }; 370 371 enum class OHOSApplicationApi { 372 RegisterAbilityLifecycleCallbacks = (int)ElementNameApi::End, 373 UnregisterAbilityLifecycleCallbacks, 374 DispatchAbilitySavedState, 375 OnConfigurationUpdated, 376 OnMemoryLevel, 377 OnStart, 378 OnTerminate, 379 RegisterElementsCallbacks, 380 UnregisterElementsCallbacks, 381 End 382 }; 383 384 enum class LifecycleObserverApi { 385 OnActive = (int)OHOSApplicationApi::End, 386 OnBackground, 387 OnForeground, 388 OnInactive, 389 OnStart, 390 OnStop, 391 OnStateChanged_Event_Want, 392 OnStateChanged_Event, 393 End 394 }; 395 396 enum class ProcessInfoApi { 397 GetPid = (int)LifecycleObserverApi::End, 398 GetProcessName, 399 Marshalling, 400 Unmarshalling, 401 ProcessInfo, 402 ProcessInfo_String_int, 403 End 404 }; 405 406 enum class RunningProcessInfoApi { 407 GetProcessName = (int)ProcessInfoApi::End, 408 GetPid, 409 GetUid, 410 End, 411 }; 412 413 enum class WantParamsApi { 414 HasParam = (int)RunningProcessInfoApi::End, 415 IsEmpty, 416 Marshalling, 417 Unmarshalling, 418 Size, 419 WantParamsCopy, 420 GetParam, 421 KeySet, 422 Remove, 423 SetParam, 424 End, 425 }; 426 } // namespace AppExecFwk 427 } // namespace OHOS 428 #endif // KIT_TEST_COMMON_INFO_H