/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef GET_PARAM_H #define GET_PARAM_H #include #include #include #include #include "ability.h" #include "ability_context.h" #include "ability_event_interface.h" #include "ability_info.h" #include "ability_handler.h" #include "ability_manager.h" #include "ability_manager_interface.h" #include "async_common_event_result.h" #include "bundle_info.h" #include "common_event_manager.h" #include "common_event_data.h" #include "common_event_publish_info.h" #include "common_event_subscribe_info.h" #include "common_event_subscriber.h" #include "common_event_support.h" #include "data_uri_utils.h" #include "dummy_component_container.h" #include "dumper.h" #include "element_name.h" #include "event_handler.h" #include "event_runner.h" #include "inner_event.h" #include "iremote_broker.h" #include "iremote_object.h" #include "key_event.h" #include "logger.h" #include "matching_skills.h" #include "module_info.h" #include "native_implement_eventhandler.h" #include "pac_map.h" #include "parcel.h" #include "patterns_matcher.h" #include "uri.h" #include "want.h" #include "bundle_mgr_proxy.h" #include "ohos_application.h" namespace OHOS { namespace EventFwk { class TestDumper; bool GetBoolParam(); uint8_t GetU8Param(); unsigned int GetUIntParam(); uint16_t GetU16Param(); uint32_t GetU32Param(); uint64_t GetU64Param(); int8_t GetS8Param(); int16_t GetS16Param(); int32_t GetS32Param(); int64_t GetS64Param(); char32_t GetChar32Param(); short GetShortParam(); long GetLongParam(); int GetIntParam(); double GetDoubleParam(); float GetFloatParam(); char GetCharParam(); char *GetCharArryParam(); std::string GetStringParam(); std::vector GetBoolVectorParam(); std::vector GetShortVectorParam(); std::vector GetLongVectorParam(); std::vector GetIntVectorParam(); std::vector GetFloatVectorParam(); std::vector GetDoubleVectorParam(); std::vector GetCharVectorParam(); std::vector GetChar32VectorParam(); std::vector GetStringVectorParam(); template std::vector GetUnsignVectorParam(); std::vector GetS8VectorParam(); std::vector GetS16VectorParam(); std::vector GetS32VectorParam(); std::vector GetS64VectorParam(); std::shared_ptr GetParamParcel(); std::shared_ptr GetParamWant(); OHOS::AAFwk::Operation GetParamOperation(); std::shared_ptr GetParamAsyncCommonEventResult(); std::shared_ptr GetParamCommonEventData(); std::shared_ptr GetParamCommonEventManager(); std::shared_ptr GetParamCommonEventPublishInfo(); std::shared_ptr GetParamCommonEventSubscribeInfo(); std::shared_ptr GetParamCommonEventSubscriber(); std::shared_ptr GetParamCommonEventSupport(); std::shared_ptr GetParamMatchingSkills(); sptr GetParamSptrRemote(); std::shared_ptr GetParamEventRunner(); std::shared_ptr GetParamEventHandler(); std::shared_ptr GetParamEventQueue(); std::shared_ptr GetParamEventRunnerNativeImplement(); std::shared_ptr GetParamFileDescriptorListener(); std::shared_ptr GetParamLogger(); OHOS::AppExecFwk::EventQueue::Priority GetParamPriority(); TestDumper GetParamDumper(); OHOS::AppExecFwk::InnerEvent::Pointer GetParamInnerEvent(); OHOS::AppExecFwk::InnerEvent::Callback GetParamCallback(); OHOS::AppExecFwk::InnerEvent::TimePoint GetParamTimePoint(); CommonEventSubscribeInfo::ThreadMode GetParamThreadMode(); std::shared_ptr GetParamAbilityContext(); std::shared_ptr GetParamIAbilityEvent(); std::shared_ptr GetParamAbilityHandler(); std::shared_ptr GetParamAbilityStartSetting(); std::shared_ptr GetParamAbility(); std::shared_ptr GetParamOHOSApplication(); OHOS::Uri GetParamUri(); NativeRdb::ValuesBucket GetParamValuesBucket(); OHOS::AppExecFwk::Configuration GetParamConfiguration(); NativeRdb::DataAbilityPredicates GetParamDataAbilityPredicates(); OHOS::AppExecFwk::PacMap GetParamPacMap(); OHOS::AppExecFwk::NotificationRequest GetParamNotificationRequest(); std::shared_ptr GetParamComponentContainer(); sptr GetParamIAbilityConnection(); std::shared_ptr GetParamProcessInfo(); std::shared_ptr GetParamDataUriUtils(); std::shared_ptr GetParamDataAbilityHelper(); std::shared_ptr GetParamLifeCycle(); OHOS::AppExecFwk::LifeCycle::Event GetParamLifeCycleEvent(); std::shared_ptr GetParamElementName(); std::shared_ptr GetParamWantParams(); std::shared_ptr GetParamAbilityManager(); OHOS::AAFwk::PatternsMatcher GetParamPatternsMatcher(); OHOS::AAFwk::MatchType GetParamMatchType(); std::shared_ptr GetParamContext(); std::shared_ptr GetParamBundleMgrProxy(); OHOS::AppExecFwk::ApplicationFlag GetParamApplicationFlag(); OHOS::AppExecFwk::ApplicationInfo GetParamApplicationInfo(); std::vector GetParamApplicationInfoVector(); OHOS::AppExecFwk::BundleFlag GetParamBundleFlag(); OHOS::AppExecFwk::BundleInfo GetParamBundleInfo(); std::vector GetParamBundleInfoVector(); OHOS::AppExecFwk::HapModuleInfo GetParamHapModuleInfo(); OHOS::AppExecFwk::PermissionDef GetParamPermissionDef(); std::vector GetParamPermissionDefVector(); OHOS::AppExecFwk::IBundleMgr::Message GetParamIBundleMgrMessage(); OHOS::MessageParcel GetParamMessageParcel(); OHOS::AppExecFwk::DumpFlag GetParamDumpFlag(); sptr GetParamICleanCacheCallback(); sptr GetParamIBundleStatusCallback(); class TestRemoteObject : public IRemoteObject { public: /** * Default constructor used to construct. */ TestRemoteObject(); /** * Default deconstructor used to deconstruct. */ ~TestRemoteObject(); /** * Override GetObjectRefCount */ int32_t GetObjectRefCount() override { return 0; } /** * Override SendRequest */ int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override { return 0; } /** * Override IsProxyObject */ bool IsProxyObject() const override { return true; } /** * Override CheckObjectLegality */ bool CheckObjectLegality() const override { return true; } /** * Override AddDeathRecipient */ bool AddDeathRecipient(const sptr &recipient) override { return true; } /** * Override RemoveDeathRecipient */ bool RemoveDeathRecipient(const sptr &recipient) override { return true; } /** * Override Marshalling */ bool Marshalling(Parcel &parcel) const override { return true; } /** * Override AsInterface */ sptr AsInterface() override { return nullptr; } /** * Override Dump */ int Dump(int fd, const std::vector &args) override { return 0; } /** * Override GetObjectDescriptor */ std::u16string GetObjectDescriptor() const { std::u16string descriptor = std::u16string(); return descriptor; } }; class TestCommonEventSubscriber : public CommonEventSubscriber { public: /** * Default constructor used to create subscriber. */ TestCommonEventSubscriber() {}; /** * Default deconstructor used to deconstruct. */ ~TestCommonEventSubscriber() {}; /** * Override OnReceiveEvent. */ virtual void OnReceiveEvent(const CommonEventData &data) { printf("Fuzz Test Receive Event\n"); } }; class TestDumper : public OHOS::AppExecFwk::Dumper { public: /** * Override Dump. */ void Dump(const std::string &message) { return; } /** * Override GetTag. */ std::string GetTag() { return GetStringParam(); } }; class TestFileDescriptorListener : public OHOS::AppExecFwk::FileDescriptorListener { public: /** * Default constructor used to construct. */ TestFileDescriptorListener() {} /** * Default deconstructor used to deconstruct. */ ~TestFileDescriptorListener() {} }; class TestIAbilityConnection : public OHOS::AAFwk::IAbilityConnection { public: /** * Override OnAbilityConnectDone. */ void OnAbilityConnectDone( const OHOS::AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) override {} /** * Override OnAbilityDisconnectDone. */ void OnAbilityDisconnectDone(const OHOS::AppExecFwk::ElementName &element, int resultCode) override {} /** * Default deconstructor used to deconstruct. */ virtual ~TestIAbilityConnection() {} }; class TestAbilityEvent : public OHOS::AppExecFwk::IAbilityEvent { public: /** * Override OnBackPressed. */ virtual void OnBackPressed() { printf("Fuzz Test Back Pressed."); } }; class TestLogger : public OHOS::AppExecFwk::Logger { public: /** * Override Log. */ void Log(const std::string &line) {} /** * Default deconstructor used to deconstruct. */ virtual ~TestLogger() {} }; class TestICleanCacheCallback : public OHOS::AppExecFwk::ICleanCacheCallback { public: /** * Default constructor used to construct. */ TestICleanCacheCallback() {} /** * Override OnCleanCacheFinished. */ void OnCleanCacheFinished(bool succeeded) override {} /** * Default deconstructor used to deconstruct. */ virtual ~TestICleanCacheCallback() {} }; class TestIBundleStatusCallback : public OHOS::AppExecFwk::IBundleStatusCallback { public: /** * Default constructor used to construct. */ TestIBundleStatusCallback() {} /** * Override OnBundleStateChanged. */ void OnBundleStateChanged(const uint8_t installType, const int32_t resultCode, const std::string &resultMsg, const std::string &bundleName) override {} /** * Default deconstructor used to deconstruct. */ virtual ~TestIBundleStatusCallback() {} }; } // namespace EventFwk } // namespace OHOS #endif