From 68bbb87f035911113b0f75e23c755225670c14cf Mon Sep 17 00:00:00 2001 From: fengyang Date: Thu, 15 May 2025 19:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=B4=BB=E8=B7=83=E5=88=86?= =?UTF-8?q?=E7=BB=84=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengyang --- .../packagegroup/include/bundle_active_group_controller.h | 1 - .../packagegroup/src/bundle_active_group_controller.cpp | 7 ++----- test/unittest/device_usage_statistics_service_test.cpp | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index b19678d..ed69f48 100644 --- a/services/packagegroup/include/bundle_active_group_controller.h +++ b/services/packagegroup/include/bundle_active_group_controller.h @@ -99,7 +99,6 @@ private: std::map eventIdMatchReason_; bool bundleGroupEnable_ = true; bool isInit_ = false; - sptr sptrBundleMgr_; bool calculationTimeOut(const std::shared_ptr& oneBundleHistory, const int64_t bootBasedTimeStamp); int32_t GetNewGroup(const std::string& bundleName, const int32_t userId, const int64_t bootBasedTimeStamp, diff --git a/services/packagegroup/src/bundle_active_group_controller.cpp b/services/packagegroup/src/bundle_active_group_controller.cpp index 60570a3..a62e311 100644 --- a/services/packagegroup/src/bundle_active_group_controller.cpp +++ b/services/packagegroup/src/bundle_active_group_controller.cpp @@ -449,11 +449,8 @@ ErrCode BundleActiveGroupController::QueryAppGroup(int32_t& appGroup, bool BundleActiveGroupController::IsBundleInstalled(const std::string& bundleName, const int32_t userId) { ApplicationInfo bundleInfo; - if (!sptrBundleMgr_) { - return false; - } - bool getInfoIsSuccess = sptrBundleMgr_->GetApplicationInfo(bundleName, ApplicationFlag::GET_BASIC_APPLICATION_INFO, - userId, bundleInfo); + bool getInfoIsSuccess = BundleActiveBundleMgrHelper::GetInstance()->GetApplicationInfo( + bundleName, ApplicationFlag::GET_BASIC_APPLICATION_INFO, userId, bundleInfo); if (getInfoIsSuccess == false) { BUNDLE_ACTIVE_LOGE("IsBundleInstalled bundle is not installed!"); return false; diff --git a/test/unittest/device_usage_statistics_service_test.cpp b/test/unittest/device_usage_statistics_service_test.cpp index c73d7a4..2f567aa 100644 --- a/test/unittest/device_usage_statistics_service_test.cpp +++ b/test/unittest/device_usage_statistics_service_test.cpp @@ -913,7 +913,6 @@ HWTEST_F(DeviceUsageStatisticsServiceTest, BundleActiveGroupControllerTest_009, bundleActiveCore_->InitBundleGroupController(); int userId = 100; EXPECT_EQ(BundleActiveGroupController::GetInstance().IsBundleInstalled("test", userId), false); - BundleActiveGroupController::GetInstance().sptrBundleMgr_ = nullptr; EXPECT_EQ(BundleActiveGroupController::GetInstance().IsBundleInstalled("test", userId), false); } @@ -1125,7 +1124,6 @@ HWTEST_F(DeviceUsageStatisticsServiceTest, DeviceUsageStatisticsServiceTest_Quer int32_t userId = 100; EXPECT_NE(BundleActiveGroupController::GetInstance().QueryAppGroup(appGroup, bundleName, userId), ERR_OK); - BundleActiveGroupController::GetInstance().sptrBundleMgr_ = nullptr; bundleName = "defaultBundleName"; EXPECT_NE(BundleActiveGroupController::GetInstance().QueryAppGroup(appGroup, bundleName, userId), ERR_OK); } -- Gitee