From f179b4b895172438feb28244d93e999bf4baca81 Mon Sep 17 00:00:00 2001 From: xsz233 Date: Thu, 8 Sep 2022 21:16:35 +0800 Subject: [PATCH] IssueNo: I5QF22 Description: delete unused bundlemgr api Sig:SIG_ApplicaitonFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: xsz233 --- .../mock/include/mock_bundle_manager.h | 427 ------------------ .../moduletest/mock/mock_bundle_mgr_proxy.cpp | 155 ------- .../mock/include/mock_bundle_manager.h | 315 +------------ .../moduletest/mock/mock_bundle_mgr_proxy.cpp | 179 -------- 4 files changed, 1 insertion(+), 1075 deletions(-) diff --git a/frameworks/test/moduletest/mock/include/mock_bundle_manager.h b/frameworks/test/moduletest/mock/include/mock_bundle_manager.h index 564eef74c..8fddb5825 100644 --- a/frameworks/test/moduletest/mock/include/mock_bundle_manager.h +++ b/frameworks/test/moduletest/mock/include/mock_bundle_manager.h @@ -36,150 +36,6 @@ public: ~MockBundleManager() {} - /** - * @brief Obtains the ApplicationInfo based on a given bundle name. - * - * @param appName Indicates the application bundle name to be queried. - * @param flag Indicates the flag used to specify information contained - * in the ApplicationInfo object that will be returned. - * @param userId Indicates the user ID. - * @param appInfo Indicates the obtained ApplicationInfo object. - * @return Returns true if the application is successfully obtained; returns false otherwise. - */ - virtual bool GetApplicationInfo( - const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) override - { - return true; - } - - /** - * @brief Obtains information about all installed applications of a specified user. - * - * @param flag Indicates the flag used to specify information contained - * in the ApplicationInfo objects that will be returned. - * @param userId Indicates the user ID. - * @param appInfos Indicates all of the obtained ApplicationInfo objects. - * @return Returns true if the application is successfully obtained; returns false otherwise. - */ - virtual bool GetApplicationInfos( - const ApplicationFlag flag, const int userId, std::vector &appInfos) override - { - return true; - } - - /** - * @brief Obtains the BundleInfo based on a given bundle name. - * - * @param bundleName Indicates the application bundle name to be queried. - * @param flag Indicates the information contained in the BundleInfo object to be returned. - * @param bundleInfo Indicates the obtained BundleInfo object. - * @param userId Indicates the user ID. - * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfo( - const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) override - { - return true; - } - - /** - * @brief Obtains BundleInfo of all bundles available in the system. - * - * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned. - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @param userId Indicates the user ID. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfos( - const BundleFlag flag, std::vector &bundleInfos, int32_t userId) override - { - return true; - } - - /** - * @brief Obtains the application UID based on the given bundle name and user ID. - * - * @param bundleName Indicates the bundle name of the application. - * @param userId Indicates the user ID. - * @return Returns the uid if successfully obtained; returns -1 otherwise. - */ - virtual int GetUidByBundleName(const std::string &bundleName, const int userId) override - { - return 0; - } - - /** - * @brief Obtains the application ID based on the given bundle name and user ID. - * - * @param bundleName Indicates the bundle name of the application. - * @param userId Indicates the user ID. - * @return Returns the application ID if successfully obtained; returns empty string otherwise. - */ - virtual std::string GetAppIdByBundleName(const std::string &bundleName, const int userId) override - { - return "bundlename"; - } - - /** - * @brief Obtains the bundle name of a specified application based on the given UID. - * - * @param uid Indicates the uid. - * @param bundleName Indicates the obtained bundle name. - * @return Returns true if the bundle name is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleNameForUid(const int uid, std::string &bundleName) override - { - bundleName = "hello"; - return true; - } - - /** - * @brief Obtains all bundle names of a specified application based on the given application UID. - * - * @param uid Indicates the uid. - * @param bundleNames Indicates the obtained bundle names. - * @return Returns true if the bundle names is successfully obtained; returns false otherwise. - */ - virtual bool GetBundlesForUid(const int uid, std::vector &bundleNames) override - { - return true; - } - - /** - * @brief Obtains the formal name associated with the given UID. - * - * @param uid Indicates the uid. - * @param name Indicates the obtained formal name. - * @return Returns true if the formal name is successfully obtained; returns false otherwise. - */ - virtual bool GetNameForUid(const int uid, std::string &name) override - { - return true; - } - - /** - * @brief Obtains an array of all group IDs associated with a specified bundle. - * - * @param bundleName Indicates the bundle name. - * @param gids Indicates the group IDs associated with the specified bundle. - * @return Returns true if the gids is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleGids(const std::string &bundleName, std::vector &gids) override - { - return true; - } - - /** - * @brief Obtains the type of a specified application based on the given bundle name. - * - * @param bundleName Indicates the bundle name. - * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise. - */ - virtual std::string GetAppType(const std::string &bundleName) override - { - return ""; - } - /** * @brief Check whether the app is system app by it's UID. * @@ -188,289 +44,6 @@ public: */ virtual bool CheckIsSystemAppByUid(const int uid) override; - /** - * @brief Obtains the BundleInfo of application bundles based on the specified metaData. - * - * @param metaData Indicates the metadata to get in the bundle. - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector &bundleInfos) override - { - return true; - } - - /** - * @brief Query the AbilityInfo by the given Want. - * - * @param want Indicates the information of the ability. - * @param abilityInfo Indicates the obtained AbilityInfo object. - * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. - */ - virtual bool QueryAbilityInfo(const AAFwk::Want &want, AbilityInfo &abilityInfo) override - { - return true; - } - - /** - * @brief Query the AbilityInfo by ability.uri in config.json. - * - * @param abilityUri Indicates the uri of the ability. - * @param abilityInfo Indicates the obtained AbilityInfo object. - * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. - */ - virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) override - { - return true; - } - - /** - * @brief Obtains the BundleInfo of all keep-alive applications in the system. - * - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool QueryKeepAliveBundleInfos(std::vector &bundleInfos) override - { - return true; - } - - /** - * @brief Obtains information about an application bundle contained in a ohos Ability Package (HAP). - * - * @param hapFilePath Indicates the absolute file path of the HAP. - * @param flag Indicates the information contained in the BundleInfo object to be returned. - * @param bundleInfo Indicates the obtained BundleInfo object. - * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleArchiveInfo( - const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) override - { - return true; - } - - /** - * @brief Obtain the HAP module info of a specific ability. - * - * @param abilityInfo Indicates the ability. - * @param hapModuleInfo Indicates the obtained HapModuleInfo object. - * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) override - { - return true; - } - - /** - * @brief Obtains the Want for starting the main ability of an application based on the given bundle name. - * - * @param bundleName Indicates the bundle name. - * @param want Indicates the obtained launch Want object. - * @return Returns true if the launch Want object is successfully obtained; returns false otherwise. - */ - virtual bool GetLaunchWantForBundle(const std::string &bundleName, Want &want) override - { - return true; - } - - /** - * @brief Checks whether the publickeys of two bundles are the same. - * - * @param firstBundleName Indicates the first bundle name. - * @param secondBundleName Indicates the second bundle name. - * @return Returns SIGNATURE_UNKNOWN_BUNDLE if at least one of the given bundles is not found; - * returns SIGNATURE_NOT_MATCHED if their publickeys are different; - * returns SIGNATURE_MATCHED if their publickeys are the same. - */ - virtual int CheckPublicKeys(const std::string &firstBundleName, const std::string &secondBundleName) override - { - return 0; - } - - /** - * @brief Obtains detailed information about a specified permission. - * - * @param permissionName Indicates the name of the ohos permission. - * @param permissionDef Indicates the object containing detailed information about the given ohos permission. - * @return Returns true if the PermissionDef object is successfully obtained; returns false otherwise. - */ - virtual bool GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) override - { - return true; - } - - /** - * @brief Obtains the FormInfo objects provided by all applications on the device. - * - * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the - * device. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool GetAllFormsInfo(std::vector &formInfos) override - { - return true; - } - - /** - * @brief Obtains the FormInfo objects provided by a specified application on the device. - * - * @param bundleName Indicates the bundle name of the application. - * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the - * device. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool GetFormsInfoByApp(const std::string &bundleName, std::vector &formInfos) override - { - return true; - } - - /** - * @brief Obtains the FormInfo objects provided by a specified. - * - * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the - * device. - * @param moduleName Indicates the module name of the application. - * @param bundleName Indicates the bundle name of the application. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool GetFormsInfoByModule( - const std::string &bundleName, const std::string &moduleName, std::vector &formInfos) override - { - return true; - } - - /** - * @brief Checks whether the system has a specified capability. - * - * @param capName Indicates the name of the system feature to check. - * @return Returns true if the given feature specified by name is available in the system; returns false otherwise. - */ - virtual bool HasSystemCapability(const std::string &capName) override - { - return true; - } - - /** - * @brief Obtains the capabilities that are available in the system. - * - * @param systemCaps Indicates the list of capabilities available in the system. - * @return Returns true if capabilities in the system are successfully obtained; returns false otherwise. - */ - virtual bool GetSystemAvailableCapabilities(std::vector &systemCaps) override - { - return true; - } - - /** - * @brief Checks whether the current device has been started in safe mode. - * - * @return Returns true if the device is in safe mode; returns false otherwise. - */ - virtual bool IsSafeMode() override - { - return true; - } - - /** - * @brief Clears application running data of a specified application. - * - * @param bundleName Indicates the bundle name of the application whose data is to be cleared. - * @return Returns true if the data cleared successfully; returns false otherwise. - */ - virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override - { - return true; - } - - /** - * @brief Register the specific bundle status callback. - * - * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool RegisterBundleStatusCallback(const sptr &bundleStatusCallback) override - { - return true; - } - - /** - * @brief Clear the specific bundle status callback. - * - * @param bundleStatusCallback Indicates the callback to be cleared. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool ClearBundleStatusCallback(const sptr &bundleStatusCallback) override - { - return true; - } - - /** - * @brief Unregister all the callbacks of status changed. - * - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool UnregisterBundleStatusCallback() override - { - return true; - } - - /** - * @brief Dump the bundle information with specific flags. - * - * @param flag Indicates the information contained in the dump result. - * @param bundleName Indicates the bundle name if needed. - * @param userId Indicates the user ID. - * @param result Indicates the dump information result. - * @return Returns true if the dump result is successfully obtained; returns false otherwise. - */ - virtual bool DumpInfos( - const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) override - { - return true; - } - - /** - * @brief Checks whether a specified application is enabled. - * - * @param bundleName Indicates the bundle name of the application. - * @return Returns true if the application is enabled; returns false otherwise. - */ - virtual bool IsApplicationEnabled(const std::string &bundleName) override - { - return true; - } - - /** - * @brief Sets whether to enable a specified ability. - * - * @param abilityInfo Indicates information about the ability to check. - * @return Returns true if the ability is enabled; returns false otherwise. - */ - virtual bool IsAbilityEnabled(const AbilityInfo &abilityInfo) override - { - return true; - } - - /** - * @brief Obtains the interface used to install and uninstall bundles. - * - * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise. - */ - virtual sptr GetBundleInstaller() override - { - return nullptr; - } - - /** - * @brief Obtains the interface used to create or delete user. - * - * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise. - */ - virtual sptr GetBundleUserMgr() override - { - return nullptr; - } - /** * @brief Mock to set whether it is system application. * diff --git a/frameworks/test/moduletest/mock/mock_bundle_mgr_proxy.cpp b/frameworks/test/moduletest/mock/mock_bundle_mgr_proxy.cpp index 6c15c081d..77c327569 100644 --- a/frameworks/test/moduletest/mock/mock_bundle_mgr_proxy.cpp +++ b/frameworks/test/moduletest/mock/mock_bundle_mgr_proxy.cpp @@ -38,19 +38,6 @@ BundleMgrProxy::BundleMgrProxy(const sptr &impl) : IRemoteProxy &appInfos) -{ - return true; -} - bool BundleMgrProxy::GetBundleInfo( const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) { @@ -58,16 +45,6 @@ bool BundleMgrProxy::GetBundleInfo( return true; } -bool BundleMgrProxy::GetBundleInfos(const BundleFlag flag, std::vector &bundleInfos, int32_t userId) -{ - return true; -} - -int BundleMgrProxy::GetUidByBundleName(const std::string &bundleName, const int userId) -{ - return 1; -} - std::string BundleMgrProxy::GetAppIdByBundleName(const std::string &bundleName, const int userId) { return "appId"; @@ -79,141 +56,9 @@ bool BundleMgrProxy::GetBundleNameForUid(const int uid, std::string &bundleName) return true; } -bool BundleMgrProxy::GetBundlesForUid(const int uid, std::vector &bundleNames) -{ - return true; -} - -bool BundleMgrProxy::GetNameForUid(const int uid, std::string &name) -{ - return true; -} - -bool BundleMgrProxy::GetBundleGids(const std::string &bundleName, std::vector &gids) -{ - return true; -} - std::string BundleMgrProxy::GetAppType(const std::string &bundleName) { return "Constants::EMPTY_STRING"; } - -bool BundleMgrProxy::CheckIsSystemAppByUid(const int uid) -{ - return true; -} - -bool BundleMgrProxy::GetBundleInfosByMetaData(const std::string &metaData, std::vector &bundleInfos) -{ - return true; -} - -bool BundleMgrProxy::QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) -{ - return true; -} - -bool BundleMgrProxy::QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) -{ - return true; -} - -bool BundleMgrProxy::QueryKeepAliveBundleInfos(std::vector &bundleInfos) -{ - return true; -} - -bool BundleMgrProxy::GetBundleArchiveInfo(const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) -{ - return true; -} - -bool BundleMgrProxy::GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) -{ - return true; -} - -bool BundleMgrProxy::GetLaunchWantForBundle(const std::string &bundleName, Want &want) -{ - return true; -} - -int BundleMgrProxy::CheckPublicKeys(const std::string &firstBundleName, const std::string &secondBundleName) -{ - return 1; -} - -bool BundleMgrProxy::GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) -{ - return true; -} - -bool BundleMgrProxy::HasSystemCapability(const std::string &capName) -{ - return true; -} - -bool BundleMgrProxy::GetSystemAvailableCapabilities(std::vector &systemCaps) -{ - return true; -} - -bool BundleMgrProxy::IsSafeMode() -{ - return true; -} - -bool BundleMgrProxy::CleanBundleDataFiles(const std::string &bundleName, const int userId) -{ - return true; -} - -bool BundleMgrProxy::RegisterBundleStatusCallback(const sptr &bundleStatusCallback) -{ - return true; -} - -bool BundleMgrProxy::ClearBundleStatusCallback(const sptr &bundleStatusCallback) -{ - return true; -} - -bool BundleMgrProxy::UnregisterBundleStatusCallback() -{ - return true; -} - -bool BundleMgrProxy::DumpInfos(const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) -{ - return true; -} - -bool BundleMgrProxy::IsApplicationEnabled(const std::string &bundleName) -{ - return true; -} - -bool BundleMgrProxy::IsAbilityEnabled(const AbilityInfo &abilityInfo) -{ - return true; -} - -template -bool BundleMgrProxy::GetParcelableInfo(IBundleMgr::Message code, MessageParcel &data, T &parcelableInfo) -{ - return true; -} - -template -bool BundleMgrProxy::GetParcelableInfos(IBundleMgr::Message code, MessageParcel &data, std::vector &parcelableInfos) -{ - return true; -} - -bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &data, MessageParcel &reply) -{ - return true; -} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/test/moduletest/mock/include/mock_bundle_manager.h b/services/test/moduletest/mock/include/mock_bundle_manager.h index 56f641cba..56e5a7207 100644 --- a/services/test/moduletest/mock/include/mock_bundle_manager.h +++ b/services/test/moduletest/mock/include/mock_bundle_manager.h @@ -36,107 +36,7 @@ public: ~MockBundleManager() {} - - /** - * @brief Obtains the ApplicationInfo based on a given bundle name. - * - * @param appName Indicates the application bundle name to be queried. - * @param flag Indicates the flag used to specify information contained - * in the ApplicationInfo object that will be returned. - * @param userId Indicates the user ID. - * @param appInfo Indicates the obtained ApplicationInfo object. - * @return Returns true if the application is successfully obtained; returns false otherwise. - */ - virtual bool GetApplicationInfo( - const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) override - { - return true; - } - /** - * @brief Obtains information about all installed applications of a specified user. - * - * @param flag Indicates the flag used to specify information contained - * in the ApplicationInfo objects that will be returned. - * @param userId Indicates the user ID. - * @param appInfos Indicates all of the obtained ApplicationInfo objects. - * @return Returns true if the application is successfully obtained; returns false otherwise. - */ - virtual bool GetApplicationInfos( - const ApplicationFlag flag, const int userId, std::vector &appInfos) override - { - return true; - } - /** - * @brief Obtains the BundleInfo based on a given bundle name. - * - * @param bundleName Indicates the application bundle name to be queried. - * @param flag Indicates the information contained in the BundleInfo object to be returned. - * @param bundleInfo Indicates the obtained BundleInfo object. - * @param userId Indicates the user ID. - * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfo( - const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) override - { - return true; - } - /** - * @brief Obtains BundleInfo of all bundles available in the system. - * - * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned. - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @param userId Indicates the user ID. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfos( - const BundleFlag flag, std::vector &bundleInfos, int32_t userId) override - { - return true; - }; - /** - * @brief Obtains the application UID based on the given bundle name and user ID. - * - * @param bundleName Indicates the bundle name of the application. - * @param userId Indicates the user ID. - * @return Returns the uid if successfully obtained; returns -1 otherwise. - */ - virtual int GetUidByBundleName(const std::string &bundleName, const int userId) override - { - return 0; - } - /** - * @brief Obtains the bundle name of a specified application based on the given UID. - * - * @param uid Indicates the uid. - * @param bundleName Indicates the obtained bundle name. - * @return Returns true if the bundle name is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleNameForUid(const int uid, std::string &bundleName) override - { - bundleName = "hello"; - return true; - } - /** - * @brief Obtains an array of all group IDs associated with a specified bundle. - * - * @param bundleName Indicates the bundle name. - * @param gids Indicates the group IDs associated with the specified bundle. - * @return Returns true if the gids is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleGids(const std::string &bundleName, std::vector &gids) override - { - return true; - } - /** - * @brief Obtains the type of a specified application based on the given bundle name. - * - * @param bundleName Indicates the bundle name. - * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise. - */ - virtual std::string GetAppType(const std::string &bundleName) override - { - return ""; - } + /** * @brief Check whether the app is system app by it's UID. * @@ -145,219 +45,6 @@ public: */ virtual bool CheckIsSystemAppByUid(const int uid) override; - /** - * @brief Obtains the BundleInfo of application bundles based on the specified metaData. - * - * @param metaData Indicates the metadata to get in the bundle. - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector &bundleInfos) override - { - return true; - } - /** - * @brief Query the AbilityInfo by the given Want. - * - * @param want Indicates the information of the ability. - * @param abilityInfo Indicates the obtained AbilityInfo object. - * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. - */ - virtual bool QueryAbilityInfo(const AAFwk::Want &want, AbilityInfo &abilityInfo) override - { - return true; - } - /** - * @brief Query the AbilityInfo by ability.uri in config.json. - * - * @param abilityUri Indicates the uri of the ability. - * @param abilityInfo Indicates the obtained AbilityInfo object. - * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. - */ - virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) override - { - return true; - } - /** - * @brief Obtains the BundleInfo of all keep-alive applications in the system. - * - * @param bundleInfos Indicates all of the obtained BundleInfo objects. - * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. - */ - virtual bool QueryKeepAliveBundleInfos(std::vector &bundleInfos) override - { - return true; - }; - /** - * @brief Obtains information about an application bundle contained in a ohos Ability Package (HAP). - * - * @param hapFilePath Indicates the absolute file path of the HAP. - * @param flag Indicates the information contained in the BundleInfo object to be returned. - * @param bundleInfo Indicates the obtained BundleInfo object. - * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetBundleArchiveInfo( - const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) override - { - return true; - } - /** - * @brief Obtain the HAP module info of a specific ability. - * - * @param abilityInfo Indicates the ability. - * @param hapModuleInfo Indicates the obtained HapModuleInfo object. - * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. - */ - virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) override - { - return true; - } - /** - * @brief Obtains the Want for starting the main ability of an application based on the given bundle name. - * - * @param bundleName Indicates the bundle name. - * @param want Indicates the obtained launch Want object. - * @return Returns true if the launch Want object is successfully obtained; returns false otherwise. - */ - virtual bool GetLaunchWantForBundle(const std::string &bundleName, Want &want) override - { - return true; - } - /** - * @brief Checks whether the publickeys of two bundles are the same. - * - * @param firstBundleName Indicates the first bundle name. - * @param secondBundleName Indicates the second bundle name. - * @return Returns SIGNATURE_UNKNOWN_BUNDLE if at least one of the given bundles is not found; - * returns SIGNATURE_NOT_MATCHED if their publickeys are different; - * returns SIGNATURE_MATCHED if their publickeys are the same. - */ - virtual int CheckPublicKeys(const std::string &firstBundleName, const std::string &secondBundleName) override - { - return 0; - } - /** - * @brief Obtains detailed information about a specified permission. - * - * @param permissionName Indicates the name of the ohos permission. - * @param permissionDef Indicates the object containing detailed information about the given ohos permission. - * @return Returns true if the PermissionDef object is successfully obtained; returns false otherwise. - */ - virtual bool GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) override - { - return true; - } - /** - * @brief Checks whether the system has a specified capability. - * - * @param capName Indicates the name of the system feature to check. - * @return Returns true if the given feature specified by name is available in the system; returns false otherwise. - */ - virtual bool HasSystemCapability(const std::string &capName) override - { - return true; - } - /** - * @brief Obtains the capabilities that are available in the system. - * - * @param systemCaps Indicates the list of capabilities available in the system. - * @return Returns true if capabilities in the system are successfully obtained; returns false otherwise. - */ - virtual bool GetSystemAvailableCapabilities(std::vector &systemCaps) override - { - return true; - } - /** - * @brief Checks whether the current device has been started in safe mode. - * - * @return Returns true if the device is in safe mode; returns false otherwise. - */ - virtual bool IsSafeMode() override - { - return true; - } - /** - * @brief Clears application running data of a specified application. - * - * @param bundleName Indicates the bundle name of the application whose data is to be cleared. - * @return Returns true if the data cleared successfully; returns false otherwise. - */ - virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override - { - return true; - } - /** - * @brief Register the specific bundle status callback. - * - * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool RegisterBundleStatusCallback(const sptr &bundleStatusCallback) override - { - return true; - } - /** - * @brief Clear the specific bundle status callback. - * - * @param bundleStatusCallback Indicates the callback to be cleared. - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool ClearBundleStatusCallback(const sptr &bundleStatusCallback) override - { - return true; - } - /** - * @brief Unregister all the callbacks of status changed. - * - * @return Returns true if this function is successfully called; returns false otherwise. - */ - virtual bool UnregisterBundleStatusCallback() override - { - return true; - } - /** - * @brief Dump the bundle informations with specific flags. - * - * @param flag Indicates the information contained in the dump result. - * @param bundleName Indicates the bundle name if needed. - * @param userId Indicates the user ID. - * @param result Indicates the dump information result. - * @return Returns true if the dump result is successfully obtained; returns false otherwise. - */ - virtual bool DumpInfos( - const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) override - { - return true; - } - /** - * @brief Checks whether a specified application is enabled. - * - * @param bundleName Indicates the bundle name of the application. - * @return Returns true if the application is enabled; returns false otherwise. - */ - virtual bool IsApplicationEnabled(const std::string &bundleName) override - { - return true; - } - /** - * @brief Obtains the interface used to install and uninstall bundles. - * - * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise. - */ - virtual sptr GetBundleInstaller() override - { - return nullptr; - } - /** - * @brief Obtains the interface used to create or delete user. - * - * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise. - */ - virtual sptr GetBundleUserMgr() override - { - return nullptr; - } - /** * @brief Set whether the bundle is systemapp. * diff --git a/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp b/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp index d38187389..dc7d0fa1a 100644 --- a/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp +++ b/services/test/moduletest/mock/mock_bundle_mgr_proxy.cpp @@ -29,184 +29,5 @@ BundleMgrProxy::BundleMgrProxy(const sptr &impl) : IRemoteProxy &appInfos) -{ - return true; -} - -bool BundleMgrProxy::GetBundleInfo( - const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) -{ - return true; -} - -bool BundleMgrProxy::GetBundleInfos( - const BundleFlag flag, std::vector &bundleInfos, int32_t userId) -{ - return true; -} - -int BundleMgrProxy::GetUidByBundleName(const std::string &bundleName, const int userId) -{ - return 1; -} - -std::string BundleMgrProxy::GetAppIdByBundleName(const std::string &bundleName, const int userId) -{ - return "appId"; -} - -bool BundleMgrProxy::GetBundleNameForUid(const int uid, std::string &bundleName) -{ - bundleName = "bundleName"; - return true; -} - -bool BundleMgrProxy::GetBundlesForUid(const int uid, std::vector &bundleNames) -{ - return true; -} - -bool BundleMgrProxy::GetNameForUid(const int uid, std::string &name) -{ - return true; -} - -bool BundleMgrProxy::GetBundleGids(const std::string &bundleName, std::vector &gids) -{ - return true; -} - -std::string BundleMgrProxy::GetAppType(const std::string &bundleName) -{ - return "Constants::EMPTY_STRING"; -} - -bool BundleMgrProxy::CheckIsSystemAppByUid(const int uid) -{ - return true; -} - -bool BundleMgrProxy::GetBundleInfosByMetaData(const std::string &metaData, std::vector &bundleInfos) -{ - return true; -} - -bool BundleMgrProxy::QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) -{ - return true; -} - -bool BundleMgrProxy::QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) -{ - return true; -} - -bool BundleMgrProxy::QueryKeepAliveBundleInfos(std::vector &bundleInfos) -{ - return true; -} - -bool BundleMgrProxy::GetBundleArchiveInfo(const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) -{ - return true; -} - -bool BundleMgrProxy::GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) -{ - return true; -} - -bool BundleMgrProxy::GetLaunchWantForBundle(const std::string &bundleName, Want &want) -{ - return true; -} - -int BundleMgrProxy::CheckPublicKeys(const std::string &firstBundleName, const std::string &secondBundleName) -{ - return 1; -} - -bool BundleMgrProxy::GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) -{ - return true; -} - -bool BundleMgrProxy::HasSystemCapability(const std::string &capName) -{ - return true; -} - -bool BundleMgrProxy::GetSystemAvailableCapabilities(std::vector &systemCaps) -{ - return true; -} - -bool BundleMgrProxy::IsSafeMode() -{ - return true; -} - -bool BundleMgrProxy::CleanBundleDataFiles(const std::string &bundleName, const int userId) -{ - return true; -} - -bool BundleMgrProxy::RegisterBundleStatusCallback(const sptr &bundleStatusCallback) -{ - return true; -} - -bool BundleMgrProxy::ClearBundleStatusCallback(const sptr &bundleStatusCallback) -{ - return true; -} - -bool BundleMgrProxy::UnregisterBundleStatusCallback() -{ - return true; -} - -bool BundleMgrProxy::DumpInfos( - const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) -{ - return true; -} - -bool BundleMgrProxy::IsApplicationEnabled(const std::string &bundleName) -{ - return true; -} - - -bool BundleMgrProxy::IsAbilityEnabled(const AbilityInfo &abilityInfo) -{ - return true; -} - -template -bool BundleMgrProxy::GetParcelableInfo(IBundleMgr::Message code, MessageParcel &data, T &parcelableInfo) -{ - return true; -} - -template -bool BundleMgrProxy::GetParcelableInfos(IBundleMgr::Message code, MessageParcel &data, std::vector &parcelableInfos) -{ - return true; -} - -bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &data, MessageParcel &reply) -{ - return true; -} } // namespace AppExecFwk } // namespace OHOS -- Gitee