diff --git a/services/packagegroup/include/bundle_active_group_controller.h b/services/packagegroup/include/bundle_active_group_controller.h index b19678d20733d62064d13dfa7c549f259c148a9d..ed69f48d015f9ff847e96cb7aa359eddf4ce7e8f 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 60570a3b7f27c427728ff49bde9fa1b50f5ca314..a62e31188ba30ff57cd06ccf659b06a26d20c1ff 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 c73d7a47843b249d86e4bbc01a9b18e99bb84729..2f567aa2fed2baee4a433239363a884adbc9d357 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); }