diff --git a/bundle.json b/bundle.json index 55cc66d3f6e02d4119fbbfaf7ed1c8c2117dfad4..12a70c53a9fbd9b16978742a1a79f5176f27e44d 100644 --- a/bundle.json +++ b/bundle.json @@ -3,11 +3,11 @@ "description": "background task manager service", "version": "3.1", "license": "Apache License 2.0", - "repository": "https://gitee.com/openharmony/resourceschedule_background_task_mgr", "publishAs": "code-segment", "segment": { "destPath" : "foundation/resourceschedule/background_task_mgr" }, + "dirs": {}, "scripts": {}, "component": { "name": "background_task_mgr", @@ -19,8 +19,8 @@ "small", "standard" ], - "rom": "", - "ram": "", + "rom": "2048KB", + "ram": "10240KB", "deps": { "components": [ "aafwk_standard", diff --git a/interfaces/test/unittest/transient_task_jsunittest/transient_task_jsunit.test.js b/interfaces/test/unittest/transient_task_jsunittest/transient_task_jsunit.test.js index 0059dbb03f8bc3b944c2f9e58ac1f54b7ab3fb49..589a9364da934af52ff6382124e89182c13da141 100644 --- a/interfaces/test/unittest/transient_task_jsunittest/transient_task_jsunit.test.js +++ b/interfaces/test/unittest/transient_task_jsunittest/transient_task_jsunit.test.js @@ -139,9 +139,9 @@ describe("TransientTaskJsTest", function () { done(); } - backgroundTaskManager.getRemainingDelayTime(info.requestId, (error, data) => { - if (error.code == 0) { - console.info('TransientTaskJsTest004 backgroundTaskManager success, delaytime:' + data); + backgroundTaskManager.getRemainingDelayTime(info.requestId, (err, res) => { + if (err.data === 0) { + console.info('TransientTaskJsTest004 backgroundTaskManager success, delaytime:' + res); expect(true).assertTrue(); } else { diff --git a/services/test/unittest/bg_transient_task_mgr_test.cpp b/services/test/unittest/bg_transient_task_mgr_test.cpp index e5e2b25e979fb578b12a043ee3b2e96eff932830..8d5e554f8caed62b6431ba3b027af5596ea01f2a 100644 --- a/services/test/unittest/bg_transient_task_mgr_test.cpp +++ b/services/test/unittest/bg_transient_task_mgr_test.cpp @@ -51,8 +51,8 @@ public: HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_001, TestSize.Level1) { auto subscriber = std::make_shared(); - bool ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_TRUE(ret); + auto ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); + EXPECT_TRUE(ret == ERR_OK); } /** @@ -63,8 +63,8 @@ HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_001, TestSize.Level1) */ HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_002, TestSize.Level1) { - bool ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(nullptr); - EXPECT_FALSE(ret); + auto ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(nullptr); + EXPECT_FALSE(ret == ERR_OK); } /** @@ -76,11 +76,11 @@ HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_002, TestSize.Level1) HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_003, TestSize.Level1) { auto subscriber = std::make_shared(); - bool ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_TRUE(ret); + auto ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); + EXPECT_TRUE(ret == ERR_OK); ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_FALSE(ret); + EXPECT_FALSE(ret == ERR_OK); } /** @@ -92,13 +92,13 @@ HWTEST_F(BgTransientTaskMgrTest, SubscribeTransientTask_003, TestSize.Level1) HWTEST_F(BgTransientTaskMgrTest, UnsubscribeTransientTask_001, TestSize.Level1) { auto subscriber = std::make_shared(); - bool ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_TRUE(ret); + auto ret = DelayedSingleton::GetInstance()->SubscribeBackgroundTask(subscriber->GetImpl()); + EXPECT_TRUE(ret == ERR_OK); usleep(1000); ret = DelayedSingleton::GetInstance()->UnsubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_TRUE(ret); + EXPECT_TRUE(ret == ERR_OK); } /** @@ -110,8 +110,8 @@ HWTEST_F(BgTransientTaskMgrTest, UnsubscribeTransientTask_001, TestSize.Level1) HWTEST_F(BgTransientTaskMgrTest, UnsubscribeTransientTask_002, TestSize.Level1) { auto subscriber = std::make_shared(); - bool ret = DelayedSingleton::GetInstance()->UnsubscribeBackgroundTask(subscriber->GetImpl()); - EXPECT_FALSE(ret); + auto ret = DelayedSingleton::GetInstance()->UnsubscribeBackgroundTask(subscriber->GetImpl()); + EXPECT_FALSE(ret == ERR_OK); } /** @@ -122,8 +122,8 @@ HWTEST_F(BgTransientTaskMgrTest, UnsubscribeTransientTask_002, TestSize.Level1) */ HWTEST_F(BgTransientTaskMgrTest, UnsubscribeTransientTask_003, TestSize.Level1) { - bool ret = DelayedSingleton::GetInstance()->UnsubscribeBackgroundTask(nullptr); - EXPECT_FALSE(ret); + auto ret = DelayedSingleton::GetInstance()->UnsubscribeBackgroundTask(nullptr); + EXPECT_FALSE(ret == ERR_OK); } /** diff --git a/services/transient_task/src/bg_transient_task_mgr.cpp b/services/transient_task/src/bg_transient_task_mgr.cpp index 5b21904865229dfcc06eabf394de20af4f383d66..c88733050778e38e475083e793c82e63b2a393ab 100644 --- a/services/transient_task/src/bg_transient_task_mgr.cpp +++ b/services/transient_task/src/bg_transient_task_mgr.cpp @@ -483,7 +483,7 @@ ErrCode BgTransientTaskMgr::ShellDump(const std::vector &dumpOption deviceInfoManeger_->SetDump(false); result = true; } else { - dumpInfo.push_back("Error Dump Cmd!\n"); + dumpInfo.push_back("Error transient dump command!\n"); } return result ? ERR_OK : ERR_BGTASK_NOT_ALLOWED; diff --git a/utils/dump/src/bgtaskmgr_shell_command.cpp b/utils/dump/src/bgtaskmgr_shell_command.cpp index dc059bebfe321b4ca8b521fbfb3524bbe5e1fe9a..0b3ff2e51855f7d70863c4c1c35fc9bf1e3e8e3b 100644 --- a/utils/dump/src/bgtaskmgr_shell_command.cpp +++ b/utils/dump/src/bgtaskmgr_shell_command.cpp @@ -42,11 +42,12 @@ static const std::string DUMP_HELP_MSG = "usage: bgtask dump []\n" "options list:\n" " -h help menu\n" - " -T BATTARY_LOW battary low mode\n" + " -T transient task commands:\n" + " BATTARY_LOW battary low mode\n" " BATTARY_OKAY battary okay mode\n" - " SCREEN_ON sreen on mode\n" + " SCREEN_ON sreen on mode\n" " SCREEN_OFF sreen off mode\n" - " DUMP_CANCEL cancel dump mode\n" + " DUMP_CANCEL cancel dump mode\n" " All list all request\n"; } // namespace @@ -108,17 +109,12 @@ ErrCode BgtaskmgrShellCommand::RunAsDumpCommand() resultReceiver_.append(DUMP_HELP_MSG); break; case 'T': - if (argc_ != 4 || btm_ == nullptr) { - resultReceiver_.append(DUMP_HELP_MSG); - ret = ERR_BGTASK_SERVICE_NOT_CONNECTED; - break; + if (btm_ != nullptr) { + ret = btm_->ShellDump(argList_, infos); } - ret = btm_->ShellDump(argList_, infos); break; default: - std::cout << __LINE__ << " " << option << " " << ind << " " << std::endl; - if (optarg) - std::cout << optarg << std::endl; + resultReceiver_.append("Please input correct command!\n"); resultReceiver_.append(DUMP_HELP_MSG); break; }