From 2296530a43b8505af9c92b517713f2b78f8633b2 Mon Sep 17 00:00:00 2001 From: rcy-hw Date: Mon, 23 May 2022 21:17:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20wordtools=E5=91=8A=E8=AD=A6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rcy-hw --- .../ans/test/moduletest/ReminderHelperTest.js | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/frameworks/ans/test/moduletest/ReminderHelperTest.js b/frameworks/ans/test/moduletest/ReminderHelperTest.js index 6bd46c63a..d232d4965 100644 --- a/frameworks/ans/test/moduletest/ReminderHelperTest.js +++ b/frameworks/ans/test/moduletest/ReminderHelperTest.js @@ -20,6 +20,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe("ReminderHelperTest", function () { beforeAll(function() { + /* * @tc.setup: setup invoked before all testcases */ @@ -27,6 +28,7 @@ describe("ReminderHelperTest", function () { }) afterAll(function() { + /* * @tc.teardown: teardown invoked after all testcases */ @@ -34,6 +36,7 @@ describe("ReminderHelperTest", function () { }) beforeEach(function() { + /* * @tc.setup: setup invoked before each testcases */ @@ -41,6 +44,7 @@ describe("ReminderHelperTest", function () { }) afterEach(function() { + /* * @tc.teardown: teardown invoked after each testcases */ @@ -705,7 +709,7 @@ describe("ReminderHelperTest", function () { reminderAgent.addNotificationSlot(mySlot).then(() => { resolve(); }) - reject(); + reject(new Error('errr occurred.')); }); promise.then(() => { }, err => { @@ -1028,7 +1032,7 @@ describe("ReminderHelperTest", function () { reminderAgent.removeNotificationSlot(1).then(() => { resolve(); }); - reject(); + reject(new Error('errr occurred.')); }); promise.then(() => { }, err => { @@ -1195,12 +1199,12 @@ describe("ReminderHelperTest", function () { } ], wantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, maxScreenWantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, ringDuration:5, snoozeTimes:2, @@ -1223,8 +1227,10 @@ describe("ReminderHelperTest", function () { } console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent.pkgName); console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent.abilityName); - console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent.pkgName); - console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent.abilityName); + console.log("getValidReminders, maxScreenWantAgent.pkgName = " + + reminders[i].maxScreenWantAgent.pkgName); + console.log("getValidReminders, maxScreenWantAgent.abilityName = " + + reminders[i].maxScreenWantAgent.abilityName); expect(reminders[i].ringDuration).assertEqual(5); console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); expect(reminders[i].snoozeTimes).assertEqual(2); @@ -1276,12 +1282,12 @@ describe("ReminderHelperTest", function () { } ], wantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, maxScreenWantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, ringDuration:5, snoozeTimes:2, @@ -1304,8 +1310,10 @@ describe("ReminderHelperTest", function () { } console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent.pkgName); console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent.abilityName); - console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent.pkgName); - console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent.abilityName); + console.log("getValidReminders, maxScreenWantAgent.pkgName = " + + reminders[i].maxScreenWantAgent.pkgName); + console.log("getValidReminders, maxScreenWantAgent.abilityName = " + + reminders[i].maxScreenWantAgent.abilityName); expect(reminders[i].ringDuration).assertEqual(5); console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); expect(reminders[i].snoozeTimes).assertEqual(2); @@ -1357,12 +1365,12 @@ describe("ReminderHelperTest", function () { } ], wantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, maxScreenWantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, ringDuration:5, snoozeTimes:2, @@ -1415,12 +1423,12 @@ describe("ReminderHelperTest", function () { } ], wantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, maxScreenWantAgent:{ - pkgName:"com.huawei.phone", - abilityName:"com.huawei.phone.MainAbility" + pkgName:"com.test.pkg", + abilityName:"com.test.pkg.MainAbility" }, ringDuration:5, snoozeTimes:2, -- Gitee From 0ebb0756feb935b152fa190e6adcc05a2e4f7db2 Mon Sep 17 00:00:00 2001 From: rcy-hw Date: Mon, 23 May 2022 21:48:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rcy-hw --- services/ans/src/reminder_data_manager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/ans/src/reminder_data_manager.cpp b/services/ans/src/reminder_data_manager.cpp index a74441c54..946ece0ef 100644 --- a/services/ans/src/reminder_data_manager.cpp +++ b/services/ans/src/reminder_data_manager.cpp @@ -690,6 +690,10 @@ void ReminderDataManager::ShowReminder(const sptr &reminder, co reminder->OnShow(toPlaySound, isSysTimeChanged, true); AddToShowedReminders(reminder); UpdateNotification(reminder); // this should be called after OnShow + + if (alertingReminderId_ != -1) { + TerminateAlerting(alertingReminder_, "PlaySoundAndVibration"); + } ANSR_LOGD("publish notification.(reminderId=%{public}d)", reminder->GetReminderId()); ErrCode errCode = advancedNotificationService_->PublishPreparedNotification(notificationRequest, bundleOption); if (errCode != ERR_OK) { -- Gitee