From fcf9225078f71a6fc49f9ce287109d44541e7297 Mon Sep 17 00:00:00 2001 From: jackd320 Date: Mon, 25 Jul 2022 11:47:00 +0000 Subject: [PATCH 1/5] Signed-off-by: jackd320 --- .../extend/systemplugin/napi/ohos_update.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index deba644b..965f71f8 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -41,6 +41,18 @@ export function mockUpdate() { }) } }, + getNewVersionDescription: function (...args) { + console.warn("Updater.getNewVersionDescription interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [ComponentDescription]); + } else { + return new Promise((resolve, reject) => { + resolve([ComponentDescription]); + }) + } + }, getCurrentVersionInfo: function (...args) { console.warn("Updater.getCurrentVersionInfo interface mocked in the Previewer. How this interface works" + " on the Previewer may be different from that on a real device.") @@ -53,6 +65,18 @@ export function mockUpdate() { }) } }, + getCurrentVersionDescription: function (...args) { + console.warn("Updater.getCurrentVersionDescription interface mocked in the Previewer. How this interface works" + + " on the Previewer may be different from that on a real device.") + const len = args.length + if (len > 0 && typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, [ComponentDescription]); + } else { + return new Promise((resolve, reject) => { + resolve([ComponentDescription]); + }) + } + }, getTaskInfo: function (...args) { console.warn("Updater.getTaskInfo interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -255,6 +279,9 @@ export function mockUpdate() { ClearOptions, EventClassifyInfo, UpgradeFile, + DescriptionOptions, + ComponentDescription, + DescriptionFormat, getOnlineUpdater: function (...args) { console.warn("update.getOnlineUpdater interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -365,6 +392,7 @@ const DescriptionInfo = { } const VersionComponent = { + componentId: "[PC Preview] unknown componentId", componentType: ComponentType.OTA, upgradeAction: UpgradeAction.UPGRADE, displayVersion: "[PC Preview] unknown displayVersion", @@ -465,4 +493,19 @@ const EventClassifyInfo = { const UpgradeFile = { fileType: ComponentType, filePath: "[PC Preview] unknown filePath" +} + +const DescriptionOptions = { + format: DescriptionFormat, + language: "[PC Preview] unknown language", +} + +const ComponentDescription = { + componentId: "[PC Preview] unknown componentId", + descriptionInfo: DescriptionInfo, +} + +const DescriptionFormat = { + STANDARD: 0, + SIMPLIFIED : 1, } \ No newline at end of file From 91f781dc01df7bdb592567e12bcf477bdd2661c7 Mon Sep 17 00:00:00 2001 From: jackd320 Date: Mon, 25 Jul 2022 11:50:02 +0000 Subject: [PATCH 2/5] Signed-off-by: jackd320 --- runtime/main/extend/systemplugin/napi/ohos_update.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index 965f71f8..6a7f1086 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -280,8 +280,6 @@ export function mockUpdate() { EventClassifyInfo, UpgradeFile, DescriptionOptions, - ComponentDescription, - DescriptionFormat, getOnlineUpdater: function (...args) { console.warn("update.getOnlineUpdater interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") From a2f3c0520fe861fb68c85a9ca92580ded66f4e60 Mon Sep 17 00:00:00 2001 From: jackd320 Date: Tue, 26 Jul 2022 11:41:04 +0000 Subject: [PATCH 3/5] Signed-off-by: jackd320 --- runtime/main/extend/systemplugin/napi/ohos_update.js | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index 6a7f1086..1e45391f 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -280,6 +280,7 @@ export function mockUpdate() { EventClassifyInfo, UpgradeFile, DescriptionOptions, + DescriptionFormat, getOnlineUpdater: function (...args) { console.warn("update.getOnlineUpdater interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") From 79f283e6abe1b680a0d62c3107ae7f0106d98c01 Mon Sep 17 00:00:00 2001 From: jiangyuan0000 Date: Tue, 19 Jul 2022 11:26:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0hidebug=E7=9A=84js=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jiangyuan0000 --- .../main/extend/systemplugin/napi/index.js | 3 + .../extend/systemplugin/napi/ohos_hidebug.js | 74 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 runtime/main/extend/systemplugin/napi/ohos_hidebug.js diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js index 6c3bea34..155e7d1e 100644 --- a/runtime/main/extend/systemplugin/napi/index.js +++ b/runtime/main/extend/systemplugin/napi/index.js @@ -53,6 +53,7 @@ import { mockHiAppEvent } from './ohos_hiAppEvent' import { mockHilog } from './ohos_hilog' import { mockHiSysEvent } from './ohos_hiSysEvent' import { mockHiTraceChain } from './ohos_hiTraceChain' +import { mockHidebug } from './ohos_hidebug' import { mockTv } from './tv' import { mockDtv } from './dtv' import { mockDistributedAccount } from './ohos_account_distributedAccount' @@ -348,6 +349,8 @@ export function mockRequireNapiFun() { return mockHilog(); case "hiSysEvent": return mockHiSysEvent(); + case "hidebug": + return mockHidebug(); case "hiTraceChain": return mockHiTraceChain(); case "tv": diff --git a/runtime/main/extend/systemplugin/napi/ohos_hidebug.js b/runtime/main/extend/systemplugin/napi/ohos_hidebug.js new file mode 100644 index 00000000..c1fd2a4a --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/ohos_hidebug.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { paramMock } from "../utils" + +export function mockHidebug() { + const hidebug = { + getNativeHeapSize: function () { + console.warn("hidebug.getNativeHeapSize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getNativeHeapAllocatedSize: function () { + console.warn("hidebug.getNativeHeapAllocatedSize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getNativeHeapFreeSize: function () { + console.warn("hidebug.getNativeHeapFreeSize interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getPss: function () { + console.warn("hidebug.getPss interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getSharedDirty: function () { + console.warn("hidebug.getSharedDirty interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getPrivateDirty: function () { + console.warn("hidebug.getPrivateDirty interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + getCpuUsage: function () { + console.warn("hidebug.getCpuUsage interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramNumberMock; + }, + startProfiling: function (...args) { + console.warn("hidebug.startProfiling interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + stopProfiling: function () { + console.warn("hidebug.stopProfiling interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + dumpHeapData: function (...args) { + console.warn("hidebug.dumpHeapData interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + getServiceDump: function (...args) { + console.warn("hidebug.getServiceDump interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + return paramMock.paramStringMock; + }, + } + return hidebug +} \ No newline at end of file From 4f2eae614f2e200fb6e73a96bcea78fe8229ac6c Mon Sep 17 00:00:00 2001 From: "zhangyafei.echo" Date: Wed, 27 Jul 2022 12:43:48 +0800 Subject: [PATCH 5/5] IssueNo:#I5HKEJ Description:Add definition of windowMode in stage-based ability. Sig:SIG_ApplicationFramework Feature or BugFix: Feature Binary Source: No Signed-off-by: zhangyafei.echo Change-Id: I6436590e127dd98210d1536bf34c81422b0070bf --- .../napi/ohos_application_AbilityConstant.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js b/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js index 5a0aedb5..3f7f3a92 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js +++ b/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js @@ -33,12 +33,20 @@ export const OnContinueResult = { REJECT: 1, MISMATCH: 2, } +export const WindowMode = { + WINDOW_MODE_UNDEFINED: 0, + WINDOW_MODE_FULLSCREEN: 1, + WINDOW_MODE_SPLIT_PRIMARY: 100, + WINDOW_MODE_SPLIT_SECONDARY: 101, + WINDOW_MODE_FLOATING: 102, +} export function mockAbilityConstant() { const AbilityConstant = { LaunchParam, LaunchReason, LastExitReason, - OnContinueResult + OnContinueResult, + WindowMode } return AbilityConstant; } \ No newline at end of file