diff --git a/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js b/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js new file mode 100755 index 00000000..3caaf73d --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js @@ -0,0 +1,21 @@ +/* + * 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. + */ + +export const PermissionDef = { + permissionName: "[PC preview] unknown permissionName", + grantMode: "[PC preview] unknown grantMode", + labelId: "[PC preview] unknown labelId", + descriptionId: "[PC preview] unknown descriptionId", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js old mode 100644 new mode 100755 index ee690e17..3a0bbf33 --- a/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js @@ -13,7 +13,14 @@ * limitations under the License. */ -export const AbilityInfoMock = { +import { paramMock } from "../../utils" +import { AbilityType, AbilitySubType, DisplayOrientation, LaunchMode, SupportWindowMode } from "./../ohos_bundle" +import { ApplicationInfo } from "./applicationInfo" +import { CustomizeData } from "./customizeData" +import { Metadata } from "./metadata" + + +export const AbilityInfo = { name: "[PC preview] unknown name", bundleName: "[PC preview] unknown bundleName", moduleName: "[PC preview] unknown moduleName", @@ -22,117 +29,31 @@ export const AbilityInfoMock = { backgroundModes: "[PC preview] unknown backgroundModes", isVisible: "[PC preview] unknown isVisible", formEnabled: "[PC preview] unknown formEnabled", - type: { - UNKNOWN: 0, - PAGE: 2, - SERVICE: 3, - DATA: 4, - }, - subType: { - UNSPECIFIED: 0, - CA: 1, - }, - orientation: { - UNSPECIFIED: 0, - LANDSCAPE: 2, - PORTRAIT: 1, - FOLLOW_RECENT: 2, - LANDSCAPE_INVERTED: 4, - PORTRAIT_INVERTED: 3, - AUTO_ROTATION: 5, - AUTO_ROTATION_LANDSCAPE: 7, - AUTO_ROTATION_PORTRAIT: 6, - AUTO_ROTATION_RESTRICTED: 8, - AUTO_ROTATION_LANDSCAPE_RESTRICTED: 10, - AUTO_ROTATION_PORTRAIT_RESTRICTED: 9, - LOCKED: 11, - }, - launchMode: { - SINGLETON: 0, - STANDARD: 1, - }, - permissions: ['[PC Preview] unknow permissions'], - deviceTypes: ['[PC Preview] unknow deviceTypes'], - deviceCapabilities: ['[PC Preview] unknow deviceCapabilities'], + type: AbilityType, + subType: AbilitySubType, + orientation: DisplayOrientation, + launchMode: LaunchMode, + permissions: [paramMock.paramStringMock], + deviceTypes: [paramMock.paramStringMock], + deviceCapabilities: [paramMock.paramNumberMock], readPermission: '[PC Preview] unknow readPermission', writePermission: '[PC Preview] unknow writePermission', appId: '[PC Preview] unknow appId', label: "[PC preview] unknown label", description: "[PC preview] unknown description", + icon: "[PC preview] unknown icon", + labelId: "[PC preview] unknown labelId", + iconId: "[PC preview] unknown iconId", uid: '[PC Preview] unknow uid', installTime: '[PC Preview] unknow installTime', updateTime: '[PC Preview] unknow updateTime', descriptionId: '[PC Preview] unknow descriptionId', - applicationInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - enabled: "[PC preview] unknown enabled", - systemApp: "[PC preview] unknown systemApp", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - sourceDir: "[PC preview] unknown sourceDir", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - entryDir: ["[PC preview] unknown entryDir"], - codePath: ["[PC preview] unknown codePath"], - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: "[PC preview] unknown iconResource", - labelResource: "[PC preview] unknown labelResource", - descriptionResource: "[PC preview] unknown descriptionResource", - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - supportedModes: "[PC preview] unknown supportedModes", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], + applicationInfo: ApplicationInfo, + metaData: [CustomizeData], + uri: "[PC preview] unknown uri", + metadata: [Metadata], enabled: "[PC preview] unknown enabled", - supportWindowMode: [{ - FULL_SCREEN: 0, - SPLIT: 1, - FLOATING: 2, - }], + supportWindowMode: [SupportWindowMode], maxWindowRatio: "[PC preview] unknown maxWindowRatio", minWindowRatio: "[PC preview] unknown minWindowRatio", maxWindowWidth: "[PC preview] unknown maxWindowWidth", @@ -144,5 +65,4 @@ export const AbilityInfoMock = { defaultFormHeight: "[PC preview] unknown defaultFormHeight", minFormWidth: "[PC preview] unknown minFormWidth", defaultFormWidth: "[PC preview] unknown defaultFormWidth", - uri: "[PC preview] unknown uri", } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js b/runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js old mode 100644 new mode 100755 index cd6b17a1..a2b65f88 --- a/runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js @@ -13,7 +13,13 @@ * limitations under the License. */ -export const ApplicationInfoMock = { +import { paramMock } from "../../utils" +import { ModuleInfo } from './moduleInfo'; +import { CustomizeData } from './customizeData'; +import { Metadata } from './metadata'; +import { Resource } from './../global/resource'; + +export const ApplicationInfo = { name: "[PC preview] unknown name", description: "[PC preview] unknown description", descriptionId: "[PC preview] unknown descriptionId", @@ -25,51 +31,26 @@ export const ApplicationInfoMock = { iconId: "[PC preview] unknown iconId", process: "[PC preview] unknown process", supportedModes: "[PC preview] unknown supportedModes", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - moduleInfos: [ - { - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - } - ], + moduleSourceDirs: [paramMock.paramNumberMock], + permissions: [paramMock.paramNumberMock], + moduleInfos: [ModuleInfo], entryDir: "[PC preview] unknown entryDir", codePath: "[PC preview] unknown codePath", - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], + metaData: [CustomizeData], + metadata: [Metadata], removable: "[PC preview] unknown removable", accessTokenId: "[PC preview] unknown accessTokenId", uid: "[PC preview] unknown uid", entityType: "[PC preview] unknown entityType", fingerprint: "[PC preview] unknown fingerprint", - iconResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id" - }, - labelResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id" - }, - descriptionResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id" - }, + iconResource: Resource, + labelResource: Resource, + descriptionResource: Resource, appDistributionType: "[PC preview] unknown appDistributionType", appProvisionType: "[PC preview] unknown appProvisionType", } -export const WantMock = { +export const Want = { deviceId: "[PC Preview] unknow deviceId", bundleName: "[PC Preview] unknow bundleName", abilityName: "[PC Preview] unknow abilityName", @@ -77,44 +58,7 @@ export const WantMock = { type: "[PC Preview] unknow type", flag: "[PC Preview] unknow flag", action: "[PC Preview] unknow action", - parameters: ["[PC Preview] unknow parameters"], - entities: ["[PC Preview] unknow entities"], + parameters: [paramMock.paramStringMock], + entities: [paramMock.paramStringMock], moduleName: "[PC Preview] unknow moduleName", -} - -export const ShortcutInfoMock = { - id: "[PC preview] unknown id", - bundleName: "[PC preview] unknown bundleName", - hostAbility: "[PC preview] unknown hostAbility", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - disableMessage: "[PC preview] unknown disableMessage", - wants: [ - { - targetBundle: "[PC preview] unknown targetBundle", - targetModule: "[PC preview] unknown targetModule", - targetClass: "[PC preview] unknown targetClass", - }], - isStatic: "[PC preview] unknown isStatic", - isHomeShortcut: "[PC preview] unknown isHomeShortcut", - isEnabled: "[PC preview] unknown isEnabled", - moduleName: "[PC preview] unknown moduleName", -} - -export const ModuleUsageRecordMock = { - bundleName: "[PC preview] unknown bundleName", - appLabelId: "[PC preview] unknown appLabelId", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown labelId", - descriptionId: "[PC preview] unknown descriptionId", - abilityName: "[PC preview] unknown abilityName", - abilityLabelId: "[PC preview] unknown abilityLabelId", - abilityDescriptionId: "[PC preview] unknown abilityDescriptionId", - abilityIconId: "[PC preview] unknown abilityIconId", - launchedCount: "[PC preview] unknown launchedCount", - lastLaunchTime: "[PC preview] unknown lastLaunchTime", - isRemoved: "[PC preview] unknown isRemoved", - installationFreeSupported: "[PC preview] unknown installationFreeSupported", } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js b/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js old mode 100644 new mode 100755 index ab73c42a..68793e40 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js @@ -13,699 +13,53 @@ * limitations under the License. */ -export const BundleInfoMock = { +import { paramMock } from "../../utils" +import { AbilityInfo } from './abilityInfo'; +import { ApplicationInfo } from './applicationInfo'; +import { ExtensionAbilityInfo } from './extensionAbilityInfo'; +import { HapModuleInfo } from './hapModuleInfo'; + +export const UsedScene = { + abilities: [paramMock.paramStringMock], + when: "[PC preview] unknown when", +} + +export const ReqPermissionDetail = { + name: "[PC preview] unknown name", + reason: "[PC preview] unknown reason", + reasonId: "[PC preview] unknown reasonId", + usedScene: UsedScene, +} + +export const BundleInfo = { name: "[PC preview] unknown name", type: "[PC preview] unknown type", appId: "[PC preview] unknown appId", uid: "[PC preview] unknown uid", installTime: "[PC preview] unknown installTime", updateTime: "[PC preview] unknown updateTime", - appInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - systemApp: "[PC preview] unknown systemApp", - enabled: "[PC preview] unknown enabled", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown labelId", - label: "[PC preview] unknown label", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - supportedModes: "[PC preview] unknown supportedModes", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - sourceDir: "[PC preview] unknown sourceDir", - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - flags: "[PC preview] unknown flags", - entryDir: "[PC preview] unknown entryDir", - codePath: "[PC preview] unknown codePath", - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - labelResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - descriptionResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - abilityInfo: [ - { - name: "[PC preview] unknown name", - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown targetAbility", - backgroundModes: "[PC preview] unknown backgroundModes", - isVisible: "[PC preview] unknown isVisible", - formEnabled: "[PC preview] unknown formEnabled", - type: { - UNKNOWN: 0, - PAGE: 2, - SERVICE: 3, - DATA: 4, - }, - subType: { - UNSPECIFIED: 0, - CA: 1, - }, - orientation: { - UNSPECIFIED: 0, - LANDSCAPE: 2, - PORTRAIT: 1, - FOLLOW_RECENT: 2, - LANDSCAPE_INVERTED: 4, - PORTRAIT_INVERTED: 3, - AUTO_ROTATION: 5, - AUTO_ROTATION_LANDSCAPE: 7, - AUTO_ROTATION_PORTRAIT: 6, - AUTO_ROTATION_RESTRICTED: 8, - AUTO_ROTATION_LANDSCAPE_RESTRICTED: 10, - AUTO_ROTATION_PORTRAIT_RESTRICTED: 9, - LOCKED: 11, - }, - launchMode: { - SINGLETON: 0, - STANDARD: 1, - }, - permissions: ['[PC Preview] unknow permissions'], - deviceTypes: ['[PC Preview] unknow deviceTypes'], - deviceCapabilities: ['[PC Preview] unknow deviceCapabilities'], - readPermission: '[PC Preview] unknow readPermission', - writePermission: '[PC Preview] unknow writePermission', - appId: '[PC Preview] unknow appId', - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - uid: '[PC Preview] unknow uid', - installTime: '[PC Preview] unknow installTime', - updateTime: '[PC Preview] unknow updateTime', - descriptionId: '[PC Preview] unknow descriptionId', - applicationInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - enabled: "[PC preview] unknown enabled", - systemApp: "[PC preview] unknown systemApp", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - sourceDir: "[PC preview] unknown sourceDir", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - entryDir: ["[PC preview] unknown entryDir"], - codePath: ["[PC preview] unknown codePath"], - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: "[PC preview] unknown iconResource", - labelResource: "[PC preview] unknown labelResource", - descriptionResource: "[PC preview] unknown descriptionResource", - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - supportedModes: "[PC preview] unknown supportedModes", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - enabled: "[PC preview] unknown enabled", - supportWindowMode: [{ - FULL_SCREEN: 0, - SPLIT: 1, - FLOATING: 2, - }], - maxWindowRatio: "[PC preview] unknown maxWindowRatio", - minWindowRatio: "[PC preview] unknown minWindowRatio", - maxWindowWidth: "[PC preview] unknown maxWindowWidth", - minWindowWidth: "[PC preview] unknown minWindowWidth", - maxWindowHeight: "[PC preview] unknown maxWindowHeight", - minWindowHeight: "[PC preview] unknown minWindowHeight", - formEntity: "[PC preview] unknown formEntity", - minFormHeight: "[PC preview] unknown minFormHeight", - defaultFormHeight: "[PC preview] unknown defaultFormHeight", - minFormWidth: "[PC preview] unknown minFormWidth", - defaultFormWidth: "[PC preview] unknown defaultFormWidth", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - reqPermissions: ["[PC preview] unknown repermission"], - reqPermissionDetails: [ - { - name: "[PC preview] unknown name", - reason: "[PC preview] unknown reason", - reasonId: "[PC preview] unknown reasonId", - usedScene: { - abilities: ["[PC preview] unknown ability"], - when: "[PC preview] unknown when", - } - } - ], + appInfo: ApplicationInfo, + abilityInfos: [AbilityInfo], + reqPermissions: [paramMock.paramStringMock], + reqPermissionDetails: [ReqPermissionDetail], vendor: "[PC preview] unknown vendor", versionCode: "[PC preview] unknown versionCode", versionName: "[PC preview] unknown versionName", compatibleVersion: "[PC preview] unknown compatibleVersion", targetVersion: "[PC preview] unknown targetVersion", isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs", - hapModuleInfos: [{ - name: "[PC preview] unknown name", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - iconId: "[PC preview] unknown iconId", - backgroundImg: "[PC preview] unknown backgroundImg", - supportedModes: "[PC preview] unknown supportedModes", - reqCapabilities: ["[PC preview] unknown reqCapabilities"], - deviceTypes: ["[PC preview] unknown deviceTypes"], - abilityInfo: [ - { - name: "[PC preview] unknown name", - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown targetAbility", - backgroundModes: "[PC preview] unknown backgroundModes", - isVisible: "[PC preview] unknown isVisible", - formEnabled: "[PC preview] unknown formEnabled", - type: { - UNKNOWN: 0, - PAGE: 2, - SERVICE: 3, - DATA: 4, - }, - subType: { - UNSPECIFIED: 0, - CA: 1, - }, - orientation: { - UNSPECIFIED: 0, - LANDSCAPE: 2, - PORTRAIT: 1, - FOLLOW_RECENT: 2, - LANDSCAPE_INVERTED: 4, - PORTRAIT_INVERTED: 3, - AUTO_ROTATION: 5, - AUTO_ROTATION_LANDSCAPE: 7, - AUTO_ROTATION_PORTRAIT: 6, - AUTO_ROTATION_RESTRICTED: 8, - AUTO_ROTATION_LANDSCAPE_RESTRICTED: 10, - AUTO_ROTATION_PORTRAIT_RESTRICTED: 9, - LOCKED: 11, - }, - launchMode: { - SINGLETON: 0, - STANDARD: 1, - }, - permissions: ['[PC Preview] unknow permissions'], - deviceTypes: ['[PC Preview] unknow deviceTypes'], - deviceCapabilities: ['[PC Preview] unknow deviceCapabilities'], - readPermission: '[PC Preview] unknow readPermission', - writePermission: '[PC Preview] unknow writePermission', - appId: '[PC Preview] unknow appId', - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - uid: '[PC Preview] unknow uid', - installTime: '[PC Preview] unknow installTime', - updateTime: '[PC Preview] unknow updateTime', - descriptionId: '[PC Preview] unknow descriptionId', - applicationInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - enabled: "[PC preview] unknown enabled", - systemApp: "[PC preview] unknown systemApp", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - sourceDir: "[PC preview] unknown sourceDir", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - entryDir: ["[PC preview] unknown entryDir"], - codePath: ["[PC preview] unknown codePath"], - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: "[PC preview] unknown iconResource", - labelResource: "[PC preview] unknown labelResource", - descriptionResource: "[PC preview] unknown descriptionResource", - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - supportedModes: "[PC preview] unknown supportedModes", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - enabled: "[PC preview] unknown enabled", - supportWindowMode: [{ - FULL_SCREEN: 0, - SPLIT: 1, - FLOATING: 2, - }], - maxWindowRatio: "[PC preview] unknown maxWindowRatio", - minWindowRatio: "[PC preview] unknown minWindowRatio", - maxWindowWidth: "[PC preview] unknown maxWindowWidth", - minWindowWidth: "[PC preview] unknown minWindowWidth", - maxWindowHeight: "[PC preview] unknown maxWindowHeight", - minWindowHeight: "[PC preview] unknown minWindowHeight", - formEntity: "[PC preview] unknown formEntity", - minFormHeight: "[PC preview] unknown minFormHeight", - defaultFormHeight: "[PC preview] unknown defaultFormHeight", - minFormWidth: "[PC preview] unknown minFormWidth", - defaultFormWidth: "[PC preview] unknown defaultFormWidth", - uri: "[PC preview] unknown uri", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - moduleName: "[PC preview] unknown moduleName", - mainAbilityName: "[PC preview] unknown mainAbilityName", - installationFree: "[PC preview] unknown installationFree", - mainElementName: "[PC preview] unknown mainElementName", - extensionAbilityInfo: [ - { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown labelId", - descriptionId: "[PC preview] unknown descriptionId", - iconId: "[PC preview] unknown iconId", - isVisible: "[PC preview] unknown isVisible", - extensionAbilityType: { - FORM: 0, - WORK_SCHEDULER: 1, - INPUT_METHOD: 2, - SERVICE: 3, - ACCESSIBILITY: 4, - DATA_SHARE: 5, - FILE_SHARE: 6, - STATIC_SUBSCRIBER: 7, - WALLPAPER: 8, - BACKUP: 9, - WINDOW: 10, - ENTERPRISE_ADMIN: 11, - UNSPECIFIED: 20, - }, - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - hashValue: "[PC preview] unknown hashValue", - } - ], - metadata: "[PC preview] unknown mainElementName", - hashValue: "[PC preview] unknown hashValue", - }], - hapModuleInfo: [ - { - name: "string", - description: "string", - descriptionId: 1, - icon: "string", - label: "string", - labelId: 2, - iconId: 3, - backgroundImg: "string", - supportedModes: 4, - reqCapabilities: ["1", "2"], - deviceTypes: ["1", "2"], - abilityInfo: [ - { - bundleName: "string", - name: "string", - label: "string", - description: "string", - icon: "string", - labelId: 1, - descriptionId: 2, - iconId: 3, - moduleName: "string", - process: "string", - targetAbility: "string", - backgroundModes: 4, - isVisible: true, - formEnabled: true, - type: "bundle.AbilityType", - subType: "bundle.AbilitySubType", - orientation: "bundle.DisplayOrientation", - launchMode: "bundle.LaunchMode", - permissions: ["1"], - deviceTypes: ["2"], - deviceCapabilities: ["3"], - readPermission: "string", - writePermission: "string", - applicationInfo: { - packageName: "[PC preview] unknown packageName", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - labelId: 2, - iconId: 3, - sourceDir: "[PC preview] unknown sourceDir", - flags: 1, - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: 5, - minFormHeight: 6, - defaultFormHeight: 7, - minFormWidth: 8, - defaultFormWidth: 9, - uri: "string", - customizeData: { - key: "[PC preview] unknown key", - value: [ - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - }, - { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - }, - } - ] - }, - } - ], - moduleName: "string", - mainAbilityName: "string", - installationFree: true, - } - ], - entryModuleName: "string", - cpuAbi: "string", - isSilentInstallation: "string", - minCompatibleVersionCode: 7, - entryInstallationFree: true, - reqPermissionStates: ["[PC preview] unknown reqPermissionStates"], - extensionAbilityInfo: [{ - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown labelId", - descriptionId: "[PC preview] unknown descriptionId", - iconId: "[PC preview] unknown iconId", - isVisible: "[PC preview] unknown isVisible", - extensionAbilityType: { - FORM: 0, - WORK_SCHEDULER: 1, - INPUT_METHOD: 2, - SERVICE: 3, - ACCESSIBILITY: 4, - DATA_SHARE: 5, - FILE_SHARE: 6, - STATIC_SUBSCRIBER: 7, - WALLPAPER: 8, - BACKUP: 9, - WINDOW: 10, - ENTERPRISE_ADMIN: 11, - UNSPECIFIED: 20, - }, - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - permissions: ["[PC preview] unknown hashValue"], - applicationInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - enabled: "[PC preview] unknown enabled", - systemApp: "[PC preview] unknown systemApp", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown labelId", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - entryDir: ["[PC preview] unknown entryDir"], - codePath: ["[PC preview] unknown codePath"], - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: "[PC preview] unknown iconResource", - labelResource: "[PC preview] unknown labelResource", - descriptionResource: "[PC preview] unknown descriptionResource", - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - supportedModes: "[PC preview] unknown supportedModes", - }, - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - enabled: "[PC preview] unknown enabled", - readPermission: "[PC preview] unknown readPermission", - writePermission: "[PC preview] unknown writePermission", - }], + hapModuleInfos: [HapModuleInfo], + entryModuleName: "[PC preview] unknown entryModuleName", + cpuAbi: "[PC preview] unknown cpuAbi", + isSilentInstallation: "[PC preview] unknown isSilentInstallation", + minCompatibleVersionCode: "[PC preview] unknown minCompatibleVersionCode", + entryInstallationFree: "[PC preview] unknown entryInstallationFree", + reqPermissionStates: [paramMock.paramStringMock], + extensionAbilityInfo: [ExtensionAbilityInfo], }; -export const BundlePackInfo = { - packages: [{ - deviceType: ["[PC preview] unknown deviceType"], - name: "[PC preview] unknown name", - moduleType: "[PC preview] unknown moduleType", - deliveryWithInstall: "[PC preview] unknown deliveryWithInstall", - }], - summary: { - app: { - bundleName: "[PC preview] unknown bundleName", - version: { - minCompatibleVersionCode: "[PC preview] unknown minCompatibleVersionCode", - name: "[PC preview] unknown name", - code: "[PC preview] unknown code", - }, - }, - modules: [ - { - apiVersion: { - releaseType: "[PC preview] unknown releaseType", - compatible: "[PC preview] unknown compatible", - target: "[PC preview] unknown target", - }, - deviceType: ["[PC preview] unknown deviceType"], - distro: { - mainAbility: "[PC preview] unknown mainAbility", - deliveryWithInstall: "[PC preview] unknown deliveryWithInstall", - installationFree: "[PC preview] unknown installationFree", - moduleName: "[PC preview] unknown moduleName", - moduleType: "[PC preview] unknown moduleType", - }, - abilities: [ - { - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - visible: "[PC preview] unknown visible", - forms: [ - { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - updateEnabled: "[PC preview] unknown updateEnabled", - scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime", - updateDuration: "[PC preview] unknown updateDuration", - supportDimensions: ["[PC preview] unknown supportDimensions"], - defaultDimension: "[PC preview] unknown defaultDimension", - } - ], - - } - ], - extensionAbilities: [ - { - name: "[PC preview] unknown name", - forms: [ - { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - updateEnabled: "[PC preview] unknown updateEnabled", - scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime", - updateDuration: "[PC preview] unknown updateDuration", - supportDimensions: ["[PC preview] unknown supportDimensions"], - defaultDimension: "[PC preview] unknown defaultDimension", - } - ], - } - ] - } - ] - } -}; - -export const DispatchInfoMock = { - verison: "[PC preview] unknown verison", - dispatchAPI: "[PC preview] unknown dispatchAPI", +export const PixelMapFormat = { + UNKNOWN: 0, + RGB_565: 2, + RGBA_8888: 3, } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js b/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js new file mode 100755 index 00000000..d0c85129 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js @@ -0,0 +1,64 @@ +/* + * 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" +import { InstallErrorCode } from '../ohos_bundle.js' + +export const HashParam = { + moduleName: "[PC preview] unknown moduleName", + hashValue: "[PC preview] unknown hashValue", +} + +export const InstallParam = { + userId: "[PC preview] unknown userId", + installFlag: "[PC preview] unknown installFlag", + isKeepData: "[PC preview] unknown isKeepData", + hashParams: [HashParam], + crowdtestDeadline: "[PC preview] unknown crowdtestDeadline", +} + +export const InstallStatus = { + status: InstallErrorCode, + statusMessage: "[PC preview] unknown statusMessage", +} + +export const BundleInstaller = { + moduleName: "[PC preview] unknown moduleName", + hashValue: "[PC preview] unknown hashValue", +} + +export function mockBundleInstaller() { + const bundleInstaller = { + install: function(...args){ + console.warn("bundleInstaller.install 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; + args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus); + }, + uninstall: function(...args){ + console.warn("bundleInstaller.uninstall 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; + args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus); + }, + recover: function(...args){ + console.warn("bundleInstaller.recover 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; + args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus); + } + }; + return bundleInstaller; +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/bundleStatusCallback.js b/runtime/main/extend/systemplugin/napi/bundle/bundleStatusCallback.js new file mode 100755 index 00000000..2215a05f --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/bundleStatusCallback.js @@ -0,0 +1,32 @@ +/* + * 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. + */ + +export function mockBundleStatusCallback() { + const bundleStatusCallback = { + add: function(){ + console.warn("bundleStatusCallback.add interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + update: function(){ + console.warn("bundleStatusCallback.update interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + }, + remove: function(){ + console.warn("bundleStatusCallback.remove interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + } + }; + return bundleStatusCallback; +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/customizeData.js b/runtime/main/extend/systemplugin/napi/bundle/customizeData.js new file mode 100755 index 00000000..dce34591 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/customizeData.js @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export const CustomizeData = { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + extra: "[PC preview] unknown extra", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js b/runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js index 0e47ba4b..f66db7aa 100755 --- a/runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js +++ b/runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js @@ -13,7 +13,7 @@ * limitations under the License. */ -export const DefaultAppManagerMock = { +export const DefaultAppManager = { BROWSER: "[PC preview] unknown BROWSER", IMAGE: "[PC preview] unknown IMAGE", AUDIO: "[PC preview] unknown AUDIO", diff --git a/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js b/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js new file mode 100755 index 00000000..318aefb8 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export const DispatchInfo = { + version: "[PC preview] unknown version", + dispatchAPI: "[PC preview] unknown dispatchAPI", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/elementName.js b/runtime/main/extend/systemplugin/napi/bundle/elementName.js new file mode 100755 index 00000000..ffa0992a --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/elementName.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export const ElementName = { + deviceId: "[PC preview] unknown deviceId", + bundleName: "[PC preview] unknown bundleName", + abilityName: "[PC preview] unknown abilityName", + uri: "[PC preview] unknown uri", + shortName: "[PC preview] unknown shortName", + moduleName: "[PC preview] unknown moduleName", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/extensionAbilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/extensionAbilityInfo.js new file mode 100755 index 00000000..ebbb9f78 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/extensionAbilityInfo.js @@ -0,0 +1,37 @@ +/* + * 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" +import { ApplicationInfo } from './applicationInfo'; +import { Metadata } from './metadata' +import { ExtensionAbilityType } from "./../ohos_bundle" + + +export const ExtensionAbilityInfo = { + bundleName: "[PC preview] unknown bundleName", + moduleName: "[PC preview] unknown moduleName", + name: "[PC preview] unknown name", + labelId: "[PC preview] unknown labelId", + descriptionId: "[PC preview] unknown descriptionId", + iconId: "[PC preview] unknown iconId", + isVisible: "[PC preview] unknown isVisible", + extensionAbilityType: ExtensionAbilityType, + metadata: [Metadata], + permissions: [paramMock.paramStringMock], + applicationInfo: ApplicationInfo, + enabled: "[PC preview] unknown enabled", + readPermission: "[PC preview] unknown readPermission", + writePermission: "[PC preview] unknown writePermission", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js b/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js new file mode 100755 index 00000000..b3c2ee21 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js @@ -0,0 +1,42 @@ +/* + * 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" +import { AbilityInfo } from './abilityInfo'; +import { ExtensionAbilityInfo } from './extensionAbilityInfo'; +import { Metadata } from './metadata'; + + +export const HapModuleInfo = { + name: "[PC preview] unknown name", + description: "[PC preview] unknown description", + descriptionId: "[PC preview] unknown descriptionId", + icon: "[PC preview] unknown icon", + label: "[PC preview] unknown label", + labelId: "[PC preview] unknown labelId", + iconId: "[PC preview] unknown iconId", + backgroundImg: "[PC preview] unknown backgroundImg", + supportedModes: "[PC preview] unknown supportedModes", + reqCapabilities: [paramMock.paramStringMock], + deviceTypes: [paramMock.paramStringMock], + abilityInfo: [AbilityInfo], + moduleName: "[PC preview] unknown moduleName", + mainAbilityName: "[PC preview] unknown mainAbilityName", + installationFree: "[PC preview] unknown installationFree", + mainElementName: "[PC preview] unknown mainElementName", + extensionAbilityInfo: [ExtensionAbilityInfo], + metadata: [Metadata], + hashValue: "[PC preview] unknown hashValue", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js old mode 100644 new mode 100755 index 720915a6..830d0533 --- a/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js +++ b/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js @@ -13,72 +13,13 @@ * limitations under the License. */ -export const LauncherAbilityInfoMock = { - applicationInfo: { - packageName: "[PC preview] unknown packageName", - description: "[PC preview] unknown description", - descriptionId: "[PC preview] unknown descriptionId", - systemApp: "[PC preview] unknown systemApp", - enabled: "[PC preview] unknown enabled", - className: "[PC preview] unknown className", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown labelId", - label: "[PC preview] unknown label", - icon: "[PC preview] unknown icon", - iconId: "[PC preview] unknown iconId", - process: "[PC preview] unknown process", - supportedModes: "[PC preview] unknown supportedModes", - moduleSourceDirs: ["[PC preview] unknown moduleSourceDirs"], - permissions: ["[PC preview] unknown permissions"], - sourceDir: "[PC preview] unknown sourceDir", - moduleInfos: [{ - moduleName: "[PC preview] unknown moduleName", - moduleSourceDir: "[PC preview] unknown moduleSourceDir", - }], - flags: "[PC preview] unknown flags", - entryDir: "[PC preview] unknown entryDir", - codePath: "[PC preview] unknown codePath", - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - extra: "[PC preview] unknown extra", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown removable", - accessTokenId: "[PC preview] unknown accessTokenId", - uid: "[PC preview] unknown uid", - entityType: "[PC preview] unknown entityType", - fingerprint: "[PC preview] unknown fingerprint", - iconResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - labelResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - descriptionResource: { - bundleName: "[PC preview] unknown bundleName", - moduleName: "[PC preview] unknown moduleName", - id: "[PC preview] unknown id", - }, - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", - }, - elementName: { - deviceId: "[PC preview] unknown deviceId", - bundleName: "[PC preview] unknown bundleName", - abilityName: "[PC preview] unknown abilityName", - uri: "[PC preview] unknown uri", - shortName: "[PC preview] unknown shortName", - moduleName: "[PC preview] unknown moduleName", - }, +import { paramMock } from "../../utils" +import { ApplicationInfo } from './applicationInfo'; +import { ElementName } from './elementName' + +export const LauncherAbilityInfo = { + applicationInfo: ApplicationInfo, + elementName: ElementName, labelId: "[PC preview] unknown labelId", iconId: "[PC preview] unknown iconId", userId: "[PC preview] unknown userId", diff --git a/runtime/main/extend/systemplugin/napi/bundle/metadata.js b/runtime/main/extend/systemplugin/napi/bundle/metadata.js new file mode 100755 index 00000000..6157307c --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/metadata.js @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export const Metadata = { + name: "[PC preview] unknown name", + value: "[PC preview] unknown value", + resource: "[PC preview] unknown resource", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/moduleInfo.js b/runtime/main/extend/systemplugin/napi/bundle/moduleInfo.js new file mode 100755 index 00000000..4b0193f6 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/moduleInfo.js @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export const ModuleInfo = { + moduleName: "[PC preview] unknown moduleName", + moduleSourceDir: "[PC preview] unknown moduleSourceDir", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/packInfo.js b/runtime/main/extend/systemplugin/napi/bundle/packInfo.js new file mode 100755 index 00000000..fd6e7dc8 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/packInfo.js @@ -0,0 +1,95 @@ +/* + * 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 const PackageConfig = { + deviceType: [paramMock.paramStringMock], + name: "[PC preview] unknown name", + moduleType: "[PC preview] unknown moduleType", + deliveryWithInstall: "[PC preview] unknown deliveryWithInstall", +} + +export const ModuleDistroInfo = { + mainAbility: "[PC preview] unknown mainAbility", + deliveryWithInstall: "[PC preview] unknown deliveryWithInstall", + installationFree: "[PC preview] unknown installationFree", + moduleName: "[PC preview] unknown moduleName", + moduleType: "[PC preview] unknown moduleType", +} + +export const AbilityFormInfo = { + name: "[PC preview] unknown name", + type: "[PC preview] unknown type", + updateEnabled: "[PC preview] unknown updateEnabled", + scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime", + updateDuration: "[PC preview] unknown updateDuration", + supportDimensions: [paramMock.paramNumberMock], + defaultDimension: "[PC preview] unknown defaultDimension", +} + +export const ApiVersion = { + releaseType: "[PC preview] unknown releaseType", + compatible: "[PC preview] unknown compatible", + target: "[PC preview] unknown target", +} + +export const Version = { + minCompatibleVersionCode: "[PC preview] unknown minCompatibleVersionCode", + name: "[PC preview] unknown name", + code: "[PC preview] unknown code", +} + +export const ModuleAbilityInfo = { + name: "[PC preview] unknown name", + label: "[PC preview] unknown label", + visible: "[PC preview] unknown visible", + forms: [AbilityFormInfo], +} + +export const ExtensionAbilities = { + name: "[PC preview] unknown name", + forms: [AbilityFormInfo], +} + +export const ModuleConfigInfo = { + apiVersion: ApiVersion, + deviceType: [paramMock.paramStringMock], + distro: [paramMock.paramStringMock], + abilities: [ModuleAbilityInfo], + extensionAbilities: [ExtensionAbilities], +} + +export const BundleConfigInfo = { + bundleName: "[PC preview] unknown bundleName", + version: Version, +} + +export const PackageSummary = { + app: BundleConfigInfo, + modules: [ModuleConfigInfo] +} + +export const BundlePackFlag = { + GET_PACK_INFO_ALL: 0x00000000, + GET_PACKAGES: 0x00000001, + GET_BUNDLE_SUMMARY: 0x00000002, + GET_MODULE_SUMMARY: 0x00000004, +} + +export const BundlePackInfo = { + packages: [PackageConfig], + summary: PackageSummary +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/remoteAbilityInfo.js b/runtime/main/extend/systemplugin/napi/bundle/remoteAbilityInfo.js new file mode 100755 index 00000000..ab31d377 --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/remoteAbilityInfo.js @@ -0,0 +1,22 @@ +/* + * 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 { ElementName } from './elementName'; + +export const RemoteAbilityInfo = { + elementName: ElementName, + label: "[PC preview] unknown IMAGE", + icon: "[PC preview] unknown AUDIO", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/shortcutInfo.js b/runtime/main/extend/systemplugin/napi/bundle/shortcutInfo.js new file mode 100755 index 00000000..e90805ca --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/bundle/shortcutInfo.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +export const ShortcutWant = { + targetBundle: "[PC preview] unknown targetBundle", + targetModule: "[PC preview] unknown targetModule", + targetClass: "[PC preview] unknown targetClass", +} + +export const ShortcutInfo = { + id: "[PC preview] unknown id", + bundleName: "[PC preview] unknown bundleName", + hostAbility: "[PC preview] unknown hostAbility", + icon: "[PC preview] unknown icon", + iconId: "[PC preview] unknown iconId", + label: "[PC preview] unknown label", + labelId: "[PC preview] unknown labelId", + disableMessage: "[PC preview] unknown disableMessage", + wants: [ShortcutWant], + isStatic: "[PC preview] unknown isStatic", + isHomeShortcut: "[PC preview] unknown isHomeShortcut", + isEnabled: "[PC preview] unknown isEnabled", + moduleName: "[PC preview] unknown moduleName", +} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundle.js b/runtime/main/extend/systemplugin/napi/ohos_bundle.js old mode 100644 new mode 100755 index cba24dee..ec349ded --- a/runtime/main/extend/systemplugin/napi/ohos_bundle.js +++ b/runtime/main/extend/systemplugin/napi/ohos_bundle.js @@ -14,89 +14,149 @@ */ import { paramMock } from "../utils" -import { BundleInfoMock, BundlePackInfo, DispatchInfoMock } from './bundle/bundleInfo' -import { ApplicationInfoMock } from './bundle/applicationInfo' -import { WantMock } from './bundle/applicationInfo' +import { BundleInfo, PixelMapFormat } from './bundle/bundleInfo' +import { BundlePackInfo } from './bundle/packInfo' +import { DispatchInfo } from './bundle/dispatchInfo' +import { ApplicationInfo, Want} from './bundle/applicationInfo' +import { AbilityInfo } from './bundle/abilityInfo' +import { PermissionDef } from './bundle/PermissionDef' +import { ExtensionAbilityInfo } from './bundle/extensionAbilityInfo' + +export const BundleFlag = { + GET_BUNDLE_DEFAULT: 0x00000000, + GET_BUNDLE_WITH_ABILITIES: 0x00000001, + GET_ABILITY_INFO_WITH_PERMISSION: 0x00000002, + GET_ABILITY_INFO_WITH_APPLICATION: 0x00000004, + GET_APPLICATION_INFO_WITH_PERMISSION: 0x00000008, + GET_BUNDLE_WITH_REQUESTED_PERMISSION: 0x00000010, + GET_ALL_APPLICATION_INFO: 0xFFFF0000, + GET_ABILITY_INFO_WITH_METADATA: 0x00000020, + GET_BUNDLE_WITH_EXTENSION_ABILITY: 0x00000020, + GET_BUNDLE_WITH_HASH_VALUE: 0x00000030, + GET_APPLICATION_INFO_WITH_METADATA: 0x00000040, + GET_ABILITY_INFO_SYSTEMAPP_ONLY: 0x00000080, + GET_ABILITY_INFO_WITH_DISABLE: 0x00000100, + GET_APPLICATION_INFO_WITH_DISABLE: 0x00000200, + GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT: 0x00000400, +} + +export const ExtensionFlag = { + GET_EXTENSION_INFO_DEFAULT: 0x00000000, + GET_EXTENSION_INFO_WITH_PERMISSION: 0x00000002, + GET_EXTENSION_INFO_WITH_APPLICATION: 0x00000004, + GET_EXTENSION_INFO_WITH_METADATA: 0x00000020, +} + +export const ColorMode = { + AUTO_MODE: -1, + DARK_MODE: 0, + LIGHT_MODE: 1, +} + +export const GrantStatus = { + PERMISSION_DENIED: -1, + PERMISSION_GRANTED: 0, +} + +export const AbilityType = { + UNKNOWN: 0, + PAGE: 1, + SERVICE: 2, + DATA: 3, +} + +export const AbilitySubType = { + UNSPECIFIED: 0, + CA: 1, +} + +export const DisplayOrientation = { + UNSPECIFIED: 0, + LANDSCAPE: 0, + PORTRAIT: 1, + FOLLOW_RECENT: 2, + LANDSCAPE_INVERTED: 3, + PORTRAIT_INVERTED: 4, + AUTO_ROTATION: 5, + AUTO_ROTATION_LANDSCAPE: 6, + AUTO_ROTATION_PORTRAIT: 7, + AUTO_ROTATION_RESTRICTED: 8, + AUTO_ROTATION_LANDSCAPE_RESTRICTED: 9, + AUTO_ROTATION_PORTRAIT_RESTRICTED: 10, + LOCKED: 11, +} + +export const LaunchMode = { + SINGLETON: 0, + STANDARD: 1, +} + +export const ExtensionAbilityType = { + FORM: 0, + WORK_SCHEDULER: 1, + INPUT_METHOD: 2, + SERVICE: 3, + ACCESSIBILITY: 4, + DATA_SHARE: 5, + FILE_SHARE: 6, + STATIC_SUBSCRIBER: 7, + WALLPAPER: 8, + BACKUP: 9, + WINDOW: 10, + ENTERPRISE_ADMIN: 11, + UNSPECIFIED: 20, +} + +export const BundleOptions = { + userId: "[PC preview] unknown userId", +} + +export const InstallErrorCode = { + SUCCESS: 0, + STATUS_INSTALL_FAILURE: 1, + STATUS_INSTALL_FAILURE_ABORTED: 2, + STATUS_INSTALL_FAILURE_INVALID: 3, + STATUS_INSTALL_FAILURE_CONFLICT: 4, + STATUS_INSTALL_FAILURE_STORAGE: 5, + STATUS_INSTALL_FAILURE_INCOMPATIBLE: 6, + STATUS_UNINSTALL_FAILURE: 7, + STATUS_UNINSTALL_FAILURE_BLOCKED: 8, + STATUS_UNINSTALL_FAILURE_ABORTED: 9, + STATUS_UNINSTALL_FAILURE_CONFLICT: 10, + STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT: 0x0B, + STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED: 0x0C, + STATUS_RECOVER_FAILURE_INVALID: 0x0D, + STATUS_ABILITY_NOT_FOUND: 0x40, + STATUS_BMS_SERVICE_ERROR: 0x41, + STATUS_FAILED_NO_SPACE_LEFT: 0x42, + STATUS_GRANT_REQUEST_PERMISSIONS_FAILED: 0x43, + STATUS_INSTALL_PERMISSION_DENIED: 0x44, + STATUS_UNINSTALL_PERMISSION_DENIED: 0x45, +} + +export const UpgradeFlag = { + NOT_UPGRADE: 0, + SINGLE_UPGRADE: 1, + RELATION_UPGRADE: 2, +} + +export const SupportWindowMode = { + FULL_SCREEN: 0, + SPLIT: 1, + FLOATING: 2, +} export function mockBundle() { - const extensionAbilityType = { - FORM: 0, - WORK_SCHEDULER: 1, - INPUT_METHOD: 2, - SERVICE: 3, - ACCESSIBILITY: 4, - DATA_SHARE: 5, - FILE_SHARE: 6, - STATIC_SUBSCRIBER: 7, - WALLPAPER: 8, - BACKUP: 9, - WINDOW: 10, - UNSPECIFIED: 20, - } - - const ExtensionAbilityInfoMock = [ - { - bundleName: "[PC preview] unknown bundle name", - moduleName: "[PC preview] unknown module name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - isVisible: "[PC preview] unknown is visible", - extensionAbilityType: extensionAbilityType, - permissions: ["[PC preview] unknown permissions"], - applicationInfo: { - name: "[PC preview] unknown is name", - description: "[PC preview] unknown is description", - descriptionId: "[PC preview] unknown is descriptionId", - systemApp: "[PC preview] unknown is systemApp", - enabled: "[PC preview] unknown is enabled", - labelId: "[PC preview] unknown is labelId", - icon: "[PC preview] unknown is icon", - iconId: "[PC preview] unknown is iconId", - process: "[PC preview] unknown is process", - supportedModes: "[PC preview] unknown is supportedModes", - moduleSourceDirs: "[PC preview] unknown is moduleSourceDirs", - permissions: ["[PC preview] unknown is permissions"], - moduleInfos: ["[PC preview] unknown is moduleSourceDirs"], - entryDir: "[PC preview] unknown is entryDir", - metaData: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - removable: "[PC preview] unknown is removable", - accessTokenId: "[PC preview] unknown is accessTokenId", - uid: "[PC preview] unknown is uid", - entityType: "[PC preview] unknown is entityType", - fingerprint: "[PC preview] unknown is fingerprint", - }, - metadata: [{ - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - resource: "[PC preview] unknown resource", - }], - enabled: "[PC preview] unknown enabled", - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - } - ] - const bundle = { getBundleInfo: function(...args) { console.warn("bundle.getBundleInfo 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 (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock); + args[len - 1].call(this, paramMock.businessErrorMock, BundleInfo); } else { return new Promise((resolve) => { - resolve(BundleInfoMock); + resolve(BundleInfo); }) } }, @@ -117,10 +177,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfoMock); + args[len - 1].call(this, paramMock.businessErrorMock, ApplicationInfo); } else { return new Promise((resolve) => { - resolve(ApplicationInfoMock); + resolve(ApplicationInfo); }) } }, @@ -129,10 +189,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfoMock)); + args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfo)); } else { return new Promise((resolve) => { - resolve(Array(BundleInfoMock)); + resolve(Array(BundleInfo)); }) } }, @@ -141,10 +201,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfoMock)); + args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfo)); } else { return new Promise((resolve) => { - resolve(Array(BundleInfoMock)); + resolve(Array(BundleInfo)); }) } }, @@ -153,10 +213,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Array(ApplicationInfoMock)); + args[len - 1].call(this, paramMock.businessErrorMock, Array(ApplicationInfo)); } else { return new Promise((resolve) => { - resolve(Array(ApplicationInfoMock)); + resolve(Array(ApplicationInfo)); }) } }, @@ -165,10 +225,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfoMock)); + args[len - 1].call(this, paramMock.businessErrorMock, Array(BundleInfo)); } else { return new Promise((resolve) => { - resolve(Array(BundleInfoMock)); + resolve(Array(BundleInfo)); }) } }, @@ -177,10 +237,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, Array(WantMock)); + args[len - 1].call(this, paramMock.businessErrorMock, Array(Want)); } else { return new Promise((resolve) => { - resolve(Array(WantMock)); + resolve(Array(Want)); }) } }, @@ -273,10 +333,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { - args[len - 1].call(this,paramMock.businessErrorMock, Array(ExtensionAbilityInfoMock)) + args[len - 1].call(this,paramMock.businessErrorMock, Array(ExtensionAbilityInfo)) } else { return new Promise((resolve) => { - resolve(Array(ExtensionAbilityInfoMock)) + resolve(Array(ExtensionAbilityInfo)) }); } }, @@ -297,10 +357,10 @@ export function mockBundle() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, DispatchInfoMock); + args[len - 1].call(this, paramMock.businessErrorMock, DispatchInfo); } else { return new Promise((resolve) => { - resolve(DispatchInfoMock); + resolve(DispatchInfo); }) } }, @@ -328,6 +388,90 @@ export function mockBundle() { }); } }, + isAbilityEnabled: function(...args) { + console.warn("bundle.isAbilityEnabled 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + isApplicationEnabled: function(...args) { + console.warn("bundle.isApplicationEnabled 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + getAbilityIcon: function(...args) { + console.warn("bundle.getAbilityIcon 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PixelMapFormat); + } else { + return new Promise((resolve) => { + resolve(PixelMapFormat); + }) + } + }, + getAbilityLabel: function(...args) { + console.warn("bundle.getAbilityLabel 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getPermissionDef: function(...args) { + console.warn("bundle.getPermissionDef 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, PermissionDef); + } else { + return new Promise((resolve) => { + resolve(PermissionDef); + }) + } + }, + getNameForUid: function(...args) { + console.warn("bundle.getNameForUid 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock); + }) + } + }, + getAbilityInfo: function(...args) { + console.warn("bundle.getAbilityInfo 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 (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfo); + } else { + return new Promise((resolve) => { + resolve(AbilityInfo); + }) + } + }, }; return bundle; } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js b/runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js index d5487114..6d35a272 100755 --- a/runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js @@ -14,7 +14,18 @@ */ import { paramMock } from "../utils" -import { BundleInfoMock } from './bundle/bundleInfo' +import { BundleInfo } from './bundle/bundleInfo' + +export const ApplicationType = { + BROWSER: "BROWSER", + IMAGE: "IMAGE", + AUDIO: "AUDIO", + VIDEO: "VIDEO", + PDF: "PDF", + WORD: "WORD", + EXCEL: "EXCEL", + PPT: "PPT", + }; export function mockDefaultAppManager() { const defaultAppManager = { @@ -35,10 +46,10 @@ export function mockDefaultAppManager() { " Previewer may be different from that on a real device.") const len = args.length; if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BundleInfoMock); + args[len - 1].call(this, paramMock.businessErrorMock, BundleInfo); } else { return new Promise((resolve) => { - resolve(BundleInfoMock); + resolve(BundleInfo); }) } }, diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js b/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js index 8487432b..18976b25 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js @@ -14,8 +14,8 @@ */ import { paramMock } from "../utils" -import { ShortcutInfoMock } from './bundle/applicationInfo' -import { LauncherAbilityInfoMock } from './bundle/launcherAbilityInfo' +import { ShortcutInfo } from './bundle/shortcutInfo' +import { LauncherAbilityInfo } from './bundle/launcherAbilityInfo' export function mockInnerBundle() { const innerBundleManager = { diff --git a/runtime/main/extend/systemplugin/napi/ohos_zlib.js b/runtime/main/extend/systemplugin/napi/ohos_zlib.js old mode 100644 new mode 100755 index 0caab86f..d0a632c1 --- a/runtime/main/extend/systemplugin/napi/ohos_zlib.js +++ b/runtime/main/extend/systemplugin/napi/ohos_zlib.js @@ -13,51 +13,52 @@ * limitations under the License. */ export const MemLevel = { - MEM_LEVEL_MIN: 1, - MEM_LEVEL_MAX: 9, - MEM_LEVEL_DEFAULT: 8 + MEM_LEVEL_MIN: 1, + MEM_LEVEL_MAX: 9, + MEM_LEVEL_DEFAULT: 8 }; export const ErrorCode = { - ERROR_CODE_OK: 0, - ERROR_CODE_ERRND: -1, + ERROR_CODE_OK: 0, + ERROR_CODE_ERRNO: -1, }; export const CompressLevel = { - COMPRESS_LEVEL_NO_COMPRESSION: 0, - COMPRESS_LEVEL_BEST_SPEED: 1, - COMPRESS_LEVEL_BEST_COMPRESSION: 9, - COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1 + COMPRESS_LEVEL_NO_COMPRESSION: 0, + COMPRESS_LEVEL_BEST_SPEED: 1, + COMPRESS_LEVEL_BEST_COMPRESSION: 9, + COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1 }; export const CompressStrategy = { - COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0, - COMPRESS_STRATEGY_FILTERED: 1, - COMPRESS_STRATEGY_HUFFMAN_ONLY: 2, - COMPRESS_STRATEGY_RLE: 3, - COMPRESS_STRATEGY_FIXED: 4 + COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0, + COMPRESS_STRATEGY_FILTERED: 1, + COMPRESS_STRATEGY_HUFFMAN_ONLY: 2, + COMPRESS_STRATEGY_RLE: 3, + COMPRESS_STRATEGY_FIXED: 4 }; -export function mockZlib() { - const zlib = { - ErrorCode, - MemLevel, - CompressLevel, - CompressStrategy, - Options: { - level: CompressLevel, - memLevel: MemLevel, - strategy: CompressStrategy, - }, - zipFile(...args) { - console.warn("zlib.zipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.") - return new Promise((resolve, reject) => { - resolve() - }) - }, +export const Options = { + level: CompressLevel, + memLevel: MemLevel, + strategy: CompressStrategy, +}; +export function mockZlib() { + const zlib = { + ErrorCode, + MemLevel, + CompressLevel, + CompressStrategy, + Options, + zipFile: function(...args) { + console.warn("zlib.zipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.") + return new Promise((resolve) => { + resolve(); + }) + }, - unzipFile(...args) { - console.warn("zlib.unzipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.") - return new Promise((resolve, reject) => { - resolve() - }) + unzipFile: function(...args) { + console.warn("zlib.unzipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.") + return new Promise((resolve) => { + resolve(); + }) + } } - } - return zlib; + return zlib; } \ No newline at end of file