From 0315ee1c4ed8146ee7bccd36933aa984a674f059 Mon Sep 17 00:00:00 2001 From: njupthan Date: Mon, 10 Jan 2022 21:14:57 +0000 Subject: [PATCH 1/2] Cross-device information synchronization and query Signed-off-by: njupthan --- .../native/test/mock/include/bundle_mgr_interface.h | 4 ++++ .../native/test/mock/include/mock_bundle_manager.h | 6 ++++++ .../include/bundlemgr/bundle_mgr_interface.h | 4 ++++ .../include/bundlemgr/mock_bundle_manager.h | 6 ++++++ services/test/mock/include/mock_bundle_mgr.h | 9 ++++++++- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/frameworks/kits/ability/native/test/mock/include/bundle_mgr_interface.h b/frameworks/kits/ability/native/test/mock/include/bundle_mgr_interface.h index cea500ac69b..9404f4d2f63 100644 --- a/frameworks/kits/ability/native/test/mock/include/bundle_mgr_interface.h +++ b/frameworks/kits/ability/native/test/mock/include/bundle_mgr_interface.h @@ -27,6 +27,7 @@ #include "ohos/aafwk/content/want.h" #include "permission_def.h" #include "module_usage_record.h" +#include "distributed_bundle_info.h" using OHOS::AAFwk::Want; @@ -228,6 +229,9 @@ public: virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) = 0; virtual bool BundleClone(const std::string &bundleName) = 0; virtual bool CheckBundleNameInAllowList(const std::string &bundleName) = 0; + virtual bool GetDistributedBundleInfo( + const std::string &networkId, int32_t userId, const std::string &bundleName, + DistributedBundleInfo &distributedBundleInfo) = 0; enum class Message { GET_APPLICATION_INFO, diff --git a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h index 96c88016bae..e3ca26fdae5 100644 --- a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h +++ b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h @@ -205,6 +205,12 @@ public: { return true; } + virtual bool GetDistributedBundleInfo( + const std::string &networkId, int32_t userId, const std::string &bundleName, + DistributedBundleInfo &distributedBundleInfo) override + { + return true; + } }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h index adcaa9c71fd..648a2fa206d 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h @@ -31,6 +31,7 @@ #include "common_event_info.h" #include "on_permission_changed_callback_interface.h" #include "ohos/aafwk/content/want.h" +#include "distributed_bundle_info.h" namespace OHOS { namespace AppExecFwk { @@ -441,6 +442,9 @@ public: virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) = 0; virtual bool BundleClone(const std::string &bundleName) = 0; virtual bool CheckBundleNameInAllowList(const std::string &bundleName) = 0; + virtual bool GetDistributedBundleInfo( + const std::string &networkId, int32_t userId, const std::string &bundleName, + DistributedBundleInfo &distributedBundleInfo) = 0; enum class Message { GET_APPLICATION_INFO, diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h index 2eea64e4954..39bfacd9c50 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h @@ -315,6 +315,12 @@ public: { return true; } + virtual bool GetDistributedBundleInfo( + const std::string &networkId, int32_t userId, const std::string &bundleName, + DistributedBundleInfo &distributedBundleInfo) override + { + return true; + } public: using QueryAbilityInfoFunType = diff --git a/services/test/mock/include/mock_bundle_mgr.h b/services/test/mock/include/mock_bundle_mgr.h index c3bfb9e307d..127a7b8be03 100644 --- a/services/test/mock/include/mock_bundle_mgr.h +++ b/services/test/mock/include/mock_bundle_mgr.h @@ -258,6 +258,8 @@ public: MOCK_METHOD2(GetShortcutInfos, bool(const std::string &bundleName, std::vector &shortcutInfos)); MOCK_METHOD2(QueryAbilityInfos, bool(const Want &want, std::vector &abilityInfos)); MOCK_METHOD2(QueryAbilityInfosForClone, bool(const Want &want, std::vector &abilityInfos)); + MOCK_METHOD4(GetDistributedBundleInfo, bool(const std::string &networkId, int32_t userId, + const std::string &bundleName, DistributedBundleInfo &distributedBundleInfo)); }; class BundleMgrStub : public IRemoteStub { @@ -373,7 +375,12 @@ public: { return true; } - + virtual bool GetDistributedBundleInfo( + const std::string &networkId, int32_t userId, const std::string &bundleName, + DistributedBundleInfo &distributedBundleInfo) override + { + return true; + } BundleMgrService() { abilityInfoMap_.emplace(COM_IX_HIWORLD, HiWordInfo); -- Gitee From 7776e6959693a0af7fb310eb167f0faa2efdc91a Mon Sep 17 00:00:00 2001 From: njupthan Date: Tue, 11 Jan 2022 11:19:18 +0000 Subject: [PATCH 2/2] Fix codex Signed-off-by: njupthan --- .../ability/native/test/mock/include/mock_bundle_manager.h | 6 ++++-- .../appexecfwk_core/include/bundlemgr/mock_bundle_manager.h | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h index e3ca26fdae5..8ab2ec5c246 100644 --- a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h +++ b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.h @@ -98,7 +98,8 @@ public: const int32_t number, std::vector &moduleUsageRecords) override; virtual sptr GetBundleInstaller() override; virtual bool NotifyAbilityLifeStatus( - const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override; + const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) + override; }; class BundleMgrStub : public IRemoteStub { @@ -174,7 +175,8 @@ public: const int32_t number, std::vector &moduleUsageRecords) override; virtual sptr GetBundleInstaller() override; virtual bool NotifyAbilityLifeStatus( - const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override; + const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) + override; virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector &gids) override { return true; diff --git a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h index 39bfacd9c50..dce7b43aec7 100644 --- a/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h +++ b/services/abilitymgr/test/mock/libs/appexecfwk_core/include/bundlemgr/mock_bundle_manager.h @@ -143,7 +143,8 @@ public: const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) override; virtual bool NotifyAbilityLifeStatus( - const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override; + const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) + override; virtual bool CheckIsSystemAppByUid(const int uid) override; MOCK_METHOD3(GetApplicationInfos, bool(const ApplicationFlag flag, const int userId, std::vector &appInfos)); @@ -227,7 +228,8 @@ public: bool CheckWantEntity(const AAFwk::Want &, AbilityInfo &); virtual bool NotifyAbilityLifeStatus( - const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override; + const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) + override; MOCK_METHOD2(QueryWantAbility, int(const AAFwk::Want &want, std::vector &abilityInfos)); MOCK_METHOD3(GetApplicationInfos, bool(const ApplicationFlag flag, const int userId, std::vector &appInfos)); -- Gitee