diff --git a/frameworks/native/appkit/app/child_main_thread.cpp b/frameworks/native/appkit/app/child_main_thread.cpp index a18c52e5b0646f753c83f9e59bb74c9d0773aa1b..b33a982990d37039e7b108c3836941dff2c2fb19 100644 --- a/frameworks/native/appkit/app/child_main_thread.cpp +++ b/frameworks/native/appkit/app/child_main_thread.cpp @@ -123,8 +123,12 @@ bool ChildMainThread::Init(const std::shared_ptr &runner, const Chi processInfo_ = std::make_shared(processInfo); processArgs_->entryParams = processInfo.entryParams; mainHandler_ = std::make_shared(runner); - bundleInfo_ = std::make_shared(processInfo.bundleInfo); - InitNativeLib(processInfo.bundleInfo, processInfo.hspList); + bundleInfo_ = processInfo.bundleInfo; + if (bundleInfo_ == nullptr) { + TAG_LOGE(AAFwkTag::APPKIT, "null bundleInfo"); + return false; + } + InitNativeLib(*bundleInfo_, processInfo.hspList); return true; } diff --git a/interfaces/inner_api/app_manager/include/appmgr/child_process_info.h b/interfaces/inner_api/app_manager/include/appmgr/child_process_info.h index b26dcf2ed0fb68ddf4b232e50c0795a65353c9b5..d6f14fa78f6e5083d85c0cac0c849eb01f17d52b 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/child_process_info.h +++ b/interfaces/inner_api/app_manager/include/appmgr/child_process_info.h @@ -47,7 +47,7 @@ struct ChildProcessInfo : public Parcelable { std::string srcEntry; std::string entryFunc; std::string entryParams; - BundleInfo bundleInfo; + std::shared_ptr bundleInfo = nullptr; std::vector hspList; bool ReadFromParcel(Parcel &parcel); diff --git a/interfaces/inner_api/app_manager/src/appmgr/child_process_info.cpp b/interfaces/inner_api/app_manager/src/appmgr/child_process_info.cpp index 9729cc19370249e2e090d1d273b4a292d746081f..ef4851479e10d21d524185f64285358ee0770d95 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/child_process_info.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/child_process_info.cpp @@ -55,12 +55,10 @@ bool ChildProcessInfo::ReadFromParcel(Parcel &parcel) isDebugApp = parcel.ReadBool(); isStartWithDebug = parcel.ReadBool(); isStartWithNative = parcel.ReadBool(); - std::unique_ptr info(parcel.ReadParcelable()); - if (!info) { - TAG_LOGE(AAFwkTag::APPMGR, "read bundle info failed"); - return false; + bool hasBundleInfo = parcel.ReadBool(); + if (hasBundleInfo) { + bundleInfo.reset(parcel.ReadParcelable()); } - bundleInfo = *info; int32_t hspListSize = 0; READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, hspListSize); @@ -105,7 +103,11 @@ bool ChildProcessInfo::Marshalling(Parcel &parcel) const WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isDebugApp); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isStartWithDebug); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isStartWithNative); - WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &bundleInfo); + bool hasBundleInfo = bundleInfo != nullptr; + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, hasBundleInfo); + if (hasBundleInfo) { + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, bundleInfo.get()); + } WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, hspList.size()); for (auto &baseSharedBundleInfo : hspList) { WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &baseSharedBundleInfo); diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index e6a298ada78244b8f34db7ce9812d8133c41ad41..9743d0479f3719023d8a9031ccdd01d763d62616 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -1833,8 +1833,10 @@ private: const ChildProcessOptions &options); int32_t GetChildProcessInfo(const std::shared_ptr childProcessRecord, - const std::shared_ptr appRecord, ChildProcessInfo &info, - bool isCallFromGetChildrenProcesses = false); + const std::shared_ptr appRecord, ChildProcessInfo &info); + + int32_t GetChildProcessInfoEx(const std::shared_ptr childProcessRecord, + const std::shared_ptr appRecord, ChildProcessInfo &info); void OnChildProcessRemoteDied(const wptr &remote); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 6b946bab932fb5953c528d44694361d0ae8365d3..c2a39790dfda7eaffb1230a88ea7205a4cb6c45e 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -2978,7 +2978,7 @@ void AppMgrServiceInner::GetChildrenProcesses(const std::shared_ptrsecond; - return GetChildProcessInfo(childProcessRecord, appRecord, info); + return GetChildProcessInfoEx(childProcessRecord, appRecord, info); } return ERR_NAME_NOT_FOUND; } +int32_t AppMgrServiceInner::GetChildProcessInfoEx(const std::shared_ptr childProcessRecord, + const std::shared_ptr appRecord, ChildProcessInfo &info) +{ + TAG_LOGD(AAFwkTag::APPMGR, "called"); + int32_t errCode = GetChildProcessInfo(childProcessRecord, appRecord, info); + if (errCode != ERR_OK) { + TAG_LOGE(AAFwkTag::APPMGR, "GetChildProcessInfo failed, error: %{public}d", errCode); + return errCode; + } + auto bundleMgrHelper = remoteClientManager_->GetBundleManagerHelper(); + if (bundleMgrHelper == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "bundleMgrHelper null"); + return ERR_NO_INIT; + } + auto osAccountMgr = DelayedSingleton::GetInstance(); + if (osAccountMgr == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr"); + return ERR_INVALID_VALUE; + } + int32_t userId = -1; + errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId); + if (errCode != ERR_OK) { + TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode); + return errCode; + } + auto bundleFlag = static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE) | + static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) | + static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA); + BundleInfo bundleInfo; + if (IN_PROCESS_CALL(bundleMgrHelper->GetCloneBundleInfo(appRecord->GetBundleName(), + bundleFlag, appRecord->GetAppIndex(), bundleInfo, userId) != ERR_OK)) { + TAG_LOGE(AAFwkTag::APPMGR, "GetCloneBundleInfo fail"); + return ERR_INVALID_VALUE; + } + info.bundleInfo = std::make_shared(bundleInfo); + if (childProcessRecord->GetChildProcessType() != CHILD_PROCESS_TYPE_NATIVE && + childProcessRecord->GetChildProcessType() != CHILD_PROCESS_TYPE_NATIVE_ARGS) { + if (IN_PROCESS_CALL(bundleMgrHelper->GetBaseSharedBundleInfos(appRecord->GetBundleName(), info.hspList, + AppExecFwk::GetDependentBundleInfoFlag::GET_ALL_DEPENDENT_BUNDLE_INFO) != ERR_OK)) { + TAG_LOGE(AAFwkTag::APPMGR, "GetBaseSharedBundleInfos fail"); + return ERR_INVALID_VALUE; + } + } + info.childProcessType = childProcessRecord->GetChildProcessType(); + info.srcEntry = childProcessRecord->GetSrcEntry(); + info.entryFunc = childProcessRecord->GetEntryFunc(); + info.entryParams = childProcessRecord->GetEntryParams(); + info.jitEnabled = appRecord->IsJITEnabled(); + info.isStartWithDebug = childProcessRecord->isStartWithDebug(); + auto applicationInfo = appRecord->GetApplicationInfo(); + if (applicationInfo) { + TAG_LOGD(AAFwkTag::APPMGR, "applicationInfo is exist, debug:%{public}d", applicationInfo->debug); + info.isDebugApp = applicationInfo->debug; + } + info.isStartWithNative = appRecord->isNativeStart(); + return ERR_OK; +} + int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptr childProcessRecord, - const std::shared_ptr appRecord, ChildProcessInfo &info, bool isCallFromGetChildrenProcesses) + const std::shared_ptr appRecord, ChildProcessInfo &info) { TAG_LOGD(AAFwkTag::APPMGR, "called"); if (!childProcessRecord) { @@ -8747,44 +8805,6 @@ int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptrGetUid(); info.bundleName = appRecord->GetBundleName(); info.processName = childProcessRecord->GetProcessName(); - - auto bundleMgrHelper = remoteClientManager_->GetBundleManagerHelper(); - if (bundleMgrHelper == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "bundleMgrHelper null"); - return ERR_NO_INIT; - } - auto bundleFlag = static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE) | - static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) | - static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_METADATA); - if (IN_PROCESS_CALL(bundleMgrHelper->GetCloneBundleInfo(appRecord->GetBundleName(), - bundleFlag, appRecord->GetAppIndex(), info.bundleInfo, userId))) { - TAG_LOGE(AAFwkTag::APPMGR, "GetCloneBundleInfo fail"); - return ERR_INVALID_VALUE; - } - - if (childProcessRecord->GetChildProcessType() != CHILD_PROCESS_TYPE_NATIVE && - childProcessRecord->GetChildProcessType() != CHILD_PROCESS_TYPE_NATIVE_ARGS) { - if (IN_PROCESS_CALL(bundleMgrHelper->GetBaseSharedBundleInfos(appRecord->GetBundleName(), info.hspList, - AppExecFwk::GetDependentBundleInfoFlag::GET_ALL_DEPENDENT_BUNDLE_INFO))) { - TAG_LOGE(AAFwkTag::APPMGR, "GetBaseSharedBundleInfos fail"); - return ERR_INVALID_VALUE; - } - } - - if (!isCallFromGetChildrenProcesses) { - info.childProcessType = childProcessRecord->GetChildProcessType(); - info.srcEntry = childProcessRecord->GetSrcEntry(); - info.entryFunc = childProcessRecord->GetEntryFunc(); - info.entryParams = childProcessRecord->GetEntryParams(); - info.jitEnabled = appRecord->IsJITEnabled(); - info.isStartWithDebug = childProcessRecord->isStartWithDebug(); - auto applicationInfo = appRecord->GetApplicationInfo(); - if (applicationInfo) { - TAG_LOGD(AAFwkTag::APPMGR, "applicationInfo is exist, debug:%{public}d", applicationInfo->debug); - info.isDebugApp = applicationInfo->debug; - } - info.isStartWithNative = appRecord->isNativeStart(); - } return ERR_OK; } diff --git a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp index b9f289989d5270cb3a4e7c7412f85aa207626696..8deb81954a73d0c3537cfae8c4bef29118ba84db 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp @@ -1421,13 +1421,13 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoForSelf_005, TestSize. } /** - * @tc.name: GetChildProcessInfo_001 - * @tc.desc: test GetChildProcessInfo_001 + * @tc.name: GetChildProcessInfoEx_001 + * @tc.desc: test GetChildProcessInfoEx_001 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_001, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_001, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_001 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_001 start"); auto appMgrServiceInner = std::make_shared(); ChildProcessRequest request; @@ -1435,20 +1435,19 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_001, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = nullptr; ChildProcessInfo info; - bool isCallFromGetChildren = false; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_NAME_NOT_FOUND); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_001 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_001 end"); } /** - * @tc.name: GetChildProcessInfo_002 - * @tc.desc: test GetChildProcessInfo_002 + * @tc.name: GetChildProcessInfoEx_002 + * @tc.desc: test GetChildProcessInfoEx_002 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_002, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_002, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_002 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_002 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_NAME_NOT_FOUND; @@ -1457,20 +1456,19 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_002, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_NAME_NOT_FOUND); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_002 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_002 end"); } /** - * @tc.name: GetChildProcessInfo_003 - * @tc.desc: test GetChildProcessInfo_003 + * @tc.name: GetChildProcessInfoEx_003 + * @tc.desc: test GetChildProcessInfoEx_003 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_003, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_003, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_003 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_003 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1479,20 +1477,19 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_003, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_OK); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_003 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_003 end"); } /** - * @tc.name: GetChildProcessInfo_004 - * @tc.desc: test GetChildProcessInfo_004 + * @tc.name: GetChildProcessInfoEx_004 + * @tc.desc: test GetChildProcessInfoEx_004 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_004, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_004, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_004 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_004 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1501,21 +1498,20 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_004, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = nullptr; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_NO_INIT); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_004 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_004 end"); } /** - * @tc.name: GetChildProcessInfo_005 - * @tc.desc: test GetChildProcessInfo_005 + * @tc.name: GetChildProcessInfoEx_005 + * @tc.desc: test GetChildProcessInfoEx_005 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_005, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_005, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_005 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_005 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1524,23 +1520,22 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_005, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); AAFwk::MyStatus::GetInstance().getCloneBundleInfo_ = ERR_INVALID_VALUE; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_INVALID_VALUE); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_005 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_005 end"); } /** - * @tc.name: GetChildProcessInfo_006 - * @tc.desc: test GetChildProcessInfo_006 + * @tc.name: GetChildProcessInfoEx_006 + * @tc.desc: test GetChildProcessInfoEx_006 * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_006, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_006, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_006 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_006 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1550,24 +1545,23 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_006, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); AAFwk::MyStatus::GetInstance().getCloneBundleInfo_ = ERR_OK; AAFwk::MyStatus::GetInstance().getBaseSharedBundleInfos_ = ERR_INVALID_VALUE; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_INVALID_VALUE); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_006 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_006 end"); } /** - * @tc.name: GetChildProcessInfo_007 + * @tc.name: GetChildProcessInfoEx_007 * @tc.desc: test GetChildProcessInfo * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_007, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_007, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_007 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_007 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1577,23 +1571,22 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_007, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); AAFwk::MyStatus::GetInstance().getCloneBundleInfo_ = ERR_OK; AAFwk::MyStatus::GetInstance().getBaseSharedBundleInfos_ = ERR_INVALID_VALUE; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_OK); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_007 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_007 end"); } /** - * @tc.name: GetChildProcessInfo_008 + * @tc.name: GetChildProcessInfoEx_008 * @tc.desc: test GetChildProcessInfo * @tc.type: FUNC */ -HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_008, TestSize.Level1) +HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfoEx_008, TestSize.Level1) { - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_008 start"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_008 start"); auto appMgrServiceInner = std::make_shared(); AAFwk::MyStatus::GetInstance().getOsAccountLocalIdFromUid_ = ERR_OK; @@ -1603,13 +1596,12 @@ HWTEST_F(AppMgrServiceInnerEighthTest, GetChildProcessInfo_008, TestSize.Level1) std::make_shared(0, request, nullptr); std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); ChildProcessInfo info; - bool isCallFromGetChildren = false; AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); AAFwk::MyStatus::GetInstance().getCloneBundleInfo_ = ERR_OK; AAFwk::MyStatus::GetInstance().getBaseSharedBundleInfos_ = ERR_INVALID_VALUE; - auto ret = appMgrServiceInner->GetChildProcessInfo(childProcessRecord, appRecord, info, isCallFromGetChildren); + auto ret = appMgrServiceInner->GetChildProcessInfoEx(childProcessRecord, appRecord, info); EXPECT_EQ(ret, ERR_OK); - TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfo_008 end"); + TAG_LOGI(AAFwkTag::TEST, "GetChildProcessInfoEx_008 end"); } /** diff --git a/test/unittest/appkit/child_main_thread_test/child_main_thread_test.cpp b/test/unittest/appkit/child_main_thread_test/child_main_thread_test.cpp index bd054a6b0e6e3b62e57fc51ca6d2ea04d381d0dc..3c884abf7c7f6940a51a7cace0fde9590e0b6c51 100644 --- a/test/unittest/appkit/child_main_thread_test/child_main_thread_test.cpp +++ b/test/unittest/appkit/child_main_thread_test/child_main_thread_test.cpp @@ -76,6 +76,7 @@ HWTEST_F(ChildMainThreadTest, Init_0100, TestSize.Level0) std::shared_ptr runner = EventRunner::GetMainEventRunner(); ChildProcessInfo info; + info.bundleInfo = std::make_shared(); auto ret = thread->Init(runner, info); EXPECT_TRUE(ret); }