From 8e6826a08999cb7ef986e768d09c36899f8fd26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E6=80=A1?= Date: Tue, 30 Aug 2022 12:59:09 +0000 Subject: [PATCH 1/3] =?UTF-8?q?bgtask=E8=83=BD=E6=95=88=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=8E=A5=E5=8F=A3API=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱天怡 --- .../napi/ohos_backgroundTaskManager.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js index d3e9eebf..a33af424 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js @@ -32,6 +32,23 @@ export function mockBackgroundTaskManager() { VOIP: 8, TASK_KEEPING: 9 }, + ResourceType : { + CPU: 1, + COMMON_EVENT: 1 << 1, + TIMER: 1 << 2, + WORK_SCHEDULER: 1 << 3, + BLUETOOTH: 1 << 4, + GPS: 1 << 5, + AUDIO: 1 << 6, + }, + EfficiencyResourceRequest : { + resourceType: '[PC preview] unknown resourceType', + isApply: '[PC preview] unknown isApply', + timeOut: '[PC preview] unknown timeOut', + isPersist: '[PC preview] unknown isPersist', + isProcess: '[PC preview] unknown isProcess', + reason: '[PC preview] unknown reason', + }, requestSuspendDelay: function (...args) { console.warn("backgroundTaskManager.requestSuspendDelay interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -80,6 +97,14 @@ export function mockBackgroundTaskManager() { resolve(); }); } + }, + applyEfficiencyResources: function(...args) { + console.warn("backgroundTaskManager.applyEfficiencyResources interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + resetAllEfficiencyResources: function(...args) { + console.warn("backgroundTaskManager.resetAllEfficiencyResources interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") } }; return backgroundTaskManager; From 131db9095fd2419385e1a1ed48fcf9e99f52d0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E6=80=A1?= Date: Fri, 2 Sep 2022 02:39:22 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱天怡 --- .../main/extend/systemplugin/napi/ohos_backgroundTaskManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js index a33af424..d9370a3c 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js @@ -42,7 +42,7 @@ export function mockBackgroundTaskManager() { AUDIO: 1 << 6, }, EfficiencyResourceRequest : { - resourceType: '[PC preview] unknown resourceType', + resourceTypes: '[PC preview] unknown resourceTypes', isApply: '[PC preview] unknown isApply', timeOut: '[PC preview] unknown timeOut', isPersist: '[PC preview] unknown isPersist', From 6d56ed700d3559ab8df0af6961daf3a6e127f15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E6=80=A1?= Date: Mon, 5 Sep 2022 06:26:04 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱天怡 --- .../extend/systemplugin/napi/ohos_backgroundTaskManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js index d9370a3c..30d41fe5 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js @@ -41,7 +41,7 @@ export function mockBackgroundTaskManager() { GPS: 1 << 5, AUDIO: 1 << 6, }, - EfficiencyResourceRequest : { + EfficiencyResourcesRequest : { resourceTypes: '[PC preview] unknown resourceTypes', isApply: '[PC preview] unknown isApply', timeOut: '[PC preview] unknown timeOut', @@ -101,6 +101,7 @@ export function mockBackgroundTaskManager() { applyEfficiencyResources: function(...args) { console.warn("backgroundTaskManager.applyEfficiencyResources interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") + return paramMock.paramBooleanMock; }, resetAllEfficiencyResources: function(...args) { console.warn("backgroundTaskManager.resetAllEfficiencyResources interface mocked in the Previewer. How this interface works on the" +