From 7c0ec830f8413261bf90dc92db2a5c514e462510 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Mon, 14 Feb 2022 14:30:52 +0000 Subject: [PATCH 1/6] Fix atomic ability bundle.json change Signed-off-by: wanchengzhen --- bundle.json | 1 - services/formmgr/bundle.json | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index ae71005c594..a1087adc372 100644 --- a/bundle.json +++ b/bundle.json @@ -24,7 +24,6 @@ "appspawn", "bytrace_standard", "ces_standard", - "ces_standard", "device_manager_base", "distributeddatamgr_appdatamgr", "distributedschedule_dms_fwk", diff --git a/services/formmgr/bundle.json b/services/formmgr/bundle.json index 801f14db7b9..fb7f7e2d693 100644 --- a/services/formmgr/bundle.json +++ b/services/formmgr/bundle.json @@ -23,13 +23,13 @@ "components": [ "ability_runtime", "ans_standard", - "appexecfwk_standard", + "bundle_framework", "ces_standard", "hiviewdfx_hilog_native", "ipc", "napi", "native_appdatamgr", - "miscservices_time", + "time_native", "os_account_standard", "permission_standard", "power_manager_native", -- Gitee From 451c53f5d75e70c474fb1bbe96842011b67d54b5 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Mon, 14 Feb 2022 18:46:58 +0000 Subject: [PATCH 2/6] DisplayId check Signed-off-by: wanchengzhen --- frameworks/kits/ability/native/src/ability.cpp | 2 +- .../content/cpp/src/ohos/aafwk/content/want.cpp | 1 + .../ability_manager/include/start_options.h | 1 - .../want/include/ohos/aafwk/content/want.h | 1 + .../aafwk/inner/napi_common/napi_common_want.cpp | 13 ++++++++++++- .../aafwk/inner/napi_common/napi_common_want.h | 1 + .../abilitymgr/src/ability_manager_service.cpp | 2 +- services/abilitymgr/src/start_options.cpp | 14 +++++++++++++- 8 files changed, 30 insertions(+), 5 deletions(-) diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index 4ce6c9ac68c..c5485ee69b7 100755 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -206,7 +206,7 @@ void Ability::OnStart(const Want &want) } int defualtDisplayId = Rosen::WindowScene::DEFAULT_DISPLAY_ID; - int displayId = want.GetIntParam(StartOptions::STRING_DISPLAY_ID, defualtDisplayId); + int displayId = want.GetIntParam(Want::PARAM_RESV_DISPLAY_ID, defualtDisplayId); APP_LOGI("Ability::OnStart bundleName:%{public}s, abilityName:%{public}s, windowType:%{public}d, " "displayId:%{public}d", abilityInfo_->bundleName.c_str(), diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp index 8b0488a35eb..2453de0f445 100644 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp @@ -67,6 +67,7 @@ const std::string Want::MIME_TYPE("mime-type"); const std::string Want::WANT_HEADER("#Intent;"); const std::string Want::PARAM_RESV_WINDOW_MODE("ohos.aafwk.param.windowMode"); +const std::string Want::PARAM_RESV_DISPLAY_ID("ohos.aafwk.param.displayId"); const std::string Want::PARAM_RESV_CALLER_TOKEN("ohos.aafwk.param.callerToken"); const std::string Want::PARAM_RESV_CALLER_UID("ohos.aafwk.param.callerUid"); const std::string Want::PARAM_RESV_CALLER_PID("ohos.aafwk.param.callerPid"); diff --git a/interfaces/innerkits/ability_manager/include/start_options.h b/interfaces/innerkits/ability_manager/include/start_options.h index ed8bc0f6e70..df20f768bc0 100644 --- a/interfaces/innerkits/ability_manager/include/start_options.h +++ b/interfaces/innerkits/ability_manager/include/start_options.h @@ -24,7 +24,6 @@ namespace OHOS { namespace AAFwk { class StartOptions final : public Parcelable, public std::enable_shared_from_this { public: - static const std::string STRING_DISPLAY_ID; const int32_t DEFAULT_DISPLAY_ID {0}; StartOptions() = default; diff --git a/interfaces/innerkits/want/include/ohos/aafwk/content/want.h b/interfaces/innerkits/want/include/ohos/aafwk/content/want.h index 1c571636cbb..8cbea1e7b33 100644 --- a/interfaces/innerkits/want/include/ohos/aafwk/content/want.h +++ b/interfaces/innerkits/want/include/ohos/aafwk/content/want.h @@ -789,6 +789,7 @@ public: // reserved param definition static const std::string PARAM_RESV_WINDOW_MODE; + static const std::string PARAM_RESV_DISPLAY_ID; static const std::string PARAM_RESV_CALLER_TOKEN; static const std::string PARAM_RESV_CALLER_UID; static const std::string PARAM_RESV_CALLER_PID; diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp index 9dff21cbd37..f7856d4c7aa 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp @@ -686,6 +686,16 @@ bool InnerUnwrapWantParams(napi_env env, const std::string &key, napi_value para return false; } +bool BlackListFilter(const std::string &strProName) { + if (strProName == Want::PARAM_RESV_WINDOW_MODE) { + return true; + } + if (strProName == Want::PARAM_RESV_DISPLAY_ID) { + return true; + } + return false; +} + bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantParams) { HILOG_INFO("%{public}s called.", __func__); @@ -709,7 +719,8 @@ bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantPar std::string strProName = UnwrapStringFromJS(env, jsProName); /* skip reserved param */ - if (strProName == Want::PARAM_RESV_WINDOW_MODE) { + if(BlackListFilter(strProName)) { + HILOG_INFO("%{public}s is filtered.", strProName.c_str()); continue; } HILOG_INFO("%{public}s called. Property name=%{public}s.", __func__, strProName.c_str()); diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.h b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.h index 03130b2beb4..8cc4bcade3f 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.h +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.h @@ -33,6 +33,7 @@ bool UnwrapElementName(napi_env env, napi_value param, ElementName &elementName) napi_value WrapWantParams(napi_env env, const AAFwk::WantParams &wantParams); bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantParams); +bool BlackListFilter(const std::string &strProName); napi_value WrapWant(napi_env env, const Want &want); bool UnwrapWant(napi_env env, napi_value param, Want &want); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 1f98c244ec9..3becb70ac8f 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -502,7 +502,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st return systemAppManager_->StartAbility(abilityRequest); } } - abilityRequest.want.SetParam(StartOptions::STRING_DISPLAY_ID, startOptions.GetDisplayID()); + abilityRequest.want.SetParam(Want::PARAM_RESV_DISPLAY_ID, startOptions.GetDisplayID()); abilityRequest.want.SetParam(Want::PARAM_RESV_WINDOW_MODE, startOptions.GetWindowMode()); if (useNewMission_) { userIdValid = abilityInfo.applicationInfo.singleUser ? DEFAULT_USER_ID : userIdValid; diff --git a/services/abilitymgr/src/start_options.cpp b/services/abilitymgr/src/start_options.cpp index 0ec49ac7681..6c630f190ef 100644 --- a/services/abilitymgr/src/start_options.cpp +++ b/services/abilitymgr/src/start_options.cpp @@ -17,8 +17,20 @@ namespace OHOS { namespace AAFwk { +StartOptions::StartOptions(const StartOptions &other) +{ + windowMode_ = other.windowMode_; + displayId_ = other.displayId_; +} -const std::string StartOptions::STRING_DISPLAY_ID = "ohos.aafwk.displayId"; +StartOptions &StartOptions::operator=(const StartOptions &other) +{ + if (this != &other) { + windowMode_ = other.windowMode_; + displayId_ = other.displayId_; + } + return *this; +} StartOptions::StartOptions(const StartOptions &other) { -- Gitee From ee1e795060ce22838e47a9ea51f011ad454adc61 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Mon, 14 Feb 2022 18:57:23 +0000 Subject: [PATCH 3/6] Fix code Signed-off-by: wanchengzhen --- services/abilitymgr/src/start_options.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/services/abilitymgr/src/start_options.cpp b/services/abilitymgr/src/start_options.cpp index 6c630f190ef..e7bc58c9596 100644 --- a/services/abilitymgr/src/start_options.cpp +++ b/services/abilitymgr/src/start_options.cpp @@ -32,21 +32,6 @@ StartOptions &StartOptions::operator=(const StartOptions &other) return *this; } -StartOptions::StartOptions(const StartOptions &other) -{ - windowMode_ = other.windowMode_; - displayId_ = other.displayId_; -} - -StartOptions &StartOptions::operator=(const StartOptions &other) -{ - if (this != &other) { - windowMode_ = other.windowMode_; - displayId_ = other.displayId_; - } - return *this; -} - bool StartOptions::ReadFromParcel(Parcel &parcel) { SetWindowMode(parcel.ReadInt32()); -- Gitee From e35f0c24284b0dbd704d445970379abd690428f6 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Mon, 14 Feb 2022 20:11:43 +0000 Subject: [PATCH 4/6] Fix codeCheck Signed-off-by: wanchengzhen --- .../kits/napi/aafwk/inner/napi_common/napi_common_want.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp index f7856d4c7aa..4b3f081efc4 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_want.cpp @@ -686,7 +686,8 @@ bool InnerUnwrapWantParams(napi_env env, const std::string &key, napi_value para return false; } -bool BlackListFilter(const std::string &strProName) { +bool BlackListFilter(const std::string &strProName) +{ if (strProName == Want::PARAM_RESV_WINDOW_MODE) { return true; } @@ -719,7 +720,7 @@ bool UnwrapWantParams(napi_env env, napi_value param, AAFwk::WantParams &wantPar std::string strProName = UnwrapStringFromJS(env, jsProName); /* skip reserved param */ - if(BlackListFilter(strProName)) { + if (BlackListFilter(strProName)) { HILOG_INFO("%{public}s is filtered.", strProName.c_str()); continue; } -- Gitee From 3f3f88836d456d15104ce899a7d11d88223bfdbb Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Tue, 15 Feb 2022 16:40:45 +0800 Subject: [PATCH 5/6] zhongjianfei@huawei.com Signed-off-by: zhongjianfei Change-Id: I29a0b623a5d8b3a9f3cd81aac69522ecb19b308f --- .../native/test/unittest/context_container_test.cpp | 12 +++++++----- .../phone/ability_dump_test/ability_dump_test.cpp | 7 +------ .../ability_record_test/ability_record_test.cpp | 1 - .../ability_service_start_test.cpp | 2 -- .../ability_stack_manager_test.cpp | 1 - .../ability_with_applications_test.cpp | 1 - .../kernal_system_app_manager_test.cpp | 3 --- .../pending_want_manager_test.cpp | 1 - .../terminate_ability_test.cpp | 7 +------ .../ability_mgr_module_test.cpp | 7 ++----- .../ability_stack_test/ability_stack_module_test.cpp | 4 +--- .../moduletest/dump_module_test/dump_module_test.cpp | 1 - .../panding_want_manager_test.cpp | 2 +- 13 files changed, 13 insertions(+), 36 deletions(-) diff --git a/frameworks/kits/appkit/native/test/unittest/context_container_test.cpp b/frameworks/kits/appkit/native/test/unittest/context_container_test.cpp index a4b2e5a9028..fa9e66f1355 100644 --- a/frameworks/kits/appkit/native/test/unittest/context_container_test.cpp +++ b/frameworks/kits/appkit/native/test/unittest/context_container_test.cpp @@ -45,22 +45,24 @@ public: }; void ContextContainerTest::SetUpTestCase(void) -{} +{ + OHOS::DelayedSingleton::GetInstance()->RegisterSystemAbility( + OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, new BundleMgrService()); +} void ContextContainerTest::TearDownTestCase(void) -{} +{ + OHOS::DelayedSingleton::DestroyInstance(); +} void ContextContainerTest::SetUp(void) { - OHOS::DelayedSingleton::GetInstance()->RegisterSystemAbility( - OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, new BundleMgrService()); context_ = std::make_shared(); contextDeal_ = std::make_shared(); } void ContextContainerTest::TearDown(void) { - OHOS::DelayedSingleton::DestroyInstance(); context_ = nullptr; contextDeal_ = nullptr; } diff --git a/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp b/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp index 8957753503d..cc363a08756 100644 --- a/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp @@ -186,12 +186,7 @@ void AbilityDumpTest::SetUp() void AbilityDumpTest::TearDown() { - g_abilityMs->eventLoop_->Stop(); - g_abilityMs->eventLoop_.reset(); - g_abilityMs->handler_.reset(); - g_abilityMs->state_ = ServiceRunningState::STATE_NOT_START; - OHOS::DelayedSingleton::DestroyInstance(); - g_abilityMs = nullptr; + g_abilityMs->OnStop(); } void AbilityDumpTest::StartAbilityes() diff --git a/services/abilitymgr/test/unittest/phone/ability_record_test/ability_record_test.cpp b/services/abilitymgr/test/unittest/phone/ability_record_test/ability_record_test.cpp index 71202da4478..547699defa8 100644 --- a/services/abilitymgr/test/unittest/phone/ability_record_test/ability_record_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_record_test/ability_record_test.cpp @@ -53,7 +53,6 @@ void AbilityRecordTest::SetUpTestCase(void) void AbilityRecordTest::TearDownTestCase(void) { OHOS::DelayedSingleton::GetInstance()->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); } void AbilityRecordTest::SetUp(void) diff --git a/services/abilitymgr/test/unittest/phone/ability_service_start_test/ability_service_start_test.cpp b/services/abilitymgr/test/unittest/phone/ability_service_start_test/ability_service_start_test.cpp index 5d50f189567..5164dce77f5 100644 --- a/services/abilitymgr/test/unittest/phone/ability_service_start_test/ability_service_start_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_service_start_test/ability_service_start_test.cpp @@ -57,8 +57,6 @@ void AbilityServiceStartTest::SetUp() void AbilityServiceStartTest::TearDown() { aams_->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); - aams_ = nullptr; } /* diff --git a/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp b/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp index e22a8cce45b..d4a48a6cb73 100644 --- a/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp @@ -137,7 +137,6 @@ void AbilityStackManagerTest::TearDown() { stackManager_.reset(); abilityMs_->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); } void AbilityStackManagerTest::init() diff --git a/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp b/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp index b33478719cb..a4d33b77bca 100644 --- a/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp @@ -78,7 +78,6 @@ void AbilityWithApplicationsTest::SetUp() void AbilityWithApplicationsTest::TearDown() { abilityMs_->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); } void AbilityWithApplicationsTest::OnStartabilityAms() diff --git a/services/abilitymgr/test/unittest/phone/kernal_system_app_manager_test/kernal_system_app_manager_test.cpp b/services/abilitymgr/test/unittest/phone/kernal_system_app_manager_test/kernal_system_app_manager_test.cpp index 8d5191d5e1d..73f7fdbb841 100644 --- a/services/abilitymgr/test/unittest/phone/kernal_system_app_manager_test/kernal_system_app_manager_test.cpp +++ b/services/abilitymgr/test/unittest/phone/kernal_system_app_manager_test/kernal_system_app_manager_test.cpp @@ -74,15 +74,12 @@ void KernalSystemAppManagerTest::SetUpTestCase() int systemAbilityId = 401; OHOS::DelayedSingleton::GetInstance()->RegisterSystemAbility( systemAbilityId, new (std::nothrow) AppExecFwk::BundleMgrService()); - DelayedSingleton::GetInstance(); DelayedSingleton::GetInstance()->OnStart(); } void KernalSystemAppManagerTest::TearDownTestCase() { OHOS::DelayedSingleton::GetInstance()->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); - OHOS::DelayedSingleton::DestroyInstance(); } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp index 95e043170d1..db35827b343 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp +++ b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp @@ -132,7 +132,6 @@ void PendingWantManagerTest::SetUp() void PendingWantManagerTest::TearDown() { abilityMs_->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); } WantSenderInfo PendingWantManagerTest::MakeWantSenderInfo(Want &want, int32_t flags, int32_t userId, int32_t type) diff --git a/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp b/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp index 078735a877c..b010a495b5e 100644 --- a/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp +++ b/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp @@ -193,12 +193,7 @@ void TerminateAbilityTest::SetUp(void) void TerminateAbilityTest::TearDown(void) { - g_aams->eventLoop_->Stop(); - g_aams->eventLoop_.reset(); - g_aams->handler_.reset(); - g_aams->state_ = ServiceRunningState::STATE_NOT_START; - OHOS::DelayedSingleton::DestroyInstance(); - g_aams = nullptr; + g_aams->OnStop(); } bool TerminateAbilityTest::StartAbility( diff --git a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp index 1c49229fb3f..707fce1de92 100644 --- a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp +++ b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp @@ -201,22 +201,19 @@ static void OnStartAms() void AbilityMgrModuleTest::SetUpTestCase(void) { - OHOS::DelayedSingleton::DestroyInstance(); OHOS::DelayedSingleton::GetInstance()->RegisterSystemAbility( OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, new (std::nothrow) BundleMgrService()); - abilityMgrServ_ = OHOS::DelayedSingleton::GetInstance(); mockAppMgrClient_ = std::make_shared(); - OnStartAms(); } void AbilityMgrModuleTest::TearDownTestCase(void) { - OHOS::DelayedSingleton::DestroyInstance(); - abilityMgrServ_.reset(); + abilityMgrServ_->OnStop(); mockAppMgrClient_.reset(); } + void AbilityMgrModuleTest::SetUp(void) { scheduler_ = new MockAbilityScheduler(); diff --git a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp index e1edffa368e..9879881ccdc 100644 --- a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp +++ b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp @@ -149,9 +149,7 @@ void AbilityStackModuleTest::SetUp(void) void AbilityStackModuleTest::TearDown(void) { GTEST_LOG_(INFO) << "TearDown"; - auto ams = DelayedSingleton::GetInstance(); - OHOS::DelayedSingleton::DestroyInstance(); - + DelayedSingleton::GetInstance()->OnStop(); if (mockScheduler_ != nullptr) { mockScheduler_.clear(); } diff --git a/services/test/moduletest/dump_module_test/dump_module_test.cpp b/services/test/moduletest/dump_module_test/dump_module_test.cpp index 68943019cac..454b85e303e 100644 --- a/services/test/moduletest/dump_module_test/dump_module_test.cpp +++ b/services/test/moduletest/dump_module_test/dump_module_test.cpp @@ -183,7 +183,6 @@ void DumpModuleTest::SetUp() void DumpModuleTest::TearDown() { g_abilityMs->OnStop(); - OHOS::DelayedSingleton::DestroyInstance(); GTEST_LOG_(INFO) << "TearDown OK"; } diff --git a/services/test/moduletest/panding_want_manager_test/panding_want_manager_test.cpp b/services/test/moduletest/panding_want_manager_test/panding_want_manager_test.cpp index 2b20747fefc..bdcf2640585 100644 --- a/services/test/moduletest/panding_want_manager_test/panding_want_manager_test.cpp +++ b/services/test/moduletest/panding_want_manager_test/panding_want_manager_test.cpp @@ -98,7 +98,7 @@ void PandingWantManagerTest::SetUpTestCase(void) void PandingWantManagerTest::TearDownTestCase(void) { - OHOS::DelayedSingleton::DestroyInstance(); + abilityManager->OnStop(); if (appClient) { delete appClient; appClient = nullptr; -- Gitee From 1b449940570c4bb6f56fc241b3c0025534cdf3a5 Mon Sep 17 00:00:00 2001 From: zhangxin_T Date: Wed, 16 Feb 2022 17:25:39 +0800 Subject: [PATCH 6/6] bugfix for napi param parsing problem Signed-off-by: zhangxin_T --- .../napi/aafwk/inner/napi_common/napi_common_ability.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp index a5b9eda80d3..9e97c68a82f 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp @@ -3547,7 +3547,14 @@ void StartBackgroundRunningExecuteCB(napi_env env, void *data) return; } - asyncCallbackInfo->errCode = asyncCallbackInfo->ability->StartBackgroundRunning(*asyncCallbackInfo->wantAgent); + Notification::WantAgent::WantAgent wantAgentObj; + if (!asyncCallbackInfo->wantAgent) { + HILOG_WARN("input param without wantAgent"); + wantAgentObj = Notification::WantAgent::WantAgent(); + } else { + wantAgentObj = *asyncCallbackInfo->wantAgent; + } + asyncCallbackInfo->errCode = asyncCallbackInfo->ability->StartBackgroundRunning(wantAgentObj); HILOG_INFO("%{public}s end.", __func__); } -- Gitee