From 420548dddc6f03460363af148a1b49a95ec13b79 Mon Sep 17 00:00:00 2001 From: hwx1119949 Date: Thu, 17 Oct 2024 14:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=A2=84=E8=A7=88=E6=89=8B?= =?UTF-8?q?=E5=8A=A8mock=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hwx1119949 --- runtime/main/extend/systemplugin/ability.js | 1409 ---- runtime/main/extend/systemplugin/ai.js | 102 - runtime/main/extend/systemplugin/battery.js | 30 - .../main/extend/systemplugin/brightness.js | 61 - runtime/main/extend/systemplugin/calendar.js | 394 -- .../systemplugin/distributedSchedule.js | 121 - runtime/main/extend/systemplugin/entry.js | 18 - .../extend/systemplugin/featureAbility.js | 93 - runtime/main/extend/systemplugin/fetch.js | 133 - .../main/extend/systemplugin/geolocation.js | 63 - runtime/main/extend/systemplugin/index.js | 87 - .../main/extend/systemplugin/multimedia.js | 1118 ---- .../napi/@internal/ets/lifecycle.js | 258 - .../napi/ability/abilityResult.js | 20 - .../napi/ability/connectOptions.js | 29 - .../napi/ability/dataAbilityHelper.js | 289 - .../napi/ability/dataAbilityOperation.js | 33 - .../napi/ability/dataAbilityResult.js | 19 - .../napi/ability/startAbilityParameter.js | 20 - .../extend/systemplugin/napi/ability/want.js | 27 - .../systemplugin/napi/app/appVersionInfo.js | 20 - .../extend/systemplugin/napi/app/context.js | 317 - .../systemplugin/napi/app/processInfo.js | 19 - .../napi/application/AbilityContext.js | 231 - .../napi/application/AbilityRunningInfo.js | 39 - .../napi/application/AbilityStageContext.js | 28 - .../napi/application/AbilityStateData.js | 28 - .../AccessibilityExtensionContext.js | 199 - .../napi/application/AppStateData.js | 24 - .../napi/application/ApplicationContext.js | 59 - .../application/ApplicationStateObserver.js | 37 - .../napi/application/BaseContext.js | 21 - .../systemplugin/napi/application/Context.js | 314 - .../napi/application/ErrorObserver.js | 25 - .../systemplugin/napi/application/EventHub.js | 33 - .../napi/application/ExtensionContext.js | 30 - .../napi/application/ExtensionRunningInfo.js | 50 - .../napi/application/FormExtensionContext.js | 34 - .../napi/application/MissionInfo.js | 27 - .../napi/application/MissionListener.js | 37 - .../napi/application/MissionSnapshot.js | 30 - .../application/PermissionRequestResult.js | 25 - .../napi/application/ProcessData.js | 24 - .../napi/application/ProcessRunningInfo.js | 23 - .../application/ServiceExtensionContext.js | 139 - .../napi/application/abilityDelegator.js | 155 - .../napi/application/abilityDelegatorArgs.js | 21 - .../napi/application/abilityMonitor.js | 45 - .../napi/application/shellCmdResult.js | 19 - .../systemplugin/napi/bundle/PermissionDef.js | 21 - .../systemplugin/napi/bundle/abilityInfo.js | 68 - .../napi/bundle/applicationInfo.js | 64 - .../systemplugin/napi/bundle/bundleInfo.js | 65 - .../napi/bundle/bundleInstaller.js | 64 - .../napi/bundle/bundleStatusCallback.js | 32 - .../systemplugin/napi/bundle/customizeData.js | 20 - .../napi/bundle/defaultAppManager.js | 25 - .../systemplugin/napi/bundle/dispatchInfo.js | 19 - .../systemplugin/napi/bundle/elementName.js | 23 - .../napi/bundle/extensionAbilityInfo.js | 37 - .../systemplugin/napi/bundle/hapModuleInfo.js | 42 - .../napi/bundle/launcherAbilityInfo.js | 27 - .../systemplugin/napi/bundle/metadata.js | 20 - .../systemplugin/napi/bundle/moduleInfo.js | 19 - .../systemplugin/napi/bundle/packInfo.js | 95 - .../napi/bundle/remoteAbilityInfo.js | 22 - .../systemplugin/napi/bundle/shortcutInfo.js | 36 - .../napi/common/full/featureability.js | 156 - .../napi/commonEvent/commonEventData.js | 22 - .../commonEvent/commonEventPublishData.js | 25 - .../commonEvent/commonEventSubscribeInfo.js | 23 - .../napi/commonEvent/commonEventSubscriber.js | 163 - .../continuation/continuationExtraParams.js | 27 - .../napi/continuation/continuationResult.js | 19 - .../systemplugin/napi/data/rdb/resultSet.js | 97 - runtime/main/extend/systemplugin/napi/dtv.js | 5691 ----------------- .../napi/global/rawFileDescriptor.js | 20 - .../systemplugin/napi/global/resource.js | 20 - .../main/extend/systemplugin/napi/index.js | 563 -- .../notification/notificationActionButton.js | 22 - .../napi/notification/notificationContent.js | 45 - .../napi/notification/notificationFlags.js | 24 - .../napi/notification/notificationRequest.js | 67 - .../napi/notification/notificationSlot.js | 31 - .../napi/notification/notificationSorting.js | 21 - .../notification/notificationSortingMap.js | 20 - .../notification/notificationSubscribeInfo.js | 20 - .../notification/notificationSubscriber.js | 64 - .../napi/notification/notificationTemplate.js | 18 - .../notification/notificationUserInput.js | 17 - .../ohos_EnterpriseAdminExtensionAbility.js | 31 - .../ohos_WorkSchedulerExtensionAbility.js | 30 - .../napi/ohos_abilityAccessCtrl.js | 110 - .../napi/ohos_ability_dataUriUtils.js | 42 - .../napi/ohos_ability_errorCode.js | 23 - .../napi/ohos_ability_featureAbility.js | 171 - .../napi/ohos_ability_particleAbility.js | 96 - .../napi/ohos_ability_wantConstant.js | 76 - .../systemplugin/napi/ohos_accessibility.js | 189 - .../napi/ohos_accessibility_config.js | 46 - .../napi/ohos_account_appAccount.js | 568 -- .../napi/ohos_account_distributedAccount.js | 59 - .../napi/ohos_account_osAccount.js | 747 --- .../ohos_animation_windowAnimationManager.js | 79 - .../napi/ohos_application_Ability.js | 118 - .../napi/ohos_application_AbilityConstant.js | 58 - ...os_application_AbilityLifecycleCallback.js | 52 - .../napi/ohos_application_AbilityStage.js | 45 - ...plication_AccessibilityExtensionAbility.js | 62 - .../napi/ohos_application_Configuration.js | 26 - .../ohos_application_ConfigurationConstant.js | 41 - ...s_application_DataShareExtensionAbility.js | 116 - .../ohos_application_EnvironmentCallback.js | 29 - .../napi/ohos_application_FormExtension.js | 68 - ...hos_application_ServiceExtensionAbility.js | 63 - .../napi/ohos_application_StartOptions.js | 25 - ...cation_StaticSubscriberExtensionAbility.js | 27 - .../napi/ohos_application_Want.js | 34 - ...os_application_abilityDelegatorRegistry.js | 48 - .../napi/ohos_application_abilityManager.js | 83 - .../napi/ohos_application_appManager.js | 145 - .../napi/ohos_application_context.js | 43 - .../napi/ohos_application_errorManager.js | 40 - .../napi/ohos_application_formBindingData.js | 30 - .../napi/ohos_application_formError.js | 46 - .../napi/ohos_application_formHost.js | 231 - .../napi/ohos_application_formInfo.js | 89 - .../napi/ohos_application_formProvider.js | 95 - .../napi/ohos_application_missionManager.js | 153 - .../napi/ohos_application_quickFixManager.js | 61 - .../napi/ohos_application_testRunner.js | 27 - .../ohos_application_uriPermissionManager.js | 38 - .../napi/ohos_backgroundTaskManager.js | 112 - .../systemplugin/napi/ohos_batteryInfo.js | 79 - .../napi/ohos_batteryStatistics.js | 75 - .../systemplugin/napi/ohos_bluetooth.js | 60 - .../systemplugin/napi/ohos_brightness.js | 26 - .../extend/systemplugin/napi/ohos_buffer.js | 436 -- .../extend/systemplugin/napi/ohos_bundle.js | 487 -- .../systemplugin/napi/ohos_bundleState.js | 246 - .../napi/ohos_bundle_defaultAppManager.js | 82 - .../napi/ohos_bundle_innerBundleManager.js | 68 - .../extend/systemplugin/napi/ohos_bytrace.js | 34 - .../systemplugin/napi/ohos_commonEvent.js | 261 - .../systemplugin/napi/ohos_configPolicy.js | 58 - .../extend/systemplugin/napi/ohos_contact.js | 475 -- .../ohos_continuation_continuationManager.js | 170 - .../systemplugin/napi/ohos_convertxml.js | 57 - .../napi/ohos_data_DataShareResultSet.js | 110 - .../systemplugin/napi/ohos_data_Storage.js | 193 - .../napi/ohos_data_dataAbility.js | 331 - .../systemplugin/napi/ohos_data_dataShare.js | 240 - .../napi/ohos_data_dataSharePredicates.js | 176 - .../napi/ohos_data_distributedData.js | 972 --- .../napi/ohos_data_distributedDataObject.js | 78 - .../systemplugin/napi/ohos_deviceInfo.js | 50 - .../extend/systemplugin/napi/ohos_display.js | 155 - .../napi/ohos_distributedBundle.js | 61 - .../ohos_distributedHardware_deviceManager.js | 231 - .../napi/ohos_distributedMissionManager.js | 82 - .../extend/systemplugin/napi/ohos_document.js | 58 - .../napi/ohos_enterpriseDeviceManager.js | 142 - .../systemplugin/napi/ohos_environment.js | 46 - .../systemplugin/napi/ohos_events_emitter.js | 63 - .../systemplugin/napi/ohos_faultLogger.js | 58 - .../systemplugin/napi/ohos_fileManager.js | 71 - .../extend/systemplugin/napi/ohos_fileio.js | 710 -- .../systemplugin/napi/ohos_geolocation.js | 364 -- .../systemplugin/napi/ohos_hiAppEvent.js | 93 - .../systemplugin/napi/ohos_hiSysEvent.js | 107 - .../systemplugin/napi/ohos_hiTraceChain.js | 95 - .../systemplugin/napi/ohos_hiTraceMeter.js | 32 - .../systemplugin/napi/ohos_hichecker.js | 48 - .../extend/systemplugin/napi/ohos_hidebug.js | 74 - .../extend/systemplugin/napi/ohos_hilog.js | 54 - .../extend/systemplugin/napi/ohos_i18n.js | 440 -- .../systemplugin/napi/ohos_inputmethod.js | 188 - .../napi/ohos_inputmethodengine.js | 440 -- .../napi/ohos_inputmethodextensionability.js | 35 - .../napi/ohos_inputmethodextensioncontext.js | 49 - .../extend/systemplugin/napi/ohos_intl.js | 223 - .../napi/ohos_multimedia_audio.js | 1043 --- .../napi/ohos_multimedia_av_session.js | 436 -- .../napi/ohos_multimedia_camera.js | 625 -- .../napi/ohos_multimedia_image.js | 519 -- .../napi/ohos_multimedia_media.js | 541 -- .../napi/ohos_multimedia_mediaLibrary.js | 468 -- .../ohos_multimodalInput_inputConsumer.js | 74 - .../napi/ohos_multimodalInput_inputDevice.js | 218 - .../napi/ohos_multimodalInput_inputEvent.js | 25 - .../ohos_multimodalInput_inputEventClient.js | 62 - .../napi/ohos_multimodalInput_inputMonitor.js | 109 - .../napi/ohos_multimodalInput_keyCode.js | 354 - .../napi/ohos_multimodalInput_keyEvent.js | 46 - .../napi/ohos_multimodalInput_mouseEvent.js | 75 - .../napi/ohos_multimodalInput_pointer.js | 46 - .../napi/ohos_multimodalInput_touchEvent.js | 73 - .../systemplugin/napi/ohos_net_connection.js | 288 - .../extend/systemplugin/napi/ohos_net_http.js | 144 - .../systemplugin/napi/ohos_net_socket.js | 301 - .../systemplugin/napi/ohos_net_webSocket.js | 110 - .../extend/systemplugin/napi/ohos_network.js | 45 - .../napi/ohos_nfc_cardEmulation.js | 26 - .../systemplugin/napi/ohos_nfc_controller.js | 45 - .../extend/systemplugin/napi/ohos_nfc_tag.js | 274 - .../systemplugin/napi/ohos_notification.js | 793 --- .../systemplugin/napi/ohos_pasteboard.js | 298 - .../extend/systemplugin/napi/ohos_power.js | 81 - .../systemplugin/napi/ohos_privacyManager.js | 140 - .../extend/systemplugin/napi/ohos_process.js | 159 - .../systemplugin/napi/ohos_reminderAgent.js | 184 - .../extend/systemplugin/napi/ohos_request.js | 276 - .../systemplugin/napi/ohos_resourceManager.js | 326 - .../main/extend/systemplugin/napi/ohos_rpc.js | 751 --- .../systemplugin/napi/ohos_runninglock.js | 69 - .../extend/systemplugin/napi/ohos_screen.js | 244 - .../systemplugin/napi/ohos_screenLock.js | 117 - .../systemplugin/napi/ohos_screenshot.js | 55 - .../napi/ohos_security_cryptoFramework.js | 768 --- .../systemplugin/napi/ohos_security_huks.js | 549 -- .../systemplugin/napi/ohos_securitylabel.js | 55 - .../extend/systemplugin/napi/ohos_sensor.js | 435 -- .../extend/systemplugin/napi/ohos_settings.js | 197 - .../extend/systemplugin/napi/ohos_statfs.js | 46 - .../napi/ohos_storageStatistics.js | 133 - .../napi/ohos_systemCapability.js | 34 - .../systemplugin/napi/ohos_systemTime.js | 154 - .../systemplugin/napi/ohos_systemTimer.js | 82 - .../systemplugin/napi/ohos_systemparameter.js | 55 - .../systemplugin/napi/ohos_telephony_call.js | 804 --- .../systemplugin/napi/ohos_telephony_data.js | 157 - .../napi/ohos_telephony_observer.js | 133 - .../systemplugin/napi/ohos_telephony_radio.js | 482 -- .../systemplugin/napi/ohos_telephony_sim.js | 636 -- .../systemplugin/napi/ohos_telephony_sms.js | 500 -- .../extend/systemplugin/napi/ohos_thermal.js | 54 - .../extend/systemplugin/napi/ohos_uitest.js | 493 -- .../extend/systemplugin/napi/ohos_update.js | 510 -- .../main/extend/systemplugin/napi/ohos_uri.js | 58 - .../main/extend/systemplugin/napi/ohos_url.js | 151 - .../main/extend/systemplugin/napi/ohos_usb.js | 288 - .../napi/ohos_userIAM_faceAuth.js | 40 - .../napi/ohos_userIAM_userAuth.js | 237 - .../extend/systemplugin/napi/ohos_util.js | 577 -- .../systemplugin/napi/ohos_util_Arraylist.js | 148 - .../systemplugin/napi/ohos_util_Deque.js | 92 - .../systemplugin/napi/ohos_util_HashMap.js | 135 - .../systemplugin/napi/ohos_util_HashSet.js | 103 - .../napi/ohos_util_LightWeightMap.js | 172 - .../napi/ohos_util_LightWeightSet.js | 153 - .../systemplugin/napi/ohos_util_LinkedList.js | 152 - .../systemplugin/napi/ohos_util_List.js | 152 - .../systemplugin/napi/ohos_util_PlainArray.js | 134 - .../systemplugin/napi/ohos_util_Queue.js | 74 - .../systemplugin/napi/ohos_util_Stack.js | 84 - .../systemplugin/napi/ohos_util_TreeMap.js | 153 - .../systemplugin/napi/ohos_util_TreeSet.js | 134 - .../systemplugin/napi/ohos_util_Vector.js | 190 - .../extend/systemplugin/napi/ohos_vibrator.js | 53 - .../systemplugin/napi/ohos_volumeManager.js | 127 - .../systemplugin/napi/ohos_wallpaper.js | 252 - .../systemplugin/napi/ohos_wantAgent.js | 142 - .../extend/systemplugin/napi/ohos_wifi.js | 630 -- .../extend/systemplugin/napi/ohos_wifiext.js | 71 - .../extend/systemplugin/napi/ohos_window.js | 900 --- .../systemplugin/napi/ohos_workScheduler.js | 116 - .../extend/systemplugin/napi/ohos_worker.js | 168 - .../main/extend/systemplugin/napi/ohos_xml.js | 168 - .../extend/systemplugin/napi/ohos_zlib.js | 64 - .../extend/systemplugin/napi/system_cipher.js | 61 - .../extend/systemplugin/napi/system_file.js | 111 - .../systemplugin/napi/system_storage.js | 185 - runtime/main/extend/systemplugin/napi/tv.js | 2494 -------- .../napi/wantAgent/triggerInfo.js | 21 - .../napi/wantAgent/wantAgentInfo.js | 24 - .../extend/systemplugin/napi/webgl/webgl.js | 1048 --- .../extend/systemplugin/napi/webgl/webgl2.js | 770 --- runtime/main/extend/systemplugin/net.js | 1179 ---- .../main/extend/systemplugin/notification.js | 23 - runtime/main/extend/systemplugin/ohos/app.js | 302 - .../extend/systemplugin/ohos/bluetooth.js | 500 -- .../extend/systemplugin/ohos/bundleManager.js | 1532 ----- .../extend/systemplugin/ohos/commonEvent.js | 206 - .../extend/systemplugin/ohos/inputMonitor.js | 88 - .../systemplugin/ohos/packageManager.js | 240 - .../main/extend/systemplugin/ohos/request.js | 238 - .../systemplugin/ohos/storageInfoManager.js | 78 - .../systemplugin/ohos/userIAMuserAuth.js | 228 - runtime/main/extend/systemplugin/sensor.js | 378 -- runtime/main/extend/systemplugin/storage.js | 45 - .../main/extend/systemplugin/systemPackage.js | 27 - runtime/main/extend/systemplugin/userIAM.js | 41 - runtime/main/extend/systemplugin/utils.js | 34 - runtime/main/extend/systemplugin/vibrator.js | 27 - runtime/main/extend/systemplugin/wifi.js | 50 - 295 files changed, 58771 deletions(-) delete mode 100644 runtime/main/extend/systemplugin/ability.js delete mode 100644 runtime/main/extend/systemplugin/ai.js delete mode 100644 runtime/main/extend/systemplugin/battery.js delete mode 100755 runtime/main/extend/systemplugin/brightness.js delete mode 100644 runtime/main/extend/systemplugin/calendar.js delete mode 100644 runtime/main/extend/systemplugin/distributedSchedule.js delete mode 100644 runtime/main/extend/systemplugin/entry.js delete mode 100644 runtime/main/extend/systemplugin/featureAbility.js delete mode 100644 runtime/main/extend/systemplugin/fetch.js delete mode 100644 runtime/main/extend/systemplugin/geolocation.js delete mode 100644 runtime/main/extend/systemplugin/index.js delete mode 100644 runtime/main/extend/systemplugin/multimedia.js delete mode 100644 runtime/main/extend/systemplugin/napi/@internal/ets/lifecycle.js delete mode 100644 runtime/main/extend/systemplugin/napi/ability/abilityResult.js delete mode 100644 runtime/main/extend/systemplugin/napi/ability/connectOptions.js delete mode 100755 runtime/main/extend/systemplugin/napi/ability/dataAbilityHelper.js delete mode 100755 runtime/main/extend/systemplugin/napi/ability/dataAbilityOperation.js delete mode 100755 runtime/main/extend/systemplugin/napi/ability/dataAbilityResult.js delete mode 100644 runtime/main/extend/systemplugin/napi/ability/startAbilityParameter.js delete mode 100644 runtime/main/extend/systemplugin/napi/ability/want.js delete mode 100644 runtime/main/extend/systemplugin/napi/app/appVersionInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/app/context.js delete mode 100644 runtime/main/extend/systemplugin/napi/app/processInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/AbilityContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/AbilityRunningInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/AbilityStageContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/AbilityStateData.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/AccessibilityExtensionContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/AppStateData.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ApplicationContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ApplicationStateObserver.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/BaseContext.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/Context.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ErrorObserver.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/EventHub.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ExtensionContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ExtensionRunningInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/FormExtensionContext.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/MissionInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/MissionListener.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/MissionSnapshot.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/PermissionRequestResult.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ProcessData.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ProcessRunningInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/application/ServiceExtensionContext.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/abilityDelegator.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/abilityDelegatorArgs.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/abilityMonitor.js delete mode 100644 runtime/main/extend/systemplugin/napi/application/shellCmdResult.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js delete mode 100644 runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/bundleStatusCallback.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/customizeData.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/elementName.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/extensionAbilityInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/metadata.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/moduleInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/packInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/remoteAbilityInfo.js delete mode 100755 runtime/main/extend/systemplugin/napi/bundle/shortcutInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/common/full/featureability.js delete mode 100644 runtime/main/extend/systemplugin/napi/commonEvent/commonEventData.js delete mode 100644 runtime/main/extend/systemplugin/napi/commonEvent/commonEventPublishData.js delete mode 100644 runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscribeInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscriber.js delete mode 100644 runtime/main/extend/systemplugin/napi/continuation/continuationExtraParams.js delete mode 100644 runtime/main/extend/systemplugin/napi/continuation/continuationResult.js delete mode 100644 runtime/main/extend/systemplugin/napi/data/rdb/resultSet.js delete mode 100644 runtime/main/extend/systemplugin/napi/dtv.js delete mode 100644 runtime/main/extend/systemplugin/napi/global/rawFileDescriptor.js delete mode 100644 runtime/main/extend/systemplugin/napi/global/resource.js delete mode 100644 runtime/main/extend/systemplugin/napi/index.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationActionButton.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationContent.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationFlags.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationRequest.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationSlot.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationSorting.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationSortingMap.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationSubscribeInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationSubscriber.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationTemplate.js delete mode 100644 runtime/main/extend/systemplugin/napi/notification/notificationUserInput.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_EnterpriseAdminExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_WorkSchedulerExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_abilityAccessCtrl.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_ability_dataUriUtils.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_ability_errorCode.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_ability_featureAbility.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_ability_particleAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_ability_wantConstant.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_accessibility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_accessibility_config.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_account_appAccount.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_account_distributedAccount.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_account_osAccount.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_Ability.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_AbilityLifecycleCallback.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_AbilityStage.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_application_AccessibilityExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_Configuration.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_ConfigurationConstant.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_DataShareExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_EnvironmentCallback.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_FormExtension.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_ServiceExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_StartOptions.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_StaticSubscriberExtensionAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_Want.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_abilityDelegatorRegistry.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_abilityManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_appManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_context.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_application_errorManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_formBindingData.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_formError.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_formHost.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_formInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_formProvider.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_missionManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_quickFixManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_testRunner.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_application_uriPermissionManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_batteryInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_batteryStatistics.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_bluetooth.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_brightness.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_buffer.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_bundle.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_bundleState.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_bytrace.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_commonEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_configPolicy.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_contact.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_continuation_continuationManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_convertxml.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_DataShareResultSet.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_Storage.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_dataAbility.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_dataShare.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_dataSharePredicates.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_data_distributedDataObject.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_deviceInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_display.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_distributedBundle.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_distributedMissionManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_document.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_enterpriseDeviceManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_environment.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_events_emitter.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_faultLogger.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_fileManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_fileio.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_geolocation.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hiAppEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hiSysEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hiTraceChain.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hiTraceMeter.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hichecker.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hidebug.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_hilog.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_i18n.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_inputmethod.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_inputmethodengine.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_inputmethodextensionability.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_inputmethodextensioncontext.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_intl.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_audio.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_av_session.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_camera.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_image.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_media.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimedia_mediaLibrary.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputConsumer.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js delete mode 100755 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEventClient.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputMonitor.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyCode.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_mouseEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_pointer.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_multimodalInput_touchEvent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_net_connection.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_net_http.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_net_socket.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_net_webSocket.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_network.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_nfc_cardEmulation.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_nfc_controller.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_nfc_tag.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_notification.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_pasteboard.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_power.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_privacyManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_process.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_reminderAgent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_request.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_resourceManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_rpc.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_runninglock.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_screen.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_screenLock.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_screenshot.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_security_cryptoFramework.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_security_huks.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_securitylabel.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_sensor.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_settings.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_statfs.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_storageStatistics.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_systemCapability.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_systemTime.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_systemTimer.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_systemparameter.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_call.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_data.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_observer.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_radio.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_sim.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_telephony_sms.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_thermal.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_uitest.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_update.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_uri.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_url.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_usb.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_userIAM_faceAuth.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_userIAM_userAuth.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_Arraylist.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_Deque.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_HashMap.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_HashSet.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_LightWeightMap.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_LightWeightSet.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_LinkedList.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_List.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_PlainArray.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_Queue.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_Stack.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_TreeMap.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_TreeSet.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_util_Vector.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_vibrator.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_volumeManager.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_wallpaper.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_wantAgent.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_wifi.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_wifiext.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_window.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_workScheduler.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_worker.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_xml.js delete mode 100644 runtime/main/extend/systemplugin/napi/ohos_zlib.js delete mode 100644 runtime/main/extend/systemplugin/napi/system_cipher.js delete mode 100644 runtime/main/extend/systemplugin/napi/system_file.js delete mode 100644 runtime/main/extend/systemplugin/napi/system_storage.js delete mode 100644 runtime/main/extend/systemplugin/napi/tv.js delete mode 100644 runtime/main/extend/systemplugin/napi/wantAgent/triggerInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/wantAgent/wantAgentInfo.js delete mode 100644 runtime/main/extend/systemplugin/napi/webgl/webgl.js delete mode 100644 runtime/main/extend/systemplugin/napi/webgl/webgl2.js delete mode 100644 runtime/main/extend/systemplugin/net.js delete mode 100644 runtime/main/extend/systemplugin/notification.js delete mode 100644 runtime/main/extend/systemplugin/ohos/app.js delete mode 100644 runtime/main/extend/systemplugin/ohos/bluetooth.js delete mode 100644 runtime/main/extend/systemplugin/ohos/bundleManager.js delete mode 100644 runtime/main/extend/systemplugin/ohos/commonEvent.js delete mode 100644 runtime/main/extend/systemplugin/ohos/inputMonitor.js delete mode 100644 runtime/main/extend/systemplugin/ohos/packageManager.js delete mode 100644 runtime/main/extend/systemplugin/ohos/request.js delete mode 100644 runtime/main/extend/systemplugin/ohos/storageInfoManager.js delete mode 100644 runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js delete mode 100644 runtime/main/extend/systemplugin/sensor.js delete mode 100644 runtime/main/extend/systemplugin/storage.js delete mode 100644 runtime/main/extend/systemplugin/systemPackage.js delete mode 100644 runtime/main/extend/systemplugin/userIAM.js delete mode 100644 runtime/main/extend/systemplugin/utils.js delete mode 100644 runtime/main/extend/systemplugin/vibrator.js delete mode 100644 runtime/main/extend/systemplugin/wifi.js diff --git a/runtime/main/extend/systemplugin/ability.js b/runtime/main/extend/systemplugin/ability.js deleted file mode 100644 index 64ecc6d8..00000000 --- a/runtime/main/extend/systemplugin/ability.js +++ /dev/null @@ -1,1409 +0,0 @@ -/* - * Copyright (c) 2021-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 { windowMock } from "./napi/ohos_window" - -const DataAbilityResultMock = { - uri: "[PC Preview] unknow uri", - count: "[PC Preview] unknow count" -} -const DataAbilityResultArrayMock = [ - DataAbilityResultMock -] -const getFileTypesArrayMock = [ - paramMock.paramStringMock -] -const PacMapTypeMock = { - PacMap: new Map([["[PC Preview] unknow PacMapKey", "[PC Preview] unknow PacMapValue"]]) -} -const ResultSetMock = { - columnNames: "[PC Preview] unknow columnNames", - columnCount: "[PC Preview] unknow columnCount", - rowCount: "[PC Preview] unknow rowCount", - rowIndex: "[PC Preview] unknow rowIndex", - isAtFirstRow: "[PC Preview] unknow isAtFirstRow", - isAtLastRow: "[PC Preview] unknow isAtLastRow", - isEnded: "[PC Preview] unknow isEnded", - isStarted: "[PC Preview] unknow isStarted", - isClose: "[PC Preview] unknow isClose", - getColumnIndex: function (...args) { - console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getColumnName: function (...args) { - console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - goTo: function (...args) { - console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToRow: function (...args) { - console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToLastRow: function (...args) { - console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToFirstRow: function (...args) { - console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToNextRow: function (...args) { - console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToPreviousRow: function (...args) { - console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getBlob: function (...args) { - console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }, - getString: function (...args) { - console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getLong: function (...args) { - console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getDouble: function (...args) { - console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isColumnNull: function (...args) { - console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - close: function () { - console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } -} -const DataAbilityHelperMock = { - openFile: function (...args) { - console.warn("DataAbilityHelper.openFile 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - on: function (...args) { - console.warn("DataAbilityHelper.on 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) - } - }, - off: function (...args) { - console.warn("DataAbilityHelper.off 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) - } - }, - call: function (...args) { - console.warn("DataAbilityHelper.call 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, PacMapTypeMock) - } else { - return new Promise((resolve) => { - resolve(PacMapMock); - }) - } - }, - getType: function (...args) { - console.warn("DataAbilityHelper.getType 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); - }) - } - }, - getFileTypes: function (...args) { - console.warn("DataAbilityHelper.getFileTypes 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, getFileTypesArrayMock) - } else { - return new Promise((resolve) => { - resolve(getFileTypesArrayMock); - }) - } - }, - normalizeUri: function (...args) { - console.warn("DataAbilityHelper.normalizeUri 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); - }) - } - }, - denormalizeUri: function (...args) { - console.warn("DataAbilityHelper.denormalizeUri 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); - }) - } - }, - notifyChange: function (...args) { - console.warn("DataAbilityHelper.notifyChange 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) - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - insert: function (...args) { - console.warn("DataAbilityHelper.insert 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - batchInsert: function (...args) { - console.warn("DataAbilityHelper.batchInsert 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delete: function (...args) { - console.warn("DataAbilityHelper.delete 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - update: function (...args) { - console.warn("DataAbilityHelper.update 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - query: function (...args) { - console.warn("DataAbilityHelper.query 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, ResultSetMock) - } else { - return new Promise((resolve) => { - resolve(ResultSetMock); - }) - } - }, - executeBatch: function (...args) { - console.warn("DataAbilityHelper.executeBatch 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, DataAbilityResultArrayMock) - } else { - return new Promise((resolve) => { - resolve(DataAbilityResultArrayMock); - }) - } - } -} - -export function mockAbilityFeatureAbility() { - global.systemplugin.ability = {} - const WantMock = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - 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" - } - const AbilityResultMock = { - resultCode: "[PC Preview] unknow resultCode", - want: WantMock - } - const ContinuationStateMock = { - LOCAL_RUNNING: '0', - REMOTE_RUNNING: '1', - REPLICA_RUNNING: '2' - } - const PermissionRequestResultMock = { - requestCode: "[PC Preview] unknow requestCode", - permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], - authResults: ["[PC Preview] unknow authResult", "[PC Preview] unknow authResult"] - } - const ModuleInfoMock = { - moduleName: "[PC Preview] unknow moduleName", - moduleSourceDir: "[PC Preview] unknow moduleSourceDir" - } - const CustomizeDataMock = { - name: "[PC Preview] unknow name", - value: "[PC Preview] unknow values" - } - const ApplicationInfoMock = { - name: "[PC Preview] unknow name", - description: "[PC Preview] unknow description", - descriptionId: "[PC Preview] unknow descriptionId", - systemApp: "[PC Preview] unknow systemApp", - enabled: "[PC Preview] unknow enabled", - label: "[PC Preview] unknow label", - labelId: "[PC Preview] unknow labelId", - icon: "[PC Preview] unknow icon", - iconId: "[PC Preview] unknow iconId", - process: "[PC Preview] unknow process", - supportedModes: "[PC Preview] unknow supportedModes", - moduleSourceDirs: ["[PC Preview] unknow moduleSourceDir", "[PC Preview] unknow moduleSourceDir"], - permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], - moduleInfo: [ModuleInfoMock], - entryDir: "[PC Preview] unknow entryDir", - customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) - } - const AbilityInfoMock = { - bundleName: "[PC Preview] unknow bundleName", - className: "[PC Preview] unknow className", - label: "[PC Preview] unknow label", - description: "[PC Preview] unknow description", - icon: "[PC Preview] unknow icon", - labelId: "[PC Preview] unknow labelId", - descriptionId: "[PC Preview] unknow descriptionId", - iconId: "[PC Preview] unknow iconId", - moduleName: "[PC Preview] unknow moduleName", - process: "[PC Preview] unknow process", - targetAbility: "[PC Preview] unknow targetAbility", - backgroundModes: "[PC Preview] unknow backgroundModes", - isVisible: "[PC Preview] unknow isVisible", - formEnabled: "[PC Preview] unknow formEnabled", - type: "[PC Preview] unknow type", - subType: "[PC Preview] unknow subType", - orientation: "[PC Preview] unknow orientation", - launchMode: "[PC Preview] unknow launchMode", - permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], - deviceTypes: ["[PC Preview] unknow deviceType", "[PC Preview] unknow deviceType"], - deviceCapabilities: ["[PC Preview] unknow deviceCapabilities", "[PC Preview] unknow deviceCapabilities"], - readPermission: "[PC Preview] unknow readPermission", - writePermission: "[PC Preview] unknow writePermission", - applicationInfo: ApplicationInfoMock, - formEntity: "[PC Preview] unknow formEntity", - minFormHeight: "[PC Preview] unknow minFormHeight", - defaultFormHeight: "[PC Preview] unknow defaultFormHeight", - minFormWidth: "[PC Preview] unknow minFormWidth", - defaultFormWidth: "[PC Preview] unknow defaultFormWidth", - uri: "[PC Preview] unknow uri", - customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) - } - const ProcessInfoMock = { - pid: "[PC Preview] unknow pid", - processName: "[PC Preview] unknow processName" - } - const HapModuleInfoMock = { - name: "[PC Preview] unknow name", - description: "[PC Preview] unknow description", - descriptionId: "[PC Preview] unknow descriptionId", - icon: "[PC Preview] unknow icon", - label: "[PC Preview] unknow label", - labelId: "[PC Preview] unknow labelId", - iconId: "[PC Preview] unknow iconId", - backgroundImg: "[PC Preview] unknow backgroundImg", - supportedModes: "[PC Preview] unknow supportedModes", - reqCapabilities: ["[PC Preview] unknow reqCapabilities", "[PC Preview] unknow reqCapabilities"], - deviceTypes: ["[PC Preview] unknow deviceTypes", "[PC Preview] unknow deviceTypes"], - abilityInfo: [AbilityInfoMock], - moduleName: "[PC Preview] unknow moduleName", - mainAbilityName: "[PC Preview] unknow mainAbilityName", - installationFree: "[PC Preview] unknow installationFree", - } - const ElementNameMock = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - shortName: "[PC Preview] unknow shortName", - } - const AppVersionInfoMock = { - appName: "[PC Preview] unknow appName", - versionCode: "[PC Preview] unknow versionCode", - versionName: "[PC Preview] unknow versionName" - } - const ContextMock = { - getCacheDir: function (...args) { - console.warn("Context.getCacheDir 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) - }) - } - }, - getFilesDir: function (...args) { - console.warn("Context.getFilesDir 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) - }) - } - }, - getExternalCacheDir: function (...args) { - console.warn("Context.getExternalCacheDir 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) - }) - } - }, - getOrCreateLocalDir: function (...args) { - console.warn("Context.getOrCreateLocalDir 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) - }) - } - }, - getOrCreateDistributedDir: function (...args) { - console.warn("Context.getOrCreateDistributedDir 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) - }) - } - }, - verifyPermission: function (...args) { - console.warn("Context.verifyPermission 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - compelVerifyPermission: function (...args) { - console.warn("Context.compelVerifyPermission 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - authUriAccessPermission: function (...args) { - console.warn("Context.authUriAccessPermission 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - unauthUriAccessPermission: function (...args) { - console.warn("Context.unauthUriAccessPermission 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - requestPermissionsFromUser: function (...args) { - console.warn("Context.requestPermissionsFromUser 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, PermissionRequestResultMock) - } else { - return new Promise((resolve) => { - resolve(PermissionRequestResultMock) - }) - } - }, - getApplicationInfo: function (...args) { - console.warn("Context.getApplicationInfo 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, ApplicationInfoMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfoMock) - }) - } - }, - getBundleName: function (...args) { - console.warn("Context.getBundleName 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) - }) - } - }, - getDisplayOrientation: function (...args) { - console.warn("Context.getDisplayOrientation 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - setDisplayOrientation: function (...args) { - console.warn("Context.setDisplayOrientation 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setShowOnLockScreen: function (...args) { - console.warn("Context.setShowOnLockScreen 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setWakeUpScreen: function (...args) { - console.warn("Context.setWakeUpScreen 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - getProcessInfo: function (...args) { - console.warn("Context.getProcessInfo 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, ProcessInfoMock) - } else { - return new Promise((resolve) => { - resolve(ProcessInfoMock) - }) - } - }, - getAppType: function (...args) { - console.warn("Context.getAppType 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) - }) - } - }, - getElementName: function (...args) { - console.warn("Context.getElementName 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, ElementNameMock) - } else { - return new Promise((resolve) => { - resolve(ElementNameMock) - }) - } - }, - getHapModuleInfo: function (...args) { - console.warn("Context.getHapModuleInfo 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, HapModuleInfoMock) - } else { - return new Promise((resolve) => { - resolve(HapModuleInfoMock) - }) - } - }, - getProcessName: function (...args) { - console.warn("Context.getProcessName 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) - }) - } - }, - getCallingBundle: function (...args) { - console.warn("Context.getCallingBundle 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) - }) - } - }, - printDrawnCompleted: function (...args) { - console.warn("Context.printDrawnCompleted 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isUpdatingConfigurations: function (...args) { - console.warn("Context.isUpdatingConfigurations 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) - }) - } - }, - getAppVersionInfo: function (...args) { - console.warn("Context.getAppVersionInfo 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, AppVersionInfoMock) - } else { - return new Promise((resolve) => { - resolve(AppVersionInfoMock) - }) - } - }, - getAbilityInfo: function (...args) { - console.warn("Context.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, AbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(AbilityInfoMock) - }) - } - }, - getApplicationContext: function () { - console.warn("Context.getApplicationContext interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return ContextMock; - } - } - global.systemplugin.ability.featureAbility = { - getWant: function (...args) { - console.warn("ability.featureAbility.getWant 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, WantMock) - } else { - return new Promise((resolve) => { - resolve(WantMock) - }) - } - }, - startAbility: function (...args) { - console.warn("ability.featureAbility.startAbility 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - connectAbility: function (...args) { - console.warn("ability.featureAbility.connectAbility interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - disconnectAbility: function (...args) { - console.warn("ability.featureAbility.disconnectAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - getContext: function () { - console.warn("ability.featureAbility.getContext interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return ContextMock; - }, - startAbilityForResult: function (...args) { - console.warn("ability.featureAbility.startAbilityForResult 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, AbilityResultMock) - } else { - return new Promise((resolve) => { - resolve(AbilityResultMock) - }) - } - }, - terminateSelfWithResult: function (...args) { - console.warn("ability.featureAbility.terminateSelfWithResult 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - terminateSelf: function (...args) { - console.warn("ability.featureAbility.terminateSelf 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - acquireDataAbilityHelper: function (...args) { - console.warn("ability.featureAbility.acquireDataAbilityHelper mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - return DataAbilityHelperMock; - }, - hasWindowFocus: function (...args) { - console.warn("ability.featureAbility.hasWindowFocus 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) - }) - } - }, - getAbilityMissionId: function (...args) { - console.warn("ability.featureAbility.getAbilityMissionId 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindow: function (...args) { - console.warn("ability.featureAbility.getWindow 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, windowMock) - } else { - return new Promise((resolve) => { - resolve(windowMock) - }) - } - }, - continueAbility: function (...args) { - console.warn("ability.featureAbility.continueAbility 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) - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - getContinuationState: function (...args) { - console.warn("ability.featureAbility.getContinuationState 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, ContinuationStateMock) - } else { - return new Promise((resolve) => { - resolve(ContinuationStateMock) - }) - } - }, - getOriginalDeviceId: function (...args) { - console.warn("ability.featureAbility.getOriginalDeviceId 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) - }) - } - }, - reverseContinueAbility: function (...args) { - console.warn("ability.featureAbility.reverseContinueAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - finishTaskSyncAnimation: function (...args) { - console.warn("ability.featureAbility.finishTaskSyncAnimation interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - }, - setTaskSyncAnimationParams: function (...args) { - console.warn("ability.featureAbility.setTaskSyncAnimationParams 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - startAssistAbility: function (...args) { - console.warn("ability.featureAbility.startAssistAbility mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - }, - stopAssistAbility: function (...args) { - console.warn("ability.featureAbility.stopAssistAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - on: function (...args) { - console.warn("ability.featureAbility.on 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') { - if (args[0] == 'assistConnect') { - args[len - 1].call(this, global.systemplugin.ability.abilityAgent); - } else if (args[0] == 'assistConnectFailed') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else { - args[len - 1].call(this, paramMock.paramNumberMock); - } - } - }, - off: function (...args) { - console.warn("ability.featureAbility.off 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') { - if (args[0] == 'assistConnect') { - args[len - 1].call(this, global.systemplugin.ability.abilityAgent); - } else if (args[0] == 'assistConnectFailed') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else { - args[len - 1].call(this, paramMock.paramNumberMock); - } - } - } - } -} -export function mockAbilityParticleAbility() { - global.systemplugin.ability.particleAbility = { - startAbility: function (...args) { - console.warn("ability.particleAbility.startAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - connectAbility: function (...args) { - console.warn("ability.particleAbility.connectAbility interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - disconnectAbility: function (...args) { - console.warn("ability.particleAbility.disconnectAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - terminateSelf: function (...args) { - console.warn("ability.particleAbility.terminateSelf 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - acquireDataAbilityHelper: function (...args) { - console.warn("ability.particleAbility.acquireDataAbilityHelper interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return DataAbilityHelperMock; - }, - startBackgroundRunning: function (...args) { - console.warn("ability.particleAbility.startBackgroundRunning 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - cancelBackgroundRunning: function (...args) { - console.warn("ability.particleAbility.cancelBackgroundRunning 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } - } -} -export function mockAbilityFormManager() { - const FormInfoMock = { - bundleName: "[PC Preview] unknow bundleName", - moduleName: "[PC Preview] unknow moduleName", - abilityName: "[PC Preview] unknow abilityName", - name: "[PC Preview] unknow name", - description: "[PC Preview] unknow description", - type: "[PC Preview] unknow type", - jsComponentName: "[PC Preview] unknow jsComponentName", - colorMode: "[PC Preview] unknow colorMode", - isDefault: "[PC Preview] unknow isDefault", - updateEnabled: "[PC Preview] unknow updateEnabled", - formVisibleNotify: "[PC Preview] unknow formVisibleNotify", - relatedBundleName: "[PC Preview] unknow relatedBundleName", - scheduledUpdateTime: "[PC Preview] unknow scheduledUpdateTime", - formConfigAbility: "[PC Preview] unknow formConfigAbility", - updateDuration: "[PC Preview] unknow updateDuration", - defaultDimension: "[PC Preview] unknow defaultDimension", - supportDimensions: "[PC Preview] unknow supportDimensions", - customizeDatas: "[PC Preview] unknow customizeDatas", - jsonObject: "[PC Preview] unknow jsonObject" - } - const WantMock = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - 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" - } - const FormStateMock = { - UNKNOWN: '-1', - DEFAULT: '0', - READY: '1' - } - const FormInfoArrayMock = [ - FormInfoMock - ] - const AcquireFormStateMock = { - FormStateMock, - WantMock - } - global.systemplugin.ability.formManager = { - requestForm: function (...args) { - console.warn("ability.formManager.requestForm 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - deleteForm: function (...args) { - console.warn("ability.formManager.deleteForm 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - releaseForm: function (...args) { - console.warn("ability.formManager.releaseForm 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); - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - notifyVisibleForms: function (...args) { - console.warn("ability.formManager.notifyVisibleForms 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - notifyInvisibleForms: function (...args) { - console.warn("ability.formManager.notifyInvisibleForms 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - enableFormsUpdate: function (...args) { - console.warn("ability.formManager.enableFormsUpdate 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - disableFormsUpdate: function (...args) { - console.warn("ability.formManager.disableFormsUpdate 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isSystemReady: function (...args) { - console.warn("ability.formManager.isSystemReady 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) - }) - } - }, - castTempForm: function (...args) { - console.warn("ability.formManager.castTempForm 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - deleteInvalidForms: function (...args) { - console.warn("ability.formManager.deleteInvalidForms 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - acquireFormState: function (...args) { - console.warn("ability.formManager.acquireFormState 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, AcquireFormStateMock) - } else { - return new Promise((resolve) => { - resolve(AcquireFormStateMock) - }) - } - }, - on: function (...args) { - console.warn("ability.formManager.on 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.paramStringMock) - } - }, - off: function (...args) { - console.warn("ability.formManager.off 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.paramStringMock) - } - }, - getAllFormsInfo: function (...args) { - console.warn("ability.formManager.getAllFormsInfo 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, FormInfoArrayMock) - } else { - return new Promise((resolve) => { - resolve(FormInfoArrayMock) - }) - } - }, - getFormsInfo: function (...args) { - console.warn("ability.formManager.getFormsInfo 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, FormInfoArrayMock) - } else { - return new Promise((resolve) => { - resolve(FormInfoArrayMock) - }) - } - }, - updateForm: function (...args) { - console.warn("ability.formManager.updateForm 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } - } -} -export function mockAbilityContinuationRegisterManager() { - const ContinuationResultMock = { - id: "[PC Preview] unknow id", - type: "[PC Preview] unknow type", - name: "[PC Preview] unknow name" - } - global.systemplugin.ability.continuationRegisterManager = { - on: function (...args) { - console.warn("ability.ContinuationRegisterManager.on 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') { - if (args[0] === 'deviceConnect') { - args[len - 1].call(this, ContinuationResultMock) - } else { - args[len - 1].call(this, paramMock.paramStringMock) - } - } - }, - off: function (...args) { - console.warn("ability.ContinuationRegisterManager.off 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') { - if (args[0] === 'deviceConnect') { - args[len - 1].call(this, ContinuationResultMock) - } else { - args[len - 1].call(this, paramMock.paramStringMock) - } - } - }, - register: function (...args) { - console.warn("ability.ContinuationRegisterManager.register 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - unregister: function (...args) { - console.warn("ability.ContinuationRegisterManager.unregister 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - updateConnectStatus: function (...args) { - console.warn("ability.ContinuationRegisterManager.updateConnectStatus 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - showDeviceList: function (...args) { - console.warn("ability.ContinuationRegisterManager.showDeviceList 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - disconnect: function (...args) { - console.warn("ability.ContinuationRegisterManager.disconnect 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } - } -} -export function mockAbilityAbilityAgent() { - global.systemplugin.ability.abilityAgent = { - on: function (...args) { - console.warn("ability.abilityAgent.on 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') { - if (args[0] == 'message') { - args[len - 1].call(this, paramMock.paramStringMock); - } else { - args[len - 1].call(this, paramMock.paramNumberMock); - } - } - }, - off: function (...args) { - console.warn("ability.abilityAgent.off 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') { - if (args[0] == 'message') { - args[len - 1].call(this, paramMock.paramStringMock) - } else { - args[len - 1].call(this, paramMock.paramNumberMock) - } - } - }, - postMessage: function (...args) { - console.warn("ability.abilityAgent.postMessage 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } - } -} -export function mockAbilityFormBindingData() { - const FormBindingDataMock = { - data: "[PC Preview] unknow data" - } - global.systemplugin.ability.formBindingData = { - createFormBindingData: function (...args) { - console.warn("ability.formBindingData.createFormBindingData interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return FormBindingDataMock; - } - } -} diff --git a/runtime/main/extend/systemplugin/ai.js b/runtime/main/extend/systemplugin/ai.js deleted file mode 100644 index 2d83c285..00000000 --- a/runtime/main/extend/systemplugin/ai.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2021 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 mockAI() { - const TTSCallBackMock = { - key: "[PC preview] unknow key" - }; - global.systemplugin.ai = {}; - global.systemplugin.ai.TTS = { - getTTSClient: function () { - console.warn("ai.TTS.getTTSClient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return TTSClient - }, - }; - const TTSClient = { - init: function (...args) { - console.warn("TTSClient.init interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSpeaking: function () { - console.warn("TTSClient.isSpeaking interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - setAudioType: function (...args) { - console.warn("TTSClient.setAudioType interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - setParams: function (...args) { - console.warn("TTSClient.setParams interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - connectService: function () { - console.warn("TTSClient.connectService interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - setIsSaveTtsData: function (...args) { - console.warn("TTSClient.setIsSaveTtsData interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - release: function () { - console.warn("TTSClient.release interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - speakLongText: function (...args) { - console.warn("TTSClient.speakLongText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - speakText: function (...args) { - console.warn("TTSClient.speakText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - stopSpeak: function () { - console.warn("TTSClient.stopSpeak interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - destroy: function () { - console.warn("TTSClient.destroy interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - on: function (...args) { - console.warn("TTSClient.on 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, TTSCallBackMock) - }, - getSupportMaxLength: function () { - console.warn("TTSClient.getSupportMaxLength interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock - }, - getVersion: function () { - console.warn("TTSClient.getVersion interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramStringMock - }, - }; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/battery.js b/runtime/main/extend/systemplugin/battery.js deleted file mode 100644 index 184c8365..00000000 --- a/runtime/main/extend/systemplugin/battery.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "./utils" - -export function mockBattery() { - global.systemplugin.battery = { - getStatus: function (...args) { - console.warn("battery.getStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - args[0].success.call(this, { - level: 1, - charging: false - }) - hasComplete(args[0].complete) - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/brightness.js b/runtime/main/extend/systemplugin/brightness.js deleted file mode 100755 index d8bf446b..00000000 --- a/runtime/main/extend/systemplugin/brightness.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 { hasComplete } from "./utils" - -export function mockBrightness() { - global.systemplugin.brightness = { - argsV: { - value: 80 - }, - argsM: { - mode: 0 - }, - getValue: function (...args) { - console.warn("brightness.getValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - args[0].success(this.argsV) - hasComplete(args[0].complete) - }, - setValue: function (...args) { - console.warn("brightness.setValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (args[0].value) { - this.argsV.value = args[0].value - args[0].success() - hasComplete(args[0].complete) - } - }, - getMode: function (...args) { - console.warn("brightness.getMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - args[0].success(this.argsM) - hasComplete(args[0].complete) - }, - setMode: function (...args) { - console.warn("brightness.setMode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.argsM.mode = args[0].mode - args[0].success() - hasComplete(args[0].complete) - }, - setKeepScreenOn: function (...args) { - console.warn("brightness.setKeepScreenOn interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - } - } -} diff --git a/runtime/main/extend/systemplugin/calendar.js b/runtime/main/extend/systemplugin/calendar.js deleted file mode 100644 index 6825a005..00000000 --- a/runtime/main/extend/systemplugin/calendar.js +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (c) 2021 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 mockCalendar() { - const CalendarEntityClass = class CalendarEntity { - constructor() { - console.warn('calendar.CalendarEntity.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.id = '[PC preview] unknown id'; - } - }; - CalendarEntityClass.ACC_TYPE_LOCAL = 'LOCAL'; - CalendarEntityClass.IS_SYNC_ADAPTER = 'caller_is_syncadapter'; - const AccountsClass = class Accounts extends CalendarEntityClass { - constructor() { - super(); - console.warn('calendar.Accounts.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.name = '[PC preview] unknown name'; - this.accName = '[PC preview] unknown accName'; - this.accType = '[PC preview] unknown accType'; - this.accColour = '[PC preview] unknown accColour'; - this.accDisplayName = '[PC preview] unknown accDisplayName'; - this.visible = '[PC preview] unknown visible'; - this.accTimezone = '[PC preview] unknown accTimezone'; - this.isSyncEvents = '[PC preview] unknown isSyncEvents'; - this.remindersType = '[PC preview] unknown remindersType'; - this.attendeeTypes = '[PC preview] unknown attendeeTypes'; - } - }; - AccountsClass.NAME = 'name'; - const EventsClass = class Events extends CalendarEntityClass { - constructor() { - super(); - console.warn('calendar.Events.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.accId = '[PC preview] unknown accId'; - this.title = '[PC preview] unknown title'; - this.description = '[PC preview] unknown description'; - this.eventPosition = '[PC preview] unknown eventPosition'; - this.eventStatus = '[PC preview] unknown eventStatus'; - this.eventStartTime = '[PC preview] unknown eventStartTime'; - this.eventEndTime = '[PC preview] unknown eventEndTime'; - this.duration = '[PC preview] unknown duration'; - this.isWholeDay = '[PC preview] unknown isWholeDay'; - this.availableStatus = '[PC preview] unknown availableStatus'; - this.hasAlarm = '[PC preview] unknown hasAlarm'; - this.recurRule = '[PC preview] unknown recurRule'; - this.recurDate = '[PC preview] unknown recurDate'; - this.initialId = '[PC preview] unknown initialId'; - this.hasAttendeeInfo = '[PC preview] unknown hasAttendeeInfo'; - } - }; - const InstancesClass = class Instances extends CalendarEntityClass { - constructor() { - super(); - console.warn('calendar.Instances.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.instanceBegin = '[PC preview] unknown instanceBegin'; - this.instanceEnd = '[PC preview] unknown instanceEnd'; - this.eventId = '[PC preview] unknown eventId'; - this.instanceStartDay = '[PC preview] unknown instanceStartDay'; - this.instanceEndDay = '[PC preview] unknown instanceEndDay'; - this.instanceStartMinute = '[PC preview] unknown instanceStartMinute'; - this.instanceEndMinute = '[PC preview] unknown instanceEndMinute'; - } - }; - const ParticipantsClass = class Participants extends CalendarEntityClass { - constructor() { - super(); - console.warn('calendar.Participants.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.eventId = '[PC preview] unknown eventId'; - this.participantName = '[PC preview] unknown participantName'; - this.participantEmail = '[PC preview] unknown participantEmail'; - this.participantRoleType = '[PC preview] unknown participantRoleType'; - this.participantType = '[PC preview] unknown participantType'; - this.participantStatus = '[PC preview] unknown participantStatus'; - } - }; - const RemindersClass = class Reminders extends CalendarEntityClass { - constructor() { - super(); - console.warn('calendar.Reminders.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.eventId = '[PC preview] unknown eventId'; - this.remindMinutes = '[PC preview] unknown remindMinutes'; - this.remindType = '[PC preview] unknown remindType'; - this.syncId = '[PC preview] unknown syncId'; - } - }; - const AppletEntityClass = class AppletEntity { - constructor() { - console.warn('calendar.AppletEntity.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.title = '[PC preview] unknown title'; - this.startTime = '[PC preview] unknown startTime'; - this.allDay = '[PC preview] unknown allDay'; - this.description = '[PC preview] unknown description'; - this.location = '[PC preview] unknown location'; - this.endTime = '[PC preview] unknown endTime'; - this.alarm = '[PC preview] unknown alarm'; - this.alarmOffset = '[PC preview] unknown alarmOffset'; - this.repeatInterval = '[PC preview] unknown repeatInterval'; - this.repeatEndTime = '[PC preview] unknown repeatEndTime'; - } - }; - const AppletRepeatEntityClass = class AppletRepeatEntity extends AppletEntityClass { - constructor() { - super(); - console.warn('calendar.AppletRepeatEntity.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.repeatInterval = '[PC preview] unknown repeatInterval'; - this.repeatEndTime = '[PC preview] unknown repeatEndTime'; - } - }; - const CalendarCollectionClass = class CalendarCollection { - constructor() { - this.handler = '[PC preview] unknown handler'; - this.close = function (...args) { - console.warn('calendar.CalendarCollection.close interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - }; - this.count = function (...args) { - console.warn('calendar.CalendarCollection.count interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }; - this.next = function (...args) { - console.warn('calendar.CalendarCollection.next interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new CalendarEntityClass(); - }; - this.hasNext = function (...args) { - console.warn('calendar.CalendarCollection.hasNext interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }; - } - }; - const CalendarDataHelperClass = class CalendarDataHelper { - constructor() { - this.name = '[PC preview] unknown queryEntityName'; - this.query = function (...args) { - console.warn('calendar.CalendarDataHelper.query 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, new CalendarCollectionClass()); - } else { - return new Promise((resolve) => { - resolve(new CalendarCollectionClass()); - }); - } - }; - this.insert = function (...args) { - console.warn('calendar.CalendarDataHelper.insert 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); - }); - } - }; - this.update = function (...args) { - console.warn('calendar.CalendarDataHelper.update 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }; - this.delete = function (...args) { - console.warn('calendar.CalendarDataHelper.delete 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') { - if (typeof args[0] === 'number') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] instanceof CalendarEntityClass) { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } - } else { - if (typeof args[0] === 'number') { - return new Promise((resolve) => { - resolve(); - }); - } else if (args[0] instanceof CalendarEntityClass) { - return new Promise((resolve) => { - resolve(); - }); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - } - }; - } - }; - CalendarDataHelperClass.creator = function (...args) { - console.warn('calendar.CalendarDataHelper.creator interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new CalendarDataHelperClass(); - }; - global.systemplugin.calendar = { - BaseColumns: { - COUNT: "_count", - ID: "_id" - }, - AccountColumns: { - ACC_COLOR: "calendar_color", - ACC_COLOR_INDEX: "calendar_color_index", - ACC_DISPLAY_NAME: "calendar_displayName", - VISIBLE: "visible", - ACC_TIME_ZONE: "calendar_timezone", - IS_SYNC_EVENTS: "sync_events", - REMINDERS_TYPE: "allowedReminders", - AVAILABILITY_STATUS: "allowedAvailability", - ATTENDEE_TYPES: "allowedAttendeeTypes", - IS_PRIMARY: "isPrimary" - }, - AccountSyncColumns: { - ACC_SYNC1: "cal_sync1", - ACC_SYNC2: "cal_sync2", - ACC_SYNC3: "cal_sync3", - ACC_SYNC4: "cal_sync4", - ACC_SYNC5: "cal_sync5", - ACC_SYNC6: "cal_sync6", - ACC_SYNC7: "cal_sync7", - ACC_SYNC8: "cal_sync8", - ACC_SYNC9: "cal_sync9", - ACC_SYNC10: "cal_sync10" - }, - EventsColumns: { - ACC_ID: "calendar_id", - TITLE: "title", - DESCRIPTION: "description", - EVENT_POSITION: "eventLocation", - EVENT_STATUS: "eventStatus", - EVENT_STATUS_TENTATIVE: 0, - EVENT_STATUS_CONFIRMED: 1, - EVENT_STATUS_CANCELED: 2, - OWNER_ATTENDEE_STATUS: "selfAttendeeStatus", - EXTEND_DATA1: "sync_data1", - EXTEND_DATA2: "sync_data2", - EXTEND_DATA3: "sync_data3", - EXTEND_DATA4: "sync_data4", - EXTEND_DATA5: "sync_data5", - EXTEND_DATA6: "sync_data6", - D_DATA7: "sync_data7", - EXTEND_DATA8: "sync_data8", - EXTEND_DATA9: "sync_data9", - EXTEND_DATA10: "sync_data10", - EVENT_START_TIME: "dtstart", - EVENT_END_TIME: "dtend", - DURATION: "duration", - START_TIMEZONE: "eventTimezone", - END_TIMEZONE: "eventEndTimezone", - IS_WHOLE_DAY: "allDay", - PERMISSION_LEVEL: "accessLevel", - PERMISSION_DEFAULT: 0, - PERMISSION_CONFIDENTIAL: 1, - PERMISSION_PRIVATE: 2, - PERMISSION_PUBLIC: 3, - AVAILABLE_STATUS: "availability", - STATUS_BUSY: 0, - STATUS_FREE: 1, - STATUS_TENTATIVE: 2, - HAS_ALARM: "hasAlarm", - HAS_EXTENDED_ATTRIBUTES: "hasExtendedProperties", - RECUR_RULE: "rrule", - RECUR_DATE: "rdate", - INITIAL_ID: "original_id", - INITIAL_SYNC_ID: "original_sync_id", - HAS_ATTENDEE_INFO: "hasAttendeeData", - ORGANIZER_EMAIL: "organizer" - }, - InstancesColumns: { - EVENT_ID: "event_id", - INSTANCE_START: "begin", - INSTANCE_END: "end", - INSTANCE_START_DAY: "startDay", - INSTANCE_END_DAY: "endDay", - INSTANCE_START_MINUTE: "startMinute", - INSTANCE_END_MINUTE: "endMinute" - }, - ParticipantsColumns: { - EVENT_ID: "event_id", - PARTICIPANT_NAME: "attendeeName", - PARTICIPANT_EMAIL: "attendeeEmail", - PARTICIPANT_ROLE_TYPE: "attendeeRelationship", - ROLE_NONE: 0, - ROLE_ATTENDEE: 1, - ROLE_ORGANIZER: 2, - ROLE_PERFORMER: 3, - ROLE_SPEAKER: 4, - PARTICIPANT_TYPE: "attendeeType", - TYPE_NONE: 0, - TYPE_REQUIRED: 1, - TYPE_OPTIONAL: 2, - TYPE_RESOURCE: 3, - PARTICIPANT_STATUS: "attendeeStatus", - PARTICIPANT_STATUS_NONE: 0, - PARTICIPANT_STATUS_ACCEPTED: 1, - PARTICIPANT_STATUS_DECLINED: 2, - PARTICIPANT_STATUS_INVITED: 3, - PARTICIPANT_STATUS_TENTATIVE: 4 - }, - RemindersColumns: { - EVENT_ID: "event_id", - REMIND_MINUTES: "minutes", - REMIND_MINUTES_DEFAULT: -1, - REMIND_TYPE: "method", - TYPE_DEFAULT: 0, - TYPE_ALERT: 1, - TYPE_EMAIL: 2, - TYPE_SMS: 3, - TYPE_ALARM: 4 - }, - SyncColumns: { - ACC_NAME: "account_name", - ACC_TYPE: "account_type", - SYNC_ID: "_sync_id", - DIRTY: "dirty", - CALLING_BUNDLE_NAME: "mutators", - DELETED: "deleted" - }, - queryEntityName: { - EVENTS: "EVENTS", - ACCOUNTS: "ACCOUNTS", - INSTANCES: "INSTANCES", - PARTICIPANTS: "PARTICIPANTS", - REMINDERS: "REMINDERS" - }, - CalendarEntity: CalendarEntityClass, - Accounts: AccountsClass, - Events: EventsClass, - Instances: InstancesClass, - Participants: ParticipantsClass, - Reminders: RemindersClass, - AppletEntity: AppletEntityClass, - AppletRepeatEntity: AppletRepeatEntityClass, - CalendarCollection: CalendarCollectionClass, - CalendarDataHelper: CalendarDataHelperClass, - addPhoneCalendar: function (...args) { - console.warn('calendar.addPhoneCalendar 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - addPhoneRepeatCalendar: function (...args) { - console.warn('calendar.addPhoneRepeatCalendar 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - } - }; -} diff --git a/runtime/main/extend/systemplugin/distributedSchedule.js b/runtime/main/extend/systemplugin/distributedSchedule.js deleted file mode 100644 index 9e7ba919..00000000 --- a/runtime/main/extend/systemplugin/distributedSchedule.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2021 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 mockDistributedSchedule() { - const ModuleInfoMock = { - moduleName: "[PC Preview] unknow moduleName", - moduleSourceDir: "[PC Preview] unknow moduleSourceDir" - } - const CustomizeDataMock = { - name: "[PC Preview] unknow name", - value: "[PC Preview] unknow values" - } - const ApplicationInfoMock = { - name: "[PC Preview] unknow name", - description: "[PC Preview] unknow description", - descriptionId: "[PC Preview] unknow descriptionId", - systemApp: "[PC Preview] unknow systemApp", - enabled: "[PC Preview] unknow enabled", - label: "[PC Preview] unknow label", - labelId: "[PC Preview] unknow labelId", - icon: "[PC Preview] unknow icon", - iconId: "[PC Preview] unknow iconId", - process: "[PC Preview] unknow process", - supportedModes: "[PC Preview] unknow supportedModes", - moduleSourceDirs: ["[PC Preview] unknow moduleSourceDir", "[PC Preview] unknow moduleSourceDir"], - permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], - moduleInfo: [ModuleInfoMock], - entryDir: "[PC Preview] unknow entryDir", - customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) - } - const AbilityInfoMock = { - bundleName: "[PC Preview] unknow bundleName", - className: "[PC Preview] unknow name", - label: "[PC Preview] unknow label", - description: "[PC Preview] unknow description", - icon: "[PC Preview] unknow icon", - labelId: "[PC Preview] unknow labelId", - descriptionId: "[PC Preview] unknow descriptionId", - iconId: "[PC Preview] unknow iconId", - moduleName: "[PC Preview] unknow moduleName", - process: "[PC Preview] unknow process", - targetAbility: "[PC Preview] unknow targetAbility", - backgroundModes: "[PC Preview] unknow backgroundModes", - isVisible: "[PC Preview] unknow isVisible", - formEnabled: "[PC Preview] unknow formEnabled", - type: "[PC Preview] unknow type", - subType: "[PC Preview] unknow subType", - orientation: "[PC Preview] unknow orientation", - launchMode: "[PC Preview] unknow launchMode", - permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"], - deviceTypes: ["[PC Preview] unknow deviceType", "[PC Preview] unknow deviceType"], - deviceCapabilities: ["[PC Preview] unknow deviceCapabilities", "[PC Preview] unknow deviceCapabilities"], - readPermission: "[PC Preview] unknow readPermission", - writePermission: "[PC Preview] unknow writePermission", - applicationInfo: ApplicationInfoMock, - formEntity: "[PC Preview] unknow formEntity", - minFormHeight: "[PC Preview] unknow minFormHeight", - defaultFormHeight: "[PC Preview] unknow defaultFormHeight", - minFormWidth: "[PC Preview] unknow minFormWidth", - defaultFormWidth: "[PC Preview] unknow defaultFormWidth", - uri: "[PC Preview] unknow uri", - customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]]) - } - global.systemplugin.distributedSchedule = { - stopDistributedService: function (...args) { - console.warn("distributedSchedule.stopDistributedService 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) - }) - } - }, - startDistributedService: function (...args) { - console.warn("distributedSchedule.startDistributedService 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) - }) - } - }, - queryRemoteAbilityByWant: function (...args) { - console.warn("distributedSchedule.queryRemoteAbilityByWant interface mocked in the Previewer. " + - "How this interface works on the Previewer" + - " may be different from that on a real device.") - var array = new Array(); - array.push(AbilityInfoMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/entry.js b/runtime/main/extend/systemplugin/entry.js deleted file mode 100644 index b9cd8d4d..00000000 --- a/runtime/main/extend/systemplugin/entry.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2021 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 { mockSystemPlugin } from './index'; - -mockSystemPlugin() \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/featureAbility.js b/runtime/main/extend/systemplugin/featureAbility.js deleted file mode 100644 index 01fb9743..00000000 --- a/runtime/main/extend/systemplugin/featureAbility.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @Author: your name - * @Date: 2022-01-20 21:27:31 - * @LastEditTime: 2022-01-20 21:27:33 - * @LastEditors: your name - * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \third_party_jsframework\runtime\main\extend\systemplugin\featureAbility.js - */ -/* - * Copyright (c) 2021 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 mockFeatureAbility() { - let FeatureAbilityObject = { - getFeatureAbility: function () { - const ResultMock = { - code: '[PC preview] unknow code', - data: '[PC preview] unknow data' - } - const FeatureAbility = { - startAbility: function (...args) { - console.warn("Unable to use the FeatureAbility.startAbility method to start another ability in the" + - " Previewer. Perform this operation on the emulator or a real device instead.") - return new Promise((resolve, reject) => { - resolve(ResultMock); - }) - }, - startAbilityForResult: function (...args) { - console.warn("Unable to use the FeatureAbility.startAbilityForResult method to start another ability in" + - " the Previewer. Perform this operation on the emulator or a real device instead.") - return new Promise((resolve, reject) => { - resolve(ResultMock); - }) - }, - finishWithResult: function (...args) { - console.warn("FeatureAbility.finishWithResult 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(ResultMock); - }) - }, - callAbility: function (...args) { - console.warn("FeatureAbility.callAbility 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(JSON.stringify(ResultMock)); - }) - }, - continueAbility: function (...args) { - console.warn("FeatureAbility.continueAbility 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(ResultMock); - }) - }, - subscribeAbilityEvent: function (...args) { - console.warn("FeatureAbility.subscribeAbilityEvent 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(JSON.stringify(ResultMock)); - }) - }, - unsubscribeAbilityEvent: function (...args) { - console.warn("FeatureAbility.unsubscribeAbilityEvent 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(JSON.stringify(ResultMock)); - }) - } - } - return FeatureAbility - } - } - global.createLocalParticleAbility = function (...args) { - console.warn("createLocalParticleAbility 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(paramMock.paramObjectMock); - }) - } - global.FeatureAbility = FeatureAbilityObject.getFeatureAbility(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/fetch.js b/runtime/main/extend/systemplugin/fetch.js deleted file mode 100644 index a44b17ec..00000000 --- a/runtime/main/extend/systemplugin/fetch.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2021 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 mockFetch() { - global.sendGroupMessage = global.group.sendGroupMessage; - let GroupMessenger = { - create: function () { - let messenger = {}; - messenger.send = function (groupName, functionName, ...args) { - return new Promise(function (resolve, reject) { - let params = messenger.prepareArgs(...args); - sendGroupMessage(function (result) { - resolve(messenger.parseJsonResult(result)); - }, function (error) { - reject(messenger.parseJsonResult(error)); - }, groupName, functionName, ...params); - }) - }; - messenger.parseJsonResult = function (data) { - if (data && data.constructor == String) { - try { - data = JSON.parse(data); - } catch (jsonParseErr) { - console.warn("parse result exception: " + JSON.stringify(jsonParseErr)); - } - } - return data; - }; - messenger.prepareArgs = function (...args) { - let result = [...args]; - for (let i = 0; i < result.length; i++) { - if (typeof result[i] === 'function') { - result[i] = messenger.packageCallback(result[i]); - } - } - return result; - }; - messenger.packageCallback = function (func) { - return function (data) { - data = messenger.parseJsonResult(data); - if (!Array.isArray(data)) { - func(data); - } else { - func(...data); - } - }; - }; - return messenger; - } - }; - - let CommonCallback = { - commonCallback: function commonCallback(callback, flag, data, code) { - if (typeof callback === 'function') { - switch (flag) { - case 'success': - callback(data); - break; - case 'fail': - callback(data, code); - break; - case 'cancel': - callback(data); - break; - case 'complete': - callback(); - break; - default: - break; - } - } else { - console.warn('callback.' + flag + ' is not function or not present'); - } - } - }; - global.commonCallback = CommonCallback.commonCallback; - let CommonCallbackEx = { - commonCallbackEx: function commonCallbackEx(callback, result, pluginError) { - if ((callback === undefined) || ((callback.success === undefined) && (callback.fail === undefined) && (callback.complete === undefined))) { - return CommonCallbackEx.promiseMethod(result, pluginError); - } else { - return CommonCallbackEx.callbackMethod(callback, result, pluginError); - } - }, - promiseMethod: function promiseMethod(result, pluginError) { - if (pluginError != undefined) { - throw pluginError; - } - return result; - }, - callbackMethod: function callbackMethod(callback, result, pluginError) { - if (pluginError != undefined) { - commonCallback(callback.fail, 'fail', pluginError.data, pluginError.code); - commonCallback(callback.complete, 'complete'); - throw pluginError; - } - commonCallback(callback.success, 'success', result.data); - commonCallback(callback.complete, 'complete'); - return result; - }, - catching: function catching(promise, param) { - return promise.then(ret => commonCallbackEx(param, ret)) - .catch(err => commonCallbackEx(param, null, err)); - } - }; - global.commonCallbackEx = CommonCallbackEx.commonCallbackEx; - global.systemplugin.catching = CommonCallbackEx.catching; - - let FetchObject = { - getFetch: function () { - let fetch = {} - fetch.messenger = GroupMessenger.create(); - fetch.fetch = async function (param) { - return await CommonCallbackEx.catching(this.messenger.send("groupName", "fetch", param), param); - } - return fetch - } - } - - global.systemplugin.fetch = FetchObject.getFetch(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/geolocation.js b/runtime/main/extend/systemplugin/geolocation.js deleted file mode 100644 index 80999264..00000000 --- a/runtime/main/extend/systemplugin/geolocation.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete, getRandomArbitrary } from "./utils" - -export function mockGeolocation() { - const data = { - latitude: '121.61934', - longitude: '31.257907', - accuracy: '15', - time: '160332896544' - } - global.systemplugin.geolocation = { - getLocation: function (...args) { - console.warn("geolocation.getLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success(data) - hasComplete(args[0].complete) - }, - getLocationType: function (...args) { - console.warn("geolocation.getLocationType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const info = { types: ['gps', 'network'] } - args[0].success(info) - hasComplete(args[0].complete) - }, - getSupportedCoordTypes() { - console.warn("geolocation.getSupportedCoordTypes interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ["wgs84"] - }, - subscribe: function (...args) { - console.warn("geolocation.subscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeLocation) { - this.unsubscribeLocation = setInterval(() => { - data.latitude = getRandomArbitrary(121, 122) - data.longitude = getRandomArbitrary(31, 32) - data.accuracy = getRandomArbitrary(14, 18) - args[0].success(data) - }, 1000) - } - }, - unsubscribe: function () { - console.warn("geolocation.unsubscribe interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeLocation) - delete this.unsubscribeLocation - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/index.js b/runtime/main/extend/systemplugin/index.js deleted file mode 100644 index cb5e503d..00000000 --- a/runtime/main/extend/systemplugin/index.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2021-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 regeneratorRuntime from 'babel-runtime/regenerator' - -import { - mockAbilityFeatureAbility, - mockAbilityParticleAbility, - mockAbilityFormManager, - mockAbilityContinuationRegisterManager, - mockAbilityAbilityAgent, - mockAbilityFormBindingData -} from './ability' -import { mockAppAbilityManager } from './ohos/app' - -import { mockBattery } from './battery' -import { mockBrightness } from './brightness' -import { mockOhosBluetooth } from './ohos/bluetooth' -import { mockDistributedSchedule } from './distributedSchedule' -import { mockFetch } from './fetch' -import { mockFeatureAbility } from './featureAbility' -import { mockGeolocation } from './geolocation' -import { mockNotification } from './notification' -import { mockCommonEvent } from './ohos/commonEvent' -import { mockOhosRequest } from './ohos/request' -import { mockSensor } from './sensor' -import { mockStorage } from './storage' -import { mockStorageInfoManager } from './ohos/storageInfoManager' -import { mockSystemPackage } from './systemPackage' - -import { mockUserauth } from './userIAM' -import { mockVibrator } from './vibrator' -import { mockRequireNapiFun } from './napi' -import { mockAI } from './ai' -import { mockUserIAMUserAuth } from './ohos/userIAMuserAuth.js' -import { mockBundleManager } from './ohos/bundleManager' -import { mockPackageManager } from './ohos/packageManager' -import { mockCalendar } from "./calendar" - -export function mockSystemPlugin() { - global.regeneratorRuntime = regeneratorRuntime - - global.systemplugin = {} - global.ohosplugin = {} - - mockNotification() - mockCommonEvent() - mockFetch() - mockStorage() - mockVibrator() - mockSensor() - mockGeolocation() - mockBattery() - mockBrightness() - mockSystemPackage() - mockFeatureAbility() - mockOhosBluetooth() - mockUserauth() - mockDistributedSchedule() - mockOhosRequest() - mockAbilityFeatureAbility() - mockAbilityContinuationRegisterManager() - mockRequireNapiFun() - mockAbilityParticleAbility() - mockAbilityFormManager() - mockAbilityAbilityAgent() - mockAbilityFormBindingData() - mockAI() - mockStorageInfoManager() - mockAppAbilityManager() - mockUserIAMUserAuth() - mockBundleManager() - mockPackageManager() - mockCalendar() -} diff --git a/runtime/main/extend/systemplugin/multimedia.js b/runtime/main/extend/systemplugin/multimedia.js deleted file mode 100644 index 5bd3485d..00000000 --- a/runtime/main/extend/systemplugin/multimedia.js +++ /dev/null @@ -1,1118 +0,0 @@ -/* - * Copyright (c) 2021 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" - -const sizeMock = { - height: "[PC Preview] unknow height", - width: "[PC Preview] unknow width" -} -const imageInfoMock = { - size: sizeMock, - pixelFortmat: "[PC Preview] unknow pixelFortmat", - colorSpace: "[PC Preview] unknow colorSpace", - alphaType: "[PC Preview] unknow alphaType" -} -export const PixelMapMock = { - isEditable: "[PC Preview]: unknow isEditable", - readPixelsToBuffer: function (...args) { - console.warn("PixelMap.readPixelsToBuffer 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - readPixels: function (...args) { - console.warn("PixelMap.readPixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - writePixels: function (...args) { - console.warn("PixelMap.writePixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - writeBufferToPixels: function (...args) { - console.warn("PixelMap.writeBufferToPixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getImageInfo: function (...args) { - console.warn("PixelMap.getImageInfo 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, imageInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(imageInfoMock); - }) - } - }, - getBytesNumberPerRow: function (...args) { - console.warn("PixelMap.getBytesNumberPerRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getPixelBytesNumber: function (...args) { - console.warn("PixelMap.getPixelBytesNumber interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - release: function (...args) { - console.warn("PixelMap.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } -} - -export function mockMultimediaImage() { - global.systemplugin.multimedia = {} - const imageSourceMock = { - getImageInfo: function (...args) { - console.warn("ImageSource.getImageInfo 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, imageInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(imageInfoMock); - }) - } - }, - release: function (...args) { - console.warn("ImageSource.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - createPixelMap: function (...args) { - console.warn("ImageSource.createPixelMap 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, PixelMapMock); - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - getImageProperty: function (...args) { - console.warn("ImageSource.getImageProperty 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - supportedFormats: "[PC Preview] unknow supportedFormats" - } - const imagePackerMock = { - packing: function (...args) { - console.warn("ImagePacker.packing 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - release: function (...args) { - console.warn("ImagePacker.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - supportedFormats: "[PC Preview] unknow supportedFormats" - } - const PixelMapFormatMock = { - UNKNOWN: "[PC Preview]: unknow UNKNOWN", - RGB_565: "[PC Preview]: unknow RGB_565", - RGBA_8888: "[PC Preview]: unknow RGBA_8888", - } - const PropertyKeyMock = { - BITS_PER_SAMPLE: "[PC Preview]: unknow BITS_PER_SAMPLE", - ORIENTATION: "[PC Preview]: unknow ORIENTATION", - IMAGE_LENGTH: "[PC Preview]: unknow IMAGE_LENGTH", - GPS_LATITUDE: "[PC Preview]: unknow GPS_LATITUDE", - GPS_LONGITUDE: "[PC Preview]: unknow GPS_LONGITUDE", - GPS_LATITUDE_REF: "[PC Preview]: unknow GPS_LATITUDE_REF", - GPS_LONGITUDE_REF: "[PC Preview]: unknow GPS_LONGITUDE_REF" - } - - global.systemplugin.multimedia.image = { - PixelMapFormat: PixelMapFormatMock, - PropertyKey: PropertyKeyMock, - createImageSource: function () { - console.warn("multimedia.image.createImageSource interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return imageSourceMock; - }, - createImagePacker: function () { - console.warn("multimedia.image.createImagePacker interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return imagePackerMock; - } - } -} - -export function mockMultimediaMedia() { - const MediaType = { - VIDEO: "[PC Preview]: unknow VIDEO", - AUDIO: "[PC Preview]: unknow AUDIO", - } - const ComposerTrack = { - trackId: "[PC Preview]: unknow trackId", - type: MediaType, - duration: "[PC Preview]: unknow duration" - } - const sizeMock = { - height: "[PC Preview] unknow height", - width: "[PC Preview] unknow width" - } - const DecoderFrameMock = { - size: sizeMock, - pts: "[PC Preview] unknow pts", - buffer: "[PC Preview] unknow buffer" - } - const audioPlayerMock = { - play: function () { - console.warn("AudioPlayer.play interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - pause: function () { - console.warn("AudioPlayer.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - stop: function () { - console.warn("AudioPlayer.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - reset: function () { - console.warn("AudioPlayer.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - seek: function (...args) { - console.warn("AudioPlayer.seek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - setVolume: function (...args) { - console.warn("AudioPlayer.setVolume interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - release: function () { - console.warn("AudioPlayer.release interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - src: "[PC Preview] unknow src", - loop: "[PC Preview] unknow loop", - currentTime: "[PC Preview] unknow currentTime", - duration: "[PC Preview] unknow duration", - state: "[PC Preview] unknow state", - on: function (...args) { - console.warn("AudioPlayer.on 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') { - if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'timeUpdate') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else { - args[len - 1].call(this); - } - } - } - } - const audioRecorderMock = { - prepare: function () { - console.warn("AudioRecorder.prepare interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - start: function () { - console.warn("AudioRecorder.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - pause: function () { - console.warn("AudioRecorder.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - resume: function () { - console.warn("AudioRecorder.resume interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stop: function () { - console.warn("AudioRecorder.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - release: function () { - console.warn("AudioRecorder.release interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - reset: function () { - console.warn("AudioRecorder.reset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("AudioRecorder.on 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') { - if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - args[len - 1].call(this); - } - } - } - } - const MediaComposerMock = { - extractSource: function (...args) { - console.warn("MediaComposer.extractSource 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 - var composerTracks = new Array(ComposerTrack) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, composerTracks); - } else { - return new Promise((resolve, reject) => { - resolve(composerTracks); - }) - } - }, - configOutput: function (...args) { - console.warn("MediaComposer.configOutput 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - addTrack: function (...args) { - console.warn("MediaComposer.addTrack 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeTrack: function (...args) { - console.warn("MediaComposer.removeTrack 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - compose: function (...args) { - console.warn("MediaComposer.compose 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - release: function (...args) { - console.warn("MediaComposer.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const mediaDecoderMock = { - start: function (...args) { - console.warn("MediaDecoder.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - seek: function (...args) { - console.warn("MediaDecoder.seek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - stop: function () { - console.warn("MediaDecoder.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - release: function () { - console.warn("MediaDecoder.release interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - requestFrame: function () { - console.warn("MediaDecoder.requestFrame interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("MediaDecoder.on 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') { - if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'start') { - args[len - 1].call(this, sizeMock); - } else if (args[0] == 'frameChange') { - args[len - 1].call(this, sizeMock); - } else if (args[0] == 'frameAvailable') { - args[len - 1].call(this, DecoderFrameMock); - } else { - args[len - 1].call(this); - } - } - } - } - const MimeTypeMock = '[PC Preview] unknow mimeType' - const CodecDescriptionMock = { - name: "[PC Preview] unknow name", - mimeTypes: new Array(MimeTypeMock), - isAudio: "[PC Preview] unknow isAudio", - isEncoder: "[PC Preview] unknow isEncoder", - isSoftware: "[PC Preview] unknow isSoftware", - } - const codecDescriptionHelperMock = { - findDecoder: function (...args) { - console.warn("CodecDescriptionHelper.findDecoder 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, CodecDescriptionMock); - } else { - return new Promise((resolve, reject) => { - resolve(CodecDescriptionMock); - }) - } - }, - findEncoder: function (...args) { - console.warn("CodecDescriptionHelper.findEncoder 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, CodecDescriptionMock); - } else { - return new Promise((resolve, reject) => { - resolve(CodecDescriptionMock); - }) - } - }, - getSupportedDecoders: function (...args) { - console.warn("CodecDescriptionHelper.getSupportedDecoders 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 - var CodecDescriptionArray = new Array(CodecDescriptionMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CodecDescriptionArray); - } else { - return new Promise((resolve, reject) => { - resolve(CodecDescriptionArray); - }) - } - }, - getSupportedEncoders: function (...args) { - console.warn("CodecDescriptionHelper.getSupportedEncoders 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 - var CodecDescriptionArray = new Array(CodecDescriptionMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CodecDescriptionArray); - } else { - return new Promise((resolve, reject) => { - resolve(CodecDescriptionArray); - }) - } - }, - getSupportedMimes: function (...args) { - console.warn("CodecDescriptionHelper.getSupportedMimes 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 - var MimeTypeArray = new Array(MimeTypeMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, MimeTypeArray); - } else { - return new Promise((resolve, reject) => { - resolve(MimeTypeArray); - }) - } - }, - isDecoderSupportedByFormat: function (...args) { - console.warn("CodecDescriptionHelper.isDecoderSupportedByFormat 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isDecoderSupportedByMime: function (...args) { - console.warn("CodecDescriptionHelper.isDecoderSupportedByMime 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isEncoderSupportedByFormat: function (...args) { - console.warn("CodecDescriptionHelper.isEncoderSupportedByFormat 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isEncoderSupportedByMime: function (...args) { - console.warn("CodecDescriptionHelper.findDisEncoderSupportedByMime 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - global.systemplugin.multimedia.media = { - MediaType: { - VIDEO: 0, - AUDIO: 1, - }, - createAudioPlayer: function () { - console.warn("multimedia.media.createAudioPlayer interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return audioPlayerMock; - }, - createAudioRecorder: function () { - console.warn("multimedia.media.createAudioRecorder interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return audioRecorderMock; - }, - createMediaComposer: function () { - console.warn("multimedia.media.createMediaComposer interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return MediaComposerMock; - }, - createMediaDecoder: function () { - console.warn("multimedia.media.createMediaDecoder interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return mediaDecoderMock; - }, - getCodecDescriptionHelper: function () { - console.warn("multimedia.media.getCodecDescriptionHelper interface mocked in the Previewer. How this" + - " interface works on the Previewer may be different from that on a real device.") - return codecDescriptionHelperMock; - } - } -} - -export function mockMultimediaMedialibrary() { - const FileAssetMock = { - id: "[PC Preview] unknow id", - uri: "[PC Preview] unknow uri", - thumbnailUri: "[PC Preview] unknow thumbnailUri", - mimeType: "[PC Preview] unknow mimeType", - mediaType: "[PC Preview] unknow mediaType", - displayName: "[PC Preview] unknow displayName", - title: "[PC Preview] unknow title", - size: "[PC Preview] unknow size", - albumId: "[PC Preview] unknow albumId", - albumName: "[PC Preview] unknow albumName", - dateAdded: "[PC Preview] unknow dateAdded", - dateModified: "[PC Preview] unknow dateMidified", - dateTaken: "[PC Preview] unknow dateTaken", - orientation: "[PC Preview] unknow orientation", - width: "[PC Preview] unknow width", - height: "[PC Preview] unknow height", - extendedValues: "[PC Preview] unknow extendedValues", - } - const MediaLibraryMock = { - storeMediaAsset: function (...args) { - console.warn("MediaLibrary.storeMediaAsset 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - startImagePreview: function (...args) { - console.warn("MediaLibrary.startImagePreview 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - startMediaSelect: function (...args) { - console.warn("MediaLibrary.startMediaSelect 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getFileAssets: function (...args) { - console.warn("MediaLibrary.getFileAssets 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FetchFileResultMock) - : new Promise((resolve, reject) => { - resolve(FetchFileResultMock); - }) - }, - getAlbums: function (...args) { - console.warn("MediaLibrary.getAlbums 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 - var albumsMock = new Array(AlbumMock) - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, albumsMock) - : new Promise((resolve, reject) => { - resolve(albumsMock); - }) - }, - on: function (...args) { - console.warn("MediaLibrary.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - off: function (...args) { - console.warn("MediaLibrary.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } - const FetchFileResultMock = { - getCount: function (...args) { - console.warn("FetchFileResult.getCount interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - isAfterLast: function (...args) { - console.warn("FetchFileResult.isAfterLast interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - close: function (...args) { - console.warn("FetchFileResult.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - getFirstObject: function (...args) { - console.warn("FetchFileResult.getFirstObject 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FileAssetMock) - : new Promise((resolve, reject) => { - resolve(FileAssetMock); - }) - }, - getLastObject: function (...args) { - console.warn("FetchFileResult.getLastObject 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FileAssetMock) - : new Promise((resolve, reject) => { - resolve(FileAssetMock); - }) - }, - getNextObject: function (...args) { - console.warn("FetchFileResult.getNextObject 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FileAssetMock) - : new Promise((resolve, reject) => { - resolve(FileAssetMock); - }) - }, - getPositionObject: function (...args) { - console.warn("FetchFileResult.getPositionObject 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FileAssetMock) - : new Promise((resolve, reject) => { - resolve(FileAssetMock); - }) - }, - getAllObject: function (...args) { - console.warn("FetchFileResult.getAllObject 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 - var fileAssets = new Array(FileAssetMock) - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, fileAssets) - : new Promise((resolve, reject) => { - resolve(fileAssets); - }) - } - } - const AlbumMock = { - albumId: "[PC Preview] unknow albumId", - albumName: "[PC Preview] unknow albumName", - path: "[PC Preview] unknow path", - dateModified: "[PC Preview] unknow dateModified", - getFileAssets: function (...args) { - console.warn("Album.getFileAssets 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, FetchFileResultMock) - : new Promise((resolve, reject) => { - resolve(FetchFileResultMock); - }) - } - } - const AVMetadataHelperMock = { - setSource: function (...args) { - console.warn("AVMetadataHelper.setSource 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock) - : new Promise((resolve, reject) => { - resolve(); - }) - }, - fetchVideoPixelMapByTime: function (...args) { - console.warn("AVMetadataHelper.fetchVideoPixelMapByTime 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock) - : new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - }, - resolveMetadata: function (...args) { - console.warn("AVMetadataHelper.resolveMetadata 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) - : new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - }, - release: function (...args) { - console.warn("AVMetadataHelper.release 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 - var isCallBack = typeof args[len - 1] === 'function' - return isCallBack ? args[len - 1].call(this, paramMock.businessErrorMock) - : new Promise((resolve, reject) => { - resolve(); - }) - } - } - global.systemplugin.multimedia.mediaLibrary = { - getMediaLibrary: function () { - console.warn("multimedia.mediaLibrary.getMediaLibrary interface mocked in the Previewer. How this interface" + - " works on the Previewer may be different from that on a real device.") - return MediaLibraryMock; - }, - createAVMetadataHelper: function () { - console.warn("multimedia.mediaLibrary.createAVMetadataHelper interface mocked in the Previewer. How this" + - " interface works on the Previewer may be different from that on a real device.") - return AVMetadataHelperMock; - }, - } -} - -export function mockMultimediaAudio() { - const interruptActionMock = { - actionType: "[PC Preview] unknow actionType", - type: "[PC Preview] unknow type", - hint: "[PC Preview] unknow hint", - activated: "[PC Preview] unknow activated", - } - const AudioEncodingFormatMock = "[PC Preview]: unknow AudioEncodingFormat" - const DeviceRoleMock = "[PC Preview]: unknow DeviceRole" - const DeviceTypeMock = "[PC Preview]: unknow DeviceType" - const AudioDeviceDescriptorMock = { - id: "[PC Preview]: unknow id", - name: "[PC Preview]: unknow name", - address: "[PC Preview]: unknow address", - sampleRates: new Array(paramMock.paramNumberMock), - channelCounts: new Array(paramMock.paramNumberMock), - channelIndexMasks: new Array(paramMock.paramNumberMock), - channelMasks: new Array(paramMock.paramNumberMock), - encodingFormats: new Array(AudioEncodingFormatMock), - deviceRole: DeviceRoleMock, - deviceType: DeviceTypeMock, - } - const DeviceChangeActionMock = { - type: "[PC Preview]: unknow type", - deviceDescriptors: AudioDeviceDescriptorMock, - } - const AudioRingModeMock = '[PC Preview]: unknow AudioRingMode' - const audioManagerMock = { - on: function (...args) { - console.warn("AudioManager.on 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') { - if (args[0] == 'interrupt') { - args[len - 1].call(this, interruptActionMock); - } else if (args[0] == 'deviceChange') { - args[len - 1].call(this, DeviceChangeActionMock); - } else { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("AudioManager.off 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') { - if (args[0] == 'interrupt') { - args[len - 1].call(this, interruptActionMock); - } else if (args[0] == 'deviceChange') { - args[len - 1].call(this); - } else { - args[len - 1].call(this); - } - } - }, - getDevices: function (...args) { - console.warn("AudioManager.getDevices interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var AudioDeviceDescriptors = new Array(AudioDeviceDescriptorMock) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioDeviceDescriptors); - } else { - return new Promise((resolve, reject) => { - resolve(AudioDeviceDescriptors); - }) - } - }, - isDeviceActive: function (...args) { - console.warn("AudioManager.isDeviceActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDeviceActive: function (...args) { - console.warn("AudioManager.setDeviceActive 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setRingerMode: function (...args) { - console.warn("AudioManager.setRingerMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAudioParameter: function (...args) { - console.warn("AudioManager.setAudioParameter 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setVolume: function (...args) { - console.warn("AudioManager.setVolume 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getVolume: function (...args) { - console.warn("AudioManager.getVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinVolume: function (...args) { - console.warn("AudioManager.getMinVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMaxVolume: function (...args) { - console.warn("AudioManager.getMaxVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMute: function (...args) { - console.warn("AudioManager.isMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - mute: function (...args) { - console.warn("AudioManager.mute 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isActive: function (...args) { - console.warn("AudioManager.isActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isMicrophoneMute: function (...args) { - console.warn("AudioManager.isMicrophoneMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setMicrophoneMute: function (...args) { - console.warn("AudioManager.setMicrophoneMute 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAudioParameter: function (...args) { - console.warn("AudioManager.getAudioParameter 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getRingerMode: function (...args) { - console.warn("AudioManager.getRingerMode 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, AudioRingModeMock); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRingModeMock); - }) - } - } - } - global.systemplugin.multimedia.audio = { - AudioVolumeType: { - RINGTONE: 2, - MEDIA: 3, - }, - ContentType: { - CONTENT_TYPE_UNKNOWN: 0, - CONTENT_TYPE_SPEECH: 1, - CONTENT_TYPE_MUSIC: 2, - CONTENT_TYPE_MOVIE: 3, - CONTENT_TYPE_SONIFICATION: 4, - }, - StreamUsage: { - STREAM_USAGE_UNKNOWN: 0, - STREAM_USAGE_MEDIA: 1, - STREAM_USAGE_VOICE_COMMUNICATION: 2, - STREAM_USAGE_NOTIFICATION_RINGTONE: 6, - }, - DeviceFlag: { - OUTPUT_DEVICES_FLAG: 1, - INPUT_DEVICES_FLAG: 2, - ALL_DEVICES_FLAG: 3, - }, - ActiveDeviceType: { - SPEAKER: 2, - BLUETOOTH_SCO: 7, - }, - AudioRingMode: { - RINGER_MODE_NORMAL: 2, - RINGER_MODE_SILENT: 0, - RINGER_MODE_VIBRATE: 1, - }, - getAudioManager: function () { - console.warn("multimedia.media.getAudioManager interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return audioManagerMock; - } - } -} diff --git a/runtime/main/extend/systemplugin/napi/@internal/ets/lifecycle.js b/runtime/main/extend/systemplugin/napi/@internal/ets/lifecycle.js deleted file mode 100644 index 69bdb7a9..00000000 --- a/runtime/main/extend/systemplugin/napi/@internal/ets/lifecycle.js +++ /dev/null @@ -1,258 +0,0 @@ -/* - * 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 { FormBindingData } from "../ohos_application_formBindingData" -import { FormState } from "../ohos_application_formInfo" -import { paramMock } from "../../utils" -import { RemoteObjectClass } from "../ohos_rpc" -import { ResultSet, PacMapType } from "../ohos_ability_featureAbility" - -const DataAbilityResult = { - uri: "[PC Preview] unknow uri", - count: "[PC Preview] unknow count", -} -export const LifecycleForm = { - onCreate: function (...args) { - console.warn("LifecycleForm.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return FormBindingData; - }, - onCastToNormal: function (...args) { - console.warn("LifecycleForm.onCastToNormal interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onUpdate: function (...args) { - console.warn("LifecycleForm.onUpdate interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onVisibilityChange: function (...args) { - console.warn("LifecycleForm.onVisibilityChange interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onEvent: function (...args) { - console.warn("LifecycleForm.onEvent interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onDestroy: function (...args) { - console.warn("LifecycleForm.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onAcquireFormState: function (...args) { - console.warn("LifecycleForm.onAcquireFormState interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return FormState; - }, - onShare: function (...args) { - console.warn("LifecycleForm.onShare interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return {"key": "unknow any"}; - }, -} -export const LifecycleApp = { - onShow: function () { - console.warn("LifecycleApp.onShow interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onHide: function () { - console.warn("LifecycleApp.onHide interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onDestroy: function () { - console.warn("LifecycleApp.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onCreate: function () { - console.warn("LifecycleApp.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onWindowDisplayModeChanged: function (...args) { - console.warn("LifecycleApp.onWindowDisplayModeChanged interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onStartContinuation: function () { - console.warn("LifecycleApp.onStartContinuation interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - onSaveData: function (...args) { - console.warn("LifecycleApp.onSaveData interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - onCompleteContinuation: function (...args) { - console.warn("LifecycleApp.onCompleteContinuation interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onRestoreData: function (...args) { - console.warn("LifecycleApp.onRestoreData interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onRemoteTerminated: function () { - console.warn("LifecycleApp.onRemoteTerminated interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onSaveAbilityState: function (...args) { - console.warn("LifecycleApp.onSaveAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onRestoreAbilityState: function (...args) { - console.warn("LifecycleApp.onRestoreAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onInactive: function () { - console.warn("LifecycleApp.onInactive interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onActive: function () { - console.warn("LifecycleApp.onActive interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onNewWant: function (...args) { - console.warn("LifecycleApp.onNewWant interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onMemoryLevel: function (...args) { - console.warn("LifecycleApp.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, -} -export const LifecycleService = { - onStart: function () { - console.warn("LifecycleService.onStart interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onCommand: function (...args) { - console.warn("LifecycleService.onCommand interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onStop: function () { - console.warn("LifecycleService.onStop interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onConnect: function (...args) { - console.warn("LifecycleService.onConnect interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return new RemoteObjectClass(); - }, - onDisconnect: function (...args) { - console.warn("LifecycleService.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - onReconnect: function (...args) { - console.warn("LifecycleService.onReconnect interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, -} -export const LifecycleData = { - update: function (...args) { - console.warn("LifecycleData.update 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.paramNumberMock); - } - }, - query: function (...args) { - console.warn("LifecycleData.query 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, ResultSet); - } - }, - delete: function (...args) { - console.warn("LifecycleData.delete 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.paramNumberMock); - } - }, - normalizeUri: function (...args) { - console.warn("LifecycleData.normalizeUri 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); - } - }, - batchInsert: function (...args) { - console.warn("LifecycleData.batchInsert 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.paramNumberMock); - } - }, - denormalizeUri: function (...args) { - console.warn("LifecycleData.denormalizeUri 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); - } - }, - insert: function (...args) { - console.warn("LifecycleData.insert 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.paramNumberMock); - } - }, - openFile: function (...args) { - console.warn("LifecycleData.openFile 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.paramNumberMock); - } - }, - getFileTypes: function (...args) { - console.warn("LifecycleData.getFileTypes 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]); - } - }, - onInitialized: function (...args) { - console.warn("LifecycleData.onInitialized interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - getType: function (...args) { - console.warn("LifecycleData.getType 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); - } - }, - executeBatch: function (...args) { - console.warn("LifecycleData.executeBatch 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, [DataAbilityResult]); - } - }, - call: function (...args) { - console.warn("LifecycleData.call 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, PacMapType); - } - }, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/abilityResult.js b/runtime/main/extend/systemplugin/napi/ability/abilityResult.js deleted file mode 100644 index ce560932..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/abilityResult.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { WantClass } from "../ohos_application_Want" - -export const AbilityResult = { - resultCode: "[PC Preview] unknow resultCode", - want: new WantClass(), -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/connectOptions.js b/runtime/main/extend/systemplugin/napi/ability/connectOptions.js deleted file mode 100644 index b07a5d9a..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/connectOptions.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 ConnectOptions = { - onConnect: function (...args) { - console.warn("ConnectOptions.onConnect interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - onDisconnect: function (...args) { - console.warn("ConnectOptions.onDisconnect interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - onFailed: function (...args) { - console.warn("ConnectOptions.onFailed interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/dataAbilityHelper.js b/runtime/main/extend/systemplugin/napi/ability/dataAbilityHelper.js deleted file mode 100755 index c89704b7..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/dataAbilityHelper.js +++ /dev/null @@ -1,289 +0,0 @@ -/* - * 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" - -const DataAbilityResult = { - uri: "[PC Preview] unknow uri", - count: "[PC Preview] unknow count" -} -const ResultSet = { - columnNames: [paramMock.paramStringMock], - columnCount: "[PC Preview] unknow columnCount", - rowCount: "[PC Preview] unknow rowCount", - rowIndex: "[PC Preview] unknow rowIndex", - isAtFirstRow: "[PC Preview] unknow isAtFirstRow", - isAtLastRow: "[PC Preview] unknow isAtLastRow", - isEnded: "[PC Preview] unknow isEnded", - isStarted: "[PC Preview] unknow isStarted", - isClose: "[PC Preview] unknow isClose", - getColumnIndex: function (...args) { - console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getColumnName: function (...args) { - console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - goTo: function (...args) { - console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToRow: function (...args) { - console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToLastRow: function (...args) { - console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToFirstRow: function (...args) { - console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToNextRow: function (...args) { - console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToPreviousRow: function (...args) { - console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getBlob: function (...args) { - console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }, - getString: function (...args) { - console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getLong: function (...args) { - console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getDouble: function (...args) { - console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isColumnNull: function (...args) { - console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - close: function () { - console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } -} - -export const PacMap = {key:{}} -export const DataAbilityHelper = { - openFile: function (...args) { - console.warn("dataAbilityHelper.openFile 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - on: function (...args) { - console.warn("dataAbilityHelper.on 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) - } - }, - off: function (...args) { - console.warn("dataAbilityHelper.off 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) - } - }, - call: function (...args) { - console.warn("dataAbilityHelper.call 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, PacMap) - } else { - return new Promise((resolve) => { - resolve(PacMap); - }) - } - }, - getType: function (...args) { - console.warn("dataAbilityHelper.getType 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); - }) - } - }, - getFileTypes: function (...args) { - console.warn("dataAbilityHelper.getFileTypes 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]); - }) - } - }, - normalizeUri: function (...args) { - console.warn("dataAbilityHelper.normalizeUri 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); - }) - } - }, - denormalizeUri: function (...args) { - console.warn("dataAbilityHelper.denormalizeUri 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); - }) - } - }, - notifyChange: function (...args) { - console.warn("dataAbilityHelper.notifyChange 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) - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - insert: function (...args) { - console.warn("dataAbilityHelper.insert 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - batchInsert: function (...args) { - console.warn("dataAbilityHelper.batchInsert 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delete: function (...args) { - console.warn("dataAbilityHelper.delete 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - update: function (...args) { - console.warn("dataAbilityHelper.update 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - query: function (...args) { - console.warn("dataAbilityHelper.query 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, ResultSet) - } else { - return new Promise((resolve) => { - resolve(ResultSet); - }) - } - }, - call: function (...args) { - console.warn("dataAbilityHelper.call 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, PacMap) - } else { - return new Promise((resolve) => { - resolve(PacMap); - }) - } - }, - executeBatch: function (...args) { - console.warn("dataAbilityHelper.executeBatch 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, [DataAbilityResult]) - } else { - return new Promise((resolve) => { - resolve([DataAbilityResult]); - }) - } - } -} diff --git a/runtime/main/extend/systemplugin/napi/ability/dataAbilityOperation.js b/runtime/main/extend/systemplugin/napi/ability/dataAbilityOperation.js deleted file mode 100755 index 7337d35a..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/dataAbilityOperation.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { mockDataAbility } from "../ohos_data_dataAbility" - -export const DataAbilityOperation = { - uri: "[PC Preview] unknow uri", - type: { - TYPE_INSERT: 1, - TYPE_UPDATE: 2, - TYPE_DELETE: 3, - TYPE_ASSERT: 4 - }, - valuesBucket: {key:{}}, - valueBackReferences: {key:{}}, - predicates: mockDataAbility().DataAbilityPredicates, - predicatesBackReferences: new Map([[paramMock.paramNumberMock, paramMock.paramNumberMock]]), - interrupted: "[PC Preview] unknow interrupted", - expectedCount: "[PC Preview] unknow expectedCount" -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/dataAbilityResult.js b/runtime/main/extend/systemplugin/napi/ability/dataAbilityResult.js deleted file mode 100755 index b2905210..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/dataAbilityResult.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 DataAbilityResult = { - uri: "[PC Preview] unknow uri", - count: "[PC Preview] unknow count", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/startAbilityParameter.js b/runtime/main/extend/systemplugin/napi/ability/startAbilityParameter.js deleted file mode 100644 index 626ad3ac..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/startAbilityParameter.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { WantClass } from "../ohos_application_Want" - -export const StartAbilityParameter = { - want: new WantClass(), - abilityStartSetting: {}, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ability/want.js b/runtime/main/extend/systemplugin/napi/ability/want.js deleted file mode 100644 index 57e17e11..00000000 --- a/runtime/main/extend/systemplugin/napi/ability/want.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 Want = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - type: "[PC Preview] unknow type", - flags: "[PC Preview] unknow flags", - action: "[PC Preview] unknow action", - parameters: {}, - entities: [paramMock.paramStringMock] -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/app/appVersionInfo.js b/runtime/main/extend/systemplugin/napi/app/appVersionInfo.js deleted file mode 100644 index b482c73b..00000000 --- a/runtime/main/extend/systemplugin/napi/app/appVersionInfo.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 AppVersionInfo = { - appName: "[PC Preview] unknow appName", - versionCode: "[PC Preview] unknow versionCode", - versionName: "[PC Preview] unknow versionName", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/app/context.js b/runtime/main/extend/systemplugin/napi/app/context.js deleted file mode 100644 index a6c2338f..00000000 --- a/runtime/main/extend/systemplugin/napi/app/context.js +++ /dev/null @@ -1,317 +0,0 @@ -/* - * 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 { ProcessInfo } from "./processInfo" -import { AppVersionInfo } from "./appVersionInfo" -import { AbilityInfo } from "../bundle/abilityInfo" -import { ApplicationInfo } from "../bundle/applicationInfo" -import { ElementName } from "../bundle/elementName" -import { HapModuleInfo } from "../bundle/hapModuleInfo" - -const DisplayOrientation = { - UNSPECIFIED: "[PC preview] unknown is UNSPECIFIED", - LANDSCAPE: "[PC preview] unknown is LANDSCAPE", - PORTRAIT: "[PC preview] unknown is PORTRAIT", - FOLLOW_RECENT: "[PC preview] unknown is FOLLOW_RECENT", - LANDSCAPE_INVERTED: "[PC preview] unknown is LANDSCAPE_INVERTED", - PORTRAIT_INVERTED: "[PC preview] unknown is PORTRAIT_INVERTED", - AUTO_ROTATION: "[PC preview] unknown is AUTO_ROTATION", - AUTO_ROTATION_LANDSCAPE: "[PC preview] unknown is AUTO_ROTATION_LANDSCAPE", - AUTO_ROTATION_PORTRAIT: "[PC preview] unknown is AUTO_ROTATION_PORTRAIT", - AUTO_ROTATION_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_RESTRICTED", - AUTO_ROTATION_LANDSCAPE_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_LANDSCAPE_RESTRICTED", - AUTO_ROTATION_PORTRAIT_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_PORTRAIT_RESTRICTED", - LOCKED: "[PC preview] unknown is LOCKED", -} -export const Context = { - getOrCreateLocalDir: function (...args) { - console.warn("Context.getOrCreateLocalDir 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - verifyPermission: function (...args) { - console.warn("Context.verifyPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - requestPermissionsFromUser: function (...args) { - console.warn("Context.requestPermissionsFromUser 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, PermissionRequestResult); - } else { - return new Promise((resolve, reject) => { - resolve(PermissionRequestResult); - }) - } - }, - getApplicationInfo: function (...args) { - console.warn("Context.getApplicationInfo 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, ApplicationInfo); - } else { - return new Promise((resolve, reject) => { - resolve(ApplicationInfo); - }) - } - }, - getBundleName: function (...args) { - console.warn("Context.getBundleName 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getDisplayOrientation: function (...args) { - console.warn("Context.getDisplayOrientation 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, DisplayOrientation); - } else { - return new Promise((resolve, reject) => { - resolve(DisplayOrientation); - }) - } - }, - setDisplayOrientation: function (...args) { - console.warn("Context.setDisplayOrientation 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setShowOnLockScreen: function (...args) { - console.warn("Context.setShowOnLockScreen 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setWakeUpScreen: function (...args) { - console.warn("Context.setWakeUpScreen 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getProcessInfo: function (...args) { - console.warn("Context.getProcessInfo 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, ProcessInfo); - } else { - return new Promise((resolve, reject) => { - resolve(ProcessInfo); - }) - } - }, - getElementName: function (...args) { - console.warn("Context.getElementName 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, ElementName); - } else { - return new Promise((resolve, reject) => { - resolve(ElementName); - }) - } - }, - getProcessName: function (...args) { - console.warn("Context.getProcessName 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getCallingBundle: function (...args) { - console.warn("Context.getCallingBundle 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getFilesDir: function (...args) { - console.warn("Context.getFilesDir 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getCacheDir: function (...args) { - console.warn("Context.getCacheDir 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getOrCreateDistributedDir: function (...args) { - console.warn("Context.getOrCreateDistributedDir 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAppType: function (...args) { - console.warn("Context.getAppType 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getHapModuleInfo: function (...args) { - console.warn("Context.getHapModuleInfo 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, HapModuleInfo); - } else { - return new Promise((resolve, reject) => { - resolve(HapModuleInfo); - }) - } - }, - getAppVersionInfo: function (...args) { - console.warn("Context.getAppVersionInfo 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, AppVersionInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AppVersionInfo); - }) - } - }, - getApplicationContext: function () { - console.warn("Context.getApplicationContext interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Context; - }, - getAbilityInfo: function (...args) { - console.warn("Context.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 (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AbilityInfo); - }) - } - }, - isUpdatingConfigurations: function (...args) { - console.warn("Context.isUpdatingConfigurations 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - printDrawnCompleted: function (...args) { - console.warn("Context.printDrawnCompleted 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } -} -export const PermissionRequestResult = { - requestCode: "[PC Preview] unknow requestCode", - permissions: [paramMock.paramStringMock], - authResults: [paramMock.paramNumberMock], -} -export const PermissionOptions = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/app/processInfo.js b/runtime/main/extend/systemplugin/napi/app/processInfo.js deleted file mode 100644 index 0fcda95b..00000000 --- a/runtime/main/extend/systemplugin/napi/app/processInfo.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 ProcessInfo = { - pid: "[PC Preview] unknow pid", - processName: "[PC Preview] unknow processName", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/AbilityContext.js b/runtime/main/extend/systemplugin/napi/application/AbilityContext.js deleted file mode 100644 index c25d3f00..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AbilityContext.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2021 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 { ContextClass } from "./Context" -import { Configuration } from "../ohos_application_Configuration" -import { Caller } from "../ohos_application_Ability" -import { AbilityInfo } from "../bundle/abilityInfo" -import { HapModuleInfo } from "../bundle/hapModuleInfo" -import { AbilityResult } from "../ability/abilityResult" -import { PermissionRequestResultClass } from "./PermissionRequestResult" - -export const AbilityContextClass = class AbilityContext extends ContextClass { - constructor() { - super(); - console.warn('Ability.AbilityContext.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.abilityInfo = AbilityInfo; - this.currentHapModuleInfo = HapModuleInfo; - this.config = Configuration; - this.startAbility = function (...args) { - console.warn("Ability.AbilityContext.startAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startAbilityByCall = function (...args) { - console.warn("Ability.AbilityContext.startAbilityByCall 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(Caller); - }) - }; - this.startAbilityWithAccount = function (...args) { - console.warn("Ability.AbilityContext.startAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startAbilityForResult = function (...args) { - console.warn("Ability.AbilityContext.startAbilityForResult 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, AbilityResult); - } else { - return new Promise((resolve, reject) => { - resolve(AbilityResult); - }) - } - }; - this.startAbilityForResultWithAccount = function (...args) { - console.warn("Ability.AbilityContext.startAbilityForResultWithAccount 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, AbilityResult); - } else { - return new Promise((resolve, reject) => { - resolve(AbilityResult); - }) - } - }; - this.startServiceExtensionAbility = function (...args) { - console.warn("Ability.AbilityContext.startServiceExtensionAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startServiceExtensionAbilityWithAccount = function (...args) { - console.warn("Ability.AbilityContext.startServiceExtensionAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.stopServiceExtensionAbility = function (...args) { - console.warn("Ability.AbilityContext.stopServiceExtensionAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.stopServiceExtensionAbilityWithAccount = function (...args) { - console.warn("Ability.AbilityContext.stopServiceExtensionAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.terminateSelf = function (...args) { - console.warn("Ability.AbilityContext.terminateSelf 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.terminateSelfWithResult = function (...args) { - console.warn("Ability.AbilityContext.terminateSelfWithResult 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.connectAbility = function (...args) { - console.warn("Ability.AbilityContext.connectAbility interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.connectAbilityWithAccount = function (...args) { - console.warn("Ability.AbilityContext.connectAbilityWithAccount interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.disconnectAbility = function (...args) { - console.warn("Ability.AbilityContext.disconnectAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.setMissionLabel = function (...args) { - console.warn("Ability.AbilityContext.setMissionLabel 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.setMissionIcon = function (...args) { - console.warn("Ability.AbilityContext.setMissionIcon 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.requestPermissionsFromUser = function (...args) { - console.warn("Ability.AbilityContext.requestPermissionsFromUser 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, new PermissionRequestResultClass()); - } else { - return new Promise((resolve, reject) => { - resolve( new PermissionRequestResultClass()); - }) - } - }; - this.restoreWindowStage = function (...args) { - console.warn("Ability.AbilityContext.restoreWindowStage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.isTerminating = function () { - console.warn("Ability.AbilityContext.isTerminating interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - } -} -export function mockAbilityContext() { - return new AbilityContextClass(); -} diff --git a/runtime/main/extend/systemplugin/napi/application/AbilityRunningInfo.js b/runtime/main/extend/systemplugin/napi/application/AbilityRunningInfo.js deleted file mode 100755 index 1462d1a5..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AbilityRunningInfo.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -const ElementName = { - deviceId: '[PC preview] unknow deviceId', - bundleName: '[PC preview] unknow bundleName', - abilityName: '[PC preview] unknow abilityName', - uri: '[PC preview] unknow uri', - shortName: '[PC preview] unknow shortName', - moduleName: '[PC preview] unknow moduleName' -} -const AbilityState = { - INITIAL: 0, - FOREGROUND: 9, - BACKGROUND: 10, - FOREGROUNDING: 11, - BACKGROUNDING: 12 -} - -export const AbilityRunningInfo = { - ability: ElementName, - pid: '[PC preview] unknow pid', - uid: '[PC preview] unknow uid', - processName: '[PC preview] unknow processName', - startTime: '[PC preview] unknow startTime', - abilityState: AbilityState -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/AbilityStageContext.js b/runtime/main/extend/systemplugin/napi/application/AbilityStageContext.js deleted file mode 100755 index 8199d32c..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AbilityStageContext.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 { ContextClass } from "./Context" -import { HapModuleInfo } from "../bundle/hapModuleInfo" -import { Configuration } from "../ohos_application_Configuration" - -export const AbilityStageContextClass = class AbilityStageContext extends ContextClass { - constructor() { - super(); - console.warn("AbilityStageContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.currentHapModuleInfo = HapModuleInfo; - this.config = Configuration; - } -}; diff --git a/runtime/main/extend/systemplugin/napi/application/AbilityStateData.js b/runtime/main/extend/systemplugin/napi/application/AbilityStateData.js deleted file mode 100755 index 02192c55..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AbilityStateData.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 AbilityStateDataClass = class AbilityStateData { - constructor() { - console.warn("AbilityStateData.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.moduleName = "[PC Preview] unknow moduleName", - this.bundleName = "[PC Preview] unknow bundleName", - this.abilityName = "[PC Preview] unknow abilityName", - this.pid = "[PC Preview] unknow pid", - this.uid = "[PC Preview] unknow uid", - this.state = "[PC Preview] unknow state", - this.abilityType = "[PC Preview] unknow abilityType" - } -}; diff --git a/runtime/main/extend/systemplugin/napi/application/AccessibilityExtensionContext.js b/runtime/main/extend/systemplugin/napi/application/AccessibilityExtensionContext.js deleted file mode 100644 index eee99234..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AccessibilityExtensionContext.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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 { ExtensionContextClass } from './ExtensionContext' - -const ElementAttributeNameMock = '[PC Preview] unknown element attribute name'; - -const ElementAttributeValuesMock = '[PC Preview] unknown element attribute value'; - -const Rect = { - left: '[PC Preview] unknown element left', - top: '[PC Preview] unknown element top', - width: '[PC Preview] unknown element width', - height: '[PC Preview] unknown element height' -}; - -const AccessibilityElement = { - attributeNames: function (...args) { - console.warn('AccessibilityElement.attributeNames 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, [ElementAttributeNameMock]); - } else { - return new Promise((resolve, reject) => { - resolve([ElementAttributeNameMock]); - }); - } - }, - attributeValue: function (...args) { - console.warn('AccessibilityElement.attributeValue interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - let value = null; - switch (args[0]) { - case 'contents': - value = [ElementAttributeValuesMock]; - break; - case 'rect': - case 'screenRect': - value = Rect; - break; - case 'parent': - case 'rootElement': - value = AccessibilityElement; - break; - case 'children': - value = [AccessibilityElement]; - break; - default: - value = ElementAttributeValuesMock; - break; - } - - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, value); - } else { - return new Promise((resolve, reject) => { - resolve(value); - }); - } - }, - actionNames: function (...args) { - console.warn('AccessibilityElement.actionNames 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, [param.paramStringMock]); - } else { - return new Promise((resolve, reject) => { - resolve([param.paramStringMock]); - }); - } - }, - performAction: function (...args) { - console.warn('AccessibilityElement.performAction 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, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - findElement: function (...args) { - console.warn('AccessibilityElement.findElement interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - const result = (args[0] === 'content') ? [AccessibilityElement] : AccessibilityElement; - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, result); - } else { - return new Promise((resolve, reject) => { - resolve(result); - }); - } - }, -}; - -export class AccessibilityExtensionContext extends ExtensionContextClass { - constructor(...args) { - super(); - console.warn('AccessibilityExtensionContext.constructor interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - - this.setEventTypeFilter = function (...args) { - console.warn('AccessibilityExtensionContext.setEventTypeFilter 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }; - - this.setTargetBundleName = function (...args) { - console.warn('AccessibilityExtensionContext.setTargetBundleName 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }; - - this.getFocusElement = function (...args) { - console.warn('AccessibilityExtensionContext.getFocusElement 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, AccessibilityElement); - } else { - return new Promise((resolve, reject) => { - resolve(AccessibilityElement); - }); - } - }; - - this.getWindowRootElement = function (...args) { - console.warn('AccessibilityExtensionContext.getWindowRootElement 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, AccessibilityElement); - } else { - return new Promise((resolve, reject) => { - resolve(AccessibilityElement); - }); - } - }; - - this.getWindows = function (...args) { - console.warn('AccessibilityExtensionContext.getWindows 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, [AccessibilityElement]); - } else { - return new Promise((resolve, reject) => { - resolve([AccessibilityElement]); - }); - } - }; - - this.injectGesture = function (...args) { - console.warn('AccessibilityExtensionContext.injectGesture 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/AppStateData.js b/runtime/main/extend/systemplugin/napi/application/AppStateData.js deleted file mode 100755 index 48465100..00000000 --- a/runtime/main/extend/systemplugin/napi/application/AppStateData.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 AppStateDataClass = class AppStateData { - constructor() { - console.warn("AppStateData.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.bundleName = "[PC Preview] unknow bundleName"; - this.uid = "[PC Preview] unknow uid"; - this.state = "[PC Preview] unknow state"; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ApplicationContext.js b/runtime/main/extend/systemplugin/napi/application/ApplicationContext.js deleted file mode 100755 index 92290c92..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ApplicationContext.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 { ContextClass } from "./Context" - -export const ApplicationContextClass = class ApplicationContext extends ContextClass { - constructor() { - super(); - console.warn('ApplicationContext.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.registerAbilityLifecycleCallback = function (...args) { - console.warn("ApplicationContext.registerAbilityLifecycleCallback interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.unregisterAbilityLifecycleCallback = function (...args) { - console.warn("ApplicationContext.unregisterAbilityLifecycleCallback 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.registerEnvironmentCallback = function (...args) { - console.warn("ApplicationContext.registerEnvironmentCallback interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.unregisterEnvironmentCallback = function (...args) { - console.warn("ApplicationContext.unregisterEnvironmentCallback 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - } - } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ApplicationStateObserver.js b/runtime/main/extend/systemplugin/napi/application/ApplicationStateObserver.js deleted file mode 100755 index b8327543..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ApplicationStateObserver.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 ApplicationStateObserverClass = class ApplicationStateObserver { - constructor() { - console.warn('ApplicationStateObserver.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.onForegroundApplicationChanged = function (...args) { - console.warn("ApplicationStateObserver.onForegroundApplicationChanged interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - this.onAbilityStateChanged = function (...args) { - console.warn("ApplicationStateObserver.onAbilityStateChanged interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - this.onProcessCreated = function (...args) { - console.warn("ApplicationStateObserver.onProcessCreated interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - this.onProcessDied = function (...args) { - console.warn("ApplicationStateObserver.onProcessDied interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - } - } \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/BaseContext.js b/runtime/main/extend/systemplugin/napi/application/BaseContext.js deleted file mode 100644 index f3847be4..00000000 --- a/runtime/main/extend/systemplugin/napi/application/BaseContext.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 BaseContextClass = class BaseContext { - constructor() { - console.warn("BaseContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.stageMode = "[PC Preview] unknow stageMode"; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/Context.js b/runtime/main/extend/systemplugin/napi/application/Context.js deleted file mode 100644 index ac512d42..00000000 --- a/runtime/main/extend/systemplugin/napi/application/Context.js +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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 { ApplicationInfo } from "../bundle/applicationInfo" -import { BaseContextClass as BaseContext } from "./BaseContext" - -const ResourceManager = { - getString: function(...args) { - console.warn("ResourceManager.getString 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringArray: function(...args) { - console.warn("ResourceManager.getStringArray 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, reject) => { - resolve([paramMock.paramStringMock]); - }) - } - }, - - getMedia: function(...args) { - console.warn("ResourceManager.getMedia 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getMediaBase64: function(...args) { - console.warn("ResourceManager.getMediaBase64 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getPluralString: function(...args) { - console.warn("ResourceManager.getPluralString 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getConfiguration: function(...args) { - console.warn("ResourceManager.getConfiguration 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, new ConfigurationClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new ConfigurationClass()); - }) - } - }, - - getDeviceCapability: function(...args) { - console.warn("ResourceManager.getDeviceCapability 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, new DeviceCapabilityClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new DeviceCapabilityClass()); - }) - } - }, - - release: function() { - console.warn("ResourceManager.release interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - - getRawFile: function(...args) { - console.warn("ResourceManager.getRawFile 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getRawFileDescriptor: function(...args) { - console.warn("ResourceManager.getRawFileDescriptor 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, RawFileDescriptor); - } else { - return new Promise((resolve, reject) => { - resolve(RawFileDescriptor); - }) - } - }, - - closeRawFileDescriptor: function(...args) { - console.warn("ResourceManager.closeRawFileDescriptor 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringByName: function(...args) { - console.warn("ResourceManager.getStringByName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringArrayByName: function(...args) { - console.warn("ResourceManager.getStringArrayByName 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, reject) => { - resolve([paramMock.paramStringMock]); - }) - } - }, - - getMediaByName: function(...args) { - console.warn("ResourceManager.getMediaByName 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getMediaBase64ByName: function(...args) { - console.warn("ResourceManager.getMediaBase64ByName 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getPluralStringByName: function(...args) { - console.warn("ResourceManager.getPluralStringByName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringSync: function(...args) { - console.warn("ResourceManager.getStringSync interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - - getStringByNameSync: function(...args) { - console.warn("ResourceManager.getStringByNameSync interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - - getBoolean: function(...args) { - console.warn("ResourceManager.getBoolean interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getBooleanByName: function(...args) { - console.warn("ResourceManager.getBooleanByName interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getNumber: function(...args) { - console.warn("ResourceManager.getNumber interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getNumberByName: function(...args) { - console.warn("ResourceManager.getNumberByName interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - } -} -const EventHubClass = class EventHub { - constructor() { - console.warn('EventHub.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.on = function (...args) { - console.warn("EventHub.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.off = function (...args) { - console.warn("EventHub.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.emit = function (...args) { - console.warn("EventHub.emit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -} -export const ContextClass = class Context extends BaseContext { - constructor() { - super(); - console.warn('Context.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.resourceManager = ResourceManager; - this.applicationInfo = ApplicationInfo; - this.cacheDir = "[PC Preview] unknow cacheDir"; - this.tempDir = "[PC Preview] unknow tempDir"; - this.filesDir = "[PC Preview] unknow filesDir"; - this.databaseDir = "[PC Preview] unknow databaseDir"; - this.preferencesDir = "[PC Preview] unknow preferencesDir"; - this.storageDir = "[PC Preview] unknow storageDir"; - this.bundleCodeDir = "[PC Preview] unknow bundleCodeDir"; - this.distributedFilesDir = "[PC Preview] unknow distributedFilesDir"; - this.eventHub = new EventHubClass(); - this.area = AreaMode; - this.createBundleContext = function (...args) { - console.warn("Context.createBundleContext interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new ContextClass(); - }; - this.createModuleContext = function (...args) { - console.warn("Context.createModuleContext interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new ContextClass(); - }; - this.getApplicationContext = function () { - console.warn("Context.getApplicationContext interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new ContextClass(); - }; - this.switchArea = function (...args) { - console.warn("Context.switchArea interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -} -export const AreaMode = { - EL1: 0, - EL2: 1 -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ErrorObserver.js b/runtime/main/extend/systemplugin/napi/application/ErrorObserver.js deleted file mode 100755 index 6cfe5d31..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ErrorObserver.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 ErrorObserverClass = class ErrorObserver { - constructor() { - console.warn("ErrorObserver.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.onUnhandledException = function (...args) { - console.warn("ErrorObserver.onUnhandledException interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/EventHub.js b/runtime/main/extend/systemplugin/napi/application/EventHub.js deleted file mode 100755 index d2f68c19..00000000 --- a/runtime/main/extend/systemplugin/napi/application/EventHub.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 EventHubClass = class EventHub { - constructor() { - console.warn("EventHub.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.on = function (...args) { - console.warn("EventHub.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.off = function (...args) { - console.warn("EventHub.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.emit = function (...args) { - console.warn("EventHub.emit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ExtensionContext.js b/runtime/main/extend/systemplugin/napi/application/ExtensionContext.js deleted file mode 100755 index b2f4e883..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ExtensionContext.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { HapModuleInfo } from "../bundle/hapModuleInfo"; -import { Configuration } from "../ohos_application_Configuration" -import { ExtensionAbilityInfo } from "../bundle/extensionAbilityInfo" -import { ContextClass } from "./Context" - -export const ExtensionContextClass = class ExtensionContext extends ContextClass { - constructor() { - super(); - console.warn("ExtensionContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.currentHapModuleInfo = HapModuleInfo; - this.config = Configuration; - this.extensionAbilityInfo = ExtensionAbilityInfo; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ExtensionRunningInfo.js b/runtime/main/extend/systemplugin/napi/application/ExtensionRunningInfo.js deleted file mode 100755 index 16406d9a..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ExtensionRunningInfo.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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" - -const ElementName = { - deviceId: '[PC preview] unknow deviceId', - bundleName: '[PC preview] unknow bundleName', - abilityName: '[PC preview] unknow abilityName', - uri: '[PC preview] unknow uri', - shortName: '[PC preview] unknow shortName', - moduleName: '[PC preview] unknow moduleName' -} -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 ExtensionRunningInfo = { - extension: ElementName, - pid: '[PC preview] unknow pid', - uid: '[PC preview] unknow uid', - processName: '[PC preview] unknow processName', - startTime: '[PC preview] unknow startTime', - clientPackage: [paramMock.paramStringMock], - abilityState: ExtensionAbilityType -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/FormExtensionContext.js b/runtime/main/extend/systemplugin/napi/application/FormExtensionContext.js deleted file mode 100644 index 5bf26661..00000000 --- a/runtime/main/extend/systemplugin/napi/application/FormExtensionContext.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 { ExtensionContextClass } from "./ExtensionContext" -export const FormExtensionContextClass = class FormExtensionContext extends ExtensionContextClass { - constructor() { - super(); - console.warn('FormExtensionContext.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.startAbility = function (...args) { - console.warn("FormExtensionContext.startAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/MissionInfo.js b/runtime/main/extend/systemplugin/napi/application/MissionInfo.js deleted file mode 100755 index b157bda2..00000000 --- a/runtime/main/extend/systemplugin/napi/application/MissionInfo.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 { WantClass } from "../ohos_application_Want" - -export const MissionInfo = { - missionId: '[PC preview] unknow missionId', - runningState: '[PC preview] unknow runningState', - lockedState: '[PC preview] unknow lockedState', - timestamp: '[PC preview] unknow timestamp', - want: new WantClass(), - label: '[PC preview] unknow label', - iconPath: '[PC preview] unknow iconPath', - continuable: '[PC preview] unknow continuable' -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/MissionListener.js b/runtime/main/extend/systemplugin/napi/application/MissionListener.js deleted file mode 100755 index ae014e52..00000000 --- a/runtime/main/extend/systemplugin/napi/application/MissionListener.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 MissionListener = { - onMissionCreated: function(...args) { - console.warn("MissionListener.onMissionCreated interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onMissionDestroyed: function(...args) { - console.warn("MissionListener.onMissionDestroyed interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onMissionSnapshotChanged: function(...args) { - console.warn("MissionListener.onMissionSnapshotChanged interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onMissionMovedToFront: function(...args) { - console.warn("MissionListener.onMissionMovedToFront interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onMissionIconUpdated: function(...args) { - console.warn("MissionListener.onMissionIconUpdated interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/MissionSnapshot.js b/runtime/main/extend/systemplugin/napi/application/MissionSnapshot.js deleted file mode 100755 index a71f4797..00000000 --- a/runtime/main/extend/systemplugin/napi/application/MissionSnapshot.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { PixelMapMock } from "../../multimedia" - -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' -} - -export const MissionSnapshot = { - abality: ElementName, - snapshot: PixelMapMock -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/PermissionRequestResult.js b/runtime/main/extend/systemplugin/napi/application/PermissionRequestResult.js deleted file mode 100755 index 4b7b387c..00000000 --- a/runtime/main/extend/systemplugin/napi/application/PermissionRequestResult.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 PermissionRequestResultClass = class PermissionRequestResult { - constructor() { - console.warn("PermissionRequestResult.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.permissions = [paramMock.paramStringMock] - this.authResults = [paramMock.paramNumberMock] - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ProcessData.js b/runtime/main/extend/systemplugin/napi/application/ProcessData.js deleted file mode 100755 index f27582f0..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ProcessData.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 ProcessDataClass = class ProcessData { - constructor() { - console.warn("ProcessData.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.bundleName = "[PC Preview] unknow bundleName" - this.pid = "[PC Preview] unknow pid" - this.uid = "[PC Preview] unknow uid" - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ProcessRunningInfo.js b/runtime/main/extend/systemplugin/napi/application/ProcessRunningInfo.js deleted file mode 100755 index 761fd862..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ProcessRunningInfo.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 ProcessRunningInfo = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - processName: "[PC Preview] unknow processName", - bundleNames: [paramMock.paramStringMock] -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/ServiceExtensionContext.js b/runtime/main/extend/systemplugin/napi/application/ServiceExtensionContext.js deleted file mode 100755 index 6418a8f5..00000000 --- a/runtime/main/extend/systemplugin/napi/application/ServiceExtensionContext.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 { Caller } from "../ohos_application_Ability"; -import { ExtensionContextClass } from "./ExtensionContext" - -export const ServiceExtensionContextClass = class ServiceExtensionContext extends ExtensionContextClass { - constructor() { - super(); - console.warn("ServiceExtensionContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.startAbility = function (...args) { - console.warn("ServiceExtensionContext.startAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startAbilityWithAccount = function (...args) { - console.warn("ServiceExtensionContext.startAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startServiceExtensionAbility = function (...args) { - console.warn("ServiceExtensionContext.startServiceExtensionAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startServiceExtensionAbilityWithAccount = function (...args) { - console.warn("ServiceExtensionContext.startServiceExtensionAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.stopServiceExtensionAbility = function (...args) { - console.warn("ServiceExtensionContext.stopServiceExtensionAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.stopServiceExtensionAbilityWithAccount = function (...args) { - console.warn("ServiceExtensionContext.stopServiceExtensionAbilityWithAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.terminateSelf = function (...args) { - console.warn("ServiceExtensionContext.terminateSelf 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.connectAbility = function (...args) { - console.warn("ServiceExtensionContext.connectAbility interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.connectAbilityWithAccount = function (...args) { - console.warn("ServiceExtensionContext.connectAbilityWithAccount interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.disconnectAbility = function (...args) { - console.warn("ServiceExtensionContext.disconnectAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.startAbilityByCall = function (...args) { - console.warn("ServiceExtensionContext.startAbilityByCall 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(Caller); - }) - }; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/abilityDelegator.js b/runtime/main/extend/systemplugin/napi/application/abilityDelegator.js deleted file mode 100644 index b56b2388..00000000 --- a/runtime/main/extend/systemplugin/napi/application/abilityDelegator.js +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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 { AbilityClass } from "../ohos_application_Ability" -import { ContextClass } from "./Context" -import { ShellCmdResult } from "./shellCmdResult" - -export const AbilityDelegator = { - addAbilityMonitor: function (...args) { - console.warn("AbilityDelegator.addAbilityMonitor 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeAbilityMonitor: function (...args) { - console.warn("AbilityDelegator.removeAbilityMonitor 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - waitAbilityMonitor: function (...args) { - console.warn("AbilityDelegator.waitAbilityMonitor 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, new AbilityClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new AbilityClass()); - }) - } - }, - getAppContext: function (...args) { - console.warn('AbilityDelegator.getAppContext interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new ContextClass(); - }, - getAbilityState: function (...args) { - console.warn('AbilityDelegator.getAbilityState interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - getCurrentTopAbility: function (...args) { - console.warn("AbilityDelegator.getCurrentTopAbility 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, new AbilityClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new AbilityClass()); - }) - } - }, - startAbility: function (...args) { - console.warn("AbilityDelegator.startAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - doAbilityForeground: function (...args) { - console.warn("AbilityDelegator.doAbilityForeground 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - doAbilityBackground: function (...args) { - console.warn("AbilityDelegator.doAbilityBackground 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - print: function (...args) { - console.warn("AbilityDelegator.print 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - printSync: function (...args) { - console.warn('AbilityDelegator.printSync interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - }, - executeShellCommand: function (...args) { - console.warn("AbilityDelegator.executeShellCommand 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, ShellCmdResult); - } else { - return new Promise((resolve, reject) => { - resolve(ShellCmdResult); - }) - } - }, - finishTest: function (...args) { - console.warn("AbilityDelegator.finishTest 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/abilityDelegatorArgs.js b/runtime/main/extend/systemplugin/napi/application/abilityDelegatorArgs.js deleted file mode 100644 index 104b0367..00000000 --- a/runtime/main/extend/systemplugin/napi/application/abilityDelegatorArgs.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 AbilityDelegatorArgs = { - bundleName: "[PC Preview] unknow bundleName", - parameters: {}, - testCaseNames: "[PC Preview] unknow testCaseNames", - testRunnerClassName: "[PC Preview] unknow testRunnerClassName", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/abilityMonitor.js b/runtime/main/extend/systemplugin/napi/application/abilityMonitor.js deleted file mode 100644 index 22195d2b..00000000 --- a/runtime/main/extend/systemplugin/napi/application/abilityMonitor.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 AbilityMonitor = { - abilityName: "[PC Preview] unknow abilityName", - onAbilityCreate: function (...args) { - console.warn("AbilityMonitor.onAbilityCreate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onAbilityForeground: function (...args) { - console.warn("AbilityMonitor.onAbilityForeground interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onAbilityBackground: function (...args) { - console.warn("AbilityMonitor.onAbilityBackground interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onAbilityDestroy: function (...args) { - console.warn("AbilityMonitor.onAbilityDestroy interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onWindowStageCreate: function (...args) { - console.warn("AbilityMonitor.onWindowStageCreate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onWindowStageRestore: function (...args) { - console.warn("AbilityMonitor.onWindowStageRestore interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - onWindowStageDestroy: function (...args) { - console.warn("AbilityMonitor.onWindowStageDestroy interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/application/shellCmdResult.js b/runtime/main/extend/systemplugin/napi/application/shellCmdResult.js deleted file mode 100644 index 920d25dd..00000000 --- a/runtime/main/extend/systemplugin/napi/application/shellCmdResult.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 ShellCmdResult = { - stdResult: "[PC Preview] unknow stdResult", - exitCode: "[PC Preview] unknow exitCode", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js b/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js deleted file mode 100755 index 3caaf73d..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/PermissionDef.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3a0bbf33..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/abilityInfo.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2021-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 { 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", - 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: 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: ApplicationInfo, - metaData: [CustomizeData], - uri: "[PC preview] unknown uri", - metadata: [Metadata], - enabled: "[PC preview] unknown enabled", - supportWindowMode: [SupportWindowMode], - 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", -} \ 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 deleted file mode 100644 index a2b65f88..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/applicationInfo.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021-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 { 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", - systemApp: "[PC preview] unknown systemApp", - enabled: "[PC preview] unknown enabled", - 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", - supportedModes: "[PC preview] unknown supportedModes", - moduleSourceDirs: [paramMock.paramNumberMock], - permissions: [paramMock.paramNumberMock], - moduleInfos: [ModuleInfo], - entryDir: "[PC preview] unknown entryDir", - codePath: "[PC preview] unknown codePath", - 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: Resource, - labelResource: Resource, - descriptionResource: Resource, - appDistributionType: "[PC preview] unknown appDistributionType", - appProvisionType: "[PC preview] unknown appProvisionType", -} - -export const Want = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - type: "[PC Preview] unknow type", - flag: "[PC Preview] unknow flag", - action: "[PC Preview] unknow action", - parameters: [paramMock.paramStringMock], - entities: [paramMock.paramStringMock], - moduleName: "[PC Preview] unknow moduleName", -} \ 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 deleted file mode 100644 index 68793e40..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleInfo.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021-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 { 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: 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: [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 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 deleted file mode 100755 index d0c85129..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleInstaller.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 deleted file mode 100755 index 2215a05f..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/bundleStatusCallback.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 deleted file mode 100755 index dce34591..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/customizeData.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 deleted file mode 100755 index f66db7aa..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/defaultAppManager.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 DefaultAppManager = { - BROWSER: "[PC preview] unknown BROWSER", - IMAGE: "[PC preview] unknown IMAGE", - AUDIO: "[PC preview] unknown AUDIO", - VIDEO: "[PC preview] unknown VIDEO", - PDF: "[PC preview] unknown PDF", - WORD: "[PC preview] unknown WORD", - EXCEL: "[PC preview] unknown EXCEL", - PPT: "[PC preview] unknown PPT", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js b/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js deleted file mode 100755 index 318aefb8..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/dispatchInfo.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100755 index ffa0992a..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/elementName.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 deleted file mode 100755 index ebbb9f78..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/extensionAbilityInfo.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 deleted file mode 100755 index 8a85e2a5..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/hapModuleInfo.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 mainElementName", -} \ 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 deleted file mode 100644 index 830d0533..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/launcherAbilityInfo.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021 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 { 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", - installTime: "[PC preview] unknown installTime", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/bundle/metadata.js b/runtime/main/extend/systemplugin/napi/bundle/metadata.js deleted file mode 100755 index 6157307c..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/metadata.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 deleted file mode 100755 index 4b0193f6..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/moduleInfo.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100755 index fd6e7dc8..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/packInfo.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 deleted file mode 100755 index ab31d377..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/remoteAbilityInfo.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 deleted file mode 100755 index e90805ca..00000000 --- a/runtime/main/extend/systemplugin/napi/bundle/shortcutInfo.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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/common/full/featureability.js b/runtime/main/extend/systemplugin/napi/common/full/featureability.js deleted file mode 100644 index 084bf211..00000000 --- a/runtime/main/extend/systemplugin/napi/common/full/featureability.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 Result = { - code: "[PC Preview] unknow code", - data: "[PC Preview] unknow data", -} -export const SubscribeMessageResponse = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - message: "[PC Preview] unknow message", -} -export const CallAbilityParam = { - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - messageCode: "[PC Preview] unknow messageCode", - abilityType: "[PC Preview] unknow abilityType", - data: "[PC Preview] unknow data", - syncOption: "[PC Preview] unknow syncOption", -} -export const SubscribeAbilityEventParam = { - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - messageCode: "[PC Preview] unknow messageCode", - abilityType: "[PC Preview] unknow abilityType", - syncOption: "[PC Preview] unknow syncOption", -} -export const SendMessageOptions = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - message: "[PC Preview] unknow message", - success: function () { - console.warn("SendMessageOptions.success interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - fail: function (...args) { - console.warn("SendMessageOptions.fail interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - complete: function () { - console.warn("SendMessageOptions.complete interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - } -} -export const SubscribeMessageOptions = { - success: function (...args) { - console.warn("SubscribeMessageOptions.success interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - fail: function (...args) { - console.warn("SubscribeMessageOptions.fail interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, -} -export const RequestParams = { - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - entities: [paramMock.paramStringMock], - action: "[PC Preview] unknow action", - deviceType: "[PC Preview] unknow deviceType", - data: "[PC Preview] unknow data", - flag: "[PC Preview] unknow flag", - url: "[PC Preview] unknow url", -} -export const FinishWithResultParams = { - code: "[PC Preview] unknow code", - result: "[PC Preview] unknow result", -} -export const FeatureAbilityClass = class FeatureAbility { - constructor() { - console.warn('FeatureAbility.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.startAbility = function (...args) { - console.warn("FeatureAbility.startAbility 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(Result); - }) - }; - this.startAbilityForResult = function (...args) { - console.warn("FeatureAbility.startAbilityForResult 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(Result); - }) - }; - this.finishWithResult = function (...args) { - console.warn("FeatureAbility.finishWithResult 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(Result); - }) - }; - this.getDeviceList = function (...args) { - console.warn("FeatureAbility.getDeviceList 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(Result); - }) - }; - this.callAbility = function (...args) { - console.warn("FeatureAbility.callAbility 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(paramMock.paramStringMock); - }) - }; - this.continueAbility = function () { - console.warn("FeatureAbility.continueAbility 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(Result); - }) - }; - this.subscribeAbilityEvent = function (...args) { - console.warn("FeatureAbility.subscribeAbilityEvent 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(paramMock.paramStringMock); - }) - }; - this.unsubscribeAbilityEvent = function (...args) { - console.warn("FeatureAbility.unsubscribeAbilityEvent 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(paramMock.paramStringMock); - }) - }; - this.sendMsg = function (...args) { - console.warn("FeatureAbility.sendMsg interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.subscribeMsg = function (...args) { - console.warn("FeatureAbility.subscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.unsubscribeMsg = function () { - console.warn("FeatureAbility.unsubscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventData.js b/runtime/main/extend/systemplugin/napi/commonEvent/commonEventData.js deleted file mode 100644 index 8631a7ec..00000000 --- a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventData.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 CommonEventData = { - event: '[PC preview] unknow event', - bundleName: '[PC preview] unknow bundleName', - code: '[PC preview] unknow code', - data: '[PC preview] unknow data', - parameters: {"key": "unknown any"}, -} diff --git a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventPublishData.js b/runtime/main/extend/systemplugin/napi/commonEvent/commonEventPublishData.js deleted file mode 100644 index 248f625b..00000000 --- a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventPublishData.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 CommonEventPublishData = { - bundleName: '[PC preview] unknow bundleName', - code: '[PC preview] unknow code', - data: '[PC preview] unknow data', - subscriberPermissions: [paramMock.paramStringMock], - isOrdered: '[PC preview] unknow isOrdered', - isSticky: '[PC preview] unknow isSticky', - parameters: {"key": "unknown any"}, -} diff --git a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscribeInfo.js b/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscribeInfo.js deleted file mode 100644 index d2cc1633..00000000 --- a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscribeInfo.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 CommonEventSubscribeInfo = { - events: [paramMock.paramStringMock], - publisherPermission: '[PC preview] unknow publisherPermission', - publisherDeviceId: '[PC preview] unknow publisherDeviceId', - userId: '[PC preview] unknow userId', - priority: '[PC preview] unknow priority' -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscriber.js b/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscriber.js deleted file mode 100644 index 0f478d53..00000000 --- a/runtime/main/extend/systemplugin/napi/commonEvent/commonEventSubscriber.js +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 { CommonEventSubscribeInfo } from "./commonEventSubscribeInfo" - -export const CommonEventSubscriber = { - getCode: function (...args) { - console.warn('CommonEventSubscriber.getCode 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setCode: function (...args) { - console.warn('CommonEventSubscriber.setCode 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getData: function (...args) { - console.warn('CommonEventSubscriber.getData 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); - }); - } - }, - setData: function (...args) { - console.warn('CommonEventSubscriber.setData 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setCodeAndData: function (...args) { - console.warn('CommonEventSubscriber.setCodeAndData 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isOrderedCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.isOrderedCommonEvent 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); - }); - } - }, - isStickyCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.isStickyCommonEvent 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); - }); - } - }, - abortCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.abortCommonEvent 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearAbortCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.clearAbortCommonEvent 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAbortCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.getAbortCommonEvent 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); - }); - } - }, - getSubscribeInfo: function (...args) { - console.warn('CommonEventSubscriber.getSubscribeInfo 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, CommonEventSubscribeInfo); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscribeInfo); - }); - } - }, - finishCommonEvent: function (...args) { - console.warn('CommonEventSubscriber.finishCommonEvent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/continuation/continuationExtraParams.js b/runtime/main/extend/systemplugin/napi/continuation/continuationExtraParams.js deleted file mode 100644 index f29740cd..00000000 --- a/runtime/main/extend/systemplugin/napi/continuation/continuationExtraParams.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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" -const ContinuationMode = { - COLLABORATION_SINGLE: 0, - COLLABORATION_MULTIPLE: 1 -} -export const ContinuationExtraParams = { - deviceType: [paramMock.paramStringMock], - targetBundle: "[PC Preview] unknow targetBundle", - description: "[PC Preview] unknow description", - filter: "[PC Preview] unknow filter", - continuationMode: ContinuationMode, - authInfo: {"key":"unknow any"} -} diff --git a/runtime/main/extend/systemplugin/napi/continuation/continuationResult.js b/runtime/main/extend/systemplugin/napi/continuation/continuationResult.js deleted file mode 100644 index 1d8521f2..00000000 --- a/runtime/main/extend/systemplugin/napi/continuation/continuationResult.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 ContinuationResult = { - id: "[PC Preview] unknow id", - type: "[PC Preview] unknow type", - name: "[PC Preview] unknow name", -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/data/rdb/resultSet.js b/runtime/main/extend/systemplugin/napi/data/rdb/resultSet.js deleted file mode 100644 index 25a16440..00000000 --- a/runtime/main/extend/systemplugin/napi/data/rdb/resultSet.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 resultSet = { - columnNames: [paramMock.paramStringMock], - columnCount: "[PC Preview] unknow columnCount", - rowCount: "[PC Preview] unknow rowCount", - rowIndex: "[PC Preview] unknow rowIndex", - isAtFirstRow: "[PC Preview] unknow isAtFirstRow", - isAtLastRow: "[PC Preview] unknow isAtLastRow", - isEnded: "[PC Preview] unknow isEnded", - isStarted: "[PC Preview] unknow isStarted", - isClosed: "[PC Preview] unknow isClosed", - getColumnIndex: function (...args) { - console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getColumnName: function (...args) { - console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - goTo: function (...args) { - console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToRow: function (...args) { - console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToFirstRow: function (...args) { - console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToLastRow: function (...args) { - console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToNextRow: function (...args) { - console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToPreviousRow: function (...args) { - console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getBlob: function (...args) { - console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramObjectMock; - }, - getString: function (...args) { - console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getLong: function (...args) { - console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getDouble: function (...args) { - console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isColumnNull: function (...args) { - console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - close: function (...args) { - console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, -} diff --git a/runtime/main/extend/systemplugin/napi/dtv.js b/runtime/main/extend/systemplugin/napi/dtv.js deleted file mode 100644 index d604bf1e..00000000 --- a/runtime/main/extend/systemplugin/napi/dtv.js +++ /dev/null @@ -1,5691 +0,0 @@ -/* - * Copyright (c) 2021 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 mockDtv() { - const BookTask = { - id: "[PC Preview] unknow id", - channelId: "[PC Preview] unknow channelId", - eventId: "[PC Preview] unknow eventId", - isAdjustByEvent: "[PC Preview] unknow isAdjustByEvent", - name: "[PC Preview] unknow name", - startDate: "[PC Preview] unknow startDate", - duration: "[PC Preview] unknow duration", - type: "[PC Preview] unknow type", - cycle: "[PC Preview] unknow cycle", - isEnabled: "[PC Preview] unknow isEnabled", - lcn: "[PC Preview] unknow lcn", - programName: "[PC Preview] unknow programName", - signalType: "[PC Preview] unknow signalType", - startTime: "[PC Preview] unknow startTime" - } - const FavTags = { - FAV_ALL: "[PC Preview] unknow FAV_ALL", - FAV_1: "[PC Preview] unknow FAV_1", - FAV_2: "[PC Preview] unknow FAV_2", - FAV_3: "[PC Preview] unknow FAV_3", - FAV_4: "[PC Preview] unknow FAV_4", - FAV_5: "[PC Preview] unknow FAV_5", - FAV_6: "[PC Preview] unknow FAV_6", - FAV_7: "[PC Preview] unknow FAV_7", - FAV_8: "[PC Preview] unknow FAV_8", - FAV_9: "[PC Preview] unknow FAV_9", - FAV_10: "[PC Preview] unknow FAV_10", - FAV_11: "[PC Preview] unknow FAV_11", - FAV_12: "[PC Preview] unknow FAV_12", - FAV_13: "[PC Preview] unknow FAV_13", - FAV_14: "[PC Preview] unknow FAV_14", - FAV_15: "[PC Preview] unknow FAV_15", - FAV_16: "[PC Preview] unknow FAV_16" - } - const ChannelTsInfo = { - tsInfoNum: "[PC Preview] unknow tsInfoNum", - networkType: "[PC Preview] unknow networkType", - centerFreqList: "[PC Preview] unknow centerFreqList", - cabDeliveryDescriptor: "[PC Preview] unknow cabDeliveryDescriptor", - terDeliveryDescriptor: "[PC Preview] unknow terDeliveryDescriptor", - satDeliveryDescriptor: "[PC Preview] unknow satDeliveryDescriptor" - } - const ChannelFilter = { - siElement: "[PC Preview] unknow siElement", - tvRadio: "[PC Preview] unknow tvRadio", - favGroupTypes: "[PC Preview] unknow favGroupTypes", - scrambleType: "[PC Preview] unknow scrambleType", - editTags: "[PC Preview] unknow editTags", - letters: "[PC Preview] unknow letters", - mbServiceNameFilter: "[PC Preview] unknow mbServiceNameFilter" - } - const TVRadioFilters = { - ALL: "[PC Preview] unknow ALL", - TV: "[PC Preview] unknow TV", - RADIO: "[PC Preview] unknow RADIO", - DATA: "[PC Preview] unknow DATA", - BUTT: "[PC Preview] unknow BUTT" - } - const ChannelRegion = { - name: "[PC Preview] unknow name", - countryCode: "[PC Preview] unknow countryCode", - regionDepth: "[PC Preview] unknow regionDepth", - prc: "[PC Preview] unknow prc", - src: "[PC Preview] unknow src", - trc: "[PC Preview] unknow trc" - } - const ChannelRate = { - enUstvAll: "[PC Preview] unknow enUstvAll", - enUstvFv: "[PC Preview] unknow enUstvFv", - enUstvV: "[PC Preview] unknow enUstvV", - enUstvS: "[PC Preview] unknow enUstvS", - enUstvL: "[PC Preview] unknow enUstvL", - enUstvD: "[PC Preview] unknow enUstvD", - enMpaa: "[PC Preview] unknow enMpaa", - enCaen: "[PC Preview] unknow enCaen", - enCafr: "[PC Preview] unknow enCafr" - } - const ParentalContents = { - PARENTAL_CONTENT_NONE: "[PC Preview] unknow PARENTAL_CONTENT_NONE", - PARENTAL_CONTENT_DRUGS: "[PC Preview] unknow PARENTAL_CONTENT_DRUGS", - PARENTAL_CONTENT_VIOLENCE: "[PC Preview] unknow PARENTAL_CONTENT_VIOLENCE", - PARENTAL_CONTENT_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_VIOL_DRUG", - PARENTAL_CONTENT_SEX: "[PC Preview] unknow PARENTAL_CONTENT_SEX", - PARENTAL_CONTENT_SEX_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_DRUG", - PARENTAL_CONTENT_SEX_VIOL: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL", - PARENTAL_CONTENT_SEX_VIOL_DRUG: "[PC Preview] unknow PARENTAL_CONTENT_SEX_VIOL_DRUG", - PARENTAL_CONTENT_BUTT: "[PC Preview] unknow PARENTAL_CONTENT_BUTT" - } - const EPGEvent = { - channelId: "[PC Preview] unknow channelId", - eventId: "[PC Preview] unknow eventId", - scramble: "[PC Preview] unknow scramble", - parentLockLevel: "[PC Preview] unknow parentLockLevel", - startTime: "[PC Preview] unknow startTime", - endTime: "[PC Preview] unknow endTime", - duration: "[PC Preview] unknow duration", - eventName: "[PC Preview] unknow eventName", - contentLevel1: "[PC Preview] unknow contentLevel1", - contentLevel2: "[PC Preview] unknow contentLevel2", - contentLevel3: "[PC Preview] unknow contentLevel3", - contentLevel4: "[PC Preview] unknow contentLevel4", - runningStatus: "[PC Preview] unknow runningStatus", - shortDescription: "[PC Preview] unknow shortDescription", - extendedDescription: "[PC Preview] unknow extendedDescription", - booked: "[PC Preview] unknow booked", - cridProgramme: "[PC Preview] unknow cridProgramme", - cridSeries: "[PC Preview] unknow cridSeries", - utcStartTime: "[PC Preview] unknow utcStartTime", - utcEndTime: "[PC Preview] unknow utcEndTime" - } - const NetworkTypes = { - NONE: "[PC Preview] unknow NONE", - CABLE: "[PC Preview] unknow CABLE", - SATELLITE: "[PC Preview] unknow SATELLITE", - TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL", - ISDB_TER: "[PC Preview] unknow ISDB_TER", - ATSC_T: "[PC Preview] unknow ATSC_T", - DTMB: "[PC Preview] unknow DTMB", - J83B: "[PC Preview] unknow J83B", - RF: "[PC Preview] unknow RF", - ATSC_CAB: "[PC Preview] unknow ATSC_CAB", - ISDB_CAB: "[PC Preview] unknow ISDB_CAB" - } - const VersionTypes = { - Version_1: "[PC Preview] unknow Version_1", - Version_2: "[PC Preview] unknow Version_2", - Version_all: "[PC Preview] unknow Version_all" - } - const TunerStatus = { - UNLOCK: "[PC Preview] unknow UNLOCK", - LOCK: "[PC Preview] unknow LOCK", - UNKNOW: "[PC Preview] unknow UNKNOW" - } - const TimeShiftInfo = { - recordTime: "[PC Preview] unknow recordTime", - beginTimeSecond: "[PC Preview] unknow beginTimeSecond", - playTimeSecond: "[PC Preview] unknow playTimeSecond", - TERRESTRIAL: "[PC Preview] unknow TERRESTRIAL" - } - const TrickModes = { - FAST_FORWARD_NORMAL: "[PC Preview] unknow FAST_FORWARD_NORMAL", - FAST_FORWARD_TWO: "[PC Preview] unknow FAST_FORWARD_TWO", - FAST_FORWARD_FOUR: "[PC Preview] unknow FAST_FORWARD_FOUR", - FAST_FORWARD_EIGHT: "[PC Preview] unknow FAST_FORWARD_EIGHT", - FAST_FORWARD_SIXTEEN: "[PC Preview] unknow FAST_FORWARD_SIXTEEN", - FAST_FORWARD_THIRTYTWO: "[PC Preview] unknow FAST_FORWARD_THIRTYTWO", - FAST_FORWARD_SIXTYFOUR: "[PC Preview] unknow FAST_FORWARD_SIXTYFOUR", - FAST_BACKWARD_NORMAL: "[PC Preview] unknow FAST_BACKWARD_NORMAL", - FAST_BACKWARD_TWO: "[PC Preview] unknow FAST_BACKWARD_TWO", - FAST_BACKWARD_FOUR: "[PC Preview] unknow FAST_BACKWARD_FOUR", - FAST_BACKWARD_EIGHT: "[PC Preview] unknow FAST_BACKWARD_EIGHT", - FAST_BACKWARD_SIXTEEN: "[PC Preview] unknow FAST_BACKWARD_SIXTEEN", - FAST_BACKWARD_THIRTYTWO: "[PC Preview] unknow FAST_BACKWARD_THIRTYTWO", - FAST_BACKWARD_SIXTYFOUR: "[PC Preview] unknow FAST_BACKWARD_SIXTYFOUR", - SLOW_FORWARD_TWO: "[PC Preview] unknow SLOW_FORWARD_TWO", - SLOW_FORWARD_FOUR: "[PC Preview] unknow SLOW_FORWARD_FOUR", - SLOW_FORWARD_EIGHT: "[PC Preview] unknow SLOW_FORWARD_EIGHT", - SLOW_FORWARD_SIXTEEN: "[PC Preview] unknow SLOW_FORWARD_SIXTEEN", - SLOW_FORWARD_THIRTYTWO: "[PC Preview] unknow SLOW_FORWARD_THIRTYTWO", - SLOW_BACKWARD_TWO: "[PC Preview] unknow SLOW_BACKWARD_TWO", - SLOW_BACKWARD_FOUR: "[PC Preview] unknow SLOW_BACKWARD_FOUR", - SLOW_BACKWARD_EIGHT: "[PC Preview] unknow SLOW_BACKWARD_EIGHT", - SLOW_BACKWARD_SIXTEEN: "[PC Preview] unknow SLOW_BACKWARD_SIXTEEN", - SLOW_BACKWARD_THIRTYTWO: "[PC Preview] unknow SLOW_BACKWARD_THIRTYTWO", - INVALID_TRICK_MODE: "[PC Preview] unknow INVALID_TRICK_MODE" - } - const PlayStatus = { - STOP: "[PC Preview] unknow STOP", - LIVEPLAY: "[PC Preview] unknow LIVEPLAY", - TIMESHIFTPLAY: "[PC Preview] unknow TIMESHIFTPLAY", - PAUSE: "[PC Preview] unknow PAUSE", - IDLE: "[PC Preview] unknow IDLE", - RELEASEPLAYRESOURCE: "[PC Preview] unknow RELEASEPLAYRESOURCE", - PIPPLAY: "[PC Preview] unknow PIPPLAY", - EWSPLAY: "[PC Preview] unknow EWSPLAY", - INVALID: "[PC Preview] unknow INVALID" - } - const AudioComponent = { - pid: "[PC Preview] unknow pid", - type: "[PC Preview] unknow type", - languageCode: "[PC Preview] unknow languageCode", - audioTextDescription: "[PC Preview] unknow audioTextDescription", - audioDescriptionType: "[PC Preview] unknow audioDescriptionType", - audioTrackMode: "[PC Preview] unknow audioTrackMode", - audioComponentTag: "[PC Preview] unknow audioComponentTag" - } - const AudioTrackModes = { - AUDIO_TRACK_STEREO: "[PC Preview] unknow AUDIO_TRACK_STEREO", - AUDIO_TRACK_DOUBLE_MONO: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_MONO", - AUDIO_TRACK_DOUBLE_LEFT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_LEFT", - AUDIO_TRACK_DOUBLE_RIGHT: "[PC Preview] unknow AUDIO_TRACK_DOUBLE_RIGHT", - AUDIO_TRACK_EXCHANGE: "[PC Preview] unknow AUDIO_TRACK_EXCHANGE", - AUDIO_TRACK_ONLY_RIGHT: "[PC Preview] unknow AUDIO_TRACK_ONLY_RIGHT", - AUDIO_TRACK_ONLY_LEFT: "[PC Preview] unknow AUDIO_TRACK_ONLY_LEFT", - AUDIO_TRACK_MUTED: "[PC Preview] unknow AUDIO_TRACK_MUTED", - AUDIO_TRACK_BUTT: "[PC Preview] unknow AUDIO_TRACK_BUTT" - } - const StopTypes = { - FREEZE: "[PC Preview] unknow FREEZE", - BLACKSCREEN: "[PC Preview] unknow BLACKSCREEN", - STOP_TYPE_BUTT: "[PC Preview] unknow STOP_TYPE_BUTT" - } - const AudioTypes = { - HI_DESC_AUDIO_UNDEFINED: "[PC Preview] unknow HI_DESC_AUDIO_UNDEFINED", - HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY: "[PC Preview] unknow HI_DESC_AUDIO_VISUAL_IMPAIRED_COMMENTARY", - HI_DESC_AUDIO_HEARING_IMPAIRED: "[PC Preview] unknow HI_DESC_AUDIO_HEARING_IMPAIRED", - HI_DESC_AUDIO_CLEAN_EFFACTS: "[PC Preview] unknow HI_DESC_AUDIO_CLEAN_EFFACTS" - } - const PlayInfo = { - startVideoPlayStatus: "[PC Preview] unknow startVideoPlayStatus", - startAudioPlayStatus: "[PC Preview] unknow startAudioPlayStatus", - signalStatus: "[PC Preview] unknow signalStatus", - caStatus: "[PC Preview] unknow caStatus", - frontendDataStatus: "[PC Preview] unknow frontendDataStatus" - } - const SubtitleTypes = { - SUBTITLE: "[PC Preview] unknow SUBTITLE", - TELETEXT: "[PC Preview] unknow TELETEXT", - CC: "[PC Preview] unknow CC" - } - const SubtComponentTypes = { - NORMAL: "[PC Preview] unknow NORMAL", - HOH: "[PC Preview] unknow HOH" - } - const TeletextComponent = { - motor: "[PC Preview] unknow motor", - magazingNum: "[PC Preview] unknow magazingNum", - pageNum: "[PC Preview] unknow pageNum" - } - const TTXRegions = { - TTX_REGION_WEST_EUROPE: "[PC Preview] unknow TTX_REGION_WEST_EUROPE", - TTX_REGION_EAST_EUROPE: "[PC Preview] unknow TTX_REGION_EAST_EUROPE", - TTX_REGION_RUSSIAN: "[PC Preview] unknow TTX_REGION_RUSSIAN", - TTX_REGION_ARABIC: "[PC Preview] unknow TTX_REGION_ARABIC", - TTX_REGION_FARSI: "[PC Preview] unknow TTX_REGION_FARSI", - TTX_REGION_BUTT: "[PC Preview] unknow TTX_REGION_BUTT" - } - const Modulations = { - QAM_AUTO: "[PC Preview] unknow QAM_AUTO", - QAM4_NR: "[PC Preview] unknow QAM4_NR", - QAM4: "[PC Preview] unknow QAM4", - QAM16: "[PC Preview] unknow QAM16", - QAM32: "[PC Preview] unknow QAM32", - QAM64: "[PC Preview] unknow QAM64", - QAM128: "[PC Preview] unknow QAM128", - QAM256: "[PC Preview] unknow QAM256", - QAM512: "[PC Preview] unknow QAM512", - QAM640: "[PC Preview] unknow QAM640", - QAM768: "[PC Preview] unknow QAM768", - QAM896: "[PC Preview] unknow QAM896", - QAM1024: "[PC Preview] unknow QAM1024", - QPSK: "[PC Preview] unknow QPSK", - BPSK: "[PC Preview] unknow BPSK", - OQPSK: "[PC Preview] unknow OQPSK", - MODU_8VSB: "[PC Preview] unknow MODU_8VSB", - MODU_16VSB: "[PC Preview] unknow MODU_16VSB" - } - const Status = { - RUNNING: "[PC Preview] unknow RUNNING", - UNSTART: "[PC Preview] unknow UNSTART" - } - const PVRFileInfo = { - fullPath: "[PC Preview] unknow fullPath", - size: "[PC Preview] unknow size", - duration: "[PC Preview] unknow duration", - videoResolution: "[PC Preview] unknow videoResolution", - audioComponents: "[PC Preview] unknow audioComponents", - subtitleComponents: "[PC Preview] unknow subtitleComponents", - isRadio: "[PC Preview] unknow isRadio" - } - const DtvSystems = { - DVB_STANDARD: "[PC Preview] unknow DVB_STANDARD", - ATSC_STANDARD: "[PC Preview] unknow ATSC_STANDARD" - } - - const ClosedCaptionList = { - listName: "[PC Preview] unknow listName", - ccList: "[PC Preview] unknow ccList", - listType: "[PC Preview] unknow listType", - currentPosition: "[PC Preview] unknow currentPosition" - } - const ClosedCaptionComponent = { - languageCode: "[PC Preview] unknow languageCode", - enCCType: "[PC Preview] unknow enCCType", - dataType: "[PC Preview] unknow dataType", - currentPosition: "[PC Preview] unknow currentPosition" - } - const CCAnalogSelectors = { - CC1: "[PC Preview] unknow CC1", - CC2: "[PC Preview] unknow CC2", - CC3: "[PC Preview] unknow CC3", - CC4: "[PC Preview] unknow CC4", - TEXT1: "[PC Preview] unknow TEXT1", - TEXT2: "[PC Preview] unknow TEXT2", - TEXT3: "[PC Preview] unknow TEXT3", - TEXT4: "[PC Preview] unknow TEXT4" - } - const CCDigitalSelectors = { - OFF: "[PC Preview] unknow OFF", - SERVICE1: "[PC Preview] unknow SERVICE1", - SERVICE2: "[PC Preview] unknow SERVICE2", - SERVICE3: "[PC Preview] unknow SERVICE3", - SERVICE4: "[PC Preview] unknow SERVICE4", - SERVICE5: "[PC Preview] unknow SERVICE5", - SERVICE6: "[PC Preview] unknow SERVICE6" - } - const FontSizes = { - DEFAULT: "[PC Preview] unknow DEFAULT", - SMALL: "[PC Preview] unknow SMALL", - NORMAL: "[PC Preview] unknow NORMAL", - LARGE: "[PC Preview] unknow LARGE" - } - const FontStyles = { - DEFAULT: "[PC Preview] unknow DEFAULT", - STYLE0: "[PC Preview] unknow STYLE0", - STYLE1: "[PC Preview] unknow STYLE1", - STYLE2: "[PC Preview] unknow STYLE2", - STYLE3: "[PC Preview] unknow STYLE3", - STYLE4: "[PC Preview] unknow STYLE4", - STYLE5: "[PC Preview] unknow STYLE5", - STYLE6: "[PC Preview] unknow STYLE6", - STYLE7: "[PC Preview] unknow STYLE7" - } - const Colors = { - DEFAULT: "[PC Preview] unknow DEFAULT", - BLACK: "[PC Preview] unknow BLACK", - RED: "[PC Preview] unknow RED", - GREEN: "[PC Preview] unknow GREEN", - BLUE: "[PC Preview] unknow BLUE", - YELLOW: "[PC Preview] unknow YELLOW", - MAGENTA: "[PC Preview] unknow MAGENTA", - STYLE6: "[PC Preview] unknow STYLE6", - CYAN: "[PC Preview] unknow CYAN" - } - const Opacities = { - DEFAULT: "[PC Preview] unknow DEFAULT", - SOLID: "[PC Preview] unknow SOLID", - FLASHING: "[PC Preview] unknow FLASHING", - TRANSLUCENT: "[PC Preview] unknow TRANSLUCENT", - TRANSPARENT: "[PC Preview] unknow TRANSPARENT" - } - const FontEdgeEffects = { - DEFAULT: "[PC Preview] unknow DEFAULT", - NONE: "[PC Preview] unknow NONE", - RAISED: "[PC Preview] unknow RAISED", - DEPRESSED: "[PC Preview] unknow DEPRESSED", - UNIFORM: "[PC Preview] unknow UNIFORM", - LETF_DROP_SHADOW: "[PC Preview] unknow LETF_DROP_SHADOW", - RIGHT_DROP_SHADOW: "[PC Preview] unknow RIGHT_DROP_SHADOW" - } - - const result = { - getBookManager: function () { - console.warn("dtv.getBookManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return BookManager; - }, - getChannelManager: function () { - console.warn("dtv.getChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ChannelManager; - }, - getAtvChannelManager: function () { - console.warn("dtv.getAtvChannelManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return AtvChannelManager; - }, - getParentalControlManager: function () { - console.warn("dtv.getParentalControlManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ParentalControlManager; - }, - getConfigManager: function () { - console.warn("dtv.getConfigManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DTVConfigManager; - }, - getEPGManager: function () { - console.warn("dtv.getEPGManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return EPGManager; - }, - getOTAManager: function () { - console.warn("dtv.getOTAManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return OTAManager; - }, - getHardwareManager: function () { - console.warn("dtv.getHardwareManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HardwareManager; - }, - getNetworkManager: function () { - console.warn("dtv.getNetworkManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return NetworkManager; - }, - getPlayerManager: function () { - console.warn("dtv.getPlayerManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PlayerManager; - }, - getRecorderManager: function () { - console.warn("dtv.getRecorderManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return RecorderManager; - }, - getPVRFilePlayer: function () { - console.warn("dtv.getPVRFilePlayer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PVRFilePlayer; - }, - getPVRFileManager: function () { - console.warn("dtv.getPVRFileManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PVRFileManager; - }, - getDTVManager: function () { - console.warn("dtv.getDTVManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DTVManager; - }, - getClosedCaptionManager: function () { - console.warn("dtv.getClosedCaptionManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ClosedCaptionManager; - }, - getDtvEventManager: function () { - console.warn("dtv.getDtvEventManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DtvEventManager; - } - } - - const BookManager = { - addTask: function (...args) { - console.warn("BookManager.addTask 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearAllTasks: function (...args) { - console.warn("BookManager.clearAllTasks 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createTask: function (...args) { - console.warn("BookManager.createTask 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, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - }, - deleteTask: function (...args) { - console.warn("BookManager.deleteTask 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - updateTask: function (...args) { - console.warn("BookManager.updateTask 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - findConflictTasks: function (...args) { - console.warn("BookManager.findConflictTasks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); - } else { - return new Promise((resolve, reject) => { - resolve(bookTaskArray); - }) - } - }, - getTaskByID: function (...args) { - console.warn("BookManager.getTaskByID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - }, - getAllTasks: function (...args) { - console.warn("BookManager.getAllTasks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var bookTaskArray = new Array(); - bookTaskArray.push(BookTask); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, bookTaskArray); - } else { - return new Promise((resolve, reject) => { - resolve(bookTaskArray); - }) - } - }, - getComingTask: function (...args) { - console.warn("BookManager.getComingTask 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, BookTask); - } else { - return new Promise((resolve, reject) => { - resolve(BookTask); - }) - } - } - } - const Channel = { - getChannelName: function (...args) { - console.warn("Channel.getChannelName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getFavTag: function (...args) { - console.warn("Channel.getFavTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var favTagArray = new Array(); - favTagArray.push(FavTags); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, favTagArray); - } else { - return new Promise((resolve, reject) => { - resolve(favTagArray); - }) - } - }, - getCaTag: function (...args) { - console.warn("Channel.getCaTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTag: function (...args) { - console.warn("Channel.getTag 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getVolume: function (...args) { - console.warn("Channel.getVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrackMode: function (...args) { - console.warn("Channel.getTrackMode 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, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - setChannelName: function (...args) { - console.warn("Channel.setChannelName 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setFavTag: function (...args) { - console.warn("Channel.setFavTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTag: function (...args) { - console.warn("Channel.setTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolume: function (...args) { - console.warn("Channel.setVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTrackMode: function (...args) { - console.warn("Channel.setTrackMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRunningStatus: function (...args) { - console.warn("Channel.getRunningStatus 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStatusTag: function (...args) { - console.warn("Channel.getStatusTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setStatusTag: function (...args) { - console.warn("Channel.setStatusTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSortTag: function (...args) { - console.warn("Channel.setSortTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSortTag: function (...args) { - console.warn("Channel.getSortTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelID: function (...args) { - console.warn("Channel.getChannelID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelNo: function (...args) { - console.warn("Channel.getChannelNo 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNetWorkName: function (...args) { - console.warn("Channel.getNetWorkName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const ChannelList = { - setFilter: function (...args) { - console.warn("ChannelList.setFilter 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getFilter: function (...args) { - console.warn("ChannelList.getFilter 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, ChannelFilter); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelFilter); - }) - } - }, - getChannelCount: function (...args) { - console.warn("ChannelList.getChannelCount 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannels: function (...args) { - console.warn("ChannelList.getChannels interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelArray = new Array(); - channelArray.push(Channel); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelArray); - }) - } - }, - getChannelByIndex: function (...args) { - console.warn("ChannelList.getChannelByIndex 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setListName: function (...args) { - console.warn("ChannelList.setListName 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getListName: function (...args) { - console.warn("ChannelList.getListName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - move: function (...args) { - console.warn("ChannelList.move 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - swap: function (...args) { - console.warn("ChannelList.swap 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPosByChannelID: function (...args) { - console.warn("ChannelList.getPosByChannelID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPosByChannelLcn: function (...args) { - console.warn("ChannelList.getPosByChannelLcn 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getGroupType: function (...args) { - console.warn("ChannelList.getGroupType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setChannelNameLang: function (...args) { - console.warn("ChannelList.setChannelNameLang 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const ChannelManager = { - getChannelByNo: function (...args) { - console.warn("ChannelManager.getChannelByNo 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getChannelById: function (...args) { - console.warn("ChannelManager.getChannelById 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getTsInfoByID: function (...args) { - console.warn("ChannelManager.getTsInfoByID 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, ChannelTsInfo); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelTsInfo); - }) - } - }, - importDBFromIniFile: function (...args) { - console.warn("ChannelManager.importDBFromIniFile 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - exportDBToFile: function (...args) { - console.warn("ChannelManager.exportDBToFile 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - importDBFromFile: function (...args) { - console.warn("ChannelManager.importDBFromFile 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteAll: function (...args) { - console.warn("ChannelManager.deleteAll 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelByID: function (...args) { - console.warn("ChannelManager.deleteChannelByID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreChannelByID: function (...args) { - console.warn("ChannelManager.restoreChannelByID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delChannelByTag: function (...args) { - console.warn("ChannelManager.delChannelByTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelsByNetworkType: function (...args) { - console.warn("ChannelManager.deleteChannelsByNetworkType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelsBySIElement: function (...args) { - console.warn("ChannelManager.deleteChannelsBySIElement 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - save: function (...args) { - console.warn("ChannelManager.save 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recover: function (...args) { - console.warn("ChannelManager.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 - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createChannel: function (...args) { - console.warn("ChannelManager.createChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getChannelList: function (...args) { - console.warn("ChannelManager.getChannelList 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, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - sort: function (...args) { - console.warn("ChannelManager.sort 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - sortProgramView: function (...args) { - console.warn("ChannelManager.sortProgramView 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDefaultOpenChannel: function (...args) { - console.warn("ChannelManager.setDefaultOpenChannel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.setChannelServiceTypeMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rebuildAllGroup: function (...args) { - console.warn("ChannelManager.rebuildAllGroup 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.getChannelServiceTypeMode 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, TVRadioFilters); - } else { - return new Promise((resolve, reject) => { - resolve(TVRadioFilters); - }) - } - }, - getChannelListByGroupType: function (...args) { - console.warn("ChannelManager.getChannelListByGroupType 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, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - getDefaultOpenChannel: function (...args) { - console.warn("ChannelManager.getDefaultOpenChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.setChannelServiceTypeMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rebuildAllGroup: function (...args) { - console.warn("ChannelManager.rebuildAllGroup 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannelServiceTypeMode: function (...args) { - console.warn("ChannelManager.getChannelServiceTypeMode 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, TVRadioFilters); - } else { - return new Promise((resolve, reject) => { - resolve(TVRadioFilters); - }) - } - }, - getDefaultOpenGroupType: function (...args) { - console.warn("ChannelManager.getDefaultOpenGroupType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUseFavGroups: function (...args) { - console.warn("ChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseStatalliteGroups: function (...args) { - console.warn("ChannelManager.getUseStatalliteGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseGroups: function (...args) { - console.warn("ChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - regenerateChannels: function (...args) { - console.warn("ChannelManager.regenerateChannels 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setFavNetworkName: function (...args) { - console.warn("ChannelManager.setFavNetworkName 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getLcnList: function (...args) { - console.warn("ChannelManager.getLcnList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - selectLcnList: function (...args) { - console.warn("ChannelManager.selectLcnList 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConflictLcnGroupNum: function (...args) { - console.warn("ChannelManager.getConflictLcnGroupNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConflictLcnChannelId: function (...args) { - console.warn("ChannelManager.getConflictLcnChannelId interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - getRegionList: function (...args) { - console.warn("ChannelManager.getRegionList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelRegionArray = new Array(); - channelRegionArray.push(ChannelRegion); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelRegionArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelRegionArray); - }) - } - }, - setRegionInfo: function (...args) { - console.warn("ChannelManager.setRegionInfo 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - reAssignLcn: function (...args) { - console.warn("ChannelManager.reAssignLcn 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - addUserChannel: function (...args) { - console.warn("ChannelManager.addUserChannel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const AnalogChannel = { - enableAFT: function (...args) { - console.warn("AnalogChannel.enableAFT 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAFTEnable: function (...args) { - console.warn("AnalogChannel.isAFTEnable 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setColorSystem: function (...args) { - console.warn("AnalogChannel.setColorSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorSystem: function (...args) { - console.warn("AnalogChannel.getColorSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOriginalColorSystem: function (...args) { - console.warn("AnalogChannel.getOriginalColorSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioSystem: function (...args) { - console.warn("AnalogChannel.setAudioSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioSystem: function (...args) { - console.warn("AnalogChannel.getAudioSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setMtsMode: function (...args) { - console.warn("AnalogChannel.setMtsMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getMtsMode: function (...args) { - console.warn("AnalogChannel.getMtsMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const AtvChannelManager = { - createChannel: function (...args) { - console.warn("AtvChannelManager.createChannel 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, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getChannelByID: function (...args) { - console.warn("AtvChannelManager.getChannelByID 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, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getAllChannelList: function (...args) { - console.warn("AtvChannelManager.getAllChannelList 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, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - getChannelList: function (...args) { - console.warn("AtvChannelManager.getChannelList 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, ChannelList); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelList); - }) - } - }, - deleteAll: function (...args) { - console.warn("AtvChannelManager.deleteAll 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deleteChannelByID: function (...args) { - console.warn("AtvChannelManager.deleteChannelByID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDefaultOpenChannel: function (...args) { - console.warn("AtvChannelManager.getDefaultOpenChannel 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, AnalogChannel); - } else { - return new Promise((resolve, reject) => { - resolve(AnalogChannel); - }) - } - }, - getUseGroups: function (...args) { - console.warn("AtvChannelManager.getUseGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - }, - getUseFavGroups: function (...args) { - console.warn("AtvChannelManager.getUseFavGroups interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var channelListArray = new Array(); - channelListArray.push(ChannelList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, channelListArray); - } else { - return new Promise((resolve, reject) => { - resolve(channelListArray); - }) - } - } - } - const RRTInfo = { - getRRTDimensionsNum: function (...args) { - console.warn("RRTInfo.getRRTDimensionsNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionName: function (...args) { - console.warn("RRTInfo.getRRTDimensionName 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionTypeNum: function (...args) { - console.warn("RRTInfo.getRRTDimensionTypeNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRRTDimensionValueName: function (...args) { - console.warn("RRTInfo.getRRTDimensionValueName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const ParentalControlManager = { - setParentalRateUstvAllTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvAllTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvFvTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvFvTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvVTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvVTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvSTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvSTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvLTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvLTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateUstvDTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateUstvDTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateMpaaTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateMpaaTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateCaenTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateCaenTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRateCafrTypes: function (...args) { - console.warn("ParentalControlManager.setParentalRateCafrTypes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentalRate: function (...args) { - console.warn("ParentalControlManager.setParentalRate 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentalRateUstvAllTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvAllTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvFvTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvFvTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvVTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvVTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvSTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvSTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvLTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvLTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateUstvDTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateUstvDTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateMpaaTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateMpaaTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateCaenTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateCaenTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRateCafrTypes: function (...args) { - console.warn("ParentalControlManager.getParentalRateCafrTypes 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getParentalRate: function (...args) { - console.warn("ParentalControlManager.getParentalRate 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getChannelParental: function (...args) { - console.warn("ParentalControlManager.getChannelParental 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, ChannelRate); - } else { - return new Promise((resolve, reject) => { - resolve(ChannelRate); - }) - } - }, - getChannelParentalChannel: function (...args) { - console.warn("ParentalControlManager.getChannelParentalChannel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParental: function (...args) { - console.warn("ParentalControlManager.getParental 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentalContent: function (...args) { - console.warn("ParentalControlManager.getParentalContent 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, ParentalContents); - } else { - return new Promise((resolve, reject) => { - resolve(ParentalContents); - }) - } - }, - getParentalStatus: function (...args) { - console.warn("ParentalControlManager.getParentalStatus 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getRRT: function (...args) { - console.warn("ParentalControlManager.getRRT 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, RRTInfo); - } else { - return new Promise((resolve, reject) => { - resolve(RRTInfo); - }) - } - }, - resetRRT: function (...args) { - console.warn("ParentalControlManager.resetRRT 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentLockAge: function (...args) { - console.warn("ParentalControlManager.getParentLockAge 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setParentLockAge: function (...args) { - console.warn("ParentalControlManager.setParentLockAge 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const DTVConfigManager = { - setString: function (...args) { - console.warn("DTVConfigManager.setString 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setInt: function (...args) { - console.warn("DTVConfigManager.setInt 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getString: function (...args) { - console.warn("DTVConfigManager.getString 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getInt: function (...args) { - console.warn("DTVConfigManager.getInt 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreDefaultConfig: function (...args) { - console.warn("DTVConfigManager.restoreDefaultConfig 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getConfigFileInt: function (...args) { - console.warn("DTVConfigManager.getConfigFileInt 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - switchTunerSignal: function (...args) { - console.warn("DTVConfigManager.switchTunerSignal 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const EPGManager = { - setEventLang: function (...args) { - console.warn("EPGManager.setEventLang 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startEpg: function (...args) { - console.warn("EPGManager.startEpg 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPresentEvent: function (...args) { - console.warn("EPGManager.getPresentEvent 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, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getFollowEvent: function (...args) { - console.warn("EPGManager.getFollowEvent 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, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getEvents: function (...args) { - console.warn("EPGManager.getEvents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var ePGEventArray = new Array(); - ePGEventArray.push(EPGEvent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, ePGEventArray); - } else { - return new Promise((resolve, reject) => { - resolve(ePGEventArray); - }) - } - }, - getEventById: function (...args) { - console.warn("EPGManager.getEventById 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, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - }, - getRelevantEvents: function (...args) { - console.warn("EPGManager.getEventById 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, EPGEvent); - } else { - return new Promise((resolve, reject) => { - resolve(EPGEvent); - }) - } - } - } - const OTAManager = { - startOta: function (...args) { - console.warn("OTAManager.startOta 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopOta: function (...args) { - console.warn("OTAManager.stopOta 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startDownloadFile: function (...args) { - console.warn("OTAManager.startDownloadFile 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopDownloadFile: function (...args) { - console.warn("OTAManager.stopDownloadFile 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const Motor = { - setLimit: function (...args) { - console.warn("Motor.setLimit 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - move: function (...args) { - console.warn("Motor.move 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopMove: function (...args) { - console.warn("Motor.stopMove 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAutoRolationSwitch: function (...args) { - console.warn("Motor.setAutoRolationSwitch 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const Multiplex = { - getBelongNetwork: function (...args) { - console.warn("Multiplex.getBelongNetwork 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, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - getID: function (...args) { - console.warn("Multiplex.getID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFrequency: function (...args) { - console.warn("Multiplex.getFrequency 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setFrequency: function (...args) { - console.warn("Multiplex.setFrequency 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVersion: function (...args) { - console.warn("Multiplex.getVersion 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, VersionTypes); - } else { - return new Promise((resolve, reject) => { - resolve(VersionTypes); - }) - } - }, - setVersion: function (...args) { - console.warn("Multiplex.setVersion 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getName: function (...args) { - console.warn("Multiplex.getName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getBandWidth: function (...args) { - console.warn("Multiplex.getBandWidth 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSymbolRate: function (...args) { - console.warn("Multiplex.getSymbolRate 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getModulation: function (...args) { - console.warn("Multiplex.getModulation 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPolarity: function (...args) { - console.warn("Multiplex.getPolarity 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const Tuner = { - getSignalStrength: function (...args) { - console.warn("Tuner.getSignalStrength 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSignalQuality: function (...args) { - console.warn("Tuner.getSignalQuality 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - connect: function (...args) { - console.warn("Tuner.connect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - disconnect: function (...args) { - console.warn("Tuner.disconnect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBER: function (...args) { - console.warn("Tuner.getBER 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSNR: function (...args) { - console.warn("Tuner.getSNR 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSignalType: function (...args) { - console.warn("Tuner.getSignalType 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, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - getTunerID: function (...args) { - console.warn("Tuner.getTunerID 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, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - getTuningMultiplexe: function (...args) { - console.warn("Tuner.getTuningMultiplexe 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, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - getTunerStatus: function (...args) { - console.warn("Tuner.getTunerStatus 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, TunerStatus); - } else { - return new Promise((resolve, reject) => { - resolve(TunerStatus); - }) - } - }, - getModulation: function (...args) { - console.warn("Tuner.getModulation 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, Modulations); - } else { - return new Promise((resolve, reject) => { - resolve(Modulations); - }) - } - } - } - const HardwareManager = { - getMotor: function (...args) { - console.warn("HardwareManager.getMotor 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, Motor); - } else { - return new Promise((resolve, reject) => { - resolve(Motor); - }) - } - }, - getTunerNum: function (...args) { - console.warn("HardwareManager.getTunerNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAllTuners: function (...args) { - console.warn("HardwareManager.getAllTuners interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var tunerArray = new Array(); - tunerArray.push(Tuner); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); - } else { - return new Promise((resolve, reject) => { - resolve(tunerArray); - }) - } - }, - getTunersByStatus: function (...args) { - console.warn("HardwareManager.getTunersByStatus interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var tunerArray = new Array(); - tunerArray.push(Tuner); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, tunerArray); - } else { - return new Promise((resolve, reject) => { - resolve(tunerArray); - }) - } - }, - getTunerByID: function (...args) { - console.warn("HardwareManager.getTunerByID 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, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - } - } - const Network = { - getID: function (...args) { - console.warn("Network.getID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMultiplexes: function (...args) { - console.warn("Network.getMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - setScanMultiplexes: function (...args) { - console.warn("Network.setScanMultiplexes 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getScanMultiplexes: function (...args) { - console.warn("Network.getScanMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - createMultiplex: function (...args) { - console.warn("Network.createMultiplex 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, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - createTmpMultiplex: function (...args) { - console.warn("Network.createTmpMultiplex 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, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - getPresetMultiplexes: function (...args) { - console.warn("Network.getPresetMultiplexes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var multiplexArray = new Array(); - multiplexArray.push(Multiplex); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, multiplexArray); - } else { - return new Promise((resolve, reject) => { - resolve(multiplexArray); - }) - } - }, - getMultiplexById: function (...args) { - console.warn("Network.getMultiplexById 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, Multiplex); - } else { - return new Promise((resolve, reject) => { - resolve(Multiplex); - }) - } - }, - removeMultiplex: function (...args) { - console.warn("Network.removeMultiplex 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - saveMultiplexes: function (...args) { - console.warn("Network.saveMultiplexes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recoverMultiplexes: function (...args) { - console.warn("Network.recoverMultiplexes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSelected: function (...args) { - console.warn("Network.isSelected 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSelect: function (...args) { - console.warn("Network.setSelect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNetworkNameList: function (...args) { - console.warn("Network.getNetworkNameList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - } - const TimeManager = { - getCalendarTime: function (...args) { - console.warn("TimeManager.getCalendarTime 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - setCalendarTime: function (...args) { - console.warn("TimeManager.setCalendarTime 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - getTimeZone: function (...args) { - console.warn("TimeManager.getTimeZone 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTimeZone: function (...args) { - console.warn("TimeManager.setTimeZone 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - secondToDate: function (...args) { - console.warn("TimeManager.secondToDate 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - dateToSecond: function (...args) { - console.warn("TimeManager.dateToSecond 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - syncTime: function (...args) { - console.warn("TimeManager.syncTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncTimeFlag: function (...args) { - console.warn("TimeManager.getSyncTimeFlag 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - syncTimeZone: function (...args) { - console.warn("TimeManager.syncTimeZone 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncTimeZoneFlag: function (...args) { - console.warn("TimeManager.getSyncTimeZoneFlag 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getSleepTime: function (...args) { - console.warn("TimeManager.getSleepTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWakeupInternal: function (...args) { - console.warn("TimeManager.setWakeupInternal 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTimeToSystem: function (...args) { - console.warn("TimeManager.setTimeToSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - syncDaylight: function (...args) { - console.warn("TimeManager.syncDaylight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSyncDaylightFlag: function (...args) { - console.warn("TimeManager.getSyncDaylightFlag 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDaylight: function (...args) { - console.warn("TimeManager.setDaylight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDaylight: function (...args) { - console.warn("TimeManager.getDaylight 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - } - const NetworkManager = { - getAllSupportNetworks: function (...args) { - console.warn("NetworkManager.getAllSupportNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getNetworks: function (...args) { - console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getNetworks: function (...args) { - console.warn("NetworkManager.getNetworks interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var networkArray = new Array(); - networkArray.push(Network); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, networkArray); - } else { - return new Promise((resolve, reject) => { - resolve(networkArray); - }) - } - }, - getCurrentNetworkType: function (...args) { - console.warn("NetworkManager.getCurrentNetworkType 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, NetworkTypes); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkTypes); - }) - } - }, - setCurrentNetworkType: function (...args) { - console.warn("NetworkManager.setCurrentNetworkType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - createNetwork: function (...args) { - console.warn("NetworkManager.createNetwork 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, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - getNetworkById: function (...args) { - console.warn("NetworkManager.getNetworkById 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, Network); - } else { - return new Promise((resolve, reject) => { - resolve(Network); - }) - } - }, - removeNetwork: function (...args) { - console.warn("NetworkManager.removeNetwork 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - removeAllSatellite: function (...args) { - console.warn("NetworkManager.removeAllSatellite 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearNetworks: function (...args) { - console.warn("NetworkManager.clearNetworks 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - saveNetworks: function (...args) { - console.warn("NetworkManager.saveNetworks 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - recoverNetworks: function (...args) { - console.warn("NetworkManager.recoverNetworks 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTimeManager: function (...args) { - console.warn("NetworkManager.getTimeManager 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, TimeManager); - } else { - return new Promise((resolve, reject) => { - resolve(TimeManager); - }) - } - }, - setNetworkType: function (...args) { - console.warn("NetworkManager.setNetworkType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const SubtitleComponent = { - getLanguageCode: function (...args) { - console.warn("SubtitleComponent.getLanguageCode 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSubtitleType: function (...args) { - console.warn("SubtitleComponent.getSubtitleType 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, SubtitleTypes); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleTypes); - }) - } - }, - getSubtComponentType: function (...args) { - console.warn("SubtitleComponent.getSubtComponentType 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, SubtComponentTypes); - } else { - return new Promise((resolve, reject) => { - resolve(SubtComponentTypes); - }) - } - }, - getPID: function (...args) { - console.warn("SubtitleComponent.getPID 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMagazingNum: function (...args) { - console.warn("SubtitleComponent.getMagazingNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPageNum: function (...args) { - console.warn("SubtitleComponent.getPageNum 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPos: function (...args) { - console.warn("SubtitleComponent.getPos 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHdSubtitle: function (...args) { - console.warn("SubtitleComponent.isHdSubtitle 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getSubtComponentTag: function (...args) { - console.warn("SubtitleComponent.getSubtComponentTag 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const TeletextControl = { - showTTX: function (...args) { - console.warn("TeletextControl.showTTX 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isTTXVisible: function (...args) { - console.warn("TeletextControl.isTTXVisible 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTTXAvailable: function (...args) { - console.warn("TeletextControl.isTTXAvailable 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getCurrentTTX: function (...args) { - console.warn("TeletextControl.getCurrentTTX 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, TeletextComponent); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextComponent); - }) - } - }, - setCommand: function (...args) { - console.warn("TeletextControl.setCommand 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setTTXLanguage: function (...args) { - console.warn("TeletextControl.setTTXLanguage 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTTXLanguage: function (...args) { - console.warn("TeletextControl.getTTXLanguage 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setTTXRegion: function (...args) { - console.warn("TeletextControl.setTTXRegion 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTTXRegion: function (...args) { - console.warn("TeletextControl.getTTXRegion 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, TTXRegions); - } else { - return new Promise((resolve, reject) => { - resolve(TTXRegions); - }) - } - }, - showHbbtvTtxApp: function (...args) { - console.warn("TeletextControl.showHbbtvTtxApp 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHbbtvTtxAppVisible: function (...args) { - console.warn("TeletextControl.isHbbtvTtxAppVisible 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isHbbtvTtxAppAvailable: function (...args) { - console.warn("TeletextControl.isHbbtvTtxAppAvailable 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - showSubtitle: function (...args) { - console.warn("TeletextControl.showSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const AdControl = { - setAdEnable: function (...args) { - console.warn("AdControl.setAdEnable 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAdEnable: function (...args) { - console.warn("AdControl.isAdEnable 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAdBalance: function (...args) { - console.warn("AdControl.setAdBalance 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdBalance: function (...args) { - console.warn("AdControl.getAdBalance 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAdToSomePort: function (...args) { - console.warn("AdControl.setAdToSomePort 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAdToSomePort: function (...args) { - console.warn("AdControl.isAdToSomePort 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - } - const Ginga = { - init: function (...args) { - console.warn("Ginga.init 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - deinit: function (...args) { - console.warn("Ginga.deinit 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - dispatchKey: function (...args) { - console.warn("Ginga.dispatchKey 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getAppList: function (...args) { - console.warn("Ginga.getAppList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - startApp: function (...args) { - console.warn("Ginga.startApp 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setGraphicSurface: function (...args) { - console.warn("Ginga.setGraphicSurface 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const Player = { - showVideo: function (...args) { - console.warn("Player.showVideo 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - freezeVideo: function (...args) { - console.warn("Player.freezeVideo 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isVideoFrozen: function (...args) { - console.warn("Player.isVideoFrozen 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - changeChannel: function (...args) { - console.warn("Player.changeChannel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopSync: function (...args) { - console.warn("Player.stopSync 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentChannel: function (...args) { - console.warn("Player.getCurrentChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getReplaceChannel: function (...args) { - console.warn("Player.getReplaceChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getPreviousChannel: function (...args) { - console.warn("Player.getPreviousChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - setTimeShiftEncryption: function (...args) { - console.warn("Player.setTimeShiftEncryption 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - play: function (...args) { - console.warn("Player.play 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - pause: function (...args) { - console.warn("Player.pause 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTimeShiftInfo: function (...args) { - console.warn("Player.getTimeShiftInfo 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, TimeShiftInfo); - } else { - return new Promise((resolve, reject) => { - resolve(TimeShiftInfo); - }) - } - }, - startTimeShift: function (...args) { - console.warn("Player.startTimeShift 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopTimeShift: function (...args) { - console.warn("Player.stopTimeShift 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - seek: function (...args) { - console.warn("Player.seek 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - trickPlay: function (...args) { - console.warn("Player.trickPlay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrickMode: function (...args) { - console.warn("Player.getTrickMode 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, TrickModes); - } else { - return new Promise((resolve, reject) => { - resolve(TrickModes); - }) - } - }, - getStatus: function (...args) { - console.warn("Player.getStatus 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, PlayStatus); - } else { - return new Promise((resolve, reject) => { - resolve(PlayStatus); - }) - } - }, - setMute: function (...args) { - console.warn("Player.setMute 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMuteStatus: function (...args) { - console.warn("Player.getMuteStatus 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDisplay: function (...args) { - console.warn("Player.setDisplay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearDisplay: function (...args) { - console.warn("Player.clearDisplay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudioComponents: function (...args) { - console.warn("Player.getCurrentAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var audioComponentArray = new Array(); - audioComponentArray.push(AudioComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(audioComponentArray); - }) - } - }, - selectAudio: function (...args) { - console.warn("Player.selectAudio 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudio: function (...args) { - console.warn("Player.getCurrentAudio 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, AudioComponent); - } else { - return new Promise((resolve, reject) => { - resolve(AudioComponent); - }) - } - }, - showSubtitle: function (...args) { - console.warn("Player.showSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSubtitleVisible: function (...args) { - console.warn("Player.isSubtitleVisible 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - pauseSubtitle: function (...args) { - console.warn("Player.pauseSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeSubtitle: function (...args) { - console.warn("Player.resumeSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSubtitleHiAvailable: function (...args) { - console.warn("Player.setSubtitleHiAvailable 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSubtitleHiStatus: function (...args) { - console.warn("Player.setSubtitleHiStatus 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSubtitleHiStatus: function (...args) { - console.warn("Player.getSubtitleHiStatus 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSubtitleLanguage: function (...args) { - console.warn("Player.setSubtitleLanguage 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - selectSubtitle: function (...args) { - console.warn("Player.selectSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSurface: function (...args) { - console.warn("Player.setSurface 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentSubtitle: function (...args) { - console.warn("Player.getCurrentSubtitle 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, SubtitleComponent); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleComponent); - }) - } - }, - getTeletextControl: function (...args) { - console.warn("Player.getTeletextControl 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, TeletextControl); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextControl); - }) - } - }, - releaseResource: function (...args) { - console.warn("Player.releaseResource 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeResource: function (...args) { - console.warn("Player.resumeResource 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWindowRect: function (...args) { - console.warn("Player.setWindowRect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("Player.getWindowRect 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - setClipRect: function (...args) { - console.warn("Player.setClipRect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getClipRect: function (...args) { - console.warn("Player.getClipRect 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - snapshot: function (...args) { - console.warn("Player.snapshot 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTuner: function (...args) { - console.warn("Player.getTuner 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, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - }, - setZOrder: function (...args) { - console.warn("Player.setZOrder 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioTrackMode: function (...args) { - console.warn("Player.setAudioTrackMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAudioLanguage: function (...args) { - console.warn("Player.setAudioLanguage 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioTrackMode: function (...args) { - console.warn("Player.getAudioTrackMode 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, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - setStopMode: function (...args) { - console.warn("Player.setStopMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStopMode: function (...args) { - console.warn("Player.getStopMode 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, StopTypes); - } else { - return new Promise((resolve, reject) => { - resolve(StopTypes); - }) - } - }, - getVideoResolutionHeight: function (...args) { - console.warn("Player.getVideoResolutionHeight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVideoResolutionWidth: function (...args) { - console.warn("Player.getVideoResolutionWidth 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFPS: function (...args) { - console.warn("Player.getFPS 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolume: function (...args) { - console.warn("Player.setVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getVolume: function (...args) { - console.warn("Player.getVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopAudioStreamOutput: function (...args) { - console.warn("Player.stopAudioStreamOutput 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startAudioStreamOutput: function (...args) { - console.warn("Player.startAudioStreamOutput 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDolbyInfoStreamType: function (...args) { - console.warn("Player.getDolbyInfoStreamType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDolbyInfoAcmod: function (...args) { - console.warn("Player.getDolbyInfoAcmod 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDolbyRange: function (...args) { - console.warn("Player.setDolbyRange 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDRARawChannel: function (...args) { - console.warn("Player.getDRARawChannel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdControl: function (...args) { - console.warn("Player.getAdControl 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, AdControl); - } else { - return new Promise((resolve, reject) => { - resolve(AdControl); - }) - } - }, - ewsActionControl: function (...args) { - console.warn("Player.ewsActionControl 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getGinga: function (...args) { - console.warn("Player.getGinga 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, Ginga); - } else { - return new Promise((resolve, reject) => { - resolve(Ginga); - }) - } - }, - getSupportStatus: function (...args) { - console.warn("Player.getSupportStatus 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - switchToBarkerChannelFreSync: function (...args) { - console.warn("Player.switchToBarkerChannelFreSync 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAvFramePlaying: function (...args) { - console.warn("Player.getAvFramePlaying 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getTimeShiftAudioComponents: function (...args) { - console.warn("Player.getTimeShiftAudioComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var audioComponentArray = new Array(); - audioComponentArray.push(AudioComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, audioComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(audioComponentArray); - }) - } - }, - selectTimeShiftAudio: function (...args) { - console.warn("Player.selectTimeShiftAudio 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSubtitleFirSecLang: function (...args) { - console.warn("Player.getSubtitleFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - getAudioFirSecLang: function (...args) { - console.warn("Player.getAudioFirSecLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - setAudioType: function (...args) { - console.warn("Player.setAudioType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioType: function (...args) { - console.warn("Player.getAudioType 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, AudioTypes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTypes); - }) - } - }, - getCurrentPlayInfo: function (...args) { - console.warn("Player.getCurrentPlayInfo 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, PlayInfo); - } else { - return new Promise((resolve, reject) => { - resolve(PlayInfo); - }) - } - }, - } - const PlayerManager = { - createPlayer: function (...args) { - console.warn("PlayerManager.createPlayer 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, Player); - } else { - return new Promise((resolve, reject) => { - resolve(Player); - }) - } - }, - getPlayers: function (...args) { - console.warn("PlayerManager.getPlayers interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var playerArray = new Array(); - playerArray.push(Player); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, playerArray); - } else { - return new Promise((resolve, reject) => { - resolve(playerArray); - }) - } - }, - destroyPlayer: function (...args) { - console.warn("PlayerManager.destroyPlayer 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const Recorder = { - start: function (...args) { - console.warn("Recorder.start 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startpvrEncryption: function (...args) { - console.warn("Recorder.startpvrEncryption 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getChannel: function (...args) { - console.warn("Recorder.getChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - }, - getRecordFile: function (...args) { - console.warn("Recorder.getRecordFile interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var objectArray = new Array(); - objectArray.push(paramMock.paramObjectMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, objectArray); - } else { - return new Promise((resolve, reject) => { - resolve(objectArray); - }) - } - }, - stop: function (...args) { - console.warn("Recorder.stop 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTuner: function (...args) { - console.warn("Recorder.getTuner 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, Tuner); - } else { - return new Promise((resolve, reject) => { - resolve(Tuner); - }) - } - }, - getAlreadyRecordTime: function (...args) { - console.warn("Recorder.getAlreadyRecordTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDuration: function (...args) { - console.warn("Recorder.getDuration 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getRecordStatus: function (...args) { - console.warn("Recorder.getRecordStatus 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, Status); - } else { - return new Promise((resolve, reject) => { - resolve(Status); - }) - } - }, - } - const RecorderManager = { - createRecorder: function (...args) { - console.warn("RecorderManager.createRecorder 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, Recorder); - } else { - return new Promise((resolve, reject) => { - resolve(Recorder); - }) - } - }, - getAllRecorders: function (...args) { - console.warn("RecorderManager.getAllRecorders 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, Recorder); - } else { - return new Promise((resolve, reject) => { - resolve(Recorder); - }) - } - }, - destroyRecorder: function (...args) { - console.warn("RecorderManager.destroyRecorder 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - const PVRFilePlayer = { - start: function (...args) { - console.warn("PVRFilePlayer.start 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - start: function (...args) { - console.warn("PVRFilePlayer.start 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stop: function (...args) { - console.warn("PVRFilePlayer.stop 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - pause: function (...args) { - console.warn("PVRFilePlayer.pause 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resume: function (...args) { - console.warn("PVRFilePlayer.resume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - trickPlay: function (...args) { - console.warn("PVRFilePlayer.trickPlay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentTrickMode: function (...args) { - console.warn("PVRFilePlayer.getCurrentTrickMode 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, TrickModes); - } else { - return new Promise((resolve, reject) => { - resolve(TrickModes); - }) - } - }, - seekTo: function (...args) { - console.warn("PVRFilePlayer.seekTo 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentAudio: function (...args) { - console.warn("PVRFilePlayer.getCurrentAudio 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, AudioComponent); - } else { - return new Promise((resolve, reject) => { - resolve(AudioComponent); - }) - } - }, - selectAudio: function (...args) { - console.warn("PVRFilePlayer.selectAudio 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurrentSubtitle: function (...args) { - console.warn("PVRFilePlayer.getCurrentSubtitle 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, SubtitleComponent); - } else { - return new Promise((resolve, reject) => { - resolve(SubtitleComponent); - }) - } - }, - getSubtitleComponents: function (...args) { - console.warn("PVRFilePlayer.getSubtitleComponents interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var subtitleComponentArray = new Array(); - subtitleComponentArray.push(SubtitleComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, subtitleComponentArray); - } else { - return new Promise((resolve, reject) => { - resolve(subtitleComponentArray); - }) - } - }, - selectSubtitle: function (...args) { - console.warn("PVRFilePlayer.selectSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - showSubtitle: function (...args) { - console.warn("PVRFilePlayer.showSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSubtitleVisible: function (...args) { - console.warn("PVRFilePlayer.isSubtitleVisible 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - pauseSubtitle: function (...args) { - console.warn("PVRFilePlayer.pauseSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeSubtitle: function (...args) { - console.warn("PVRFilePlayer.resumeSubtitle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTeletextControl: function (...args) { - console.warn("PVRFilePlayer.getTeletextControl 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, TeletextControl); - } else { - return new Promise((resolve, reject) => { - resolve(TeletextControl); - }) - } - }, - getCurrentPosition: function (...args) { - console.warn("PVRFilePlayer.getCurrentPosition 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSurface: function (...args) { - console.warn("PVRFilePlayer.setSurface 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setWindowRect: function (...args) { - console.warn("PVRFilePlayer.setWindowRect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("PVRFilePlayer.getWindowRect 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - getPVRFileInfo: function (...args) { - console.warn("PVRFilePlayer.getPVRFileInfo 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, PVRFileInfo); - } else { - return new Promise((resolve, reject) => { - resolve(PVRFileInfo); - }) - } - }, - setAudioTrackMode: function (...args) { - console.warn("PVRFilePlayer.setAudioTrackMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioTrackMode: function (...args) { - console.warn("PVRFilePlayer.getAudioTrackMode 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, AudioTrackModes); - } else { - return new Promise((resolve, reject) => { - resolve(AudioTrackModes); - }) - } - }, - getCurrentChannel: function (...args) { - console.warn("PVRFilePlayer.getCurrentChannel 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, Channel); - } else { - return new Promise((resolve, reject) => { - resolve(Channel); - }) - } - } - } - const PVRFileManager = { - delete: function (...args) { - console.warn("PVRFileManager.delete 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - rename: function (...args) { - console.warn("PVRFileManager.rename 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUserData: function (...args) { - console.warn("PVRFileManager.setUserData 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUserData: function (...args) { - console.warn("PVRFileManager.getUserData 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const DTVManager = { - prepareDTV: function (...args) { - console.warn("DTVManager.prepareDTV 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - unPrepareDTV: function (...args) { - console.warn("DTVManager.unPrepareDTV 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - releaseDTVMem: function (...args) { - console.warn("DTVManager.releaseDTVMem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resumeDTVMem: function (...args) { - console.warn("DTVManager.resumeDTVMem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - onStandby: function (...args) { - console.warn("DTVManager.onStandby 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - onWakeup: function (...args) { - console.warn("DTVManager.onWakeup 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setCountry: function (...args) { - console.warn("DTVManager.setCountry 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCountry: function (...args) { - console.warn("DTVManager.getCountry 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setAreaCode: function (...args) { - console.warn("DTVManager.setAreaCode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAreaCode: function (...args) { - console.warn("DTVManager.getAreaCode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSysLang: function (...args) { - console.warn("DTVManager.setSysLang 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSysLang: function (...args) { - console.warn("DTVManager.getSysLang interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var subtitleComponentArray = new Array(); - subtitleComponentArray.push(SubtitleComponent); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setScreenBlueEnable: function (...args) { - console.warn("DTVManager.setScreenBlueEnable 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getScreenBlueEnable: function (...args) { - console.warn("DTVManager.getScreenBlueEnable 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDtvSystem: function (...args) { - console.warn("DTVManager.setDtvSystem 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDtvSystem: function (...args) { - console.warn("DTVManager.getDtvSystem 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, DtvSystems); - } else { - return new Promise((resolve, reject) => { - resolve(DtvSystems); - }) - } - }, - setFeFakeMode: function (...args) { - console.warn("DTVManager.setFeFakeMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getJavaAPIVersion: function (...args) { - console.warn("DTVManager.getJavaAPIVersion 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const ClosedCaptionManager = { - getUsedCCLists: function (...args) { - console.warn("ClosedCaptionManager.getUsedCCLists interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var closedCaptionListArray = new Array(); - closedCaptionListArray.push(ClosedCaptionList); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, closedCaptionListArray); - } else { - return new Promise((resolve, reject) => { - resolve(closedCaptionListArray); - }) - } - }, - getCurrentCC: function (...args) { - console.warn("ClosedCaptionManager.getCurrentCC 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, ClosedCaptionComponent); - } else { - return new Promise((resolve, reject) => { - resolve(ClosedCaptionComponent); - }) - } - }, - isCCVisible: function (...args) { - console.warn("ClosedCaptionManager.isCCVisible 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - showCC: function (...args) { - console.warn("ClosedCaptionManager.showCC 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - showCC: function (...args) { - console.warn("ClosedCaptionManager.showCC 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isCCShow: function (...args) { - console.warn("ClosedCaptionManager.isCCShow 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAnalogSelector: function (...args) { - console.warn("ClosedCaptionManager.setAnalogSelector 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAnalogSelector: function (...args) { - console.warn("ClosedCaptionManager.setAnalogSelector 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, CCAnalogSelectors); - } else { - return new Promise((resolve, reject) => { - resolve(CCAnalogSelectors); - }) - } - }, - setDigitalSelector: function (...args) { - console.warn("ClosedCaptionManager.setDigitalSelector 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDigitalSelector: function (...args) { - console.warn("ClosedCaptionManager.getDigitalSelector 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, CCDigitalSelectors); - } else { - return new Promise((resolve, reject) => { - resolve(CCDigitalSelectors); - }) - } - }, - setFontSize: function (...args) { - console.warn("ClosedCaptionManager.setFontSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontSize: function (...args) { - console.warn("ClosedCaptionManager.getFontSize 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, FontSizes); - } else { - return new Promise((resolve, reject) => { - resolve(FontSizes); - }) - } - }, - setFontStyle: function (...args) { - console.warn("ClosedCaptionManager.setFontStyle 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontStyle: function (...args) { - console.warn("ClosedCaptionManager.getFontStyle 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, FontStyles); - } else { - return new Promise((resolve, reject) => { - resolve(FontStyles); - }) - } - }, - setFontColor: function (...args) { - console.warn("ClosedCaptionManager.setFontColor 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontColor: function (...args) { - console.warn("ClosedCaptionManager.getFontColor 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, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - }, - setFontOpacity: function (...args) { - console.warn("ClosedCaptionManager.setFontOpacity 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontOpacity: function (...args) { - console.warn("ClosedCaptionManager.getFontOpacity 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, Opacities); - } else { - return new Promise((resolve, reject) => { - resolve(Opacities); - }) - } - }, - setBackgroundColor: function (...args) { - console.warn("ClosedCaptionManager.setBackgroundColor 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBackgroundColor: function (...args) { - console.warn("ClosedCaptionManager.getBackgroundColor 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, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - }, - setBackgroundOpacity: function (...args) { - console.warn("ClosedCaptionManager.setBackgroundOpacity 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBackgroundOpacity: function (...args) { - console.warn("ClosedCaptionManager.getBackgroundOpacity 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, Opacities); - } else { - return new Promise((resolve, reject) => { - resolve(Opacities); - }) - } - }, - setFontEdgeEffect: function (...args) { - console.warn("ClosedCaptionManager.setFontEdgeEffect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontEdgeEffect: function (...args) { - console.warn("ClosedCaptionManager.getFontEdgeEffect 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, FontEdgeEffects); - } else { - return new Promise((resolve, reject) => { - resolve(FontEdgeEffects); - }) - } - }, - setFontEdgeColor: function (...args) { - console.warn("ClosedCaptionManager.setFontEdgeColor 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFontEdgeColor: function (...args) { - console.warn("ClosedCaptionManager.getFontEdgeColor 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, Colors); - } else { - return new Promise((resolve, reject) => { - resolve(Colors); - }) - } - } - } - const DtvEventManager = { - on: function (...args) { - console.warn("DtvEventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - off: function (...args) { - console.warn("DtvEventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - return result; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/global/rawFileDescriptor.js b/runtime/main/extend/systemplugin/napi/global/rawFileDescriptor.js deleted file mode 100644 index ef263de1..00000000 --- a/runtime/main/extend/systemplugin/napi/global/rawFileDescriptor.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 RawFileDescriptor = { - fd : '[PC Preview] unknow number', - offset : '[PC Preview] unknow number', - length : '[PC Preview] unknow number' -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/global/resource.js b/runtime/main/extend/systemplugin/napi/global/resource.js deleted file mode 100644 index 8d2d8906..00000000 --- a/runtime/main/extend/systemplugin/napi/global/resource.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 Resource = { - bundleName : '[PC Preview] unknow string', - moduleName : '[PC Preview] unknow string', - id : '[PC Preview] unknow number' -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js deleted file mode 100644 index d79cbefb..00000000 --- a/runtime/main/extend/systemplugin/napi/index.js +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright (c) 2021-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 { mockSystemParameter } from './ohos_systemparameter' -import { mockSystemCapability } from './ohos_systemCapability' -import { mockAbility } from './ohos_application_Ability' -import { mockErrorCode } from './ohos_ability_errorCode' -import { mockFeatureAbility } from './ohos_ability_featureAbility' -import { mockDataUriUtils } from './ohos_ability_dataUriUtils' -import { mockWantConstant } from './ohos_ability_wantConstant' -import { mockAbilityConstant } from './ohos_application_AbilityConstant' -import { mockAbilityDelegatorRegistry } from './ohos_application_abilityDelegatorRegistry' -import { mockAbilityLifecycleCallback } from './ohos_application_AbilityLifecycleCallback' -import { mockFormExtension } from './ohos_application_FormExtension' -import { mockStaticSubscriberExtensionAbility } from './ohos_application_StaticSubscriberExtensionAbility' -import { mockFormHost } from './ohos_application_formHost' -import { mockFormInfo } from './ohos_application_formInfo' -import { mockErrorManager } from './ohos_application_errorManager' -import { mockQuickFixManager } from './ohos_application_quickFixManager' -import { mockTestRunner } from './ohos_application_testRunner' -import { mockWant } from './ohos_application_Want' -import { mockServiceExtensionAbility } from './ohos_application_ServiceExtensionAbility' -import { mockStartOptions } from './ohos_application_StartOptions' -import { mockAbilityStage } from './ohos_application_AbilityStage' -import { mockFormBindingData } from './ohos_application_formBindingData' -import { mockFormError } from './ohos_application_formError' -import { mockAbilityManager } from './ohos_application_abilityManager' -import { mockParticleAbility } from './ohos_ability_particleAbility' -import { mockAppManager } from './ohos_application_appManager' -import { mockConfiguration } from './ohos_application_Configuration' -import { mockConfigurationConstant } from './ohos_application_ConfigurationConstant' -import { mockContext } from './ohos_application_context' -import { mockDataShareExtensionAbility } from './ohos_application_DataShareExtensionAbility' -import { mockEnvironmentCallback } from './ohos_application_EnvironmentCallback' -import { mockMissionManager } from "./ohos_application_missionManager" -import { mockUriPermissionManager } from "./ohos_application_uriPermissionManager" -import { mockCommonEvent } from './ohos_commonEvent' -import { mockNotification } from './ohos_notification' -import { mockFileio } from './ohos_fileio' -import { mockWorker } from './ohos_worker' -import { mockUtil } from './ohos_util' -import { mockPower } from './ohos_power' -import { mockRunninglock } from './ohos_runninglock' -import { mockThermal } from './ohos_thermal' -import { mockBatteryStatistics } from './ohos_batteryStatistics' -import { mockIntl } from './ohos_intl' -import { mockI18N } from './ohos_i18n' -import { mockRpc } from './ohos_rpc' -import { mockProcess } from './ohos_process' -import { mockUrl } from './ohos_url' -import { mockHiAppEvent } from './ohos_hiAppEvent' -import { mockHiChecker } from './ohos_hichecker' -import { mockHiSysEvent } from './ohos_hiSysEvent' -import { mockHiTraceChain } from './ohos_hiTraceChain' -import { mockHiTraceMeter } from './ohos_hiTraceMeter' -import { mockHidebug } from './ohos_hidebug' -import { mockFaultLogger } from './ohos_faultLogger' -import { mockTv } from './tv' -import { mockDtv } from './dtv' -import { mockDistributedAccount } from './ohos_account_distributedAccount' -import { mockEmitter } from './ohos_events_emitter' -import { mockDistributedObject } from './ohos_data_distributedDataObject' -import { mockDataAbility } from './ohos_data_dataAbility' -import { mockStorage } from './system_storage' -import { mockDataShare } from './ohos_data_dataShare' -import { mockDataSharePredicates } from './ohos_data_dataSharePredicates' -import { DataShareResultSet } from './ohos_data_DataShareResultSet' -import { mockInputDevice } from './ohos_multimodalInput_inputDevice' -import { mockVibrator } from './ohos_vibrator' -import { mockSensor } from './ohos_sensor' -import { mockWifi } from './ohos_wifi' -import { mockWifiExt } from './ohos_wifiext' -import { mockUsb } from './ohos_usb' -import { mockBundle } from './ohos_bundle' -import { mockInnerBundle } from './ohos_bundle_innerBundleManager' -import { mockUri } from './ohos_uri' -import { mockXml } from './ohos_xml' -import { mockConvertXml } from './ohos_convertxml' -import { mockStatfs } from './ohos_statfs' -import { mockFileManager } from "./ohos_fileManager" -import { mockEnvironment } from "./ohos_environment" -import { mockStorageStatistics } from "./ohos_storageStatistics" -import { mockVolumeManager } from "./ohos_volumeManager" -import { mockSettings } from './ohos_settings' -import { mockAbilityAccessCtrl } from './ohos_abilityAccessCtrl' -import { mockConfigPolicy } from './ohos_configPolicy' -import { mockUpdate } from './ohos_update' -import { mockBackgroundTaskManager } from './ohos_backgroundTaskManager' -import { mockBundleState } from './ohos_bundleState' -import { mockSecurityLabel } from './ohos_securitylabel' -import { mockWorkScheduler } from './ohos_workScheduler' -import { mockWorkSchedulerExtensionAbility } from './ohos_WorkSchedulerExtensionAbility' -import { mockUserAuth } from './ohos_userIAM_userAuth' -import { mockFaceAuth } from './ohos_userIAM_faceAuth' -import { mockArrayList } from './ohos_util_Arraylist' -import { mockDeque } from './ohos_util_Deque' -import { mockHashMap } from './ohos_util_HashMap' -import { mockHashSet } from './ohos_util_HashSet' -import { mockLightWeightMap } from './ohos_util_LightWeightMap' -import { mockLightWeightSet } from './ohos_util_LightWeightSet' -import { mockLinkedList } from './ohos_util_LinkedList' -import { mockList } from './ohos_util_List' -import { mockPlainArray } from './ohos_util_PlainArray' -import { mockQueue } from './ohos_util_Queue' -import { mockStack } from './ohos_util_Stack' -import { mockTreeMap } from './ohos_util_TreeMap' -import { mockTreeSet } from './ohos_util_TreeSet' -import { mockVector } from './ohos_util_Vector' -import { mockMultimediaAVSession } from './ohos_multimedia_av_session' -import { mockMultimediaCamera } from './ohos_multimedia_camera' -import { mockMultimediaAudio } from './ohos_multimedia_audio' -import { mockMultimediaImage } from './ohos_multimedia_image' -import { mockMultimediaMedia } from './ohos_multimedia_media' -import { mockMultimediaMediaLibrary } from './ohos_multimedia_mediaLibrary' -import { mockBatteryinfo } from './ohos_batteryInfo' -import { mockBluetooth } from './ohos_bluetooth' -import { mockBrightness } from './ohos_brightness' -import { mockBytrace } from './ohos_bytrace' -import { mockCipher } from './system_cipher' -import { mockContact } from './ohos_contact' -import { mockDataStorage } from './ohos_data_Storage' -import { mockDeviceInfo } from './ohos_deviceInfo' -import { mockDeviceManager } from './ohos_distributedHardware_deviceManager' -import { mockDistributedMissionManager } from "./ohos_distributedMissionManager" -import { mockDisplay } from './ohos_display' -import { mockCryptoFramework } from './ohos_security_cryptoFramework' -import { mockHuks } from './ohos_security_huks' -import { mockInputMethod } from './ohos_inputmethod' -import { mockInputMethodEngine } from './ohos_inputmethodengine' -import { mockInputMethodExtensionAbility } from "./ohos_inputmethodextensionability"; -import { mockConnection } from './ohos_net_connection' -import { mockHttp } from './ohos_net_http' -import { mockSocket } from './ohos_net_socket' -import { mockWebSocket } from './ohos_net_webSocket' -import { mockNetwork } from './ohos_network' -import { mockNfcCardEmulation } from './ohos_nfc_cardEmulation' -import { mockController } from './ohos_nfc_controller' -import { mockTag } from './ohos_nfc_tag' -import { mockPasteBoard } from './ohos_pasteboard' -import { mockRequest } from './ohos_request' -import { mockScreenLock } from './ohos_screenLock' -import { mockCall } from './ohos_telephony_call' -import { mockData } from './ohos_telephony_data' -import { mockObserver } from './ohos_telephony_observer' -import { mockRadio } from './ohos_telephony_radio' -import { mockSim } from './ohos_telephony_sim' -import { mockSMS } from './ohos_telephony_sms' -import { mockWindow } from './ohos_window' -import { mockAppAccount } from './ohos_account_appAccount' -import { mockOhosGeolocation } from './ohos_geolocation' -import { mockInputMonitor } from './ohos_multimodalInput_inputMonitor' -import { mockPointer } from './ohos_multimodalInput_pointer' -import { mockOsAccount } from './ohos_account_osAccount' -import { mockReminderAgent } from './ohos_reminderAgent' -import { mockSystemTime } from './ohos_systemTime' -import { mockSystemTimer } from './ohos_systemTimer' -import { mockWallpaper } from './ohos_wallpaper' -import { mockWantAgent } from './ohos_wantAgent' -import { mockScreenshot } from './ohos_screenshot' -import { mockZlib } from './ohos_zlib' -import { mockPrivacyManager } from './ohos_privacyManager' -import { mockFormProvider } from './ohos_application_formProvider' -import { mockScreen } from './ohos_screen' -import { mockDistributedBundle } from './ohos_distributedBundle' -import { mockInputConsumer } from './ohos_multimodalInput_inputConsumer' -import { mockDocument } from './ohos_document' -import { mockResourceManager } from './ohos_resourceManager' -import { mockFile } from './system_file' -import { mockEnterpriseDeviceManager } from './ohos_enterpriseDeviceManager' -import { mockEnterpriseAdminExtensionAbility } from './ohos_EnterpriseAdminExtensionAbility' -import { mockKeyCode } from './ohos_multimodalInput_keyCode' -import { mockInputEventClient } from './ohos_multimodalInput_inputEventClient' -import { mockDefaultAppManager } from './ohos_bundle_defaultAppManager' -import { mockKeyEvent } from './ohos_multimodalInput_keyEvent' -import { mockMouseEvent } from './ohos_multimodalInput_mouseEvent' -import { mockTouchEvent } from './ohos_multimodalInput_touchEvent' -import { mockContinationManager } from './ohos_continuation_continuationManager' -import { mockUiTest } from './ohos_uitest' -import { mockBuffer } from './ohos_buffer' -import { mockWindowAnimationManager } from './ohos_animation_windowAnimationManager' -import { mockAccessibility } from './ohos_accessibility' -import { mockAccessibilityConfig } from './ohos_accessibility_config' -import { mockAccessibilityExtensionAbility } from './ohos_application_AccessibilityExtensionAbility' -export function mockRequireNapiFun() { - global.requireNapi = function (...args) { - switch (args[0]) { - case "file": - return mockFile(); - case "resourceManager": - return mockResourceManager(); - case "document": - return mockDocument(); - case "screen": - return mockScreen(); - case "zlib": - return mockZlib(); - case "screenshot": - return mockScreenshot(); - case "wantAgent": - return mockWantAgent(); - case "wallpaper": - return mockWallpaper(); - case "systemTimer": - return mockSystemTimer(); - case "systemTime": - return mockSystemTime(); - case "reminderAgent": - return mockReminderAgent(); - case "account.osAccount": - return mockOsAccount(); - case "multimodalInput.inputMonitor": - return mockInputMonitor(); - case "geolocation": - return mockOhosGeolocation(); - case "account.appAccount": - return mockAppAccount(); - case "window": - return mockWindow(); - case "telephony.call": - return mockCall(); - case "telephony.data": - return mockData(); - case "telephony.observer": - return mockObserver(); - case "telephony.radio": - return mockRadio(); - case "telephony.sim": - return mockSim(); - case "telephony.sms": - return mockSMS(); - case "pasteboard": - return mockPasteBoard(); - case "request": - return mockRequest(); - case "screenLock": - return mockScreenLock(); - case "nfc.cardEmulation": - return mockNfcCardEmulation(); - case "nfc.controller": - return mockController(); - case "nfc.tag": - return mockTag(); - case "network": - return mockNetwork(); - case "net.connection": - return mockConnection(); - case "net.http": - return mockHttp(); - case "net.socket": - return mockSocket(); - case "net.webSocket": - return mockWebSocket(); - case "inputmethodengine": - return mockInputMethodEngine(); - case "inputmethod": - return mockInputMethod(); - case "inputmethodextensionability": - return mockInputMethodExtensionAbility(); - case "security.cryptoFramework": - return mockCryptoFramework(); - case "security.huks": - return mockHuks(); - case "display": - return mockDisplay(); - case "distributedHardware.deviceManager": - return mockDeviceManager(); - case "distributedMissionManager": - return mockDistributedMissionManager(); - case "deviceInfo": - return mockDeviceInfo(); - case "data.storage": - return mockDataStorage(); - case "contact": - return mockContact(); - case "cipher": - return mockCipher(); - case "bytrace": - return mockBytrace(); - case "brightness": - return mockBrightness(); - case "bluetooth": - return mockBluetooth(); - case "batteryinfo": - return mockBatteryinfo(); - case "systemCapability": - return mockSystemCapability(); - case "systemParameter": - return mockSystemParameter(); - case "ability.errorCode": - return mockErrorCode(); - case "ability.dataUriUtils": - return mockDataUriUtils(); - case "ability.particleAbility": - return mockParticleAbility(); - case "ability.featureAbility": - return mockFeatureAbility(); - case "ability.wantConstant": - return mockWantConstant(); - case "application.Ability": - return mockAbility(); - case "application.formHost": - return mockFormHost(); - case "application.formInfo": - return mockFormInfo(); - case "application.FormExtension": - return mockFormExtension(); - case "application.ServiceExtensionAbility": - return mockServiceExtensionAbility(); - case "application.StartOptions": - return mockStartOptions(); - case "application.StaticSubscriberExtensionAbility": - return mockStaticSubscriberExtensionAbility() - case "application.errorManager": - return mockErrorManager(); - case "application.testRunner": - return mockTestRunner(); - case "application.Want": - return mockWant(); - case "application.AbilityConstant": - return mockAbilityConstant(); - case "application.abilityDelegatorRegistry": - return mockAbilityDelegatorRegistry(); - case "application.AbilityLifecycleCallback": - return mockAbilityLifecycleCallback(); - case "application.AbilityStage": - return mockAbilityStage(); - case "application.formBindingData": - return mockFormBindingData(); - case "application.formError": - return mockFormError(); - case "application.abilityManager": - return mockAbilityManager(); - case "application.appManager": - return mockAppManager(); - case "application.Configuration": - return mockConfiguration(); - case "application.quickFixManager": - return mockQuickFixManager(); - case "application.ConfigurationConstant": - return mockConfigurationConstant(); - case "application.context": - return mockContext(); - case "application.DataShareExtensionAbility": - return mockDataShareExtensionAbility(); - case "application.EnvironmentCallback": - return mockEnvironmentCallback(); - case "application.missionManager": - return mockMissionManager(); - case "application.UriPermissionManager": - return mockUriPermissionManager(); - case "commonEvent": - return mockCommonEvent(); - case "notification": - return mockNotification(); - case "fileio": - return mockFileio(); - case "worker": - return mockWorker(); - case "util": - return mockUtil(); - case "intl": - return mockIntl(); - case "i18n": - return mockI18N(); - case "power": - return mockPower(); - case "runninglock": - return mockRunninglock(); - case "thermal": - return mockThermal(); - case "batteryStatistics": - return mockBatteryStatistics(); - case "rpc": - return mockRpc(); - case "process": - return mockProcess(); - case "url": - return mockUrl(); - case "hichecker": - return mockHiChecker(); - case "hiAppEvent": - return mockHiAppEvent(); - case "hiSysEvent": - return mockHiSysEvent(); - case "hidebug": - return mockHidebug(); - case "hiTraceChain": - return mockHiTraceChain(); - case "hiTraceMeter": - return mockHiTraceMeter(); - case "faultLogger": - return mockFaultLogger(); - case "tv": - return mockTv(); - case "dtv": - return mockDtv(); - case "account.distributedAccount": - return mockDistributedAccount(); - case "events.emitter": - return mockEmitter(); - case "data.distributedDataObject": - return mockDistributedObject(); - case "data.storage": - return mockStorage(); - case "data.dataShare": - return mockDataShare(); - case "data.dataSharePredicates": - return mockDataSharePredicates(); - case "data.DataShareResultSet": - return DataShareResultSet(); - case "data.dataAbility": - return mockDataAbility(); - case "multimodalInput.inputDevice": - return mockInputDevice(); - case "multimodalInput.pointer": - return mockPointer(); - case "vibrator": - return mockVibrator(); - case "sensor": - return mockSensor(); - case "wifi": - return mockWifi(); - case "wifiext": - return mockWifiExt(); - case "usb": - return mockUsb(); - case "bundle": - return mockBundle(); - case "distributedBundle": - return mockDistributedBundle(); - case "bundle.innerBundleManager": - return mockInnerBundle(); - case "bundle.defaultAppManager": - return mockDefaultAppManager(); - case "uri": - return mockUri(); - case "xml": - return mockXml(); - case "convertxml": - return mockConvertXml(); - case "statfs": - return mockStatfs(); - case "fileManager": - return mockFileManager(); - case "environment": - return mockEnvironment(); - case "storageStatistics": - return mockStorageStatistics(); - case "volumeManager": - return mockVolumeManager(); - case "settings": - return mockSettings(); - case "abilityAccessCtrl": - return mockAbilityAccessCtrl(); - case "configPolicy": - return mockConfigPolicy(); - case "update": - return mockUpdate(); - case "backgroundTaskManager": - return mockBackgroundTaskManager(); - case "bundleState": - return mockBundleState(); - case "securityLabel": - return mockSecurityLabel(); - case "workScheduler": - return mockWorkScheduler(); - case "WorkSchedulerExtensionAbility": - return mockWorkSchedulerExtensionAbility(); - case "userIAM.userAuth": - return mockUserAuth(); - case "userIAM.faceAuth": - return mockFaceAuth(); - case "util.ArrayList": - return mockArrayList(); - case "util.Deque": - return mockDeque(); - case "util.HashMap": - return mockHashMap(); - case "util.HashSet": - return mockHashSet(); - case "util.LightWeightMap": - return mockLightWeightMap(); - case "util.LightWeightSet": - return mockLightWeightSet(); - case "util.LinkedList": - return mockLinkedList(); - case "util.List": - return mockList(); - case "util.PlainArray": - return mockPlainArray(); - case "util.Queue": - return mockQueue(); - case "util.Stack": - return mockStack(); - case "util.TreeMap": - return mockTreeMap(); - case "util.TreeSet": - return mockTreeSet(); - case "util.Vector": - return mockVector(); - case "multimedia.mediaLibrary": - return mockMultimediaMediaLibrary(); - case "multimedia.media": - return mockMultimediaMedia(); - case "multimedia.image": - return mockMultimediaImage(); - case "multimedia.avsession": - return mockMultimediaAVSession(); - case "multimedia.camera": - return mockMultimediaCamera(); - case "multimedia.audio": - return mockMultimediaAudio(); - case "privacyManager": - return mockPrivacyManager(); - case "application.formProvider": - return mockFormProvider(); - case "multimodalInput.inputConsumer": - return mockInputConsumer(); - case "enterpriseDeviceManager": - return mockEnterpriseDeviceManager(); - case "EnterpriseAdminExtensionAbility": - return mockEnterpriseAdminExtensionAbility(); - case "multimodalInput.keyCode": - return mockKeyCode(); - case "multimodalInput.inputEventClient": - return mockInputEventClient(); - case "multimodalInput.keyEvent": - return mockKeyEvent(); - case "multimodalInput.mouseEvent": - return mockMouseEvent(); - case "multimodalInput.touchEvent": - return mockTouchEvent(); - case "accessibility": - return mockAccessibility(); - case "accessibility.config": - return mockAccessibilityConfig(); - case "application.AccessibilityExtensionAbility": - return mockAccessibilityExtensionAbility(); - case "continuation.continuationManager": - return mockContinationManager(); - case "uitest": - return mockUiTest(); - case "buffer": - return mockBuffer(); - case "animation.windowAnimationManager": - return mockWindowAnimationManager(); - default: - return global.requireNapiPreview(...args); - } - } -} diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationActionButton.js b/runtime/main/extend/systemplugin/napi/notification/notificationActionButton.js deleted file mode 100644 index 0b4fbb30..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationActionButton.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 { NotificationUserInput } from "./notificationUserInput" - -export const NotificationActionButton = { - title: '[PC preview] unknow title', - wantAgent: '[PC preview] unknow wantAgent', - extras: {"key": "unknown any"}, - userInput: NotificationUserInput, -} diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationContent.js b/runtime/main/extend/systemplugin/napi/notification/notificationContent.js deleted file mode 100644 index 25da4a05..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationContent.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 { ContentType } from "../ohos_notification" -import { PixelMapMock } from "../ohos_multimedia_image" - -export const NotificationBasicContent = { - title: '[PC preview] unknow title', - text: '[PC preview] unknow text', - additionalText: '[PC preview] unknow additionalText', -} -export const NotificationLongTextContent = { - longText: '[PC preview] unknow longText', - briefText: '[PC preview] unknow briefText', - expandedTitle: '[PC preview] unknow expandedTitle', -} -export const NotificationMultiLineContent = { - briefText: '[PC preview] unknow briefText', - longTitle: '[PC preview] unknow longTitle', - lines: [paramMock.paramStringMock], -} -export const NotificationPictureContent = { - briefText: '[PC preview] unknow briefText', - expandedTitle: '[PC preview] unknow expandedTitle', - picture: PixelMapMock, -} -export const NotificationContent = { - contentType: ContentType, - normal: NotificationBasicContent, - longText: NotificationLongTextContent, - multiLine: NotificationMultiLineContent, - picture: NotificationPictureContent, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationFlags.js b/runtime/main/extend/systemplugin/napi/notification/notificationFlags.js deleted file mode 100644 index 44942bd3..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationFlags.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 NotificationFlagStatus = { - TYPE_NONE: 0, - TYPE_OPEN: 1, - TYPE_CLOSE: 2, -} -export const NotificationFlags = { - soundEnabled: NotificationFlagStatus, - vibrationEnabled: NotificationFlagStatus, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationRequest.js b/runtime/main/extend/systemplugin/napi/notification/notificationRequest.js deleted file mode 100644 index 81f0c521..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationRequest.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 { SlotType } from "../ohos_notification" -import { NotificationActionButton } from "./notificationActionButton" -import { PixelMapMock } from "../ohos_multimedia_image" -import { NotificationTemplate } from "./notificationTemplate" -import { NotificationFlags } from "./notificationFlags" -import { NotificationContent } from "./notificationContent" - -export const NotificationRequest = { - content: NotificationContent, - id: '[PC preview] unknow id', - slotType: SlotType, - isOngoing: '[PC preview] unknow isOngoing', - isUnremovable: '[PC preview] unknow isUnremovable', - deliveryTime: '[PC preview] unknow deliveryTime', - tapDismissed: '[PC preview] unknow tapDismissed', - autoDeletedTime: '[PC preview] unknow autoDeletedTime', - wantAgent: '[PC preview] unknow wantAgent', - extraInfo: {"key": "unknown any"}, - color: '[PC preview] unknow color', - colorEnabled: '[PC preview] unknow colorEnabled', - isAlertOnce: '[PC preview] unknow isAlertOnce', - isStopwatch: '[PC preview] unknow isStopwatch', - isCountDown: '[PC preview] unknow isCountDown', - isFloatingIcon: '[PC preview] unknow isFloatingIcon', - label: '[PC preview] unknow label', - badgeIconStyle: '[PC preview] unknow badgeIconStyle', - showDeliveryTime: '[PC preview] unknow showDeliveryTime', - actionButtons: [NotificationActionButton], - smallIcon: PixelMapMock, - largeIcon: PixelMapMock, - groupName: '[PC preview] unknow groupName', - creatorBundleName: '[PC preview] unknow creatorBundleName', - creatorUid: '[PC preview] unknow creatorUid', - creatorPid: '[PC preview] unknow creatorPid', - creatorUserId: '[PC preview] unknow creatorUserId', - classification: '[PC preview] unknow classification', - hashCode: '[PC preview] unknow hashCode', - isRemoveAllowed: '[PC preview] unknow isRemveAllowd', - source: '[PC preview] unknow source', - template: NotificationTemplate, - distributedOption: DistributedOptions, - deviceId: '[PC preview] unknow deviceId', - notificationFlags: NotificationFlags, - removalWantAgent: '[PC preview] unknow removalWantAgent', - badgeNumber: '[PC preview] unknow badgeNumber', -} -export const DistributedOptions = { - isDistributed: '[PC preview] unknow isDistributed', - supportDisplayDevices: [paramMock.paramStringMock], - supportOperateDevices: [paramMock.paramStringMock], - remindType: '[PC preview] unknow remindType', -} diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationSlot.js b/runtime/main/extend/systemplugin/napi/notification/notificationSlot.js deleted file mode 100644 index bc884a43..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationSlot.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 { SlotType, SlotLevel } from "../ohos_notification" - -export const NotificationSlot = { - type: SlotType, - level: SlotLevel, - desc: '[PC preview] unknow desc', - badgeFlag: '[PC preview] unknow badgeFlag', - bypassDnd: '[PC preview] unknow bypassDnd', - lockscreenVisibility: '[PC preview] unknow lockscreenVisibility', - vibrationEnabled: '[PC preview] unknow vibrationEnabled', - sound: '[PC preview] unknow sound', - lightEnabled: '[PC preview] unknow lightEnabled', - lightColor: '[PC preview] unknow lightColor', - vibrationValues: [paramMock.paramNumberMock], - enabled: '[PC preview] unknow enabled', -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationSorting.js b/runtime/main/extend/systemplugin/napi/notification/notificationSorting.js deleted file mode 100644 index efc1e751..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationSorting.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 { NotificationSlot } from "./notificationSlot" - -export const NotificationSorting = { - slot: NotificationSlot, - hashCode: '[PC preview] unknow hashCode', - ranking: '[PC preview] unknow ranking', -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationSortingMap.js b/runtime/main/extend/systemplugin/napi/notification/notificationSortingMap.js deleted file mode 100644 index 8ed89dff..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationSortingMap.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 NotificationSortingMap = { - sortings: {"key": "unknown any"}, - sortedHashCode: [paramMock.paramStringMock], -}; diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationSubscribeInfo.js b/runtime/main/extend/systemplugin/napi/notification/notificationSubscribeInfo.js deleted file mode 100644 index 8476e26c..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationSubscribeInfo.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 NotificationSubscribeInfo = { - bundleNames: [paramMock.paramStringMock], - userId: '[PC preview] unknow userId', -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationSubscriber.js b/runtime/main/extend/systemplugin/napi/notification/notificationSubscriber.js deleted file mode 100644 index e9568430..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationSubscriber.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 { NotificationRequest } from "./notificationRequest" -import { NotificationSortingMap } from "./notificationSortingMap" - -export const NotificationSubscriber = { - onConsume: function (...args) { - console.warn("NotificationSubscriber.onConsume interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onCancel: function (...args) { - console.warn("NotificationSubscriber.onCancel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onUpdate: function (...args) { - console.warn("NotificationSubscriber.onUpdate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onConnect: function () { - console.warn("NotificationSubscriber.onConnect interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onDisconnect: function () { - console.warn("NotificationSubscriber.onDisconnect interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onDestroy: function () { - console.warn("NotificationSubscriber.onDestroy interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onDoNotDisturbDateChange: function (...args) { - console.warn("NotificationSubscriber.onDoNotDisturbDateChange interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onEnabledNotificationChanged: function (...args) { - console.warn("NotificationSubscriber.onEnabledNotificationChanged interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } -} -export const SubscribeCallbackData = { - request: NotificationRequest, - sortingMap: NotificationSortingMap, - reason: '[PC preview] unknow reason', - sound: '[PC preview] unknow sound', - vibrationValues: [paramMock.paramNumberMock], -} -export const EnabledNotificationCallbackData = { - bundle: '[PC preview] unknow bundle', - uid: '[PC preview] unknow uid', - enable: '[PC preview] unknow enable', -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationTemplate.js b/runtime/main/extend/systemplugin/napi/notification/notificationTemplate.js deleted file mode 100644 index c235f1ef..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationTemplate.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 NotificationTemplate = { - name: '[PC preview] unknow name', - data: {"key": "unknown any"}, -} diff --git a/runtime/main/extend/systemplugin/napi/notification/notificationUserInput.js b/runtime/main/extend/systemplugin/napi/notification/notificationUserInput.js deleted file mode 100644 index 8c12935d..00000000 --- a/runtime/main/extend/systemplugin/napi/notification/notificationUserInput.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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 NotificationUserInput = { - inputKey: '[PC preview] unknow inputKey', -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_EnterpriseAdminExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_EnterpriseAdminExtensionAbility.js deleted file mode 100644 index ce59393b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_EnterpriseAdminExtensionAbility.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 mockEnterpriseAdminExtensionAbility() { - const EnterpriseAdminExtensionAbilityClass = class EnterpriseAdminExtensionAbility { - constructor() { - console.warn('EnterpriseAdminExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.onAdminEnabled = function (...args) { - console.warn("EnterpriseAdminExtensionAbility.onAdminEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAdminDisabled = function (...args) { - console.warn("EnterpriseAdminExtensionAbility.onAdminDisabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return EnterpriseAdminExtensionAbilityClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_WorkSchedulerExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_WorkSchedulerExtensionAbility.js deleted file mode 100644 index 72e6b22c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_WorkSchedulerExtensionAbility.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 mockWorkSchedulerExtensionAbility() { - const WorkSchedulerExtensionAbilityClass = class WorkSchedulerExtensionAbility { - constructor() { - this.onWorkStart = function () { - console.warn("WorkSchedulerExtensionAbility.onWorkStart interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWorkStop = function () { - console.warn("WorkSchedulerExtensionAbility.onWorkStop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return new WorkSchedulerExtensionAbilityClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_abilityAccessCtrl.js b/runtime/main/extend/systemplugin/napi/ohos_abilityAccessCtrl.js deleted file mode 100644 index adaadfdb..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_abilityAccessCtrl.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 mockAbilityAccessCtrl() { - const GrantStatus = "[PC preview] unknow GrantStatus"; - - const AtManager = { - verifyAccessToken: function (...args) { - console.warn("AtManager.verifyAccessToken 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(GrantStatus); - }) - }, - verifyAccessTokenSync: function (...args) { - console.warn("AtManager.verifyAccessTokenSync interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return GrantStatus; - }, - grantUserGrantedPermission: function (...args) { - console.warn("AtManager.grantUserGrantedPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - revokeUserGrantedPermission: function (...args) { - console.warn("AtManager.revokeUserGrantedPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPermissionFlags: function (...args) { - console.warn("AtManager.getPermissionFlags 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(paramMock.paramNumberMock); - }) - }, - getVersion: function (...args) { - console.warn("AtManager.getVersion 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 - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - }, - on: function (...args) { - console.warn("AtManager.on 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, PermissionStateChangeInfo); - } - }, - off: function (...args) { - console.warn("AtManager.off 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, PermissionStateChangeInfo); - } - } - }; - const PermissionStateChangeType = { - PERMISSION_REVOKED_OPER: 0, - PERMISSION_GRANTED_OPER: 1 - }; - - const PermissionStateChangeInfo = { - change: PermissionStateChangeType, - tokenID: '[PC Preview] unknown tokenID', - permissionName: '[PC Preview] unknown permissionName', - - }; - const abilityAccessCtrl = { - createAtManager : function (...args) { - console.warn("abilityAccessCtrl.createAtManager interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return AtManager; - }, - }; - - return abilityAccessCtrl; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_ability_dataUriUtils.js b/runtime/main/extend/systemplugin/napi/ohos_ability_dataUriUtils.js deleted file mode 100644 index 9ed2ad00..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_ability_dataUriUtils.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 mockDataUriUtils() { - const dataUriUtils = { - getId: function (...args) { - console.warn("dataUriUtils.getId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - attachId: function (...args) { - console.warn("dataUriUtils.attachId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - deleteId: function (...args) { - console.warn("dataUriUtils.deleteId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - updateId: function (...args) { - console.warn("dataUriUtils.updateId 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 dataUriUtils; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_ability_errorCode.js b/runtime/main/extend/systemplugin/napi/ohos_ability_errorCode.js deleted file mode 100644 index 21cdc9e2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_ability_errorCode.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 ErrorCode = { - PERMISSION_DENY: -3, - ABILITY_NOT_FOUND: -2, - INVALID_PARAMETER: -1, - NO_ERROR: 0, -} -export function mockErrorCode() { - return ErrorCode; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_ability_featureAbility.js b/runtime/main/extend/systemplugin/napi/ohos_ability_featureAbility.js deleted file mode 100644 index 5321b14d..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_ability_featureAbility.js +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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 { WantClass } from "./ohos_application_Want" -import { Context as _Context } from "./app/context" -import { AbilityResult } from "./ability/abilityResult" -import { windowMock } from "./ohos_window" -import { DataAbilityHelper } from "./ability/dataAbilityHelper" -import { AppVersionInfo as _AppVersionInfo } from "./app/appVersionInfo" -import { ProcessInfo as _ProcessInfo } from "./app/processInfo" - -export function mockFeatureAbility() { - const featureAbility = { - getWant: function (...args) { - console.warn("featureAbility.getWant 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, new WantClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new WantClass()); - }) - } - }, - startAbility: function (...args) { - console.warn("featureAbility.startAbility 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getContext: function () { - console.warn("featureAbility.getContext interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return _Context; - }, - startAbilityForResult: function (...args) { - console.warn("featureAbility.startAbilityForResult 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, AbilityResult); - } else { - return new Promise((resolve, reject) => { - resolve(AbilityResult); - }) - } - }, - terminateSelfWithResult: function (...args) { - console.warn("featureAbility.terminateSelfWithResult 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - terminateSelf: function () { - console.warn("featureAbility.terminateSelf 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - acquireDataAbilityHelper: function (...args) { - console.warn("featureAbility.acquireDataAbilityHelper interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataAbilityHelper; - }, - hasWindowFocus: function (...args) { - console.warn("featureAbility.hasWindowFocus 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - connectAbility: function (...args) { - console.warn("featureAbility.connectAbility interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - disconnectAbility: function (...args) { - console.warn("featureAbility.disconnectAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getWindow: function (...args) { - console.warn("featureAbility.getWindow 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, windowMock); - } else { - return new Promise((resolve, reject) => { - resolve(windowMock); - }) - } - }, - AbilityWindowConfiguration, - AbilityStartSetting, - ErrorCode, - DataAbilityOperationType, - Context: _Context, - AppVersionInfo: _AppVersionInfo, - ProcessInfo: _ProcessInfo - } - return featureAbility; -} -export const AbilityWindowConfiguration = { - WINDOW_MODE_UNDEFINED: 0, - WINDOW_MODE_FULLSCREEN: 1, - WINDOW_MODE_SPLIT_PRIMARY: 100, - WINDOW_MODE_SPLIT_SECONDARY: 101, - WINDOW_MODE_FLOATING: 102 -} -export const AbilityStartSetting = { - BOUNDS_KEY: "abilityBounds", - WINDOW_MODE_KEY: "windowMode", - DISPLAY_ID_KEY: "displayId" -} -export const ErrorCode = { - NO_ERROR: 0, - INVALID_PARAMETER: -1, - ABILITY_NOT_FOUND: -2, - PERMISSION_DENY: -3 -} -export const DataAbilityOperationType = { - TYPE_INSERT: 1, - TYPE_UPDATE: 2, - TYPE_DELETE: 3, - TYPE_ASSERT: 4, -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_ability_particleAbility.js b/runtime/main/extend/systemplugin/napi/ohos_ability_particleAbility.js deleted file mode 100755 index f1e4ec1c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_ability_particleAbility.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 { DataAbilityHelper } from "./ability/dataAbilityHelper" - -export function mockParticleAbility() { - const particleAbility = { - startAbility: function (...args) { - console.warn("ability.particleAbility.startAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - terminateSelf: function (...args) { - console.warn("ability.particleAbility.terminateSelf 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - acquireDataAbilityHelper: function (...args) { - console.warn("ability.particleAbility.acquireDataAbilityHelper interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return DataAbilityHelper; - }, - connectAbility: function (...args) { - console.warn("ability.particleAbility.connectAbility interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - disconnectAbility: function (...args) { - console.warn("ability.particleAbility.disconnectAbility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - startBackgroundRunning: function (...args) { - console.warn("ability.particleAbility.startBackgroundRunning 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - cancelBackgroundRunning: function (...args) { - console.warn("ability.particleAbility.cancelBackgroundRunning 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - ErrorCode : { - INVALID_PARAMETER: -1, - } - } - return particleAbility; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_ability_wantConstant.js b/runtime/main/extend/systemplugin/napi/ohos_ability_wantConstant.js deleted file mode 100644 index e317a31a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_ability_wantConstant.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 Action = { - ACTION_HOME: "ohos.want.action.home", - ACTION_DIAL: "ohos.want.action.dial", - ACTION_SEARCH: "ohos.want.action.search", - ACTION_WIRELESS_SETTINGS: "ohos.settings.wireless", - ACTION_MANAGE_APPLICATIONS_SETTINGS: "ohos.settings.manage.applications", - ACTION_APPLICATION_DETAILS_SETTINGS: "ohos.settings.application.details", - ACTION_SET_ALARM: "ohos.want.action.setAlarm", - ACTION_SHOW_ALARMS: "ohos.want.action.showAlarms", - ACTION_SNOOZE_ALARM: "ohos.want.action.snoozeAlarm", - ACTION_DISMISS_ALARM: "ohos.want.action.dismissAlarm", - ACTION_DISMISS_TIMER: "ohos.want.action.dismissTimer", - ACTION_SEND_SMS: "ohos.want.action.sendSms", - ACTION_CHOOSE: "ohos.want.action.choose", - ACTION_IMAGE_CAPTURE: "ohos.want.action.imageCapture", - ACTION_VIDEO_CAPTURE: "ohos.want.action.videoCapture", - ACTION_SELECT: "ohos.want.action.select", - ACTION_SEND_DATA: "ohos.want.action.sendData", - ACTION_SEND_MULTIPLE_DATA: "ohos.want.action.sendMultipleData", - ACTION_SCAN_MEDIA_FILE: "ohos.want.action.scanMediaFile", - ACTION_VIEW_DATA: "ohos.want.action.viewData", - ACTION_EDIT_DATA: "ohos.want.action.editData", - INTENT_PARAMS_INTENT: "ability.want.params.INTENT", - INTENT_PARAMS_TITLE: "ability.want.params.TITLE", - ACTION_FILE_SELECT: "ohos.action.fileSelect", - PARAMS_STREAM: "ability.params.stream", - ACTION_APP_ACCOUNT_OAUTH: "ohos.account.appAccount.action.oauth", - ACTION_MARKER_DOWNLOAD: "ohos.want.action.marketDownload" -} -export const Entity = { - ENTITY_DEFAULT: "entity.system.default", - ENTITY_HOME: "entity.system.home", - ENTITY_VOICE: "entity.system.voice", - ENTITY_BROWSABLE: "entity.system.browsable", - ENTITY_VIDEO: "entity.system.video" -} -export const Flags = { - FLAG_AUTH_READ_URI_PERMISSION: 0x00000001, - FLAG_AUTH_WRITE_URI_PERMISSION: 0x00000002, - FLAG_ABILITY_FORWARD_RESULT: 0x00000004, - FLAG_ABILITY_CONTINUATION: 0x00000008, - FLAG_NOT_OHOS_COMPONENT: 0x00000010, - FLAG_ABILITY_FORM_ENABLED: 0x00000020, - FLAG_AUTH_PERSISTABLE_URI_PERMISSION: 0x00000040, - FLAG_AUTH_PREFIX_URI_PERMISSION: 0x00000080, - FLAG_ABILITYSLICE_MULTI_DEVICE: 0x00000100, - FLAG_START_FOREGROUND_ABILITY: 0x00000200, - FLAG_ABILITY_CONTINUATION_REVERSIBLE: 0x00000400, - FLAG_INSTALL_ON_DEMAND: 0x00000800, - FLAG_INSTALL_WITH_BACKGROUND_MODE: 0x80000000, - FLAG_ABILITY_CLEAR_MISSION: 0x00008000, - FLAG_ABILITY_NEW_MISSION: 0x10000000, - FLAG_ABILITY_MISSION_TOP: 0x20000000 -} -export function mockWantConstant() { - const wantConstant = { - Action, - Entity, - Flags - } - return wantConstant; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_accessibility.js b/runtime/main/extend/systemplugin/napi/ohos_accessibility.js deleted file mode 100644 index ba20e642..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_accessibility.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2021-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 mockAccessibility() { - const AbilityTypeMock = '[PC Preview] unknown AbilityType'; - - const CapabilityMock = '[PC Preview] unknown Capability'; - - const EventTypeMock = '[PC Preview] unknown EventType'; - - const AccessibilityAbilityInfo = { - id: '[PC Preview] unknown id', - name: '[PC Preview] unknown name', - bundleName: '[PC Preview] unknown bundleName', - TargetBundleName: ['[PC Preview] unknown TargetBundleName'], - abilityTypes: [AbilityTypeMock], - capabilities: [CapabilityMock], - description: '[PC Preview] unknown description', - eventTypes: [EventTypeMock] - }; - - const CaptionsFontEdgeTypeMock = '[PC Preview] unknown CaptionsFontEdgeType'; - - const CaptionsFontFamilyMock = '[PC Preview] unknown CaptionsFontFamily'; - - const CaptionStyle = { - fontFamily: CaptionsFontFamilyMock, - fontScale: '[PC Preview] unknown fontScale', - fontColor: '[PC Preview] unknown fontColor', - fontEdgeType: CaptionsFontEdgeTypeMock, - backgroundColor: '[PC Preview] unknown backgroundColor', - windowColor: '[PC Preview] unknown windowColor' - }; - - const CaptionsManagerMock = { - enabled: '[PC Preview] unknown enabled', - style: CaptionStyle, - on: function (...args) { - console.warn('CaptionsManager.on 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 > 1 && typeof args[len - 1] === 'function') { - if (args[0] === 'enableChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'styleChange') { - args[len - 1].call(this, CaptionStyle); - } - } - }, - off: function (...args) { - console.warn('CaptionsManager.off 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 > 1 && typeof args[len - 1] === 'function') { - if (args[0] === 'enableChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'styleChange') { - args[len - 1].call(this, CaptionStyle); - } - } - }, - }; - - const WindowUpdateTypeMock = '[PC Preview] unknown WindowUpdateType'; - - const ActionMock = '[PC Preview] unknown Action'; - - const TextMoveUnitMock = '[PC Preview] unknown TextMoveUnit'; - - const EventInfoClass = class EventInfo { - constructor(...args) { - console.warn('accessibility.EventInfoClass.constructor interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - this.type = EventTypeMock; - this.windowUpdateType = WindowUpdateTypeMock; - this.bundleName = '[PC Preview] unknown bundleName'; - this.componentType = '[PC Preview] unknown componentType'; - this.pageId = '[PC Preview] unknown pageId'; - this.description = '[PC Preview] unknown description'; - this.triggerAction = ActionMock; - this.textMoveUnit = TextMoveUnitMock; - this.contents = ['[PC Preview] unknown content']; - this.lastContent = '[PC Preview] unknown lastContent'; - this.beginIndex = '[PC Preview] unknown beginIndex'; - this.currentIndex = '[PC Preview] unknown currentIndex'; - this.endIndex = '[PC Preview] unknown endIndex'; - this.itemCount = '[PC Preview] unknown itemCount'; - } - }; - - const accessibility = { - EventInfo: EventInfoClass, - isOpenAccessibility: function (...args) { - console.warn('accessibility.isOpenAccessibility 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, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - isOpenTouchGuide: function (...args) { - console.warn('accessibility.isOpenTouchGuide 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); - }); - } - }, - on: function (...args) { - console.warn('accessibility.on 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') { - if (args[0] == 'accessibilityStateChange') { - args[len - 1].call(this, this, paramMock.paramBooleanMock); - } else if (args[0] == 'touchGuideStateChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else { - args[len - 1].call(this, this, paramMock.paramBooleanMock); - } - } - }, - off: function (...args) { - console.warn('accessibility.off 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 > 1 && typeof args[len - 1] === 'function') { - if (args[0] === 'accessibilityStateChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'touchGuideStateChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } - } - }, - getAbilityLists: function (...args) { - console.warn('accessibility.getAbilityLists 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, [AccessibilityAbilityInfo]); - } else { - return new Promise((resolve, reject) => { - resolve([AccessibilityAbilityInfo]); - }); - } - }, - sendEvent: function (...args) { - console.warn('accessibility.sendEvent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getCaptionsManager: function () { - console.warn('accessibility.getCaptionsManager interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return CaptionsManagerMock; - } - }; - - return accessibility; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_accessibility_config.js b/runtime/main/extend/systemplugin/napi/ohos_accessibility_config.js deleted file mode 100644 index b20d2865..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_accessibility_config.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 mockAccessibilityConfig() { - const config = { - enableAbility: function (...args) { - console.warn('accessibilityConfig config.enableAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - disableAbility: function (...args) { - console.warn('accessibilityConfig config.disableAbility 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - } - }; - return config; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_account_appAccount.js b/runtime/main/extend/systemplugin/napi/ohos_account_appAccount.js deleted file mode 100644 index 981b592c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_account_appAccount.js +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (c) 2021 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 { RemoteObjectClass } from "./ohos_rpc" - -export function mockAppAccount() { - const AppAccountInfoMock = { - owner: "[PC Preview] unknown owner", - name: "[PC Preview] unknown name" - }; - const OAuthTokenInfoMock = { - authType: "[PC preview] unknown authType", - token: "[PC preview] unknown token", - account: AppAccountInfoMock, - }; - const AuthenticatorInfoMock = { - owner: "[PC preview] unknown owner", - iconId: "[PC preview] unknown iconId", - labelId: "[PC preview] unknown labelId", - }; - const appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const SelectAccountsOptions = { - allowedAccounts: appAccountInfoArrayMock, - allowedOwners: [paramMock.paramString], - requiredLabels: [paramMock.paramString], - } - const VerifyCredentialOptions = { - credentialType: paramMock.paramStringMock, - credential: paramMock.paramStringMock, - parameters:{"unknown key":paramMock.paramObjectMock}, - } - const SetPropertiesOptions = { - properties: {"unknown key":paramMock.paramObjectMock}, - parameters: {"unknown key":paramMock.paramObjectMock}, - } - const appAccountManagerMock = { - addAccount: function (...args) { - console.warn("AppAccountManager.addAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - addAccountImplicitly: function (...args) { - console.warn("AppAccountManager.addAccountImplicitly 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, AuthenticatorCallbackMock); - } - }, - deleteAccount: function (...args) { - console.warn("AppAccountManager.deleteAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableAppAccess: function (...args) { - console.warn("AppAccountManager.disableAppAccess 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableAppAccess: function (...args) { - console.warn("AppAccountManager.enableAppAccess 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - checkAppAccess: function (...args) { - console.warn("AppAccountManager.checkAppAccess 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - checkAppAccountSyncEnable: function (...args) { - console.warn("AppAccountManager.checkAppAccountSyncEnable 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAccountCredential: function (...args) { - console.warn("AppAccountManager.setAccountCredential 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAccountExtraInfo: function (...args) { - console.warn("AppAccountManager.setAccountExtraInfo 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAppAccountSyncEnable: function (...args) { - console.warn("AppAccountManager.setAppAccountSyncEnable 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAssociatedData: function (...args) { - console.warn("AppAccountManager.setAssociatedData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAllAccessibleAccounts: function (...args) { - console.warn("AppAccountManager.getAllAccessibleAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - getAllAccounts: function (...args) { - console.warn("AppAccountManager.getAllAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - getAccountCredential: function (...args) { - console.warn("AppAccountManager.getAccountCredential 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAccountExtraInfo: function (...args) { - console.warn("AppAccountManager.getAccountExtraInfo 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAssociatedData: function (...args) { - console.warn("AppAccountManager.getAssociatedData 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getAssociatedDataSync: function (...args) { - console.warn("AppAccountManager.getAssociatedDataSync interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - on: function (...args) { - console.warn("AppAccountManager.on interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - off: function (...args) { - console.warn("AppAccountManager.off interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - authenticate: function (...args) { - console.warn("AppAccountManager.authenticate 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, AuthenticatorCallbackMock); - } - }, - getOAuthToken: function (...args) { - console.warn("AppAccountManager.getOAuthToken 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock) - }) - } - }, - setOAuthToken: function (...args) { - console.warn("AppAccountManager.setOAuthToken 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - deleteOAuthToken: function (...args) { - console.warn("AppAccountManager.deleteOAuthToken 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - setOAuthTokenVisibility: function (...args) { - console.warn("AppAccountManager.setOAuthTokenVisibility 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - checkOAuthTokenVisibility: function (...args) { - console.warn("AppAccountManager.checkOAuthTokenVisibility 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - getAllOAuthTokens: function (...args) { - console.warn("AppAccountManager.getAllOAuthTokens 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, new Array(OAuthTokenInfoMock)); - } else { - return new Promise((resolve, reject) => { - resolve(new Array(OAuthTokenInfoMock)) - }) - } - }, - getOAuthList: function (...args) { - console.warn("AppAccountManager.getOAuthList 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, new Array(paramMock.paramStringMock)); - } else { - return new Promise((resolve, reject) => { - resolve(new Array(paramMock.paramStringMock)) - }) - } - }, - getAuthenticatorCallback: function (...args) { - console.warn("AppAccountManager.getAuthenticatorCallback 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, AuthenticatorCallbackMock); - } else { - return new Promise((resolve, reject) => { - resolve(AuthenticatorCallbackMock) - }) - } - }, - getAuthenticatorInfo: function (...args) { - console.warn("AppAccountManager.getAuthenticatorInfo 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, AuthenticatorInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(AuthenticatorInfoMock) - }) - } - }, - checkAccountLabels: function (...args) { - console.warn("AppAccountManager.checkAccountLabels 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - deleteAccountCredential: function (...args) { - console.warn("AppAccountManager.deleteAccountCredential 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - selectAccountsByOptions: function (...args) { - console.warn("AppAccountManager.selectAccountsByOptions interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var appAccountInfoArrayMock = new Array(); - appAccountInfoArrayMock.push(AppAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, appAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(appAccountInfoArrayMock); - }) - } - }, - verifyCredential: function (...args) { - console.warn("AppAccountManager.verifyCredential 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, AuthenticatorCallbackMock); - } - }, - setAuthenticatorProperties: function (...args) { - console.warn("AppAccountManager.setAuthenticatorProperties 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, AuthenticatorCallbackMock); - } - } - }; - const AuthenticatorCallbackMock = { - onResult: function (...args) { - console.warn("AuthenticatorCallback.onResult interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - onRequestRedirected: function (...args) { - console.warn("AuthenticatorCallback.onRequestRedirected interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - onRequestContinued: function (...args) { - console.warn("AuthenticatorCallback.onRequestContinued interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - }; - const AuthenticatorClass = class Authenticator { - constructor() { - console.warn("appAccount.Authenticator constructor interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - this.addAccountImplicitly = function (...args) { - console.warn("Authenticator.addAccountImplicitly 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, AuthenticatorCallbackMock); - } - }; - this.authenticate = function (...args) { - console.warn("Authenticator.authenticate 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, AuthenticatorCallbackMock); - } - }; - this.verifyCredential = function (...args) { - console.warn("Authenticator.verifyCredential 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, AuthenticatorCallbackMock); - } - }; - this.setProperties = function (...args) { - console.warn("Authenticator.setProperties 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, AuthenticatorCallbackMock); - } - }; - this.checkAccountLabels = function (...args) { - console.warn("Authenticator.checkAccountLabels 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, AuthenticatorCallbackMock); - } - }; - this.isAccountRemovable = function (...args) { - console.warn("Authenticator.isAccountRemovable 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, AuthenticatorCallbackMock); - } - }; - this.getRemoteObject = function (...args) { - console.warn("Authenticator.getRemoteObject interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return new RemoteObjectClass; - }; - } - }; - const ConstantsMock = { - ACTION_ADD_ACCOUNT_IMPLICITLY: "addAccountImplicitly", - ACTION_AUTHENTICATE: "authenticate", - KEY_NAME: "name", - KEY_OWNER: "owner", - KEY_TOKEN: "token", - KEY_ACTION: "action", - KEY_AUTH_TYPE: "authType", - KEY_SESSION_ID: "sessionId", - KEY_CALLER_PID: "callerPid", - KEY_CALLER_UID: "callerUid", - KEY_CALLER_BUNDLE_NAME: "callerBundleName", - KEY_REQUIRED_LABELS: "requiredLabels", - KEY_BOOLEAN_RESULT: "booleanResult" - }; - const ResultCodeMock = { - SUCCESS: 0, - ERROR_ACCOUNT_NOT_EXIST: 10001, - ERROR_APP_ACCOUNT_SERVICE_EXCEPTION: 10002, - ERROR_INVALID_PASSWORD: 10003, - ERROR_INVALID_REQUEST: 10004, - ERROR_INVALID_RESPONSE: 10005, - ERROR_NETWORK_EXCEPTION: 10006, - ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST: 10007, - ERROR_OAUTH_CANCELED: 10008, - ERROR_OAUTH_LIST_TOO_LARGE: 10009, - ERROR_OAUTH_SERVICE_BUSY: 10010, - ERROR_OAUTH_SERVICE_EXCEPTION: 10011, - ERROR_OAUTH_SESSION_NOT_EXIST: 10012, - ERROR_OAUTH_TIMEOUT: 10013, - ERROR_OAUTH_TOKEN_NOT_EXIST: 10014, - ERROR_OAUTH_TOKEN_TOO_MANY: 10015, - ERROR_OAUTH_UNSUPPORT_ACTION: 10016, - ERROR_OAUTH_UNSUPPORT_AUTH_TYPE: 10017, - ERROR_PERMISSION_DENIED: 10018 - }; - const appAccount = { - createAppAccountManager: function (...args) { - console.warn("appAccount.createAppAccountManager interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return appAccountManagerMock; - }, - AuthenticatorCallback: AuthenticatorCallbackMock, - Authenticator: AuthenticatorClass, - Constants: ConstantsMock, - ResultCode: ResultCodeMock, - } - return appAccount -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_account_distributedAccount.js b/runtime/main/extend/systemplugin/napi/ohos_account_distributedAccount.js deleted file mode 100644 index 9f18bcd2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_account_distributedAccount.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2021 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 mockDistributedAccount() { - const distributedInfoMock = { - name: "[PC Preview] unknown name", - id: "[PC Preview] unknown id", - event: "[PC Preview] unknown event", - scalableData: "[PC Preview] unknown scalableData" - } - const distributedAccountAbilityMock = { - queryOsAccountDistributedInfo: function (...args) { - console.warn("DistributedAccountAbility.queryOsAccountDistributedInfo 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, distributedInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(distributedInfoMock); - }) - } - }, - updateOsAccountDistributedInfo: function (...args) { - console.warn("DistributedAccountAbility.updateOsAccountDistributedInfo 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - }; - const distributedAccount = { - getDistributedAccountAbility: function (...args) { - console.warn("distributedAccount.getDistributedAccountAbility interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return distributedAccountAbilityMock; - } - } - return distributedAccount; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_account_osAccount.js b/runtime/main/extend/systemplugin/napi/ohos_account_osAccount.js deleted file mode 100644 index 7cac359e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_account_osAccount.js +++ /dev/null @@ -1,747 +0,0 @@ -/* - * Copyright (c) 2021-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 mockOsAccount() { - const OsAccountInfoMock = { - localId: "[PC Preview] unknown localId", - localName: "[PC Preview] unknown localName", - type: "[PC Preview] unknown type", - constraints: "[PC Preview] unknown constraints", - isVerified: "[PC Preview] unknown isVerified", - photo: "[PC Preview] unknown photo", - createTime: "[PC Preview] unknown createTime", - lastLoginTime: "[PC Preview] unknown lastLoginTime", - serialNumber: "[PC Preview] unknown serialNumber", - isActived: "[PC Preview] unknown isActived", - isCreateCompleted: "[PC Preview] unknown isCreateCompleted", - domainInfo: "[PC Preview] unknown domainInfo", - distributedInfo: "[PC Preview] unknown distributedInfo" - }; - const DomainAccountInfoMock = { - domain: "[PC Preview] unknown domain", - accountName: "[PC Preview] unknown accountName" - }; - const ConstraintSourceTypeInfoMock = { - localId: "[PC Preview] unknown localId", - type: "[PC Preview] unknown type" - }; - const GetPropertyRequest = { - authType: "[PC Preview] unknown authType", - keys: "[PC Preview] unknown keys" - }; - const SetPropertyRequest = { - authType: "[PC Preview] unknown authType", - key: "[PC Preview] unknown key", - setInfo: "[PC Preview] unknown setInfo" - }; - const ExecutorProperty = { - result: "[PC Preview] unknown result", - authSubType: AuthSubType, - remainTimes: "[PC Preview] unknown remainTimes", - freezingTime: "[PC Preview] unknown freezingTime" - }; - const AuthResult = { - token: "[PC Preview] unknown token", - remainTimes: "[PC Preview] unknown remainTimes", - freezingTime: "[PC Preview] unknown freezingTime" - }; - const CredentialInfo = { - credType: "[PC Preview] unknown credType", - credSubType: "[PC Preview] unknown credSubType", - token: "[PC Preview] unknown token" - }; - const RequestResult = { - credentialId: "[PC Preview] unknown credentialId" - }; - const EnrolledCredInfo = { - credentialId: "[PC Preview] unknown credentialId", - authType: "[PC Preview] unknown authType", - authSubType: "[PC Preview] unknown authSubType", - templateId: "[PC Preview] unknown templateId" - }; - const OsAccountTypeMock = "[PC Preview] unknown type"; - const AccountManagerMock = { - activateOsAccount: function (...args) { - console.warn("AccountManager.activateOsAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isMultiOsAccountEnable: function (...args) { - console.warn("AccountManager.isMultiOsAccountEnable 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountActived: function (...args) { - console.warn("AccountManager.isOsAccountActived 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountConstraintEnable: function (...args) { - console.warn("AccountManager.isOsAccountConstraintEnable 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTestOsAccount: function (...args) { - console.warn("AccountManager.isTestOsAccount 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isOsAccountVerified: function (...args) { - console.warn("AccountManager.isOsAccountVerified 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - removeOsAccount: function (...args) { - console.warn("AccountManager.removeOsAccount 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setOsAccountConstraints: function (...args) { - console.warn("AccountManager.setOsAccountConstraints 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setOsAccountName: function (...args) { - console.warn("AccountManager.setOsAccountName 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCreatedOsAccountsCount: function (...args) { - console.warn("AccountManager.getCreatedOsAccountsCount 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountLocalIdFromProcess: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdFromProcess 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountLocalIdFromUid: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdFromUid 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountLocalIdFromDomain: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdFromDomain 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - queryMaxOsAccountNumber: function (...args) { - console.warn("AccountManager.queryMaxOsAccountNumber 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOsAccountAllConstraints: function (...args) { - console.warn("AccountManager.getOsAccountAllConstraints 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - queryAllCreatedOsAccounts: function (...args) { - console.warn("AccountManager.queryAllCreatedOsAccounts interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var osAccountInfoArrayMock = new Array(); - osAccountInfoArrayMock.push(OsAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountInfoArrayMock); - }) - } - }, - queryActivatedOsAccountIds: function (...args) { - console.warn("AccountManager.queryActivatedOsAccountIds interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var osAccountIdsArrayMock = new Array(); - osAccountIdsArrayMock.push(OsAccountInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, osAccountIdsArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(osAccountIdsArrayMock); - }) - } - }, - createOsAccount: function (...args) { - console.warn("AccountManager.createOsAccount 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, OsAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(OsAccountInfoMock); - }) - } - }, - createOsAccountForDomain: function (...args) { - console.warn("AccountManager.createOsAccountForDomain 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, OsAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(OsAccountInfoMock); - }) - } - }, - queryCurrentOsAccount: function (...args) { - console.warn("AccountManager.queryCurrentOsAccount 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, OsAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(OsAccountInfoMock); - }) - } - }, - queryOsAccountById: function (...args) { - console.warn("AccountManager.queryOsAccountById 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, OsAccountInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(OsAccountInfoMock); - }) - } - }, - getOsAccountTypeFromProcess: function (...args) { - console.warn("AccountManager.getOsAccountTypeFromProcess 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, OsAccountTypeMock); - } else { - return new Promise((resolve, reject) => { - resolve(OsAccountTypeMock); - }) - } - }, - getDistributedVirtualDeviceId: function (...args) { - console.warn("AccountManager.getDistributedVirtualDeviceId 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getOsAccountProfilePhoto: function (...args) { - console.warn("AccountManager.getOsAccountProfilePhoto 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setOsAccountProfilePhoto: function (...args) { - console.warn("AccountManager.setOsAccountProfilePhoto 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getOsAccountLocalIdBySerialNumber: function (...args) { - console.warn("AccountManager.getOsAccountLocalIdBySerialNumber 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getSerialNumberByOsAccountLocalId: function (...args) { - console.warn("AccountManager.getSerialNumberByOsAccountLocalId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("AccountManager.on 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - off: function (...args) { - console.warn("AccountManager.off 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMainOsAccount: function (...args) { - console.warn("AccountManager.isMainOsAccount 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getBundleIdFromUid: function (...args) { - console.warn("AccountManager.getBundleIdFromUid 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - queryOsAccountConstraintSourceTypes: function (...args) { - console.warn("AccountManager.queryOsAccountConstraintSourceTypes interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var constraintSourceTypeInfoArrayMock = new Array(); - constraintSourceTypeInfoArrayMock.push(ConstraintSourceTypeInfoMock); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, constraintSourceTypeInfoArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(constraintSourceTypeInfoArrayMock); - }) - } - }, - }; - const UserAuthClass = class UserAuth { - constructor() { - console.warn("osAccount.UserAuth.constructor interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - this.getVersion = function (...args) { - console.warn("UserAuth.getVersion interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getAvailableStatus = function (...args) { - console.warn("UserAuth.getAvailableStatus interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getProperty = function (...args) { - console.warn("UserAuth.getProperty 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, ExecutorProperty); - } else { - return new Promise((resolve, reject) => { - resolve(ExecutorProperty); - }) - } - }; - this.setProperty = function (...args) { - console.warn("UserAuth.setProperty 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }; - this.auth = function (...args) { - console.warn("UserAuth.auth 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, IUserAuthCallback); - } - return paramMock.paramArrayMock; - }; - this.authUser = function (...args) { - console.warn("UserAuth.authUser 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, IUserAuthCallback); - } - return paramMock.paramArrayMock; - }; - this.cancelAuth = function (...args) { - console.warn("UserAuth.cancelAuth interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - }; - }; - const PINAuthClass = class PINAuth { - constructor() { - console.warn("osAccount.PINA.constructor interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - this.registerInputer = function (...args) { - console.warn("PINAuth.registerInputer interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.unregisterInputer = function (...args) { - console.warn("PINAuth.unregisterInputer interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }; - }; - }; - const UserIdentityManagerClass = class UserIdentityManager { - constructor() { - console.warn("osAccount.getAccountManager.constructor interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - this.openSession = function (...args) { - console.warn("UserIdentityManager.openSession 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, paramMock.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }; - this.addCredential = function (...args) { - console.warn("AUserIdentityManager.addCredential 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, IIdmCallback); - } - }; - this.updateCredential = function (...args) { - console.warn("AUserIdentityManager.updateCredential 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, IIdmCallback); - } - }; - this.closeSession = function (...args) { - console.warn("AUserIdentityManager.closeSession interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }; - this.cancel = function (...args) { - console.warn("AUserIdentityManager.cancel interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.delUser = function (...args) { - console.warn("AUserIdentityManager.delUser 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, IIdmCallback); - } - }; - this.delCred = function (...args) { - console.warn("AUserIdentityManager.delCred 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, IIdmCallback); - } - }; - this.getAuthInfo = function (...args) { - console.warn("AUserIdentityManager.getAuthInfo interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - var EnrolledCredInfoMock = new Array(); - EnrolledCredInfoMock.push(EnrolledCredInfo); - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, EnrolledCredInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(EnrolledCredInfoMock) - }) - } - }; - }; - } - const IInputData = { - onSetData: function (...args) { - console.warn("IInputData.onSetData interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - }; - const IInputer = { - onGetData: function (...args) { - console.warn("IInputer.onGetData interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - }; - const IUserAuthCallback = { - onResult: function (...args) { - console.warn("IUserAuthCallback.onResult interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - onAcquireInfo: function (...args) { - console.warn("IUserAuthCallback.onAcquireInfo interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - }; - const IIdmCallback = { - onResult: function (...args) { - console.warn("IIdmCallback.onResult interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - onAcquireInfo: function (...args) { - console.warn("IIdmCallback.onAcquireInfo interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - }; - const ConstraintSourceType = { - CONSTRAINT_NOT_EXIST: 0, - CONSTRAINT_TYPE_BASE: 1, - CONSTRAINT_TYPE_DEVICE_OWNER: 2, - CONSTRAINT_TYPE_PROFILE_OWNER: 3 - }; - const OsAccountType = { - ADMIN: 0, - NORMAL: 1, - GUEST: 2 - }; - const FingerprintTips = { - FINGERPRINT_TIP_GOOD: 0, - FINGERPRINT_TIP_IMAGER_DIRTY: 1, - FINGERPRINT_TIP_INSUFFICIENT: 2, - FINGERPRINT_TIP_PARTIAL: 3, - FINGERPRINT_TIP_TOO_FAST: 4, - FINGERPRINT_TIP_TOO_SLOW: 5 - }; - const FaceTipsCode = { - FACE_AUTH_TIP_TOO_BRIGHT: 1, - FACE_AUTH_TIP_TOO_DARK: 2, - FACE_AUTH_TIP_TOO_CLOSE: 3, - FACE_AUTH_TIP_TOO_FAR: 4, - FACE_AUTH_TIP_TOO_HIGH: 5, - FACE_AUTH_TIP_TOO_LOW: 6, - FACE_AUTH_TIP_TOO_RIGHT: 7, - FACE_AUTH_TIP_TOO_LEFT: 8, - FACE_AUTH_TIP_TOO_MUCH_MOTION: 9, - FACE_AUTH_TIP_POOR_GAZE: 10, - FACE_AUTH_TIP_NOT_DETECTED: 11 - }; - const ResultCode = { - SUCCESS: 0, - FAIL: 1, - GENERAL_ERROR: 2, - CANCELED: 3, - TIMEOUT: 4, - TYPE_NOT_SUPPORT: 5, - TRUST_LEVEL_NOT_SUPPORT: 6, - BUSY: 7, - INVALID_PARAMETERS: 8, - LOCKED: 9, - NOT_ENROLLED: 10 - }; - const Module = { - FACE_AUTH: 1 - }; - const AuthTrustLevel = { - ATL1: 10000, - ATL2: 20000, - ATL3: 30000, - ATL4: 40000 - }; - const AuthSubType = { - PIN_SIX: 10000, - PIN_NUMBER: 10001, - PIN_MIXED: 10002, - FACE_2D: 20000, - FACE_3D: 20001 - }; - const GetPropertyType = { - AUTH_SUB_TYPE: 1, - REMAIN_TIMES: 2, - FREEZING_TIME: 3 - }; - const SetPropertyType = { - INIT_ALGORITHM: 1 - }; - const AuthType = { - PIN: 1, - FACE: 2 - }; - const osAccount = { - getAccountManager: function (...args) { - console.warn("osAccount.getAccountManager interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return AccountManagerMock; - }, - UserAuth: UserAuthClass, - PINAuth: PINAuthClass, - UserIdentityManager: UserIdentityManagerClass, - ConstraintSourceType, - OsAccountType, - FingerprintTips, - FaceTipsCode, - ResultCode, - Module, - AuthTrustLevel, - AuthSubType, - GetPropertyType, - SetPropertyType, - AuthType, - } - return osAccount -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js b/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js deleted file mode 100644 index 9839a613..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_animation_windowAnimationManager.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 mockWindowAnimationManager() { - const RRect = { - left: '[PC preview] unknow left', - top: '[PC preview] unknow top', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - radius: '[PC preview] unknow radius', - } - const WindowAnimationTarget = { - bundleName: '[PC preview] unknow bundleName', - abilityName: '[PC preview] unknow abilityName', - windowBounds: RRect, - } - const WindowAnimationFinishedCallback = { - onAnimationFinish: function (...args) { - console.warn("WindowAnimationFinishedCallback.onAnimationFinish interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - } - const WindowAnimationController = { - onStartAppFromLauncher: function (...args) { - console.warn("WindowAnimationController.onStartAppFromLauncher interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onStartAppFromRecent: function (...args) { - console.warn("WindowAnimationController.onStartAppFromRecent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onStartAppFromOther: function (...args) { - console.warn("WindowAnimationController.onStartAppFromOther interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onAppTransition: function (...args) { - console.warn("WindowAnimationController.onAppTransition interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onMinimizeWindow: function (...args) { - console.warn("WindowAnimationController.onMinimizeWindow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onCloseWindow: function (...args) { - console.warn("WindowAnimationController.onCloseWindow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - onScreenUnlock: function (...args) { - console.warn("WindowAnimationController.onScreenUnlock interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - } - - const windowAnimationManager = { - WindowAnimationController, - WindowAnimationFinishedCallback, - WindowAnimationTarget, - RRect, - setController: function (...args) { - console.warn("windowAnimationManager.setController interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } - } - return windowAnimationManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_Ability.js b/runtime/main/extend/systemplugin/napi/ohos_application_Ability.js deleted file mode 100644 index d63f16c7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_Ability.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2021-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 { AbilityContextClass } from "./application/AbilityContext" -import { WantClass } from "./ohos_application_Want" -import { OnContinueResult } from "./ohos_application_AbilityConstant" -import { MessageParcelClass } from "./ohos_rpc" - -export const Caller = { - call: function (...args) { - console.warn("Caller.call 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(); - }) - }, - callWithResult: function (...args) { - console.warn("Caller.callWithResult 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(new MessageParcelClass()); - }) - }, - release: function () { - console.warn("Caller.release interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - onRelease: function (...args) { - console.warn("Caller.onRelease interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, -} -export const Callee = { - on: function (...args) { - console.warn("Ability.calleeClass.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - off: function (...args) { - console.warn("Ability.calleeClass.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, -} -export const AbilityClass = class Ability { - constructor() { - console.warn('application.Ability.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new AbilityContextClass(); - this.launchWant = new WantClass(); - this.lastRequestWant = new WantClass(); - this.callee = Callee; - this.onCreate = function (...args) { - console.warn("application.Ability.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWindowStageCreate = function (...args) { - console.warn("application.Ability.onWindowStageCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWindowStageDestroy = function () { - console.warn("application.Ability.onWindowStageDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onWindowStageRestore = function (...args) { - console.warn("application.Ability.onWindowStageRestore interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onDestroy = function () { - console.warn("application.Ability.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onForeground = function () { - console.warn("application.Ability.onForeground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onBackground = function () { - console.warn("application.Ability.onBackground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onContinue = function (...args) { - console.warn("application.Ability.onContinue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return OnContinueResult; - }; - this.onNewWant = function (...args) { - console.warn("application.Ability.onNewWant interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onConfigurationUpdated = function (...args) { - console.warn("application.Ability.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.dump = function (...args) { - console.warn("application.Ability.dump interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return [paramMock.paramStringMock]; - }; - this.onMemoryLevel = function (...args) { - console.warn("application.Ability.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -} -export function mockAbility() { - return new AbilityClass(); -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js b/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js deleted file mode 100644 index ffeca788..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityConstant.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 LaunchParam = { - launchReason: LaunchReason, - lastExitReason: LastExitReason, -} -export const LaunchReason = { - UNKNOWN: 0, - START_ABILITY: 1, - CALL: 2, - CONTINUATION: 3, -} -export const LastExitReason = { - UNKNOWN: 0, - ABILITY_NOT_RESPONDING: 1, - NORMAL: 2, -} -export const OnContinueResult = { - AGREE: 0, - REJECT: 1, - MISMATCH: 2, -} -export const MemoryLevel = { - MEMORY_LEVEL_MODERATE: 0, - MEMORY_LEVEL_LOW: 1, - MEMORY_LEVEL_CRITICAL: 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, - MemoryLevel, - WindowMode - } - return AbilityConstant; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityLifecycleCallback.js b/runtime/main/extend/systemplugin/napi/ohos_application_AbilityLifecycleCallback.js deleted file mode 100644 index f6e0b1d1..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityLifecycleCallback.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 mockAbilityLifecycleCallback() { - const AbilityLifecycleCallbackClass = class AbilityLifecycleCallback { - constructor() { - console.warn('application.AbilityLifecycleCallback.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.onAbilityCreate = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityWindowStageCreate = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityWindowStageCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityWindowStageDestroy = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityWindowStageDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityDestroy = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityForeground = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityForeground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityBackground = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityBackground interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAbilityContinue = function (...args) { - console.warn("application.AbilityLifecycleCallback.onAbilityContinue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return new AbilityLifecycleCallbackClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityStage.js b/runtime/main/extend/systemplugin/napi/ohos_application_AbilityStage.js deleted file mode 100644 index 359c3fb7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_AbilityStage.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 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 { AbilityStageContextClass } from "./application/AbilityStageContext" -import { paramMock } from "../utils" - -export function mockAbilityStage() { - const AbilityStageClass = class AbilityStage { - constructor() { - console.warn('application.AbilityStage.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new AbilityStageContextClass(); - this.onCreate = function () { - console.warn("application.AbilityStage.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAcceptWant = function (...args) { - console.warn("application.AbilityStage.onAcceptWant interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.onConfigurationUpdated = function (...args) { - console.warn("application.AbilityStage.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onMemoryLevel = function (...args) { - console.warn("application.AbilityStage.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return new AbilityStageClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_AccessibilityExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_application_AccessibilityExtensionAbility.js deleted file mode 100755 index fe7eb1f7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_AccessibilityExtensionAbility.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { AccessibilityExtensionContext } from './application/AccessibilityExtensionContext'; - -const AccessibilityEvent = { - eventType: '[PC Preview] unknown eventType', - target: '[PC Preview] unknown target', - timeStamp: '[PC Preview] unknown timeStamp' -}; - -const GesturePoint = { - positionX: '[PC Preview] unknown positionX', - positionY: '[PC Preview] unknown positionY' - }; - -const GesturePath = { - points: [GesturePoint], - durationTime: '[PC Preview] unknown durationTime' -}; - -export function mockAccessibilityExtensionAbility() { - const AccessibilityExtensionAbilityClass = class AccessibilityExtensionAbility { - constructor() { - console.warn('accessibilityExtensionAbility.constructor interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - this.context = new AccessibilityExtensionContext(); - this.onConnect = function (...args) { - console.warn('accessibilityExtensionAbility.onConnect interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - }; - this.onDisconnect = function (...args) { - console.warn('accessibilityExtensionAbility.onDisconnect interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - }; - this.onAccessibilityEvent = function (...args) { - console.warn('accessibilityExtensionAbility.onAccessibilityEvent interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - }; - this.onKeyEvent = function (...args) { - console.warn('accessibilityExtensionAbility.onKeyEvent interface mocked in the Previewer.' + - ' How this interface works on the Previewer may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }; - } - }; - - return AccessibilityExtensionAbilityClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_Configuration.js b/runtime/main/extend/systemplugin/napi/ohos_application_Configuration.js deleted file mode 100644 index c368d86a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_Configuration.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { ColorMode, Direction, ScreenDensity} from "./ohos_application_ConfigurationConstant" -export const Configuration = { - language: '[PC preview] unknow language', - colorMode: ColorMode, - direction: Direction, - screenDensity: ScreenDensity, - displayId: '[PC preview] unknow displayId', - hasPointerDevice: '[PC preview] unknow hasPointerDevice', -} -export function mockConfiguration() { - return Configuration; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_ConfigurationConstant.js b/runtime/main/extend/systemplugin/napi/ohos_application_ConfigurationConstant.js deleted file mode 100644 index 1c57b1dc..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_ConfigurationConstant.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 ColorMode = { - COLOR_MODE_NOT_SET: -1, - COLOR_MODE_DARK: 0, - COLOR_MODE_LIGHT: 1, -} -export const Direction = { - DIRECTION_NOT_SET: -1, - DIRECTION_VERTICAL: 0, - DIRECTION_HORIZONTAL: 1, -} -export const ScreenDensity = { - SCREEN_DENSITY_NOT_SET: 0, - SCREEN_DENSITY_SDPI: 120, - SCREEN_DENSITY_MDPI: 160, - SCREEN_DENSITY_LDPI: 240, - SCREEN_DENSITY_XLDPI: 320, - SCREEN_DENSITY_XXLDPI: 480, - SCREEN_DENSITY_XXXLDPI: 640, -} -export function mockConfigurationConstant() { - const ConfigurationConstant = { - ColorMode, - Direction, - ScreenDensity - } - return ConfigurationConstant; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_DataShareExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_application_DataShareExtensionAbility.js deleted file mode 100644 index 47766cf0..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_DataShareExtensionAbility.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 { ExtensionContextClass } from "./application/ExtensionContext" - -export function mockDataShareExtensionAbility() { - const DataShareExtensionAbilityClass = class DataShareExtensionAbility { - constructor() { - console.warn('application.DataShareExtensionAbility interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new ExtensionContextClass(); - this.onCreate = function (...args) { - console.warn("application.DataShareExtensionAbility.onCreate 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) - } - }, - this.getFileTypes = function (...args) { - console.warn("application.DataShareExtensionAbility.getFileTypes 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]) - } - }, - this.openFile = function (...args) { - console.warn("application.DataShareExtensionAbility.openFile 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.paramNumberMock) - } - }, - this.insert = function (...args) { - console.warn("application.DataShareExtensionAbility.insert 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.paramNumberMock) - } - }, - this.update = function (...args) { - console.warn("application.DataShareExtensionAbility.update 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.paramNumberMock) - } - }, - this.delete = function (...args) { - console.warn("application.DataShareExtensionAbility.delete 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.paramNumberMock) - } - }, - this.query = function (...args) { - console.warn("application.DataShareExtensionAbility.query 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) - } - }, - this.getType = function (...args) { - console.warn("application.DataShareExtensionAbility.getType 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) - } - }, - this.batchInsert = function (...args) { - console.warn("application.DataShareExtensionAbility.batchInsert 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.paramNumberMock) - } - }, - this.normalizeUri = function (...args) { - console.warn("application.DataShareExtensionAbility.normalizeUri 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) - } - }, - this.denormalizeUri = function (...args) { - console.warn("application.DataShareExtensionAbility.denormalizeUri 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) - } - } - } - } - return DataShareExtensionAbilityClass; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_EnvironmentCallback.js b/runtime/main/extend/systemplugin/napi/ohos_application_EnvironmentCallback.js deleted file mode 100644 index 0589efdf..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_EnvironmentCallback.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 EnvironmentCallbackClass = class EnvironmentCallback { - constructor() { - console.warn('EnvironmentCallback.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.onConfigurationUpdated = function (...args) { - console.warn("EnvironmentCallback.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } -} - -export function mockEnvironmentCallback() { - return new EnvironmentCallbackClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_FormExtension.js b/runtime/main/extend/systemplugin/napi/ohos_application_FormExtension.js deleted file mode 100644 index 996e0737..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_FormExtension.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2021-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 { FormState } from "./ohos_application_formInfo" -import { FormExtensionContextClass as FormExtensionContext } from "./application/FormExtensionContext" -import { FormBindingData } from "./ohos_application_formBindingData" - -export function mockFormExtension() { - const formExtensionClass = class formExtension { - constructor() { - console.warn('application.formExtension.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new FormExtensionContext(); - this.onCreate = function (...args) { - console.warn("application.formExtension.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return FormBindingData - }; - this.onCastToNormal = function (...args) { - console.warn("application.formExtension.onCastToNormal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onUpdate = function (...args) { - console.warn("application.formExtension.onUpdate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onVisibilityChange = function (...args) { - console.warn("application.formExtension.onVisibilityChange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onEvent = function (...args) { - console.warn("application.formExtension.onEvent interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onDestroy = function (...args) { - console.warn("application.formExtension.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onConfigurationUpdated = function (...args) { - console.warn("application.formExtension.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onAcquireFormState = function (...args) { - console.warn("application.formExtension.onAcquireFormState interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return FormState; - }; - this.onShare = function (...args) { - console.warn("application.formExtension.onShare interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return {"key": "unknow any"}; - }; - } - } - return new formExtensionClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_ServiceExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_application_ServiceExtensionAbility.js deleted file mode 100644 index 6ee3b2c8..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_ServiceExtensionAbility.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021 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 { ServiceExtensionContextClass } from "./application/ServiceExtensionContext" -import { RemoteObjectClass } from "./ohos_rpc" - -export function mockServiceExtensionAbility() { - const ServiceExtensionAbilityClass = class ServiceExtensionAbility { - constructor() { - console.warn('application.ServiceExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new ServiceExtensionContextClass(); - this.onCreate = function (...args) { - console.warn("application.ServiceExtensionAbility.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onDestroy = function () { - console.warn("application.ServiceExtensionAbility.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onRequest = function (...args) { - console.warn("application.ServiceExtensionAbility.onRequest interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onConnect = function (...args) { - console.warn("application.ServiceExtensionAbility.onConnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new RemoteObjectClass(); - }; - this.onDisconnect = function (...args) { - console.warn("application.ServiceExtensionAbility.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onReconnect = function (...args) { - console.warn("application.ServiceExtensionAbility.onReconnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onConfigurationUpdated = function (...args) { - console.warn("application.ServiceExtensionAbility.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.dump = function (...args) { - console.warn("application.ServiceExtensionAbility.dump 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 new ServiceExtensionAbilityClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_StartOptions.js b/runtime/main/extend/systemplugin/napi/ohos_application_StartOptions.js deleted file mode 100644 index a1e50970..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_StartOptions.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 StartOptionsClass = class StartOptions { - constructor() { - console.warn('StartOptions.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.windowMode = "[PC Preview] unknow windowMode"; - this.displayId = "[PC Preview] unknow displayId"; - } -} -export function mockStartOptions() { - return new StartOptionsClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_StaticSubscriberExtensionAbility.js b/runtime/main/extend/systemplugin/napi/ohos_application_StaticSubscriberExtensionAbility.js deleted file mode 100644 index 45c9875f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_StaticSubscriberExtensionAbility.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 mockStaticSubscriberExtensionAbility() { - const StaticSubscriberExtensionAbilityClass = class StaticSubscriberExtensionAbility { - constructor() { - console.warn('StaticSubscriberExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.onReceiveEvent = function (...args) { - console.warn("StaticSubscriberExtensionAbility.onReceiveEvent interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return new StaticSubscriberExtensionAbilityClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_Want.js b/runtime/main/extend/systemplugin/napi/ohos_application_Want.js deleted file mode 100644 index 85c6a5be..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_Want.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 WantClass = class Want { - constructor() { - this.deviceId = "[PC Preview] unknow deviceId"; - this.bundleName = "[PC Preview] unknow bundleName"; - this.abilityName = "[PC Preview] unknow abilityName"; - this.uri = "[PC Preview] unknow uri"; - this.type = "[PC Preview] unknow type"; - this.flags = "[PC Preview] unknow flags"; - this.action = "[PC Preview] unknow action"; - this.parameters = {}; - this.entities = [paramMock.paramStringMock]; - this.moduleName = "[PC Preview] unknow moduleName"; - } -} -export function mockWant() { - return new WantClass(); -} - diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_abilityDelegatorRegistry.js b/runtime/main/extend/systemplugin/napi/ohos_application_abilityDelegatorRegistry.js deleted file mode 100644 index 613e1cf4..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_abilityDelegatorRegistry.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 { AbilityDelegator as _AbilityDelegator} from "./application/abilityDelegator" -import { AbilityDelegatorArgs as _AbilityDelegatorArgs } from "./application/abilityDelegatorArgs" -import { AbilityMonitor as _AbilityMonitor } from "./application/abilityMonitor" -import { ShellCmdResult as _ShellCmdResult } from "./application/shellCmdResult" - -export const AbilityLifecycleState = { - UNINITIALIZED: '[PC preview] unknow UNINITIALIZED', - CREATE: '[PC preview] unknow CREATE', - FOREGROUND: '[PC preview] unknow FOREGROUND', - BACKGROUND: '[PC preview] unknow BACKGROUND', - DESTROY: '[PC preview] unknow DESTROY', -} - -export function mockAbilityDelegatorRegistry() { - const abilityDelegatorRegistry = { - getAbilityDelegator: function () { - console.warn('abilityDelegatorRegistry.getAbilityDelegator interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return _AbilityDelegator; - }, - getArguments: function () { - console.warn('abilityDelegatorRegistry.getArguments interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return _AbilityDelegatorArgs; - }, - AbilityLifecycleState, - AbilityDelegator: _AbilityDelegator, - AbilityDelegatorArgs: _AbilityDelegatorArgs, - AbilityMonitor: _AbilityMonitor, - ShellCmdResult: _ShellCmdResult - } - return abilityDelegatorRegistry -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_abilityManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_abilityManager.js deleted file mode 100644 index 1513b1f9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_abilityManager.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 { AbilityRunningInfo as _AbilityRunningInfo } from "./application/AbilityRunningInfo" -import { ExtensionRunningInfo as _ExtensionRunningInfo } from "./application/ExtensionRunningInfo" -import { ElementName } from "./bundle/elementName" - -export const AbilityState = { - INITIAL: 0, - FOREGROUND: 9, - BACKGROUND: 10, - FOREGROUNDING: 11, - BACKGROUNDING: 12 -} -export function mockAbilityManager() { - const abilityManager = { - AbilityState, - updateConfiguration: function (...args) { - console.warn('abilityManager.updateConfiguration 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAbilityRunningInfos: function (...args) { - console.warn('abilityManager.getAbilityRunningInfos 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, [_AbilityRunningInfo]); - } else { - return new Promise((resolve) => { - resolve([_AbilityRunningInfo]); - }); - } - }, - getExtensionRunningInfos: function (...args) { - console.warn('abilityManager.getExtensionRunningInfos 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, [_ExtensionRunningInfo]); - } else { - return new Promise((resolve) => { - resolve([_ExtensionRunningInfo]); - }); - } - }, - getTopAbility: function (...args) { - console.warn('abilityManager.getTopAbility 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, ElementName); - } else { - return new Promise((resolve) => { - resolve(ElementName); - }); - } - }, - AbilityRunningInfo: _AbilityRunningInfo, - ExtensionRunningInfo: _ExtensionRunningInfo - } - return abilityManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_appManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_appManager.js deleted file mode 100644 index 53d18896..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_appManager.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 { AppStateDataClass as _AppStateData } from "./application/AppStateData" -import { ProcessRunningInfo } from "./application/ProcessRunningInfo" -import { AppStateDataClass as _AbilityStateData } from "./application/AppStateData" -import { ApplicationStateObserverClass as _ApplicationStateObserver } from "./application/ApplicationStateObserver" -import { ProcessDataClass as _ProcessData } from "./application/ProcessData" - -export function mockAppManager() { - const appManager = { - registerApplicationStateObserver: function (...args) { - console.warn('appManager.registerApplicationStateObserver interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - unregisterApplicationStateObserver: function (...args) { - console.warn('appManager.unregisterApplicationStateObserver 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getForegroundApplications: function (...args) { - console.warn('appManager.getForegroundApplications 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, [new _AppStateData()]); - } else { - return new Promise((resolve) => { - resolve([new _AppStateData()]); - }); - } - }, - killProcessWithAccount: function (...args) { - console.warn('appManager.killProcessWithAccount 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isRunningInStabilityTest: function (...args) { - console.warn('appManager.isRunningInStabilityTest 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); - }); - } - }, - getProcessRunningInfos: function (...args) { - console.warn('appManager.getProcessRunningInfos 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, [ProcessRunningInfo]); - } else { - return new Promise((resolve) => { - resolve([ProcessRunningInfo]); - }); - } - }, - killProcessesByBundleName: function (...args) { - console.warn('appManager.killProcessesByBundleName 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearUpApplicationData: function (...args) { - console.warn('appManager.clearUpApplicationData 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isRamConstrainedDevice: function (...args) { - console.warn('appManager.isRamConstrainedDevice 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); - }); - } - }, - getAppMemorySize: function (...args) { - console.warn('appManager.getAppMemorySize 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - AbilityStateData: new _AbilityStateData(), - AppStateData: new _AppStateData(), - ApplicationStateObserver: new _ApplicationStateObserver(), - ProcessData: new _ProcessData(), - ProcessRunningInfo - } - return appManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_context.js b/runtime/main/extend/systemplugin/napi/ohos_application_context.js deleted file mode 100644 index 58689e8b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_context.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { AbilityContextClass as _AbilityContext } from "./application/AbilityContext" -import { AbilityStageContextClass as _AbilityStageContext } from "./application/AbilityStageContext" -import { ApplicationContextClass as _ApplicationContext } from "./application/ApplicationContext" -import { BaseContextClass as _BaseContext } from "./application/BaseContext" -import { ContextClass as _Context } from "./application/Context" -import { ExtensionContextClass as _ExtensionContext } from "./application/ExtensionContext" -import { FormExtensionContextClass as _FormExtensionContext } from "./application/FormExtensionContext" -import { EventHubClass as _EventHub } from "./application/EventHub" -import { PermissionRequestResultClass as _PermissionRequestResult } from "./application/PermissionRequestResult" - -export const AreaMode = { - EL1: 0, - EL2: 1 -} -export function mockContext() { - const Context = { - AbilityContext: new _AbilityContext(), - AbilityStageContext: new _AbilityStageContext(), - ApplicationContext: new _ApplicationContext(), - BaseContext: new _BaseContext(), - Context: new _Context(), - ExtensionContext: new _ExtensionContext(), - FormExtensionContext: new _FormExtensionContext(), - AreaMode, - EventHub: new _EventHub(), - PermissionRequestResult: new _PermissionRequestResult() - } - return Context; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_errorManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_errorManager.js deleted file mode 100755 index b4ecd6ed..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_errorManager.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { ErrorObserverClass as _ErrorObserver } from "./application/ErrorObserver" - -export function mockErrorManager() { - const errorManager = { - registerErrorObserver: function (...args) { - console.warn('errorManager.registerErrorObserver interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - unregisterErrorObserver: function (...args) { - console.warn('errorManager.unregisterErrorObserver 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - ErrorObserver: new _ErrorObserver() - } - return errorManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_formBindingData.js b/runtime/main/extend/systemplugin/napi/ohos_application_formBindingData.js deleted file mode 100644 index 0284a3ce..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_formBindingData.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 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 FormBindingData = { - data: paramMock.paramObjectMock -} -export function mockFormBindingData() { - const formBindingData = { - createFormBindingData: function (...args) { - console.warn("formBindingData.createFormBindingData interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return FormBindingData; - }, - FormBindingData - } - return formBindingData; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_formError.js b/runtime/main/extend/systemplugin/napi/ohos_application_formError.js deleted file mode 100644 index 89565bfa..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_formError.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 FormError = { - ERR_COMMON: 1, - ERR_PERMISSION_DENY: 2, - ERR_GET_INFO_FAILED: 4, - ERR_GET_BUNDLE_FAILED: 5, - ERR_GET_LAYOUT_FAILED: 6, - ERR_ADD_INVALID_PARAM: 7, - ERR_CFG_NOT_MATCH_ID: 8, - ERR_NOT_EXIST_ID: 9, - ERR_BIND_PROVIDER_FAILED: 10, - ERR_MAX_SYSTEM_FORMS: 11, - ERR_MAX_INSTANCES_PER_FORM: 12, - ERR_OPERATION_FORM_NOT_SELF: 13, - ERR_PROVIDER_DEL_FAIL: 14, - ERR_MAX_FORMS_PER_CLIENT: 15, - ERR_MAX_SYSTEM_TEMP_FORMS: 16, - ERR_FORM_NO_SUCH_MODULE: 17, - ERR_FORM_NO_SUCH_ABILITY: 18, - ERR_FORM_NO_SUCH_DIMENSION: 19, - ERR_FORM_FA_NOT_INSTALLED: 20, - ERR_SYSTEM_RESPONSES_FAILED: 30, - ERR_FORM_DUPLICATE_ADDED: 31, - ERR_IN_RECOVERY: 36, - ERR_DISTRIBUTED_SCHEDULE_FAILED: 37 -} -export function mockFormError() { - const formError = { - FormError - } - return formError; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_formHost.js b/runtime/main/extend/systemplugin/napi/ohos_application_formHost.js deleted file mode 100644 index 5525217c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_formHost.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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 { FormInfo, FormStateInfo } from "./ohos_application_formInfo" - -export function mockFormHost() { - const formHost = { - deleteForm: function (...args) { - console.warn('formHost.deleteForm 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - releaseForm: function (...args) { - console.warn('formHost.releaseForm 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - requestForm: function (...args) { - console.warn('formHost.requestForm 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - castTempForm: function (...args) { - console.warn('formHost.castTempForm 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - notifyVisibleForms: function (...args) { - console.warn('formHost.notifyVisibleForms 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - notifyInvisibleForms: function (...args) { - console.warn('formHost.notifyInvisibleForms 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - enableFormsUpdate: function (...args) { - console.warn('formHost.enableFormsUpdate 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - disableFormsUpdate: function (...args) { - console.warn('formHost.disableFormsUpdate 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isSystemReady: function (...args) { - console.warn('formHost.isSystemReady 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAllFormsInfo: function (...args) { - console.warn('formHost.getAllFormsInfo 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, [FormInfo]); - } else { - return new Promise((resolve) => { - resolve([FormInfo]); - }); - } - }, - getFormsInfo: function (...args) { - console.warn('formHost.getFormsInfo 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, [FormInfo]); - } else { - return new Promise((resolve) => { - resolve([FormInfo]); - }); - } - }, - deleteInvalidForms: function (...args) { - console.warn('formHost.deleteInvalidForms 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.paramNumberMock]); - } else { - return new Promise((resolve) => { - resolve([paramMock.paramNumberMock]); - }); - } - }, - acquireFormState: function (...args) { - console.warn('formHost.acquireFormState 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, FormStateInfo); - } else { - return new Promise((resolve) => { - resolve(FormStateInfo); - }); - } - }, - on: function (...args) { - console.warn("formHost.on 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.paramStringMock); - } - }, - off: function (...args) { - console.warn("formHost.off 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.paramStringMock); - } - }, - notifyFormsVisible: function (...args) { - console.warn('formHost.notifyFormsVisible 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - notifyFormsEnableUpdate: function (...args) { - console.warn('formHost.notifyFormsEnableUpdate 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - shareForm: function (...args) { - console.warn('formHost.shareForm 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - } - return formHost -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_formInfo.js b/runtime/main/extend/systemplugin/napi/ohos_application_formInfo.js deleted file mode 100644 index 30e01439..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_formInfo.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 { WantClass } from "./ohos_application_Want" - -export const FormInfo = { - bundleName: '[PC preview] unknow bundleName', - moduleName: '[PC preview] unknow moduleName', - abilityName: '[PC preview] unknow abilityName', - name: '[PC preview] unknow name', - description: '[PC preview] unknow description', - type: FormType, - jsComponentName: '[PC preview] unknow jsComponentName', - colorMode: ColorMode, - isDefault: '[PC preview] unknow isDefault', - updateEnabled: '[PC preview] unknow updateEnabled', - formVisibleNotify: '[PC preview] unknow formVisibleNotify', - relatedBundleName: '[PC preview] unknow relatedBundleName', - scheduledUpdateTime: '[PC preview] unknow scheduledUpdateTime', - formConfigAbility: '[PC preview] unknow formConfigAbility', - updateDuration: '[PC preview] unknow updateDuration', - defaultDimension: '[PC preview] unknow defaultDimension', - supportDimensions: [paramMock.paramNumberMock], - customizeData: {"key": paramMock.paramStringMock}, -} -export const FormType = { - JS: 1, -} -export const ColorMode = { - MODE_AUTO: -1, - MODE_DARK: 0, - MODE_LIGHT: 1 -} -export const FormStateInfo = { - formState: FormState, - want: new WantClass(), -} -export const FormState = { - UNKNOWN: -1, - DEFAULT: 0, - READY: 1, -} -export const FormParam = { - IDENTITY_KEY: "ohos.extra.param.key.form_identity", - DIMENSION_KEY: "ohos.extra.param.key.form_dimension", - NAME_KEY: "ohos.extra.param.key.form_name", - MODULE_NAME_KEY: "ohos.extra.param.key.module_name", - WIDTH_KEY: "ohos.extra.param.key.form_width", - HEIGHT_KEY: "ohos.extra.param.key.form_height", - TEMPORARY_KEY: "ohos.extra.param.key.form_temporary", - BUNDLE_NAME_KEY: "ohos.extra.param.key.bundle_name", - ABILITY_NAME_KEY: "ohos.extra.param.key.ability_name", - DEVICE_ID_KEY: "ohos.extra.param.key.device_id" -} -export const FormInfoFilter = { - moduleName: '[PC preview] unknow moduleName', -} -export const FormDimension = { - Dimension_1_2: 1, - Dimension_2_2: '[PC preview] unknow Dimension_2_2', - Dimension_2_4: '[PC preview] unknow Dimension_2_4', - Dimension_4_4: '[PC preview] unknow Dimension_4_4', - Dimension_2_1: '[PC preview] unknow Dimension_2_1', -} -export function mockFormInfo() { - const formInfo = { - FormInfo, - FormType, - ColorMode, - FormStateInfo, - FormState, - FormParam, - FormInfoFilter, - FormDimension - } - return formInfo; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_formProvider.js b/runtime/main/extend/systemplugin/napi/ohos_application_formProvider.js deleted file mode 100644 index 078f3e77..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_formProvider.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 { FormInfo } from "./ohos_application_formInfo" - -export function mockFormProvider() { - const formProvider = { - setFormNextRefreshTime: function (...args) { - console.warn('formProvider.setFormNextRefreshTime 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; - // callback - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - updateForm: function (...args) { - console.warn('formProvider.updateForm 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; - // callback - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getFormsInfo: function (...args) { - console.warn('formProvider.getFormsInfo 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; - var array = new Array(); - array.push(FormInfo); - // promise without option. - if (len == 0) { - return new Promise((resolve) => { - resolve(array); - }); - } - // callback - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array); - } else { - return new Promise((resolve) => { - resolve(array); - }); - } - }, - requestPublishForm: function (...args) { - console.warn('formProvider.requestPublishForm 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; - // callback - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramStringMock); - }); - } - }, - isRequestPublishFormSupported: function (...args) { - console.warn('formProvider.isRequestPublishFormSupported interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - // callback - 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); - }); - } - } - } - return formProvider; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_missionManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_missionManager.js deleted file mode 100644 index d6619a5c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_missionManager.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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 { MissionInfo as _MissionInfo } from "./application/MissionInfo" -import { MissionSnapshot as _MissionSnapshot } from "./application/MissionSnapshot" -import { MissionListener as _MissionListener } from "./application/MissionListener" - -export function mockMissionManager() { - const missionManager = { - registerMissionListener: function (...args) { - console.warn("missionManager.registerMissionListener interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - unregisterMissionListener: function (...args) { - console.warn('missionManager.unregisterMissionListener 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getMissionInfo: function (...args) { - console.warn('missionManager.getMissionInfo 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, _MissionInfo); - } else { - return new Promise((resolve) => { - resolve(_MissionInfo); - }); - } - }, - getMissionInfos: function (...args) { - console.warn('missionManager.getMissionInfos 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, [_MissionInfo]); - } else { - return new Promise((resolve) => { - resolve([_MissionInfo]); - }); - } - }, - getMissionSnapShot: function (...args) { - console.warn('missionManager.getMissionSnapShot 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, _MissionSnapshot); - } else { - return new Promise((resolve) => { - resolve(_MissionSnapshot); - }); - } - }, - getLowResolutionMissionSnapShot: function (...args) { - console.warn('missionManager.getLowResolutionMissionSnapShot 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, _MissionSnapshot); - } else { - return new Promise((resolve) => { - resolve(_MissionSnapshot); - }); - } - }, - lockMission: function (...args) { - console.warn('missionManager.lockMission 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - unlockMission: function (...args) { - console.warn('missionManager.unlockMission 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearMission: function (...args) { - console.warn('missionManager.clearMission 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearAllMissions: function (...args) { - console.warn('missionManager.clearAllMissions 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - moveMissionToFront: function (...args) { - console.warn('missionManager.moveMissionToFront 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - MissionInfo: _MissionInfo, - MissionListener: _MissionListener, - MissionSnapshot: _MissionSnapshot - } - return missionManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_quickFixManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_quickFixManager.js deleted file mode 100644 index 5576c94c..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_quickFixManager.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 HapModuleQuickFixInfo = { - moduleName: '[PC preview] unknow moduleName', - originHapHash: '[PC preview] unknow originHapHash', - quickFixFilePath: '[PC preview] unknow quickFixFilePath', -} -export const ApplicationQuickFixInfo = { - bundleName: '[PC preview] unknow bundleName', - bundleVersionCode: '[PC preview] unknow bundleVersionCode', - bundleVersionName: '[PC preview] unknow bundleVersionName', - quickFixVersionCode: '[PC preview] unknow quickFixVersionCode', - quickFixVersionName: '[PC preview] unknow quickFixVersionName', - hapModuleQuickFixInfo: [HapModuleQuickFixInfo], -} -export function mockQuickFixManager() { - const quickFixManager = { - HapModuleQuickFixInfo, - ApplicationQuickFixInfo, - applyQuickFix: function (...args) { - console.warn('quickFixManager.applyQuickFix 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getApplicationQuickFixInfo: function (...args) { - console.warn('quickFixManager.getApplicationQuickFixInfo 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, ApplicationQuickFixInfo); - } else { - return new Promise((resolve) => { - resolve(ApplicationQuickFixInfo); - }); - } - }, - } - return quickFixManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_testRunner.js b/runtime/main/extend/systemplugin/napi/ohos_application_testRunner.js deleted file mode 100644 index 21abc4d6..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_testRunner.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 mockTestRunner() { - const TestRunner = { - onPrepare: function () { - console.warn('TestRunner.onPrepare interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - }, - onRun: function () { - console.warn('TestRunner.onRun interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - }, - } - return TestRunner; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_application_uriPermissionManager.js b/runtime/main/extend/systemplugin/napi/ohos_application_uriPermissionManager.js deleted file mode 100644 index 282c1527..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_application_uriPermissionManager.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 mockUriPermissionManager() { - const UriPermissionManagerClass = class UriPermissionManager { - constructor() { - console.warn('application.UriPermissionManager.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.verifyUriPermission = function (...args) { - console.warn("UriPermissionManager.verifyUriPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }; - } - } - return new UriPermissionManagerClass(); -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js b/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js deleted file mode 100644 index 30d41fe5..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_backgroundTaskManager.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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 mockBackgroundTaskManager() { - const DelaySuspendInfo = { - requestId: '[PC preview] unknown requestId', - actualDelayTime: '[PC preview] unknown actualDelayTime', - }; - const backgroundTaskManager = { - BackgroundMode : { - DATA_TRANSFER: 1, - AUDIO_PLAYBACK: 2, - AUDIO_RECORDING: 3, - LOCATION: 4, - BLUETOOTH_INTERACTION: 5, - MULTI_DEVICE_CONNECTION: 6, - WIFI_INTERACTION: 7, - 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, - }, - EfficiencyResourcesRequest : { - resourceTypes: '[PC preview] unknown resourceTypes', - 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.") - const len = args.length; - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - return DelaySuspendInfo; - } - }, - cancelSuspendDelay: function (...args) { - console.warn("backgroundTaskManager.cancelSuspendDelay interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getRemainingDelayTime: function (...args) { - console.warn("backgroundTaskManager.getRemainingDelayTime 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, DelaySuspendInfo.actualDelayTime) - } else { - return new Promise((resolve) => { - resolve(DelaySuspendInfo.actualDelayTime) - }); - } - }, - startBackgroundRunning: function (...args) { - console.warn("backgroundTaskManager.startBackgroundRunning 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - stopBackgroundRunning: function (...args) { - console.warn("backgroundTaskManager.stopBackgroundRunning 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); - } else { - return new Promise((resolve) => { - 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.") - return paramMock.paramBooleanMock; - }, - 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; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_batteryInfo.js b/runtime/main/extend/systemplugin/napi/ohos_batteryInfo.js deleted file mode 100644 index 8c0c9340..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_batteryInfo.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2021-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 mockBatteryinfo() { - const BatteryPluggedType = { - NONE: 0, - AC: 1, - USB: 2, - WIRELESS: 3 - } - const BatteryChargeState = { - NONE: 0, - ENABLE: 1, - DISABLE: 2, - FULL: 3 - } - const BatteryHealthState = { - UNKNOWN: 0, - GOOD: 1, - OVERHEAT: 2, - OVERVOLTAGE: 3, - COLD: 4, - DEAD: 5 - } - const BatteryCapacityLevel = { - LEVEL_NONE: 0, - LEVEL_FULL: 1, - LEVEL_HIGH: 2, - LEVEL_NORMAL: 3, - LEVEL_LOW: 4, - LEVEL_CRITICAL: 5 - } - const CommonEventBatteryChangedCode = { - EXTRA_SOC: 0, - EXTRA_VOLTAGE: 1, - EXTRA_TEMPERATURE: 2, - EXTRA_HEALTH_STATE: 3, - EXTRA_PLUGGED_TYPE: 4, - EXTRA_MAX_CURRENT: 5, - EXTRA_MAX_VOLTAGE: 6, - EXTRA_CHARGE_STATE: 7, - EXTRA_CHARGE_COUNTER: 8, - EXTRA_PRESENT: 9, - EXTRA_TECHNOLOGY: 10, - } - const batteryInfo = { - BatteryPluggedType, - BatteryChargeState, - BatteryHealthState, - BatteryCapacityLevel, - CommonEventBatteryChangedCode, - batterySOC: "[PC Preview] unknow batterySOC", - chargingStatus: BatteryChargeState, - healthStatus: BatteryHealthState, - pluggedType: BatteryPluggedType, - voltage: "[PC Preview] unknow voltage", - technology: "[PC Preview] unknow technology", - batteryTemperature: "[PC Preview] unknow batteryTemperature", - isBatteryPresent: "[PC Preview] unknow isBatteryPresent", - batteryCapacityLevel: BatteryCapacityLevel, - estimatedRemainingChargeTime: "[PC Preview] unknow estimatedRemainingChargeTime", - totalEnergy: "[PC Preview] unknow totalEnergy", - nowCurrent: "[PC Preview] unknow nowCurrent", - remainingEnergy: "[PC Preview] unknow remainingEnergy" - } - return batteryInfo -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_batteryStatistics.js b/runtime/main/extend/systemplugin/napi/ohos_batteryStatistics.js deleted file mode 100644 index 41ac82b0..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_batteryStatistics.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 mockBatteryStatistics() { - const ConsumptionType = { - CONSUMPTION_TYPE_INVALID: -17, - CONSUMPTION_TYPE_APP: '[PC preview] unknow CONSUMPTION_TYPE_APP', - CONSUMPTION_TYPE_BLUETOOTH: '[PC preview] unknow CONSUMPTION_TYPE_BLUETOOTH', - CONSUMPTION_TYPE_IDLE: '[PC preview] unknow CONSUMPTION_TYPE_IDLE', - CONSUMPTION_TYPE_PHONE: '[PC preview] unknow CONSUMPTION_TYPE_PHONE', - CONSUMPTION_TYPE_RADIO: '[PC preview] unknow CONSUMPTION_TYPE_RADIO', - CONSUMPTION_TYPE_SCREEN: '[PC preview] unknow CONSUMPTION_TYPE_SCREEN', - CONSUMPTION_TYPE_USER: '[PC preview] unknow CONSUMPTION_TYPE_USER', - CONSUMPTION_TYPE_WIFI: '[PC preview] unknow CONSUMPTION_TYPE_WIFI' - } - const BatteryStatsInfo = { - uid: '[PC preview] unknow uid', - type: ConsumptionType, - power: '[PC preview] unknow power', - } - const batteryStats = { - ConsumptionType, - BatteryStatsInfo, - getBatteryStats: function (...args) { - console.warn("batteryStats.getBatteryStats interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var batteryStatsInfos = new Array(BatteryStatsInfo) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, batteryStatsInfos); - }else { - return new Promise((resolve, reject) => { - resolve(batteryStatsInfos); - }) - } - }, - getAppPowerValue: function (...args) { - console.warn("batteryStats.getAppPowerValue interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getAppPowerPercent: function (...args) { - console.warn("batteryStats.getAppPowerPercent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getHardwareUnitPowerValue: function (...args) { - console.warn("batteryStats.getHardwareUnitPowerValue interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - - }, - getHardwareUnitPowerPercent: function (...args) { - console.warn("batteryStats.getHardwareUnitPowerPercent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - } - } - return batteryStats - } - \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bluetooth.js b/runtime/main/extend/systemplugin/napi/ohos_bluetooth.js deleted file mode 100644 index a958fb25..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bluetooth.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "../utils" - -export function mockBluetooth() { - const bluetooth = { - startBLEScan: function (...args) { - console.warn("bluetooth.startBLEScan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - stopBLEScan: function (...args) { - console.warn("bluetooth.stopBLEScan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - subscribeBLEFound: function (...args) { - console.warn("bluetooth.subscribeBLEFound interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const options = { - addrType: 'public', - addr: 'xx:xx:xx:xx', - rssi: 123, - txpower: 'xxx', - data: 'xxx' - } - const min = 1 - const max = 6 - clearInterval(this.unsubscribeBLE) - delete this.unsubscribeBLE - this.unsubscribeBLE = setInterval(() => { - const randomAddr = Math.floor(Math.random() * (max - min)) + min - const optionsArr = Array(randomAddr).fill(options) - args[0].success(optionsArr) - }, 1000) - }, - unsubscribeBLEFound: function () { - console.warn("bluetooth.unsubscribeBLEFound interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeBLE) - delete this.unsubscribeBLE - } - } - return bluetooth -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_brightness.js b/runtime/main/extend/systemplugin/napi/ohos_brightness.js deleted file mode 100644 index 37e2fa58..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_brightness.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021-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 { hasComplete } from "../utils" - -export function mockBrightness() { - const brightness = { - setValue: function (...args) { - console.warn("brightness.setValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } - return brightness -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_buffer.js b/runtime/main/extend/systemplugin/napi/ohos_buffer.js deleted file mode 100644 index 1168d039..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_buffer.js +++ /dev/null @@ -1,436 +0,0 @@ -/* - * 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 mockBuffer() { - const paramBuffer = { - paramIterMock_K : '[PC Preview] unknow iterableiterator_k', - paramIterMock_V : '[PC Preview] unknow iterableiterator_v' - } - const BlobClass = class Blob { - constructor(...args) { - console.warn('BlobClass.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.size = '[PC preview] unknow size'; - this.type = '[PC preview] unknow type'; - this.arrayBuffer = function (...args) { - console.warn("BlobClass.arrayBuffer 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(paramMock.paramArrayMock) - }); - }; - this.slice = function (...args) { - console.warn("BlobClass.slice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BlobClass(); - }; - this.text = function (...args) { - console.warn("BlobClass.text 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(paramMock.paramStringMock) - }); - }; - } - } - - const buffer = { - alloc: function (...args) { - console.warn("buffer.alloc interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - allocUninitializedFromPool: function (...args) { - console.warn("buffer.allocUninitializedFromPool interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - allocUninitialized: function (...args) { - console.warn("buffer.allocUninitialized interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - byteLength: function (...args) { - console.warn("buffer.byteLength interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - concat: function (...args) { - console.warn("buffer.concat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - from: function (...args) { - console.warn("buffer.from interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - isBuffer: function (...args) { - console.warn("buffer.isBuffer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isEncoding: function (...args) { - console.warn("buffer.isEncoding interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - compare: function (...args) { - console.warn("buffer.compare interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - transcode: function (...args) { - console.warn("buffer.transcode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - Blob: BlobClass, - Buffer: BufferClass - } - - const BufferClass = class Buffer { - constructor() { - console.warn('BufferClass.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.length = '[PC preview] unknow length', - this.buffer = '[PC preview] unknow buffer', - this.byteOffset = '[PC preview] unknow byteOffset', - this.fill = function (...args) { - console.warn("Buffer.fill interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - this.compare = function (...args) { - console.warn("Buffer.compare interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.copy = function (...args) { - console.warn("Buffer.copy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.equals = function (...args) { - console.warn("Buffer.equals interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - this.includes = function (...args) { - console.warn("Buffer.includes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - this.indexOf = function (...args) { - console.warn("Buffer.indexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.keys = function (...args) { - console.warn("Buffer.keys interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device.") - const IteratorKMock = { - *[Symbol.iterator]() { - yield paramBuffer.paramIterMock_K; - } - }; - return IteratorKMock; - }, - this.values = function (...args) { - console.warn("Buffer.values interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramBuffer.paramIterMock_V; - } - }; - return IteratorVMock; - }, - this.entries = function (...args) { - console.warn("Buffer.entries interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramBuffer.paramIterMock_K, paramBuffer.paramIterMock_V]; - } - }; - return IteratorEntriesMock; - }, - this.lastIndexOf = function (...args) { - console.warn("Buffer.lastIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readBigInt64BE = function (...args) { - console.warn("Buffer.readBigInt64BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readBigInt64LE = function (...args) { - console.warn("Buffer.readBigInt64LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readBigUInt64BE = function (...args) { - console.warn("Buffer.readBigUInt64BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readBigUInt64LE = function (...args) { - console.warn("Buffer.readBigUInt64LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readDoubleBE = function (...args) { - console.warn("Buffer.readDoubleBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readDoubleLE = function (...args) { - console.warn("Buffer.readDoubleLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readFloatBE = function (...args) { - console.warn("Buffer.readFloatBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readFloatLE = function (...args) { - console.warn("Buffer.readFloatLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readInt8 = function (...args) { - console.warn("Buffer.readInt8 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readInt16BE = function (...args) { - console.warn("Buffer.readInt16BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readInt16LE = function (...args) { - console.warn("Buffer.readInt16LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readInt32BE = function (...args) { - console.warn("Buffer.readInt32BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readInt32LE = function (...args) { - console.warn("Buffer.readInt32LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readIntBE = function (...args) { - console.warn("Buffer.readIntBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readIntLE = function (...args) { - console.warn("Buffer.readIntLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUInt8 = function (...args) { - console.warn("Buffer.readUInt8 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUInt16BE = function (...args) { - console.warn("Buffer.readUInt16BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUInt16LE = function (...args) { - console.warn("Buffer.readUInt16LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUInt32BE = function (...args) { - console.warn("Buffer.readUInt32BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUInt32LE = function (...args) { - console.warn("Buffer.readUInt32LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUIntBE = function (...args) { - console.warn("Buffer.readUIntBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.readUIntLE = function (...args) { - console.warn("Buffer.readUIntLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.subarray = function (...args) { - console.warn("Buffer.subarray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - this.swap16 = function (...args) { - console.warn("Buffer.swap16 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - this.swap32 = function (...args) { - console.warn("Buffer.swap32 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - this.swap64 = function (...args) { - console.warn("Buffer.swap64 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BufferClass(); - }, - this.toJSON = function (...args) { - console.warn("Buffer.toJSON interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramObjectMock; - }, - this.toString = function (...args) { - console.warn("Buffer.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - this.write = function (...args) { - console.warn("Buffer.write interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeBigInt64BE = function (...args) { - console.warn("Buffer.writeBigInt64BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeBigInt64LE = function (...args) { - console.warn("Buffer.writeBigInt64LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeBigUInt64BE = function (...args) { - console.warn("Buffer.writeBigUInt64BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeBigUInt64LE = function (...args) { - console.warn("Buffer.writeBigUInt64LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeDoubleBE = function (...args) { - console.warn("Buffer.writeDoubleBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeDoubleLE = function (...args) { - console.warn("Buffer.writeDoubleLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeFloatBE = function (...args) { - console.warn("Buffer.writeFloatBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeFloatLE = function (...args) { - console.warn("Buffer.writeFloatLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeInt8 = function (...args) { - console.warn("Buffer.writeInt8 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeInt16BE = function (...args) { - console.warn("Buffer.writeInt16BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeInt16LE = function (...args) { - console.warn("Buffer.writeInt16LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeInt32BE = function (...args) { - console.warn("Buffer.writeInt32BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeInt32LE = function (...args) { - console.warn("Buffer.writeInt32LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeIntBE = function (...args) { - console.warn("Buffer.writeIntBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeIntLE = function (...args) { - console.warn("Buffer.writeIntLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUInt8 = function (...args) { - console.warn("Buffer.writeUInt8 interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUInt16BE = function (...args) { - console.warn("Buffer.writeUInt16BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUInt16LE = function (...args) { - console.warn("Buffer.writeUInt16LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUInt32BE = function (...args) { - console.warn("Buffer.writeUInt32BE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUInt32LE = function (...args) { - console.warn("Buffer.writeUInt32LE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUIntBE = function (...args) { - console.warn("Buffer.writeUIntBE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - this.writeUIntLE = function (...args) { - console.warn("Buffer.writeUIntLE interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - } - } -} -return buffer; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundle.js b/runtime/main/extend/systemplugin/napi/ohos_bundle.js deleted file mode 100644 index 49d86707..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bundle.js +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright (c) 2021-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 { 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 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, BundleInfo); - } else { - return new Promise((resolve) => { - resolve(BundleInfo); - }) - } - }, - getBundleInstaller: function(...args) { - console.warn("bundle.getBundleInstaller 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); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getApplicationInfo: function(...args) { - console.warn("bundle.getApplicationInfo 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, ApplicationInfo); - } else { - return new Promise((resolve) => { - resolve(ApplicationInfo); - }) - } - }, - queryAbilityByWant: function(...args) { - console.warn("bundle.queryAbilityByWant 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, Array(BundleInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(BundleInfo)); - }) - } - }, - getAllApplicationInfo: function(...args){ - console.warn("bundle.getAllApplicationInfo 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, Array(BundleInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(BundleInfo)); - }) - } - }, - getAllBundleInfo: function(...args) { - console.warn("bundle.getAllBundleInfo 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, Array(ApplicationInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(ApplicationInfo)); - }) - } - }, - getBundleArchiveInfo: function(...args) { - console.warn("bundle.getBundleArchiveInfo 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, Array(BundleInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(BundleInfo)); - }) - } - }, - getLaunchWantForBundle: function(...args) { - console.warn("bundle.getBundleArchiveInfo 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, Array(Want)); - } else { - return new Promise((resolve) => { - resolve(Array(Want)); - }) - } - }, - cleanBundleCacheFiles: function(...args) { - console.warn("bundle.cleanBundleCacheFiles 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); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setApplicationEnabled: function(...args) { - console.warn("bundle.setApplicationEnabled 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); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setAbilityEnabled: function(...args) { - console.warn("bundle.setAbilityEnabled 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); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setModuleUpgradeFlag: function (...args) { - console.warn("bundle.setModuleUpgradeFlag 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - isModuleRemovable: function (...args) { - console.warn("bundle.isModuleRemovable 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) - }); - } - }, - getProfileByAbility: function (...args) { - console.warn("bundle.getProfileByAbility 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, new Array(paramMock.paramStringMock)) - } else { - return new Promise((resolve) => { - resolve(new Array(paramMock.paramStringMock)) - }); - } - }, - getProfileByExtensionAbility: function (...args) { - console.warn("bundle.getProfileByExtensionAbility 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, new Array(paramMock.paramStringMock)) - } else { - return new Promise((resolve) => { - resolve(new Array(paramMock.paramStringMock)) - }); - } - }, - queryExtensionAbilityInfos: function (...args) { - console.warn("bundle.queryExtensionAbilityInfos 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, Array(ExtensionAbilityInfo)) - } else { - return new Promise((resolve) => { - resolve(Array(ExtensionAbilityInfo)) - }); - } - }, - getBundlePackInfo: function(...args) { - console.warn("bundle.getBundlePackInfo 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, BundlePackInfo); - } else { - return new Promise((resolve) => { - resolve(BundlePackInfo); - }) - } - }, - getDispatcherVersion: function(...args) { - console.warn("bundle.getDispatcherVersion 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, DispatchInfo); - } else { - return new Promise((resolve) => { - resolve(DispatchInfo); - }) - } - }, - setDisposedStatus: function (...args) { - console.warn("bundle.setDisposedStatus 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getDisposedStatus: function (...args) { - console.warn("bundle.getDisposedStatus 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }); - } - }, - 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); - }) - } - }, - getApplicationInfoSync: function(...args) { - console.warn("bundle.getApplicationInfoSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return ApplicationInfo - }, - getBundleInfoSync: function(...args) { - console.warn("bundle.getBundleInfoSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return BundleInfo - }, - }; - return bundle; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundleState.js b/runtime/main/extend/systemplugin/napi/ohos_bundleState.js deleted file mode 100644 index f7bb772d..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bundleState.js +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2021 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 mockBundleState() { - const BundleStateInfo = { - abilityInFgTotalTime: '[PC preview] unknown abilityInFgTotalTime', - abilityPrevAccessTime: '[PC preview] unknown abilityPrevAccessTime', - abilityPrevSeenTime: '[PC preview] unknown abilityPrevSeenTime', - abilitySeenTotalTime: '[PC preview] unknown abilitySeenTotalTime', - bundleName: "[PC preview] unknown bundle name", - fgAbilityAccessTotalTime: '[PC preview] unknown fgAbilityAccessTotalTime', - fgAbilityPrevAccessTime: '[PC preview] unknown fgAbilityPrevAccessTime', - id: '[PC preview] unknown id', - infosBeginTime: '[PC preview] unknown infosBeginTime', - infosEndTime: '[PC preview] unknown infosEndTime', - - merge: function (...args) { - console.warn("bundleState.merge interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - } - const BundleStateInfoArray = [BundleStateInfo] - const BundleActiveState = { - appUsagePriorityGroup: '[PC preview] unknown appUsagePriorityGroup', - bundleName: '[PC preview] unknown bundleName', - indexOfLink: '[PC preview] unknown indexOfLink', - nameOfClass: '[PC preview] unknown nameOfClass', - stateOccurredTime: '[PC preview] unknown stateOccurredTime', - stateType: '[PC preview] unknown stateType', - } - const BundleActiveStateArray = [BundleActiveState] - const BundleActiveEventState = { - name: '[PC preview] unknown name', - eventId: '[PC preview] unknown eventId', - count: '[PC preview] unknown count', - } - const BundleActiveEventStateArray = [BundleActiveEventState] - const BundleActiveInfoResponse = { - "key": BundleStateInfo - } - const BundleActiveGroupCallbackInfo = { - appUsageOldGroup : '[PC preview] unknown appUsageOldGroup', - appUsageNewGroup : '[PC preview] unknown appUsageNewGroup', - userId : '[PC preview] unknown userId', - changeReason : '[PC preview] unknown changeReason', - bundleName : '[PC preview] unknown bundleName', - } - const BundleActiveFormInfo = { - count : '[PC preview] unknown count', - formLastUsedTime : '[PC preview] unknown formLastUsedTime', - formId : '[PC preview] unknown formId', - formDimension : '[PC preview] unknown formDimension', - formName : '[PC preview] unknown formName', - } - const BundleActiveModuleInfo = { - deviceId : '[PC preview] unknown deviceId', - bundleName : '[PC preview] unknown bundleName', - moduleName : '[PC preview] unknown moduleName', - abilityName : '[PC preview] unknown abilityName', - appLabelId : '[PC preview] unknown appLabelId', - labelId : '[PC preview] unknown labelId', - descriptionId : '[PC preview] unknown descriptionId', - abilityLableId : '[PC preview] unknown abilityLableId', - abilityDescriptionId : '[PC preview] unknown abilityDescriptionId', - abilityIconId : '[PC preview] unknown abilityIconId', - launchedCount : '[PC preview] unknown launchedCount', - lastModuleUsedTime : '[PC preview] unknown lastModuleUsedTime', - formRecords : [BundleActiveFormInfo], - } - const IntervalType = { - BY_OPTIMIZED: 0, - BY_DAILY: 1, - BY_WEEKLY: 2, - BY_MONTHLY: 3, - BY_ANNUALLY: 4 - } - const GroupType = { - ACTIVE_GROUP_ALIVE : 10, - ACTIVE_GROUP_DAILY : 20, - ACTIVE_GROUP_FIXED : 30, - ACTIVE_GROUP_RARE : 40, - ACTIVE_GROUP_LIMIT : 50, - ACTIVE_GROUP_NEVER : 60, - } - const bundleState = { - isIdleState: function (...args) { - console.warn("bundleState.isIdleState 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) - }); - } - }, - queryAppUsagePriorityGroup: function (...args) { - console.warn("bundleState.queryAppUsagePriorityGroup 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }); - } - }, - queryBundleStateInfos: function (...args) { - console.warn("bundleState.queryBundleStateInfos 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, BundleActiveInfoResponse); - } else { - return new Promise((resolve) => { - resolve(BundleActiveInfoResponse) - }); - } - }, - queryBundleStateInfoByInterval: function (...args) { - console.warn("bundleState.queryBundleStateInfoByInterval 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, BundleStateInfoArray); - } else { - return new Promise((resolve) => { - resolve(BundleStateInfoArray) - }); - } - }, - queryBundleActiveStates: function (...args) { - console.warn("bundleState.queryBundleActiveStates 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, BundleActiveStateArray); - } else { - return new Promise((resolve) => { - resolve(BundleActiveStateArray) - }); - } - }, - queryCurrentBundleActiveStates: function (...args) { - console.warn("bundleState.queryCurrentBundleActiveStates 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, BundleActiveStateArray); - } else { - return new Promise((resolve) => { - resolve(BundleActiveStateArray) - }); - } - }, - queryBundleActiveEventStates: function (...args) { - console.warn("bundleState.queryBundleActiveEventStates 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, BundleActiveEventStateArray); - } else { - return new Promise((resolve) => { - resolve(BundleActiveEventStateArray) - }); - } - }, - queryAppNotificationNumber: function (...args) { - console.warn("bundleState.queryAppNotificationNumber 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, BundleActiveEventStateArray); - } else { - return new Promise((resolve) => { - resolve(BundleActiveEventStateArray) - }); - } - }, - setBundleGroup: function (...args) { - console.warn("bundleState.setBundleGroup 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); - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - registerGroupCallBack: function (...args) { - console.warn("bundleState.registerGroupCallBack 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); - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - unRegisterGroupCallBack: function (...args) { - console.warn("bundleState.unRegisterGroupCallBack 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); - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getRecentlyUsedModules: function (...args) { - console.warn("bundleState.getRecentlyUsedModules 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, BundleActiveModuleInfo); - } else { - return new Promise((resolve) => { - resolve(BundleActiveModuleInfo) - }); - } - }, - } - return bundleState -} \ 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 deleted file mode 100755 index 6d35a272..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bundle_defaultAppManager.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 { 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 = { - isDefaultApplication: function(...args){ - console.warn("defaultAppManager.isDefaultApplication 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); - }) - } - }, - getDefaultApplication: function(...args){ - console.warn("defaultAppManager.getDefaultApplication 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, BundleInfo); - } else { - return new Promise((resolve) => { - resolve(BundleInfo); - }) - } - }, - setDefaultApplication: function(...args){ - console.warn("defaultAppManager.setDefaultApplication 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - resetDefaultApplication: function(...args){ - console.warn("defaultAppManager.resetDefaultApplication 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - } - }; - return defaultAppManager; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js b/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js deleted file mode 100644 index 175a0249..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bundle_innerBundleManager.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2021 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 { ShortcutInfo } from './bundle/shortcutInfo' -import { LauncherAbilityInfo } from './bundle/launcherAbilityInfo' - -export function mockInnerBundle() { - const innerBundleManager = { - getLauncherAbilityInfos: function(...args){ - console.warn("innerBundle.getLauncherAbilityInfos 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, LauncherAbilityInfo); - } else { - return new Promise((resolve) => { - resolve(LauncherAbilityInfo); - }) - } - }, - on: function(...args) { - console.warn("innerBundle.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - off: function(...args) { - console.warn("innerBundle.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getAllLauncherAbilityInfos: function(...args){ - console.warn("innerBundle.getAllLauncherAbilityInfos 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, Array(LauncherAbilityInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(LauncherAbilityInfo)); - }) - } - }, - getShortcutInfos: function(...args){ - console.warn("innerBundle.getShortcutInfos 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, Array(ShortcutInfo)); - } else { - return new Promise((resolve) => { - resolve(Array(ShortcutInfo)); - }) - } - }, - }; - return innerBundleManager; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_bytrace.js b/runtime/main/extend/systemplugin/napi/ohos_bytrace.js deleted file mode 100644 index 94a502ae..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_bytrace.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 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 mockBytrace() { - const bytrace = { - startTrace: function (...args) { - console.warn("bytrace.startTrace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - finishTrace: function (...args) { - console.warn("bytrace.finishTrace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - traceByValue: function (...args) { - console.warn("bytrace.traceByValue interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } - } - return bytrace -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_commonEvent.js b/runtime/main/extend/systemplugin/napi/ohos_commonEvent.js deleted file mode 100644 index bd4b1a6d..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_commonEvent.js +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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 { CommonEventData } from "./commonEvent/commonEventData" -import { CommonEventSubscriber } from "./commonEvent/commonEventSubscriber" - -export const Support = { - COMMON_EVENT_BOOT_COMPLETED: "usual.event.BOOT_COMPLETED", - COMMON_EVENT_LOCKED_BOOT_COMPLETED: "usual.event.LOCKED_BOOT_COMPLETED", - COMMON_EVENT_SHUTDOWN: "usual.event.SHUTDOWN", - COMMON_EVENT_BATTERY_CHANGED: "usual.event.BATTERY_CHANGED", - COMMON_EVENT_BATTERY_LOW: "usual.event.BATTERY_LOW", - COMMON_EVENT_BATTERY_OKAY: "usual.event.BATTERY_OKAY", - COMMON_EVENT_POWER_CONNECTED: "usual.event.POWER_CONNECTED", - COMMON_EVENT_POWER_DISCONNECTED: "usual.event.POWER_DISCONNECTED", - COMMON_EVENT_SCREEN_OFF: "usual.event.SCREEN_OFF", - COMMON_EVENT_SCREEN_ON: "usual.event.SCREEN_ON", - COMMON_EVENT_THERMAL_LEVEL_CHANGED: "usual.event.THERMAL_LEVEL_CHANGED", - COMMON_EVENT_USER_PRESENT: "usual.event.USER_PRESENT", - COMMON_EVENT_TIME_TICK: "usual.event.TIME_TICK", - COMMON_EVENT_TIME_CHANGED: "usual.event.TIME_CHANGED", - COMMON_EVENT_DATE_CHANGED: "usual.event.DATE_CHANGED", - COMMON_EVENT_TIMEZONE_CHANGED: "usual.event.TIMEZONE_CHANGED", - COMMON_EVENT_CLOSE_SYSTEM_DIALOGS: "usual.event.CLOSE_SYSTEM_DIALOGS", - COMMON_EVENT_PACKAGE_ADDED: "usual.event.PACKAGE_ADDED", - COMMON_EVENT_PACKAGE_REPLACED: "usual.event.PACKAGE_REPLACED", - COMMON_EVENT_MY_PACKAGE_REPLACED: "usual.event.MY_PACKAGE_REPLACED", - COMMON_EVENT_PACKAGE_REMOVED: "usual.event.PACKAGE_REMOVED", - COMMON_EVENT_BUNDLE_REMOVED: "usual.event.BUNDLE_REMOVED", - COMMON_EVENT_PACKAGE_FULLY_REMOVED: "usual.event.PACKAGE_FULLY_REMOVED", - COMMON_EVENT_PACKAGE_CHANGED: "usual.event.PACKAGE_CHANGED", - COMMON_EVENT_PACKAGE_RESTARTED: "usual.event.PACKAGE_RESTARTED", - COMMON_EVENT_PACKAGE_DATA_CLEARED: "usual.event.PACKAGE_DATA_CLEARED", - COMMON_EVENT_PACKAGE_CACHE_CLEARED: "usual.event.PACKAGE_CACHE_CLEARED", - COMMON_EVENT_PACKAGES_SUSPENDED: "usual.event.PACKAGES_SUSPENDED", - COMMON_EVENT_PACKAGES_UNSUSPENDED: "usual.event.PACKAGES_UNSUSPENDED", - COMMON_EVENT_MY_PACKAGE_SUSPENDED: "usual.event.MY_PACKAGE_SUSPENDED", - COMMON_EVENT_MY_PACKAGE_UNSUSPENDED: "usual.event.MY_PACKAGE_UNSUSPENDED", - COMMON_EVENT_UID_REMOVED: "usual.event.UID_REMOVED", - COMMON_EVENT_PACKAGE_FIRST_LAUNCH: "usual.event.PACKAGE_FIRST_LAUNCH", - COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION: "usual.event.PACKAGE_NEEDS_VERIFICATION", - COMMON_EVENT_PACKAGE_VERIFIED: "usual.event.PACKAGE_VERIFIED", - COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE: "usual.event.EXTERNAL_APPLICATIONS_AVAILABLE", - COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE: "usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE", - COMMON_EVENT_CONFIGURATION_CHANGED: "usual.event.CONFIGURATION_CHANGED", - COMMON_EVENT_LOCALE_CHANGED: "usual.event.LOCALE_CHANGED", - COMMON_EVENT_MANAGE_PACKAGE_STORAGE: "usual.event.MANAGE_PACKAGE_STORAGE", - COMMON_EVENT_DRIVE_MODE: "common.event.DRIVE_MODE", - COMMON_EVENT_HOME_MODE: "common.event.HOME_MODE", - COMMON_EVENT_OFFICE_MODE: "common.event.OFFICE_MODE", - COMMON_EVENT_USER_STARTED: "usual.event.USER_STARTED", - COMMON_EVENT_USER_BACKGROUND: "usual.event.USER_BACKGROUND", - COMMON_EVENT_USER_FOREGROUND: "usual.event.USER_FOREGROUND", - COMMON_EVENT_USER_SWITCHED: "usual.event.USER_SWITCHED", - COMMON_EVENT_USER_STARTING: "usual.event.USER_STARTING", - COMMON_EVENT_USER_UNLOCKED: "usual.event.USER_UNLOCKED", - COMMON_EVENT_USER_STOPPING: "usual.event.USER_STOPPING", - COMMON_EVENT_USER_STOPPED: "usual.event.USER_STOPPED", - COMMON_EVENT_HWID_LOGIN: "common.event.HWID_LOGIN", - COMMON_EVENT_HWID_LOGOUT: "common.event.HWID_LOGOUT", - COMMON_EVENT_HWID_TOKEN_INVALID: "common.event.HWID_TOKEN_INVALID", - COMMON_EVENT_HWID_LOGOFF: "common.event.HWID_LOGOFF", - COMMON_EVENT_WIFI_POWER_STATE: "usual.event.wifi.POWER_STATE", - COMMON_EVENT_WIFI_SCAN_FINISHED: "usual.event.wifi.SCAN_FINISHED", - COMMON_EVENT_WIFI_RSSI_VALUE: "usual.event.wifi.RSSI_VALUE", - COMMON_EVENT_WIFI_CONN_STATE: "usual.event.wifi.CONN_STATE", - COMMON_EVENT_WIFI_HOTSPOT_STATE: "usual.event.wifi.HOTSPOT_STATE", - COMMON_EVENT_WIFI_AP_STA_JOIN: "usual.event.wifi.WIFI_HS_STA_JOIN", - COMMON_EVENT_WIFI_AP_STA_LEAVE: "usual.event.wifi.WIFI_HS_STA_LEAVE", - COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE: "usual.event.wifi.mplink.STATE_CHANGE", - COMMON_EVENT_WIFI_P2P_CONN_STATE: "usual.event.wifi.p2p.CONN_STATE_CHANGE", - COMMON_EVENT_WIFI_P2P_STATE_CHANGED: "usual.event.wifi.p2p.STATE_CHANGE", - COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED: "usual.event.wifi.p2p.DEVICES_CHANGE", - COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED: "usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE", - COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED:"usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE", - COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED:"usual.event.wifi.p2p.GROUP_STATE_CHANGED", - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE: - "usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE: - "usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE", - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE: "usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE:"usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE: "usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE: "usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE: - "usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE: "usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED: "usual.event.bluetooth.remotedevice.DISCOVERED", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE: "usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED: "usual.event.bluetooth.remotedevice.ACL_CONNECTED", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED: "usual.event.bluetooth.remotedevice.ACL_DISCONNECTED", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE: - "usual.event.bluetooth.remotedevice.NAME_UPDATE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE: - "usual.event.bluetooth.remotedevice.PAIR_STATE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE: - "usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT: - "usual.event.bluetooth.remotedevice.SDP_RESULT", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE: - "usual.event.bluetooth.remotedevice.UUID_VALUE", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ: - "usual.event.bluetooth.remotedevice.PAIRING_REQ", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL: - "usual.event.bluetooth.remotedevice.PAIRING_CANCEL", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ: - "usual.event.bluetooth.remotedevice.CONNECT_REQ", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY: - "usual.event.bluetooth.remotedevice.CONNECT_REPLY", - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL: - "usual.event.bluetooth.remotedevice.CONNECT_CANCEL", - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE: - "usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE: - "usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT: - "usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT", - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE: - "usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE: - "usual.event.bluetooth.host.STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE: - "usual.event.bluetooth.host.REQ_DISCOVERABLE", - COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE: "usual.event.bluetooth.host.REQ_ENABLE", - COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE: - "usual.event.bluetooth.host.REQ_DISABLE", - COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE: - "usual.event.bluetooth.host.SCAN_MODE_UPDATE", - COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED: - "usual.event.bluetooth.host.DISCOVERY_STARTED", - COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED: - "usual.event.bluetooth.host.DISCOVERY_FINISHED", - COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE: - "usual.event.bluetooth.host.NAME_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE: - "usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE: - "usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE", - COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE: - "usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE", - COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED: - "usual.event.nfc.action.ADAPTER_STATE_CHANGED", - COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED: - "usual.event.nfc.action.RF_FIELD_ON_DETECTED", - COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED: - "usual.event.nfc.action.RF_FIELD_OFF_DETECTED", - COMMON_EVENT_DISCHARGING: "usual.event.DISCHARGING", - COMMON_EVENT_CHARGING: "usual.event.CHARGING", - COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED: "usual.event.DEVICE_IDLE_MODE_CHANGED", - COMMON_EVENT_POWER_SAVE_MODE_CHANGED: "usual.event.POWER_SAVE_MODE_CHANGED", - COMMON_EVENT_USER_ADDED: "usual.event.USER_ADDED", - COMMON_EVENT_USER_REMOVED: "usual.event.USER_REMOVED", - COMMON_EVENT_ABILITY_ADDED: "common.event.ABILITY_ADDED", - COMMON_EVENT_ABILITY_REMOVED: "common.event.ABILITY_REMOVED", - COMMON_EVENT_ABILITY_UPDATED: "common.event.ABILITY_UPDATED", - COMMON_EVENT_LOCATION_MODE_STATE_CHANGED: - "usual.event.location.MODE_STATE_CHANGED", - COMMON_EVENT_IVI_SLEEP: "common.event.IVI_SLEEP", - COMMON_EVENT_IVI_PAUSE: "common.event.IVI_PAUSE", - COMMON_EVENT_IVI_STANDBY: "common.event.IVI_STANDBY", - COMMON_EVENT_IVI_LASTMODE_SAVE: "common.event.IVI_LASTMODE_SAVE", - COMMON_EVENT_IVI_VOLTAGE_ABNORMAL: "common.event.IVI_VOLTAGE_ABNORMAL", - COMMON_EVENT_IVI_HIGH_TEMPERATURE: "common.event.IVI_HIGH_TEMPERATURE", - COMMON_EVENT_IVI_EXTREME_TEMPERATURE: "common.event.IVI_EXTREME_TEMPERATURE", - COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL: "common.event.IVI_TEMPERATURE_ABNORMAL", - COMMON_EVENT_IVI_VOLTAGE_RECOVERY: "common.event.IVI_VOLTAGE_RECOVERY", - COMMON_EVENT_IVI_TEMPERATURE_RECOVERY: "common.event.IVI_TEMPERATURE_RECOVERY", - COMMON_EVENT_IVI_ACTIVE: "common.event.IVI_ACTIVE", - COMMON_EVENT_USB_STATE: "usual.event.hardware.usb.action.USB_STATE", - COMMON_EVENT_USB_PORT_CHANGED: "usual.event.hardware.usb.action.USB_PORT_CHANGED", - COMMON_EVENT_USB_DEVICE_ATTACHED: - "usual.event.hardware.usb.action.USB_DEVICE_ATTACHED", - COMMON_EVENT_USB_DEVICE_DETACHED: - "usual.event.hardware.usb.action.USB_DEVICE_DETACHED", - COMMON_EVENT_USB_ACCESSORY_ATTACHED: - "usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED", - COMMON_EVENT_USB_ACCESSORY_DETACHED: - "usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED", - COMMON_EVENT_DISK_REMOVED: "usual.event.data.DISK_REMOVED", - COMMON_EVENT_DISK_UNMOUNTED: "usual.event.data.DISK_UNMOUNTED", - COMMON_EVENT_DISK_MOUNTED: "usual.event.data.DISK_MOUNTED", - COMMON_EVENT_DISK_BAD_REMOVAL: "usual.event.data.DISK_BAD_REMOVAL", - COMMON_EVENT_DISK_UNMOUNTABLE: "usual.event.data.DISK_UNMOUNTABLE", - COMMON_EVENT_DISK_EJECT: "usual.event.data.DISK_EJECT", - COMMON_EVENT_VOLUME_REMOVED: "usual.event.data.VOLUME_REMOVED", - COMMON_EVENT_VOLUME_UNMOUNTED: "usual.event.data.VOLUME_UNMOUNTED", - COMMON_EVENT_VOLUME_MOUNTED: "usual.event.data.VOLUME_MOUNTED", - COMMON_EVENT_VOLUME_BAD_REMOVAL: "usual.event.data.VOLUME_BAD_REMOVAL", - COMMON_EVENT_VOLUME_EJECT: "usual.event.data.VOLUME_EJECT", - COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED: - "usual.event.data.VISIBLE_ACCOUNTS_UPDATED", - COMMON_EVENT_ACCOUNT_DELETED: "usual.event.data.ACCOUNT_DELETED", - COMMON_EVENT_FOUNDATION_READY: "common.event.FOUNDATION_READY", - COMMON_EVENT_AIRPLANE_MODE_CHANGED: "usual.event.AIRPLANE_MODE", - COMMON_EVENT_SPLIT_SCREEN: "common.event.SPLIT_SCREEN", - COMMON_EVENT_SLOT_CHANGE: "usual.event.SLOT_CHANGE", - COMMON_EVENT_SPN_INFO_CHANGED: "usual.event.SPN_INFO_CHANGED" -} -export function mockCommonEvent() { - const commonEvent = { - publish: function (...args) { - console.warn('commonEvent.publish 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); - } - }, - publishAsUser: function (...args) { - console.warn('commonEvent.publishAsUser 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); - } - }, - createSubscriber: function (...args) { - console.warn('commonEvent.createSubscriber 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, CommonEventSubscriber); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscriber); - }); - } - }, - subscribe: function (...args) { - console.warn('commonEvent.subscribe 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, CommonEventData); - } - }, - unsubscribe: function (...args) { - console.warn('commonEvent.unsubscribe 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); - } - }, - Support - } - return commonEvent -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_configPolicy.js b/runtime/main/extend/systemplugin/napi/ohos_configPolicy.js deleted file mode 100644 index d2088ac2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_configPolicy.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 mockConfigPolicy() { - const configPolicy = { - getOneCfgFile: function (...args) { - console.warn("configPolicy.getOneCfgFile 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getCfgFiles: function (...args) { - console.warn("configPolicy.getCfgFiles 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getCfgDirList: function (...args) { - console.warn("configPolicy.getCfgDirList 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - } - } - return configPolicy -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_contact.js b/runtime/main/extend/systemplugin/napi/ohos_contact.js deleted file mode 100644 index ed8ca6d9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_contact.js +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (c) 2021 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 mockContact() { - const ContactClass = class Contact { - constructor() { - console.warn('contact.Contact.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.id = "[PC Preview] unknow id"; - this.key = "[PC Preview] unknow key"; - this.contactAttributes = "[PC Preview] unknow contactAttributes"; - this.emails = "[PC Preview] unknow emails"; - this.events = "[PC Preview] unknow events"; - this.groups = "[PC Preview] unknow groups"; - this.imAddresses = "[PC Preview] unknow imAddresses"; - this.phoneNumbers = "[PC Preview] unknow phoneNumbers"; - this.portrait = "[PC Preview] unknow portrait"; - this.postalAddresses = "[PC Preview] unknow postalAddresses"; - this.relations = "[PC Preview] unknow relations"; - this.sipAddresses = "[PC Preview] unknow sipAddresses"; - this.websites = "[PC Preview] unknow websites"; - this.name = "[PC Preview] unknow name"; - this.nickName = "[PC Preview] unknow nickName"; - this.note = "[PC Preview] unknow note"; - this.organization = "[PC Preview] unknow organization"; - } - } - ContactClass.INVALID_CONTACT_ID = -1; - - const ContactAttributesClass = class ContactAttributes { - constructor() { - console.warn('contact.ContactAttributes.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.attributes = ["[PC Preview] unknow Attribute"] - } - } - const EmailClass = class Email { - constructor() { - console.warn('contact.Email.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.EMAIL_HOME = 1; - this.EMAIL_WORK = 2; - this.EMAIL_OTHER = 3; - this.INVALID_LABEL_ID = -1; - this.email = "[PC Preview] unknow email"; - this.labelName = "[PC Preview] unknow labelName"; - this.displayName = "[PC Preview] unknow displayName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const EventClass = class Event { - constructor() { - console.warn('contact.Event.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.EVENT_ANNIVERSARY = 1; - this.EVENT_OTHER = 2; - this.EVENT_BIRTHDAY = 3; - this.INVALID_LABEL_ID = -1; - this.eventDate = "[PC Preview] unknow eventDate"; - this.labelName = "[PC Preview] unknow labelName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const GroupClass = class Group { - constructor() { - console.warn('contact.Group.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.groupId = "[PC Preview] unknow groupId"; - this.title = "[PC Preview] unknow title"; - } - } - const HolderClass = class Holder { - constructor() { - console.warn('contact.Holder.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.bundleName = "[PC Preview] unknow bundleName"; - this.displayName = "[PC Preview] unknow displayName"; - this.holderId = "[PC Preview] unknow holderId"; - } - } - const ImAddressClass = class ImAddress { - constructor() { - console.warn('contact.ImAddress.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = -1; - this.IM_AIM = 0; - this.IM_MSN = 1; - this.IM_YAHOO = 2; - this.IM_SKYPE = 3; - this.IM_QQ = 4; - this.IM_ICQ = 6; - this.IM_JABBER = 7; - this.INVALID_LABEL_ID = -2; - this.imAddress = "[PC Preview] unknow imAddress"; - this.labelName = "[PC Preview] unknow labelName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const NameClass = class Name { - constructor() { - console.warn('contact.Name.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.familyName = "[PC Preview] unknow familyName"; - this.familyNamePhonetic = "[PC Preview] unknow familyNamePhonetic"; - this.fullName = "[PC Preview] unknow fullName"; - this.givenName = "[PC Preview] unknow givenName"; - this.givenNamePhonetic = "[PC Preview] unknow givenNamePhonetic"; - this.middleNamePhonetic = "[PC Preview] unknow middleNamePhonetic"; - this.namePrefix = "[PC Preview] unknow namePrefix"; - this.nameSuffix = "[PC Preview] unknow nameSuffix"; - this.middleName = "[PC Preview] unknow middleName"; - } - } - const NickNameClass = class NickName { - constructor() { - console.warn('contact.NickName.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.nickName = "[PC Preview] unknow nickName"; - } - } - const NoteClass = class Note { - constructor() { - console.warn('contact.Note.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.noteContent = "[PC Preview] unknow noteContent"; - } - } - const OrganizationClass = class Organization { - constructor() { - console.warn('contact.Organization.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.name = "[PC Preview] unknow name"; - this.title = "[PC Preview] unknow title"; - } - } - const PhoneNumberClass = class PhoneNumber { - constructor() { - console.warn('contact.PhoneNumber.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.NUM_HOME = 1; - this.NUM_MOBILE = 2; - this.NUM_WORK = 3; - this.NUM_FAX_WORK = 4; - this.NUM_FAX_HOME = 5; - this.NUM_PAGER = 6; - this.NUM_OTHER = 7; - this.NUM_CALLBACK = 8; - this.NUM_CAR = 9; - this.NUM_COMPANY_MAIN = 10; - this.NUM_ISDN = 11; - this.NUM_MAIN = 12; - this.NUM_OTHER_FAX = 13; - this.NUM_RADIO = 14; - this.NUM_TELEX = 15; - this.NUM_TTY_TDD = 16; - this.NUM_WORK_MOBILE = 17; - this.NUM_WORK_PAGER = 18; - this.NUM_ASSISTANT = 19; - this.NUM_MMS = 20; - this.INVALID_LABEL_ID = -1; - this.phoneNumber = "[PC Preview] unknow phoneNumber"; - this.labelName = "[PC Preview] unknow labelName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const PortraitClass = class Portrait { - constructor() { - console.warn('contact.Portrait.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.uri = "[PC Preview] unknow uri"; - } - } - const PostalAddressClass = class PostalAddress { - constructor() { - console.warn('contact.PostalAddress.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.ADDR_HOME = 1; - this.ADDR_WORK = 2; - this.ADDR_OTHER = 3; - this.INVALID_LABEL_ID = -1; - this.city = "[PC Preview] unknow city"; - this.country = "[PC Preview] unknow country"; - this.labelName = "[PC Preview] unknow labelName"; - this.neighborhood = "[PC Preview] unknow neighborhood"; - this.pobox = "[PC Preview] unknow pobox"; - this.postalAddress = "[PC Preview] unknow postalAddress"; - this.postcode = "[PC Preview] unknow postcode"; - this.region = "[PC Preview] unknow region"; - this.street = "[PC Preview] unknow street"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const RelationClass = class Relation { - constructor() { - console.warn('contact.Relation.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.RELATION_ASSISTANT = 1; - this.RELATION_BROTHER = 2; - this.RELATION_CHILD = 3; - this.RELATION_DOMESTIC_PARTNER = 4; - this.RELATION_FATHER = 5; - this.RELATION_FRIEND = 6; - this.RELATION_MANAGER = 7; - this.RELATION_MOTHER = 8; - this.RELATION_PARENT = 9; - this.RELATION_PARTNER = 10; - this.RELATION_REFERRED_BY = 11; - this.RELATION_RELATIVE = 12; - this.RELATION_SISTER = 13; - this.RELATION_SPOUSE = 14; - this.INVALID_LABEL_ID = -1; - this.relationName = "[PC Preview] unknow relationName"; - this.labelName = "[PC Preview] unknow labelName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const SipAddressClass = class SipAddress { - constructor() { - console.warn('contact.SipAddress.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.CUSTOM_LABEL = 0; - this.SIP_HOME = 1; - this.SIP_WORK = 2; - this.SIP_OTHER = 3; - this.INVALID_LABEL_ID = -1; - this.sipAddress = "[PC Preview] unknow sipAddress"; - this.labelName = "[PC Preview] unknow labelName"; - this.labelId = "[PC Preview] unknow labelId"; - } - } - const WebsiteClass = class Website { - constructor() { - console.warn('contact.Website.constructor interface mocked in the Previewer. How this interface' + - ' works on the Previewer may be different from that on a real device.'); - this.website = "[PC Preview] unknow website"; - } - } - const contact = { - Contact: ContactClass, - ContactAttributes: ContactAttributesClass, - Email: EmailClass, - Event: EventClass, - Group: GroupClass, - Holder: HolderClass, - ImAddress: ImAddressClass, - Name: NameClass, - NickName: NickNameClass, - Note: NoteClass, - Organization: OrganizationClass, - PhoneNumber: PhoneNumberClass, - Portrait: PortraitClass, - PostalAddress: PostalAddressClass, - Relation: RelationClass, - SipAddress: SipAddressClass, - Website: WebsiteClass, - Attribute:{ - ATTR_CONTACT_EVENT: "[PC Preview] unknow ATTR_CONTACT_EVENT", - ATTR_EMAIL: "[PC Preview] unknow ATTR_EMAIL", - ATTR_GROUP_MEMBERSHIP: "[PC Preview] unknow ATTR_GROUP_MEMBERSHIP", - ATTR_IM: "[PC Preview] unknow ATTR_IM", - ATTR_NAME: "[PC Preview] unknow ATTR_NAME", - ATTR_NICKNAME: "[PC Preview] unknow ATTR_NICKNAME", - ATTR_NOTE: "[PC Preview] unknow ATTR_NOTE", - ATTR_ORGANIZATION: "[PC Preview] unknow ATTR_ORGANIZATION", - ATTR_PHONE: "[PC Preview] unknow ATTR_PHONE", - ATTR_PORTRAIT: "[PC Preview] unknow ATTR_PORTRAIT", - ATTR_POSTAL_ADDRESS: "[PC Preview] unknow ATTR_POSTAL_ADDRESS", - ATTR_RELATION: "[PC Preview] unknow ATTR_RELATION", - ATTR_SIP_ADDRESS: "[PC Preview] unknow ATTR_SIP_ADDRESS", - ATTR_WEBSITE: "[PC Preview] unknow ATTR_WEBSITE", - }, - addContact: function (...args) { - console.warn("contact.addContact 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }); - } - }, - selectContact: function (...args) { - console.warn("contact.selectContact interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new ContactClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - deleteContact: function (...args) { - console.warn("contact.deleteContact 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - queryContact: function (...args) { - console.warn("contact.queryContact 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, new ContactClass()) - } else { - return new Promise((resolve) => { - resolve(new ContactClass()) - }); - } - }, - queryContacts: function (...args) { - console.warn("contact.queryContacts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new ContactClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - queryContactsByEmail: function (...args) { - console.warn("contact.queryContactsByEmail interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new ContactClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - queryContactsByPhoneNumber: function (...args) { - console.warn("contact.queryContactsByPhoneNumber interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new ContactClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - queryGroups: function (...args) { - console.warn("contact.queryGroups interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new GroupClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - queryHolders: function (...args) { - console.warn("contact.queryHolders interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new HolderClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - queryKey: function (...args) { - console.warn("contact.queryKey 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) - }); - } - }, - queryMyCard: function (...args) { - console.warn("contact.queryMyCard interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(new ContactClass()); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - updateContact: function (...args) { - console.warn("contact.updateContact 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - isLocalContact: function (...args) { - console.warn("contact.isLocalContact 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) - }); - } - }, - isMyCard: function (...args) { - console.warn("contact.isMyCard 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) - }); - } - } - } - return contact -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_continuation_continuationManager.js b/runtime/main/extend/systemplugin/napi/ohos_continuation_continuationManager.js deleted file mode 100644 index d7b5acfe..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_continuation_continuationManager.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 mockContinationManager() { - const ContinuationMode = { - COLLABORATION_SINGLE: 0, - COLLABORATION_MULTIPLE: 1 - } - const ContinuationExtraParams = { - deviceType: [paramMock.paramStringMock], - targetBundle: '[PC preview] unknown targetBundle', - description: '[PC preview] unknown description', - filter: '[PC preview] unknown filter', - continuationMode: ContinuationMode, - authInfo: '[PC preview] unknown authInfo' - } - - const ContinuationResult = { - id: '[PC preview] unknown id', - type: '[PC preview] unknown type', - name: '[PC preview] unknown name' - } - - const continuationManager = { - ContinuationMode, - DeviceConnectState: { - IDLE: 0, - CONNECTING: 1, - CONNECTED: 2, - DISCONNECTING: 3 - }, - - on: function (...args) { - console.warn("continuationManager.on 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') { - if (args[0] == 'deviceConnect') { - args[len - 1].call(this, new Array(ContinuationResult)); - } else if (args[0] == 'deviceDisconnect') { - args[len - 1].call(this, new Array(paramMock.paramStringMock)); - } - } - }, - - off: function (...args) { - console.warn("continuationManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - - register: function (...args) { - console.warn("continuationManager.register 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - - unregister: function (...args) { - console.warn("continuationManager.unregister 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - - updateConnectStatus: function (...args) { - console.warn("continuationManager.updateConnectStatus 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - - startDeviceManager: function (...args) { - console.warn("continuationManager.startDeviceManager 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - - registerContinuation: function (...args) { - console.warn("continuationManager.registerContinuation 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - - unregisterContinuation: function (...args) { - console.warn("continuationManager.unregisterContinuation 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - - updateContinuationState: function (...args) { - console.warn("continuationManager.updateContinuationState 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - - startContinuationDeviceManager: function (...args) { - console.warn("continuationManager.startContinuationDeviceManager 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - } - return continuationManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_convertxml.js b/runtime/main/extend/systemplugin/napi/ohos_convertxml.js deleted file mode 100644 index 78c48f43..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_convertxml.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 mockConvertXml() { - const ConvertXMLClass = class ConvertXML { - constructor(...args) { - console.warn("convertXml.ConvertXML.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.convert = function (...args) { - console.warn("ConvertXML.convert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramObjectMock; - } - } - }; - - const ConvertXMLMock = { - ConvertXML : ConvertXMLClass - }; - - const ConvertOptionsMock = { - trim : '[PC preview] unknow trim', - ignoreDeclaration : '[PC preview] unknow ignoreDeclaration', - ignoreInstruction : '[PC preview] unknow ignoreInstruction', - ignoreAttributes : '[PC preview] unknow ignoreAttributes', - ignoreComment : '[PC preview] unknow ignoreComment', - ignoreCDATA : '[PC preview] unknow ignoreCDATA', - ignoreDoctype : '[PC preview] unknow ignoreDoctype', - ignoreText : '[PC preview] unknow ignoreText', - declarationKey : '[PC preview] unknow declarationKey', - instructionKey : '[PC preview] unknow instructionKey', - attributesKey : '[PC preview] unknow attributesKey', - textKey : '[PC preview] unknow textKey', - cdataKey : '[PC preview] unknow cdataKey', - doctypeKey : '[PC preview] unknow doctypeKey', - commentKey : '[PC preview] unknow commentKey', - parentKey : '[PC preview] unknow parentKey', - typeKey : '[PC preview] unknow typeKey', - nameKey : '[PC preview] unknow nameKey', - elementsKey : '[PC preview] unknow elementsKey' - }; - return ConvertXMLMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_DataShareResultSet.js b/runtime/main/extend/systemplugin/napi/ohos_data_DataShareResultSet.js deleted file mode 100644 index 26f86584..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_DataShareResultSet.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 DataType = { - TYPE_NULL: 0, - TYPE_LONG: 1, - TYPE_DOUBLE: 2, - TYPE_STRING: 3, - TYPE_BLOB: 4 -}; -export const DataShareResultSetMock = { - columnNames: "[PC Preview] unknow columnNames", - columnCount: "[PC Preview] unknow columnCount", - rowCount: "[PC Preview] unknow rowCount", - rowIndex: "[PC Preview] unknow rowIndex", - isEnded: "[PC Preview] unknow isEnded", - isStarted: "[PC Preview] unknow isStarted", - isClosed: "[PC Preview] unknow isClosed", - getColumnIndex: function (...args) { - console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getColumnName: function (...args) { - console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - goTo: function (...args) { - console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToRow: function (...args) { - console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToLastRow: function (...args) { - console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToFirstRow: function (...args) { - console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToNextRow: function (...args) { - console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - goToPreviousRow: function (...args) { - console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getBlob: function (...args) { - console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }, - getString: function (...args) { - console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getLong: function (...args) { - console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getDouble: function (...args) { - console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isColumnNull: function (...args) { - console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getDataType: function (...args) { - console.warn("ResultSet.getDataType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - close: function () { - console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } -} -export function DataShareResultSet() { - return DataShareResultSetMock -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_Storage.js b/runtime/main/extend/systemplugin/napi/ohos_data_Storage.js deleted file mode 100644 index 36977af0..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_Storage.js +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2021 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" - -const ValueTypes = '[PC Preview] unknow value type' - -const StorageObserver = { - key: '[PC Preview] unknown key' -}; -const MAX_KEY_LENGTH = 80; - -const MAX_VALUE_LENGTH = 8192; - -export function mockDataStorage() { - const storage = { - storageMock, - getStorageSync: function () { - console.warn("data.storage.getStorageSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storageMock - }, - getStorage: function (...args) { - console.warn("data.storage.getStorage 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, storageMock) - } else { - return new Promise((resolve) => { - resolve(storageMock) - }) - } - }, - deleteStorageSync: function () { - console.warn("data.storage.deleteStorageSync interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - }, - deleteStorage: function (...args) { - console.warn("data.storage.deleteStorage 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - removeStorageFromCacheSync: function () { - console.warn("data.storage.removeStorageFromCacheSync interface mocked in the Previewer. How this interface" + - " works on the Previewer may be different from that on a real device.") - }, - removeStorageFromCache: function (...args) { - console.warn("data.storage.removeStorageFromCache 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - } - } - const storageMock = { - getSync: function () { - console.warn("Storage.getSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return ValueTypes - }, - get: function (...args) { - console.warn("Storage.get 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, ValueTypes) - } else { - return new Promise((resolve) => { - resolve(ValueTypes) - }) - } - }, - hasSync: function () { - console.warn("Storage.hasSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - has: function (...args) { - console.warn("Storage.has 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) - }) - } - }, - putSync: function () { - console.warn("Storage.putSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - put: function (...args) { - console.warn("Storage.put 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - deleteSync: function () { - console.warn("Storage.deleteSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - delete: function (...args) { - console.warn("Storage.delete 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - clearSync: function () { - console.warn("Storage.clearSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - clear: function (...args) { - console.warn("Storage.clear 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - flushSync: function () { - console.warn("Storage.flushSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - flush: function (...args) { - console.warn("Storage.flush 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - on: function (...args) { - console.warn("Storage.on 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, StorageObserver) - }, - off: function (...args) { - console.warn("Storage.off 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, storageObserver) - } - } - return storage -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_dataAbility.js b/runtime/main/extend/systemplugin/napi/ohos_data_dataAbility.js deleted file mode 100644 index e3c87aba..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_dataAbility.js +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (c) 2021 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 RdbPredicatesClass = class RdbPredicates { - constructor(...args) { - console.warn('data.rdb.RdbPredicates.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.equalTo = function (...args) { - console.warn("RdbPredicates.equalTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.notEqualTo = function (...args) { - console.warn("RdbPredicates.notEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.beginWrap = function (...args) { - console.warn("RdbPredicates.beginWrap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.endWrap = function (...args) { - console.warn("RdbPredicates.endWrap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.or = function (...args) { - console.warn("RdbPredicates.or interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.and = function (...args) { - console.warn("RdbPredicates.and interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.contains = function (...args) { - console.warn("RdbPredicates.contains interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.beginsWith = function (...args) { - console.warn("RdbPredicates.beginsWith interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.endsWith = function (...args) { - console.warn("RdbPredicates.endsWith interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.isNull = function (...args) { - console.warn("RdbPredicates.isNull interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.isNotNull = function (...args) { - console.warn("RdbPredicates.isNotNull interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.like = function (...args) { - console.warn("RdbPredicates.like interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.glob = function (...args) { - console.warn("RdbPredicates.glob interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.between = function (...args) { - console.warn("RdbPredicates.between interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.notBetween = function (...args) { - console.warn("RdbPredicates.notBetween interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.greaterThan = function (...args) { - console.warn("RdbPredicates.greaterThan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.lessThan = function (...args) { - console.warn("RdbPredicates.lessThan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.greaterThanOrEqualTo = function (...args) { - console.warn("RdbPredicates.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.lessThanOrEqualTo = function (...args) { - console.warn("RdbPredicates.lessThanOrEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.orderByAsc = function (...args) { - console.warn("RdbPredicates.orderByAsc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.orderByDesc = function (...args) { - console.warn("RdbPredicates.orderByDesc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.distinct = function (...args) { - console.warn("RdbPredicates.distinct interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.limitAs = function (...args) { - console.warn("RdbPredicates.limitAs interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.offsetAs = function (...args) { - console.warn("RdbPredicates.offsetAs interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.groupBy = function (...args) { - console.warn("RdbPredicates.groupBy interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.indexedBy = function (...args) { - console.warn("RdbPredicates.indexedBy interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.in = function (...args) { - console.warn("RdbPredicates.in interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.notIn = function (...args) { - console.warn("RdbPredicates.notIn interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.inDevices = function (...args) { - console.warn("RdbPredicates.inDevices interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - this.inAllDevices = function (...args) { - console.warn("RdbPredicates.inAllDevices interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new RdbPredicatesClass(); - }; - } -}; - -export function mockDataAbility() { - const DataAbilityPredicatesClass = class DataAbilityPredicates { - constructor() { - console.warn('DataAbility.DataAbilityPredicates.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.equalTo = function (...args) { - console.warn('DataAbilityPredicates.equalTo interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.notEqualTo = function (...args) { - console.warn('DataAbilityPredicates.notEqualTo interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.beginWrap = function (...args) { - console.warn('DataAbilityPredicates.beginWrap interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.endWrap = function (...args) { - console.warn('DataAbilityPredicates.endWrap interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.or = function (...args) { - console.warn('DataAbilityPredicates.or interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.and = function (...args) { - console.warn('DataAbilityPredicates.and interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.contains = function (...args) { - console.warn('DataAbilityPredicates.contains interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.beginsWith = function (...args) { - console.warn('DataAbilityPredicates.beginsWith interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.endsWith = function (...args) { - console.warn('DataAbilityPredicates.endsWith interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.isNull = function (...args) { - console.warn('DataAbilityPredicates.isNull interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.isNotNull = function (...args) { - console.warn('DataAbilityPredicates.isNotNull interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.like = function (...args) { - console.warn('DataAbilityPredicates.like interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.glob = function (...args) { - console.warn('DataAbilityPredicates.glob interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.between = function (...args) { - console.warn('DataAbilityPredicates.between interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.notBetween = function (...args) { - console.warn('DataAbilityPredicates.notBetween interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.greaterThan = function (...args) { - console.warn('DataAbilityPredicates.greaterThan interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.lessThan = function (...args) { - console.warn('DataAbilityPredicates.lessThan interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.greaterThanOrEqualTo = function (...args) { - console.warn('DataAbilityPredicates.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.lessThanOrEqualTo = function (...args) { - console.warn('DataAbilityPredicates.lessThanOrEqualTo interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.orderByAsc = function (...args) { - console.warn('DataAbilityPredicates.orderByAsc interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.orderByDesc = function (...args) { - console.warn('DataAbilityPredicates.orderByDesc interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.distinct = function (...args) { - console.warn('DataAbilityPredicates.distinct interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.limitAs = function (...args) { - console.warn('DataAbilityPredicates.limitAs interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.offsetAs = function (...args) { - console.warn('DataAbilityPredicates.offsetAs interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.groupBy = function (...args) { - console.warn('DataAbilityPredicates.groupBy interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.indexedBy = function (...args) { - console.warn('DataAbilityPredicates.indexedBy interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.in = function (...args) { - console.warn('DataAbilityPredicates.in interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - this.notIn = function (...args) { - console.warn('DataAbilityPredicates.notIn interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return new DataAbilityPredicatesClass(); - }; - } - }; - const dataAbilityMock = { - createRdbPredicates: function (...args) { - console.warn('DataAbility.createRdbPredicates.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - return new RdbPredicatesClass(); - }, - DataAbilityPredicates: DataAbilityPredicatesClass - }; - return dataAbilityMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_dataShare.js b/runtime/main/extend/systemplugin/napi/ohos_data_dataShare.js deleted file mode 100644 index 12f50cb1..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_dataShare.js +++ /dev/null @@ -1,240 +0,0 @@ -/* - * 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 { DataShareResultSetMock } from "./ohos_data_DataShareResultSet" - - -export function mockDataShare() { - const getFileTypesArrayMock = [ - paramMock.paramStringMock - ] - const PacMapTypeMock = { - PacMap: new Map([["[PC Preview] unknow PacMapKey", "[PC Preview] unknow PacMapValue"]]) - } - const DataShareHelperMock = { - on: function (...args) { - console.warn("DataShareHelper.on 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) - } - }, - off: function (...args) { - console.warn("DataShareHelper.off 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) - } - }, - getType: function (...args) { - console.warn("DataShareHelper.getType 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getFileTypes: function (...args) { - console.warn("DataShareHelper.getFileTypes 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, getFileTypesArrayMock) - } else { - return new Promise((resolve, reject) => { - resolve(getFileTypesArrayMock); - }) - } - }, - normalizeUri: function (...args) { - console.warn("DataShareHelper.normalizeUri 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - denormalizeUri: function (...args) { - console.warn("DataShareHelper.denormalizeUri 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - notifyChange: function (...args) { - console.warn("DataShareHelper.notifyChange 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - insert: function (...args) { - console.warn("DataShareHelper.insert 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - batchInsert: function (...args) { - console.warn("DataShareHelper.batchInsert 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delete: function (...args) { - console.warn("DataShareHelper.delete 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - update: function (...args) { - console.warn("DataShareHelper.update 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - query: function (...args) { - console.warn("DataShareHelper.query 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, DataShareResultSetMock) - } else { - return new Promise((resolve, reject) => { - resolve(DataShareResultSetMock); - }) - } - }, - openFile: function (...args) { - console.warn("DataShareHelper.OpenFile 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - addTemplate: function (...args) { - console.warn("DataShareHelper.addTemplate 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - delTemplate: function (...args) { - console.warn("DataShareHelper.delTemplate 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - publish: function (...args) { - console.warn("DataShareHelper.publish 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPublishedData: function (...args) { - console.warn("DataShareHelper.getPublishedData 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const dataShareMock = { - createDataShareHelper: function (...args) { - console.warn("data.dataShare.createDataShareHelper 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, DataShareHelperMock) - } else { - return new Promise((resolve, reject) => { - resolve(DataShareHelperMock); - }) - } - } - } - return dataShareMock; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_dataSharePredicates.js b/runtime/main/extend/systemplugin/napi/ohos_data_dataSharePredicates.js deleted file mode 100644 index a803141b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_dataSharePredicates.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 mockDataSharePredicates() { - const DataSharePredicatesClass = class DataSharePredicates { - constructor() { - this.equalTo = function (...args) { - console.warn("DataSharePredicates.equalTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.notEqualTo = function (...args) { - console.warn("DataSharePredicates.notEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.beginWrap = function (...args) { - console.warn("DataSharePredicates.beginWrap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.endWrap = function (...args) { - console.warn("DataSharePredicates.endWrap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.or = function (...args) { - console.warn("DataSharePredicates.or interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.and = function (...args) { - console.warn("DataSharePredicates.and interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.contains = function (...args) { - console.warn("DataSharePredicates.contains interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.beginsWith = function (...args) { - console.warn("DataSharePredicates.beginsWith interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.endsWith = function (...args) { - console.warn("DataSharePredicates.endsWith interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.isNull = function (...args) { - console.warn("DataSharePredicates.isNull interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.isNotNull = function (...args) { - console.warn("DataSharePredicates.isNotNull interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.like = function (...args) { - console.warn("DataSharePredicates.like interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.unlike = function (...args) { - console.warn("DataSharePredicates.unlike interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.glob = function (...args) { - console.warn("DataSharePredicates.glob interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.between = function (...args) { - console.warn("DataSharePredicates.between interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.notBetween = function (...args) { - console.warn("DataSharePredicates.notBetween interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.greaterThan = function (...args) { - console.warn("DataSharePredicates.greaterThan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.lessThan = function (...args) { - console.warn("DataSharePredicates.lessThan interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.greaterThanOrEqualTo = function (...args) { - console.warn("DataSharePredicates.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.lessThanOrEqualTo = function (...args) { - console.warn("DataSharePredicates.lessThanOrEqualTo interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.orderByAsc = function (...args) { - console.warn("DataSharePredicates.orderByAsc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.orderByDesc = function (...args) { - console.warn("DataSharePredicates.orderByDesc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.distinct = function (...args) { - console.warn("DataSharePredicates.distinct interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.limit = function (...args) { - console.warn("DataSharePredicates.limit interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.groupBy = function (...args) { - console.warn("DataSharePredicates.groupBy interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.indexedBy = function (...args) { - console.warn("DataSharePredicates.indexedBy interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.in = function (...args) { - console.warn("DataSharePredicates.in interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.notIn = function (...args) { - console.warn("DataSharePredicates.notIn interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.prefixKey = function (...args) { - console.warn("DataSharePredicates.prefixKey interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - this.inKeys = function (...args) { - console.warn("DataSharePredicates.inKeys interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new DataSharePredicatesClass(); - }; - } - } - const dataSharePredicatesMock = { - DataSharePredicates: DataSharePredicatesClass - } - return dataSharePredicatesMock; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js deleted file mode 100644 index 39a43628..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js +++ /dev/null @@ -1,972 +0,0 @@ -/* - * Copyright (c) 2021 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 mockDistributedData() { - const SchemaClass = class Schema { - constructor() { - console.warn('Schema.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.toJsonString = function (...args) { - console.warn("Schema.toJsonString interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - } - } - }; - - const FieldNodeClass = class FieldNode { - constructor(...args) { - console.warn('FieldNode.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - - this.appendChild = function (...args) { - console.warn("FieldNode.appendChild interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - - this.toJson = function (...args) { - console.warn("FieldNode.toJson interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }; - } - }; - - const QueryClass = class Query { - constructor() { - console.warn('Query.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.reset = function (...args) { - console.warn("Query.reset interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.equalTo = function (...args) { - console.warn("Query.equalTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.notEqualTo = function (...args) { - console.warn("Query.notEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.greaterThan = function (...args) { - console.warn("Query.greaterThan interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.lessThan = function (...args) { - console.warn("Query.lessThan interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.greaterThanOrEqualTo = function (...args) { - console.warn("Query.greaterThanOrEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.lessThanOrEqualTo = function (...args) { - console.warn("Query.lessThanOrEqualTo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.isNull = function (...args) { - console.warn("Query.isNull interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.inNumber = function (...args) { - console.warn("Query.inNumber interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.inString = function (...args) { - console.warn("Query.inString interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.notInNumber = function (...args) { - console.warn("Query.notInNumber interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.notInString = function (...args) { - console.warn("Query.notInString interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.like = function (...args) { - console.warn("Query.like interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.unlike = function (...args) { - console.warn("Query.unlike interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.and = function (...args) { - console.warn("Query.and interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.or = function (...args) { - console.warn("Query.or interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.orderByAsc = function (...args) { - console.warn("Query.orderByAsc interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.orderByDesc = function (...args) { - console.warn("Query.orderByDesc interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.limit = function (...args) { - console.warn("Query.limit interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.isNotNull = function (...args) { - console.warn("Query.isNotNull interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.beginGroup = function (...args) { - console.warn("Query.beginGroup interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.endGroup = function (...args) { - console.warn("Query.endGroup interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.prefixKey = function (...args) { - console.warn("Query.prefixKey interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.setSuggestIndex = function (...args) { - console.warn("Query.setSuggestIndex interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.deviceId = function (...args) { - console.warn("Query.deviceId interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - - this.getSqlLike = function (...args) { - console.warn("Query.getSqlLike interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return QueryClass; - }; - } - }; - - const distributedDataMock = { - Schema: SchemaClass, - Query: QueryClass, - FieldNode: FieldNodeClass, - - KVStoreType: { - DEVICE_COLLABORATION: 0, - SINGLE_VERSION: 1, - MULTI_VERSION: 2, - }, - - SecurityLevel: { - NO_LEVEL: 0, - S0: 1, - S1: 2, - S2: 3, - S3: 5, - S4: 6, - }, - - SyncMode: { - PULL_ONLY: 0, - PUSH_ONLY: 1, - PUSH_PULL: 2, - }, - - SubscribeType: { - SUBSCRIBE_TYPE_LOCAL: 0, - SUBSCRIBE_TYPE_REMOTE: 1, - SUBSCRIBE_TYPE_ALL: 2, - }, - - createKVManager: function (...args) { - console.warn("distributedData.createKVManager 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, KVManager); - } else { - return new Promise((resolve, reject) => { - resolve(KVManager); - }) - } - } - }; - - const userTypeMock = { - SAME_USER_ID: "[PC Preview] unknown SAME_USER_ID" - }; - const userInfoMock = { - userId: "[PC Preview] unknown userId", - userType: "[PC Preview] unknown userType" - }; - const kvManagerConfigMock = { - userInfo: "[PC Preview] unknown userInfo", - bundleName: "[PC Preview] unknown bundleName", - context : "[PC Preview] unknown context" - }; - const constantsMock = { - MAX_KEY_LENGTH: "[PC Preview] unknown MAX_KEY_LENGTH", - MAX_VALUE_LENGTH: "[PC Preview] unknown MAX_VALUE_LENGTH", - MAX_KEY_LENGTH_DEVICE: "[PC Preview] unknown MAX_KEY_LENGTH_DEVICE", - MAX_STORE_ID_LENGTH: "[PC Preview] unknown MAX_STORE_ID_LENGTH", - MAX_QUERY_LENGTH: "[PC Preview] unknown MAX_QUERY_LENGTH", - MAX_BATCH_SIZE: "[PC Preview] unknown MAX_BATCH_SIZE" - }; - const schemaMock = { - root: "[PC Preview] unknown root", - indexes: "[PC Preview] unknown indexes", - mode: "[PC Preview] unknown mode", - skip: "[PC Preview] unknown skip" - }; - const fieldnodeMock = { - default: "[PC Preview] unknown default", - nullable: "[PC Preview] unknown nullable", - type: "[PC Preview] unknown type" - }; - const valueTypeMock = { - STRING: "[PC Preview] unknown STRING", - INTEGER: "[PC Preview] unknown INTEGER", - FLOAT: "[PC Preview] unknown FLOAT", - BYTE_ARRAY: "[PC Preview] unknown BYTE_ARRAY", - BOOLEAN: "[PC Preview] unknown BOOLEAN", - DOUBLE: "[PC Preview] unknown DOUBLE" - }; - const valueMock = { - type: valueTypeMock.STRING, - value: "[PC Preview] unknown value" - }; - const entryMock = { - key: "[PC Preview] unknown key", - value: valueMock - }; - const changeNotificationMock = { - insertEntries: new Array(entryMock), - updateEntries: new Array(entryMock), - deleteEntries: new Array(entryMock), - deviceId: "[PC Preview] unknown deviceId" - }; - const optionsMock = { - createIfMissing: "[PC Preview] unknown createIfMissing", - encrypt: "[PC Preview] unknown encrypt", - backup: "[PC Preview] unknown backup", - autoSync: "[PC Preview] unknown autoSync", - kvStoreType: "[PC Preview] unknown kvStoreType", - securityLevel: "[PC Preview] unknown securityLevel", - schema: "[PC Preview] unknown schema" - }; - - const KVStoreClass = class KVStore { - constructor() { - console.warn("KVStore.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - this.put = function (...args) { - console.warn("KVStore.put 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); - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.delete = function (...args) { - console.warn("KVStore.delete 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.setSyncRange = function (...args) { - console.warn("KVStore.setSyncRange 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.on = function (...args) { - console.warn("KVStore.on 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') { - if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } else if (args[0] === 'syncComplete') { - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - args[len - 1].call(this, array); - } - } - }; - - this.off = function (...args) { - console.warn("KVStore.off 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') { - if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } else if (args[0] === 'syncComplete') { - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - args[len - 1].call(this, array); - } - } - }; - - this.putBatch = function (...args) { - console.warn("KVStore.putBatch 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.deleteBatch = function (...args) { - console.warn("KVStore.deleteBatch 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.startTransaction = function (...args) { - console.warn("KVStore.startTransaction 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.commit = function (...args) { - console.warn("KVStore.commit 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.rollback = function (...args) { - console.warn("KVStore.rollback 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.enableSync = function (...args) { - console.warn("KVStore.enableSync 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.backup = function (...args) { - console.warn("KVStore.backup 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.restore = function (...args) { - console.warn("KVStore.restore 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.deleteBackup = function (...args) { - console.warn("KVStore.deleteBackup 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.paramArrayMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramArrayMock) - }) - } - }; - } - }; - - const SingleKVStoreClass = class SingleKVStore extends KVStoreClass { - constructor() { - super(); - console.warn("SingleKVStore.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - - this.put = function (...args) { - console.warn("SingleKVStore.put 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - - this.delete = function (...args) { - console.warn("SingleKVStore.delete 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - - this.on = function (...args) { - console.warn("SingleKVStore.on 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') { - if (args[0] === 'dataChange') { - args[len - 1].call(this, changeNotificationMock); - } else if (args[0] === 'syncComplete') { - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - args[len - 1].call(this, array); - } - } - }; - - this.off = function (...args) { - console.warn("SingleKVStore.off 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 - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }; - - this.sync = function (...args) { - console.warn("SingleKVStore.sync interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - - this.get = function (...args) { - console.warn("SingleKVStore.get 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 | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - }) - } - }; - - this.getResultSet = function (...args) { - console.warn("SingleKVStore.getResultSet 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, KVStoreResultSet) - } else { - return new Promise((resolve) => { - resolve(KVStoreResultSet) - }) - } - }; - - this.closeResultSet = function (...args) { - console.warn("SingleKVStore.closeResultSet 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.getResultSize = function (...args) { - console.warn("SingleKVStore.getResultSize 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }; - - this.getEntries = function (...args) { - console.warn("SingleKVStore.getEntries 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 - var array = new Array(entryMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }; - - this.removeDeviceData = function (...args) { - console.warn("SingleKVStore.removeDeviceData 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.setSyncParam = function (...args) { - console.warn("SingleKVStore.setSyncParam 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.getSecurityLevel = function (...args) { - console.warn("SingleKVStore.getSecurityLevel 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - } - }; - - const DeviceKVStoreClass = class DeviceKVStore extends KVStoreClass { - constructor() { - super(); - console.warn('DeviceKVStore.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - - this.get = function (...args) { - console.warn("DeviceKVStore.get 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 | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock | paramMock.paramStringMock | paramMock.paramNumberMock | paramMock.paramArrayMock) - }) - } - }; - - this.getEntries = function (...args) { - console.warn("DeviceKVStore.getEntries 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 - var array = new Array(entryMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }; - - this.getResultSet = function (...args) { - console.warn("DeviceKVStore.getResultSet 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, KVStoreResultSet) - } else { - return new Promise((resolve) => { - resolve(KVStoreResultSet) - }) - } - }; - - this.closeResultSet = function (...args) { - console.warn("DeviceKVStore.closeResultSet 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.getResultSize = function (...args) { - console.warn("DeviceKVStore.getResultSize 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }; - - this.removeDeviceData = function (...args) { - console.warn("DeviceKVStore.removeDeviceData 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }; - - this.sync = function (...args) { - console.warn("DeviceKVStore.sync interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }; - - this.on = function (...args) { - console.warn("DeviceKVStore.on 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 - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }; - - this.off = function (...args) { - console.warn("DeviceKVStore.off 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 - var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); - if (typeof args[len - 1] === 'function') { - if (args[0] == 'syncComplete') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else if (args[0] == 'dataChange') { - args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) - } - } - }; - } - }; - - const KVManager = { - getKVStore: function (...args) { - console.warn("KVManager.getKVStore 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 - var singleKVStoreClass = new SingleKVStoreClass - var deviceKVStoreClass = new DeviceKVStoreClass - if (len > 0 && typeof args[len - 1] === 'function') { - console.warn("getKVStore kvStoreType = " + args[1].kvStoreType); - if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { - args[len - 1].call(this, paramMock.businessErrorMock, deviceKVStoreClass); - } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { - args[len - 1].call(this, paramMock.businessErrorMock, singleKVStoreClass); - } - } else { - return new Promise((resolve) => { - if (args[1].kvStoreType == distributedDataMock.KVStoreType.DEVICE_COLLABORATION) { - resolve(deviceKVStoreClass); - } else if (args[1].kvStoreType == distributedDataMock.KVStoreType.SINGLE_VERSION) { - resolve(singleKVStoreClass); - } - }) - } - }, - - closeKVStore: function (...args) { - console.warn("KVManager.closeKVStore 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - deleteKVStore: function (...args) { - console.warn("KVManager.deleteKVStore 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - getAllKVStoreId: function (...args) { - console.warn("KVManager.getAllKVStoreId 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 - var array = new Array(paramMock.paramStringMock) - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }) - } - }, - - on: function (...args) { - console.warn("KVManager.on 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') { - if (args[0] == 'distributedDataServiceDie') { - args[len - 1].call(this, paramMock.businessErrorMock) - } - } - }, - - off: function (...args) { - console.warn("KVManager.off 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') { - if (args[0] == 'distributedDataServiceDie') { - args[len - 1].call(this, paramMock.businessErrorMock) - } - } - } - }; - - const KVStoreResultSet = { - getCount: function (...args) { - console.warn("KVStoreResultSet.getCount interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getPosition: function (...args) { - console.warn("KVStoreResultSet.getPosition interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - moveToFirst: function (...args) { - console.warn("KVStoreResultSet.moveToFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToLast: function (...args) { - console.warn("KVStoreResultSet.moveToLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToNext: function (...args) { - console.warn("KVStoreResultSet.moveToNext interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToPrevious: function (...args) { - console.warn("KVStoreResultSet.moveToPrevious interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - move: function (...args) { - console.warn("KVStoreResultSet.move interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - moveToPosition: function (...args) { - console.warn("KVStoreResultSet.moveToPosition interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isFirst: function (...args) { - console.warn("KVStoreResultSet.isFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isLast: function (...args) { - console.warn("KVStoreResultSet.isLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isBeforeFirst: function (...args) { - console.warn("KVStoreResultSet.isBeforeFirst interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isAfterLast: function (...args) { - console.warn("KVStoreResultSet.isAfterLast interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getEntry: function (...args) { - console.warn("KVStoreResultSet.getEntry interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return entryMock; - } - }; - - return distributedDataMock; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedDataObject.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedDataObject.js deleted file mode 100644 index c7eaccea..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedDataObject.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 mockDistributedObject() { - const DistributedObject = { - setSessionId: function (...args) { - console.warn("DistributedObject.setSessionId interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - on: function (...args) { - console.warn("DistributedObject.on interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - off: function (...args) { - console.warn("DistributedObject.off interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - save: function (...args) { - console.warn("DistributedObject.save 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, SaveSuccessResponse); - } else { - return new Promise((resolve, reject) => { - resolve(SaveSuccessResponse); - }) - } - }, - revokeSave: function (...args) { - console.warn("DistributedObject.revokeSave 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, RevokeSaveSuccessResponse); - } else { - return new Promise((resolve, reject) => { - resolve(RevokeSaveSuccessResponse); - }) - } - } - }; - const SaveSuccessResponse = { - sessionId: "[[PC Preview] unknow sessionId]", - version: "[[PC Preview] unknow version]", - deviceId: "[[PC Preview] unknow deviceId]" - }; - const RevokeSaveSuccessResponse = { - sessionId: "[[PC Preview] unknow sessionId]" - }; - const distributedDataObject = { - createDistributedObject: function (...args) { - console.warn("distributedObject.createDistributedObject interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device."); - return DistributedObject; - }, - genSessionId: function (...args) { - console.warn("distributedObject.genSessionId 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 distributedDataObject; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_deviceInfo.js b/runtime/main/extend/systemplugin/napi/ohos_deviceInfo.js deleted file mode 100644 index 71c08776..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_deviceInfo.js +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2021 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 mockDeviceInfo() { - const deviceInfo = { - deviceType: '[PC preview] unknow type', - manufacture: '[PC preview] unknow manufacture', - brand: '[PC preview] unknow brand', - marketName: '[PC preview] unknow market nanme', - productSeries: '[PC preview] unknow product series', - productModel: '[PC preview] unknow product model', - softwareModel: '[PC preview] unknow software model', - hardwareModel: '[PC preview] unknow hardware model', - hardwareProfile: '[PC preview] unknow hardware profile', - serial: '[PC preview] unknow serial', - udid: '[PC preview] unknow udid', - bootloaderVersion: '[PC preview] unknow bootloader version', - abiList: '[PC preview] unknow ablity list', - securityPatchTag: '[PC preview] unknow security patch tag', - displayVersion: '[PC preview] unknow display version', - incrementalVersion: '[PC preview] unknow incremental version', - osReleaseType: '[PC preview] unknow os release type', - osFullName: '[PC preview] unknow os full name', - majorVersion: '[PC preview] unknow security major version', - seniorVersion: '[PC preview] unknow senior version', - featureVersion: '[PC preview] unknow feature version', - buildVersion: '[PC preview] unknow build version', - sdkApiVersion: '[PC preview] unknow sdk api version', - firstApiVersion: '[PC preview] unknow first api version', - versionId: '[PC preview] unknow version id', - buildType: '[PC preview] unknow build type', - buildUser: '[PC preview] unknow build user', - buildHost: '[PC preview] unknow build host', - buildTime: '[PC preview] unknow build time', - buildRootHash: '[PC preview] unknow build root hash' - } - return deviceInfo -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_display.js b/runtime/main/extend/systemplugin/napi/ohos_display.js deleted file mode 100644 index c6ab2df2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_display.js +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2021-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" - -const DisplayState = { - STATE_UNKNOWN: 0, - STATE_OFF: 1, - STATE_ON: 2, - STATE_DOZE: 3, - STATE_DOZE_SUSPEND: 4, - STATE_VR: 5, - STATE_ON_SUSPEND: 6 -} -const DisplayType = { - add: 'add', - remove: 'remove', - change: 'change' -} - -export function mockDisplay() { - const Rect = { - left: '[PC preview] unknow left', - top: '[PC preview] unknow top', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - } - - const WaterfallDisplayAreaRects = { - left: Rect, - top: Rect, - width: Rect, - height: Rect - } - - const CutoutInfo = { - boundingRects: Array(Rect), - waterfallDisplayAreaRects: WaterfallDisplayAreaRects - } - - const Display = { - id: '[PC preview] unknow id', - name: '[PC preview] unknow name', - alive: '[PC preview] unknow alive', - state: DisplayState, - refreshRate: '[PC preview] unknow refreshRate', - rotation: '[PC preview] unknow rotation', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - densityDPI: '[PC preview] unknow densityDPI', - densityPixels: '[PC preview] unknow densityPixels', - scaledDensity: '[PC preview] unknow scaledDensity', - xDPI: '[PC preview] unknow xDPI', - yDPI: '[PC preview] unknow yDPI', - getCutoutInfo: function(...args) { - console.warn('Display.getCutoutInfo 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, CutoutInfo); - } else { - return new Promise((resolve) => { - resolve(CutoutInfo); - }); - } - } - } - - const display = { - getDefaultDisplay: function (...args) { - console.warn("Display.getDefaultDisplay 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, Display) - } else { - return new Promise((resolve, reject) => { - resolve(Display) - }) - } - }, - getDefaultDisplaySync: function (...args) { - console.warn("Display.getDefaultDisplay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return Display - }, - getAllDisplay: function (...args) { - console.warn("Display.getAllDisplay 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, [Display]) - } else { - return new Promise((resolve, reject) => { - resolve([Display]) - }) - } - }, - hasPrivateWindow: function (...args) { - console.warn("Display.hasPrivateWindow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - on: function (...args) { - console.warn("Display.on 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!==2){ - console.warn("Display.on:please check params !") - return - } - if (typeof args[len - 1] === 'function') { - if (args[0] === DisplayType.add|| args[0] === DisplayType.remove || args[0] === DisplayType.change){ - console.warn(`Display.on: you has registered ${args[0]} event.`) - } else { - console.warn("Display.on:please check first param!") - } - } else { - console.warn("Display.on:please check params, the second parma must be a function!") - } - }, - off: function (...args) { - console.warn("Display.off 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!==2){ - console.warn("Display.off:please check params!") - return - } - if (typeof args[len - 1] === 'function') { - if (args[0] === DisplayType.add|| args[0] === DisplayType.remove || args[0] === DisplayType.change){ - console.warn(`Display.off: you has registered ${args[0]} event`) - } else { - console.warn("Display.off:please check first param!") - } - } else { - console.warn("Display.off:please check params, the second parma must be a function!") - } - }, - DisplayState - } - return display -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedBundle.js b/runtime/main/extend/systemplugin/napi/ohos_distributedBundle.js deleted file mode 100755 index 30024336..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedBundle.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 mockDistributedBundle() { - const RemoteAbilityInfo = [ - { - 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", - }, - label: "[PC preview] unknown app label", - icon: "[PC preview] unknown icon", - }, - ] - - const DistributedBundle = { - getRemoteAbilityInfo: function (...args) { - console.warn("distributedBundle.getRemoteAbilityInfo 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, Array(RemoteAbilityInfo)) - } else { - return new Promise((resolve) => { - resolve(Array(RemoteAbilityInfo)) - }); - } - }, - getRemoteAbilityInfos: function (...args) { - console.warn("distributedBundle.getRemoteAbilityInfos 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, Array(RemoteAbilityInfo)) - } else { - return new Promise((resolve) => { - resolve(Array(RemoteAbilityInfo)) - }); - } - } - }; - return DistributedBundle; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js deleted file mode 100644 index 15f41509..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2021-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 mockDeviceManager() { - const DeviceType = { - UNKNOWN_TYPE: 0, - SPEAKER: 0x0A, - PHONE: 0x0E, - TABLET: 0x11, - WEARABLE: 0x6D, - CAR: 0x83, - TV: 0x9C - } - const DeviceStateChangeAction = { - ONLINE: 0, - READY: 1, - OFFLINE: 2, - CHANGE: 3 - } - const DiscoverMode = { - DISCOVER_MODE_PASSIVE: 0x55, - DISCOVER_MODE_ACTIVE: 0xAA - } - const ExchangeMedium = { - AUTO: 0, - BLE: 1, - COAP: 2, - USB: 3 - } - const ExchangeFreq = { - LOW: 0, - MID: 1, - HIGH: 2, - SUPER_HIGH: 3 - } - const SubscribeCap = { - SUBSCRIBE_CAPABILITY_DDMP: 0, - SUBSCRIBE_CAPABILITY_OSD: 1 - } - const deviceInfoMock = { - deviceId: "[PC Preview] unknow mDeviceId", - deviceName: "[PC Preview] unknow mDeviceName", - deviceType: DeviceType, - networkId: "[PC Preview] unknow mNetworkId", - range: "[PC Preview] unknow mRange" - } - const deviceStateChangeMock = { - action: 0, - device: deviceInfoMock - } - const SubscribeInfo = { - subscribeId: "[PC Preview] unknow mSubscribeId", - mode: DiscoverMode, - medium: ExchangeMedium, - freq: ExchangeFreq, - isSameAccount: "[PC Preview] unknow mIsSameAccount", - isWakeRemote: "[PC Preview] unknow mIsWakeRemote", - capability: SubscribeCap - } - const PublishInfo = { - publishId: "[PC Preview] unknow mPublishId", - mode: DiscoverMode, - freq: ExchangeFreq, - ranging : "[PC Preview] unknow mRanging" - } - const AuthParam = { - authType: "[PC Preview] unknow mAuthType", - extraInfo: {"key":"unknow any"} - } - const AuthInfo = { - authType: "[PC Preview] unknow mAuthType", - token: "[PC Preview] unknow mToken", - extraInfo: {"key":"unknow any"} - } - const deviceManagerMock = { - release: function () { - console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - getTrustedDeviceListSync: function () { - console.warn("DeviceManager.getTrustedDeviceListSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(deviceInfoMock); - return array; - }, - getTrustedDeviceList: function (...args) { - console.warn("DeviceManager.getTrustedDeviceList interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - var array = new Array(); - array.push(deviceInfoMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array); - } else { - return new Promise((resolve, reject) => { - resolve(array); - }) - } - }, - getLocalDeviceInfoSync: function () { - console.warn("DeviceManager.getLocalDeviceInfoSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return deviceInfoMock; - }, - getLocalDeviceInfo: function (...args) { - console.warn("DeviceManager.getLocalDeviceInfo 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, deviceInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(deviceInfoMock); - }) - } - }, - startDeviceDiscovery: function (...args) { - console.warn("DeviceManager.startDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stopDeviceDiscovery: function (...args) { - console.warn("DeviceManager.stopDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - publishDeviceDiscovery: function (...args) { - console.warn("DeviceManager.publishDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - unPublishDeviceDiscovery: function (...args) { - console.warn("DeviceManager.unPublishDeviceDiscovery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - authenticateDevice: function (...args) { - console.warn("DeviceManager.authenticateDevice 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, { - deviceId: "[PC Preview] unknow deviceId", - pinToken: "[PC Preview] unknow pinToken" - }); - } - }, - unAuthenticateDevice: function (...args) { - console.warn("DeviceManager.unAuthenticateDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - verifyAuthInfo: function (...args) { - console.warn("DeviceManager.verifyAuthInfo 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, { - deviceId: "[PC Preview] unknow deviceId", - level: "[PC Preview] unknow level" - }); - } - }, - on: function (...args) { - console.warn("DeviceManager.on 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') { - if (args[0] == 'deviceStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, deviceStateChangeMock); - } else if (args[0] == 'deviceFound') { - args[len - 1].call(this, paramMock.businessErrorMock, { - subscribeId: "[PC Preview] unknow subscribeId", - device: deviceInfoMock - }); - } else if (args[0] == 'discoverFail') { - args[len - 1].call(this, paramMock.businessErrorMock, { - subscribeId: "[PC Preview] unknow subscribeId", - reason: "[PC Preview] unknow reason" - }); - } else if (args[0] == 'publishSuccess') { - args[len - 1].call(this, paramMock.businessErrorMock, { - publishId: "[PC Preview] unknow publishId", - }); - } else if (args[0] == 'publishFail') { - args[len - 1].call(this, paramMock.businessErrorMock, { - publishId: "[PC Preview] unknow publishId", - reason: "[PC Preview] unknow reason" - }); - } else { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("DeviceManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - const deviceManager = { - DeviceType, - DeviceStateChangeAction, - DiscoverMode, - ExchangeMedium, - ExchangeFreq, - SubscribeCap, - SubscribeInfo, - PublishInfo, - AuthParam, - AuthInfo, - createDeviceManager: function (...args) { - console.warn("distributedHardware.deviceManager.createDeviceManager 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, deviceManagerMock) - } - } - } - return deviceManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedMissionManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedMissionManager.js deleted file mode 100755 index bad87d5e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedMissionManager.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 mockDistributedMissionManager() { - const distributedMissionManager = { - startSyncRemoteMissions: function (...args) { - console.warn('distributedMissionManager.startSyncRemoteMission 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - stopSyncRemoteMissions: function (...args) { - console.warn('distributedMissionManager.stopSyncRemoteMission 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - registerMissionListener: function (...args) { - console.warn('distributedMissionManager.registerMissionListener 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - unRegisterMissionListener: function (...args) { - console.warn('distributedMissionManager.unRegisterMissionListener 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - continueMission: function (...args) { - console.warn('distributedMissionManager.continueMission 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - } - } - return distributedMissionManager -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_document.js b/runtime/main/extend/systemplugin/napi/ohos_document.js deleted file mode 100644 index 4d1504c6..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_document.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2021 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 mockDocument() { - const document = { - create: function (...args) { - console.warn("document.create 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - choose: function (...args) { - console.warn("document.choose 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - show: function (...args) { - console.warn("document.show 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return document -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_enterpriseDeviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_enterpriseDeviceManager.js deleted file mode 100644 index 2e3cad6e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_enterpriseDeviceManager.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 mockEnterpriseDeviceManager() { - const EnterpriseInfoMock = { - name: "[PC preview] unknown name", - description: "[PC preview] unknown description", - } - - const DeviceSettingsManagerMock = { - setDateTime: function (...args) { - console.warn('DeviceSettingsManager.setDateTime 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - } - const enterpriseDeviceManager = { - AdminType: { - ADMIN_TYPE_NORMAL: 0, - ADMIN_TYPE_SUPER: 1, - }, - - enableAdmin: function (...args) { - console.warn("enterpriseDeviceManager.enableAdmin 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - disableAdmin: function (...args) { - console.warn("enterpriseDeviceManager.disableAdmin 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - disableSuperAdmin: function (...args) { - console.warn("enterpriseDeviceManager.disableSuperAdmin 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - isAdminEnabled: function (...args) { - console.warn("enterpriseDeviceManager.isAdminEnabled 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); - }) - } - }, - getEnterpriseInfo: function (...args) { - console.warn("enterpriseDeviceManager.getEnterpriseInfo 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, EnterpriseInfoMock); - } else { - return new Promise((resolve) => { - resolve(EnterpriseInfoMock); - }) - } - }, - setEnterpriseInfo: function (...args) { - console.warn("enterpriseDeviceManager.setEnterpriseInfo 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - isSuperAdmin: function (...args) { - console.warn("enterpriseDeviceManager.isSuperAdmin 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); - }) - } - }, - getDeviceSettingsManager: function (...args) { - console.warn("enterpriseDeviceManager.getDeviceSettingsManager 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, DeviceSettingsManagerMock); - } else { - return new Promise((resolve) => { - resolve(DeviceSettingsManagerMock); - }) - } - } - }; - return enterpriseDeviceManager; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_environment.js b/runtime/main/extend/systemplugin/napi/ohos_environment.js deleted file mode 100644 index e2671a3f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_environment.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2021 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 mockEnvironment() { - const environment = { - getStorageDataDir: function (...args) { - console.warn("environment.getStorageDataDir 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getUserDataDir: function (...args) { - console.warn("environment.getUserDataDir 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - return environment; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_events_emitter.js b/runtime/main/extend/systemplugin/napi/ohos_events_emitter.js deleted file mode 100644 index 0ef3f567..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_events_emitter.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021-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 EventPriority = { - IMMEDIATE: 0, - HIGH: 1, - LOW: 2, - IDLE: 3, -} -export const EventData = { - data: '[PC preview] unknow data', -} -export const InnerEvent = { - eventId: '[PC preview] unknow eventId', - priority: EventPriority, -} - -export function mockEmitter() { - const emitter = { - on: function (...args) { - console.warn("emitter.on 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, EventData); - } - }, - once: function (...args) { - console.warn("emitter.once 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, EventData); - } - }, - off: function (...args) { - console.warn("emitter.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - emit: function (...args) { - console.warn("emitter.emit interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }, - EventData, - InnerEvent, - EventPriority - } - return emitter -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_faultLogger.js b/runtime/main/extend/systemplugin/napi/ohos_faultLogger.js deleted file mode 100644 index b99ac3b4..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_faultLogger.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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" - -function buildMockInfo(interfaceName) { - return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device." -} - -export function mockFaultLogger() { - const FaultType = { - NO_SPECIFIC : 0, - CPP_CRASH : 2, - JS_CRASH : 3, - APP_FREEZE : 4 - } - const FaultLogInfo = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - type: FaultType, - timestamp: "[PC Preview] unknow timestamp", - reason: "[PC Preview] unknow reason", - module: "[PC Preview] unknow module", - summary: "[PC Preview] unknow summary", - fullLog: "[PC Preview] unknow fullLog", - } - const FaultLogger = { - FaultType, - FaultLogInfo, - querySelfFaultLog: function(...args) { - console.warn(buildMockInfo("FaultLogger.querySelfFaultLog")) - var array = new Array() - array.push(FaultLogInfo) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, array) - } else { - return new Promise((resolve) => { - resolve(array) - }); - } - }, - } - return FaultLogger -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_fileManager.js b/runtime/main/extend/systemplugin/napi/ohos_fileManager.js deleted file mode 100644 index d9fc9eb9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_fileManager.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2021-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 mockFileManager() { - const FileInfo = { - name: '[PC preview] unknow name', - path: '[PC preview] unknow path', - type: '[PC preview] unknow type', - size: '[PC preview] unknow size', - addedTime: '[PC preview] unknow addedTime', - modifiedTime: '[PC preview] unknow modifiedTime' - }; - const DevInfo = { - name: '[PC preview] unknow name' - }; - const filemanager = { - FileInfo: FileInfo, - DevInfo: DevInfo, - getRoot: function (...args) { - console.warn("filemanager.getRoot 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, new Array(FileInfo)) - } else { - return new Promise((resolve, reject) => { - resolve(new Array(FileInfo)); - }) - } - }, - listFile: function (...args) { - console.warn("filemanager.listFile 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, new Array(FileInfo)) - } else { - return new Promise((resolve, reject) => { - resolve(new Array(FileInfo)); - }) - } - }, - createFile: function (...args) { - console.warn("filemanager.createFile 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - return filemanager; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_fileio.js b/runtime/main/extend/systemplugin/napi/ohos_fileio.js deleted file mode 100644 index 840163b0..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_fileio.js +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (c) 2021 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 mockFileio() { - const StatMock = { - dev: '[PC preview] unknow dev', - ino: '[PC preview] unknow ino', - mode: '[PC preview] unknow mode', - nlink: '[PC preview] unknow nlink', - uid: '[PC preview] unknow uid', - gid: '[PC preview] unknow gid', - rdev: '[PC preview] unknow rdev', - size: '[PC preview] unknow size', - blocks: '[PC preview] unknow blocks', - atime: '[PC preview] unknow atime', - mtime: '[PC preview] unknow mtime', - ctime: '[PC preview] unknow ctime', - isBlockDevice: function () { - console.warn("Stat.isBlockDevice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isCharacterDevice: function () { - console.warn("Stat.isCharacterDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isDirectory: function () { - console.warn("Stat.isDirectory interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isFIFO: function () { - console.warn("Stat.isFIFO interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - return paramMock.paramBooleanMock - }, - isFile: function () { - console.warn("Stat.isFile interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSocket: function () { - console.warn("Stat.isSocket interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSymbolicLink: function () { - console.warn("Stat.isSymbolicLink interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - } - }; - const DirMock = { - close: function (...args) { - console.warn("Dir.close 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - closeSync: function (...args) { - console.warn("Dir.closeSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - read: function (...args) { - console.warn("Dir.read 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, DirentMock); - } else { - return new Promise((resolve, reject) => { - resolve(DirentMock); - }) - } - }, - readSync: function (...args) { - console.warn("Dir.readSync interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - return DirentMock - } - }; - const StreamMock = { - close: function (...args) { - console.warn("Stream.close 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - closeSync: function (...args) { - console.warn("Stream.closeSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - flush: function (...args) { - console.warn("Stream.flush 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - flushSync: function (...args) { - console.warn("Stream.flushSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - read: function (...args) { - console.warn("Stream.read 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, ReadOutMock) - } else { - return new Promise((resolve, reject) => { - resolve(ReadOutMock); - }) - } - }, - readSync: function (...args) { - console.warn("Stream.readSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock; - }, - write: function (...args) { - console.warn("Stream.write 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - writeSync: function (...args) { - console.warn("Stream.writeSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - } - }; - const DirentMock = { - name: "[PC Preview]: unknow name", - isBlockDevice: function () { - console.warn("Dirent.isBlockDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isCharacterDevice: function () { - console.warn("Dirent.isCharacterDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isDirectory: function () { - console.warn("Dirent.isDirectory interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isFIFO: function () { - console.warn("Dirent.isFIFO interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isFile: function () { - console.warn("Dirent.isFile interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSocket: function () { - console.warn("Dirent.isSocket interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock - }, - isSymbolicLink: function () { - console.warn("Dirent.isSymbolicLink interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - } - }; - const ReadOutMock = { - bytesRead: "[PC Preview]: unknow bytesRead", - offset: "[PC Preview]: unknow offset", - buffer: "[PC Preview]: unknow buffer" - }; - const WatcherMock = { - stop: function () { - console.warn("Watcher.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - }; - const fileioMock = { - Dir: DirMock, - Dirent: DirentMock, - Stat: StatMock, - Stream: StreamMock, - ReadOut: ReadOutMock, - Watcher: WatcherMock, - access: function (...args) { - console.warn("fileio.access 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - accessSync: function (...args) { - console.warn("fileio.accessSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - chmod: function (...args) { - console.warn("fileio.chmod 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - chmodSync: function (...args) { - console.warn("fileio.chmodSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - chown: function (...args) { - console.warn("fileio.chown 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - chownSync: function (...args) { - console.warn("fileio.chownSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - close: function (...args) { - console.warn("fileio.close 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - closeSync: function (...args) { - console.warn("fileio.closeSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - copyFile: function (...args) { - console.warn("fileio.copyFile 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - copyFileSync: function (...args) { - console.warn("fileio.copyFileSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - createStream: function (...args) { - console.warn("fileio.createStream 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, StreamMock) - } else { - return new Promise((resolve, reject) => { - resolve(StreamMock); - }) - } - }, - createStreamSync: function (...args) { - console.warn("fileio.createStreamSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return StreamMock; - }, - createWatcher: function (...args) { - console.warn("fileio.createWatcher 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.paramNumberMock) - } else { - return WatcherMock; - } - }, - fchmod: function (...args) { - console.warn("fileio.fchmod 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - fchmodSync: function (...args) { - console.warn("fileio.fchmodSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - fchown: function (...args) { - console.warn("fileio.fchown 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - fchownSync: function (...args) { - console.warn("fileio.fchownSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - fdatasync: function (...args) { - console.warn("fileio.fdatasync 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - fdatasyncSync: function (...args) { - console.warn("fileio.fdatasyncSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - fdopenStream: function (...args) { - console.warn("fileio.fdopenStream 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, StreamMock) - } else { - return new Promise((resolve, reject) => { - resolve(StreamMock); - }) - } - }, - fdopenStreamSync: function (...args) { - console.warn("fileio.fdopenStreamSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return StreamMock; - }, - fstat: function (...args) { - console.warn("fileio.fstat 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, StatMock) - } else { - return new Promise((resolve, reject) => { - resolve(StatMock); - }) - } - }, - fstatSync: function (...args) { - console.warn("fileio.fstatSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return StatMock; - }, - fsync: function (...args) { - console.warn("fileio.fsync 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - fsyncSync: function (...args) { - console.warn("fileio.fsyncSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - ftruncate: function (...args) { - console.warn("fileio.ftruncate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - ftruncateSync: function (...args) { - console.warn("fileio.ftruncateSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - hash: function (...args) { - console.warn("fileio.hash 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - lchown: function (...args) { - console.warn("fileio.lchown 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - lchownSync: function (...args) { - console.warn("fileio.lchownSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - lstat: function (...args) { - console.warn("fileio.lstat 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, StatMock) - } else { - return new Promise((resolve, reject) => { - resolve(StatMock); - }) - } - }, - lstatSync: function (...args) { - console.warn("fileio.lstatSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return StatMock; - }, - mkdir: function (...args) { - console.warn("fileio.mkdir 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - mkdirSync: function (...args) { - console.warn("fileio.mkdirSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - mkdtemp: function (...args) { - console.warn("fileio.mkdtemp 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - mkdtempSync: function (...args) { - console.warn("fileio.mkdtempSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - open: function (...args) { - console.warn("fileio.open 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - openSync: function (...args) { - console.warn("fileio.openSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock; - }, - opendir: function (...args) { - console.warn("fileio.opendir 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, DirMock) - } else { - return new Promise((resolve, reject) => { - resolve(DirMock); - }) - } - }, - opendirSync: function (...args) { - console.warn("fileio.opendirSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DirMock; - }, - read: function (...args) { - console.warn("fileio.read 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, ReadOutMock) - } else { - return new Promise((resolve, reject) => { - resolve(ReadOutMock); - }) - } - }, - readSync: function (...args) { - console.warn("fileio.readSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock; - }, - readText: function (...args) { - console.warn("fileio.readText 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - readTextSync: function (...args) { - console.warn("fileio.readTextSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - rename: function (...args) { - console.warn("fileio.rename 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - renameSync: function (...args) { - console.warn("fileio.renameSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - rmdir: function (...args) { - console.warn("fileio.rmdir 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - rmdirSync: function (...args) { - console.warn("fileio.rmdirSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - stat: function (...args) { - console.warn("fileio.stat 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, StatMock) - } else { - return new Promise((resolve, reject) => { - resolve(StatMock); - }) - } - }, - statSync: function (...args) { - console.warn("fileio.statSync interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return StatMock; - }, - symlink: function (...args) { - console.warn("fileio.symlink 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - symlinkSync: function (...args) { - console.warn("fileio.symlinkSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - truncate: function (...args) { - console.warn("fileio.truncate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - truncateSync: function (...args) { - console.warn("fileio.truncateSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - unlink: function (...args) { - console.warn("fileio.unlink 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - unlinkSync: function (...args) { - console.warn("fileio.unlinkSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - write: function (...args) { - console.warn("fileio.write 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - writeSync: function (...args) { - console.warn("fileio.writeSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - } - } - return fileioMock -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_geolocation.js b/runtime/main/extend/systemplugin/napi/ohos_geolocation.js deleted file mode 100644 index 011a3f7b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_geolocation.js +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2021 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 mockOhosGeolocation() { - const Location = { - latitude: '[PC preview] unknow latitude', - longitude: '[PC preview] unknow longitude', - altitude: '[PC preview] unknow altitude', - accuracy: '[PC preview] unknow accuracy', - speed: '[PC preview] unknow speed', - timeStamp: '[PC preview] unknow timeStamp', - direction: '[PC preview] unknow direction', - timeSinceBoot: '[PC preview] unknow timeSinceBoot', - additions: [paramMock.paramStringMock], - additionSize: '[PC preview] unknow additionSize', - } - const GeoAddress = { - latitude: '[PC preview] unknow latitude', - longitude: '[PC preview] unknow longitude', - locale: '[PC preview] unknow locale', - placeName: '[PC preview] unknow placeName', - countryCode: '[PC preview] unknow countryCode', - countryName: '[PC preview] unknow countryName', - administrativeArea: '[PC preview] unknow administrativeArea', - subAdministrativeArea: '[PC preview] unknow subAdministrativeArea', - locality: '[PC preview] unknow locality', - subLocality: '[PC preview] unknow subLocality', - roadName: '[PC preview] unknow roadName', - subRoadName: '[PC preview] unknow subRoadName', - premises: '[PC preview] unknow premises', - postalCode: '[PC preview] unknow postalCode', - phoneNumber: '[PC preview] unknow phoneNumber', - addressUrl: '[PC preview] unknow addressUrl', - descriptions: [paramMock.paramStringMock], - descriptionsSize: '[PC preview] unknow descriptionsSize', - } - const SatelliteStatusInfo = { - satellitesNumber: '[PC preview] unknow satellitesNumber', - satelliteIds: [paramMock.paramNumberMock], - carrierToNoiseDensitys: [paramMock.paramNumberMock], - altitudes: [paramMock.paramNumberMock], - azimuths: [paramMock.paramNumberMock], - carrierFrequencies: [paramMock.paramNumberMock], - } - const CountryCodeType = { - COUNTRY_CODE_FROM_LOCALE: 1, - COUNTRY_CODE_FROM_SIM: 2, - COUNTRY_CODE_FROM_LOCATION: 3, - COUNTRY_CODE_FROM_NETWORK: 4, - } - const CountryCode = { - country: '[PC preview] unknow country', - type: CountryCodeType, - } - const geolocation = { - on: function (...args) { - console.warn("geolocation.on 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') { - if (args[0] == 'locationChange') { - args[len - 1].call(this, Location); - } else if (args[0] == 'locationServiceState') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] == 'cachedGnssLocationsReporting') { - args[len - 1].call(this, [Location]); - } else if (args[0] == 'gnssStatusChange') { - args[len - 1].call(this, SatelliteStatusInfo); - } else if (args[0] == 'nmeaMessageChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } else if (args[0] == 'countryCodeChange') { - args[len - 1].call(this, CountryCode); - } - } - }, - off: function (...args) { - console.warn("geolocation.off 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') { - if (args[0] == 'locationChange') { - args[len - 1].call(this, Location); - } else if (args[0] == 'locationServiceState') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] == 'cachedGnssLocationsReporting') { - args[len - 1].call(this, [Location]); - } else if (args[0] == 'gnssStatusChange') { - args[len - 1].call(this, SatelliteStatusInfo); - } else if (args[0] == 'nmeaMessageChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } else if (args[0] == 'countryCodeChange') { - args[len - 1].call(this, CountryCode); - } - } - }, - getCurrentLocation: function (...args) { - console.warn("geolocation.getCurrentLocation 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, Location); - } else { - return new Promise((resolve) => { - resolve(Location); - }); - } - }, - getLastLocation: function (...args) { - console.warn("geolocation.getLastLocation 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, Location); - } else { - return new Promise((resolve) => { - resolve(Location); - }); - } - }, - isLocationEnabled: function (...args) { - console.warn("geolocation.isLocationEnabled 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); - }); - } - }, - requestEnableLocation: function (...args) { - console.warn("geolocation.requestEnableLocation 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); - }); - } - }, - enableLocation: function (...args) { - console.warn("geolocation.enableLocation 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); - }); - } - }, - disableLocation: function (...args) { - console.warn("geolocation.disableLocation 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); - }); - } - }, - getAddressesFromLocation: function (...args) { - console.warn("geolocation.getAddressesFromLocation 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, [GeoAddress]); - } else { - return new Promise((resolve) => { - resolve([GeoAddress]); - }); - } - }, - getAddressesFromLocationName: function (...args) { - console.warn("geolocation.getAddressesFromLocationName 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, [GeoAddress]); - } else { - return new Promise((resolve) => { - resolve([GeoAddress]); - }); - } - }, - isGeoServiceAvailable: function (...args) { - console.warn("geolocation.isGeoServiceAvailable 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); - }); - } - }, - getCachedGnssLocationsSize: function (...args) { - console.warn("geolocation.getCachedGnssLocationsSize 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - flushCachedGnssLocations: function (...args) { - console.warn("geolocation.flushCachedGnssLocations 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); - }); - } - }, - sendCommand: function (...args) { - console.warn("geolocation.sendCommand 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); - }); - } - }, - getCountryCode: function (...args) { - console.warn("geolocation.getCountryCode 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, CountryCode); - } else { - return new Promise((resolve) => { - resolve(CountryCode); - }); - } - }, - enableLocationMock: function (...args) { - console.warn("geolocation.enableLocationMock 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - disableLocationMock: function (...args) { - console.warn("geolocation.disableLocationMock 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setMockedLocations: function (...args) { - console.warn("geolocation.setMockedLocations 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - enableReverseGeocodingMock: function (...args) { - console.warn("geolocation.enableReverseGeocodingMock 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - disableReverseGeocodingMock: function (...args) { - console.warn("geolocation.disableReverseGeocodingMock 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setReverseGeocodingMockInfo: function (...args) { - console.warn("geolocation.setReverseGeocodingMockInfo 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isLocationPrivacyConfirmed: function (...args) { - console.warn("geolocation.isLocationPrivacyConfirmed 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); - }); - } - }, - setLocationPrivacyConfirmStatus: function (...args) { - console.warn("geolocation.setLocationPrivacyConfirmStatus 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); - }); - } - }, - } - return geolocation -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_hiAppEvent.js b/runtime/main/extend/systemplugin/napi/ohos_hiAppEvent.js deleted file mode 100644 index 6768fa91..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hiAppEvent.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2021 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" - -function buildMockInfo(interfaceName) { - return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."; -} - -const AppEventPackage = { - packageId: paramMock.paramNumberMock, - row: paramMock.paramNumberMock, - size: paramMock.paramNumberMock, - data: paramMock.paramArrayMock -} - -const AppEventPackageHolderClass = class AppEventPackageHolder { - constructor(...args) { - console.warn(buildMockInfo("AppEventPackageHolder.constructor")); - this.setSize = function (...arg) { - console.warn(buildMockInfo("AppEventPackageHolder.setSize")); - }; - this.takeNext = function (...arg) { - console.warn(buildMockInfo("AppEventPackageHolder.takeNext")); - return AppEventPackage; - }; - } -} - -export function mockHiAppEvent() { - const EventTypeMock = { - FAULT: paramMock.paramNumberMock, - STATISTIC: paramMock.paramNumberMock, - SECURITY: paramMock.paramNumberMock, - BEHAVIOR: paramMock.paramNumberMock - } - const EventMock = { - USER_LOGIN: paramMock.paramStringMock, - USER_LOGOUT: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_START: paramMock.paramStringMock - } - const ParamMock = { - USER_ID: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_NAME: paramMock.paramStringMock, - DISTRIBUTED_SERVICE_INSTANCE_ID: paramMock.paramStringMock - } - - const hiAppEvent = { - EventType: EventTypeMock, - Event: EventMock, - Param: ParamMock, - AppEventPackageHolder: AppEventPackageHolderClass, - write: function (...args) { - console.warn(buildMockInfo("hiAppEvent.write")) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - configure: function (...args) { - console.warn(buildMockInfo("hiAppEvent.configure")); - return paramMock.paramBooleanMock - }, - addWatcher: function (...args) { - console.warn(buildMockInfo("hiAppEvent.addWatcher")); - return new AppEventPackageHolderClass(); - }, - removeWatcher: function (...args) { - console.warn(buildMockInfo("hiAppEvent.removeWatcher")); - }, - clearData: function (...args) { - console.warn(buildMockInfo("hiAppEvent.clearData")); - } - } - return hiAppEvent -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_hiSysEvent.js b/runtime/main/extend/systemplugin/napi/ohos_hiSysEvent.js deleted file mode 100644 index 58003cfb..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hiSysEvent.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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" - -function buildMockInfo(interfaceName) { - return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device." -} - -export function mockHiSysEvent() { - const EventType = { - FAULT: 1, - STATISTIC: 2, - SECURITY: 3, - BEHAVIOR: 4 - } - const SysEventInfo = { - domain: paramMock.paramStringMock, - name: paramMock.paramStringMock, - eventType: EventType, - params: paramMock.paramObjectMock - } - const RuleType = { - WHOLE_WORD: 1, - PREFIX: 2, - REGULAR: 3 - } - const WatchRule = { - domain: paramMock.paramStringMock, - name: paramMock.paramStringMock, - tag: paramMock.paramStringMock, - ruleType: RuleType - } - const Watcher = { - rules: [WatchRule], - onEvent: function(...args) { - console.warn(buildMockInfo("hisysEvent.Watcher.onEvent")) - }, - onServiceDied: function(...args) { - console.warn(buildMockInfo("hisysEvent.Watcher.onServiceDied")) - } - } - const QueryArg = { - beginTime: paramMock.paramNumberMock, - endTime: paramMock.paramNumberMock, - maxEvents: paramMock.paramNumberMock - } - const QueryRule = { - domain: paramMock.paramStringMock, - names: [paramMock.paramStringMock] - } - const Querier = { - onQuery: function(...args) { - console.warn(buildMockInfo("hisysEvent.Querier.onQuery")) - }, - onComplete: function(...args) { - console.warn(buildMockInfo("hisysEvent.Querier.onComplete")) - } - } - const hiSysEvent = { - EventType, - SysEventInfo, - RuleType, - WatchRule, - Watcher, - QueryArg, - QueryRule, - Querier, - write: function (...args) { - console.warn(buildMockInfo("hiSysEvent.write")) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - addWatcher: function(...args) { - console.warn(buildMockInfo("hiSysEvent.addWatcher")) - return paramMock.paramNumberMock; - }, - removeWatcher: function(...args) { - console.warn(buildMockInfo("hiSysEvent.removeWatcher")) - return paramMock.paramNumberMock; - }, - query: function(...args) { - console.warn(buildMockInfo("hiSysEvent.query")) - return paramMock.paramNumberMock; - } - } - return hiSysEvent -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_hiTraceChain.js b/runtime/main/extend/systemplugin/napi/ohos_hiTraceChain.js deleted file mode 100644 index 84d5c6f3..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hiTraceChain.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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" - -function buildMockInfo(interfaceName) { - return interfaceName + " interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device." -} - -export function mockHiTraceChain() { - const HiTraceFlag = { - DEFAULT: 0, - INCLUDE_ASYNC: 1, - DONOT_CREATE_SPAN: 1 << 1, - TP_INFO: 1 << 2, - NO_BE_INFO: 1 << 3, - DISABLE_LOG: 1 << 4, - FAILURE_TRIGGER: 1 << 5, - D2D_TP_INFO: 1 << 6 - } - const HiTraceTracepointType = { - CS: 0, - CR: 1, - SS: 2, - SR: 3, - GENERAL: 4 - } - const HiTraceCommunicationMode = { - DEFAULT: 0, - THREAD: 1, - PROCESS: 2, - DEVICE: 3 - } - const HiTraceId = { - chainId: paramMock.paramNumberMock, - spanId: paramMock.paramNumberMock, - parentSpanId: paramMock.paramNumberMock, - flags: paramMock.paramNumberMock - } - const hiTraceChain = { - HiTraceFlag, - HiTraceTracepointType, - HiTraceCommunicationMode, - HiTraceId, - begin: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.begin")) - return HiTraceId; - }, - end: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.end")) - }, - getId: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.getId")) - return HiTraceId; - }, - setId: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.setId")) - }, - clearId: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.clearId")) - }, - createSpan: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.createSpan")) - return HiTraceId; - }, - tracepoint: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.tracepoint")) - }, - isValid: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.isValid")) - return paramMock.paramBooleanMock; - }, - isFlagEnabled: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.isFlagEnabled")) - return paramMock.paramBooleanMock; - }, - enableFlag: function(...arg) { - console.warn(buildMockInfo("hiTraceChain.enableFlag")) - }, - } - return hiTraceChain -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_hiTraceMeter.js b/runtime/main/extend/systemplugin/napi/ohos_hiTraceMeter.js deleted file mode 100644 index 715acafa..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hiTraceMeter.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 mockHiTraceMeter() { - const hitrace = { - startTrace: function (...args) { - console.warn("HiTraceMeter.startTrace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - finishTrace: function (...args) { - console.warn("HiTraceMeter.finishTrace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - traceByValue: function (...args) { - console.warn("HiTraceMeter.traceByValue interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - } - return hitrace; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_hichecker.js b/runtime/main/extend/systemplugin/napi/ohos_hichecker.js deleted file mode 100644 index 6d0af8e9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hichecker.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 mockHiChecker() { - const RULE_CAUTION_PRINT_LOG = paramMock.paramNumberMock; - const RULE_CAUTION_TRIGGER_CRASH = paramMock.paramNumberMock; - const RULE_THREAD_CHECK_SLOW_PROCESS = paramMock.paramNumberMock; - const RULE_CHECK_ABILITY_CONNECTION_LEAK = paramMock.paramNumberMock; - const hichecker = { - RULE_CAUTION_PRINT_LOG, - RULE_CAUTION_TRIGGER_CRASH, - RULE_THREAD_CHECK_SLOW_PROCESS, - RULE_CHECK_ABILITY_CONNECTION_LEAK, - addRule: function(...args) { - console.warn("hichecker.addRule interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - removeRule: function(...args) { - console.warn("hichecker.removeRule interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - getRule: function(...args) { - console.warn("hichecker.getRule interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - contains: function(...args) { - console.warn("hichecker.contains interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - } - return hichecker -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_hidebug.js b/runtime/main/extend/systemplugin/napi/ohos_hidebug.js deleted file mode 100644 index c1fd2a4a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hidebug.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 diff --git a/runtime/main/extend/systemplugin/napi/ohos_hilog.js b/runtime/main/extend/systemplugin/napi/ohos_hilog.js deleted file mode 100644 index c497b7e5..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_hilog.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2021 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 mockHilog() { - const hilog = { - LogLevel: { - DEBUG: 3, - INFO: 4, - WARN: 5, - ERROR: 6, - FATAL: 7 - }, - debug: function (...args) { - console.warn("hilog.debug interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - info: function (...args) { - console.warn("hilog.info interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - warn: function (...args) { - console.warn("hilog.warn interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - error: function (...args) { - console.warn("hilog.error interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - fatal: function (...args) { - console.warn("hilog.fatal interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isLoggable: function (...args) { - console.warn("hilog.isLoggable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - } - } - return hilog; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_i18n.js b/runtime/main/extend/systemplugin/napi/ohos_i18n.js deleted file mode 100644 index c76854bd..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_i18n.js +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2021 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 mockI18N() { - const i18n = { - getDisplayCountry: function(...args) { - console.warn("I18N.getDisplayCountry interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getDisplayLanguage: function(...args) { - console.warn("I18N.getDisplayLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getSystemLanguages: function() { - console.warn("I18N.getSystemLanguages interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); - }, - getSystemCountries: function(...args) { - console.warn("I18N.getSystemCountries interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); - }, - isSuggested: function(...args) { - console.warn("I18N.isSuggested interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSystemLanguage: function() { - console.warn("I18N.getSystemLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - setSystemLanguage: function(...args) { - console.warn("I18N.setSystemLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSystemRegion: function() { - console.warn("I18N.getSystemRegion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - setSystemRegion: function(...args) { - console.warn("I18N.setSystemRegion interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSystemLocale: function() { - console.warn("I18N.getSystemLocale interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - setSystemLocale: function(...args) { - console.warn("I18N.setSystemLocale interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getCalendar: function(...args) { - console.warn("I18N.getCalendar interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new CalendarClass(); - }, - isRTL: function(...args) { - console.warn("I18N.isRTL interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getLineInstance: function(...args) { - console.warn("I18N.getLineInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new BreakIteratorClass(); - }, - getTimeZone: function(...args) { - console.warn("I18N.getTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new TimeZoneClass(); - }, - getInstance: function() { - console.warn("I18N.IndexUtil.getInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new IndexUtilClass(); - }, - Character: CharacterClass, - is24HourClock: function() { - console.warn("I18N.is24HourClock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - set24HourClock: function(...args) { - console.warn("I18N.set24HourClock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - addPreferredLanguage: function(...args) { - console.warn("I18N.addPreferredLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - removePreferredLanguage: function(...args) { - console.warn("I18N.removePreferredLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getPreferredLanguageList: function() { - console.warn("I18N.getPreferredLanguageList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); - }, - getFirstPreferredLanguage: function() { - console.warn("I18N.getFirstPreferredLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - TimeZone: TimeZoneClass, - setUsingLocalDigit: function(...args) { - console.warn("I18N.setUsingLocalDigit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getUsingLocalDigit: function() { - console.warn("I18N.getUsingLocalDigit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - PhoneNumberFormat: PhoneNumberFormatClass, - Transliterator: TransliteratorClass, - getAppPreferredLanguage: function() { - console.warn("I18N.getAppPreferredLanguage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - } - const PhoneNumberFormatOptions = { - type: '[PC preview] unknow type', - } - const UnitInfo = { - unit: '[PC preview] unknow unit', - measureSystem: '[PC preview] unknow measureSystem', - } - return i18n; -} - -export const TimeZoneClass = class TimeZone{ - constructor() { - console.warn("I18N.TimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.getID = function() { - console.warn("I18N.TimeZone.getID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getDisplayName = function(...args) { - console.warn("I18N.TimeZone.getDisplayName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getRawOffset = function() { - console.warn("I18N.TimeZone.getRawOffset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getOffset = function(...args) { - console.warn("I18N.TimeZone.getOffset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - } -} -TimeZoneClass.getAvailableIDs = function() { - console.warn("I18N.TimeZone.getAvailableIDs interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); -}; -TimeZoneClass.getAvailableZoneCityIDs = function() { - console.warn("I18N.TimeZone.getAvailableZoneCityIDs interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); -}; -TimeZoneClass.getCityDisplayName = function(...args) { - console.warn("I18N.TimeZone.getCityDisplayName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; -}; -TimeZoneClass.getTimezoneFromCity = function(...args) { - console.warn("I18N.TimeZone.getTimezoneFromCity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new TimeZoneClass(); -}; -export const PhoneNumberFormatClass = class PhoneNumberFormat{ - constructor(...args) { - console.warn("I18N.PhoneNumberFormat.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.isValidNumber = function(...args) { - console.warn("I18N.PhoneNumberFormat.isValidNumber interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.format = function(...args) { - console.warn("I18N.PhoneNumberFormat.format interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getLocationName = function(...args) { - console.warn("I18N.PhoneNumberFormat.getLocationName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - } -} -export const TransliteratorClass = class Transliterator { - constructor() { - console.warn("I18N.Transliterator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.transform = function(...args) { - console.warn("I18N.Transliterator.transform interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - } -} -TransliteratorClass.getAvailableIDs = function() { - console.warn("I18N.Transliterator.getAvailableIDs interface mocked in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device.") - return new Array(paramMock.paramStringMock); -} -TransliteratorClass.getInstance = function(...args) { - console.warn("I18N.Transliterator.getInstance interface mocked in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device.") - return new TransliteratorClass(); -} -const IndexUtilClass = class IndexUtil { - constructor() { - console.warn("I18N.IndexUtil interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.getIndexList = function() { - console.warn("I18N.IndexUtil.getIndexList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return new Array(paramMock.paramStringMock); - }; - this.addLocale = function(...args) { - console.warn("I18N.IndexUtil.addLocale interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getIndex = function(...args) { - console.warn("I18N.IndexUtil.getIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - } -} -const BreakIteratorClass = class BreakIterator { - constructor() { - console.warn("I18N.BreakIterator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.current = function() { - console.warn("I18N.BreakIterator.current interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.first = function() { - console.warn("I18N.BreakIterator.first interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.last = function() { - console.warn("I18N.BreakIterator.last interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.next = function(...args) { - console.warn("I18N.BreakIterator.next interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.previous = function() { - console.warn("I18N.BreakIterator.previous interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.setLineBreakText = function() { - console.warn("I18N.BreakIterator.setLineBreakText interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.following = function() { - console.warn("I18N.BreakIterator.following interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getLineBreakText = function() { - console.warn("I18N.BreakIterator.getLineBreakText interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.isBoundary = function(...args) { - console.warn("I18N.BreakIterator.isBoundary interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - } -} -const CalendarClass = class Calendar { - constructor() { - console.warn("I18N.Calendar interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.setTime = function(...args) { - console.warn("I18N.Calendar.setTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.set = function(...args) { - console.warn("I18N.Calendar.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.setTimeZone = function(...args) { - console.warn("I18N.Calendar.setTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getTimeZone = function() { - console.warn("I18N.Calendar.getTimeZone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getFirstDayOfWeek = function() { - console.warn("I18N.Calendar.getFirstDayOfWeek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.setFirstDayOfWeek = function(...args) { - console.warn("I18N.Calendar.setFirstDayOfWeek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getMinimalDaysInFirstWeek = function() { - console.warn("I18N.Calendar.getMinimalDaysInFirstWeek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.setMinimalDaysInFirstWeek = function(...args) { - console.warn("I18N.Calendar.setMinimalDaysInFirstWeek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.get = function(...args) { - console.warn("I18N.Calendar.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getDisplayName = function(...args) { - console.warn("I18N.Calendar.getDisplayName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.isWeekend = function(...args) { - console.warn("I18N.Calendar.isWeekend interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - } -} -export const UtilClass = class Util { - constructor() { - console.warn("I18N.Util interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.unitConvert = function(...args) { - console.warn("I18N.Util.unitConvert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getDateOrder = function(...args) { - console.warn("I18N.Util.getDateOrder interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - } - } -} -export const CharacterClass = class Character { - constructor() { - console.warn("I18N.Character interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.isDigit = function(...args) { - console.warn("I18N.Character.isDigit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isSpaceChar = function(...args) { - console.warn("I18N.Character.isSpaceChar interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isWhitespace = function(...args) { - console.warn("I18N.Character.isWhitespace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isRTL = function(...args) { - console.warn("I18N.Character.isRTL interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isIdeograph = function(...args) { - console.warn("I18N.Character.isIdeograph interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isLetter = function(...args) { - console.warn("I18N.Character.isLetter interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isLowerCase = function(...args) { - console.warn("I18N.Character.isLowerCase interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.isUpperCase = function(...args) { - console.warn("I18N.Character.isUpperCase interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getType = function(...args) { - console.warn("I18N.Character.getType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js b/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js deleted file mode 100644 index 5ff426d6..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2021 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 mockInputMethod() { - const KeyboardType = { - labelId: 1, - iconId: 2, - language: "[PC Preview] unknow language", - inputSource: "[PC Preview] unknow inputSource", - customizedValue: { - key: 1 - }, - supportsAscii: true - } - const KeyboardTypeArry = [ - { - labelId: 1, - iconId: 2, - language: "[PC Preview] unknow language", - inputSource: "[PC Preview] unknow inputSource", - customizedValue: { - key: 1 - }, - supportsAscii: true - } - ] - const InputMethodProperty = { - packageName :"[PC Preview] unknow packageName", - methodId: "[PC Preview] unknow method id" - } - const InputMethodPropertyArry = [ - { - methodId: "[PC Preview] unknow method id", - bundleName: "[PC Preview] unknow bundle name", - abilityName: "[PC Preview] unknow ability name", - configurationPage: "[PC Preview] unknow configuration page", - isSystemIme: true, - typeCount: 1, - defaultImeId: 2, - keyboardTypes: KeyboardTypeArry - } - ] - const InputMethodControllerMock = { - stopInput: function (...args) { - console.warn("InputMethodController.stopInput 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - showSoftKeyboard: function (...args) { - console.warn("InputMethodController.showSoftKeyboard 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hideSoftKeyboard: function (...args) { - console.warn("InputMethodController.hideSoftKeyboard 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const InputMethodSettingMock = { - getCurrentKeyboardType: function (...args) { - console.warn("InputMethodSetting.getCurrentKeyboardType 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, KeyboardType); - } else { - return new Promise((resolve, reject) => { - resolve(KeyboardType); - }) - } - }, - listInputMethodEnabled: function (...args) { - console.warn("InputMethodSetting.listInputMethodEnabled 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, InputMethodPropertyArry); - } else { - return new Promise((resolve, reject) => { - resolve(InputMethodPropertyArry); - }) - } - }, - listKeyboardType: function (...args) { - console.warn("InputMethodSetting.listKeyboardType 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, KeyboardTypeArry); - } else { - return new Promise((resolve, reject) => { - resolve(KeyboardTypeArry); - }) - } - }, - listInputMethod: function (...args) { - console.warn("InputMethodSetting.listInputMethod 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, InputMethodPropertyArry); - } else { - return new Promise((resolve, reject) => { - resolve(InputMethodPropertyArry); - }) - } - }, - displayOptionalInputMethod: function (...args) { - console.warn("InputMethodSetting.displayOptionalInputMethod 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - const inputMethod = { - MAX_TYPE_NUM: 128, - getInputMethodController: function () { - console.warn("inputmethod.getInputMethodController interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return InputMethodControllerMock; - }, - getInputMethodSetting: function () { - console.warn("inputmethod.getInputMethodSetting interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return InputMethodSettingMock; - }, - getCurrentInputMethod: function () { - console.warn("inputmethod.getCurrentInputMethod interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return InputMethodProperty; - }, - switchInputMethod: function (...args) { - console.warn("inputMethod.switchInputMethod 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - } - return inputMethod -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_inputmethodengine.js b/runtime/main/extend/systemplugin/napi/ohos_inputmethodengine.js deleted file mode 100644 index 2151d800..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_inputmethodengine.js +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2021 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 mockInputMethodEngine() { - const EditingText = { - textContent: "[PC Preview] unknow textContent", - offset: 1, - changedStart: 2, - changedEnd: 3, - selectionStart: 4, - selectionEnd: 5, - additionalBitFlags: 6, - prompt: "[PC Preview] unknow prompt" - } - const EditingCapability = { - maxLines: 1, - maxChars: 2 - } - const EditorAttribute = { - inputPattern: 1, - enterKeyType: 2, - inputOption: 3 - } - const KeyEvent = { - keyCode: "[PC Preview] unknow keyCode", - keyAction: "[PC Preview] unknow keyAction" - } - const RichContent = { - contentURI: "[PC Preview] unknow contentURI", - linkURI: "[PC Preview] unknow linkURI", - mimeTypes: "[PC Preview] unknow mimeTypes", - detail: "[PC Preview] unknow detail" - } - const KeyboardControllerMock = { - setDisplayMode: function (...args) { - console.warn("KeyboardController.setDisplayMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getDisplayMode: function (...args) { - console.warn("KeyboardController.getDisplayMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hideKeyboard: function (...args) { - console.warn("KeyboardController.hideKeyboard 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - toNextInputMethod: function (...args) { - console.warn("KeyboardController.toNextInputMethod 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getScreenOrientation: function (...args) { - console.warn("KeyboardController.getScreenOrientation 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const TextInputClientMock = { - getEditorAttribute: function (...args) { - console.warn("TextInputClientMock.getEditorAttribute 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, EditorAttribute); - } else { - return new Promise((resolve, reject) => { - resolve(EditorAttribute); - }) - } - }, - insertText: function (...args) { - console.warn("TextInputClientMock.insertText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - insertRichContent: function (...args) { - console.warn("TextInputClientMock.insertRichContent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteBackward: function (...args) { - console.warn("TextInputClientMock.deleteBackward 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteForward: function (...args) { - console.warn("TextInputClientMock.deleteForward 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getForward: function (...args) { - console.warn("TextInputClientMock.getForward 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getBackward: function (...args) { - console.warn("TextInputClientMock.getBackward 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getEditingText: function (...args) { - console.warn("TextInputClientMock.getEditingText 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, EditingText); - } else { - return new Promise((resolve, reject) => { - resolve(EditingText); - }) - } - }, - sendKeyEvent: function (...args) { - console.warn("TextInputClientMock.sendKeyEvent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sendKeyFunction: function (...args) { - console.warn("TextInputClientMock.sendKeyFunction 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - selectText: function (...args) { - console.warn("TextInputClientMock.selectText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - requestCurrentCursorContext: function (...args) { - console.warn("TextInputClientMock.requestCurrentCursorContext 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAutoCapitalizeMode: function (...args) { - console.warn("TextInputClientMock.getAutoCapitalizeMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - reviseText: function (...args) { - console.warn("TextInputClientMock.reviseText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - markText: function (...args) { - console.warn("TextInputClientMock.markText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - unmarkText: function (...args) { - console.warn("TextInputClientMock.unmarkText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - replaceMarkedText: function (...args) { - console.warn("TextInputClientMock.replaceMarkedText 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - moveCursor: function (...args) { - console.warn("TextInputClientMock.moveCursor 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const InputMethodEngineMock = { - on: function (...args) { - console.warn("InputMethodEngine.on 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') { - if (args[0] == 'configurationUpdate') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'inputStart') { - args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); - } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { - args[len - 1].call(this); - } else if (args[0] == 'setCallingWindow') { - args[len - 1].call(this, paramMock.paramNumberMock); - } - } - }, - off: function (...args) { - console.warn("InputMethodEngine.off 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') { - if (args[0] == 'configurationUpdate') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'inputStart') { - args[len - 1].call(this, KeyboardControllerMock, TextInputClientMock); - } else if (args[0] == 'inputStop' || args[0] == 'keyboardShow' || args[0] == 'directionChange' || args[0] == 'keyboardHide') { - args[len - 1].call(this); - } else if (args[0] == 'setCallingWindow') { - args[len - 1].call(this, paramMock.paramNumberMock); - } - } - } - } - const KeyboardDelegateMock = { - on: function (...args) { - console.warn("KeyboardDelegate.on 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') { - if (args[0] == 'keyDown' || args[0] == 'keyUp') { - args[len - 1].call(this, KeyEvent); - } else if (args[0] == 'selectionChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'cursorContextChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'textChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } - } - }, - off: function (...args) { - console.warn("KeyboardDelegate.off 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') { - if (args[0] == 'keyDown' || args[0] == 'keyUp') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if (args[0] == 'selectionChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'cursorContextChange') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'textChange') { - args[len - 1].call(this, paramMock.paramStringMock); - } - } - }, - } - const inputMethodEngine = { - getInputMethodEngine: function () { - console.warn("inputMethodEngine.getInputMethodEngine interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return InputMethodEngineMock; - }, - createKeyboardDelegate: function () { - console.warn("inputMethodEngine.createKeyboardDelegate interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return KeyboardDelegateMock; - }, - ENTER_KEY_TYPE_UNSPECIFIED: "[PC Preview] unknow ENTER_KEY_TYPE_UNSPECIFIED", - ENTER_KEY_TYPE_GO: "[PC Preview] unknow ENTER_KEY_TYPE_GO", - ENTER_KEY_TYPE_SEARCH: "[PC Preview] unknow ENTER_KEY_TYPE_SEARCH", - ENTER_KEY_TYPE_SEND: "[PC Preview] unknow ENTER_KEY_TYPE_SEND", - ENTER_KEY_TYPE_NEXT: "[PC Preview] unknow ENTER_KEY_TYPE_NEXT", - ENTER_KEY_TYPE_DONE: "[PC Preview] unknow ENTER_KEY_TYPE_DONE", - ENTER_KEY_TYPE_PREVIOUS: "[PC Preview] unknow ENTER_KEY_TYPE_PREVIOUS", - PATTERN_NULL: "[PC Preview] unknow PATTERN_NULL", - PATTERN_TEXT: "[PC Preview] unknow PATTERN_TEXT", - PATTERN_NUMBER: "[PC Preview] unknow PATTERN_NUMBER", - PATTERN_PHONE: "[PC Preview] unknow PATTERN_PHONE", - PATTERN_DATETIME: "[PC Preview] unknow PATTERN_DATETIME", - PATTERN_EMAIL: "[PC Preview] unknow PATTERN_EMAIL", - PATTERN_URI: "[PC Preview] unknow PATTERN_URI", - PATTERN_PASSWORD: "[PC Preview] unknow PATTERN_PASSWORD", - FLAG_SELECTING: "[PC Preview] unknow FLAG_SELECTING", - FLAG_SINGLE_LINE: "[PC Preview] unknow FLAG_SINGLE_LINE", - DISPLAY_MODE_PART: "[PC Preview] unknow DISPLAY_MODE_PART", - DISPLAY_MODE_FULL: "[PC Preview] unknow DISPLAY_MODE_FULL", - OPTION_ASCII: "[PC Preview] unknow OPTION_ASCII", - OPTION_NONE: "[PC Preview] unknow OPTION_NONE", - OPTION_AUTO_CAP_CHARACTERS: "[PC Preview] unknow OPTION_AUTO_CAP_CHARACTERS", - OPTION_AUTO_CAP_SENTENCES: "[PC Preview] unknow OPTION_AUTO_CAP_SENTENCES", - OPTION_AUTO_WORDS: "[PC Preview] unknow OPTION_AUTO_WORDS", - OPTION_MULTI_LINE: "[PC Preview] unknow OPTION_MULTI_LINE", - OPTION_NO_FULLSCREEN: "[PC Preview] unknow OPTION_NO_FULLSCREEN", - CURSOR_UP: "[PC Preview] unknow CURSOR_UP", - CURSOR_DOWN: "[PC Preview] unknow CURSOR_UP", - CURSOR_LEFT: "[PC Preview] unknow CURSOR_UP", - CURSOR_RIGHT: "[PC Preview] unknow CURSOR_UP", - WINDOW_TYPE_INPUT_METHOD_FLOAT: "[PC Preview] unknow WINDOW_TYPE_INPUT_METHOD_FLOAT" - } - return inputMethodEngine -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensionability.js b/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensionability.js deleted file mode 100644 index fe915bd7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensionability.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { InputMethodExtensionContextClass } from "./ohos_inputmethodextensioncontext" - -export function mockInputMethodExtensionAbility() { - const InputMethodExtensionAbilityClass = class InputMethodExtensionAbility { - constructor() { - console.warn('InputMethodExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.context = new InputMethodExtensionContextClass(); - this.onCreate = function (...args) { - console.warn("InputMethodExtensionAbility.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.onDestroy = function () { - console.warn("InputMethodExtensionAbility.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - return new InputMethodExtensionAbilityClass(); -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensioncontext.js b/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensioncontext.js deleted file mode 100644 index 25bde6ca..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_inputmethodextensioncontext.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 { ExtensionContextClass } from "./application/ExtensionContext" - -export const InputMethodExtensionContextClass = class InputMethodExtensionContext extends ExtensionContextClass { - constructor() { - super(); - console.warn("InputMethodExtensionContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - this.startAbility = function (...args) { - console.warn("InputMethodExtensionContext.startAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - this.terminateSelf = function (...args) { - console.warn("InputMethodExtensionContext.terminateSelf 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }; - } -}; \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_intl.js b/runtime/main/extend/systemplugin/napi/ohos_intl.js deleted file mode 100644 index 69d80406..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_intl.js +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2021 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 mockIntl() { - const result = { - DateTimeFormat: function (...args) { - console.warn("Intl.DateTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return DateTimeFormatMock; - }, - NumberFormat: function (...args) { - console.warn("Intl.NumberFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return NumberFormatMock; - }, - Locale: function (locale) { - console.warn("Intl.Locale interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return LocaleMock; - }, - Collator: function (...args) { - console.warn("Intl.Collator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return CollatorMock; - }, - PluralRules: function (...args) { - console.warn("Intl.PluralRules interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PluralRulesMock; - }, - RelativeTimeFormat: function (...args) { - console.warn("Intl.RelativeTimeFormat interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return RelativeTimeFormatMock; - } - } - const DateTimeFormatMock = { - format: function (date) { - console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - formatRange: function (startDate, endDate) { - console.warn("Intl.DateTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - resolvedOptions: function () { - console.warn("Intl.DateTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return DateTimeOptionsMock; - } - } - const NumberFormatMock = { - format: function (number) { - console.warn("Intl.NumberFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - resolvedOptions: function () { - console.warn("Intl.NumberFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return NumberOptionsMock; - } - } - const LocaleMock = { - language: '[PC preview] unknow language', - script: '[PC preview] unknow script', - region: '[PC preview] unknow region', - baseName: '[PC preview] unknow baseName', - caseFirst: '[PC preview] unknow caseFirst', - calendar: '[PC preview] unknow calendar', - collation: '[PC preview] unknow collation', - hourCycle: '[PC preview] unknow hourCycle', - numberingSystem: '[PC preview] unknow numberingSystem', - numeric: '[PC preview] unknow numeric', - toString: function () { - console.warn("Intl.Locale.toString interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - maximize: function () { - console.warn("Intl.Locale.maximize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return LocaleMock; - }, - minimize: function () { - console.warn("Intl.Locale.minimize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return LocaleMock; - } - } - const CollatorMock = { - compare: function (firstString, secondString) { - console.warn("Intl.Collator.compare interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramNumberMock; - }, - resolvedOptions: function () { - console.warn("Intl.Collator.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return CollatorOptionsMock; - } - } - const PluralRulesMock = { - select: function (number) { - console.warn("Intl.PluralRules.select interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - } - } - const RelativeTimeFormatMock = { - format: function (value, unit) { - console.warn("Intl.RelativeTimeFormat.format interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock; - }, - formatToParts: function (value, unit) { - console.warn("Intl.RelativeTimeFormat.formatToParts interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramArrayMock; - }, - resolvedOptions: function () { - console.warn("Intl.RelativeTimeFormat.resolvedOptions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return RelativeTimeFormatResolvedOptionsMock; - } - } - const DateTimeOptionsMock = { - locale: '[PC preview] unknow locale', - dateStyle: '[PC preview] unknow dateStyle', - timeStyle: '[PC preview] unknow timeStyle', - hourCycle: '[PC preview] unknow hourCycle', - timeZone: '[PC preview] unknow timeZone', - numberingSystem: '[PC preview] unknow numberingSystem', - hour12: '[PC preview] unknow hour12', - weekday: '[PC preview] unknow weekday', - era: '[PC preview] unknow era', - year: '[PC preview] unknow year', - month: '[PC preview] unknow month', - day: '[PC preview] unknow day', - hour: '[PC preview] unknow hour', - minute: '[PC preview] unknow minute', - second: '[PC preview] unknow second', - timeZoneName: '[PC preview] unknow timeZoneName', - dayPeriod: '[PC preview] unknow dayPeriod', - localeMatcher: '[PC preview] unknow localeMatcher', - formatMatcher: '[PC preview] unknow formatMatcher', - } - const NumberOptionsMock = { - locale: '[PC preview] unknow locale', - currency: '[PC preview] unknow currency', - currencySign: '[PC preview] unknow currencySign', - currencyDisplay: '[PC preview] unknow currencyDisplay', - unit: '[PC preview] unknow unit', - unitDisplay: '[PC preview] unknow unitDisplay', - unitUsage: '[PC preview] unknow unitUsage', - signDisplay: '[PC preview] unknow signDisplay', - compactDisplay: '[PC preview] unknow compactDisplay', - notation: '[PC preview] unknow notation', - localeMatcher: '[PC preview] unknow localeMatcher', - style: '[PC preview] unknow style', - numberingSystem: '[PC preview] unknow numberingSystem', - useGrouping: '[PC preview] unknow useGrouping', - minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', - minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', - maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', - minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', - maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', - } - const CollatorOptionsMock = { - localeMatcher: '[PC preview] unknow localeMatcher', - usage: '[PC preview] unknow usage', - sensitivity: '[PC preview] unknow sensitivity', - ignorePunctuation: '[PC preview] unknow ignorePunctuation', - collation: '[PC preview] unknow collation', - numeric: '[PC preview] unknow numeric', - caseFirst: '[PC preview] unknow caseFirst', - } - const PluralRulesOptionsMock = { - localeMatcher: '[PC preview] unknow localeMatcher', - type: '[PC preview] unknow type', - minimumIntegerDigits: '[PC preview] unknow minimumIntegerDigits', - minimumFractionDigits: '[PC preview] unknow minimumFractionDigits', - maximumFractionDigits: '[PC preview] unknow maximumFractionDigits', - minimumSignificantDigits: '[PC preview] unknow minimumSignificantDigits', - maximumSignificantDigits: '[PC preview] unknow maximumSignificantDigits', - } - const RelativeTimeFormatResolvedOptions = { - locale: '[PC preview] unknow locale', - style: '[PC preview] unknow style', - numeric: '[PC preview] unknow numeric', - numberingSystem: '[PC preview] unknow numberingSystem', - } - const RelativeTimeFormatInputOptions = { - localeMatcher: '[PC preview] unknow localeMatcher', - numeric: '[PC preview] unknow numeric', - style: '[PC preview] unknow style', - } - const LocaleOptions = { - calendar: '[PC preview] unknow calendar', - collation: '[PC preview] unknow collation', - hourCycle: '[PC preview] unknow hourCycle', - numberingSystem: '[PC preview] unknow numberingSystem', - numeric: '[PC preview] unknow numeric', - caseFirst: '[PC preview] unknow caseFirst', - } - return result; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_audio.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_audio.js deleted file mode 100644 index 1e88d884..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_audio.js +++ /dev/null @@ -1,1043 +0,0 @@ -/* - * 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 mockMultimediaAudio() { - const interruptAction = { - actionType: audio.InterruptActionType, - type: audio.InterruptType, - hint: audio.InterruptHint, - activated: "[PC Preview] unknow activated", - } - const AudioDeviceDescriptor = { - deviceRole: audio.DeviceRole, - deviceType: audio.DeviceType, - id: "[PC Preview] unknow id", - name: "[PC Preview] unknow name", - address: "[PC Preview] unknow address", - sampleRates: [paramMock.paramNumberMock], - channelCounts: [paramMock.paramNumberMock], - channelMasks: [paramMock.paramNumberMock], - networkId: "[PC Preview] unknow networkId", - interruptGroupId: "[PC Preview] unknow interruptGroupId", - volumeGroupId: "[PC Preview] unknow volumeGroupId", - } - const DeviceChangeAction = { - type: audio.DeviceChangeType, - deviceDescriptors: AudioDeviceDescriptor, - } - const AudioRingMode = audio.AudioRingMode - const VolumeEvent = { - volumeType: audio.AudioVolumeType, - volume: "[PC Preview] unknow volume", - updateUi: "[PC Preview] unknow updateUi", - volumeGroupId: "[PC Preview] unknow volumeGroupId", - networkId: "[PC Preview] unknow networkId", - } - const AudioScene = '[PC Preview] unknow AudioScene' - const AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate, - channels: audio.AudioChannel, - sampleFormat: audio.AudioSampleFormat, - encodingType: audio.AudioEncodingType, - } - const AudioRendererInfo = { - content: audio.ContentType, - usage: audio.StreamUsage, - rendererFlags: "[PC Preview] unknow rendererFlags", - } - const AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo, - } - const AudioCapturerInfo = { - source: audio.SourceType, - capturerFlags: "[PC Preview] unknow capturerFlags", - } - const AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo, - } - const AudioRendererRate = audio.AudioRendererRate - const InterruptEvent = { - eventType: audio.InterruptType, - forceType: audio.InterruptForceType, - hintType: audio.InterruptHint, - } - const AudioInterrupt = { - streamUsage: audio.StreamUsage, - contentType: audio.ContentType, - pauseWhenDucked: "[PC Preview] unknow pauseWhenDucked", - } - const AudioRendererChangeInfo = { - streamId: "[PC Preview] unknow streamId", - clientUid: "[PC Preview] unknow clientUid", - rendererInfo: AudioRendererInfo, - rendererState: audio.AudioState, - deviceDescriptors: [AudioDeviceDescriptor], - } - const AudioCapturerChangeInfo = { - streamId: "[PC Preview] unknow streamId", - clientUid: "[PC Preview] unknow clientUid", - capturerInfo: AudioRendererInfo, - capturerState: audio.AudioState, - deviceDescriptors: [AudioDeviceDescriptor], - } - const AudioRendererFilter = { - uid: "[PC Preview] unknow uid", - rendererInfo: AudioRendererInfo, - rendererId: "[PC Preview] unknow rendererId", - } - const VolumeGroupInfo = { - networkId: "[PC Preview] unknow networkId", - groupId: "[PC Preview] unknow groupId", - mappingId: "[PC Preview] unknow mappingId", - groupName: "[PC Preview] unknow groupName", - type: audio.ConnectType, - } - const AudioCapturer = { - state: "[PC Preview] unknow state", - getCapturerInfo: function (...args) { - console.warn("AudioCapturer.getCapturerInfo 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, AudioCapturerInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioCapturerInfo); - }) - } - }, - getStreamInfo: function (...args) { - console.warn("AudioCapturer.getStreamInfo 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, AudioStreamInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioStreamInfo); - }) - } - }, - start: function (...args) { - console.warn("AudioCapturer.start 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - read: function (...args) { - console.warn("AudioCapturer.read 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getAudioTime: function (...args) { - console.warn("AudioCapturer.getAudioTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stop: function (...args) { - console.warn("AudioCapturer.stop 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - release: function (...args) { - console.warn("AudioCapturer.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getBufferSize: function (...args) { - console.warn("AudioCapturer.getBufferSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - on: function (...args) { - console.warn("AudioCapturer.on interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - off: function (...args) { - console.warn("AudioCapturer.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - } - const AudioRenderer = { - state: "[PC Preview] unknow state", - getRendererInfo: function (...args) { - console.warn("AudioRenderer.getRendererInfo 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, AudioRendererInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRendererInfo); - }) - } - }, - getStreamInfo: function (...args) { - console.warn("AudioRenderer.getStreamInfo 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, AudioStreamInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioStreamInfo); - }) - } - }, - start: function (...args) { - console.warn("AudioRenderer.start 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - write: function (...args) { - console.warn("AudioRenderer.write 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioTime: function (...args) { - console.warn("AudioRenderer.getAudioTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - drain: function (...args) { - console.warn("AudioRenderer.drain 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - pause: function (...args) { - console.warn("AudioRenderer.pause 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - stop: function (...args) { - console.warn("AudioRenderer.stop 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - release: function (...args) { - console.warn("AudioRenderer.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getBufferSize: function (...args) { - console.warn("AudioRenderer.getBufferSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setRenderRate: function (...args) { - console.warn("AudioRenderer.setRenderRate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getRenderRate: function (...args) { - console.warn("AudioRenderer.getRenderRate 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, AudioRendererRate); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRendererRate); - }) - } - }, - on: function (...args) { - console.warn("AudioRenderer.on interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - off: function (...args) { - console.warn("AudioRenderer.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - setInterruptMode: function (...args) { - console.warn("AudioRenderer.setInterruptMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const AudioManager = { - on: function (...args) { - console.warn("AudioManager.on 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') { - if (args[0] == 'interrupt') { - args[len - 1].call(this, interruptAction); - } else if (args[0] == 'deviceChange') { - args[len - 1].call(this, DeviceChangeAction); - } else if (args[0] == 'volumeChange') { - args[len - 1].call(this, VolumeEvent); - } else if (args[0] == 'ringerModeChange') { - args[len - 1].call(this, AudioRingMode); - } - } - }, - off: function (...args) { - console.warn("AudioManager.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - getDevices: function (...args) { - console.warn("AudioManager.getDevices interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - var AudioDeviceDescriptors = new Array(AudioDeviceDescriptor) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioDeviceDescriptors); - } else { - return new Promise((resolve, reject) => { - resolve(AudioDeviceDescriptors); - }) - } - }, - isDeviceActive: function (...args) { - console.warn("AudioManager.isDeviceActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDeviceActive: function (...args) { - console.warn("AudioManager.setDeviceActive 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setRingerMode: function (...args) { - console.warn("AudioManager.setRingerMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAudioParameter: function (...args) { - console.warn("AudioManager.setAudioParameter 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setVolume: function (...args) { - console.warn("AudioManager.setVolume 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getVolume: function (...args) { - console.warn("AudioManager.getVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinVolume: function (...args) { - console.warn("AudioManager.getMinVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMaxVolume: function (...args) { - console.warn("AudioManager.getMaxVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMute: function (...args) { - console.warn("AudioManager.isMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - mute: function (...args) { - console.warn("AudioManager.mute 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isActive: function (...args) { - console.warn("AudioManager.isActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isMicrophoneMute: function (...args) { - console.warn("AudioManager.isMicrophoneMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setMicrophoneMute: function (...args) { - console.warn("AudioManager.setMicrophoneMute 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAudioParameter: function (...args) { - console.warn("AudioManager.getAudioParameter 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getRingerMode: function (...args) { - console.warn("AudioManager.getRingerMode 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, AudioRingMode); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRingMode); - }) - } - }, - setAudioScene: function (...args) { - console.warn("AudioManager.setAudioScene 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAudioScene: function (...args) { - console.warn("AudioManager.getAudioScene 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, AudioScene); - } else { - return new Promise((resolve, reject) => { - resolve(AudioScene); - }) - } - }, - requestIndependentInterrupt: function (...args) { - console.warn("AudioManager.requestIndependentInterrupt 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - abandonIndependentInterrupt: function (...args) { - console.warn("AudioManager.abandonIndependentInterrupt 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getStreamManager: function (...args) { - console.warn("AudioManager.getStreamManager 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, AudioStreamManager); - } else { - return new Promise((resolve, reject) => { - resolve(AudioStreamManager); - }) - } - }, - getRoutingManager: function (...args) { - console.warn("AudioManager.getRoutingManager 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, AudioRoutingManager); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRoutingManager); - }) - } - }, - getVolumeGroups: function (...args) { - console.warn("AudioManager.getVolumeGroups interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - var VolumeGroupInfos = new Array(VolumeGroupInfo) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, VolumeGroupInfos); - } else { - return new Promise((resolve, reject) => { - resolve(VolumeGroupInfos); - }) - } - }, - getGroupManager: function (...args) { - console.warn("AudioManager.getGroupManager 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, AudioGroupManager); - } else { - return new Promise((resolve, reject) => { - resolve(AudioGroupManager); - }) - } - } - } - const AudioStreamManager = { - on: function (...args) { - const len = args.length - if (typeof args[len - 1] === 'function') { - if (args[0] == 'audioRendererChange') { - console.warn("AudioStreamManager.on_audioRendererChange interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - } else if (args[0] == 'audioCapturerChange') { - console.warn("AudioStreamManager.on_audioCapturerChange interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - } - } - }, - off: function (...args) { - console.warn("AudioStreamManager.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - getCurrentAudioRendererInfoArray: function (...args) { - console.warn("AudioStreamManager.getCurrentAudioRendererInfoArray interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - var AudioRendererChangeInfoArray = new Array(AudioRendererChangeInfo) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioRendererChangeInfoArray); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRendererChangeInfoArray); - }) - } - }, - getCurrentAudioCapturerInfoArray: function (...args) { - console.warn("AudioStreamManager.getCurrentAudioCapturerInfoArray interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - var AudioCapturerChangeInfoArray = new Array(AudioCapturerChangeInfo) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioCapturerChangeInfoArray); - } else { - return new Promise((resolve, reject) => { - resolve(AudioCapturerChangeInfoArray); - }) - } - } - } - const AudioRoutingManager = { - on: function (...args) { - console.warn("AudioRoutingManager.on_deviceChange 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') { - if (args[0] == 'deviceChange') { - args[len-1].call(this,DeviceChangeAction); - } - } - }, - off: function (...args) { - console.warn("AudioRoutingManager.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - if (typeof args[len - 1] === 'function') { - if (args[0] == 'deviceChange') { - args[len-1].call(this,DeviceChangeAction); - } - } - }, - getDevices: function (...args) { - console.warn("AudioRoutingManager.getDevices interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - var AudioDeviceDescriptors = new Array(AudioDeviceDescriptor) - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AudioDeviceDescriptors); - } else { - return new Promise((resolve, reject) => { - resolve(AudioDeviceDescriptors); - }) - } - }, - selectOutputDevice: function (...args) { - console.warn("AudioRoutingManager.selectOutputDevice interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - selectOutputDeviceByFilter: function (...args) { - console.warn("AudioRoutingManager.selectOutputDeviceByFilter interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const AudioGroupManager = { - setVolume: function (...args) { - console.warn("AudioGroupManager.setVolume 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getVolume: function (...args) { - console.warn("AudioGroupManager.getVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinVolume: function (...args) { - console.warn("AudioGroupManager.getMinVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMaxVolume: function (...args) { - console.warn("AudioGroupManager.getMaxVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMute: function (...args) { - console.warn("AudioGroupManager.isMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - mute: function (...args) { - console.warn("AudioGroupManager.mute 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - const audio = { - LOCAL_NETWORK_ID: "LocalDevice", - AudioState: { - STATE_INVALID: -1, - STATE_NEW: 0, - STATE_PREPARED: 1, - STATE_RUNNING: 2, - STATE_STOPPED: 3, - STATE_RELEASED:4, - STATE_PAUSED: 5, - }, - AudioVolumeType: { - VOICE_CALL: 0, - RINGTONE: 2, - MEDIA: 3, - VOICE_ASSISTANT: 9, - ALL:100 - }, - ContentType: { - CONTENT_TYPE_UNKNOWN: 0, - CONTENT_TYPE_SPEECH: 1, - CONTENT_TYPE_MUSIC: 2, - CONTENT_TYPE_MOVIE: 3, - CONTENT_TYPE_SONIFICATION: 4, - CONTENT_TYPE_RINGTONE: 5, - }, - StreamUsage: { - STREAM_USAGE_UNKNOWN: 0, - STREAM_USAGE_MEDIA: 1, - STREAM_USAGE_VOICE_COMMUNICATION: 2, - STREAM_USAGE_NOTIFICATION_RINGTONE: 6, - }, - DeviceFlag: { - OUTPUT_DEVICES_FLAG: 1, - INPUT_DEVICES_FLAG: 2, - ALL_DEVICES_FLAG: 3, - }, - ActiveDeviceType: { - SPEAKER: 2, - BLUETOOTH_SCO: 7, - }, - AudioRingMode: { - RINGER_MODE_NORMAL: 2, - RINGER_MODE_SILENT: 0, - RINGER_MODE_VIBRATE: 1, - }, - AudioSampleFormat: { - SAMPLE_FORMAT_INVALID: -1, - SAMPLE_FORMAT_U8: 0, - SAMPLE_FORMAT_S16LE: 1, - SAMPLE_FORMAT_S24LE: 2, - SAMPLE_FORMAT_S32LE: 3, - SAMPLE_FORMAT_F32LE: 4, - }, - AudioChannel: { - CHANNEL_1: 1, - CHANNEL_2: 2, - }, - AudioSamplingRate: { - SAMPLE_RATE_8000: 8000, - SAMPLE_RATE_11025: 11025, - SAMPLE_RATE_12000: 12000, - SAMPLE_RATE_16000: 16000, - SAMPLE_RATE_22050: 22050, - SAMPLE_RATE_24000: 24000, - SAMPLE_RATE_32000: 32000, - SAMPLE_RATE_44100: 44100, - SAMPLE_RATE_48000: 48000, - SAMPLE_RATE_64000: 64000, - SAMPLE_RATE_96000: 96000, - }, - AudioEncodingType: { - ENCODING_TYPE_INVALID: -1, - ENCODING_TYPE_RAW: 0, - }, - AudioRendererRate: { - RENDER_RATE_NORMAL: 0, - RENDER_RATE_DOUBLE: 1, - RENDER_RATE_HALF: 2, - }, - SourceType: { - SOURCE_TYPE_INVALID: -1, - SOURCE_TYPE_MIC: 0, - SOURCE_TYPE_VOICE_COMMUNICATION: 7, - }, - AudioScene: { - AUDIO_SCENE_DEFAULT: 0, - AUDIO_SCENE_RINGING: 1, - AUDIO_SCENE_PHONE_CALL: 2, - AUDIO_SCENE_VOICE_CHAT: 3, - }, - InterruptType: { - INTERRUPT_TYPE_BEGIN: 1, - INTERRUPT_TYPE_END: 2, - }, - InterruptForceType: { - INTERRUPT_FORCE: 0, - INTERRUPT_SHARE: 1, - }, - FocusType: { - FOCUS_TYPE_RECORDING: 0, - }, - InterruptMode: { - SHARE_MODE: 0, - INDEPENDENT_MODE: 1 - }, - DeviceRole: { - INPUT_DEVICE: 1, - OUTPUT_DEVICE: 2 - }, - DeviceType: { - INVALID: 0, - EARPIECE: 1, - SPEAKER: 2, - WIRED_HEADSET: 3, - WIRED_HEADPHONES: 4, - BLUETOOTH_SCO: 7, - BLUETOOTH_A2DP: 8, - MIC: 15, - USB_HEADSET: 22 - }, - InterruptHint: { - INTERRUPT_HINT_NONE: 0, - INTERRUPT_HINT_RESUME: 1, - INTERRUPT_HINT_PAUSE: 2, - INTERRUPT_HINT_STOP: 3, - INTERRUPT_HINT_DUCK: 4, - INTERRUPT_HINT_UNDUCK: 5 - }, - InterruptActionType: { - TYPE_ACTIVATED: 0, - TYPE_INTERRUPT: 1 - }, - DeviceChangeType: { - CONNECT: 0, - DISCONNECT: 1 - }, - ConnectType: { - CONNECT_TYPE_LOCAL: 1, - CONNECT_TYPE_DISTRIBUTED: 2 - }, - getAudioManager: function () { - console.warn("audio.getAudioManager interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return AudioManager; - }, - createAudioCapturer: function (...args) { - console.warn("audio.createAudioCapturer 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, AudioCapturer); - } else { - return new Promise((resolve, reject) => { - resolve(AudioCapturer); - }) - } - }, - createAudioRenderer: function (...args) { - console.warn("audio.createAudioRenderer 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, AudioRenderer); - } else { - return new Promise((resolve, reject) => { - resolve(AudioRenderer); - }) - } - } - } - return audio; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_av_session.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_av_session.js deleted file mode 100644 index 8cf529a9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_av_session.js +++ /dev/null @@ -1,436 +0,0 @@ -/* - * 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 mockMultimediaAVSession() { - const AVMetadata = { - assetId: "[PC Preview] unknow assetId", - title: "[PC Preview] unknow title", - artist: "[PC Preview] unknow artist", - author: "[PC Preview] unknow author", - album: "[PC Preview] unknow album", - writer: "[PC Preview] unknow writer", - composer: "[PC Preview] unknow composer", - duration: "[PC Preview] unknow duration", - mediaImage: "[PC Preview] unknow mediaImage", - publishDate: "[PC Preview] unknow publishDate", - subtitle: "[PC Preview] unknow subtitle", - description: "[PC Preview] unknow description", - lyric: "[PC Preview] unknow lyric", - previousAssetId: "[PC Preview] unknow previousAssetId", - nextAssetId: "[PC Preview] unknow nextAssetId" - } - - const AVPlaybackState = { - state: "[PC Preview] unknow state", - speed: "[PC Preview] unknow speed", - position: PlaybackPosition, - bufferedTime: "[PC Preview] unknow bufferedTime", - loopMode: "[PC Preview] unknow loopMode", - isFavorite: "[PC Preview] unknow isFavorite" - } - - const PlaybackPosition = { - elapsedTime: "[PC Preview] unknow elapsedTime", - updateTime: "[PC Preview] unknow updateTime" - } - - const OutputDeviceInfo = { - isRemote: "[PC Preview] unknow isRemote", - deviceId: [paramMock.paramStringMock], - deviceName: [paramMock.paramStringMock] - } - - const AVSessionDescriptor = { - sessionId: "[PC Preview] unknow sessionId", - type: "[PC Preview] unknow type", - sessionTag: "[PC Preview] unknow sessionTag", - elementName: "[PC Preview] unknow elementName", - isActive: "[PC Preview] unknow isActive", - isTopSession: "[PC Preview] unknow isTopSession", - outputDevice: - "[PC Preview] unknow outputDevice" - } - - const AVControlCommandType = ['play', 'pause', 'stop', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek', 'setSpeed', 'setLoopMode', 'toggleFavorite']; - - const AVSession = { - sessionId: "[PC Preview] unknow sessionId", - setAVMetadata: function (...args) { - console.warn("AVSession.setAVMetadata 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAVPlaybackState: function (...args) { - console.warn("AVSession.setAVPlaybackState 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setLaunchAbility: function (...args) { - console.warn("AVSession.setLaunchAbility 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAudioStreamId: function (...args) { - console.warn("AVSession.setAudioStreamId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getController: function (...args) { - console.warn("AVSession.getController 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, AVSessionController); - } else { - return new Promise((resolve, reject) => { - resolve(AVSessionController); - }) - } - }, - getOutputDevice: function (...args) { - console.warn("AVSession.getOutputDevice 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, OutputDeviceInfo); - } else { - return new Promise((resolve, reject) => { - resolve(OutputDeviceInfo); - }) - } - }, - on: function (...args) { - console.warn("AVSession.on 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 (args[0] == 'play' || args[0] == 'pause' ||args[0] == 'stop' ||args[0] == 'playNext' - ||args[0] == 'playPrevious' ||args[0] == 'fastForward' ||args[0] == 'rewind') { - args[len - 1].call(this); - } else if(args[0] == 'seek' || args[0] == 'setSpeed') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else if(args[0] == 'setLoopMode') { - var loopMode = "[PC Preview] unknow LoopMode"; - args[len - 1].call(this, loopMode); - } else if(args[0] == 'toggleFavorite') { - args[len - 1].call(this, paramMock.paramStringMock); - } else if(args[0] == 'handleKeyEvent') { - args[len - 1].call(this, paramMock.paramObjectMock); - } else if(args[0] == 'outputDeviceChanged') { - args[len - 1].call(this, OutputDeviceInfo); - } - }, - off: function (...args) { - console.warn("AVSession.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - activate: function (...args) { - console.warn("AVSession.activate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deactivate: function (...args) { - console.warn("AVSession.deactivate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - destroy: function (...args) { - console.warn("AVSession.destroy 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - - const AVSessionController = { - sessionId: "[PC Preview] unknow sessionId", - getAVPlaybackState: function (...args) { - console.warn("AVSessionController.getAVPlaybackState 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, AVPlaybackState); - } else { - return new Promise((resolve, reject) => { - resolve(AVPlaybackState); - }) - } - }, - getAVMetadata: function (...args) { - console.warn("AVSessionController.getAVMetadata 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, AVMetadata); - } else { - return new Promise((resolve, reject) => { - resolve(AVMetadata); - }) - } - }, - getOutputDevice: function (...args) { - console.warn("AVSessionController.getOutputDevice 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, OutputDeviceInfo); - } else { - return new Promise((resolve, reject) => { - resolve(OutputDeviceInfo); - }) - } - }, - sendAVKeyEvent: function (...args) { - console.warn("AVSessionController.sendAVKeyEvent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getLaunchAbility: function (...args) { - console.warn("AVSessionController.getLaunchAbility 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - getRealPlaybackPositionSync: function (...args) { - console.warn("AVSessionController.getRealPlaybackPositionSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isActive: function (...args) { - console.warn("AVSessionController.isActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - destroy: function (...args) { - console.warn("AVSessionController.destroy 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getValidCommands: function (...args) { - console.warn("AVSessionController.getValidCommands 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, AVControlCommandType); - } else { - return new Promise((resolve, reject) => { - resolve(AVControlCommandType); - }) - } - }, - sendControlCommand: function (...args) { - console.warn("AVSessionController.sendControlCommand 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("AVSessionController.on 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 (args[0] == 'metadataChanged') { - args[len-1].call(this, AVMetadata); - } else if (args[0] == 'playbackStateChanged') { - args[len-1].call(this, AVPlaybackState); - } else if (args[0] == 'sessionDestroyed') { - args[len-1].call(this); - } else if (args[0] == 'activeStateChanged') { - args[len-1].call(this, paramMock.paramBooleanMock); - } else if (args[0] == 'validCommandChanged') { - args[len-1].call(this, AVControlCommandType); - } else if (args[0] == 'outputDeviceChanged') { - args[len-1].call(this, OutputDeviceInfo); - } - }, - off: function (...args) { - console.warn("AVSessionController.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } - - const avsession = { - createAVSession: function (...args) { - console.warn("AVSession.createAVSession 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, AVSession); - } else { - return new Promise((resolve, reject) => { - resolve(AVSession); - }) - } - - }, - getAllSessionDescriptors: function (...args) { - console.warn("AVSession.getAllSessionDescriptors 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 - var desArr = Array(AVSessionDescriptor); - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, desArr); - } else { - return new Promise((resolve, reject) => { - resolve(desArr); - }) - } - }, - createController: function (...args) { - console.warn("AVSession.createController 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, AVSessionController); - } else { - return new Promise((resolve, reject) => { - resolve(AVSessionController); - }) - } - }, - castAudio: function (...args) { - console.warn("AVSession.castAudio 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("AVSession.on 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 (args[0] == 'sessionCreated' || args[0] == 'sessionDestroyed' || args[0] == 'topSessionChanged') { - args[len - 1].call(this, AVSessionDescriptor); - } else if (args[0] == 'sessionServiceDied') { - args[len - 1].call(this); - } - }, - off: function (...args) { - console.warn("AVSession.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - sendSystemAVKeyEvent: function (...args) { - console.warn("AVSession.sendSystemAVKeyEvent 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sendSystemControlCommand: function (...args) { - console.warn("AVSession.sendSystemControlCommand 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return avsession -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_camera.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_camera.js deleted file mode 100644 index 1c906517..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_camera.js +++ /dev/null @@ -1,625 +0,0 @@ -/* - * 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 mockMultimediaCamera() { - const Camera = { - cameraId: '[PC preview] unknow pid', - cameraPosition: CameraPosition, - cameraType: CameraType, - connectionType: ConnectionType - } - const multimediaCameraMock = { - getCameraManager: function (...args) { - console.warn('camera.getCameraManager 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, CameraManager); - } else { - return new Promise((resolve) => { - resolve(CameraManager); - }); - } - }, - createCaptureSession: function (...args) { - console.warn('camera.createCaptureSession 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, CaptureSession); - } else { - return new Promise((resolve) => { - resolve(CaptureSession); - }); - } - }, - createPreviewOutput: function (...args) { - console.warn('camera.createPreviewOutput 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, PreviewOutput); - } else { - return new Promise((resolve) => { - resolve(PreviewOutput); - }); - } - }, - createPhotoOutput: function (...args) { - console.warn('camera.createPhotoOutput 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, PhotoOutput); - } else { - return new Promise((resolve) => { - resolve(PhotoOutput); - }); - } - }, - createVideoOutput: function (...args) { - console.warn('camera.createVideoOutput 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, VideoOutput); - } else { - return new Promise((resolve) => { - resolve(VideoOutput); - }); - } - }, - } - const CameraStatus = { - CAMERA_STATUS_APPEAR: 0, - CAMERA_STATUS_DISAPPEAR: 1, - CAMERA_STATUS_AVAILABLE: 2, - CAMERA_STATUS_UNAVAILABLE: 3 - } - const CameraStatusInfo = { - camera: Camera, - status: CameraStatus - } - const CameraManager = { - getCameras: function (...args) { - console.warn('CameraManager.getCameras 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, [Camera]); - } else { - return new Promise((resolve) => { - resolve([Camera]); - }); - } - }, - createCameraInput: function (...args) { - console.warn('CameraManager.createCameraInput 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, CameraInput); - } else { - return new Promise((resolve) => { - resolve(CameraInput); - }); - } - }, - on: function (...args) { - console.warn('CameraManager.on 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') { - if(args[0] == 'cameraStatus'){ - args[len - 1].call(this, paramMock.businessErrorMock, CameraStatusInfo); - } - } - } - } - const CameraPosition = { - CAMERA_POSITION_UNSPECIFIED: 0, - CAMERA_POSITION_BACK: 1, - CAMERA_POSITION_FRONT: 2 - } - const CameraType = { - CAMERA_TYPE_UNSPECIFIED: 0, - CAMERA_TYPE_WIDE_ANGLE: 1, - CAMERA_TYPE_ULTRA_WIDE: 2, - CAMERA_TYPE_TELEPHOTO: 3, - CAMERA_TYPE_TRUE_DEPTH: 4 - } - const ConnectionType = { - CAMERA_CONNECTION_BUILT_IN: 0, - CAMERA_CONNECTION_USB_PLUGIN: 1, - CAMERA_CONNECTION_REMOTE: 2 - } - const Size = { - height: '[PC preview] unknow height', - width: '[PC preview] unknow width' - } - const CameraInputErrorCode = { - ERROR_UNKNOWN: -1 - } - const CameraInputError = { - code: CameraInputErrorCode - } - const FlashMode = { - FLASH_MODE_CLOSE: 0, - FLASH_MODE_OPEN: 1, - FLASH_MODE_AUTO: 2, - FLASH_MODE_ALWAYS_OPEN: 3 - } - const FocusMode = { - FOCUS_MODE_MANUAL: 0, - FOCUS_MODE_CONTINUOUS_AUTO: 1, - FOCUS_MODE_AUTO: 2, - FOCUS_MODE_LOCKED: 3 - } - const FocusState = { - FOCUS_STATE_SCAN: 0, - FOCUS_STATE_FOCUSED: 1, - FOCUS_STATE_UNFOCUSED: 2 - } - const CameraInput = { - getCameraId: function (...args) { - console.warn('CameraInput.getCameraId 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); - }); - } - }, - hasFlash: function (...args) { - console.warn('CameraInput.hasFlash 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); - }); - } - }, - isFlashModeSupported: function (...args) { - console.warn('CameraInput.isFlashModeSupported 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); - }); - } - }, - getFlashMode: function (...args) { - console.warn('CameraInput.getFlashMode 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, FlashMode); - } else { - return new Promise((resolve) => { - resolve(FlashMode); - }); - } - }, - setFlashMode: function (...args) { - console.warn('CameraInput.setFlashMode 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isFocusModeSupported: function (...args) { - console.warn('CameraInput.isFocusModeSupported 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); - }); - } - }, - getFocusMode: function (...args) { - console.warn('CameraInput.getFocusMode 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, FocusMode); - } else { - return new Promise((resolve) => { - resolve(FocusMode); - }); - } - }, - setFocusMode: function (...args) { - console.warn('CameraInput.setFocusMode 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getZoomRatioRange: function (...args) { - console.warn('CameraInput.getZoomRatioRange 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.paramNumberMock]); - } else { - return new Promise((resolve) => { - resolve([paramMock.paramNumberMock]); - }); - } - }, - getZoomRatio: function (...args) { - console.warn('CameraInput.getZoomRatio 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setZoomRatio: function (...args) { - console.warn('CameraInput.setZoomRatio 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn('CameraInput.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn('CameraInput.on 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') { - if(args[0] == 'focusStateChange'){ - args[len - 1].call(this, paramMock.businessErrorMock, FocusState); - } else if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock, CameraInputError); - } - } - } - } - const CaptureSessionErrorCode = { - ERROR_UNKNOWN: -1 - } - const CaptureSessionError = { - code: CaptureSessionErrorCode - } - const CaptureSession = { - beginConfig: function (...args) { - console.warn('CaptureSession.beginConfig 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - commitConfig: function (...args) { - console.warn('CaptureSession.commitConfig 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - addInput: function (...args) { - console.warn('CaptureSession.addInput 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - addOutput: function (...args) { - console.warn('CaptureSession.addOutput 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - removeInput: function (...args) { - console.warn('CaptureSession.removeInput 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - removeOutput: function (...args) { - console.warn('CaptureSession.removeOutput 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - start: function (...args) { - console.warn('CaptureSession.start 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - stop: function (...args) { - console.warn('CaptureSession.stop 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn('CaptureSession.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn('CaptureSession.on 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') { - if(args[0] == 'error'){ - args[len - 1].call(this, paramMock.businessErrorMock, CaptureSessionError); - } - } - } - } - const PreviewOutputErrorCode = { - ERROR_UNKNOWN: -1 - } - const PreviewOutputError = { - code: PreviewOutputErrorCode - } - const PreviewOutput = { - release: function (...args) { - console.warn('PreviewOutput.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn('PreviewOutput.on 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') { - if(args[0] == 'frameStart'){ - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'frameEnd') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock, PreviewOutputError); - } - } - }, - } - const ImageRotation = { - ROTATION_0: 0, - ROTATION_90: 90, - ROTATION_180: 180, - ROTATION_270: 270 - } - const QualityLevel = { - QUALITY_LEVEL_HIGH: 0, - QUALITY_LEVEL_MEDIUM: 1, - QUALITY_LEVEL_LOW: 2 - } - const PhotoCaptureSetting = { - quality:QualityLevel, - rotation: ImageRotation - } - const FrameShutterInfo = { - captureId: '[PC preview] unknow captureId', - timestamp: '[PC preview] unknow timestamp' - } - const CaptureEndInfo = { - captureId: '[PC preview] unknow captureId', - frameCount: '[PC preview] unknow frameCount' - } - const PhotoOutputErrorCode = { - ERROR_UNKNOWN: -1 - } - const PhotoOutputError = { - code: PhotoOutputErrorCode - } - const PhotoOutput = { - capture: function (...args) { - console.warn('PhotoOutput.capture 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn('PhotoOutput.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn('PhotoOutput.on 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') { - if(args[0] == 'captureStart'){ - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); - } else if (args[0] == 'frameShutter') { - args[len - 1].call(this, paramMock.businessErrorMock, FrameShutterInfo); - } else if (args[0] == 'captureEnd') { - args[len - 1].call(this, paramMock.businessErrorMock, CaptureEndInfo); - } else if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock, PhotoOutputError); - } - } - } - } - const VideoOutputErrorCode = { - ERROR_UNKNOWN: -1 - } - const VideoOutputError = { - code: VideoOutputErrorCode - } - const VideoOutput = { - start: function (...args) { - console.warn('VideoOutput.start 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - stop: function (...args) { - console.warn('VideoOutput.stop 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn('VideoOutput.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn('VideoOutput.on 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') { - if(args[0] == 'frameStart'){ - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'frameEnd') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'error') { - args[len - 1].call(this, paramMock.businessErrorMock, VideoOutputError); - } - } - } - } - return multimediaCameraMock -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_image.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_image.js deleted file mode 100644 index e681f359..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_image.js +++ /dev/null @@ -1,519 +0,0 @@ -/* - * 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" - -const SizeMock = { - height: "[PC Preview] unknow height", - width: "[PC Preview] unknow width" -} -const ImageInfoMock = { - size: SizeMock -} - -export const PixelMapMock = { - isEditable: "[PC Preview] unknow isEditable", - readPixelsToBuffer: function (...args) { - console.warn("PixelMap.readPixelsToBuffer 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - readPixels: function (...args) { - console.warn("PixelMap.readPixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - writePixels: function (...args) { - console.warn("PixelMap.writePixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - writeBufferToPixels: function (...args) { - console.warn("PixelMap.writeBufferToPixels 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getImageInfo: function (...args) { - console.warn("PixelMap.getImageInfo 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, ImageInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(ImageInfoMock); - }) - } - }, - getBytesNumberPerRow: function (...args) { - console.warn("PixelMap.getBytesNumberPerRow interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getPixelBytesNumber: function (...args) { - console.warn("PixelMap.getPixelBytesNumber interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getDensity: function (...args) { - console.warn("PixelMap.getDensity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - opacity: function (...args) { - console.warn("PixelMap.opacity 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - createAlphaPixelmap: function (...args) { - console.warn("PixelMap.createAlphaPixelmap 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,PixelMapMock); - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - scale: function (...args) { - console.warn("PixelMap.scale 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - translate: function (...args) { - console.warn("PixelMap.translate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - rotate: function (...args) { - console.warn("PixelMap.rotate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - flip: function (...args) { - console.warn("PixelMap.flip 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - crop: function (...args) { - console.warn("PixelMap.flip 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - release: function (...args) { - console.warn("PixelMap.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } -} - -export function mockMultimediaImage() { - const RegionMock = { - size: SizeMock, - x: "[PC Preview] unknow x", - y: "[PC Preview] unknow y" - } - const PositionAreaMock = { - pixels: "[PC Preview] unknow pixels", - offset: "[PC Preview] unknow offset", - stride: "[PC Preview] unknow stride", - region: RegionMock - } - const PackingOptionMock = { - format: "[PC Preview] unknow format", - quality: "[PC Preview] unknow quality" - } - const GetImagePropertyOptionsMock = { - index: "[PC Preview] unknow index", - defaultValue: "[PC Preview] unknow defaultValue" - } - const DecodingOptionsMock = { - index: "[PC Preview] unknow index", - sampleSize: "[PC Preview] unknow sampleSize", - rotate: "[PC Preview] unknow rotate", - editable: "[PC Preview] unknow editable", - desiredSize: SizeMock, - desiredRegion: RegionMock, - desiredPixelFormat: "[PC Preview] unknow desiredPixelFormat" - } - const ComponentMock = { - componentType: "[PC Preview] unknow componentType", - rowStride: "[PC Preview] unknow rowStride", - pixelStride: "[PC Preview] unknow pixelStride", - byteBuffer: "[PC Preview] unknow pixelStride" - } - const InitializationOptionsMock = { - size: SizeMock, - pixelFormat: "[PC Preview] unknow pixelFormat", - editable: "[PC Preview] unknow editable", - alphaType: "[PC Preview] unknow alphaType", - scaleMode: "[PC Preview] unknow scaleMode" - } - const SourceOptionsMock = { - sourceDensity:"[PC Preview] unknow sourceDensity", - sourcePixelFormat:"[PC Preview] unknow sourcePixelFormat", - sourceSize:SizeMock - } - - const ImageSourceMock = { - getImageInfo: function (...args) { - console.warn("ImageSource.getImageInfo 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, ImageInfoMock); - } else { - return new Promise((resolve, reject) => { - resolve(ImageInfoMock); - }) - } - }, - release: function (...args) { - console.warn("ImageSource.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - createPixelMap: function (...args) { - console.warn("ImageSource.createPixelMap 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, PixelMapMock); - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - getImageProperty: function (...args) { - console.warn("ImageSource.getImageProperty 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - modifyImageProperty: function (...args) { - console.warn("ImageSource.modifyImageProperty 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - updateData: function (...args) { - console.warn("ImageSource.updateData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - release: function (...args) { - console.warn("ImageSource.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - supportedFormats: "[PC Preview] unknow supportedFormats" - } - const ImagePackerMock = { - packing: function (...args) { - console.warn("ImagePacker.packing 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - release: function (...args) { - console.warn("ImagePacker.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - supportedFormats: "[PC Preview] unknow supportedFormats" - } - const ImageMock = { - clipRect: RegionMock, - size: SizeMock, - format: "[PC Preview] unknow format", - getComponent: function (...args) { - console.warn("Image.getComponent 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,ComponentMock); - } else { - return new Promise((resolve, reject) => { - resolve(ComponentMock); - }) - } - }, - release: function (...args) { - console.warn("Image.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const ImageReceiverMock = { - size: SizeMock, - capacity: "[PC Preview] unknow width", - format: "[PC Preview] unknow format", - getReceivingSurfaceId: function (...args) { - console.warn("ImageReceiver.getReceivingSurfaceId 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, paramMock.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - readLatestImage: function (...args) { - console.warn("ImageReceiver.readLatestImage 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, paramMock.ImageMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.ImageMock); - }) - } - }, - readNextImage: function (...args) { - console.warn("ImageReceiver.readNextImage 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, paramMock.ImageMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.ImageMock); - }) - } - }, - on: function (...args) { - console.warn("ImageReceiver.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - release: function (...args) { - console.warn("ImageReceiver.release 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const image = { - PixelMapFormat: { - UNKNOWN: 0, - RGB_565: 2, - RGBA_8888: 3, - }, - PropertyKey: { - BITS_PER_SAMPLE: "BitsPerSample", - ORIENTATION: "Orientation", - IMAGE_LENGTH: "ImageLength", - IMAGE_WIDTH: "ImageWidth", - GPS_LATITUDE: "GPSLatitude", - GPS_LONGITUDE: "GPSLongitude", - GPS_LATITUDE_REF: "GPSLatitudeRef", - GPS_LONGITUDE_REF: "GPSLongitudeRef", - }, - ImageFormat: { - YCBCR_422_SP: 1000, - JPEG: 2000, - }, - AlphaType: { - UNKNOWN: 0, - OPAQUE: 1, - PREMUL: 2, - UNPREMUL: 3, - }, - ScaleMode: { - FIT_TARGET_SIZE: 0, - CENTER_CROP: 1, - }, - ComponentType: { - YUV_Y: 1, - YUV_U: 2, - YUV_V: 3, - JPEG: 4, - }, - createPixelMap: function (...args) { - console.warn("image.createPixelMap 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, PixelMapMock); - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - createImageSource: function () { - console.warn("image.createImageSource interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ImageSourceMock; - }, - CreateIncrementalSource: function () { - console.warn("image.CreateIncrementalSource interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ImageSourceMock; - }, - createImagePacker: function () { - console.warn("image.createImagePacker interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ImagePackerMock; - }, - createImageReceiver: function () { - console.warn("image.createImageReceiver interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return ImageReceiverMock; - } - } - return image; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_media.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_media.js deleted file mode 100644 index 5517e7d7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_media.js +++ /dev/null @@ -1,541 +0,0 @@ -/* - * 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 mockMultimediaMedia() { - const audioPlayerMock = { - play: function () { - console.warn("AudioPlayer.play interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - pause: function () { - console.warn("AudioPlayer.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - stop: function () { - console.warn("AudioPlayer.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - reset: function () { - console.warn("AudioPlayer.reset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - seek: function (...args) { - console.warn("AudioPlayer.seek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - setVolume: function (...args) { - console.warn("AudioPlayer.setVolume interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - release: function () { - console.warn("AudioPlayer.release interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - getTrackDescription: function(...args) { - console.warn("AudioPlayer.getTrackDescription 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, [mediaDescriptionMock]); - } else { - return new Promise((resolve) => { - resolve([mediaDescriptionMock]); - }); - } - }, - src: '[PC Preview] unknow src', - fdSrc: AVFileDescriptor, - loop: '[PC Preview] unknow loop', - audioInterruptMode: InterruptMode, - currentTime: '[PC Preview] unknow currentTime', - duration: '[PC Preview] unknow duration', - state: '[PC Preview] unknow state', - on: function (...args) { - console.warn("AudioPlayer.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - const locationMock = { - latitude: '[PC Preview] unknow latitude', - longitude: '[PC Preview] unknow longitude', - } - const audioRecorderConfigMock = { - audioEncoder: '[PC Preview] unknow audioEncoder', - audioEncodeBitRate: '[PC Preview] unknow audioEncodeBitRate', - audioSampleRate: '[PC Preview] unknow audioSampleRate', - numberOfChannels: '[PC Preview] unknow numberOfChannels', - format: '[PC Preview] unknow format', - uri: '[PC Preview] unknow uri', - location: locationMock, - audioEncoderMime: '[PC Preview] unknow audioEncoderMime', - fileFormat: '[PC Preview] unknow fileFormat', - } - const audioRecorderMock = { - prepare: function (...args) { - console.warn("AudioRecorder.prepare interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - start: function () { - console.warn("AudioRecorder.start interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - pause: function () { - console.warn("AudioRecorder.pause interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - resume: function () { - console.warn("AudioRecorder.resume interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stop: function () { - console.warn("AudioRecorder.stop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - release: function () { - console.warn("AudioRecorder.release interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - reset: function () { - console.warn("AudioRecorder.reset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("AudioRecorder.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } - const videoRecorderMock = { - prepare: function (...args) { - console.warn("VideoRecorder.prepare 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getInputSurface: function (...args) { - console.warn("VideoRecorder.getInputSurface 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); - }); - } - }, - start: function (...args) { - console.warn("VideoRecorder.start 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - pause: function (...args) { - console.warn("VideoRecorder.pause 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - resume: function (...args) { - console.warn("VideoRecorder.resume 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - stop: function (...args) { - console.warn("VideoRecorder.stop 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn("VideoRecorder.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - reset: function (...args) { - console.warn("VideoRecorder.reset 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - on: function (...args) { - console.warn("AudioRecorder.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - state: paramMock.paramStringMock, - } - const videoPlayerMock = { - url: '[PC Preview] unknow url', - fdSrc: AVFileDescriptor, - loop: '[PC Preview] unknow loop', - currentTime: '[PC Preview] unknow currentTime', - duration: '[PC Preview] unknow duration', - state: '[PC Preview] unknow state', - width: '[PC Preview] unknow width', - height: '[PC Preview] unknow height', - audioInterruptMode: InterruptMode, - videoScaleType: mediaMock.VideoScaleType, - setDisplaySurface: function (...args) { - console.warn("VideoPlayer.setDisplaySurface 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - prepare: function (...args) { - console.warn("VideoPlayer.prepare 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - play: function (...args) { - console.warn("VideoPlayer.play 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - pause: function (...args) { - console.warn("VideoPlayer.pause 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - stop: function (...args) { - console.warn("VideoPlayer.stop 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - reset: function (...args) { - console.warn("VideoPlayer.reset 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - seek: function (...args) { - console.warn("VideoPlayer.seek 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setVolume: function (...args) { - console.warn("VideoPlayer.setVolume 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - release: function (...args) { - console.warn("VideoPlayer.release 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getTrackDescription: function (...args) { - console.warn("VideoPlayer.getTrackDescription 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, [mediaDescriptionMock]); - } else { - return new Promise((resolve) => { - resolve([mediaDescriptionMock]); - }); - } - }, - setSpeed: function (...args) { - console.warn("VideoPlayer.setSpeed 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.paramNumberMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - selectBitrate: function (...args) { - console.warn("VideoPlayer.selectBitrate 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.paramNumberMock, paramMock.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - on: function (...args) { - console.warn("VideoPlayer.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - } - const AVFileDescriptorMock = { - fd: '[PC Preview] unknow fd', - offset: '[PC Preview] unknow audioChannels', - length: '[PC Preview] unknow audioCodec', - } - const videoRecorderProfileMock = { - audioBitrate: '[PC Preview] unknow audioBitrate', - audioChannels: '[PC Preview] unknow audioChannels', - audioCodec: '[PC Preview] unknow audioCodec', - audioSampleRate: '[PC Preview] unknow audioSampleRate', - fileFormat: '[PC Preview] unknow fileFormat', - videoBitrate: '[PC Preview] unknow videoBitrate', - videoCodec: '[PC Preview] unknow videoCodec', - videoFrameWidth: '[PC Preview] unknow videoFrameWidth', - videoFrameHeight: '[PC Preview] unknow videoFrameHeight', - videoFrameRate: '[PC Preview] unknow videoFrameRate', - } - const videoRecorderConfigMock = { - audioSourceType: '[PC Preview] unknow audioSourceType', - videoSourceType: '[PC Preview] unknow videoSourceType', - profile: '[PC Preview] unknow profile', - url: '[PC Preview] unknow url', - rotation: '[PC Preview] unknow rotation', - location: locationMock, - } - const mediaDescriptionMock = { - "key": 'paramMock.paramObjectMock', - } - const InterruptModeMock = { - SHARE_MODE: 0, - INDEPENDENT_MODE: 1 - } - const mediaMock = { - MediaErrorCode : { - MSERR_OK: 0, - MSERR_NO_MEMORY: 1, - MSERR_OPERATION_NOT_PERMIT: 2, - MSERR_INVALID_VAL: 3, - MSERR_IO: 4, - MSERR_TIMEOUT: 5, - MSERR_UNKNOWN: 6, - MSERR_SERVICE_DIED: 7, - MSERR_INVALID_STATE: 8, - MSERR_UNSUPPORTED: 9 - }, - BufferingInfoType : { - BUFFERING_START: 1, - BUFFERING_END: 2, - BUFFERING_PERCENT: 3, - CACHED_DURATION: 4 - }, - AudioEncoder : { - DEFAULT: 0, - AMR_NB: 1, - AMR_WB: 2, - AAC_LC: 3, - HE_AAC: 4 - }, - AudioOutputFormat : { - DEFAULT: 0, - MPEG_4: 2, - AMR_NB: 3, - AMR_WB: 4, - AAC_ADTS: 6 - }, - CodecMimeType : { - VIDEO_H263: 'video/h263', - VIDEO_AVC: 'video/avc', - VIDEO_MPEG2: 'video/mpeg2', - VIDEO_MPEG4: 'video/mp4v-es', - VIDEO_VP8: 'video/x-vnd.on2.vp8', - AUDIO_AAC: 'audio/mp4a-latm', - AUDIO_VORBIS: 'audio/vorbis', - AUDIO_FLAC: 'audio/flac', - }, - PlaybackSpeed : { - SPEED_FORWARD_0_75_X: 0, - SPEED_FORWARD_1_00_X: 1, - SPEED_FORWARD_1_25_X: 2, - SPEED_FORWARD_1_75_X: 3, - SPEED_FORWARD_2_00_X: 4, - }, - VideoScaleType : { - VIDEO_SCALE_TYPE_FIT: 0, - VIDEO_SCALE_TYPE_FIT_CROP: 1, - }, - ContainerFormatType : { - CFT_MPEG_4: "mp4", - CFT_MPEG_4A: "m4a", - }, - MediaType : { - MEDIA_TYPE_AUD: 0, - MEDIA_TYPE_VID: 1, - }, - MediaDescriptionKey : { - MD_KEY_TRACK_INDEX: "track_index", - MD_KEY_TRACK_TYPE: "track_type", - MD_KEY_CODEC_MIME: "codec_mime", - MD_KEY_DURATION: "duration", - MD_KEY_BITRATE: "bitrate", - MD_KEY_WIDTH: "width", - MD_KEY_HEIGHT: "height", - MD_KEY_FRAME_RATE: "frame_rate", - MD_KEY_AUD_CHANNEL_COUNT: "channel_count", - MD_KEY_AUD_SAMPLE_RATE: "sample_rate", - }, - AudioSourceType : { - AUDIO_SOURCE_TYPE_DEFAULT: 0, - AUDIO_SOURCE_TYPE_MIC: 1, - }, - VideoSourceType : { - VIDEO_SOURCE_TYPE_SURFACE_YUV: 0, - VIDEO_SOURCE_TYPE_SURFACE_ES: 1, - }, - SeekMode : { - SEEK_NEXT_SYNC: 0, - SEEK_PREV_SYNC: 1, - }, - AudioState: '[PC Preview] unknow AudioState', - VideoRecordState: '[PC Preview] unknow VideoRecordState', - VideoPlayState: '[PC Preview] unknow VideoPlayState', - createAudioPlayer: function () { - console.warn("media.createAudioPlayer interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return audioPlayerMock; - }, - createAudioRecorder: function () { - console.warn("media.createAudioRecorder interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - return audioRecorderMock; - }, - createVideoPlayer: function () { - console.warn("media.createVideoPlayer 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, videoPlayerMock); - } else { - return new Promise((resolve) => { - resolve(videoPlayerMock); - }); - } - }, - createVideoRecorder: function () { - console.warn("media.createVideoRecorder 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, videoRecorderMock); - } else { - return new Promise((resolve) => { - resolve(videoRecorderMock); - }); - } - }, - } - return mediaMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimedia_mediaLibrary.js b/runtime/main/extend/systemplugin/napi/ohos_multimedia_mediaLibrary.js deleted file mode 100644 index 945af1dd..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimedia_mediaLibrary.js +++ /dev/null @@ -1,468 +0,0 @@ -/* - * 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 { PixelMapMock } from "./ohos_multimedia_image" - -export function mockMultimediaMediaLibrary() { - const mockFileAsset = { - id: "[PC Preview] unknow id", - uri: "[PC Preview] unknow uri", - mimeType: "[PC Preview] unknow mimeType", - mediaType: "[PC Preview] unknow mediaType", - displayName: "[PC Preview] unknow displayName", - title: "[PC Preview] unknow title", - relativePath: "[PC Preview] unknow relativePath", - parent: "[PC Preview] unknow parent", - size: "[PC Preview] unknow size", - dateAdded: "[PC Preview] unknow dateAdded", - dateModified: "[PC Preview] unknow dateModified", - dateTaken: "[PC Preview] unknow dateTaken", - artist: "[PC Preview] unknow artist", - audioAlbum: "[PC Preview] unknow audioAlbum", - width: "[PC Preview] unknow width", - height: "[PC Preview] unknow height", - orientation: "[PC Preview] unknow orientation", - duration: "[PC Preview] unknow duration", - albumId: "[PC Preview] unknow albumId", - albumUri: "[PC Preview] unknow albumUri", - albumName: "[PC Preview] unknow albumName", - isDirectory: function (...args) { - console.warn("FileAsset.isDirectory 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, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - commitModify: function (...args) { - console.warn("FileAsset.commitModify 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) - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - open: function (...args) { - console.warn("FileAsset.open 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, paramMock.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - close: function (...args) { - console.warn("FileAsset.close 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) - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - getThumbnail: function (...args) { - console.warn("FileAsset.getThumbnail 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, mockImagePixelMap) - } else { - return new Promise((resolve, reject) => { - resolve(mockImagePixelMap) - }) - } - }, - favorite: function (...args) { - console.warn("FileAsset.favorite 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) - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - isFavorite: function (...args) { - console.warn("FileAsset.isFavorite 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, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - trash: function (...args) { - console.warn("FileAsset.trash 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) - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - isTrash: function (...args) { - console.warn("FileAsset.isTrash 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, paramMock.paramBooleanMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - }; - - const mockFetchFileResult = { - getCount: function (...args) { - console.warn("FetchFileResult.getCount interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - isAfterLast: function (...args) { - console.warn("FetchFileResult.isAfterLast interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - close: function (...args) { - console.warn("FetchFileResult.close interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getFirstObject: function (...args) { - console.warn("FetchFileResult.getFirstObject 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, mockFileAsset) - } else { - return new Promise((resolve, reject) => { - resolve(mockFileAsset) - }) - } - }, - getNextObject: function (...args) { - console.warn("FetchFileResult.getNextObject 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, mockFileAsset) - } else { - return new Promise((resolve, reject) => { - resolve(mockFileAsset) - }) - } - }, - getLastObject: function (...args) { - console.warn("FetchFileResult.getLastObject 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, mockFileAsset) - } else { - return new Promise((resolve, reject) => { - resolve(mockFileAsset) - }) - } - }, - getPositionObject: function (...args) { - console.warn("FetchFileResult.getPositionObject 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, mockFileAsset) - } else { - return new Promise((resolve, reject) => { - resolve(mockFileAsset) - }) - } - }, - getAllObject: function (...args) { - console.warn("FetchFileResult.getPositionObject 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, [mockFileAsset]) - } else { - return new Promise((resolve, reject) => { - resolve([mockFileAsset]) - }) - } - }, - }; - - const mockPeerInfo = { - deviceName: "[PC Preview] unknow deviceName", - networkId: "[PC Preview] unknow networkId", - deviceType: "[PC Preview] unknow deviceType", - isOnline: "[PC Preview] unknow isOnline" - }; - - const mockImagePixelMap = PixelMapMock; - - const mockAlbum = { - albumId: "[PC Preview] unknow albumId", - albumName: "[PC Preview] unknow albumName", - albumUri: "[PC Preview] unknow albumUri", - dateModified: "[PC Preview] unknow dateModified", - count: "[PC Preview] unknow count", - relativePath: "[PC Preview] unknow relativePath", - coverUri: "[PC Preview] unknow coverUri", - commitModify: function (...args) { - console.warn("Album.commitModify 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - getFileAssets: function (...args) { - console.warn("Album.getFileAssets 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, mockFetchFileResult); - } else { - return new Promise((resolve, reject) => { - resolve(mockFetchFileResult) - }) - } - } - }; - - const mockMediaLibrary = { - getPublicDirectory: function (...args) { - console.warn("MediaLibrary.getPublicDirectory 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, reject) => { - resolve(paramMock.paramStringMock) - }) - } - }, - getFileAssets: function (...args) { - console.warn("MediaLibrary.getFileAssets 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, mockFetchFileResult); - } else { - return new Promise((resolve, reject) => { - resolve(mockFetchFileResult) - }) - } - }, - on: function (...args) { - console.warn("MediaLibrary.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - off: function (...args) { - console.warn("MediaLibrary.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createAsset: function (...args) { - console.warn("MediaLibrary.createAsset 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, mockFileAsset); - } else { - return new Promise((resolve, reject) => { - resolve(mockFileAsset) - }) - } - }, - deleteAsset: function (...args) { - console.warn("MediaLibrary.deleteAsset 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - getAlbums: function (...args) { - console.warn("MediaLibrary.getAlbums 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, [mockAlbum]); - } else { - return new Promise((resolve, reject) => { - resolve([mockAlbum]) - }) - } - }, - storeMediaAsset: function (...args) { - console.warn("MediaLibrary.storeMediaAsset 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, reject) => { - resolve(paramMock.paramStringMock) - }) - } - }, - startImagePreview: function (...args) { - console.warn("MediaLibrary.startImagePreview 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - }, - startMediaSelect: function (...args) { - console.warn("MediaLibrary.startMediaSelect 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, reject) => { - resolve([paramMock.paramStringMock]) - }) - } - }, - getActivePeers: function (...args) { - console.warn("MediaLibrary.getActivePeers 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, [mockPeerInfo]); - } else { - return new Promise((resolve, reject) => { - resolve([mockPeerInfo]) - }) - } - }, - getAllPeers: function (...args) { - console.warn("MediaLibrary.getAllPeers 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, [mockPeerInfo]); - } else { - return new Promise((resolve, reject) => { - resolve([mockPeerInfo]) - }) - } - }, - release: function (...args) { - console.warn("MediaLibrary.startImagePreview 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); - } else { - return new Promise((resolve, reject) => { - resolve() - }) - } - } - }; - - const mediaLibrary = { - MediaType: { - FILE: 0, - IMAGE: 1, - VIDEO: 2, - AUDIO: 3 - }, - FileKey: { - ID: "file_id", - RELATIVE_PATH: "relative_path", - DISPLAY_NAME: "display_name", - PARENT: "parent", - MIME_TYPE: "mime_type", - MEDIA_TYPE: "media_type", - SIZE: "size", - DATE_ADDED: "date_added", - DATE_MODIFIED: "date_modified", - DATE_TAKEN: "date_taken", - TITLE: "title", - ARTIST: "artist", - AUDIOALBUM: "audio_album", - DURATION: "duration", - WIDTH: "width", - HEIGHT: "height", - ORIENTATION: "orientation", - ALBUM_ID: "bucket_id", - ALBUM_NAME: "bucket_display_name" - }, - DirectoryType: { - DIR_CAMERA: 0, - DIR_VIDEO: 1, - DIR_IMAGE: 2, - DIR_AUDIO: 3, - DIR_DOCUMENTS: 4, - DIR_DOWNLOAD: 5 - }, - DeviceType: { - TYPE_UNKNOWN: 0, - TYPE_LAPTOP: 1, - TYPE_PHONE: 2, - TYPE_TABLET: 3, - TYPE_WATCH: 4, - TYPE_CAR: 5, - TYPE_TV: 6 - }, - getMediaLibrary: function (...args) { - console.warn("mediaLibrary.getMediaLibrary interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return mockMediaLibrary; - } - }; - - return mediaLibrary; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputConsumer.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputConsumer.js deleted file mode 100644 index 772faabd..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputConsumer.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 mockInputConsumer() { - const KeyOptions = { - preKeys: [param.paramNumberMock], - finalKey: "[PC preview] unknown finalKey", - isFinalKeyDown: "[PC preview] unknown isFinalKeyDown", - finalKeyDownDuration: "[PC preview] unknown finalKeyDownDuration", - } - const EventType = ['key'] - const inputConsumer = { - on: function (...args) { - console.warn("inputConsumer.on 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 !== 3) { - console.warn("Must be three parameters"); - return; - } - if (EventType.indexOf(args[0]) === -1) { - console.warn("the first parameter must be 'key'"); - return; - } - if (typeof args[1] != 'object') { - console.warn("the second parameter type must be 'object'"); - return; - } - if (typeof args[2] != 'function') { - console.warn("the third parameter type must be 'function'"); - return; - } - args[2].call(this, args[1]); - }, - off: function (...args) { - console.warn("inputConsumer.off 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 < 2 || len > 3) { - console.warn("a maximum of two parameters"); - return; - } - if (EventType.indexOf(args[0]) === -1) { - console.warn("first parameter must be 'key'") - return; - } - if (typeof args[1] != 'object') { - console.warn("second parameter type must be 'object'"); - return; - } - if (len === 3) { - if (typeof args[2] != 'function') { - console.warn("the third parameter type must be 'function'"); - return; - } - } - } - } - return inputConsumer; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js deleted file mode 100644 index 2edabfd6..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2021-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 mockInputDevice() { - const DeviceListener = { - type: '[PC preview] unknow type', - deviceId: '[PC preview] unknow deviceId', - } - const AxisRange = { - source: '[PC preview] unknow source', - axis: '[PC preview] unknow axis', - max: '[PC preview] unknow max', - min: '[PC preview] unknow min', - fuzz: '[PC preview] unknow fuzz', - flat: '[PC preview] unknow flat', - resolution: '[PC preview] unknow resolution', - } - const InputDeviceData = { - id: '[PC preview] unknow id', - name: '[PC preview] unknow name', - sources: ['[PC preview] unknow sources'], - axisRanges: [AxisRange], - bus: '[PC preview] unknow bus', - product: '[PC preview] unknow product', - vendor: '[PC preview] unknow vendor', - version: '[PC preview] unknow version', - phys: '[PC preview] unknow phys', - uniq: '[PC preview] unknow uniq', - } - const KeyboardType = { - NONE: 0, - UNKNOWN: 1, - ALPHABETIC_KEYBOARD: 2, - DIGITAL_KEYBOARD: 3, - HANDWRITING_PEN: 4, - REMOTE_CONTROL: 5, - } - - const EventType = ['change'] - const DeviceIds = [0, 1, 2, 3, 4] - const GetKeyboardType = 3 - const inputDevice = { - KeyboardType, - on: function (...args) { - console.warn("inputDevice.on 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 === 2) { - if (EventType.indexOf(args[0]) === -1) { - console.warn("the first parameter must be 'change'") - } - if (typeof args[1] != 'function') { - console.warn("the second parameter type must be 'function'") - } - } else { - console.warn("the number of parameter must be two") - } - }, - off: function (...args) { - console.warn("inputDevice.off 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 < 1 || len > 2) { - console.warn("a maximum of two parameters") - } else if (len === 1) { - if (EventType.indexOf(args[0]) === -1) { - console.warn("first parameter must be 'change'") - } - } else { - if (EventType.indexOf(args[0]) === -1) { - console.warn("first parameter must be 'change'") - } - if (typeof args[1] != 'function') { - console.warn("second parameter type must be 'function'") - } - } - }, - getDeviceSync: function (...args) { - console.warn("inputDevice.getDeviceSync 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 != 1) { - console.warn("the number of parameter must be one") - } else { - if (DeviceIds.indexOf(args[len - 1]) != -1) { - return InputDeviceData; - } else { - console.warn("parameter error") - return paramMock.businessErrorMock; - } - } - }, - getDeviceIdsSync: function () { - console.warn("inputDevice.getDeviceIdsSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return DeviceIds; - }, - getDeviceIds: function (...args) { - console.warn("inputDevice.getDeviceIds 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 > 1) { - console.warn("the number of parameter must be one") - return; - } - if (len === 1) { - if (typeof args[0] === 'function') { - args[0].call(this, DeviceIds); - } else { - console.warn("parameter type must be 'function'") - } - } else { - return new Promise((resolve, reject) => { - resolve(DeviceIds); - }) - } - }, - getDevice: function (...args) { - console.warn("inputDevice.getDevice 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 < 1 || len > 2) { - console.warn("the number of parameter must be two"); - return; - } - if (typeof args[0] !== 'number') { - console.warn("the first parameter error"); - return; - } - if (len === 1) { - return new Promise((resolve, reject) => { - resolve(InputDeviceData); - }) - } else { - if (typeof args[1] !== 'function') { - console.warn("the second parameter type must be 'function'"); - return; - } - args[1].call(this, InputDeviceData); - } - }, - supportKeys: function(...args) { - console.warn("inputDevice.supportKeys 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 < 2 || len > 3) { - console.warn("parameter number error"); - return; - } - if (typeof args[0] !== 'number') { - console.warn("the first parameter error"); - return; - } - if (typeof args[1] !== 'object') { - console.warn("the second parameter type must be array"); - return; - } - if (args[1].length < 1 || args[1].length > 5) { - console.warn("the number of keys is incorrect, the range is 1 to 5"); - return; - } - var supportKeysRet = []; - for (var i = 0; i < args[1].length; ++i) { - supportKeysRet.unshift('[PC preview] unknow boolean'); - } - if (len === 2) { - return new Promise((resolve, reject) => { - resolve(supportKeysRet); - }) - } else { - if (typeof args[2] !== 'function') { - console.warn("the third parameter type is wrong"); - return; - } - args[2].call(this, supportKeysRet); - } - }, - getKeyboardType: function(...args) { - console.warn("inputDevice.getKeyboardType 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 < 1 || len > 2) { - console.warn("parameter number error"); - return; - } - if (typeof args[0] !== 'number') { - console.warn("the first parameter error"); - return; - } - if (len == 1) { - return new Promise((resolve, reject) => { - resolve(GetKeyboardType); - }) - } else { - if (typeof args[1] !== 'function') { - console.warn("the second parameter type must be function"); - return; - } - args[1].call(this, GetKeyboardType); - } - }, - }; - return inputDevice -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEvent.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEvent.js deleted file mode 100755 index 1deaf88f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEvent.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 mockInputEvent() { - const InputEvent = { - id: '[PC preview] unknow id', - deviceId: '[PC preview] unknow deviceId', - actionTime: '[PC preview] unknow actionTime', - screenId: '[PC preview] unknow screenId', - windowId: '[PC preview] unknow windowId', - } - return InputEvent; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEventClient.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEventClient.js deleted file mode 100644 index 4ebf7cee..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputEventClient.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 mockInputEventClient() { - const KeyEvent = { - isPressed: '[PC preview] unknow isPressed', - keyCode: '[PC preview] unknow keyCode', - keyDownDuration: '[PC preview] unknow keyDownDuration', - isIntercepted: '[PC preview] unknow isIntercepted', - } - const inputEventClient = { - injectEvent: function(...args) { - console.warn("inputEventClient.injectEvent 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 !== 1) { - console.warn("the number of parameter must be one"); - return; - } - if (typeof args[0] !== 'object') { - console.warn("the second parameter type must be 'object'"); - return; - } - if (!('KeyEvent' in args[0])) { - console.warn("missing 'KeyEvent' field"); - return; - } - if (typeof args[0].KeyEvent.isPressed !== 'boolean') { - console.warn("Field isPressed must be boolean"); - return; - } - if (typeof args[0].KeyEvent.keyCode !== 'number') { - console.warn("Field keyCode must be number"); - return; - } - if (typeof args[0].KeyEvent.keyDownDuration !== 'number') { - console.warn("Field keyDownDuration must be number"); - return; - } - if (typeof args[0].KeyEvent.isIntercepted !== 'boolean') { - console.warn("Field isIntercepted must be boolean"); - return; - } - args[0].call(this, paramMock.businessErrorMock); - } - } - return inputEventClient; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputMonitor.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputMonitor.js deleted file mode 100644 index d808db3b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputMonitor.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2021 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 mockInputMonitor() { - const TouchEventReceiver = { - "touchEvent": '[PC preview] unknow boolean' - } - const touches = [{ - force: 1.67, - globalX: 122, - globalY: 3654, - localX: 0, - localY: 0, - size: 2.03 - }]; - const changedTouches = [{ - force: 1.67, - globalX: 122, - globalY: 3654, - localX: 0, - localY: 0, - size: 2.03 - }]; - const pressedButtons = [10, 11, 12, 13, 14]; - const inputMonitor = { - on: function (...args) { - console.warn('multimodalInput.inputMonitor.on interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - clearInterval(this.offInputMonitor); - delete this.offInputMonitor; - this.offInputMonitor = setInterval(() => { - const len = args.length; - if (len !== 2 || typeof args[0] !== 'string' || typeof args[len - 1] !== 'function') { - console.warn('multimodalInput.inputMonitor.on param invalid.'); - return; - } - if (args[0] !== 'touch' && args[0] !== 'mouse') { - console.warn('multimodalInput.inputMonitor.on first param should be touch or mouse.'); - return; - } - const value = {}; - value.type = 'up'; - value.timestamp = 318878; - value.deviceId = 0; - value.touches = touches; - value.changedTouches = changedTouches; - const mouse = {}; - mouse.type = 'move'; - mouse.pressedButtons = pressedButtons; - mouse.displayId = 20; - mouse.targetWindowId = 21; - mouse.agentWindowId = 22; - mouse.localX = 450; - mouse.localY = 736; - mouse.globalX = 450; - mouse.globalY = 784; - mouse.timestamp = 55670246; - mouse.axisVerticalValue = 15; - mouse.axisHorizontalValue = 20; - if (args[0] === 'touch') { - console.warn('multimodalInput.inputMonitor.on touch callback.'); - args[len - 1].call(this, value); - } else if (args[0] === 'mouse') { - console.warn('multimodalInput.inputMonitor.on mouse callback.'); - args[len - 1].call(this, mouse); - } - }, 1000); - }, - - off: function (...args) { - console.warn('multimodalInput.inputMonitor.off 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 < 1 || len > 2) { - console.warn("a maximum of two parameters"); - return; - } - if (typeof args[0] !== 'string') { - console.warn("the first parameter type must be string"); - return; - } - if (len === 1) { - if (args[0] !== 'touch' && args[0] !== 'mouse') { - console.warn("the first param should be touch or mouse"); - return; - } - } else { - if (typeof args[1] !== 'function') { - console.warn("the second parameter type must be function"); - return; - } - } - } - } - return inputMonitor -} - diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyCode.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyCode.js deleted file mode 100644 index 63a34cfc..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyCode.js +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2021-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 KeyCode = { - KEYCODE_FN: 0, - KEYCODE_UNKNOWN: -1, - KEYCODE_HOME: 1, - KEYCODE_BACK: 2, - KEYCODE_MEDIA_PLAY_PAUSE: 10, - KEYCODE_MEDIA_STOP: 11, - KEYCODE_MEDIA_NEXT: 12, - KEYCODE_MEDIA_PREVIOUS: 13, - KEYCODE_MEDIA_REWIND: 14, - KEYCODE_MEDIA_FAST_FORWARD: 15, - KEYCODE_VOLUME_UP: 16, - KEYCODE_VOLUME_DOWN: 17, - KEYCODE_POWER: 18, - KEYCODE_CAMERA: 19, - KEYCODE_VOLUME_MUTE: 22, - KEYCODE_MUTE: 23, - KEYCODE_BRIGHTNESS_UP: 40, - KEYCODE_BRIGHTNESS_DOWN: 41, - KEYCODE_0: 2000, - KEYCODE_1: 2001, - KEYCODE_2: 2002, - KEYCODE_3: 2003, - KEYCODE_4: 2004, - KEYCODE_5: 2005, - KEYCODE_6: 2006, - KEYCODE_7: 2007, - KEYCODE_8: 2008, - KEYCODE_9: 2009, - KEYCODE_STAR: 2010, - KEYCODE_POUND: 2011, - KEYCODE_DPAD_UP: 2012, - KEYCODE_DPAD_DOWN: 2013, - KEYCODE_DPAD_LEFT: 2014, - KEYCODE_DPAD_RIGHT: 2015, - KEYCODE_DPAD_CENTER: 2016, - KEYCODE_A: 2017, - KEYCODE_B: 2018, - KEYCODE_C: 2019, - KEYCODE_D: 2020, - KEYCODE_E: 2021, - KEYCODE_F: 2022, - KEYCODE_G: 2023, - KEYCODE_H: 2024, - KEYCODE_I: 2025, - KEYCODE_J: 2026, - KEYCODE_K: 2027, - KEYCODE_L: 2028, - KEYCODE_M: 2029, - KEYCODE_N: 2030, - KEYCODE_O: 2031, - KEYCODE_P: 2032, - KEYCODE_Q: 2033, - KEYCODE_R: 2034, - KEYCODE_S: 2035, - KEYCODE_T: 2036, - KEYCODE_U: 2037, - KEYCODE_V: 2038, - KEYCODE_W: 2039, - KEYCODE_X: 2040, - KEYCODE_Y: 2041, - KEYCODE_Z: 2042, - KEYCODE_COMMA: 2043, - KEYCODE_PERIOD: 2044, - KEYCODE_ALT_LEFT: 2045, - KEYCODE_ALT_RIGHT: 2046, - KEYCODE_SHIFT_LEFT: 2047, - KEYCODE_SHIFT_RIGHT: 2048, - KEYCODE_TAB: 2049, - KEYCODE_SPACE: 2050, - KEYCODE_SYM: 2051, - KEYCODE_EXPLORER: 2052, - KEYCODE_ENVELOPE: 2053, - KEYCODE_ENTER: 2054, - KEYCODE_DEL: 2055, - KEYCODE_GRAVE: 2056, - KEYCODE_MINUS: 2057, - KEYCODE_EQUALS: 2058, - KEYCODE_LEFT_BRACKET: 2059, - KEYCODE_RIGHT_BRACKET: 2060, - KEYCODE_BACKSLASH: 2061, - KEYCODE_SEMICOLON: 2062, - KEYCODE_APOSTROPHE: 2063, - KEYCODE_SLASH: 2064, - KEYCODE_AT: 2065, - KEYCODE_PLUS: 2066, - KEYCODE_MENU: 2067, - KEYCODE_PAGE_UP: 2068, - KEYCODE_PAGE_DOWN: 2069, - KEYCODE_ESCAPE: 2070, - KEYCODE_FORWARD_DEL: 2071, - KEYCODE_CTRL_LEFT: 2072, - KEYCODE_CTRL_RIGHT: 2073, - KEYCODE_CAPS_LOCK: 2074, - KEYCODE_SCROLL_LOCK: 2075, - KEYCODE_META_LEFT: 2076, - KEYCODE_META_RIGHT: 2077, - KEYCODE_FUNCTION: 2078, - KEYCODE_SYSRQ: 2079, - KEYCODE_BREAK: 2080, - KEYCODE_MOVE_HOME: 2081, - KEYCODE_MOVE_END: 2082, - KEYCODE_INSERT: 2083, - KEYCODE_FORWARD: 2084, - KEYCODE_MEDIA_PLAY: 2085, - KEYCODE_MEDIA_PAUSE: 2086, - KEYCODE_MEDIA_CLOSE: 2087, - KEYCODE_MEDIA_EJECT: 2088, - KEYCODE_MEDIA_RECORD: 2089, - KEYCODE_F1: 2090, - KEYCODE_F2: 2091, - KEYCODE_F3: 2092, - KEYCODE_F4: 2093, - KEYCODE_F5: 2094, - KEYCODE_F6: 2095, - KEYCODE_F7: 2096, - KEYCODE_F8: 2097, - KEYCODE_F9: 2098, - KEYCODE_F10: 2099, - KEYCODE_F11: 2100, - KEYCODE_F12: 2101, - KEYCODE_NUM_LOCK: 2102, - KEYCODE_NUMPAD_0: 2103, - KEYCODE_NUMPAD_1: 2104, - KEYCODE_NUMPAD_2: 2105, - KEYCODE_NUMPAD_3: 2106, - KEYCODE_NUMPAD_4: 2107, - KEYCODE_NUMPAD_5: 2108, - KEYCODE_NUMPAD_6: 2109, - KEYCODE_NUMPAD_7: 2110, - KEYCODE_NUMPAD_8: 2111, - KEYCODE_NUMPAD_9: 2112, - KEYCODE_NUMPAD_DIVIDE: 2113, - KEYCODE_NUMPAD_MULTIPLY: 2114, - KEYCODE_NUMPAD_SUBTRACT: 2115, - KEYCODE_NUMPAD_ADD: 2116, - KEYCODE_NUMPAD_DOT: 2117, - KEYCODE_NUMPAD_COMMA: 2118, - KEYCODE_NUMPAD_ENTER: 2119, - KEYCODE_NUMPAD_EQUALS: 2120, - KEYCODE_NUMPAD_LEFT_PAREN: 2121, - KEYCODE_NUMPAD_RIGHT_PAREN: 2122, - KEYCODE_VIRTUAL_MULTITASK: 2210, - KEYCODE_SLEEP: 2600, - KEYCODE_ZENKAKU_HANKAKU: 2601, - KEYCODE_102ND: 2602, - KEYCODE_RO: 2603, - KEYCODE_KATAKANA: 2604, - KEYCODE_HIRAGANA: 2605, - KEYCODE_HENKAN: 2606, - KEYCODE_KATAKANA_HIRAGANA: 2607, - KEYCODE_MUHENKAN: 2608, - KEYCODE_LINEFEED: 2609, - KEYCODE_MACRO: 2610, - KEYCODE_NUMPAD_PLUSMINUS: 2611, - KEYCODE_SCALE: 2612, - KEYCODE_HANGUEL: 2613, - KEYCODE_HANJA: 2614, - KEYCODE_YEN: 2615, - KEYCODE_STOP: 2616, - KEYCODE_AGAIN: 2617, - KEYCODE_PROPS: 2618, - KEYCODE_UNDO: 2619, - KEYCODE_COPY: 2620, - KEYCODE_OPEN: 2621, - KEYCODE_PASTE: 2622, - KEYCODE_FIND: 2623, - KEYCODE_CUT: 2624, - KEYCODE_HELP: 2625, - KEYCODE_CALC: 2626, - KEYCODE_FILE: 2627, - KEYCODE_BOOKMARKS: 2628, - KEYCODE_NEXT: 2629, - KEYCODE_PLAYPAUSE: 2630, - KEYCODE_PREVIOUS: 2631, - KEYCODE_STOPCD: 2632, - KEYCODE_CONFIG: 2634, - KEYCODE_REFRESH: 2635, - KEYCODE_EXIT: 2636, - KEYCODE_EDIT: 2637, - KEYCODE_SCROLLUP: 2638, - KEYCODE_SCROLLDOWN: 2639, - KEYCODE_NEW: 2640, - KEYCODE_REDO: 2641, - KEYCODE_CLOSE: 2642, - KEYCODE_PLAY: 2643, - KEYCODE_BASSBOOST: 2644, - KEYCODE_PRINT: 2645, - KEYCODE_CHAT: 2646, - KEYCODE_FINANCE: 2647, - KEYCODE_CANCEL: 2648, - KEYCODE_KBDILLUM_TOGGLE: 2649, - KEYCODE_KBDILLUM_DOWN: 2650, - KEYCODE_KBDILLUM_UP: 2651, - KEYCODE_SEND: 2652, - KEYCODE_REPLY: 2653, - KEYCODE_FORWARDMAIL: 2654, - KEYCODE_SAVE: 2655, - KEYCODE_DOCUMENTS: 2656, - KEYCODE_VIDEO_NEXT: 2657, - KEYCODE_VIDEO_PREV: 2658, - KEYCODE_BRIGHTNESS_CYCLE: 2659, - KEYCODE_BRIGHTNESS_ZERO: 2660, - KEYCODE_DISPLAY_OFF: 2661, - KEYCODE_BTN_MISC: 2662, - KEYCODE_GOTO: 2663, - KEYCODE_INFO: 2664, - KEYCODE_PROGRAM: 2665, - KEYCODE_PVR: 2666, - KEYCODE_SUBTITLE: 2667, - KEYCODE_FULL_SCREEN: 2668, - KEYCODE_KEYBOARD: 2669, - KEYCODE_ASPECT_RATIO: 2670, - KEYCODE_PC: 2671, - KEYCODE_TV: 2672, - KEYCODE_TV2: 2673, - KEYCODE_VCR: 2674, - KEYCODE_VCR2: 2675, - KEYCODE_SAT: 2676, - KEYCODE_CD: 2677, - KEYCODE_TAPE: 2678, - KEYCODE_TUNER: 2679, - KEYCODE_PLAYER: 2680, - KEYCODE_DVD: 2681, - KEYCODE_AUDIO: 2682, - KEYCODE_VIDEO: 2683, - KEYCODE_MEMO: 2684, - KEYCODE_CALENDAR: 2685, - KEYCODE_RED: 2686, - KEYCODE_GREEN: 2687, - KEYCODE_YELLOW: 2688, - KEYCODE_BLUE: 2689, - KEYCODE_CHANNELUP: 2690, - KEYCODE_CHANNELDOWN: 2691, - KEYCODE_LAST: 2692, - KEYCODE_RESTART: 2693, - KEYCODE_SLOW: 2694, - KEYCODE_SHUFFLE: 2695, - KEYCODE_VIDEOPHONE: 2696, - KEYCODE_GAMES: 2697, - KEYCODE_ZOOMIN: 2698, - KEYCODE_ZOOMOUT: 2699, - KEYCODE_ZOOMRESET: 2700, - KEYCODE_WORDPROCESSOR: 2701, - KEYCODE_EDITOR: 2702, - KEYCODE_SPREADSHEET: 2703, - KEYCODE_GRAPHICSEDITOR: 2704, - KEYCODE_PRESENTATION: 2705, - KEYCODE_DATABASE: 2706, - KEYCODE_NEWS: 2707, - KEYCODE_VOICEMAIL: 2708, - KEYCODE_ADDRESSBOOK: 2709, - KEYCODE_MESSENGER: 2710, - KEYCODE_BRIGHTNESS_TOGGLE: 2711, - KEYCODE_SPELLCHECK: 2712, - KEYCODE_COFFEE: 2713, - KEYCODE_MEDIA_REPEAT: 2714, - KEYCODE_IMAGES: 2715, - KEYCODE_BUTTONCONFIG: 2716, - KEYCODE_TASKMANAGER: 2717, - KEYCODE_JOURNAL: 2718, - KEYCODE_CONTROLPANEL: 2719, - KEYCODE_APPSELECT: 2720, - KEYCODE_SCREENSAVER: 2721, - KEYCODE_ASSISTANT: 2722, - KEYCODE_KBD_LAYOUT_NEXT: 2723, - KEYCODE_BRIGHTNESS_MIN: 2724, - KEYCODE_BRIGHTNESS_MAX: 2725, - KEYCODE_KBDINPUTASSIST_PREV: 2726, - KEYCODE_KBDINPUTASSIST_NEXT: 2727, - KEYCODE_KBDINPUTASSIST_PREVGROUP: 2728, - KEYCODE_KBDINPUTASSIST_NEXTGROUP: 2729, - KEYCODE_KBDINPUTASSIST_ACCEPT: 2730, - KEYCODE_KBDINPUTASSIST_CANCEL: 2731, - KEYCODE_FRONT: 2800, - KEYCODE_SETUP: 2801, - KEYCODE_WAKEUP: 2802, - KEYCODE_SENDFILE: 2803, - KEYCODE_DELETEFILE: 2804, - KEYCODE_XFER: 2805, - KEYCODE_PROG1: 2806, - KEYCODE_PROG2: 2807, - KEYCODE_MSDOS: 2808, - KEYCODE_SCREENLOCK: 2809, - KEYCODE_DIRECTION_ROTATE_DISPLAY: 2810, - KEYCODE_CYCLEWINDOWS: 2811, - KEYCODE_COMPUTER: 2812, - KEYCODE_EJECTCLOSECD: 2813, - KEYCODE_ISO: 2814, - KEYCODE_MOVE: 2815, - KEYCODE_F13: 2816, - KEYCODE_F14: 2817, - KEYCODE_F15: 2818, - KEYCODE_F16: 2819, - KEYCODE_F17: 2820, - KEYCODE_F18: 2821, - KEYCODE_F19: 2822, - KEYCODE_F20: 2823, - KEYCODE_F21: 2824, - KEYCODE_F22: 2825, - KEYCODE_F23: 2826, - KEYCODE_F24: 2827, - KEYCODE_PROG3: 2828, - KEYCODE_PROG4: 2829, - KEYCODE_DASHBOARD: 2830, - KEYCODE_SUSPEND: 2831, - KEYCODE_HP: 2832, - KEYCODE_SOUND: 2833, - KEYCODE_QUESTION: 2834, - KEYCODE_CONNECT: 2836, - KEYCODE_SPORT: 2837, - KEYCODE_SHOP: 2838, - KEYCODE_ALTERASE: 2839, - KEYCODE_SWITCHVIDEOMODE: 2841, - KEYCODE_BATTERY: 2842, - KEYCODE_BLUETOOTH: 2843, - KEYCODE_WLAN: 2844, - KEYCODE_UWB: 2845, - KEYCODE_WWAN_WIMAX: 2846, - KEYCODE_RFKILL: 2847, - KEYCODE_CHANNEL: 3001, - KEYCODE_BTN_0: 3100, - KEYCODE_BTN_1: 3101, - KEYCODE_BTN_2: 3102, - KEYCODE_BTN_3: 3103, - KEYCODE_BTN_4: 3104, - KEYCODE_BTN_5: 3105, - KEYCODE_BTN_6: 3106, - KEYCODE_BTN_7: 3107, - KEYCODE_BTN_8: 3108, - KEYCODE_BTN_9: 3109, -} - -export function mockKeyCode() { - const keyCode = { - KeyCode, - } - return keyCode; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyEvent.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyEvent.js deleted file mode 100644 index 888f6432..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_keyEvent.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 Action = { - CANCEL: 0, - DOWN: 1, - UP: 2, -} - -export function mockKeyEvent() { - const Key = { - code: '[PC preview] unknow code', - pressedTime: '[PC preview] unknow pressedTime', - deviceId: '[PC preview] unknow deviceId', - } - const KeyEvent = { - action: '[PC preview] unknow action', - key: Key, - unicodeChar: '[PC preview] unknow unicodeChar', - keys: ['[PC preview] unknow Key'], - ctrlKey: '[PC preview] unknow ctrlKey', - altKey: '[PC preview] unknow altKey', - shiftKey: '[PC preview] unknow shiftKey', - logoKey: '[PC preview] unknow logoKey', - fnKey: '[PC preview] unknow fnKey', - capsLock: '[PC preview] unknow capsLock', - numLock: '[PC preview] unknow numLock', - scrollLock: '[PC preview] unknow scrollLock', - } - const keyEvent = { - Action, - } - return keyEvent; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_mouseEvent.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_mouseEvent.js deleted file mode 100644 index 7d7fd3bb..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_mouseEvent.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 Action = { - CANCEL: 0, - MOVE: 1, - BUTTON_DOWN: 2, - BUTTON_UP: 3, - AXIS_BEGIN: 4, - AXIS_UPDATE: 5, - AXIS_END: 6, -} - -export const Button = { - LEFT: 0, - MIDDLE: 1, - RIGHT: 2, - SIDE: 3, - EXTRA: 4, - FORWARD: 5, - BACK: 6, - TASK: 7, -} - -export const Axis = { - SCROLL_VERTICAL: 0, - SCROLL_HORIZONTAL: 1, - PINCH: 2, -} - -export function mockMouseEvent() { - const AxisValue = { - axis: '[PC preview] unknow axis', - value: '[PC preview] unknow value', - } - const MouseEvent = { - action: '[PC preview] unknow action', - screenX: '[PC preview] unknow screenX', - screenY: '[PC preview] unknow screenY', - windowX: '[PC preview] unknow windowX', - windowY: '[PC preview] unknow windowY', - rawDeltaX: '[PC preview] unknow rawDeltaX', - rawDeltaY: '[PC preview] unknow rawDeltaY', - button: '[PC preview] unknow button', - pressedButtons: ['[PC preview] unknow pressedButtons'], - axes: ['[PC preview] unknow axes'], - pressedKeys: ['[PC preview] unknow pressedKeys'], - ctrlKey: '[PC preview] unknow ctrlKey', - altKey: '[PC preview] unknow altKey', - shiftKey: '[PC preview] unknow shiftKey', - logoKey: '[PC preview] unknow logoKey', - fnKey: '[PC preview] unknow fnKey', - capsLock: '[PC preview] unknow capsLock', - numLock: '[PC preview] unknow numLock', - scrollLock: '[PC preview] unknow scrollLock', - } - const mouseEvent = { - Action, - Button, - Axis, - } - return mouseEvent; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_pointer.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_pointer.js deleted file mode 100644 index abae83d6..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_pointer.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 mockPointer() { - const pointer = { - setPointerVisible: function (...args) { - console.warn("multimodalInput.pointer.setPointerVisible 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isPointerVisible: function (...args) { - console.warn("multimodalInput.pointer.isPointerVisible 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) - }) - } - }, - }; - return pointer -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_touchEvent.js b/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_touchEvent.js deleted file mode 100644 index 76655570..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_multimodalInput_touchEvent.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 Action = { - CANCEL: 0, - DOWN: 1, - MOVE: 2, - UP: 3, -} - -export const ToolType = { - FINGER: 0, - PEN: 1, - RUBBER: 2, - BRUSH: 3, - PENCIL: 4, - AIRBRUSH: 5, - MOUSE: 6, - LENS: 7, -} - -export const SourceType = { - TOUCH_SCREEN: 0, - PEN: 1, - TOUCH_PAD: 2, - } - -export function mockTouchEvent() { - const Touch = { - id: '[PC preview] unknow id', - pressedTime: '[PC preview] unknow pressedTime', - screenX: '[PC preview] unknow screenX', - screenY: '[PC preview] unknow screenY', - windowX: '[PC preview] unknow windowX', - windowY: '[PC preview] unknow windowY', - pressure: '[PC preview] unknow pressure', - width: '[PC preview] unknow width', - height: '[PC preview] unknow height', - tiltX: '[PC preview] unknow tiltX', - tiltY: '[PC preview] unknow tiltY', - toolX: '[PC preview] unknow toolX', - toolY: '[PC preview] unknow toolY', - toolWidth: '[PC preview] unknow toolWidth', - toolHeight: '[PC preview] unknow toolHeight', - rawX: '[PC preview] unknow rawX', - rawY: '[PC preview] unknow rawY', - toolType: '[PC preview] unknow toolType', - } - const TouchEvent = { - action: '[PC preview] unknow action', - touch: '[PC preview] unknow Touch', - touches: ['[PC preview] unknow Touch'], - sourceType: '[PC preview] unknow SourceType', - } - const touchEvent = { - Action, - ToolType, - SourceType, - } - return touchEvent; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_net_connection.js b/runtime/main/extend/systemplugin/napi/ohos_net_connection.js deleted file mode 100644 index 14ae9d87..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_net_connection.js +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2021-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 NetCap = { - NET_CAPABILITY_MMS: 0, - NET_CAPABILITY_NOT_METERED: 11, - NET_CAPABILITY_INTERNET: 12, - NET_CAPABILITY_NOT_VPN: 15, - NET_CAPABILITY_VALIDATED: 16 -}; - -export const NetBearType = { - BEARER_CELLULAR: 0, - BEARER_WIFI: 1, - BEARER_ETHERNET: 3 -}; - -export function mockConnection() { - const NetSpecifier = { - netCapabilities: NetCapabilities, - bearerPrivateIdentifier: '[PC preview] unknow bearerPrivateIdentifier' - } - - const NetCapabilities = { - linkUpBandwidthKbps: '[PC preview] unknow linkUpBandwidthKbps', - linkDownBandwidthKbps: '[PC preview] unknow linkDownBandwidthKbps', - networkCap:[NetCap], - bearerTypes:[NetBearType] - } - - const ConnectionProperties = { - interfaceName: '[PC preview] unknow interfaceName', - domains: '[PC preview] unknow domains', - linkAddresses: [LinkAddress], - dnses: [NetAddress], - routes: [RouteInfo], - mtu: '[PC preview] unknow mtu' - } - - const LinkAddress = { - address: NetAddress, - prefixLength: '[PC preview] unknow prefixLength' - } - - const NetAddress = { - address: '[PC preview] unknow address', - family: '[PC preview] unknow family', - port: '[PC preview] unknow port' - } - - const RouteInfo = { - interface: '[PC preview] unknow interface', - destination: LinkAddress, - gateway: NetAddress, - hasGateway: '[PC preview] unknow hasGateway', - isDefaultRoute: '[PC preview] unknow isDefaultRoute' - } - - const NetConnection = { - on: function (...args) { - console.warn("NetConnection.on 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') { - if (args[0] === 'netAvailable') { - args[len - 1].call(this, NetHandle); - } else if (args[0] === 'netBlockStatusChange') { - var array = new Array(NetHandle, paramMock.paramBooleanMock); - args[len - 1].call(this, array); - } else if (args[0] === 'netCapabilitiesChange') { - var array = new Array(NetHandle, NetCapabilities); - args[len - 1].call(this, array); - } else if (args[0] === 'netConnectionPropertiesChange') { - var array = new Array(NetHandle, ConnectionProperties); - args[len - 1].call(this, array); - } else if (args[0] === 'netLost') { - args[len - 1].call(this, NetHandle); - } else if (args[0] === 'netUnavailable') { - args[len - 1].call(this); - } - } - }, - - register: function (...args) { - console.warn("NetConnection.register 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) - } - }, - - unregister: function (...args) { - console.warn("NetConnection.unregister 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) - } - } - } - - const NetHandle = { - netId: '[PC preview] unknow netId', - - getAddressesByName: function (...args) { - console.warn("NetHandle.getAddressesByName 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, [NetAddress]) - } else { - return new Promise((resolve, reject) => { - resolve([NetAddress]) - }) - } - }, - - getAddressByName: function (...args) { - console.warn("NetHandle.getAddressByName 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, NetAddress) - } else { - return new Promise((resolve, reject) => { - resolve(NetAddress) - }) - } - } - } - - const connection = { - NetCap, - NetBearType, - createNetConnection: function () { - console.warn("connection.createNetConnection interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return NetConnection; - }, - - getDefaultNet: function (...args) { - console.warn("connection.getDefaultNet 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, NetHandle) - } else { - return new Promise((resolve) => { - resolve(NetHandle) - }) - } - }, - - getAllNets: function (...args) { - console.warn("connection.getAllNets 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, [NetHandle]) - } else { - return new Promise((resolve) => { - resolve([NetHandle]) - }) - } - }, - - getConnectionProperties: function (...args) { - console.warn("connection.getConnectionProperties 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, ConnectionProperties) - } else { - return new Promise((resolve) => { - resolve(ConnectionProperties) - }) - } - }, - - getNetCapabilities: function (...args) { - console.warn("connection.getNetCapabilities 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, NetCapabilities) - } else { - return new Promise((resolve) => { - resolve(NetCapabilities) - }) - } - }, - - hasDefaultNet: function (...args) { - console.warn("connection.hasDefaultNet 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) - }) - } - }, - - enableAirplaneMode: function (...args) { - console.warn("connection.enableAirplaneMode 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - disableAirplaneMode: function (...args) { - console.warn("connection.disableAirplaneMode 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - reportNetConnected: function (...args) { - console.warn("connection.reportNetConnected 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - reportNetDisconnected: function (...args) { - console.warn("connection.reportNetDisconnected 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - getAddressesByName: function (...args) { - console.warn("connection.getAddressesByName 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, [NetAddress]) - } else { - return new Promise((resolve) => { - resolve([NetAddress]) - }) - } - }, - }; - - return connection; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_net_http.js b/runtime/main/extend/systemplugin/napi/ohos_net_http.js deleted file mode 100644 index 74c949c4..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_net_http.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2021 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 RequestMethod = { - OPTIONS: "OPTIONS", - GET: "GET", - HEAD: "HEAD", - POST: "POST", - PUT: "PUT", - DELETE: "DELETE", - TRACE: "TRACE", - CONNECT: "CONNECT" -}; - -export const ResponseCode = { - OK: 200, - CREATED: 201, - ACCEPTED: 202, - NOT_AUTHORITATIVE: 203, - NO_CONTENT: 204, - RESET: 205, - PARTIAL: 206, - MULT_CHOICE: 300, - MOVED_PERM: 301, - MOVED_TEMP: 302, - SEE_OTHER: 303, - NOT_MODIFIED: 304, - USE_PROXY: 305, - BAD_REQUEST: 400, - UNAUTHORIZED: 401, - PAYMENT_REQUIRED: 402, - FORBIDDEN: 403, - NOT_FOUND: 404, - BAD_METHOD: 405, - NOT_ACCEPTABLE: 406, - PROXY_AUTH: 407, - CLIENT_TIMEOUT: 408, - CONFLICT: 409, - GONE: 410, - LENGTH_REQUIRED: 411, - PRECON_FAILED: 412, - ENTITY_TOO_LARGE: 413, - REQ_TOO_LONG: 414, - UNSUPPORTED_TYPE: 415, - INTERNAL_ERROR: 500, - NOT_IMPLEMENTED: 501, - BAD_GATEWAY: 502, - UNAVAILABLE: 503, - GATEWAY_TIMEOUT: 504, - VERSION: 505 -}; - -export function mockHttp() { - const HttpResponse = { - result: "[PC Preview] unknow result", - responseCode: ResponseCode, - header: "[PC Preview] unknow header", - cookies: "[PC Preview] unknow cookies" - } - const HttpRequest = { - request: function (...args) { - console.warn("HttpRequest.request 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, HttpResponse); - } else { - return new Promise((resolve, reject) => { - resolve(HttpResponse); - }) - } - }, - destroy: function () { - console.warn("HttpRequest.destroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("HttpRequest.on 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') { - if (args[0] === 'headerReceive') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'headersReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } - } - }, - off: function (...args) { - console.warn("HttpRequest.off 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') { - if (args[0] === 'headerReceive') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'headersReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } - } - }, - once: function (...args) { - console.warn("HttpRequest.once 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.paramObjectMock); - } - } - } - - const HttpRequestOptions = { - method: RequestMethod, - extraData: "[PC Preview] unknow extraData", - header: "[PC Preview] unknow header", - readTimeout: "[PC Preview] unknow readTimeout", - connectTimeout: "[PC Preview] unknow connectTimeout" - } - - const http = { - RequestMethod, - ResponseCode, - createHttp: function () { - console.warn("net.http.createHttp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HttpRequest; - }, - } - - return http; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_net_socket.js b/runtime/main/extend/systemplugin/napi/ohos_net_socket.js deleted file mode 100644 index c889c7e9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_net_socket.js +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2021 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 mockSocket() { - const SocketStateBase = { - isBound: "[PC Preview] unknow isBound", - isClose: "[PC Preview] unknow isClose", - isConnected: "[PC Preview] unknow isConnected" - } - - const SocketRemoteInfo = { - address: "[PC Preview] unknow address", - family: "[PC Preview] unknow family", - port: "[PC Preview] unknow port", - size: "[PC Preview] unknow size" - } - - const NetAddress = { - address: "[PC Preview] unknow saddressize", - family: "[PC Preview] unknow family", - port: "[PC Preview] unknow port " - } - - const UDPSocket = { - bind: function (...args) { - console.warn("UDPSocket.bind 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - send: function (...args) { - console.warn("UDPSocket.send 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - close: function (...args) { - console.warn("UDPSocket.close 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getState: function (...args) { - console.warn("UDPSocket.getState 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, SocketStateBase) - } else { - return new Promise((resolve, reject) => { - resolve(SocketStateBase); - }) - } - }, - setExtraOptions: function (...args) { - console.warn("UDPSocket.setExtraOptions 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("UDPSocket.on 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') { - if (args[0] === 'message') { - args[len - 1].call(this, {ArrayBuffer, SocketRemoteInfo}); - } else if (args[0] === 'listening') { - args[len - 1].call(this); - } else if (args[0] === 'close') { - args[len - 1].call(this); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("UDPSocket.off 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') { - if (args[0] === 'message') { - args[len - 1].call(this, {ArrayBuffer, SocketRemoteInfo}); - } else if (args[0] === 'listening') { - args[len - 1].call(this); - } else if (args[0] === 'close') { - args[len - 1].call(this); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - - const TCPSocket = { - bind: function (...args) { - console.warn("TcpSocket.bind 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - connect: function (...args) { - console.warn("TcpSocket.connect 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - send: function (...args) { - console.warn("TcpSocket.send 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - close: function (...args) { - console.warn("TcpSocket.close 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getRemoteAddress: function (...args) { - console.warn("TcpSocket.getRemoteAddress 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, NetAddress) - } else { - return new Promise((resolve, reject) => { - resolve(NetAddress); - }) - } - }, - getState: function (...args) { - console.warn("TcpSocket.getState 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, SocketStateBase) - } else { - return new Promise((resolve, reject) => { - resolve(SocketStateBase); - }) - } - }, - setExtraOptions: function (...args) { - console.warn("TcpSocket.setExtraOptions 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("TcpSocket.on 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') { - if (args[0] === 'message') { - args[len - 1].call(this, {ArrayBuffer, SocketRemoteInfo}); - } else if (args[0] === 'connect') { - args[len - 1].call(this); - } else if (args[0] === 'close') { - args[len - 1].call(this); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("TcpSocket.off 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') { - if (args[0] === 'message') { - args[len - 1].call(this, {ArrayBuffer, SocketRemoteInfo}); - } else if (args[0] === 'connect') { - args[len - 1].call(this); - } else if (args[0] === 'close') { - args[len - 1].call(this); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - - const UDPSendOptions = { - data: "[PC Preview] unknow data", - address: NetAddress - } - - const ExtraOptionsBase = { - receiveBufferSize: "[PC Preview] unknow receiveBufferSize", - sendBufferSize: "[PC Preview] unknow sendBufferSize", - reuseAddress: "[PC Preview] unknow reuseAddress", - socketTimeout: "[PC Preview] unknow socketTimeout" - } - - const UDPExtraOptions = { - broadcast: "[PC Preview] unknow broadcast" - } - - const TCPConnectOptions = { - address: NetAddress, - timeout: "[PC Preivew] unknow timeout", - } - - const TCPSendOptions = { - data: "[PC Preview] unknow data", - encoding: "[PC Preview] unknow encoding", - } - - const TCPExtraOptions = { - keepAlive: "[PC Preview] unknow keepAlive", - OOBInline: "[PC Preview] unknow OOBInline", - TCPNoDelay: "[PC Preview] unknow TCPNoDelay", - socketLinger: { - on: "[PC Preview] unknow on", - linger: "[PC Preview] unknow linger" - } - } - const socket = { - constructUDPSocketInstance: function () { - console.warn("net.socket.constructUDPSocketInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return UDPSocket; - }, - constructTCPSocketInstance: function () { - console.warn("net.socket.constructTCPSocketInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return TCPSocket; - } - } - - return socket; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_net_webSocket.js b/runtime/main/extend/systemplugin/napi/ohos_net_webSocket.js deleted file mode 100644 index eb88c7dc..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_net_webSocket.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2021 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 mockWebSocket() { - const WebSocketRequestOptions = { - header: "[PC Preview] unknow header" - } - const WebSocketCloseOptions = { - code: "[PC Preview] unknow code", - reason: "[PC Preview] unknow reason" - } - const WebSocketMock = { - connect: function (...args) { - console.warn("WebSocket.connect 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - send: function (...args) { - console.warn("WebSocket.send 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - close: function (...args) { - console.warn("WebSocket.close 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - on: function (...args) { - console.warn("WebSocket.on 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') { - if (args[0] === 'open') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'message') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else if (args[0] === 'close') { - args[len - 1].call(this, paramMock.businessErrorMock, { - code: "[PC Preview] unknow code", - reason: "[PC Preview] unknow reason" - }); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("WebSocket.off 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') { - if (args[0] === 'open') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'message') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else if (args[0] === 'close') { - args[len - 1].call(this, paramMock.businessErrorMock, { - code: "[PC Preview] unknow code", - reason: "[PC Preview] unknow reason" - }); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - const webSocket = { - createWebSocket: function () { - console.warn("net.webSocket.createWebSocket interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebSocketMock; - } - } - return webSocket -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_network.js b/runtime/main/extend/systemplugin/napi/ohos_network.js deleted file mode 100644 index e1933456..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_network.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 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 mockNetwork() { - const data = { - metered: true, - type: "5g" - } - const network = { - getType: function (...args) { - console.warn("network.getType interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success(data) - args[0].complete() - }, - subscribe: function (...args) { - console.warn("network.subscribe interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (!this.unsubscribeNetwork) { - this.unsubscribeNetwork = setInterval(() => { - args[0].success(data) - }, 3000) - } - }, - unsubscribe: function () { - console.warn("network.unsubscribe interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - clearInterval(this.unsubscribeNetwork) - delete this.unsubscribeNetwork - } - } - return network -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_nfc_cardEmulation.js b/runtime/main/extend/systemplugin/napi/ohos_nfc_cardEmulation.js deleted file mode 100644 index 7df508a2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_nfc_cardEmulation.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021 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 mockNfcCardEmulation() { - const cardEmulation = { - isSupported: function (...args) { - console.warn("nfc.cardEmulation.isSupported interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_nfc_controller.js b/runtime/main/extend/systemplugin/napi/ohos_nfc_controller.js deleted file mode 100644 index 466f4650..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_nfc_controller.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 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 mockController() { - const controller = { - isNfcAvailable: function (...args) { - console.warn("nfc.controller.isNfcAvailable interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isNfcOpen: function (...args) { - console.warn("nfc.controller.isNfcOpen interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - on: function (...args) { - console.warn("nfc.controller.on interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - off: function (...args) { - console.warn("nfc.controller.off interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - getNfcState: function (...args) { - console.warn("nfc.controller.getNfcState interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - } - return controller -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_nfc_tag.js b/runtime/main/extend/systemplugin/napi/ohos_nfc_tag.js deleted file mode 100644 index 37a8050b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_nfc_tag.js +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2021 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 mockTag() { - const NfcATagMock = { - getTagInfo: function (...args) { - console.warn("NfcATag.getTagInfo interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return TagInfoMock; - }, - connectTag: function (...args) { - console.warn("NfcATag.connectTag interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - reset: function (...args) { - console.warn("NfcATag.reset interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - isTagConnected: function (...args) { - console.warn("NfcATag.isTagConnected interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setSendDataTimeout: function (...args) { - console.warn("NfcATag.setSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSendDataTimeout: function (...args) { - console.warn("NfcATag.getSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - sendData: function (...args) { - console.warn("NfcATag.sendData 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.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } - }, - getMaxSendLength: function (...args) { - console.warn("NfcATag.getMaxSendLength interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getSak: function (...args) { - console.warn("NfcATag.getSak interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getAtqa: function () { - console.warn("NfcATag.getAtqa interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramNumberMock]; - }, - } - const NfcBTagMock = { - getTagInfo: function (...args) { - console.warn("NfcBTag.getTagInfo interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return TagInfoMock; - }, - connectTag: function (...args) { - console.warn("NfcBTag.connectTag interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - reset: function (...args) { - console.warn("NfcBTag.reset interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - isTagConnected: function (...args) { - console.warn("NfcBTag.isTagConnected interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setSendDataTimeout: function (...args) { - console.warn("NfcBTag.setSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSendDataTimeout: function (...args) { - console.warn("NfcBTag.getSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - sendData: function (...args) { - console.warn("NfcBTag.sendData 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.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } - }, - getMaxSendLength: function (...args) { - console.warn("NfcBTag.getMaxSendLength interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getRespAppData: function (...args) { - console.warn("NfcBTag.getRespAppData interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramNumberMock]; - }, - getRespProtocol: function () { - console.warn("NfcBTag.getRespProtocol interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramNumberMock]; - }, - } - const NfcFTagMock = { - getTagInfo: function (...args) { - console.warn("NfcFTag.getTagInfo interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return TagInfoMock; - }, - connectTag: function (...args) { - console.warn("NfcFTag.connectTag interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - reset: function (...args) { - console.warn("NfcFTag.reset interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - isTagConnected: function (...args) { - console.warn("NfcFTag.isTagConnected interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setSendDataTimeout: function (...args) { - console.warn("NfcFTag.setSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSendDataTimeout: function (...args) { - console.warn("NfcFTag.getSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - sendData: function (...args) { - console.warn("NfcFTag.sendData 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.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } - }, - getMaxSendLength: function (...args) { - console.warn("NfcFTag.getMaxSendLength interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getSystemCode: function (...args) { - console.warn("NfcFTag.getSystemCode interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramNumberMock]; - }, - getPmm: function () { - console.warn("NfcFTag.getPmm interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramNumberMock]; - }, - } - const NfcVTagMock = { - getTagInfo: function (...args) { - console.warn("NfcVTag.getTagInfo interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return TagInfoMock; - }, - connectTag: function (...args) { - console.warn("NfcVTag.connectTag interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - reset: function (...args) { - console.warn("NfcVTag.reset interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - isTagConnected: function (...args) { - console.warn("NfcVTag.isTagConnected interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setSendDataTimeout: function (...args) { - console.warn("NfcVTag.setSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getSendDataTimeout: function (...args) { - console.warn("NfcVTag.getSendDataTimeout interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - sendData: function (...args) { - console.warn("NfcVTag.sendData 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.paramNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paramNumberMock]); - }) - } - }, - getMaxSendLength: function (...args) { - console.warn("NfcVTag.getMaxSendLength interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getResponseFlags: function (...args) { - console.warn("NfcVTag.getResponseFlags interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getDsfId: function () { - console.warn("NfcVTag.getDsfId interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - } - const tag = { - getNfcATag: function (...args) { - console.warn("nfc.tag.getNfcATag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return NfcATagMock; - }, - getNfcBTag: function (...args) { - console.warn("nfc.tag.getNfcBTag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return NfcBTagMock; - }, - getNfcFTag: function (...args) { - console.warn("nfc.tag.getNfcFTag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return NfcFTagMock; - }, - getNfcVTag: function (...args) { - console.warn("nfc.tag.getNfcVTag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return NfcVTagMock; - }, - } - return tag -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_notification.js b/runtime/main/extend/systemplugin/napi/ohos_notification.js deleted file mode 100644 index cab703c9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_notification.js +++ /dev/null @@ -1,793 +0,0 @@ -/* - * Copyright (c) 2021-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 { NotificationSlot } from "./notification/notificationSlot" -import { NotificationRequest } from "./notification/notificationRequest" - -export const SlotType = { - UNKNOWN_TYPE: 0, - SOCIAL_COMMUNICATION: 1, - SERVICE_INFORMATION: 2, - CONTENT_INFORMATION: 3, - OTHER_TYPES: 0xFFFF, -} -export const ContentType = { - NOTIFICATION_CONTENT_BASIC_TEXT: 0, - NOTIFICATION_CONTENT_LONG_TEXT: 1, - NOTIFICATION_CONTENT_PICTURE: 2, - NOTIFICATION_CONTENT_CONVERSATION: 3, - NOTIFICATION_CONTENT_MULTILINE: 4, -} -export const SlotLevel = { - LEVEL_NONE: 0, - LEVEL_MIN: 1, - LEVEL_LOW: 2, - LEVEL_DEFAULT: 3, - LEVEL_HIGH: 4, -} -export const BundleOption = { - bundle: '[PC preview] unknow bundle', - uid: '[PC preview] unknow uid', -} -export const NotificationKey = { - id: '[PC preview] unknow id', - label: '[PC preview] unknow label', -} -export const DoNotDisturbType = { - TYPE_NONE: 0, - TYPE_ONCE: 1, - TYPE_DAILY: 2, - TYPE_CLEARLY: 3, -} -const Date = { - toString: function () { - console.warn("Date.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toDateString: function () { - console.warn("Date.toDateString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toTimeString: function () { - console.warn("Date.toTimeString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toLocaleString: function () { - console.warn("Date.toLocaleString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toLocaleDateString: function () { - console.warn("Date.toLocaleDateString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toLocaleTimeString: function () { - console.warn("Date.toLocaleTimeString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - valueOf: function () { - console.warn("Date.valueOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getTime: function () { - console.warn("Date.getTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getFullYear: function () { - console.warn("Date.getFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCFullYear: function () { - console.warn("Date.getUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getMonth: function () { - console.warn("Date.getMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCMonth: function () { - console.warn("Date.getUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getDate: function () { - console.warn("Date.getDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCDate: function () { - console.warn("Date.getUTCDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getDay: function () { - console.warn("Date.getDay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCDay: function () { - console.warn("Date.getUTCDay interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getHours: function () { - console.warn("Date.getHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCHours: function () { - console.warn("Date.getUTCHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getMinutes: function () { - console.warn("Date.getMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCMinutes: function () { - console.warn("Date.getUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getSeconds: function () { - console.warn("Date.getSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCSeconds: function () { - console.warn("Date.getUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getMilliseconds: function () { - console.warn("Date.getMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getUTCMilliseconds: function () { - console.warn("Date.getUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getTimezoneOffset: function () { - console.warn("Date.getTimezoneOffset interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setTime: function (...args) { - console.warn("Date.setTime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setMilliseconds: function (...args) { - console.warn("Date.setMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCMilliseconds: function (...args) { - console.warn("Date.setUTCMilliseconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setSeconds: function (...args) { - console.warn("Date.setSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCSeconds: function (...args) { - console.warn("Date.setUTCSeconds interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setMinutes: function (...args) { - console.warn("Date.setMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCMinutes: function (...args) { - console.warn("Date.setUTCMinutes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setHours: function (...args) { - console.warn("Date.setHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCHours: function (...args) { - console.warn("Date.setUTCHours interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setDate: function (...args) { - console.warn("Date.setDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCDate: function (...args) { - console.warn("Date.setUTCDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setMonth: function (...args) { - console.warn("Date.setMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCMonth: function (...args) { - console.warn("Date.setUTCMonth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setFullYear: function (...args) { - console.warn("Date.setFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - setUTCFullYear: function (...args) { - console.warn("Date.setUTCFullYear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock - }, - toUTCString: function () { - console.warn("Date.toUTCString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toISOString: function () { - console.warn("Date.toISOString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, - toJSON: function (...args) { - console.warn("Date.toJSON interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock - }, -} -export const DoNotDisturbDate = { - type: DoNotDisturbType, - begin: Date, - end: Date, -} -export const DeviceRemindType = { - IDLE_DONOT_REMIND: 0, - IDLE_REMIND: 1, - ACTIVE_DONOT_REMIND: 2, - ACTIVE_REMIND: 3, -} -export const SourceType = { - TYPE_NORMAL: 0, - TYPE_CONTINUOUS: 1, - TYPE_TIMER: 2, -} -export function mockNotification() { - const notification = { - publish: function (...args) { - console.warn('notification.publish 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - publishAsBundle: function (...args) { - console.warn('notification.publishAsBundle 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - cancel: function (...args) { - console.warn('notification.cancel 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - cancelAsBundle: function (...args) { - console.warn('notification.cancelAsBundle 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - cancelAll: function (...args) { - console.warn('notification.cancelAll 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - addSlot: function (...args) { - console.warn('notification.addSlot 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - addSlots: function (...args) { - console.warn('notification.addSlots 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getSlot: function (...args) { - console.warn('notification.getSlot 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, NotificationSlot); - } else { - return new Promise((resolve) => { - resolve(NotificationSlot); - }); - } - }, - getSlots: function (...args) { - console.warn('notification.getSlots 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, [NotificationSlot]); - } else { - return new Promise((resolve) => { - resolve([NotificationSlot]); - }); - } - }, - removeSlot: function (...args) { - console.warn('notification.removeSlot 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - removeAllSlots: function (...args) { - console.warn('notification.removeAllSlots 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - SlotType, - ContentType, - SlotLevel, - subscribe: function (...args) { - console.warn('notification.subscribe 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - unsubscribe: function (...args) { - console.warn('notification.unsubscribe 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - enableNotification: function (...args) { - console.warn('notification.enableNotification 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isNotificationEnabled: function (...args) { - console.warn('notification.isNotificationEnabled 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); - }); - } - }, - displayBadge: function (...args) { - console.warn('notification.displayBadge 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isBadgeDisplayed: function (...args) { - console.warn('notification.isBadgeDisplayed 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); - }); - } - }, - setSlotByBundle: function (...args) { - console.warn('notification.setSlotByBundle 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getSlotsByBundle: function (...args) { - console.warn('notification.getSlotsByBundle 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, [NotificationSlot]); - } else { - return new Promise((resolve) => { - resolve([NotificationSlot]); - }); - } - }, - getSlotNumByBundle: function (...args) { - console.warn('notification.getSlotNumByBundle 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - remove: function (...args) { - console.warn('notification.remove 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - removeAll: function (...args) { - console.warn('notification.removeAll 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAllActiveNotifications: function (...args) { - console.warn('notification.getAllActiveNotifications 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, [NotificationRequest]); - } else { - return new Promise((resolve) => { - resolve([NotificationRequest]); - }); - } - }, - getActiveNotificationCount: function (...args) { - console.warn('notification.getActiveNotificationCount 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getActiveNotifications: function (...args) { - console.warn('notification.getActiveNotifications 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, [NotificationRequest]); - } else { - return new Promise((resolve) => { - resolve([NotificationRequest]); - }); - } - }, - cancelGroup: function (...args) { - console.warn("notification.cancelGroup 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeGroupByBundle: function (...args) { - console.warn("notification.removeGroupByBundle 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setDoNotDisturbDate: function (...args) { - console.warn("notification.setDoNotDisturbDate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getDoNotDisturbDate: function (...args) { - console.warn("notification.getDoNotDisturbDate 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, DoNotDisturbDate); - } else { - return new Promise((resolve, reject) => { - resolve(DoNotDisturbDate); - }) - } - }, - supportDoNotDisturbMode: function (...args) { - console.warn("notification.supportDoNotDisturbMode 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isSupportTemplate: function (...args) { - console.warn("notification.isSupportTemplate 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - requestEnableNotification: function (...args) { - console.warn("notification.requestEnableNotification 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableDistributed: function (...args) { - console.warn("notification.enableDistributed 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isDistributedEnabled: function (...args) { - console.warn("notification.isDistributedEnabled 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableDistributedByBundle: function (...args) { - console.warn("notification.enableDistributedByBundle 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isDistributedEnabledByBundle: function (...args) { - console.warn("notification.isDistributedEnabledByBundle 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getDeviceRemindType: function (...args) { - console.warn("notification.getDeviceRemindType 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, DeviceRemindType); - } else { - return new Promise((resolve, reject) => { - resolve(DeviceRemindType); - }) - } - }, - isNotificationSlotEnabled: function (...args) { - console.warn("notification.isNotificationSlotEnabled 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSyncNotificationEnabledForUninstallApp: function (...args) { - console.warn("notification.setSyncNotificationEnabledForUninstallApp 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableNotificationSlot: function (...args) { - console.warn("notification.enableNotificationSlot 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getSyncNotificationEnabledForUninstallApp: function (...args) { - console.warn("notification.getSyncNotificationEnabledForUninstallApp 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - BundleOption, - NotificationKey, - DoNotDisturbType, - DoNotDisturbDate, - DeviceRemindType, - SourceType - } - return notification -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_pasteboard.js b/runtime/main/extend/systemplugin/napi/ohos_pasteboard.js deleted file mode 100644 index abc91dff..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_pasteboard.js +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2021-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 { PixelMapMock } from "./ohos_multimedia_image.js" - -export function mockPasteBoard() { - const PasteDataMock = { - getPrimaryText: function () { - console.warn("PasteData.getPrimaryText interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - addHtmlRecord: function (...args) { - console.warn("PasteData.addHtmlRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - addWantRecord: function (...args) { - console.warn("PasteData.addWantRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - addRecord: function (...args) { - console.warn("PasteData.addRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - addTextRecord: function (...args) { - console.warn("PasteData.addTextRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - addUriRecord: function (...args) { - console.warn("PasteData.addUriRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - addPixelMapRecord: function (...args) { - console.warn("PasteData.addPixelMapRecord interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getMimeTypes: function () { - console.warn("PasteData.getMimeTypes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return new Array(paramMock.paramStringMock); - }, - getPrimaryHtml: function () { - console.warn("PasteData.getPrimaryHtml interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getPrimaryWant: function () { - console.warn("PasteData.getPrimaryWant interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return "[PC Preview] unknow getPrimaryWant" - }, - getPrimaryMimeType: function () { - console.warn("PasteData.getPrimaryMimeType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getPrimaryUri: function () { - console.warn("PasteData.getPrimaryUri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getPrimaryPixelMap: function () { - console.warn("PasteData.getPrimaryPixelMap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return PixelMapMock - }, - getProperty: function () { - console.warn("PasteData.getProperty interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return PasteDataPropertyMock; - }, - setProperty: function () { - console.warn("PasteData.setProperty interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getRecordAt: function (...args) { - console.warn("PasteData.getRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - getRecordCount: function () { - console.warn("PasteData.getRecordCount interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getTag: function () { - console.warn("PasteData.getTag interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - hasMimeType: function (...args) { - console.warn("PasteData.hasMimeType interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - removeRecordAt: function (...args) { - console.warn("PasteData.removeRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - replaceRecordAt: function (...args) { - console.warn("PasteData.replaceRecordAt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - } - } - const PasteDataRecordMock = { - htmlText: '[PC preview] unknow htmlText', - want: '[PC preview] unknow want', - mimeType: '[PC preview] unknow mimeType', - plainText: '[PC preview] unknow plainText', - uri: '[PC preview] unknow uri', - pixelMap: PixelMapMock, - data: {'mock_xml': new ArrayBuffer()}, - convertToText: function (...args) { - console.warn("PasteDataRecord.convertToText 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - const pasteboard = { - ShareOption: { - InApp: "[PC Preview] unknown InApp", - LocalDevice: "[PC Preview] unknown LocalDevice", - CrossDevice: "[PC Preview] unknown CrossDevice" - }, - MAX_RECORD_NUM: '[PC preview] unknow MAX_RECORD_NUM', - MIMETYPE_TEXT_HTML: '[PC preview] unknow MIMETYPE_TEXT_HTML11111', - MIMETYPE_TEXT_WANT: '[PC preview] unknow MIMETYPE_TEXT_WANT', - MIMETYPE_TEXT_PLAIN: '[PC preview] unknow MIMETYPE_TEXT_PLAIN', - MIMETYPE_TEXT_URI: '[PC preview] unknow MIMETYPE_TEXT_URI', - MIMETYPE_PIXELMAP: '[PC preview] unknow MIMETYPE_PIXELMAP', - createPlainTextData: function (...args) { - console.warn("pasteboard.createPlainTextData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createHtmlData: function (...args) { - console.warn("pasteboard.createHtmlData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createUriData: function (...args) { - console.warn("pasteboard.createUriData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createPixelMapData: function (...args) { - console.warn("pasteboard.createPixelMapData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createData: function (...args) { - console.warn("pasteboard.createData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createWantData: function (...args) { - console.warn("pasteboard.createWantData interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataMock; - }, - createHtmlTextRecord: function (...args) { - console.warn("pasteboard.createHtmlTextRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createWantRecord: function (...args) { - console.warn("pasteboard.createWantRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createUriRecord: function (...args) { - console.warn("pasteboard.createUriRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createPixelMapRecord: function (...args) { - console.warn("pasteboard.createPixelMapRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createRecord: function (...args) { - console.warn("pasteboard.createRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - createPlainTextRecord: function (...args) { - console.warn("pasteboard.createPlainTextRecord interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return PasteDataRecordMock; - }, - getSystemPasteboard: function () { - console.warn("pasteboard.getSystemPasteboard interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return SystemPasteboardMock; - } - } - const PasteDataPropertyMock = { - additions: '[PC preview] unknow additions', - mimeTypes: new Array('[PC preview] unknow MIMETYPE_TEXT_PLAIN'), - tag: '[PC preview] unknow tag', - timestamp: '[PC preview] unknow timestamp', - localOnly: '[PC preview] unknow localOnly', - shareOption: pasteboard.ShareOption - } - const SystemPasteboardMock = { - on: function (...args) { - console.warn("SystemPasteboard.on 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') { - if (args[0] == 'update') { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("SystemPasteboard.off 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') { - if (args[0] == 'update') { - args[len - 1].call(this); - } - } - }, - clear: function (...args) { - console.warn("SystemPasteboard.clear 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hasPasteData: function (...args) { - console.warn("SystemPasteboard.hasPasteData 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getPasteData: function (...args) { - console.warn("SystemPasteboard.getPasteData 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, PasteDataMock) - } else { - return new Promise((resolve, reject) => { - resolve(PasteDataMock); - }) - } - }, - setPasteData: function (...args) { - console.warn("SystemPasteboard.setPasteData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return pasteboard -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_power.js b/runtime/main/extend/systemplugin/napi/ohos_power.js deleted file mode 100644 index c60b7b09..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_power.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2021 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 mockPower() { - const DevicePowerMode = { - MODE_PERFORMANCE: '[PC preview] unknow MODE_PERFORMANCE', - MODE_NORMAL: '[PC preview] unknow MODE_NORMAL', - MODE_POWER_SAVE: '[PC preview] unknow MODE_POWER_SAVE', - MODE_EXTREME_POWER_SAVE: '[PC preview] unknow MODE_EXTREME_POWER_SAVE', - } - const power = { - DevicePowerMode, - shutdownDevice: function (...args) { - console.warn("power.shutdownDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - rebootDevice: function (...args) { - console.warn("power.rebootDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isScreenOn: function (...args) { - console.warn("power.isScreenOn 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - wakeupDevice: function (...args) { - console.warn("power.wakeupDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - suspendDevice: function (...args) { - console.warn("power.suspendDevice interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getPowerMode: function (...args) { - console.warn("power.getPowerMode 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, DevicePowerMode); - } else { - return new Promise((resolve, reject) => { - resolve(DevicePowerMode); - }) - } - }, - setPowerMode: function (...args) { - console.warn("power.setPowerMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - return power -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_privacyManager.js b/runtime/main/extend/systemplugin/napi/ohos_privacyManager.js deleted file mode 100644 index 2b2dda1a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_privacyManager.js +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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 mockPrivacyManager() { - const PermissionUsedRequestMock = { - tokenId: "[PC Preview] unknown tokenId", - isRemote: "[PC Preview] unknown isRemote", - deviceId: "[PC Preview] unknown deviceId", - bundleName: "[PC Preview] unknown bundleName", - permissionNames: "[PC Preview] unknown permissionNames", - beginTime: "[PC Preview] unknown beginTime", - endTime: "[PC Preview] unknown endTime", - flag: "[PC Preview] unknown flag", - }; - const UsedRecordDetailMock = { - status: "[PC Preview] unknown status", - timestamp: "[PC Preview] unknown timestamp", - accessDuration: "[PC Preview] unknown accessDuration", - }; - const PermissionUsedRecordMock = { - permissionName: "[PC Preview] unknown permissionName", - accessCount: "[PC Preview] unknown accessCount", - rejectCount: "[PC Preview] unknown rejectCount", - lastAccessTime: "[PC Preview] unknown lastAccessTime", - lastRejectTime: "[PC Preview] unknown lastRejectTime", - lastAccessDuration: "[PC Preview] unknown lastAccessDuration", - accessRecords: [UsedRecordDetailMock], - rejectRecords: [UsedRecordDetailMock], - }; - const BundleUsedRecordMock = { - tokenId: "[PC Preview] unknown tokenId", - isRemote: "[PC Preview] unknown isRemote", - deviceId: "[PC Preview] unknown deviceId", - bundleName: "[PC Preview] unknown bundleName", - permissionRecords: [PermissionUsedRecordMock] - }; - const PermissionUsedResponseMock = { - beginTime: '[PC preview] unknow beginTime', - endTime: '[PC preview] unknow endTime', - bundleRecords: [BundleUsedRecordMock], - }; - const PermissionActiveStatus = { - PERM_INACTIVE: 0, - PERM_ACTIVE_IN_FOREGROUND: 1, - PERM_ACTIVE_IN_BACKGROUND: 2, - }; - const ActiveChangeResponse = { - tokenId: "[PC Preview] unknown tokenId", - permissionName: "[PC Preview] unknown permissionName", - deviceId: "[PC Preview] unknown deviceId", - activeStatus: PermissionActiveStatus, - }; - const privacyManager = { - PermissionActiveStatus, - PermissionUsageFlag : { - FLAG_PERMISSION_USAGE_SUMMARY: 0, - FLAG_PERMISSION_USAGE_DETAIL: 1, - }, - - addPermissionUsedRecord: function (...args) { - console.warn("privacyManager.addPermissionUsedRecord 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getPermissionUsedRecords: function (...args) { - console.warn("privacyManager.getPermissionUsedRecords 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, PermissionUsedResponseMock) - } else { - return new Promise((resolve, reject) => { - resolve(PermissionUsedResponseMock); - }) - } - }, - startUsingPermission: function (...args) { - console.warn("privacyManager.startUsingPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - stopUsingPermission: function (...args) { - console.warn("privacyManager.stopUsingPermission 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - on: function (...args) { - console.warn("privacyManager.on 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, ActiveChangeResponse); - } - }, - off: function (...args) { - console.warn("privacyManager.off 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, ActiveChangeResponse); - } - }, - }; - return privacyManager; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_process.js b/runtime/main/extend/systemplugin/napi/ohos_process.js deleted file mode 100644 index f0bfa030..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_process.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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 mockProcess() { - const process = { - runCmd: function (...args) { - console.warn("process.runCmd interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ChildProcessMock; - }, - abort: function (...args) { - console.warn("process.abort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("process.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - off: function (...args) { - console.warn("process.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - exit: function (...args) { - console.warn("process.exit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - cwd: function (...args) { - console.warn("process.cwd interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - chdir: function (...args) { - console.warn("process.chdir interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - uptime: function (...args) { - console.warn("process.uptime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - kill: function (...args) { - console.warn("process.kill interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getStartRealtime: function (...args) { - console.warn("process.getStartRealtime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getPastCputime: function (...args) { - console.warn("process.getPastCputime interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getAvailableCores: function (...args) { - console.warn("process.getAvailableCores interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }, - isIsolatedProcess: function (...args) { - console.warn("process.isIsolatedProcess interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - is64Bit: function (...args) { - console.warn("process.is64Bit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isAppUid: function (...args) { - console.warn("process.isAppUid interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getUidForName: function (...args) { - console.warn("process.getUidForName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getThreadPriority: function (...args) { - console.warn("process.getThreadPriority interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getSystemConfig: function (...args) { - console.warn("process.getSystemConfig interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getEnvironmentVar: function (...args) { - console.warn("process.getEnvironmentVar interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - egid: '[PC preview] unknow egid', - euid: '[PC preview] unknow euid', - gid: '[PC preview] unknow gid', - uid: '[PC preview] unknow uid', - groups: '[PC preview] unknow groups', - pid: '[PC preview] unknow pid', - ppid: '[PC preview] unknow ppid', - tid: '[PC preview] unknow tid', - } - - const ChildProcessMock = { - pid: '[PC preview] unknow pid', - ppid: '[PC preview] unknow ppid', - exitCode: '[PC preview] unknow exitCode', - killed: '[PC preview] unknow killed', - wait: function (...args) { - console.warn("ChildProcess.wait 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(paramMock.paramNumberMock); - }) - }, - getOutput: function (...args) { - console.warn("ChildProcess.getOutput interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const arr = new Uint8Array() - return new Promise((resolve, reject) => { - resolve(arr); - }) - }, - getErrorOutput: function (...args) { - console.warn("ChildProcess.getErrorOutput interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const arr = new Uint8Array() - return new Promise((resolve, reject) => { - resolve(arr); - }) - }, - close: function (...args) { - console.warn("ChildProcess.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - kill: function (...args) { - console.warn("ChildProcess.kill interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } - return process; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_reminderAgent.js b/runtime/main/extend/systemplugin/napi/ohos_reminderAgent.js deleted file mode 100644 index 609b0a16..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_reminderAgent.js +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2021-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 mockReminderAgent() { - const infoMock = { - reminderId: "[PC preview] unknown reminderId", - info: "[PC preview] unknown info" - } - const reminderReq = { - reminderType: "[PC preview] unknown reminderType", - actionButton: [ - { - title: "[PC preview] unknown title", - type: "[PC preview] unknown type" - } - ], - wantAgent: { - pkgName: "[PC preview] unknown pkg nam", - abilityName: "[PC preview] unknown ability name" - }, - maxScreenWantAgent: { - pkgName: "[PC preview] unknown pkg name", - abilityName: "[PC preview] unknown ability name" - }, - ringDuration: "[PC preview] unknown ringDuration", - snoozeTimes: "[PC preview] unknown snoozeTimes", - timeInterval: "[PC preview] unknown timeInterval", - title: "[PC preview] unknown title", - content: "[PC preview] unknown content", - expiredContent: "[PC preview] unknown expiredContent", - snoozeContent: "[PC preview] unknown snoozeContent", - notificationId: "[PC preview] unknown notificationId", - slotType: "[PC preview] unknown slotType" - } - const reminderReqs = [ - reminderReq - ] - const ActionButton = { - title: "[PC preview] unknown title", - type: "[PC preview] unknown type" - } - const WantAgent = { - pkgName: "[PC preview] unknown pkgName", - abilityName: "[PC preview] unknown abilityName" - } - const MaxScreenWantAgent = { - pkgName: "[PC preview] unknown pkgName", - abilityName: "[PC preview] unknown abilityName" - } - const ReminderRequest = { - reminderType: "[PC preview] unknown reminderType", - actionButton: ActionButton, - wantAgent: WantAgent, - maxScreenWantAgent: MaxScreenWantAgent, - ringDuration: "[PC preview] unknown ringDuration", - snoozeTimes: "[PC preview] unknown snoozeTimes", - timeInterval: "[PC preview] unknown timeInterval", - title: "[PC preview] unknown title", - content: "[PC preview] unknown content", - expiredContent: "[PC preview] unknown expiredContent", - snoozeContent: "[PC preview] unknown snoozeContent", - notificationId: "[PC preview] unknown notificationId", - slotType: "[PC preview] unknown slotType" - } - const ReminderRequestCalendar = { - dateTime: LocalDateTime, - repeatMonths: "[PC preview] unknown repeatMonths", - repeatDays: "[PC preview] unknown repeatDays" - } - const ReminderRequestAlarm = { - hour: "[PC preview] unknown hour", - minute: "[PC preview] unknown minute", - daysOfWeek: "[PC preview] unknown daysOfWeek" - } - const ReminderRequestTimer = { - triggerTimeInSeconds: "[PC preview] unknown triggerTimeInSeconds" - } - const LocalDateTime = { - year: "[PC preview] unknown year", - month: "[PC preview] unknown month", - day: "[PC preview] unknown day", - hour: "[PC preview] unknown hour", - minute: "[PC preview] unknown minute", - second: "[PC preview] unknown second" - } - const reminderAgent = { - ActionButtonType: { - ACTION_BUTTON_TYPE_CLOSE: 0, - ACTION_BUTTON_TYPE_SNOOZE: 1 - }, - ReminderType: { - REMINDER_TYPE_TIMER: 0, - REMINDER_TYPE_CALENDAR: 1, - REMINDER_TYPE_ALARM: 2 - }, - publishReminder: function (...args) { - console.warn("reminderAgent.publishReminder 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, infoMock.reminderId) - } else { - return new Promise((resolve) => { - resolve(infoMock.reminderId) - }); - } - }, - getValidReminders: function (...args) { - console.warn("reminderAgent.getValidReminders 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, reminderReqs) - } else { - return new Promise((resolve) => { - resolve(reminderReqs) - }); - } - }, - cancelReminder: function (...args) { - console.warn("reminderAgent.cancelReminder 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - cancelAllReminders: function (...args) { - console.warn("reminderAgent.cancelAllReminders 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - addNotificationSlot: function (...args) { - console.warn("reminderAgent.addNotificationSlot 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - removeNotificationSlot: function (...args) { - console.warn("reminderAgent.removeNotificationSlot 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - } - } - return reminderAgent -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_request.js b/runtime/main/extend/systemplugin/napi/ohos_request.js deleted file mode 100644 index 76a309ed..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_request.js +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2021-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 mockRequest() { - const DownloadConfig = { - url: "[PC Preview] unknow uri", - header: "[PC Preview] unknow header", - enableMetered: "[PC Preview] unknow enableMetered", - enableRoaming: "[PC Preview] unknow enableRoaming", - description: "[PC Preview] unknow description", - networkType: "[PC Preview] unknow networkType", - filePath: "[PC Preview] unknow filePath", - title: "[PC Preview] unknow title", - background: "[PC Preview] unknow background", - }; - - const DownloadInfo = { - description: "[PC Preview] unknow description", - downloadedBytes: "[PC Preview] unknow downloadedBytes", - downloadId: "[PC Preview] unknow downloadId", - failedReason: "[PC Preview] unknow failedReason", - fileName: "[PC Preview] unknow fileName", - filePath: "[PC Preview] unknow filePath", - pausedReason: "[PC Preview] unknow pausedReason", - status: "[PC Preview] unknow status", - targetURI: "[PC Preview] unknow targetURI", - downloadTitle: "[PC Preview] unknow downloadTitle", - downloadTotalBytes: "[PC Preview] unknow downloadTotalBytes", - }; - - const DownloadTask = { - on: function (...args) { - console.warn("downloadTask.on 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') { - if (args[0] == 'progress') { - const receivedSize = "[PC Preview] unknow receivedSize" - const totalSize = "[PC Preview] unknow totalSize" - args[len - 1].call(this, receivedSize, totalSize) - } else if (args[0] == 'complete' || 'pause' || 'remove') { - args[len - 1].call(this) - } else if (args[0] == 'fail') { - const err = "[PC Preview] unknow err" - args[len - 1].call(this, err) - } - } - }, - - off: function (...args) { - console.warn("downloadTask.off 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') { - if (args[0] == 'progress') { - const receivedSize = "[PC Preview] unknow receivedSize" - const totalSize = "[PC Preview] unknow totalSize" - args[len - 1].call(this, receivedSize, totalSize) - } else if (args[0] == 'complete' || 'pause' || 'remove') { - args[len - 1].call(this) - } else if (args[0] == 'fail') { - const err = "[PC Preview]: unknow err" - args[len - 1].call(this, err) - } - } - }, - - remove: function (...args) { - console.warn("downloadTask.remove 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) - }) - } - }, - - pause: function (...args) { - console.warn("downloadTask.pause 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - resume: function (...args) { - console.warn("downloadTask.resume 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - query: function (...args) { - console.warn("downloadTask.query 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, downloadInfoMock) - } else { - return new Promise((resolve) => { - resolve(downloadInfoMock) - }) - } - }, - - queryMimeType: function (...args) { - console.warn("downloadTask.queryMimeType 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) - }) - } - }, - }; - - const File = { - filename: "[PC Preview] unknow filename", - name: "[PC Preview] unknow name", - uri: "[PC Preview] unknow uri", - type: "[PC Preview] unknow type", - }; - - const RequestData = { - name: "[PC Preview] unknow name", - value: "[PC Preview] unknow value", - }; - - const UploadConfig = { - url: "[PC Preview] unknow uri", - header: "[PC Preview] unknow header", - method: "[PC Preview] unknow method", - files: [File], - data: [RequestData], - }; - - const TaskState = { - path: "[PC Preview] unknow path", - responseCode: "[PC Preview] unknow responseCode", - message: "[PC Preview] unknow message", - }; - - const UploadTask = { - on: function (...args) { - console.warn("uploadTask.on 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') { - if (args[0] == 'progress') { - const uploadedSize = "[PC Preview] unknow receivedSize" - const totalSize = "[PC Preview] unknow totalSize" - args[len - 1].call(this, uploadedSize, totalSize) - } else if (args[0] == 'headerReceive') { - const header = "[PC Preview] unknow header" - args[len - 1].call(this, header) - } else if (args[0] == 'complete' || 'fail') { - const taskStates = "[PC Preview] unknow taskStates" - args[len - 1].call(this, taskStates) - } - } - }, - - off: function (...args) { - console.warn("uploadTask.off 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') { - if (args[0] == 'progress') { - const uploadedSize = "[PC Preview] unknow receivedSize" - const totalSize = "[PC Preview] unknow totalSize" - args[len - 1].call(this, uploadedSize, totalSize) - } else if (args[0] == 'headerReceive') { - const header = "[PC Preview] unknow header" - args[len - 1].call(this, header) - } else if (args[0] == 'complete' || 'fail') { - const taskStates = "[PC Preview] unknow taskStates" - args[len - 1].call(this, taskStates) - } - } - }, - - remove: function (...args) { - console.warn("uploadTask.remove 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) - }) - } - }, - }; - - const request = { - NETWORK_MOBILE: '[PC preview] unknow NETWORK_MOBILE', - NETWORK_WIFI: '[PC preview] unknow NETWORK_WIFI', - ERROR_CANNOT_RESUME: '[PC preview] unknow ERROR_CANNOT_RESUME', - ERROR_DEVICE_NOT_FOUND: '[PC preview] unknow ERROR_DEVICE_NOT_FOUND', - ERROR_FILE_ALREADY_EXISTS: '[PC preview] unknow ERROR_FILE_ALREADY_EXISTS', - ERROR_FILE_ERROR: '[PC preview] unknow ERROR_FILE_ERROR', - ERROR_HTTP_DATA_ERROR: '[PC preview] unknow ERROR_HTTP_DATA_ERROR', - ERROR_INSUFFICIENT_SPACE: '[PC preview] unknow ERROR_INSUFFICIENT_SPACE', - ERROR_TOO_MANY_REDIRECTS: '[PC preview] unknow ERROR_TOO_MANY_REDIRECTS', - ERROR_UNHANDLED_HTTP_CODE: '[PC preview] unknow ERROR_UNHANDLED_HTTP_CODE', - ERROR_UNKNOWN: '[PC preview] unknow ERROR_UNKNOWN', - PAUSED_QUEUED_FOR_WIFI: '[PC preview] unknow PAUSED_QUEUED_FOR_WIFI', - PAUSED_UNKNOWN: '[PC preview] unknow PAUSED_UNKNOWN', - PAUSED_WAITING_FOR_NETWORK: '[PC preview] unknow PAUSED_WAITING_FOR_NETWORK', - PAUSED_WAITING_TO_RETRY: '[PC preview] unknow PAUSED_WAITING_TO_RETRY', - SESSION_FAILED: '[PC preview] unknow SESSION_FAILED', - SESSION_PAUSED: '[PC preview] unknow SESSION_PAUSED', - SESSION_PENDING: '[PC preview] unknow SESSION_PENDING', - SESSION_RUNNING: '[PC preview] unknow SESSION_RUNNING', - SESSION_SUCCESSFUL: '[PC preview] unknow SESSION_SUCCESSFUL', - - download: function (...args) { - console.warn("request.download 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, DownloadTask) - } else { - return new Promise((resolve) => { - resolve(DownloadTask); - }) - } - }, - - upload: function (...args) { - console.warn("request.upload 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, UploadTask) - } else { - return new Promise((resolve) => { - resolve(UploadTask) - }) - } - } - } - return request -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_resourceManager.js b/runtime/main/extend/systemplugin/napi/ohos_resourceManager.js deleted file mode 100644 index d6bb618e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_resourceManager.js +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2021-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 { RawFileDescriptor } from "./global/rawFileDescriptor" - -export function mockResourceManager() { - const Direction = { - DIRECTION_VERTICAL : 0, - DIRECTION_HORIZONTAL : 1 - } - - const ConfigurationClass = class Configuration { - constructor() { - console.warn('resourceManager.Configuration.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.direction = Direction; - this.locale = '[PC Preview] unknow string'; - } - } - - const ScreenDensity = { - SCREEN_SDPI : 120, - SCREEN_MDPI : 160, - SCREEN_LDPI : 240, - SCREEN_XLDPI : 320, - SCREEN_XXLDPI : 480, - SCREEN_XXXLDPI : 640 - } - - const DeviceType = { - DEVICE_TYPE_PHONE : 0x00, - DEVICE_TYPE_TABLET : 0x01, - DEVICE_TYPE_CAR : 0x02, - DEVICE_TYPE_PC : 0x03, - DEVICE_TYPE_TV : 0x04, - DEVICE_TYPE_WEARABLE : 0x06 - } - - const DeviceCapabilityClass = class DeviceCapability { - constructor() { - console.warn('resourceManager.DeviceCapability.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer may be different from that on a real device.'); - this.screenDensity = ScreenDensity; - this.deviceType = DeviceType; - } - } - - const ResourceManager = { - getString: function(...args) { - console.warn("ResourceManager.getString 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringArray: function(...args) { - console.warn("ResourceManager.getStringArray 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, reject) => { - resolve([paramMock.paramStringMock]); - }) - } - }, - - getMedia: function(...args) { - console.warn("ResourceManager.getMedia 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getMediaBase64: function(...args) { - console.warn("ResourceManager.getMediaBase64 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getPluralString: function(...args) { - console.warn("ResourceManager.getPluralString 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getConfiguration: function(...args) { - console.warn("ResourceManager.getConfiguration 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, new ConfigurationClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new ConfigurationClass()); - }) - } - }, - - getDeviceCapability: function(...args) { - console.warn("ResourceManager.getDeviceCapability 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, new DeviceCapabilityClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new DeviceCapabilityClass()); - }) - } - }, - - release: function() { - console.warn("ResourceManager.release interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - }, - - getRawFile: function(...args) { - console.warn("ResourceManager.getRawFile 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getRawFileDescriptor: function(...args) { - console.warn("ResourceManager.getRawFileDescriptor 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, RawFileDescriptor); - } else { - return new Promise((resolve, reject) => { - resolve(RawFileDescriptor); - }) - } - }, - - closeRawFileDescriptor: function(...args) { - console.warn("ResourceManager.closeRawFileDescriptor 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringByName: function(...args) { - console.warn("ResourceManager.getStringByName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringArrayByName: function(...args) { - console.warn("ResourceManager.getStringArrayByName 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, reject) => { - resolve([paramMock.paramStringMock]); - }) - } - }, - - getMediaByName: function(...args) { - console.warn("ResourceManager.getMediaByName 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getMediaBase64ByName: function(...args) { - console.warn("ResourceManager.getMediaBase64ByName 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - - getPluralStringByName: function(...args) { - console.warn("ResourceManager.getPluralStringByName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - - getStringSync: function(...args) { - console.warn("ResourceManager.getStringSync interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - - getStringByNameSync: function(...args) { - console.warn("ResourceManager.getStringByNameSync interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - - getBoolean: function(...args) { - console.warn("ResourceManager.getBoolean interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getBooleanByName: function(...args) { - console.warn("ResourceManager.getBooleanByName interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getNumber: function(...args) { - console.warn("ResourceManager.getNumber interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getNumberByName: function(...args) { - console.warn("ResourceManager.getNumberByName interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - } - } - - const resourceManager = { - ResourceManager, - getResourceManager: async function getResourceManager(optBundleName, optCallback) { - let bundleName = ''; - let callback; - if (typeof optCallback == 'function') { - bundleName = optBundleName ? optBundleName : ''; - callback = optCallback; - } else if (typeof optBundleName == 'function') { - callback = optBundleName; - } else { - bundleName = optBundleName ? optBundleName : ''; - } - console.warn("ResourceManager.getResourceManager interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - if (typeof callback === 'function') { - callback.call(this, paramMock.businessErrorMock, ResourceManager); - } else { - return new Promise((resolve, reject) => { - resolve(ResourceManager); - }) - } - }, - } - return resourceManager; -} - - diff --git a/runtime/main/extend/systemplugin/napi/ohos_rpc.js b/runtime/main/extend/systemplugin/napi/ohos_rpc.js deleted file mode 100644 index f8f0d322..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_rpc.js +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright (c) 2021 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 MessageParcelClass = class MessageParcel { - constructor() { - console.warn('rpc.MessageParcel.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.reclaim = function () { - console.warn("MessageParcel.reclaim interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.writeRemoteObject = function (...args) { - console.warn("MessageParcel.writeRemoteObject interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.readRemoteObject = function () { - console.warn("MessageParcel.readRemoteObject interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteObjectMock - }; - this.writeInterfaceToken = function (...args) { - console.warn("MessageParcel.writeInterfaceToken interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.readInterfaceToken = function () { - console.warn("MessageParcel.readInterfaceToken interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }; - this.getSize = function () { - console.warn("MessageParcel.getSize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.getCapacity = function () { - console.warn("MessageParcel.getCapacity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.setSize = function (...args) { - console.warn("MessageParcel.setSize interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.setCapacity = function (...args) { - console.warn("MessageParcel.setCapacity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.getWritableBytes = function () { - console.warn("MessageParcel.getWritableBytes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.getReadableBytes = function () { - console.warn("MessageParcel.getReadableBytes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.getReadPosition = function () { - console.warn("MessageParcel.getReadPosition interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.getWritePosition = function () { - console.warn("MessageParcel.getWritePosition interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.rewindRead = function (...args) { - console.warn("MessageParcel.rewindRead interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.rewindWrite = function (...args) { - console.warn("MessageParcel.rewindWrite interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeNoException = function () { - console.warn("MessageParcel.writeNoException interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readException = function () { - console.warn("MessageParcel.readException interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.writeByte = function (...args) { - console.warn("MessageParcel.writeByte interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeShort = function (...args) { - console.warn("MessageParcel.writeShort interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeInt = function (...args) { - console.warn("MessageParcel.writeInt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeLong = function (...args) { - console.warn("MessageParcel.writeLong interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeFloat = function (...args) { - console.warn("MessageParcel.writeFloat interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeDouble = function (...args) { - console.warn("MessageParcel.writeDouble interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeBoolean = function (...args) { - console.warn("MessageParcel.writeBoolean interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeChar = function (...args) { - console.warn("MessageParcel.writeChar interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeString = function (...args) { - console.warn("MessageParcel.writeString interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeSequenceable = function (...args) { - console.warn("MessageParcel.writeSequenceable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeByteArray = function (...args) { - console.warn("MessageParcel.writeByteArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeShortArray = function (...args) { - console.warn("MessageParcel.writeShortArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeIntArray = function (...args) { - console.warn("MessageParcel.writeIntArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeLongArray = function (...args) { - console.warn("MessageParcel.writeLongArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeFloatArray = function (...args) { - console.warn("MessageParcel.writeFloatArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeDoubleArray = function (...args) { - console.warn("MessageParcel.writeDoubleArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeBooleanArray = function (...args) { - console.warn("MessageParcel.writeBooleanArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeCharArray = function (...args) { - console.warn("MessageParcel.writeCharArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeStringArray = function (...args) { - console.warn("MessageParcel.writeStringArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeSequenceableArray = function (...args) { - console.warn("MessageParcel.writeSequenceableArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.writeRemoteObjectArray = function (...args) { - console.warn("MessageParcel.writeRemoteObjectArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.readByte = function () { - console.warn("MessageParcel.readByte interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readShort = function () { - console.warn("MessageParcel.readShort interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readInt = function () { - console.warn("MessageParcel.readInt interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readLong = function () { - console.warn("MessageParcel.readLong interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readFloat = function () { - console.warn("MessageParcel.readFloat interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readDouble = function () { - console.warn("MessageParcel.readDouble interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readBoolean = function () { - console.warn("MessageParcel.readBoolean interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.readChar = function () { - console.warn("MessageParcel.readChar interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.readString = function () { - console.warn("MessageParcel.readString interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }; - this.readSequenceable = function (...args) { - console.warn("MessageParcel.readSequenceable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.readByteArray = function (...args) { - console.warn("MessageParcel.readByteArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readByteArray = function () { - console.warn("MessageParcel.readByteArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readShortArray = function (...args) { - console.warn("MessageParcel.readShortArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readShortArray = function () { - console.warn("MessageParcel.readShortArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readIntArray = function (...args) { - console.warn("MessageParcel.readIntArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readIntArray = function () { - console.warn("MessageParcel.readIntArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readLongArray = function (...args) { - console.warn("MessageParcel.readLongArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readLongArray = function () { - console.warn("MessageParcel.readLongArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readFloatArray = function (...args) { - console.warn("MessageParcel.readFloatArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readFloatArray = function () { - console.warn("MessageParcel.readFloatArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readDoubleArray = function (...args) { - console.warn("MessageParcel.readDoubleArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readDoubleArray = function () { - console.warn("MessageParcel.readDoubleArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readBooleanArray = function (...args) { - console.warn("MessageParcel.readBooleanArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readBooleanArray = function () { - console.warn("MessageParcel.readBooleanArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readCharArray = function (...args) { - console.warn("MessageParcel.readCharArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readCharArray = function () { - console.warn("MessageParcel.readCharArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readStringArray = function (...args) { - console.warn("MessageParcel.readStringArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readStringArray = function () { - console.warn("MessageParcel.readStringArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.readSequenceableArray = function (...args) { - console.warn("MessageParcel.readSequenceableArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readRemoteObjectArray = function (...args) { - console.warn("MessageParcel.readRemoteObjectArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.readRemoteObjectArray = function () { - console.warn("MessageParcel.readRemoteObjectArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.containFileDescriptors = function () { - console.warn("MessageParcel.containFileDescriptors interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.writeFileDescriptor = function (...args) { - console.warn("MessageParcel.writeFileDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.readFileDescriptor = function () { - console.warn("MessageParcel.readFileDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.writeAshmem = function (...args) { - console.warn("MessageParcel.writeAshmem interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.readAshmem = function () { - console.warn("MessageParcel.readAshmem interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new AshmemClass(); - }; - this.getRawDataCapacity = function () { - console.warn("MessageParcel.getRawDataCapacity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.writeRawData = function (...args) { - console.warn("MessageParcel.writeRawData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.readRawData = function (...args) { - console.warn("MessageParcel.readRawData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - } -}; -MessageParcelClass.create = function () { - console.warn("MessageParcel.create interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return new MessageParcelClass() -}; -MessageParcelClass.closeFileDescriptor = function (...args) { - console.warn("MessageParcel.closeFileDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") -}; -MessageParcelClass.dupFileDescriptor = function (...args) { - console.warn("MessageParcel.dupFileDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock -}; -export const MessageOptionClass = class MessageOption { - constructor(...args) { - console.warn('rpc.MessageOption constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - this.getFlags = function () { - console.warn("MessageOption.getFlags interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.setFlags = function (...args) { - console.warn("MessageOption.setFlags interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.getWaitTime = function () { - console.warn("MessageOption.getWaitTime interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.setWaitTime = function (...args) { - console.warn("MessageOption.setWaitTime interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.TF_SYNC = 0; - this.TF_ASYNC = 1; - this.TF_ACCEPT_FDS = 0x10; - this.TF_WAIT_TIME = 4; - } -}; -export const AshmemClass = class Ashmem { - constructor() { - console.warn('rpc.Ashmem constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - this.closeAshmem = function () { - console.warn('Ashmem.closeAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - }; - this.unmapAshmem = function () { - console.warn('Ashmem.unmapAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - }; - this.getAshmemSize = function () { - console.warn('Ashmem.getAshmemSize interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramNumberMock - }; - this.mapAshmem = function (...args) { - console.warn('Ashmem.mapAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramBooleanMock - }; - this.mapReadAndWriteAshmem = function () { - console.warn('Ashmem.mapReadAndWriteAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramBooleanMock - }; - this.mapReadOnlyAshmem = function () { - console.warn('Ashmem.mapReadOnlyAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramBooleanMock - }; - this.setProtection = function (...args) { - console.warn('Ashmem.setProtection interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramBooleanMock - }; - this.writeToAshmem = function (...args) { - console.warn('Ashmem.writeToAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramBooleanMock - }; - this.readFromAshmem = function (...args) { - console.warn('Ashmem.readFromAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return paramMock.paramArrayMock - }; - this.PROT_EXEC = 4; - this.PROT_NONE = 0; - this.PROT_READ = 1; - this.PROT_WRITE = 2; - } -}; -AshmemClass.createAshmem = function (...args) { - console.warn('Ashmem.createAshmem interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return new AshmemClass() -}; -AshmemClass.createAshmemFromExisting = function (...args) { - console.warn('Ashmem.createAshmemFromExisting interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.') - return new AshmemClass() -}; -export const RemoteObjectClass = class RemoteObject { - constructor(...args) { - console.warn("rpc.RemoteObject constructor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - this.queryLocalInterface = function (...args) { - console.warn("RemoteObject.queryLocalInterface interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteBrokerMock - }; - this.getInterfaceDescriptor = function () { - console.warn("RemoteObject.getInterfaceDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }; - this.onRemoteRequest = function (...args) { - console.warn("RemoteObject.onRemoteRequest interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.sendRequest = function (...args) { - console.warn("RemoteObject.sendRequest 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, SendRequestResultMock) - } else { - return new Promise((resolve, reject) => { - resolve(SendRequestResultMock) - }) - } - }; - this.getCallingPid = function () { - console.warn("RemoteObject.getCallingPid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.getCallingUid = function () { - console.warn("RemoteObject.getCallingUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }; - this.attachLocalInterface = function (...args) { - console.warn("RemoteObject.attachLocalInterface interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }; - this.addDeathRecipient = function (...args) { - console.warn("RemoteObject.addDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.removeDeathRecipient = function (...args) { - console.warn("RemoteObject.removeDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.isObjectDead = function () { - console.warn("RemoteObject.isObjectDead interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - } -}; -export const RemoteProxyClass = class RemoteProxy { - constructor() { - console.warn("rpc.RemoteProxy constructor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - this.queryLocalInterface = function (...args) { - console.warn("RemoteProxy.queryLocalInterface interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteBrokerMock - }; - this.getInterfaceDescriptor = function () { - console.warn("RemoteProxy.getInterfaceDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }; - this.addDeathRecipient = function (...args) { - console.warn("RemoteProxy.addDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.removeDeathRecipient = function (...args) { - console.warn("RemoteProxy.removeDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.isObjectDead = function () { - console.warn("RemoteProxy.isObjectDead interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.sendRequest = function (...args) { - console.warn("RemoteProxy.sendRequest 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, SendRequestResultMock) - } else { - return new Promise((resolve, reject) => { - resolve(SendRequestResultMock) - }) - } - }; - this.PING_TRANSACTION = ('_'.charCodeAt(0) << 24) | ('P'.charCodeAt(0) << 16) | - ('N'.charCodeAt(0) << 8) | 'G'.charCodeAt(0); - this.DUMP_TRANSACTION = ('_'.charCodeAt(0) << 24) | ('D'.charCodeAt(0) << 16) | - ('M'.charCodeAt(0) << 8) | 'P'.charCodeAt(0); - this.INTERFACE_TRANSACTION = ('_'.charCodeAt(0) << 24) | ('N'.charCodeAt(0) << 16) | - ('T'.charCodeAt(0) << 8) | 'F'.charCodeAt(0); - this.MIN_TRANSACTION_ID = 0x1; - this.MAX_TRANSACTION_ID = 0x00FFFFFF; - } -}; -export const IRemoteObjectMock = { - queryLocalInterface: function (...args) { - console.warn("IRemoteObject.queryLocalInterface interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteBrokerMock - }, - sendRequest: function (...args) { - console.warn("IRemoteObject.sendRequest 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, SendRequestResultMock) - } else { - return new Promise((resolve, reject) => { - resolve(SendRequestResultMock) - }) - } - }, - addDeathRecipient: function (...args) { - console.warn("IRemoteObject.addDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - removeDeathRecipient: function (...args) { - console.warn("IRemoteObject.removeDeathRecipient interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - getInterfaceDescriptor: function () { - console.warn("IRemoteObject.getInterfaceDescriptor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - isObjectDead: function () { - console.warn("IRemoteObject.isObjectDead interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - } -}; -export const IRemoteBrokerMock = { - asObject: function () { - console.warn("IRemoteBroker.asObject interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteObjectMock - } -}; -export const SendRequestResultMock = { - errCode: "[PC Preview]: unknow errCode", - code: "[PC Preview]: unknow code", - data: "[PC Preview]: unknow data", - reply: "[PC Preview]: unknow reply", -}; -export const SequenceableMock = { - marshalling: function (...args) { - console.warn("Sequenceable.marshalling interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - - unmarshalling: function (...args) { - console.warn("Sequenceable.unmarshalling interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - } -}; -export const DeathRecipientMock = { - onRemoteDied: function () { - console.warn("DeathRecipient.onRemoteDied interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } -}; -export const IPCSkeletonMock = { - getContextObject: function () { - console.warn("IPCSkeleton.getContextObject interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return IRemoteObjectMock - }, - getCallingPid: function () { - console.warn("IPCSkeleton.getCallingPid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getCallingUid: function () { - console.warn("IPCSkeleton.getCallingUid interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getCallingTokenId: function () { - console.warn("IPCSkeleton.getCallingTokenId interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getCallingDeviceID: function () { - console.warn("IPCSkeleton.getCallingDeviceID interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getLocalDeviceID: function () { - console.warn("IPCSkeleton.getLocalDeviceID interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - isLocalCalling: function () { - console.warn("IPCSkeleton.isLocalCalling interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - flushCommands: function (...args) { - console.warn("IPCSkeleton.flushCommands interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - resetCallingIdentity: function () { - console.warn("IPCSkeleton.resetCallingIdentity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - setCallingIdentity: function (...args) { - console.warn("IPCSkeleton.setCallingIdentity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - } -}; -export function mockRpc() { - const rpcMock = { - IRemoteObject: IRemoteObjectMock, - IRemoteBroker: IRemoteBrokerMock, - SendRequestResult: SendRequestResultMock, - Sequenceable: SequenceableMock, - DeathRecipient: DeathRecipientMock, - IPCSkeleton: IPCSkeletonMock, - MessageParcel: MessageParcelClass, - MessageOption: MessageOptionClass, - Ashmem: AshmemClass, - RemoteObject: RemoteObjectClass, - RemoteProxy: RemoteProxyClass - }; - return rpcMock -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_runninglock.js b/runtime/main/extend/systemplugin/napi/ohos_runninglock.js deleted file mode 100644 index 3fd00a27..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_runninglock.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 mockRunninglock() { - const RunningLockType = { - BACKGROUND: 1, - PROXIMITY_SCREEN_CONTROL: '[PC Preview] unknow PROXIMITY_SCREEN_CONTROL', - } - const RunningLockClass = class RunningLock { - constructor() { - this.lock = function (...args) { - console.warn("RunningLock.lock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.isUsed = function (...args) { - console.warn("RunningLock.isUsed interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }; - this.unlock = function (...args) { - console.warn("RunningLock.unlock interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - } - } - const runninglock = { - RunningLock:RunningLockClass, - RunningLockType, - isRunningLockTypeSupported: function (...args) { - console.warn("runningLock.isRunningLockTypeSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - createRunningLock: function (...args) { - console.warn("runningLock.createRunningLock 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, new RunningLockClass()); - } else { - return new Promise((resolve, reject) => { - resolve(new RunningLockClass()); - }) - } - } - } - return runninglock -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_screen.js b/runtime/main/extend/systemplugin/napi/ohos_screen.js deleted file mode 100644 index a63bb9ce..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_screen.js +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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 Orientation = { - UNSPECIFIED: 0, - VERTICAL: 1, - HORIZONTAL: 2, - REVERSE_VERTICAL: 3, - REVERSE_HORIZONTAL: 4 -}; - -export const Screen = { - id: 'PC preview] unknown id', - parent: '[PC preview] unknown parent', - supportedModeInfo: supportedModeInfoArray, - activeModeIndex: '[PC preview] unknown activeModeIndex', - orientation: Orientation, - setOrientation: function(...args) { - console.warn('Screen.setOrientation 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setScreenActiveMode: function(...args) { - console.warn('Screen.setScreenActiveMode 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setDensityDpi: function(...args) { - console.warn('Screen.setDensityDpi 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - } -}; - -export const allScreenMock = [ - Screen -]; - -export const ExpandOption = { - screenId: '[PC preview] unknown screenId', - startX: '[PC preview] unknown startX', - startY: '[PC preview] unknown startY' -}; - -export const VirtualScreenOption = { - name: '[PC preview] unknown name', - width: '[PC preview] unknown width', - height: '[PC preview] unknown height', - density: '[PC preview] unknown density', - surfaceId: '[PC preview] unknown surfaceId' -}; - -export const ScreenModeInfo = { - id: '[PC preview] unknown id', - width: '[PC preview] unknown width', - height: '[PC preview] unknown height', - refreshRate: '[PC preview] unknown refreshRate' -}; - -export const supportedModeInfoArray = [ - ScreenModeInfo -] -const EventTypeMock = { - connect: 'connect', - disconnect: 'disconnect', - change: 'change' -} -export function mockScreen() { - const screen = { - ExpandOption, - VirtualScreenOption, - Orientation, - ScreenModeInfo, - getAllScreens: function(...args) { - console.warn('Screen.getAllScreens 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, allScreenMock); - } else { - return new Promise((resolve) => { - resolve(allScreenMock); - }); - } - }, - on: function(...args) { - console.warn('Screen.on 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!==2){ - console.warn("Screen.on please check params!") - return - } - if (typeof args[len - 1] === 'function') { - if (args[0] === EventTypeMock.connect || args[0] === EventTypeMock.disconnect || args[0] === EventTypeMock.change) { - console.warn(`Screen.on you has registered ${args[0]} event`) - } else { - console.warn('Screen.on please check first param!') - } - } else { - console.warn('Screen.on please check param!') - } - }, - off: function(...args) { - console.warn('Screen.off 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!==2){ - console.warn("Screen.off please check params!") - return - } - if (typeof args[len - 1] === 'function') { - if (args[0] === EventTypeMock.connect || args[0] === EventTypeMock.disconnect || args[0] === EventTypeMock.change) { - console.warn(`Screen.off you has registered ${args[0]} event`) - } else { - console.warn('Screen.off please check first param!') - } - } else { - console.warn('Screen.off please check param!') - } - }, - makeExpand: function(...args) { - console.warn('Screen.makeExpand 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - makeMirror: function(...args) { - console.warn( 'Screen.makeMirror 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - createVirtualScreen: function(...args) { - console.warn( 'Screen.createVirtualScreen 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, Screen); - } else { - return new Promise((resolve) => { - resolve(Screen); - }); - } - }, - destroyVirtualScreen: function(...args) { - console.warn('Screen.destroyVirtualScreen 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setVirtualScreenSurface: function(...args) { - console.warn( 'Screen.setVirtualScreenSurface 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isScreenRotationLocked: function(...args) { - console.warn( 'Screen.setVirtualScreenSurface 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); - }); - } - }, - setScreenRotationLocked: function(...args) { - console.warn( 'Screen.setVirtualScreenSurface 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); - }); - } - } - } - return screen -} - diff --git a/runtime/main/extend/systemplugin/napi/ohos_screenLock.js b/runtime/main/extend/systemplugin/napi/ohos_screenLock.js deleted file mode 100644 index 87806bd5..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_screenLock.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2021 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 mockScreenLock() { - const screenLock = { - isScreenLocked: function (...args) { - console.warn("screenLock.isScreenLocked 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); - }) - } - }, - isLocked: function (...args) { - console.warn("wallpaper.isLocked interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isSecureMode: function (...args) { - console.warn("screenLock.isSecureMode 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); - }) - } - }, - isSecure: function (...args) { - console.warn("wallpaper.isSecure interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - unlockScreen: function (...args) { - console.warn("screenLock.unlockScreen 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) - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - unlock: function (...args) { - console.warn("screenLock.unlock 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); - }) - } - }, - lock: function (...args) { - console.warn("screenLock.lockScreen 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); - }) - } - }, - onSystemEvent: function (...args) { - console.warn("screenLock.onSystemEvent 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, screenLock.SystemEvent) - } - return paramMock.paramBooleanMock - }, - SystemEvent: { - eventType: '[PC Preview] unknow eventType', - params: paramMock.paramStringMock - }, - sendScreenLockEvent: function (...args) { - console.warn("screenLock.sendScreenLockEvent 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); - }) - } - } - } - return screenLock -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_screenshot.js b/runtime/main/extend/systemplugin/napi/ohos_screenshot.js deleted file mode 100644 index 67478007..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_screenshot.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2021 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 mockScreenshot() { - const RectMock = { - left: '[PC preview] unknow Rect.left', - top: '[PC preview] unknow Rect.top', - width: '[PC preview] unknow Rect.width', - height: '[PC preview] unknow Rect.height' - } - const SizeMock = { - width: '[PC preview] unknow Size.width', - height: '[PC preview] unknow Size.height', - } - const ScreenshotOptionsMock = { - screenRect: RectMock, - imageSize: SizeMock, - rotation: '[PC preview] unknow Size.width', - displayId: '[PC preview] unknow Size.width', - } - - const screenshotMock = { - ImageSource: '[PC preview] unknow ImageSource' - } - - const screenshot = { - save: function (...args) { - console.warn("screenshot.save 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, screenshotMock) - } else { - return new Promise((resolve, reject) => { - resolve(screenshotMock) - }) - } - } - } - return screenshot -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_security_cryptoFramework.js b/runtime/main/extend/systemplugin/napi/ohos_security_cryptoFramework.js deleted file mode 100644 index 77399317..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_security_cryptoFramework.js +++ /dev/null @@ -1,768 +0,0 @@ -/* - * 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 mockCryptoFramework() { - const DataBlob = { - data: paramMock.paramArrayMock, - } - const DataArray = { - data: [paramMock.paramArrayMock], - } - const EncodingBlob = { - data: paramMock.paramArrayMock, - encodingFormat: "[PC Preview] unknow encodingFormat", - } - const SymKey = { - format: "[PC Preview] unknow format", - algName: "[PC Preview] unknow algName", - getEncoded: function () { - console.warn("SymKey.getEncoded interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - clearMem: function () { - console.warn("SymKey.clearMem interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - } - const PriKey = { - format: "[PC Preview] unknow format", - algName: "[PC Preview] unknow algName", - getEncoded: function () { - console.warn("PriKey.getEncoded interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - clearMem: function () { - console.warn("PriKey.clearMem interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - } - const PubKey = { - format: "[PC Preview] unknow format", - algName: "[PC Preview] unknow algName", - getEncoded: function () { - console.warn("PubKey.getEncoded interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - } - const KeyPair = { - priKey: PriKey, - pubKey: PubKey, - } - const Random = { - generateRandom: function (...args) { - console.warn("Random.generateRandom 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - setSeed: function (...args) { - console.warn("Random.setSeed 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - const AsyKeyGenerator = { - algName: "[PC Preview] unknow algName", - generateKeyPair: function (...args) { - console.warn("AsyKeyGenerator.generateKeyPair 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, KeyPair); - } else { - return new Promise((resolve, reject) => { - resolve(KeyPair); - }) - } - }, - convertKey: function (...args) { - console.warn("AsyKeyGenerator.convertKey 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, KeyPair); - } else { - return new Promise((resolve, reject) => { - resolve(KeyPair); - }) - } - }, - } - const SymKeyGenerator = { - algName: "[PC Preview] unknow algName", - generateSymKey: function (...args) { - console.warn("SymKeyGenerator.generateSymKey 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, SymKey); - } else { - return new Promise((resolve, reject) => { - resolve(SymKey); - }) - } - }, - convertKey: function (...args) { - console.warn("SymKeyGenerator.convertKey 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, SymKey); - } else { - return new Promise((resolve, reject) => { - resolve(SymKey); - }) - } - }, - } - const Mac = { - algName: "[PC Preview] unknow algName", - init: function (...args) { - console.warn("Mac.init 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - update: function (...args) { - console.warn("Mac.update 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - doFinal: function (...args) { - console.warn("Mac.doFinal 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - getMacLength: function () { - console.warn("Mac.getMacLength interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - } - const Md = { - algName: "[PC Preview] unknow algName", - update: function (...args) { - console.warn("Md.update 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - digest: function (...args) { - console.warn("Md.digest 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - getMdLength: function () { - console.warn("Md.getMdLength interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - } - const Cipher = { - algName: "[PC Preview] unknow algName", - init: function (...args) { - console.warn("Cipher.init 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - update: function (...args) { - console.warn("Cipher.update 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - doFinal: function (...args) { - console.warn("Cipher.doFinal 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - } - const Sign = { - algName: "[PC Preview] unknow algName", - init: function (...args) { - console.warn("Sign.init 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - update: function (...args) { - console.warn("Sign.update 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sign: function (...args) { - console.warn("Sign.sign 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - } - const Verify = { - algName: "[PC Preview] unknow algName", - init: function (...args) { - console.warn("Verify.init 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - update: function (...args) { - console.warn("Verify.update 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - verify: function (...args) { - console.warn("Verify.verify 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - } - const KeyAgreement = { - algName: "[PC Preview] unknow algName", - generateSecret: function (...args) { - console.warn("KeyAgreement.generateSecret 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - } - const X509Cert = { - verify: function (...args) { - console.warn("X509Cert.verify 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getEncoded: function (...args) { - console.warn("X509Cert.getEncoded 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, EncodingBlob); - } else { - return new Promise((resolve, reject) => { - resolve(EncodingBlob); - }) - } - }, - getPublicKey: function (...args) { - console.warn("X509Cert.getPublicKey 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, PubKey); - } else { - return new Promise((resolve, reject) => { - resolve(PubKey); - }) - } - }, - checkValidityWithDate: function (...args) { - console.warn("X509Cert.checkValidityWithDate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getVersion: function () { - console.warn("X509Cert.getVersion interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getSerialNumber: function () { - console.warn("X509Cert.getSerialNumber interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getIssuerName: function () { - console.warn("X509Cert.getIssuerName interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getSubjectName: function () { - console.warn("X509Cert.getSubjectName interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getNotBeforeTime: function () { - console.warn("X509Cert.getNotBeforeTime interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getNotAfterTime: function () { - console.warn("X509Cert.getNotAfterTime interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getSignature: function () { - console.warn("X509Cert.getSignature interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getSignatureAlgName: function () { - console.warn("X509Cert.getSignatureAlgName interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getSignatureAlgOid: function () { - console.warn("X509Cert.getSignatureAlgOid interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getSignatureAlgParams: function () { - console.warn("X509Cert.getSignatureAlgParams interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getKeyUsage: function () { - console.warn("X509Cert.getKeyUsage interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getExtKeyUsage: function () { - console.warn("X509Cert.getExtKeyUsage interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataArray - }, - getBasicConstraints: function () { - console.warn("X509Cert.getBasicConstraints interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getSubjectAltNames: function () { - console.warn("X509Cert.getSubjectAltNames interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataArray - }, - getIssuerAltNames: function () { - console.warn("X509Cert.getIssuerAltNames interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataArray - }, - } - const X509CrlEntry = { - getEncoded: function (...args) { - console.warn("X509CrlEntry.getEncoded 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, EncodingBlob); - } else { - return new Promise((resolve, reject) => { - resolve(EncodingBlob); - }) - } - }, - getSerialNumber: function () { - console.warn("X509CrlEntry.getSerialNumber interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getCertIssuer: function (...args) { - console.warn("X509CrlEntry.getCertIssuer 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - getRevocationDate: function (...args) { - console.warn("X509CrlEntry.getRevocationDate 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - } - const X509Crl = { - isRevoked: function (...args) { - console.warn("X509Crl.isRevoked 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getType: function () { - console.warn("X509Crl.getType interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getEncoded: function (...args) { - console.warn("X509Crl.getEncoded 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, EncodingBlob); - } else { - return new Promise((resolve, reject) => { - resolve(EncodingBlob); - }) - } - }, - verify: function (...args) { - console.warn("X509Crl.verify 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getVersion: function () { - console.warn("X509Crl.getVersion interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getIssuerName: function () { - console.warn("X509Crl.getIssuerName interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getLastUpdate: function () { - console.warn("X509Crl.getLastUpdate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getNextUpdate: function () { - console.warn("X509Crl.getNextUpdate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getRevokedCert: function (...args) { - console.warn("X509Crl.getRevokedCert 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, X509CrlEntry); - } else { - return new Promise((resolve, reject) => { - resolve(X509CrlEntry); - }) - } - }, - getRevokedCertWithCert: function (...args) { - console.warn("X509Crl.getRevokedCertWithCert 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, X509CrlEntry); - } else { - return new Promise((resolve, reject) => { - resolve(X509CrlEntry); - }) - } - }, - getRevokedCerts: function (...args) { - console.warn("X509Crl.getRevokedCerts 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, [X509CrlEntry]); - } else { - return new Promise((resolve, reject) => { - resolve([X509CrlEntry]); - }) - } - }, - getTbsInfo: function (...args) { - console.warn("X509Crl.getTbsInfo 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, DataBlob); - } else { - return new Promise((resolve, reject) => { - resolve(DataBlob); - }) - } - }, - getSignature: function () { - console.warn("X509Crl.getSignature interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - getSignatureAlgName: function () { - console.warn("X509Crl.getSignatureAlgName interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getSignatureAlgOid: function () { - console.warn("X509Crl.getSignatureAlgOid interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - getSignatureAlgParams: function () { - console.warn("X509Crl.getSignatureAlgParams interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return DataBlob - }, - } - const CertChainValidator = { - algorithm: "[PC Preview] unknow algorithm", - validate: function (...args) { - console.warn("CertChainValidator.validate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - const cryptoFramework = { - Result: { - INVALID_PARAMS: 401, - NOT_SUPPORT: 801, - ERR_OUT_OF_MEMORY: 17620001, - ERR_INTERNAL_ERROR: 17620002, - ERR_CRYPTO_OPERATION: 17630001, - ERR_CERT_SIGNATURE_FAILURE: 17630002, - ERR_CERT_NOT_YET_VALID: 17630003, - ERR_CERT_HAS_EXPIRED: 17630004, - ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: 17630005, - ERR_KEYUSAGE_NO_CERTSIGN: 17630006, - ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: 17630007, - }, - EncodingFormat: { - FORMAT_DER: 0, - FORMAT_PEM: 1, - }, - CryptoMode: { - ENCRYPT_MODE: 0, - DECRYPT_MODE: 1, - }, - createRandom: function () { - console.warn("cryptoFramework.createRandom interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Random; - }, - createAsyKeyGenerator: function (...args) { - console.warn("cryptoFramework.createAsyKeyGenerator interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return AsyKeyGenerator; - }, - createSymKeyGenerator: function (...args) { - console.warn("cryptoFramework.createSymKeyGenerator interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return SymKeyGenerator; - }, - createMac: function (...args) { - console.warn("cryptoFramework.createMac interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Mac; - }, - createMd: function (...args) { - console.warn("cryptoFramework.createMd interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Md; - }, - createCipher: function (...args) { - console.warn("cryptoFramework.createCipher interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Cipher; - }, - createSign: function (...args) { - console.warn("cryptoFramework.createSign interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Sign; - }, - createVerify: function (...args) { - console.warn("cryptoFramework.createVerify interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return Verify; - }, - createKeyAgreement: function (...args) { - console.warn("cryptoFramework.createKeyAgreement interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return KeyAgreement; - }, - createX509Cert: function (...args) { - console.warn("cryptoFramework.createX509Cert 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, X509Cert); - } else { - return new Promise((resolve, reject) => { - resolve(X509Cert); - }) - } - }, - createX509Crl: function (...args) { - console.warn("cryptoFramework.createX509Crl 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, X509Crl); - } else { - return new Promise((resolve, reject) => { - resolve(X509Crl); - }) - } - }, - createCertChainValidator: function (...args) { - console.warn("cryptoFramework.createCertChainValidator interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return CertChainValidator; - }, - } - return cryptoFramework; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_security_huks.js b/runtime/main/extend/systemplugin/napi/ohos_security_huks.js deleted file mode 100644 index cbe48ac8..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_security_huks.js +++ /dev/null @@ -1,549 +0,0 @@ -/* - * 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 HuksErrorCode = { - HUKS_SUCCESS: 0, - HUKS_FAILURE: -1, - HUKS_ERROR_BAD_STATE: -2, - HUKS_ERROR_INVALID_ARGUMENT: -3, - HUKS_ERROR_NOT_SUPPORTED: -4, - HUKS_ERROR_NO_PERMISSION: -5, - HUKS_ERROR_INSUFFICIENT_DATA: -6, - HUKS_ERROR_BUFFER_TOO_SMALL: -7, - HUKS_ERROR_INSUFFICIENT_MEMORY: -8, - HUKS_ERROR_COMMUNICATION_FAILURE: -9, - HUKS_ERROR_STORAGE_FAILURE: -10, - HUKS_ERROR_HARDWARE_FAILURE: -11, - HUKS_ERROR_ALREADY_EXISTS: -12, - HUKS_ERROR_NOT_EXIST: -13, - HUKS_ERROR_NULL_POINTER: -14, - HUKS_ERROR_FILE_SIZE_FAIL: -15, - HUKS_ERROR_READ_FILE_FAIL: -16, - HUKS_ERROR_INVALID_PUBLIC_KEY: -17, - HUKS_ERROR_INVALID_PRIVATE_KEY: -18, - HUKS_ERROR_INVALID_KEY_INFO: -19, - HUKS_ERROR_HASH_NOT_EQUAL: -20, - HUKS_ERROR_MALLOC_FAIL: -21, - HUKS_ERROR_WRITE_FILE_FAIL: -22, - HUKS_ERROR_REMOVE_FILE_FAIL: -23, - HUKS_ERROR_OPEN_FILE_FAIL: -24, - HUKS_ERROR_CLOSE_FILE_FAIL: -25, - HUKS_ERROR_MAKE_DIR_FAIL: -26, - HUKS_ERROR_INVALID_KEY_FILE: -27, - HUKS_ERROR_IPC_MSG_FAIL: -28, - HUKS_ERROR_REQUEST_OVERFLOWS: -29, - HUKS_ERROR_PARAM_NOT_EXIST: -30, - HUKS_ERROR_CRYPTO_ENGINE_ERROR: -31, - HUKS_ERROR_COMMUNICATION_TIMEOUT: -32, - HUKS_ERROR_IPC_INIT_FAIL: -33, - HUKS_ERROR_IPC_DLOPEN_FAIL: -34, - HUKS_ERROR_EFUSE_READ_FAIL: -35, - HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST: -36, - HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL: -37, - HUKS_ERROR_VERIFICATION_FAILED: -38, - - HUKS_ERROR_GET_USERIAM_SECINFO_FAILED: -40, - HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED: -41, - HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT: -42, - HUKS_ERROR_KEY_AUTH_FAILED: -43, - HUKS_ERROR_DEVICE_NO_CREDENTIAL: -44, - - HUKS_ERROR_CHECK_GET_ALG_FAIL: -100, - HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL: -101, - HUKS_ERROR_CHECK_GET_PADDING_FAIL: -102, - HUKS_ERROR_CHECK_GET_PURPOSE_FAIL: -103, - HUKS_ERROR_CHECK_GET_DIGEST_FAIL: -104, - HUKS_ERROR_CHECK_GET_MODE_FAIL: -105, - HUKS_ERROR_CHECK_GET_NONCE_FAIL: -106, - HUKS_ERROR_CHECK_GET_AAD_FAIL: -107, - HUKS_ERROR_CHECK_GET_IV_FAIL: -108, - HUKS_ERROR_CHECK_GET_AE_TAG_FAIL: -109, - HUKS_ERROR_CHECK_GET_SALT_FAIL: -110, - HUKS_ERROR_CHECK_GET_ITERATION_FAIL: -111, - HUKS_ERROR_INVALID_ALGORITHM: -112, - HUKS_ERROR_INVALID_KEY_SIZE: -113, - HUKS_ERROR_INVALID_PADDING: -114, - HUKS_ERROR_INVALID_PURPOSE: -115, - HUKS_ERROR_INVALID_MODE: -116, - HUKS_ERROR_INVALID_DIGEST: -117, - HUKS_ERROR_INVALID_SIGNATURE_SIZE: -118, - HUKS_ERROR_INVALID_IV: -119, - HUKS_ERROR_INVALID_AAD: -120, - HUKS_ERROR_INVALID_NONCE: -121, - HUKS_ERROR_INVALID_AE_TAG: -122, - HUKS_ERROR_INVALID_SALT: -123, - HUKS_ERROR_INVALID_ITERATION: -124, - HUKS_ERROR_INVALID_OPERATION: -125, - HUKS_ERROR_INVALID_WRAPPED_FORMAT: -126, - HUKS_ERROR_INVALID_USAGE_OF_KEY: -127, - - HUKS_ERROR_INTERNAL_ERROR: -999, - HUKS_ERROR_UNKNOWN_ERROR: -1000, -} - -export const HuksKeyPurpose = { - HUKS_KEY_PURPOSE_ENCRYPT: 1, - HUKS_KEY_PURPOSE_DECRYPT: 2, - HUKS_KEY_PURPOSE_SIGN: 4, - HUKS_KEY_PURPOSE_VERIFY: 8, - HUKS_KEY_PURPOSE_DERIVE: 16, - HUKS_KEY_PURPOSE_WRAP: 32, - HUKS_KEY_PURPOSE_UNWRAP: 64, - HUKS_KEY_PURPOSE_MAC: 128, - HUKS_KEY_PURPOSE_AGREE: 256, -} - -export const HuksKeyDigest = { - HUKS_DIGEST_NONE: 0, - HUKS_DIGEST_MD5: 1, - HUKS_DIGEST_SM3: 2, - HUKS_DIGEST_SHA1: 10, - HUKS_DIGEST_SHA224: 11, - HUKS_DIGEST_SHA256: 12, - HUKS_DIGEST_SHA384: 13, - HUKS_DIGEST_SHA512: 14, -} - -export const HuksKeyPadding = { - HUKS_PADDING_NONE: 0, - HUKS_PADDING_OAEP: 1, - HUKS_PADDING_PSS: 2, - HUKS_PADDING_PKCS1_V1_5: 3, - HUKS_PADDING_PKCS5: 4, - HUKS_PADDING_PKCS7: 5, -} - -export const HuksCipherMode = { - HUKS_MODE_ECB: 1, - HUKS_MODE_CBC: 2, - HUKS_MODE_CTR: 3, - HUKS_MODE_OFB: 4, - HUKS_MODE_CCM: 31, - HUKS_MODE_GCM: 32, -} - -export const HuksKeySize = { - HUKS_RSA_KEY_SIZE_512: 512, - HUKS_RSA_KEY_SIZE_768: 768, - HUKS_RSA_KEY_SIZE_1024: 1024, - HUKS_RSA_KEY_SIZE_2048: 2048, - HUKS_RSA_KEY_SIZE_3072: 3072, - HUKS_RSA_KEY_SIZE_4096: 4096, - - HUKS_ECC_KEY_SIZE_224: 224, - HUKS_ECC_KEY_SIZE_256: 256, - HUKS_ECC_KEY_SIZE_384: 384, - HUKS_ECC_KEY_SIZE_521: 521, - - HUKS_AES_KEY_SIZE_128: 128, - HUKS_AES_KEY_SIZE_192: 192, - HUKS_AES_KEY_SIZE_256: 256, - HUKS_AES_KEY_SIZE_512: 512, - - HUKS_CURVE25519_KEY_SIZE_256: 256, - - HUKS_DH_KEY_SIZE_2048: 2048, - HUKS_DH_KEY_SIZE_3072: 3072, - HUKS_DH_KEY_SIZE_4096: 4096, - - HUKS_SM2_KEY_SIZE_256: 256, - HUKS_SM4_KEY_SIZE_128: 128, -} - -export const HuksKeyAlg = { - HUKS_ALG_RSA: 1, - HUKS_ALG_ECC: 2, - HUKS_ALG_DSA: 3, - - HUKS_ALG_AES: 20, - HUKS_ALG_HMAC: 50, - HUKS_ALG_HKDF: 51, - HUKS_ALG_PBKDF2: 52, - - HUKS_ALG_ECDH: 100, - HUKS_ALG_X25519: 101, - HUKS_ALG_ED25519: 102, - HUKS_ALG_DH: 103, - - HUKS_ALG_SM2: 150, - HUKS_ALG_SM3: 151, - HUKS_ALG_SM4: 152, -} - -export const HuksUnwrapSuite = { - HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING: 1, - HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING: 2, -} - -export const HuksKeyGenerateType = { - HUKS_KEY_GENERATE_TYPE_DEFAULT: 0, - HUKS_KEY_GENERATE_TYPE_DERIVE: 1, - HUKS_KEY_GENERATE_TYPE_AGREE: 2, -} - -export const HuksKeyFlag = { - HUKS_KEY_FLAG_IMPORT_KEY: 1, - HUKS_KEY_FLAG_GENERATE_KEY: 2, - HUKS_KEY_FLAG_AGREE_KEY: 3, - HUKS_KEY_FLAG_DERIVE_KEY: 4, -} - -export const HuksKeyStorageType = { - HUKS_STORAGE_TEMP: 0, - HUKS_STORAGE_PERSISTENT: 1, -} - -export const HuksImportKeyType = { - HUKS_KEY_TYPE_PUBLIC_KEY: 0, - HUKS_KEY_TYPE_PRIVATE_KEY: 1, - HUKS_KEY_TYPE_KEY_PAIR: 2, -} - -export const HuksUserAuthType = { - HUKS_USER_AUTH_TYPE_FINGERPRINT: 1, - HUKS_USER_AUTH_TYPE_FACE: 2, - HUKS_USER_AUTH_TYPE_PIN: 4, -} - -export const HuksAuthAccessType = { - HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD: 1, - HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL: 2, -} - -export const HuksChallengeType = { - HUKS_CHALLENGE_TYPE_NORMAL: 0, - HUKS_CHALLENGE_TYPE_CUSTOM: 1, - HUKS_CHALLENGE_TYPE_NONE: 2, -} - -export const HuksChallengePosition = { - HUKS_CHALLENGE_POS_0: 0, - HUKS_CHALLENGE_POS_1: 1, - HUKS_CHALLENGE_POS_2: 2, - HUKS_CHALLENGE_POS_3: 3, -} - -export const HuksSecureSignType = { - HUKS_SECURE_SIGN_WITH_AUTHINFO: 1, -} - -export const HuksSendType = { - HUKS_SEND_TYPE_ASYNC: 0, - HUKS_SEND_TYPE_SYNC: 1, -} - -export const HuksTagType = { - HUKS_TAG_TYPE_INVALID: 0, - HUKS_TAG_TYPE_INT: 1, - HUKS_TAG_TYPE_UINT: 2, - HUKS_TAG_TYPE_ULONG: 3, - HUKS_TAG_TYPE_BOOL: 4, - HUKS_TAG_TYPE_BYTES: 5, -} - -export const HuksTag = { - HUKS_TAG_INVALID: 0, - - HUKS_TAG_ALGORITHM: 1, - HUKS_TAG_PURPOSE: 2, - HUKS_TAG_KEY_SIZE: 3, - HUKS_TAG_DIGEST: 4, - HUKS_TAG_PADDING: 5, - HUKS_TAG_BLOCK_MODE: 6, - HUKS_TAG_KEY_TYPE: 7, - HUKS_TAG_ASSOCIATED_DATA: 8, - HUKS_TAG_NONCE: 9, - HUKS_TAG_IV: 10, - - HUKS_TAG_INFO: 11, - HUKS_TAG_SALT: 12, - HUKS_TAG_PWD: 13, - HUKS_TAG_ITERATION: 14, - - HUKS_TAG_KEY_GENERATE_TYPE: 15, - HUKS_TAG_DERIVE_MAIN_KEY: 16, - HUKS_TAG_DERIVE_FACTOR: 17, - HUKS_TAG_DERIVE_ALG: 18, - HUKS_TAG_AGREE_ALG: 19, - HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS: 20, - HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS: 21, - HUKS_TAG_AGREE_PUBLIC_KEY: 22, - HUKS_TAG_KEY_ALIAS: 23, - HUKS_TAG_DERIVE_KEY_SIZE: 24, - HUKS_TAG_IMPORT_KEY_TYPE: 25, - HUKS_TAG_UNWRAP_ALGORITHM_SUITE: 26, - - HUKS_TAG_ACTIVE_DATETIME: 201, - - HUKS_TAG_ORIGINATION_EXPIRE_DATETIME: 202, - - HUKS_TAG_USAGE_EXPIRE_DATETIME: 203, - - HUKS_TAG_CREATION_DATETIME: 204, - - HUKS_TAG_ALL_USERS: 301, - HUKS_TAG_USER_ID: 302, - HUKS_TAG_NO_AUTH_REQUIRED: 303, - HUKS_TAG_USER_AUTH_TYPE: 304, - HUKS_TAG_AUTH_TIMEOUT: 305, - HUKS_TAG_AUTH_TOKEN: 306, - HUKS_TAG_KEY_AUTH_ACCESS_TYPE: 307, - HUKS_TAG_KEY_SECURE_SIGN_TYPE: 308, - HUKS_TAG_CHALLENGE_TYPE: 309, - HUKS_TAG_CHALLENGE_POS: 310, - - HUKS_TAG_ATTESTATION_CHALLENGE: 501, - HUKS_TAG_ATTESTATION_APPLICATION_ID: 502, - HUKS_TAG_ATTESTATION_ID_BRAND: 503, - HUKS_TAG_ATTESTATION_ID_DEVICE: 504, - HUKS_TAG_ATTESTATION_ID_PRODUCT: 505, - HUKS_TAG_ATTESTATION_ID_SERIAL: 506, - HUKS_TAG_ATTESTATION_ID_IMEI: 507, - HUKS_TAG_ATTESTATION_ID_MEID: 508, - HUKS_TAG_ATTESTATION_ID_MANUFACTURER: 509, - HUKS_TAG_ATTESTATION_ID_MODEL: 510, - HUKS_TAG_ATTESTATION_ID_ALIAS: 511, - HUKS_TAG_ATTESTATION_ID_SOCID: 512, - HUKS_TAG_ATTESTATION_ID_UDID: 513, - HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO: 514, - HUKS_TAG_ATTESTATION_ID_VERSION_INFO: 515, - - HUKS_TAG_IS_KEY_ALIAS: 1001, - HUKS_TAG_KEY_STORAGE_FLAG: 1002, - HUKS_TAG_IS_ALLOWED_WRAP: 1003, - HUKS_TAG_KEY_WRAP_TYPE: 1004, - HUKS_TAG_KEY_AUTH_ID: 1005, - HUKS_TAG_KEY_ROLE: 1006, - HUKS_TAG_KEY_FLAG: 1007, - HUKS_TAG_IS_ASYNCHRONIZED: 1008, - HUKS_TAG_SECURE_KEY_ALIAS: 1009, - HUKS_TAG_SECURE_KEY_UUID: 1010, - HUKS_TAG_KEY_DOMAIN: 1011, - - HUKS_TAG_PROCESS_NAME: 10001, - HUKS_TAG_PACKAGE_NAME: 10002, - HUKS_TAG_ACCESS_TIME: 10003, - HUKS_TAG_USES_TIME: 10004, - HUKS_TAG_CRYPTO_CTX: 10005, - HUKS_TAG_KEY: 10006, - HUKS_TAG_KEY_VERSION: 10007, - HUKS_TAG_PAYLOAD_LEN: 10008, - HUKS_TAG_AE_TAG: 10009, - HUKS_TAG_IS_KEY_HANDLE: 10010, - - HUKS_TAG_OS_VERSION: 10101, - HUKS_TAG_OS_PATCHLEVEL: 10102, - - HUKS_TAG_SYMMETRIC_KEY_DATA: 20001, - HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA: 20002, - HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA: 20003, -} - -export function mockHuks() { - const HuksParam = { - tag: HuksTag, - value: '[PC preview] unknow value', - } - const HuksHandle = { - errorCode: '[PC preview] unknow errorCode', - handle: '[PC preview] unknow handle', - token: paramMock.paramArrayMock, - } - const HuksOptions = { - properties: [HuksParam], - inData: paramMock.paramArrayMock, - } - const HuksResult = { - errorCode: '[PC preview] unknow errorCode', - outData: paramMock.paramArrayMock, - properties: [HuksParam], - certChains: [paramMock.paramStringMock], - } - const huks = { - HuksErrorCode, - HuksKeyPurpose, - HuksKeyDigest, - HuksKeyPadding, - HuksCipherMode, - HuksKeySize, - HuksKeyAlg, - HuksUnwrapSuite, - HuksKeyGenerateType, - HuksKeyFlag, - HuksKeyStorageType, - HuksImportKeyType, - HuksUserAuthType, - HuksAuthAccessType, - HuksChallengeType, - HuksChallengePosition, - HuksSecureSignType, - HuksSendType, - HuksTagType, - HuksTag, - - generateKey: function (...args) { - console.warn("huks.generateKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - deleteKey: function (...args) { - console.warn("huks.deleteKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - importKey: function (...args) { - console.warn("huks.importKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - importWrappedKey: function (...args) { - console.warn("huks.importWrappedKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - exportKey: function (...args) { - console.warn("huks.exportKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - getKeyProperties: function (...args) { - console.warn("huks.getKeyProperties 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - isKeyExist: function (...args) { - console.warn("huks.isKeyExist 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, reject) => { - resolve(paramMock.paramBooleanMock) - }) - } - }, - init: function (...args) { - console.warn("huks.init 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, HuksHandle) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - update: function (...args) { - console.warn("huks.update 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - finish: function (...args) { - console.warn("huks.finish 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - abort: function (...args) { - console.warn("huks.abort 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - attestKey: function (...args) { - console.warn("huks.attestKey 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, HuksResult) - } else { - return new Promise((resolve, reject) => { - resolve(HuksResult) - }) - } - }, - getSdkVersion: function (...args) { - console.warn("huks.getSdkVersion 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 huks -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_securitylabel.js b/runtime/main/extend/systemplugin/napi/ohos_securitylabel.js deleted file mode 100644 index 3270c0a2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_securitylabel.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 mockSecurityLabel() { - const securitylabel = { - setSecurityLabel: function (...args) { - console.warn("securitylabel.setSecurityLabel 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setSecurityLabelSync: function (...args) { - console.warn("securitylabel.setSecurityLabelSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getSecurityLabel: function (...args) { - console.warn("securitylabel.getSecurityLabel 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSecurityLabelSync: function (...args) { - console.warn("securitylabel.getSecurityLabelSync 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 securitylabel; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_sensor.js b/runtime/main/extend/systemplugin/napi/ohos_sensor.js deleted file mode 100644 index 46cac30a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_sensor.js +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) 2021-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 mockSensor() { - const AccelerometerResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - timestamp: '[PC preview] unknown timestamp' - } - const LinearAccelerometerResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - timestamp: '[PC preview] unknown timestamp' - } - const AccelerometerUncalibratedResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - biasX: '[PC preview] unknown biasX', - biasY: '[PC preview] unknown biasY', - biasZ: '[PC preview] unknown biasZ', - timestamp: '[PC preview] unknown timestamp' - } - const GravityResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - timestamp: '[PC preview] unknown timestamp' - } - const OrientationResponse = { - alpha: '[PC preview] unknown alpha', - beta: '[PC preview] unknown beta', - gamma: '[PC preview] unknown gamma', - timestamp: '[PC preview] unknown timestamp' - } - const RotationVectorResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - w: '[PC preview] unknown w', - timestamp: '[PC preview] unknown timestamp' - } - const GyroscopeResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - timestamp: '[PC preview] unknown timestamp' - } - const GyroscopeUncalibratedResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - biasX: '[PC preview] unknown biasX', - biasY: '[PC preview] unknown biasY', - biasZ: '[PC preview] unknown biasZ', - timestamp: '[PC preview] unknown timestamp' - } - const SignificantMotionResponse = { - scalar: '[PC preview] unknown scalar', - timestamp: '[PC preview] unknown timestamp' - } - const ProximityResponse = { - distance: '[PC preview] unknown distance', - timestamp: '[PC preview] unknown timestamp' - } - const LightResponse = { - intensity: '[PC preview] unknown intensity', - timestamp: '[PC preview] unknown timestamp' - } - const HallResponse = { - status: '[PC preview] unknown status', - timestamp: '[PC preview] unknown timestamp' - } - const MagneticFieldResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - timestamp: '[PC preview] unknown timestamp' - } - const MagneticFieldUncalibratedResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - biasX: '[PC preview] unknown biasX', - biasY: '[PC preview] unknown biasY', - biasZ: '[PC preview] unknown biasZ', - timestamp: '[PC preview] unknown timestamp' - } - const PedometerResponse = { - steps: '[PC preview] unknown steps', - timestamp: '[PC preview] unknown timestamp' - } - const HumidityResponse = { - humidity: '[PC preview] unknown humidity', - timestamp: '[PC preview] unknown timestamp' - } - const PedometerDetectResponse = { - scalar: '[PC preview] unknown scalar', - timestamp: '[PC preview] unknown timestamp' - } - const AmbientTemperatureResponse = { - temperature: '[PC preview] unknown temperature', - timestamp: '[PC preview] unknown timestamp' - } - const BarometerResponse = { - pressure: '[PC preview] unknown pressure', - timestamp: '[PC preview] unknown timestamp' - } - const HeartRateResponse = { - heartRate: '[PC preview] unknown heartRate', - timestamp: '[PC preview] unknown timestamp' - } - const WearDetectionResponse = { - value: '[PC preview] unknown value', - timestamp: '[PC preview] unknown timestamp' - } - const Options = { - interval: '[PC preview] unknown value' - } - const GeomagneticResponse = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y', - z: '[PC preview] unknown z', - geomagneticDip: '[PC preview] unknown geomagneticDip', - deflectionAngle: '[PC preview] unknown deflectionAngle', - levelIntensity: '[PC preview] unknown levelIntensity', - totalIntensity: '[PC preview] unknown totalIntensity' - } - const PedometerDetectionResponse = { - scalar: '[PC preview] unknown scalar', - timestamp: '[PC preview] unknown timestamp' - } - const Response = { - timestamp: '[PC preview] unknown timestamp' - } - const LocationOptions = { - latitude: '[PC preview] unknown latitude', - longitude: '[PC preview] unknown longitude', - altitude: '[PC preview] unknown altitude' - } - const CoordinatesOptions = { - x: '[PC preview] unknown x', - y: '[PC preview] unknown y' - } - const RotationMatrixResponse = { - rotation: '[PC preview] unknown rotation', - inclination: '[PC preview] unknown inclination' - } - const Sensor = { - sensorName: '[PC preview] unknown sensorName', - venderName: '[PC preview] unknown venderName', - firmwareVersion: '[PC preview] unknown firmwareVersion', - hardwareVersion: '[PC preview] unknown hardwareVersion', - sensorTypeId: '[PC preview] unknown sensorTypeId', - maxRange: '[PC preview] unknown maxRange', - precision: '[PC preview] unknown precision', - power: '[PC preview] unknown power' - } - const SensorType = { - SENSOR_TYPE_ID_ACCELEROMETER: 1, - SENSOR_TYPE_ID_GYROSCOPE: 2, - SENSOR_TYPE_ID_AMBIENT_LIGHT: 5, - SENSOR_TYPE_ID_MAGNETIC_FIELD: 6, - SENSOR_TYPE_ID_BAROMETER: 8, - SENSOR_TYPE_ID_HALL: 10, - SENSOR_TYPE_ID_PROXIMITY: 12, - SENSOR_TYPE_ID_HUMIDITY: 13, - SENSOR_TYPE_ID_ORIENTATION: 256, - SENSOR_TYPE_ID_GRAVITY: 257, - SENSOR_TYPE_ID_LINEAR_ACCELERATION: 258, - SENSOR_TYPE_ID_LINEAR_ACCELEROMETER: 258, - SENSOR_TYPE_ID_ROTATION_VECTOR: 259, - SENSOR_TYPE_ID_AMBIENT_TEMPERATURE: 260, - SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED: 261, - SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED: 263, - SENSOR_TYPE_ID_SIGNIFICANT_MOTION: 264, - SENSOR_TYPE_ID_PEDOMETER_DETECTION: 265, - SENSOR_TYPE_ID_PEDOMETER: 266, - SENSOR_TYPE_ID_HEART_RATE: 278, - SENSOR_TYPE_ID_HEART_BEAT_RATE: 278, - SENSOR_TYPE_ID_WEAR_DETECTION: 280, - SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED: 281 - } - const sensor = { - Sensor, - SensorType, - on: function (...args) { - console.warn('sensor.on 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; - const callback = typeof args[len - 1] === 'function' ? args[len - 1] : args[len - 2]; - if (args[0] == 1) { - callback.call(this, AccelerometerResponse); - } else if (args[0] == 2) { - callback.call(this, GyroscopeResponse); - } else if (args[0] == 5) { - callback.call(this, LightResponse); - } else if (args[0] == 6) { - callback.call(this, MagneticFieldResponse); - } else if (args[0] == 8) { - callback.call(this, BarometerResponse); - } else if (args[0] == 10) { - callback.call(this, HallResponse); - } else if (args[0] == 12) { - callback.call(this, ProximityResponse); - } else if (args[0] == 13) { - callback.call(this, HumidityResponse); - } else if (args[0] == 256) { - callback.call(this, OrientationResponse); - } else if (args[0] == 257) { - callback.call(this, GravityResponse); - } else if (args[0] == 258) { - callback.call(this, LinearAccelerometerResponse); - } else if (args[0] == 259) { - callback.call(this, RotationVectorResponse); - } else if (args[0] == 260) { - callback.call(this, AmbientTemperatureResponse); - } else if (args[0] == 261) { - callback.call(this, MagneticFieldUncalibratedResponse); - } else if (args[0] == 263) { - callback.call(this, GyroscopeUncalibratedResponse); - } else if (args[0] == 264) { - callback.call(this, SignificantMotionResponse); - } else if (args[0] == 265) { - callback.call(this, PedometerDetectResponse); - } else if (args[0] == 266) { - callback.call(this, PedometerResponse); - } else if (args[0] == 278) { - callback.call(this, HeartRateResponse); - } else if (args[0] == 280) { - callback.call(this, WearDetectionResponse); - } else if (args[0] == 281) { - callback.call(this, AccelerometerUncalibratedResponse); - } - }, - once: function (...args) { - console.warn('sensor.once 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 (args[0] == 1) { - args[len - 1].call(this, AccelerometerResponse); - } else if (args[0] == 2) { - args[len - 1].call(this, GyroscopeResponse); - } else if (args[0] == 5) { - args[len - 1].call(this, LightResponse); - } else if (args[0] == 6) { - args[len - 1].call(this, MagneticFieldResponse); - } else if (args[0] == 8) { - args[len - 1].call(this, BarometerResponse); - } else if (args[0] == 10) { - args[len - 1].call(this, HallResponse); - } else if (args[0] == 12) { - args[len - 1].call(this, ProximityResponse); - } else if (args[0] == 13) { - args[len - 1].call(this, HumidityResponse); - } else if (args[0] == 256) { - args[len - 1].call(this, OrientationResponse); - } else if (args[0] == 257) { - args[len - 1].call(this, GravityResponse); - } else if (args[0] == 258) { - args[len - 1].call(this, LinearAccelerometerResponse); - } else if (args[0] == 259) { - args[len - 1].call(this, RotationVectorResponse); - } else if (args[0] == 260) { - args[len - 1].call(this, AmbientTemperatureResponse); - } else if (args[0] == 261) { - args[len - 1].call(this, MagneticFieldUncalibratedResponse); - } else if (args[0] == 263) { - args[len - 1].call(this, GyroscopeUncalibratedResponse); - } else if (args[0] == 264) { - args[len - 1].call(this, SignificantMotionResponse); - } else if (args[0] == 265) { - args[len - 1].call(this, PedometerDetectResponse); - } else if (args[0] == 266) { - args[len - 1].call(this, PedometerResponse); - } else if (args[0] == 278) { - args[len - 1].call(this, HeartRateResponse); - } else if (args[0] == 280) { - args[len - 1].call(this, WearDetectionResponse); - } else if (args[0] == 281) { - args[len - 1].call(this, AccelerometerUncalibratedResponse); - } - }, - off: function (...args) { - console.warn('sensor.off interface mocked in the Previewer. How this interface works on the' - + 'Previewer may be different from that on a real device.') - }, - getGeomagneticField: function (...args) { - console.warn('sensor.getGeomagneticField 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, GeomagneticResponse); - } else { - return new Promise((resolve, reject) => { - resolve(GeomagneticResponse); - }); - } - }, - getAltitude: function (...args) { - console.warn('sensor.getAltitude 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getGeomagneticDip: function (...args) { - console.warn('sensor.getGeomagneticDip 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getAngleModify: function (...args) { - console.warn('sensor.getAngleModifiy 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.paraNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paraNumberMock]); - }); - } - }, - createRotationMatrix: function (...args) { - console.warn('sensor.createRotationMatrix 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 == 1) { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }); - } else if (len == 2) { - if (typeof args[len - 1] == 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(RotationMatrixResponse); - }); - } - } else if (len == 3) { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.RotationMatrixResponse); - } - - }, - transformCoordinateSystem: function (...args) { - console.warn('sensor.transformCoordinateSystem 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.paraNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paraNumberMock]); - }); - } - }, - createQuaternion: function (...args) { - console.warn('sensor.createQuaternion 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.paraNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paraNumberMock]); - }); - } - }, - getDirection: function (...args) { - console.warn('sensor.getDirection 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.paraNumberMock]); - } else { - return new Promise((resolve, reject) => { - resolve([paramMock.paraNumberMock]); - }); - } - }, - getSingleSensor: function (...args) { - console.warn('sensor.getSingleSensor 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, Sensor); - } else { - return new Promise((resolve, reject) => { - resolve(Sensor); - }); - } - }, - getSensorLists: function (...args) { - console.warn('sensor.getSensorLists 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,new Array(Sensor)); - } else { - return new Promise((resolve, reject) => { - resolve(Array(Sensor)); - }); - } - } - }; - return sensor -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_settings.js b/runtime/main/extend/systemplugin/napi/ohos_settings.js deleted file mode 100644 index 4ae14fbe..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_settings.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2021-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 mockSettings() { - const date = { - DATE_FORMAT: "[PC Preview] unknow DATE_FORMAT", - TIME_FORMAT: "[PC Preview] unknow TIME_FORMAT", - AUTO_GAIN_TIME: "[PC Preview] unknow AUTO_GAIN_TIME", - AUTO_GAIN_TIME_ZONE: "[PC Preview] unknow AUTO_GAIN_TIME_ZONE", - }; - const display = { - FONT_SCALE: "[PC Preview] unknow FONT_SCALE", - SCREEN_BRIGHTNESS_STATUS: "[PC Preview] unknow SCREEN_BRIGHTNESS_STATUS", - AUTO_SCREEN_BRIGHTNESS: "[PC Preview] unknow AUTO_SCREEN_BRIGHTNESS", - AUTO_SCREEN_BRIGHTNESS_MODE: "[PC Preview] unknow AUTO_SCREEN_BRIGHTNESS_MODE", - MANUAL_SCREEN_BRIGHTNESS_MODE: "[PC Preview] unknow MANUAL_SCREEN_BRIGHTNESS_MODE", - SCREEN_OFF_TIMEOUT: "[PC Preview] unknow SCREEN_OFF_TIMEOUT", - DEFAULT_SCREEN_ROTATION: "[PC Preview] unknow DEFAULT_SCREEN_ROTATION", - ANIMATOR_DURATION_SCALE: "[PC Preview] unknow ANIMATOR_DURATION_SCALE", - TRANSITION_ANIMATION_SCALE: "[PC Preview] unknow TRANSITION_ANIMATION_SCALE", - WINDOW_ANIMATION_SCALE: "[PC Preview] unknow WINDOW_ANIMATION_SCALE", - DISPLAY_INVERSION_STATUS: "[PC Preview] unknow DISPLAY_INVERSION_STATUS", - }; - const general = { - SETUP_WIZARD_FINISHED: "[PC Preview] unknow SETUP_WIZARD_FINISHED", - END_BUTTON_ACTION: "[PC Preview] unknow END_BUTTON_ACTION", - ACCELEROMETER_ROTATION_STATUS: "[PC Preview] unknow ACCELEROMETER_ROTATION_STATUS", - AIRPLANE_MODE_STATUS: "[PC Preview] unknow AIRPLANE_MODE_STATUS", - DEVICE_PROVISION_STATUS: "[PC Preview] unknow DEVICE_PROVISION_STATUS", - HDC_STATUS: "[PC Preview] unknow HDC_STATUS", - BOOT_COUNTING: "[PC Preview] unknow BOOT_COUNTING", - CONTACT_METADATA_SYNC_STATUS: "[PC Preview] unknow CONTACT_METADATA_SYNC_STATUS", - DEVELOPMENT_SETTINGS_STATUS: "[PC Preview] unknow DEVELOPMENT_SETTINGS_STATUS", - DEVICE_NAME: "[PC Preview] unknow DEVICE_NAME", - USB_STORAGE_STATUS: "[PC Preview] unknow USB_STORAGE_STATUS", - DEBUGGER_WAITING: "[PC Preview] unknow DEBUGGER_WAITING", - DEBUG_APP_PACKAGE: "[PC Preview] unknow DEBUG_APP_PACKAGE", - ACCESSIBILITY_STATUS: "[PC Preview] unknow ACCESSIBILITY_STATUS", - ACTIVATED_ACCESSIBILITY_SERVICES: "[PC Preview] unknow ACTIVATED_ACCESSIBILITY_SERVICES", - GEOLOCATION_ORIGINS_ALLOWED: "[PC Preview] unknow GEOLOCATION_ORIGINS_ALLOWED", - SKIP_USE_HINTS: "[PC Preview] unknow SKIP_USE_HINTS", - TOUCH_EXPLORATION_STATUS: "[PC Preview] unknow TOUCH_EXPLORATION_STATUS", - }; - const input = { - DEFAULT_INPUT_METHOD: "[PC Preview] unknow DEFAULT_INPUT_METHOD", - ACTIVATED_INPUT_METHOD_SUB_MODE: "[PC Preview] unknow ACTIVATED_INPUT_METHOD_SUB_MODE", - ACTIVATED_INPUT_METHODS: "[PC Preview] unknow ACTIVATED_INPUT_METHODS", - SELECTOR_VISIBILITY_FOR_INPUT_METHOD: "[PC Preview] unknow SELECTOR_VISIBILITY_FOR_INPUT_METHOD", - AUTO_CAPS_TEXT_INPUT: "[PC Preview] unknow AUTO_CAPS_TEXT_INPUT", - AUTO_PUNCTUATE_TEXT_INPUT: "[PC Preview] unknow AUTO_PUNCTUATE_TEXT_INPUT", - AUTO_REPLACE_TEXT_INPUT: "[PC Preview] unknow AUTO_REPLACE_TEXT_INPUT", - SHOW_PASSWORD_TEXT_INPUT: "[PC Preview] unknow SHOW_PASSWORD_TEXT_INPUT", - }; - const network = { - DATA_ROAMING_STATUS: "[PC Preview] unknow DATA_ROAMING_STATUS", - HTTP_PROXY_CFG: "[PC Preview] unknow HTTP_PROXY_CFG", - NETWORK_PREFERENCE_USAGE: "[PC Preview] unknow NETWORK_PREFERENCE_USAGE", - }; - const phone = { - RTT_CALLING_STATUS: "[PC Preview] unknow RTT_CALLING_STATUS", - }; - const sound = { - VIBRATE_WHILE_RINGING: "[PC Preview] unknow VIBRATE_WHILE_RINGING", - DEFAULT_ALARM_ALERT: "[PC Preview] unknow DEFAULT_ALARM_ALERT", - DTMF_TONE_TYPE_WHILE_DIALING: "[PC Preview] unknow DTMF_TONE_TYPE_WHILE_DIALING", - DTMF_TONE_WHILE_DIALING: "[PC Preview] unknow DTMF_TONE_WHILE_DIALING", - AFFECTED_MODE_RINGER_STREAMS: "[PC Preview] unknow AFFECTED_MODE_RINGER_STREAMS", - AFFECTED_MUTE_STREAMS: "[PC Preview] unknow AFFECTED_MUTE_STREAMS", - DEFAULT_NOTIFICATION_SOUND: "[PC Preview] unknow DEFAULT_NOTIFICATION_SOUND", - DEFAULT_RINGTONE: "[PC Preview] unknow DEFAULT_RINGTONE", - SOUND_EFFECTS_STATUS: "[PC Preview] unknow SOUND_EFFECTS_STATUS", - VIBRATE_STATUS: "[PC Preview] unknow VIBRATE_STATUS", - HAPTIC_FEEDBACK_STATUS: "[PC Preview] unknow HAPTIC_FEEDBACK_STATUS", - }; - const TTS = { - DEFAULT_TTS_PITCH: "[PC Preview] unknow DEFAULT_TTS_PITCH", - DEFAULT_TTS_RATE: "[PC Preview] unknow DEFAULT_TTS_RATE", - DEFAULT_TTS_SYNTH: "[PC Preview] unknow DEFAULT_TTS_SYNTH", - ENABLED_TTS_PLUGINS: "[PC Preview] unknow ENABLED_TTS_PLUGINS", - }; - const wireless = { - BLUETOOTH_DISCOVER_ABILITY_STATUS: "[PC Preview] unknow DEFAULT_TTBLUETOOTH_DISCOVER_ABILITY_STATUSS_PITCH", - BLUETOOTH_DISCOVER_TIMEOUT: "[PC Preview] unknow BLUETOOTH_DISCOVER_TIMEOUT", - AIRPLANE_MODE_RADIOS: "[PC Preview] unknow AIRPLANE_MODE_RADIOS", - BLUETOOTH_STATUS: "[PC Preview] unknow BLUETOOTH_STATUS", - BLUETOOTH_RADIO: "[PC Preview] unknow BLUETOOTH_RADIO", - CELL_RADIO: "[PC Preview] unknow CELL_RADIO", - NFC_RADIO: "[PC Preview] unknow NFC_RADIO", - WIFI_RADIO: "[PC Preview] unknow WIFI_RADIO", - OWNER_LOCKDOWN_WIFI_CFG: "[PC Preview] unknow OWNER_LOCKDOWN_WIFI_CFG", - WIFI_DHCP_MAX_RETRY_COUNT: "[PC Preview] unknow WIFI_DHCP_MAX_RETRY_COUNT", - WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT: "[PC Preview] unknow WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT", - WIFI_STATUS: "[PC Preview] unknow WIFI_STATUS", - WIFI_WATCHDOG_STATUS: "[PC Preview] unknow WIFI_WATCHDOG_STATUS", - }; - const settings = { - date, - display, - general, - input, - network, - phone, - sound, - TTS, - wireless, - getURI: function (...args) { - console.warn("settings.getURI 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.paramObjectMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramObjectMock) - }) - } - }, - getValue: function (...args) { - console.warn("settings.getValue 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.paramObjectMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramObjectMock) - }) - } - }, - setValue: function (...args) { - console.warn("settings.setValue 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) - }) - } - }, - enableAirplaneMode: function (...args) { - console.warn("settings.enableAirplaneMode 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - canShowFloating: function (...args) { - console.warn("settings.canShowFloating 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) - }) - } - }, - getUriSync: function (...args) { - console.warn("settings.getUriSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock - }, - getValueSync: function (...args) { - console.warn("settings.getValueSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramStringMock - }, - setValueSync: function (...args) { - console.warn("settings.getValueSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramBooleanMock - }, - }; - return settings; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_statfs.js b/runtime/main/extend/systemplugin/napi/ohos_statfs.js deleted file mode 100644 index 21d5ca6f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_statfs.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 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 mockStatfs() { - const statfs = { - getFreeBytes: function (...args) { - console.warn("statfs.getFreeBytes 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTotalBytes: function (...args) { - console.warn("statfs.getTotalBytes 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } - return statfs; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_storageStatistics.js b/runtime/main/extend/systemplugin/napi/ohos_storageStatistics.js deleted file mode 100644 index 4f4c7511..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_storageStatistics.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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 mockStorageStatistics() { - const BundleStats = { - appSize: '[PC preview] unknow appSize', - cacheSize: '[PC preview] unknow cacheSize', - dataSize: '[PC preview] unknow dataSize' - }; - const StorageStats= { - total: '[PC preview] unknow total', - audio: '[PC preview] unknow audio', - video: '[PC preview] unknow video', - image: '[PC preview] unknow image', - file: '[PC preview] unknow file', - app: '[PC preview] unknow app' - } - const storageStatistics = { - BundleStats: BundleStats, - StorageStats: StorageStats, - getTotalSizeOfVolume: function(...args) { - console.warn('storageStatistics.getTotalSizeOfVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getFreeSizeOfVolume: function(...args) { - console.warn('storageStatistics.getFreeSizeOfVolume 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getBundleStats: function(...args) { - console.warn('storageStatistics.getBundleStats 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, BundleStatsMock); - } else { - return new Promise((resolve, reject) => { - resolve(BundleStatsMock); - }); - } - }, - getCurrentBundleStats: function(...args) { - console.warn('storageStatistics.getCurrentBundleStats 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, BundleStats); - } else { - return new Promise((resolve, reject) => { - resolve(BundleStats); - }); - } - }, - getSystemSize: function(...args) { - console.warn('storageStatistics.getSystemSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getUserStorageStats: function(...args) { - console.warn('storageStatistics.getUserStorageStats 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, StorageStats); - } else { - return new Promise((resolve, reject) => { - resolve(StorageStats); - }); - } - }, - getTotalSize: function(...args) { - console.warn('storageStatistics.getTotalSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getFreeSize: function(...args) { - console.warn('storageStatistics.getFreeSize 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - } - }; - return storageStatistics; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_systemCapability.js b/runtime/main/extend/systemplugin/napi/ohos_systemCapability.js deleted file mode 100644 index dfec3a99..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_systemCapability.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 mockSystemCapability() { - const systemCapability = { - querySystemCapabilities: function (...args) { - console.warn("systemCapability.querySystemCapabilities 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, reject) => { - resolve(paramMock.paramStringMock); - }); - } - } - } - return systemCapability -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_systemTime.js b/runtime/main/extend/systemplugin/napi/ohos_systemTime.js deleted file mode 100644 index 4ed40e69..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_systemTime.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2021 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 mockSystemTime() { - const systemTime = { - setTime: function (...args) { - console.warn('systemTime.setTime 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getCurrentTime: function (...args) { - console.warn('systemTime.getCurrentTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getCurrentTimeNs: function (...args) { - console.warn('systemTime.getCurrentTimeNs 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealActiveTime: function (...args) { - console.warn('systemTime.getRealActiveTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealActiveTimeNs: function (...args) { - console.warn('systemTime.getRealActiveTimeNs 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealTime: function (...args) { - console.warn('systemTime.getRealTime 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getRealTimeNs: function (...args) { - console.warn('systemTime.getRealTimeNs 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setDate: function (...args) { - console.warn('systemTime.setDate 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getDate: function (...args) { - console.warn('systemTime.getDate 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.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }); - } - }, - setTimezone: function (...args) { - console.warn('systemTime.setTimezone 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }); - } - }, - getTimeZone: function (...args) { - console.warn('systemTime.getTimeZone 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, reject) => { - resolve(paramMock.paramStringMock); - }); - } - }, - } - return systemTime -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_systemTimer.js b/runtime/main/extend/systemplugin/napi/ohos_systemTimer.js deleted file mode 100644 index 0eeefe7b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_systemTimer.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2021-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 { WantAgent } from "./ohos_wantAgent" - -export function mockSystemTimer() { - const systemTimer = { - TIMER_TYPE_REALTIME: '[PC preview] unknow TIMER_TYPE_REALTIME', - TIMER_TYPE_WAKEUP: '[PC preview] unknow TIMER_TYPE_WAKEUP', - TIMER_TYPE_EXACT: '[PC preview] unknow TIMER_TYPE_EXACT', - TIMER_TYPE_IDLE: '[PC preview] unknow TIMER_TYPE_IDLE', - createTimer: function (...args) { - console.warn("systemTimer.createTimer 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - startTimer: function (...args) { - console.warn("systemTimer.startTimer 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - stopTimer: function (...args) { - console.warn("systemTimer.stopTimer 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - destroyTimer: function (...args) { - console.warn("systemTimer.destroyTimer 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const TimerOptions = { - type: '[PC Preview] unknown type', - repeat: '[PC Preview] unknown repeat', - interval: '[PC Preview] unknown interval', - wantAgent: WantAgent, - callback:'[PC Preview] unknown interval' - } - return systemTimer -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_systemparameter.js b/runtime/main/extend/systemplugin/napi/ohos_systemparameter.js deleted file mode 100644 index 7991d6e8..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_systemparameter.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2021 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 mockSystemParameter() { - const systemParameter = { - getSync: function (...args) { - console.warn("systemParameter.getSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock - }, - get: function (...args) { - console.warn("systemParameter.get 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setSync: function (...args) { - console.warn("systemParameter.setSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - set: function (...args) { - console.warn("systemParameter.set 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return systemParameter -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_call.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_call.js deleted file mode 100644 index e9f0a908..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_call.js +++ /dev/null @@ -1,804 +0,0 @@ -/* - * Copyright (c) 2021 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 ImsCallMode = { - CALL_MODE_AUDIO_ONLY: 0, - CALL_MODE_SEND_ONLY: 1, - CALL_MODE_RECEIVE_ONLY: 2, - CALL_MODE_SEND_RECEIVE: 3, - CALL_MODE_VIDEO_PAUSED: 4, -} -export const AudioDevice = { - DEVICE_MIC: "[PC Preview] unknow DEVICE_MIC", - DEVICE_SPEAKER: "[PC Preview] unknow DEVICE_SPEAKER", - DEVICE_WIRED_HEADSET: "[PC Preview] unknow DEVICE_WIRED_HEADSET", - DEVICE_BLUETOOTH_SCO: "[PC Preview] unknow DEVICE_BLUETOOTH_SCO", -} -export const CallRestrictionType = { - RESTRICTION_TYPE_ALL_INCOMING: 0, - RESTRICTION_TYPE_ALL_OUTGOING: 1, - RESTRICTION_TYPE_INTERNATIONAL: 2, - RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME: 3, - RESTRICTION_TYPE_ROAMING_INCOMING: 4, - RESTRICTION_TYPE_ALL_CALLS: 5, - RESTRICTION_TYPE_OUTGOING_SERVICES: 6, - RESTRICTION_TYPE_INCOMING_SERVICES: 7, -} -export const CallTransferInfo = { - transferNum: "[PC Preview] unknow transferNum", - type: CallTransferType, - settingType: CallTransferSettingType, -} -export const CallTransferSettingType = { - CALL_TRANSFER_DISABLE: 0, - CALL_TRANSFER_ENABLE: 1, - CALL_TRANSFER_REGISTRATION: 3, - CALL_TRANSFER_ERASURE: 4, -} -export const CallTransferType = { - TRANSFER_TYPE_UNCONDITIONAL: 0, - TRANSFER_TYPE_BUSY: 1, - TRANSFER_TYPE_NO_REPLY: 2, - TRANSFER_TYPE_NOT_REACHABLE: 3, -} -export const ConferenceState = { - TEL_CONFERENCE_IDLE: 0, - TEL_CONFERENCE_ACTIVE: 1, - TEL_CONFERENCE_DISCONNECTING: 2, - TEL_CONFERENCE_DISCONNECTED: 3, -}; -export const CallType = { - TYPE_CS: 0, - TYPE_IMS: 1, - TYPE_OTT: 2, - TYPE_ERR_CALL: 3, -} -export const VideoStateType = { - TYPE_VOICE: 0, - TYPE_VIDEO: 1, -} -export const DetailedCallState = { - CALL_STATUS_ACTIVE: 0, - CALL_STATUS_HOLDING: 1, - CALL_STATUS_DIALING: 2, - CALL_STATUS_ALERTING: 3, - CALL_STATUS_INCOMING: 4, - CALL_STATUS_WAITING: 5, - CALL_STATUS_DISCONNECTED: 6, - CALL_STATUS_DISCONNECTING: 7, - CALL_STATUS_IDLE: 8, -} -export const CallState = { - CALL_STATE_UNKNOWN: -1, - CALL_STATE_IDLE: 0, - CALL_STATE_RINGING: 1, - CALL_STATE_OFFHOOK: 2, -} -export const CallRestrictionInfo = { - type: CallRestrictionType, - password: "[PC Preview] unknow password", - mode: CallRestrictionMode, -} -export const DialOptions = { - extras: "[PC Preview] unknow extras", - accountId: "[PC Preview] unknow accountId", - videoState: VideoStateType, - dialScene: DialScene, - dialType: DialType, -} -export const DialScene = { - CALL_NORMAL: 0, - CALL_PRIVILEGED: 1, - CALL_EMERGENCY: 2, -} -export const DialType = { - DIAL_CARRIER_TYPE: 0, - DIAL_VOICE_MAIL_TYPE: 1, - DIAL_OTT_TYPE: 2, -} -export const CallRestrictionMode = { - RESTRICTION_MODE_DEACTIVATION: 0, - RESTRICTION_MODE_ACTIVATION: 1, -} -export const CallEventOptions = { - eventId: CallAbilityEventId -} -export const NumberFormatOptions = { - countryCode: "[PC Preview] unknow countryCode" -} -export const CallAbilityEventId = { - EVENT_DIAL_NO_CARRIER: 1, - EVENT_INVALID_FDN_NUMBER: 2, -} -export const RejectMessageOptions = { - messageContent: "[PC Preview] unknow messageContent" -} -export const CallWaitingStatus = { - CALL_WAITING_DISABLE: 0, - CALL_WAITING_ENABLE: 1, -}; -export const RestrictionStatus = { - RESTRICTION_DISABLE: 0, - RESTRICTION_ENABLE: 1, -}; -export const TransferStatus = { - TRANSFER_DISABLE: 0, - TRANSFER_ENABLE: 1, -}; -export const CallAttributeOptions = { - accountNumber: "[PC Preview] unknow accountNumber", - speakerphoneOn: "[PC Preview] unknow speakerphoneOn", - accountId: "[PC Preview] unknow accountId", - videoState: VideoStateType, - startTime: "[PC Preview] unknow startTime", - isEcc: "[PC Preview] unknow isEcc", - callType: CallType, - callId: "[PC Preview] unknow callId", - callState: DetailedCallState, - conferenceState: ConferenceState, - status: "[PC Preview] unknow status", - number: "[PC Preview] unknow number", -} -export const EmergencyNumberOptions = { - slotId: "[PC Preview] unknow slotId" -} -export const CallTransferResult = { - status: "[PC Preview] unknow status", - number: "[PC Preview] unknow number", -} -export const DisconnectedDetails = { - UNASSIGNED_NUMBER: 1, - NO_ROUTE_TO_DESTINATION: 3, - CHANNEL_UNACCEPTABLE: 6, - OPERATOR_DETERMINED_BARRING: 8, - NORMAL_CALL_CLEARING: 16, - USER_BUSY: 17, - NO_USER_RESPONDING: 18, - USER_ALERTING_NO_ANSWER: 19, - CALL_REJECTED: 21, - NUMBER_CHANGED: 22, - DESTINATION_OUT_OF_ORDER: 27, - INVALID_NUMBER_FORMAT: 28, - NETWORK_OUT_OF_ORDER: 38, - TEMPORARY_FAILURE: 41, - INVALID_PARAMETER: 1025, - SIM_NOT_EXIT: 1026, - SIM_PIN_NEED: 1027, - CALL_NOT_ALLOW: 1029, - SIM_INVALID: 1045, - UNKNOWN: 1279, -}; -export function mockCall() { - const call = { - ImsCallMode, - AudioDevice, - CallRestrictionType, - TransferStatus, - CallTransferSettingType, - CallWaitingStatus, - CallTransferType, - ConferenceState, - DisconnectedDetails, - CallAbilityEventId, - CallType, - VideoStateType, - DetailedCallState, - CallState, - DialScene, - RestrictionStatus, - CallTransferResult, - DialType, - CallRestrictionMode, - dial: function (...args) { - console.warn("telephony.call.dial 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - makeCall: function (...args) { - console.warn("telephony.call.makeCall 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hasCall: function (...args) { - console.warn("telephony.call.hasCall 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getCallState: function (...args) { - console.warn("telephony.call.getCallState 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, CallState); - } else { - return new Promise((resolve, reject) => { - resolve(CallState); - }) - } - }, - displayCallScreen: function (...args) { - console.warn("telephony.call.displayCallScreen 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - muteRinger: function (...args) { - console.warn("telephony.call.muteRinger 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hasVoiceCapability: function () { - console.warn("telephony.call.hasVoiceCapability interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isVideoCallingEnabled: function (...args) { - console.warn("telephony.call.isVideoCallingEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - inputDialerSpecialCode: function (...args) { - console.warn("telephony.call.inputDialerSpecialCode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isHacEnabled: function (...args) { - console.warn("telephony.call.isHacEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isEmergencyPhoneNumber: function (...args) { - console.warn("telephony.call.isEmergencyPhoneNumber 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - formatPhoneNumber: function (...args) { - console.warn("telephony.call.formatPhoneNumber 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - formatPhoneNumberToE164: function (...args) { - console.warn("telephony.call.formatPhoneNumberToE164 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - comparePhoneNumbers: function (...args) { - console.warn("telephony.call.comparePhoneNumbers 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getCallerIndex: function (...args) { - console.warn("telephony.call.getCallerIndex 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCountryCodeFromDbNumber: function (...args) { - console.warn("telephony.call.getCountryCodeFromDbNumber 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getIntlPrefixAndCountryCodeLen: function (...args) { - console.warn("telephony.call.getIntlPrefixAndCountryCodeLen 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - answer: function (...args) { - console.warn("telephony.call.answer 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - hangup: function (...args) { - console.warn("telephony.call.hangup 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - reject: function (...args) { - console.warn("telephony.call.reject 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - holdCall: function (...args) { - console.warn("telephony.call.holdCall 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - unHoldCall: function (...args) { - console.warn("telephony.call.unHoldCall 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - switchCall: function (...args) { - console.warn("telephony.call.switchCall 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - combineConference: function (...args) { - console.warn("telephony.call.combineConference 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getMainCallId: function (...args) { - console.warn("telephony.call.getMainCallId 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSubCallIdList: function (...args) { - console.warn("telephony.call.getSubCallIdList 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getCallIdListForConference: function (...args) { - console.warn("telephony.call.getCallIdListForConference 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getCallWaitingStatus: function (...args) { - console.warn("telephony.call.getCallWaitingStatus 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, CallWaitingStatus); - } else { - return new Promise((resolve, reject) => { - resolve(CallWaitingStatus); - }) - } - }, - setCallWaiting: function (...args) { - console.warn("telephony.call.setCallWaiting 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - startDTMF: function (...args) { - console.warn("telephony.call.startDTMF 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - stopDTMF: function (...args) { - console.warn("telephony.call.stopDTMF 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isInEmergencyCall: function (...args) { - console.warn("telephony.call.isInEmergencyCall 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - on: function (...args) { - console.warn("telephony.call.on 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') { - if (args[0] == 'callDetailsChange') { - args[len - 1].call(this, CallAttributeOptions); - } else if (args[0] == 'callEventChange') { - args[len - 1].call(this, CallEventOptions); - } else if (args[0] == 'callDisconnectedCause') { - args[len - 1].call(this, DisconnectedDetails); - } - } - }, - off: function (...args) { - console.warn("telephony.call.off 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') { - if (args[0] == 'callDetailsChange') { - args[len - 1].call(this, CallAttributeOptions); - } else if (args[0] == 'callEventChange') { - args[len - 1].call(this, CallEventOptions); - } else if (args[0] == 'callDisconnectedCause') { - args[len - 1].call(this, DisconnectedDetails); - } - } - }, - cancelMuted: function (...args) { - console.warn("telephony.call.cancelMuted 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - joinConference: function (...args) { - console.warn("telephony.call.joinConference 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableImsSwitch: function (...args) { - console.warn("telephony.call.disableImsSwitch 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableImsSwitch: function (...args) { - console.warn("telephony.call.enableImsSwitch 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - updateImsCallMode: function (...args) { - console.warn("telephony.call.updateImsCallMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isNewCallAllowed: function (...args) { - console.warn("telephony.call.isNewCallAllowed 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - separateConference: function (...args) { - console.warn("telephony.call.separateConference 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCallRestrictionStatus: function (...args) { - console.warn("telephony.call.getCallRestrictionStatus 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, RestrictionStatus); - } else { - return new Promise((resolve, reject) => { - resolve(RestrictionStatus); - }) - } - }, - setCallRestriction: function (...args) { - console.warn("telephony.call.setCallRestriction 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setCallTransfer: function (...args) { - console.warn("telephony.call.setCallTransfer 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCallTransferInfo: function (...args) { - console.warn("telephony.call.getCallTransferInfo 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, CallTransferResult); - } else { - return new Promise((resolve, reject) => { - resolve(CallTransferResult); - }) - } - }, - setCallTransferInfo: function (...args) { - console.warn("telephony.call.setCallTransferInfo 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isRinging: function (...args) { - console.warn("telephony.call.isRinging 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isImsSwitchEnabled: function (...args) { - console.warn("telephony.call.isImsSwitchEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setMuted: function (...args) { - console.warn("telephony.call.setMuted 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setAudioDevice: function (...args) { - console.warn("telephony.call.setAudioDevice 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return call -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_data.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_data.js deleted file mode 100644 index 1319640f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_data.js +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2021 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 DataFlowType = { - DATA_FLOW_TYPE_NONE: 0, - DATA_FLOW_TYPE_DOWN: 1, - DATA_FLOW_TYPE_UP: 2, - DATA_FLOW_TYPE_UP_DOWN: 3, - DATA_FLOW_TYPE_DORMANT: 4, -}; -export const DataConnectState = { - DATA_STATE_UNKNOWN: -1, - DATA_STATE_DISCONNECTED: 0, - DATA_STATE_CONNECTING: 1, - DATA_STATE_CONNECTED: 2, - DATA_STATE_SUSPENDED: 3, -}; -export function mockData() { - const data = { - DataFlowType, - DataConnectState, - getDefaultCellularDataSlotId: function (...args) { - console.warn("telephony.data.getDefaultCellularDataSlotId 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDefaultCellularDataSlotId: function (...args) { - console.warn("telephony.data.setDefaultCellularDataSlotId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCellularDataFlowType: function (...args) { - console.warn("telephony.data.getCellularDataFlowType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCellularDataState: function (...args) { - console.warn("telephony.data.getCellularDataState 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isCellularDataEnabled: function (...args) { - console.warn("telephony.data.isCellularDataEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableCellularData: function (...args) { - console.warn("telephony.data.enableCellularData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableCellularData: function (...args) { - console.warn("telephony.data.disableCellularData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - isCellularDataRoamingEnabled: function (...args) { - console.warn("telephony.data.isCellularDataRoamingEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableCellularDataRoaming: function (...args) { - console.warn("telephony.data.enableCellularDataRoaming 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableCellularDataRoaming: function (...args) { - console.warn("telephony.data.disableCellularDataRoaming 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return data -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_observer.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_observer.js deleted file mode 100644 index 0f3ef44e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_observer.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2021 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 { CardType, SimState } from "./ohos_telephony_sim" -export const LockReason = { - SIM_NONE: "[PC Preview] unknow SIM_NONE", - SIM_PIN: "[PC Preview] unknow SIM_PIN", - SIM_PUK: "[PC Preview] unknow SIM_PUK", - SIM_PN_PIN: "[PC Preview] unknow SIM_PN_PIN", - SIM_PN_PUK: "[PC Preview] unknow SIM_PN_PUK", - SIM_PU_PIN: "[PC Preview] unknow SIM_PU_PIN", - SIM_PU_PUK: "[PC Preview] unknow SIM_PU_PUK", - SIM_PP_PIN: "[PC Preview] unknow SIM_PP_PIN", - SIM_PP_PUK: "[PC Preview] unknow SIM_PP_PUK", - SIM_PC_PIN: "[PC Preview] unknow SIM_PC_PIN", - SIM_PC_PUK: "[PC Preview] unknow SIM_PC_PUK", - SIM_SIM_PIN: "[PC Preview] unknow SIM_SIM_PIN", - SIM_SIM_PUK: "[PC Preview] unknow SIM_SIM_PUK", -}; -export const SimStateData = { - type: CardType, - state: SimState, - reason: LockReason, -} -export function mockObserver() { - const observer = { - LockReason, - on: function (...args) { - console.warn("telephony.observer.on 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') { - if (args[0] === 'networkStateChange') { - args[len - 1].call(this, NetworkState); - } else if (args[0] === 'signalInfoChange') { - args[len - 1].call(this, [SignalInformation]); - } else if (args[0] === 'cellInfoChange') { - args[len - 1].call(this, [CellInformation]); - } else if (args[0] === 'cellularDataConnectionStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - network: "[PC Preview] unknow network" - }); - } else if (args[0] === 'cellularDataFlowChange') { - args[len - 1].call(this, DataFlowType); - } else if (args[0] === 'callStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - number: "[PC Preview] unknow number" - }); - } else if (args[0] === 'cfuIndicatorChange' || 'voiceMailMsgIndicatorChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'simStateChange') { - args[len - 1].call(this, SimStateData); - } - } - }, - off: function (...args) { - console.warn("telephony.observer.off 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') { - if (args[0] === 'networkStateChange') { - args[len - 1].call(this, NetworkState); - } else if (args[0] === 'signalInfoChange') { - args[len - 1].call(this, [SignalInformation]); - } else if (args[0] === 'cellInfoChange') { - args[len - 1].call(this, [CellInformation]); - } else if (args[0] === 'cellularDataConnectionStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - network: "[PC Preview] unknow network" - }); - } else if (args[0] === 'cellularDataFlowChange') { - args[len - 1].call(this, DataFlowType); - } else if (args[0] === 'callStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - number: "[PC Preview] unknow number" - }); - } else if (args[0] === 'cfuIndicatorChange' || 'voiceMailMsgIndicatorChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'simStateChange') { - args[len - 1].call(this, SimStateData); - } - } - }, - once: function (...args) { - console.warn("telephony.observer.once 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') { - if (args[0] === 'networkStateChange') { - args[len - 1].call(this, NetworkState); - } else if (args[0] === 'signalInfoChange') { - args[len - 1].call(this, [SignalInformation]); - } else if (args[0] === 'cellInfoChange') { - args[len - 1].call(this, [CellInformation]); - } else if (args[0] === 'cellularDataConnectionStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - network: "[PC Preview] unknow network" - }); - } else if (args[0] === 'cellularDataFlowChange') { - args[len - 1].call(this, DataFlowType); - } else if (args[0] === 'callStateChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { - state: "[PC Preview] unknow state", - number: "[PC Preview] unknow number" - }); - } else if (args[0] === 'cfuIndicatorChange' || 'voiceMailMsgIndicatorChange') { - args[len - 1].call(this, paramMock.paramBooleanMock); - } else if (args[0] === 'simStateChange') { - args[len - 1].call(this, SimStateData); - } - } - } - } - return observer -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_radio.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_radio.js deleted file mode 100644 index 56de5d38..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_radio.js +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2021 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 PreferredNetworkMode = { - PREFERRED_NETWORK_MODE_GSM: 1, - PREFERRED_NETWORK_MODE_WCDMA: 2, - PREFERRED_NETWORK_MODE_LTE: 3, - PREFERRED_NETWORK_MODE_LTE_WCDMA: 4, - PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM: 5, - PREFERRED_NETWORK_MODE_WCDMA_GSM: 6, - PREFERRED_NETWORK_MODE_CDMA: 7, - PREFERRED_NETWORK_MODE_EVDO: 8, - PREFERRED_NETWORK_MODE_EVDO_CDMA: 9, - PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA: 10, - PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA: 11, - PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA: 12, - PREFERRED_NETWORK_MODE_TDSCDMA: 13, - PREFERRED_NETWORK_MODE_TDSCDMA_GSM: 14, - PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA: 15, - PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM: 16, - PREFERRED_NETWORK_MODE_LTE_TDSCDMA: 17, - PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM: 18, - PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA: 19, - PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM: 20, - PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA: 21, - PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA: 22, - PREFERRED_NETWORK_MODE_NR: 31, - PREFERRED_NETWORK_MODE_NR_LTE: 32, - PREFERRED_NETWORK_MODE_NR_LTE_WCDMA: 33, - PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM: 34, - PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA: 35, - PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA: 36, - PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA: 37, - PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM: 38, - PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA: 39, - PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM: 40, - PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA: 41, - PREFERRED_NETWORK_MODE_MAX_VALUE: 99, -}; -export const RadioTechnology = { - RADIO_TECHNOLOGY_UNKNOWN: 0, - RADIO_TECHNOLOGY_GSM: 1, - RADIO_TECHNOLOGY_1XRTT: 2, - RADIO_TECHNOLOGY_WCDMA: 3, - RADIO_TECHNOLOGY_HSPA: 4, - RADIO_TECHNOLOGY_HSPAP: 5, - RADIO_TECHNOLOGY_TD_SCDMA: 6, - RADIO_TECHNOLOGY_EVDO: 7, - RADIO_TECHNOLOGY_EHRPD: 8, - RADIO_TECHNOLOGY_LTE: 9, - RADIO_TECHNOLOGY_LTE_CA: 10, - RADIO_TECHNOLOGY_IWLAN: 11, - RADIO_TECHNOLOGY_NR: 12 -} -export const NetworkType = { - NETWORK_TYPE_UNKNOWN: "[PC Preview] unknow NETWORK_TYPE_UNKNOWN", - NETWORK_TYPE_GSM: "[PC Preview] unknow NETWORK_TYPE_GSM", - NETWORK_TYPE_CDMA: "[PC Preview] unknow NETWORK_TYPE_CDMA", - NETWORK_TYPE_WCDMA: "[PC Preview] unknow NETWORK_TYPE_WCDMA", - NETWORK_TYPE_TDSCDMA: "[PC Preview] unknow NETWORK_TYPE_TDSCDMA", - NETWORK_TYPE_LTE: "[PC Preview] unknow NETWORK_TYPE_LTE", - NETWORK_TYPE_NR: "[PC Preview] unknow NETWORK_TYPE_NR", -}; -export const WcdmaCellInformation = { - lac: "[PC Preview] unknow lac", - cellId: "[PC Preview] unknow cellId", - psc: "[PC Preview] unknow psc", - uarfcn: "[PC Preview] unknow uarfcn", - mcc: "[PC Preview] unknow mcc", - mnc: "[PC Preview] unknow mnc", -} -export const NetworkSelectionModeOptions = { - slotId: "[PC Preview] unknow slotId", - selectMode: NetworkSelectionMode, - networkInformation: NetworkInformation, - resumeSelection: "[PC Preview] unknow resumeSelection", -} -export const NsaState = { - NSA_STATE_NOT_SUPPORT: 1, - NSA_STATE_NO_DETECT: 2, - NSA_STATE_CONNECTED_DETECT: 3, - NSA_STATE_IDLE_DETECT: 4, - NSA_STATE_DUAL_CONNECTED: 5, - NSA_STATE_SA_ATTACHED: 6 -} -export const NetworkInformation = { - operatorName: "[PC Preview] unknow operatorName", - operatorNumeric: "[PC Preview] unknow operatorNumeric", - state: NetworkInformationState, - radioTech: "[PC Preview] unknow radioTech", -} -export const NetworkInformationState = { - NETWORK_UNKNOWN: "[PC Preview] unknow NETWORK_UNKNOWN", - NETWORK_AVAILABLE: "[PC Preview] unknow NETWORK_AVAILABLE", - NETWORK_CURRENT: "[PC Preview] unknow NETWORK_CURRENT", - NETWORK_FORBIDDEN: "[PC Preview] unknow NETWORK_FORBIDDEN", -} -export const TdscdmaCellInformation = { - lac: "[PC Preview] unknow lac", - cellId: "[PC Preview] unknow cellId", - cpid: "[PC Preview] unknow cpid", - uarfcn: "[PC Preview] unknow uarfcn", - mcc: "[PC Preview] unknow mcc", - mnc: "[PC Preview] unknow mnc", -} -export const NetworkState = { - longOperatorName: "[PC Preview] unknow longOperatorName", - shortOperatorName: "[PC Preview] unknow shortOperatorName", - plmnNumeric: "[PC Preview] unknow plmnNumeric", - isRoaming: "[PC Preview] unknow isRoaming", - regState: RegState, - cfgTech: RadioTechnology, - nsaState: NsaState, - isCaActive: "[PC Preview] unknow isCaActive", - isEmergency: "[PC Preview] unknow isEmergency", -} -export const NrCellInformation = { - nrArfcn: "[PC Preview] unknow nrArfcn", - pci: "[PC Preview] unknow pci", - tac: "[PC Preview] unknow tac", - nci: "[PC Preview] unknow nci", - mcc: "[PC Preview] unknow mcc", - mnc: "[PC Preview] unknow mnc", -} -export const NetworkSelectionMode = { - NETWORK_SELECTION_UNKNOWN: "[PC Preview] unknow NETWORK_SELECTION_UNKNOWN", - NETWORK_SELECTION_AUTOMATIC: "[PC Preview] unknow NETWORK_SELECTION_AUTOMATIC", - NETWORK_SELECTION_MANUAL: "[PC Preview] unknow NETWORK_SELECTION_MANUAL", -}; -export const GsmCellInformation = { - lac: "[PC Preview] unknow lac", - cellId: "[PC Preview] unknow cellId", - arfcn: "[PC Preview] unknow arfcn", - bsic: "[PC Preview] unknow bsic", - mcc: "[PC Preview] unknow mcc", - mnc: "[PC Preview] unknow mnc", -} -export const LteCellInformation = { - cgi: "[PC Preview] unknow cgi", - pci: "[PC Preview] unknow pci", - tac: "[PC Preview] unknow tac", - earfcn: "[PC Preview] unknow earfcn", - bandwidth: "[PC Preview] unknow bandwidth", - mcc: "[PC Preview] unknow mcc", - mnc: "[PC Preview] unknow mnc", - isSupportEndc: "[PC Preview] unknow isSupportEndc", -} -export const RegState = { - REG_STATE_NO_SERVICE: 0, - REG_STATE_IN_SERVICE: 1, - REG_STATE_EMERGENCY_CALL_ONLY: 2, - REG_STATE_POWER_OFF: 3, -}; -export const CdmaCellInformation = { - baseId: "[PC Preview] unknow baseId", - latitude: "[PC Preview] unknow latitude", - longitude: "[PC Preview] unknow longitude", - nid: "[PC Preview] unknow nid", - sid: "[PC Preview] unknow sid" -} -export const NrOptionMode = { - NR_OPTION_UNKNOWN: "[PC Preview] unknow NR_OPTION_UNKNOWN", - NR_OPTION_NSA_ONLY: "[PC Preview] unknow NR_OPTION_NSA_ONLY", - NR_OPTION_SA_ONLY: "[PC Preview] unknow NR_OPTION_SA_ONLY", - NR_OPTION_NSA_AND_SA: "[PC Preview] unknow NR_OPTION_NSA_AND_SA", -}; -export const CellInformation = { - networkType: NetworkType, - isCamped: "[PC Preview] unknow isCamped", - timeStamp: "[PC Preview] unknow timeStamp", - signalInformation: SignalInformation, - data: CdmaCellInformation, -}; -export const SignalInformation = { - signalType: NetworkType, - signalLevel: "[PC Preview] unknow signalLevel", -}; -export const NetworkSearchResult = { - isNetworkSearchSuccess: "[PC Preview] unknow isNetworkSearchSuccess", - networkSearchResult: [NetworkInformation], -} -export function mockRadio() { - const radio = { - RegState, - NrOptionMode, - PreferredNetworkMode, - RadioTechnology, - NetworkType, - NetworkInformationState, - NsaState, - NetworkSelectionMode, - getRadioTech: function (...args) { - console.warn("telephony.radio.getRadioTech 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, { - psRadioTech: "[PC Preview] unknow psRadioTech", - csRadioTech: "[PC Preview] unknow csRadioTech" - }); - } else { - return new Promise((resolve, reject) => { - resolve({ - psRadioTech: "[PC Preview] unknow psRadioTech", - csRadioTech: "[PC Preview] unknow csRadioTech" - }); - }) - } - }, - getNetworkState: function (...args) { - console.warn("telephony.radio.getNetworkState 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, NetworkState); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkState); - }) - } - }, - sendUpdateCellLocationRequest: function (...args) { - console.warn("telephony.radio.sendUpdateCellLocationRequest 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setPrimarySlotId: function (...args) { - console.warn("telephony.radio.setPrimarySlotId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getCellInformation: function (...args) { - console.warn("telephony.radio.getCellInformation 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, [CellInformation]); - } else { - return new Promise((resolve, reject) => { - resolve([CellInformation]); - }) - } - }, - getNetworkSelectionMode: function (...args) { - console.warn("telephony.radio.getNetworkSelectionMode 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, NetworkSelectionMode); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkSelectionMode); - }) - } - }, - setNetworkSelectionMode: function (...args) { - console.warn("telephony.radio.setNetworkSelectionMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getNetworkSearchInformation: function (...args) { - console.warn("telephony.radio.getNetworkSearchInformation 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, NetworkSearchResult); - } else { - return new Promise((resolve, reject) => { - resolve(NetworkSearchResult); - }) - } - }, - getISOCountryCodeForNetwork: function (...args) { - console.warn("telephony.radio.getISOCountryCodeForNetwork 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getNrOptionMode: function (...args) { - console.warn("telephony.radio.getNrOptionMode 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, NrOptionMode); - } else { - return new Promise((resolve, reject) => { - resolve(NrOptionMode); - }) - } - }, - getIMEI: function (...args) { - console.warn("telephony.radio.getIMEI 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getMEID: function (...args) { - console.warn("telephony.radio.getMEID 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getUniqueDeviceId: function (...args) { - console.warn("telephony.radio.getUniqueDeviceId 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getPrimarySlotId: function (...args) { - console.warn("telephony.radio.getPrimarySlotId 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSignalInformation: function (...args) { - console.warn("telephony.radio.getSignalInformation 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, [SignalInformation]); - } else { - return new Promise((resolve, reject) => { - resolve([SignalInformation]); - }) - } - }, - isNrSupported: function () { - console.warn("telephony.radio.isNrSupported interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isRadioOn: function (...args) { - console.warn("telephony.radio.isRadioOn 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - turnOnRadio: function (...args) { - console.warn("telephony.radio.turnOnRadio 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - turnOffRadio: function (...args) { - console.warn("telephony.radio.turnOffRadio 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getOperatorName: function (...args) { - console.warn("telephony.radio.getOperatorName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setPreferredNetwork: function (...args) { - console.warn("telephony.radio.setPreferredNetwork 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getPreferredNetwork: function (...args) { - console.warn("telephony.radio.getPreferredNetwork 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, PreferredNetworkMode); - } else { - return new Promise((resolve, reject) => { - resolve(PreferredNetworkMode); - }) - } - }, - getIMEISV: function (...args) { - console.warn("telephony.radio.getIMEISV 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - } - } - return radio -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_sim.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_sim.js deleted file mode 100644 index 1faba27d..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_sim.js +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Copyright (c) 2021 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 LockInfo = { - lockType: LockType, - password: "[PC Preview] unknow password", - state: LockState, -} -export const LockType = { - PIN_LOCK: 1, - FDN_LOCK: 2, -}; -export const LockState = { - LOCK_OFF: 0, - LOCK_ON: 1, -}; -export const PersoLockType = { - PN_PIN_LOCK: "[PC Preview] unknow PN_PIN_LOCK", - PN_PUK_LOCK: "[PC Preview] unknow PN_PUK_LOCK", - PU_PIN_LOCK: "[PC Preview] unknow PU_PIN_LOCK", - PU_PUK_LOCK: "[PC Preview] unknow PU_PUK_LOCK", - PP_PIN_LOCK: "[PC Preview] unknow PP_PIN_LOCK", - PP_PUK_LOCK: "[PC Preview] unknow PP_PUK_LOCK", - PC_PIN_LOCK: "[PC Preview] unknow PC_PIN_LOCK", - PC_PUK_LOCK: "[PC Preview] unknow PC_PUK_LOCK", - SIM_PIN_LOCK: "[PC Preview] unknow SIM_PIN_LOCK", - SIM_PUK_LOCK: "[PC Preview] unknow SIM_PUK_LOCK", -}; -export const PersoLockInfo = { - lockType: PersoLockType, - password: "[PC Preview] unknow password", -} -export const DiallingNumbersInfo = { - alphaTag: "[PC Preview] unknow alphaTag", - number: "[PC Preview] unknow number", - recordNumber: "[PC Preview] unknow recordNumber", - pin2: "[PC Preview] unknow pin2", -} -export const CardType = { - UNKNOWN_CARD: -1, - SINGLE_MODE_SIM_CARD: 10, - SINGLE_MODE_USIM_CARD: 20, - SINGLE_MODE_RUIM_CARD: 30, - DUAL_MODE_CG_CARD: 40, - CT_NATIONAL_ROAMING_CARD: 41, - CU_DUAL_MODE_CARD: 42, - DUAL_MODE_TELECOM_LTE_CARD: 43, - DUAL_MODE_UG_CARD: 50, - SINGLE_MODE_ISIM_CARD: 60 -}; -export const IccAccountInfo = { - simId: "[PC Preview] unknow simId", - slotIndex: "[PC Preview] unknow slotIndex", - isEsim: "[PC Preview] unknow isEsim", - isActive: "[PC Preview] unknow isActive", - iccId: "[PC Preview] unknow iccId", - showName: "[PC Preview] unknow showName", - showNumber: "[PC Preview] unknow showNumber", -} -export const SimState = { - SIM_STATE_UNKNOWN: "[PC Preview] unknow SIM_STATE_UNKNOWN", - SIM_STATE_NOT_PRESENT: "[PC Preview] unknow SIM_STATE_NOT_PRESENT", - SIM_STATE_LOCKED: "[PC Preview] unknow SIM_STATE_LOCKED", - SIM_STATE_NOT_READY: "[PC Preview] unknow SIM_STATE_NOT_READY", - SIM_STATE_READY: "[PC Preview] unknow SIM_STATE_READY", - SIM_STATE_LOADED: "[PC Preview] unknow SIM_STATE_LOADED", -}; -export const ContactType = { - GENERAL_CONTACT: 1, - FIXED_DIALING: 2, -}; -export const OperatorConfig = { - field: "[PC Preview] unknow field", - value: "[PC Preview] unknow value" -} -export const LockStatusResponse = { - result: "[PC Preview] unknow result", - remain: "[PC Preview] unknow remain", -} -export function mockSim() { - const sim = { - ContactType, - SimState, - CardType, - PersoLockType, - LockState, - LockType, - isSimActive: function (...args) { - console.warn("telephony.sim.isSimActive 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getDefaultVoiceSlotId: function (...args) { - console.warn("telephony.sim.getDefaultVoiceSlotId 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hasOperatorPrivileges: function (...args) { - console.warn("telephony.sim.hasOperatorPrivileges 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getISOCountryCodeForSim: function (...args) { - console.warn("telephony.sim.getISOCountryCodeForSim 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSimOperatorNumeric: function (...args) { - console.warn("telephony.sim.getSimOperatorNumeric 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSimSpn: function (...args) { - console.warn("telephony.sim.getSimSpn 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSimState: function (...args) { - console.warn("telephony.sim.getSimState 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, SimState); - } else { - return new Promise((resolve, reject) => { - resolve(SimState); - }) - } - }, - getLockState: function (...args) { - console.warn("telephony.sim.getLockState 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, LockState); - } else { - return new Promise((resolve, reject) => { - resolve(LockState); - }) - } - }, - getCardType: function (...args) { - console.warn("telephony.sim.getCardType 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, CardType); - } else { - return new Promise((resolve, reject) => { - resolve(CardType); - }) - } - }, - getSimIccId: function (...args) { - console.warn("telephony.sim.getSimIccId 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getVoiceMailIdentifier: function (...args) { - console.warn("telephony.sim.getVoiceMailIdentifier 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getVoiceMailNumber: function (...args) { - console.warn("telephony.sim.getVoiceMailNumber 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getVoiceMailCount: function (...args) { - console.warn("telephony.sim.getVoiceMailCount 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSimTelephoneNumber: function (...args) { - console.warn("telephony.sim.getSimTelephoneNumber 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSimGid1: function (...args) { - console.warn("telephony.sim.getSimGid1 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getSimTeleNumberIdentifier: function (...args) { - console.warn("telephony.sim.getSimTeleNumberIdentifier 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getLine1NumberFromImpu: function (...args) { - console.warn("telephony.sim.getLine1NumberFromImpu 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getMaxSimCount: function () { - console.warn("telephony.sim.getMaxSimCount interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getIMSI: function (...args) { - console.warn("telephony.sim.getIMSI 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - hasSimCard: function (...args) { - console.warn("telephony.sim.hasSimCard 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getSimAccountInfo: function (...args) { - console.warn("telephony.sim.getSimAccountInfo 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, IccAccountInfo); - } else { - return new Promise((resolve, reject) => { - resolve(IccAccountInfo); - }) - } - }, - getActiveSimAccountInfoList: function (...args) { - console.warn("telephony.sim.getActiveSimAccountInfoList 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, [IccAccountInfo]); - } else { - return new Promise((resolve, reject) => { - resolve([IccAccountInfo]); - }) - } - }, - setDefaultVoiceSlotId: function (...args) { - console.warn("telephony.sim.setDefaultVoiceSlotId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - activateSim: function (...args) { - console.warn("telephony.sim.activateSim 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setVoiceMailInfo: function (...args) { - console.warn("telephony.sim.setVoiceMailInfo 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deactivateSim: function (...args) { - console.warn("telephony.sim.deactivateSim 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sendEnvelopeCmd: function (...args) { - console.warn("telephony.sim.sendEnvelopeCmd 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setShowName: function (...args) { - console.warn("telephony.sim.setShowName 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - sendTerminalResponseCmd: function (...args) { - console.warn("telephony.sim.sendTerminalResponseCmd 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getShowName: function (...args) { - console.warn("telephony.sim.getShowName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - setShowNumber: function (...args) { - console.warn("telephony.sim.setShowNumber 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getShowNumber: function (...args) { - console.warn("telephony.sim.getShowNumber 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getOperatorConfigs: function (...args) { - console.warn("telephony.sim.getOperatorConfigs 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, [OperatorConfigMock]); - } else { - return new Promise((resolve, reject) => { - resolve([OperatorConfigMock]); - }) - } - }, - unlockPin: function (...args) { - console.warn("telephony.sim.unlockPin 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - unlockSimLock: function (...args) { - console.warn("telephony.sim.unlockSimLock 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - unlockPuk: function (...args) { - console.warn("telephony.sim.unlockPuk 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - alterPin: function (...args) { - console.warn("telephony.sim.alterPin 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - setLockState: function (...args) { - console.warn("telephony.sim.setLockState 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - unlockPin2: function (...args) { - console.warn("telephony.sim.unlockPin2 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - unlockPuk2: function (...args) { - console.warn("telephony.sim.unlockPuk2 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - alterPin2: function (...args) { - console.warn("telephony.sim.alterPin2 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, LockStatusResponse); - } else { - return new Promise((resolve, reject) => { - resolve(LockStatusResponse); - }) - } - }, - queryIccDiallingNumbers: function (...args) { - console.warn("telephony.sim.queryIccDiallingNumbers 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, [DiallingNumbersInfo]); - } else { - return new Promise((resolve, reject) => { - resolve([DiallingNumbersInfo]); - }) - } - }, - addIccDiallingNumbers: function (...args) { - console.warn("telephony.sim.addIccDiallingNumbers 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - delIccDiallingNumbers: function (...args) { - console.warn("telephony.sim.delIccDiallingNumbers 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - updateIccDiallingNumbers: function (...args) { - console.warn("telephony.sim.updateIccDiallingNumbers 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return sim -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_telephony_sms.js b/runtime/main/extend/systemplugin/napi/ohos_telephony_sms.js deleted file mode 100644 index b78411ea..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_telephony_sms.js +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright (c) 2021 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 SimShortMessage = { - shortMessage: ShortMessage, - simMessageStatus: SimMessageStatus, - indexOnSim: "[PC Preview] unknow indexOnSim" -} -export const ShortMessage = { - visibleMessageBody: "[PC Preview] unknow visibleMessageBody", - visibleRawAddress: "[PC Preview] unknow visibleRawAddress", - messageClass: ShortMessageClass, - protocolId: "[PC Preview] unknow protocolId", - scAddress: "[PC Preview] unknow scAddress", - scTimestamp: "[PC Preview] unknow scTimestamp", - isReplaceMessage: "[PC Preview] unknow isReplaceMessage", - hasReplyPath: "[PC Preview] unknow hasReplyPath", - pdu: ["[PC Preview] unknow pdu"], - status: "[PC Preview] unknow status", - isSmsStatusReportMessage: "[PC Preview] unknow isSmsStatusReportMessage", - emailAddress: "[PC Preview] unknow emailAddress", - emailMessageBody: "[PC Preview] unknow emailMessageBody", - userRawData: ["[PC Preview] unknow userRawData"], - isEmailMessage: "[PC Preview] unknow isEmailMessage", -} -export const SimMessageStatus = { - SIM_MESSAGE_STATUS_FREE: 0, - SIM_MESSAGE_STATUS_READ: 1, - SIM_MESSAGE_STATUS_UNREAD: 3, - SIM_MESSAGE_STATUS_SENT: 5, - SIM_MESSAGE_STATUS_UNSENT: 7, -} -export const MmsInformation = { - messageType: MessageType, - mmsType: MmsSendReq, - attachment: [MmsAttachment] -} -export const MessageType = { - TYPE_MMS_SEND_REQ: 128, - TYPE_MMS_SEND_CONF: 129, - TYPE_MMS_NOTIFICATION_IND: 130, - TYPE_MMS_RESP_IND: 131, - TYPE_MMS_RETRIEVE_CONF: 132, - TYPE_MMS_ACKNOWLEDGE_IND: 133, - TYPE_MMS_DELIVERY_IND: 134, - TYPE_MMS_READ_REC_IND: 135, - TYPE_MMS_READ_ORIG_IND: 136, -}; -export const MmsAttachment = { - contentId: "[PC Preview] unknow contentId", - contentLocation: "[PC Preview] unknow contentLocation", - contentDisposition: DispositionType, - contentTransferEncoding: "[PC Preview] unknow contentTransferEncoding", - contentType: "[PC Preview] unknow contentType", - isSmil: "[PC Preview] unknow isSmil", - path: "[PC Preview] unknow path", - inBuff: "[PC Preview] unknow inBuff", - fileName: "[PC Preview] unknow fileName", - charset: MmsCharSets, -} -export const DispositionType = { - FROM_DATA: 0, - ATTACHMENT: 1, - INLINE: 2, -} -export const MmsCharSets = { - BIG5: 0X07EA, - ISO_10646_UCS_2: 0X03E8, - ISO_8859_1: 0X04, - ISO_8859_2: 0X05, - ISO_8859_3: 0X06, - ISO_8859_4: 0X07, - ISO_8859_5: 0X08, - ISO_8859_6: 0X09, - ISO_8859_7: 0X10, - ISO_8859_8: 0X11, - ISO_8859_9: 0X12, - SHIFT_JIS: 0X11, - US_ASCII: 0X03, - UTF_8: 0X6A, -} -export const MmsRetrieveConf = { - transactionId: "[PC Preview] unknow transactionId", - messageId: "[PC Preview] unknow messageId", - date: "[PC Preview] unknow date", - contentType: "[PC Preview] unknow contentType", - to: [MmsAddress], - version: MmsVersionType, - from: MmsAddress, - cc: [MmsAddress], - subject: ["[PC Preview] unknow subject"], - priority: MmsPriorityType, - deliveryReport: "[PC Preview] unknow deliveryReport", - readReport: "[PC Preview] unknow readReport", - retrieveStatus: "[PC Preview] unknow retrieveStatus", - retrieveText: ["[PC Preview] unknow retrieveText"], -} -export const MmsAcknowledgeInd = { - transactionId: "[PC Preview] unknow transactionId", - version: MmsVersionType, - reportAllowed: ReportType, -} -export const MmsDeliveryInd = { - transactionId: "[PC Preview] unknow transactionId", - date: "[PC Preview] unknow date", - to: [MmsAddress], - status: "[PC Preview] unknow status", - version: MmsVersionType, - messageId: "[PC Preview] unknow messageId", -} -export const MmsReadRecInd = { - version: MmsVersionType, - messageId: "[PC Preview] unknow messageId", - to: [MmsAddress], - from: MmsAddress, - readStatus: "[PC Preview] unknow readStatus", - date: "[PC Preview] unknow date", -} -export const MmsReadOrigInd = { - version: MmsVersionType, - messageId: "[PC Preview] unknow messageId", - to: [MmsAddress], - from: MmsAddress, - date: "[PC Preview] unknow date", - readStatus: "[PC Preview] unknow readStatus", -} -export const MmsRespInd = { - transactionId: "[PC Preview] unknow transactionId", - status: "[PC Preview] unknow transactionId", - version: MmsVersionType, - reportAllowed: ReportType, -} -export const CBConfigOptions = { - slotId: "[PC Preview] unknow slotId", - enable: "[PC Preview] unknow enable", - startMessageId: "[PC Preview] unknow startMessageId", - endMessageId: "[PC Preview] unknow endMessageId", - ranType: RanType -} -export const SimMessageOptions = { - slotId: "[PC Preview] unknow slotId", - smsc: "[PC Preview] unknow smsc", - pdu: "[PC Preview] unknow pdu", - status: SimMessageStatus, -} -export const UpdateSimMessageOptions = { - slotId: "[PC Preview] unknow slotId", - msgIndex: "[PC Preview] unknow msgIndex", - newStatus: SimMessageStatus, - pdu: "[PC Preview] unknow pdu", - smsc: "[PC Preview] unknow smsc", -} -export const SendMessageOptions = { - slotId: "[PC Preview] unknow slotId", - destinationHost: "[PC Preview] unknow destinationHost", - serviceCenter: "[PC Preview] unknow serviceCenter", - content: "[PC Preview] unknow content", - destinationPort: "[PC Preview] unknow destinationPort", - sendCallback: ISendShortMessageCallback, - deliveryCallback: IDeliveryShortMessageCallback, -} -export const IDeliveryShortMessageCallback = { - pdu: "[PC Preview] unknow pdu", -} -export const ISendShortMessageCallback = { - result: SendSmsResult, - url: "[PC Preview] unknow url", - isLastPart: "[PC Preview] unknow isLastPart", -} -export const SendSmsResult = { - SEND_SMS_SUCCESS: 0, - SEND_SMS_FAILURE_UNKNOWN: 1, - SEND_SMS_FAILURE_RADIO_OFF: 2, - SEND_SMS_FAILURE_SERVICE_UNAVAILABLE: 3 -} -export const ShortMessageClass = { - UNKNOWN: "[PC Preview] unknow UNKNOWN", - INSTANT_MESSAGE: "[PC Preview] unknow INSTANT_MESSAGE", - OPTIONAL_MESSAGE: "[PC Preview] unknow OPTIONAL_MESSAGE", - SIM_MESSAGE: "[PC Preview] unknow SIM_MESSAGE", - FORWARD_MESSAGE: "[PC Preview] unknow FORWARD_MESSAGE", -} -export const RanType = { - TYPE_GSM: 1, - TYPE_CDMA: 2, -} -export const ReportType = { - MMS_YES: 128, - MMS_NO: 129, -} -export const MmsNotificationInd = { - transactionId: "[PC Preview] unknow transactionId", - messageClass: "[PC Preview] unknow messageClass", - messageSize: "[PC Preview] unknow messageSize", - expiry: "[PC Preview] unknow expiry", - contentLocation: "[PC Preview] unknow contentLocation", - version: MmsVersionType, - from: MmsAddress, - subject: "[PC Preview] unknow subject", - deliveryReport: ["[PC Preview] unknow deliveryReport"], - contentClass: "[PC Preview] unknow contentClass", -} -export const MmsAddress = { - address: "[PC Preview] unknow address", - charset: MmsCharSets, -} -export const MmsVersionType = { - MMS_VERSION_1_0: 0x10, - MMS_VERSION_1_1: 0x11, - MMS_VERSION_1_2: 0x12, - MMS_VERSION_1_3: 0x13, -} -export const MmsPriorityType = { - MMS_LOW: 128, - MMS_NORMAL: 129, - MMS_HIGH: 130, -} -export const MmsSendReq = { - from: MmsAddress, - transactionId: "[PC Preview] unknow transactionId", - contentType: "[PC Preview] unknow contentType", - version: MmsVersionType, - to: [MmsAddress], - date: "[PC Preview] unknow date", - cc: [MmsAddress], - bcc: [MmsAddress], - subject: ["[PC Preview] unknow subject"], - messageClass: "[PC Preview] unknow messageClass", - expiry: "[PC Preview] unknow expiry", - priority: MmsPriorityType, - senderVisibility: "[PC Preview] unknow senderVisibility", - deliveryReport: ["[PC Preview] unknow deliveryReport"], - readReport: "[PC Preview] unknow readReport", - responseState: "[PC Preview] unknow responseState", - transactionId: "[PC Preview] unknow transactionId", - version: "[PC Preview] unknow version", - messageId: "[PC Preview] unknow messageId", -} -export const MmsSendConf = { - responseState: "[PC Preview] unknow responseState", - transactionId: "[PC Preview] unknow transactionId", - version: MmsVersionType, - messageId: "[PC Preview] unknow messageId", -} -export const SmsSegmentsInfo = { - splitCount: "[PC Preview] unknow splitCount", - encodeCount: "[PC Preview] unknow encodeCount", - encodeCountRemaining: "[PC Preview] unknow encodeCountRemaining", - scheme: SmsEncodingScheme, -} -export const SmsEncodingScheme = { - SMS_ENCODING_UNKNOWN: 0, - SMS_ENCODING_7BIT: 1, - SMS_ENCODING_8BIT: 2, - SMS_ENCODING_16BIT: 3, -} -export function mockSMS() { - const sms = { - SimMessageStatus, - SmsEncodingScheme, - DispositionType, - SendSmsResult, - MessageType, - ShortMessage, - MmsCharSets, - MmsPriorityType, - MmsVersionType, - ReportType, - SimShortMessage, - RanType, - ShortMessageClass, - splitMessage: function (...args) { - console.warn("telephony.sms.splitMessage 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, reject) => { - resolve([paramMock.paramStringMock]); - }) - } - }, - createMessage: function (...args) { - console.warn("telephony.sms.createMessage 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, ShortMessage); - } else { - return new Promise((resolve, reject) => { - resolve(ShortMessage); - }) - } - }, - getSmsSegmentsInfo: function (...args) { - console.warn("telephony.sms.getSmsSegmentsInfo 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, SmsSegmentsInfo); - } else { - return new Promise((resolve, reject) => { - resolve(SmsSegmentsInfo); - }) - } - }, - isImsSmsSupported: function (...args) { - console.warn("telephony.sms.isImsSmsSupported 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.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getImsShortMessageFormat: function (...args) { - console.warn("telephony.sms.getImsShortMessageFormat 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.paramStringMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - decodeMms: function (...args) { - console.warn("telephony.sms.decodeMms 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, MmsInformation); - } else { - return new Promise((resolve, reject) => { - resolve(MmsInformation); - }) - } - }, - encodeMms: function (...args) { - console.warn("telephony.sms.encodeMms 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - isImsSmsSuppo: function (...args) { - console.warn("telephony.sms.isImsSmsSuppo 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - sendMessage: function (...args) { - console.warn("telephony.sms.sendMessage interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - setDefaultSmsSlotId: function (...args) { - console.warn("telephony.sms.setDefaultSmsSlotId 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getDefaultSmsSlotId: function (...args) { - console.warn("telephony.sms.getDefaultSmsSlotId 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSmscAddr: function (...args) { - console.warn("telephony.sms.setSmscAddr 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getSmscAddr: function (...args) { - console.warn("telephony.sms.getSmscAddr 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - hasSmsCapability: function () { - console.warn("telephony.sms.hasSmsCapability interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - addSimMessage: function (...args) { - console.warn("telephony.sms.addSimMessage 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - delSimMessage: function (...args) { - console.warn("telephony.sms.delSimMessage 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - updateSimMessage: function (...args) { - console.warn("telephony.sms.updateSimMessage 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAllSimMessages: function (...args) { - console.warn("telephony.sms.getAllSimMessages 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, [SimShortMessage]); - } else { - return new Promise((resolve, reject) => { - resolve([SimShortMessage]); - }) - } - }, - setCBConfig: function (...args) { - console.warn("telephony.sms.setCBConfig 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return sms -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_thermal.js b/runtime/main/extend/systemplugin/napi/ohos_thermal.js deleted file mode 100644 index 5fd603c3..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_thermal.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 mockThermal() { - const ThermalLevel = { - COOL: 0, - NORMAL: 1, - WARM: 2, - HOT: 3, - OVERHEATED: 4, - WARNING: 5, - EMERGENCY: 6, - } - const thermal = { - ThermalLevel, - subscribeThermalLevel: function (...args) { - console.warn("thermal.subscribeThermalLevel 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, ThermalLevel); - } - }, - unsubscribeThermalLevel: function (...args) { - console.warn("thermal.unsubscribeThermalLevel 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); - } - }, - getThermalLevel: function (...args) { - console.warn("thermal.getThermalLevel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return ThermalLevel - } - } - return thermal - } - \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_uitest.js b/runtime/main/extend/systemplugin/napi/ohos_uitest.js deleted file mode 100644 index 550bd76e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_uitest.js +++ /dev/null @@ -1,493 +0,0 @@ -/* - * 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' - -const warnMessage = - ' interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.' - -export const ResizeDirection = { - LEFT: 0, - RIGHT: 1, - UP: 2, - DOWN: 3, - LEFT_UP: 4, - LEFT_DOWN: 5, - RIGHT_UP: 6, - RIGHT_DOWN: 7 -} - -export const MatchPattern = { - EQUALS: 0, - CONTAINS: 1, - STARTS_WITH: 2, - ENDS_WITH: 3 -} - -export const WindowMode = { - FULLSCREEN: 0, - PRIMARY: 1, - SECONDARY: 2, - FLOATING: 3 -} - -export const Point = { - X: '[PC Preview] unknown X', - Y: '[PC Preview] unknown Y' -} - -export const Rect = { - leftX: '[PC Preview] unknown leftX', - topY: '[PC Preview] unknown topY', - rightX: '[PC Preview] unknown rightX', - bottomY: '[PC Preview] unknown bottomY' -} - -export const WindowFilter = { - bundleName: '[PC Preview] unknown bundleName', - title: '[PC Preview] unknown title', - focused: '[PC Preview] unknown focused', - actived: '[PC Preview] unknown actived' -} - -const ByClass = class ByMock { - constructor() { - console.warn('uitest.By.constructor' + warnMessage); - this.id = function(...args) { - console.warn('uitest.By.id' + warnMessage) - return new ByClass() - }; - this.text = function(...args) { - console.warn('uitest.By.text' + warnMessage) - return new ByClass() - }; - this.key = function(...args) { - console.warn('uitest.By.key' + warnMessage) - return new ByClass() - }; - this.type = function(...args) { - console.warn('uitest.By.type' + warnMessage) - return new ByClass() - }; - this.enabled = function(...args) { - console.warn('uitest.By.enabled' + warnMessage) - return new ByClass() - }; - this.focused = function(...args) { - console.warn('uitest.By.focused' + warnMessage) - return new ByClass() - }; - this.selected = function(...args) { - console.warn('uitest.By.selected' + warnMessage) - return new ByClass() - }; - this.clickable = function(...args) { - console.warn('uitest.By.clickable' + warnMessage) - return new ByClass() - }; - this.enabled = function(...args) { - console.warn('uitest.By.enabled' + warnMessage) - return new ByClass() - }; - this.longClickable = function(...args) { - console.warn('uitest.By.longClickable' + warnMessage) - return new ByClass() - }; - this.scrollable = function(...args) { - console.warn('uitest.By.scrollable' + warnMessage) - return new ByClass() - }; - this.checkable = function(...args) { - console.warn('uitest.By.checkable' + warnMessage) - return new ByClass() - }; - this.checked = function(...args) { - console.warn('uitest.By.checked' + warnMessage) - return new ByClass() - }; - this.isBefore = function(...args) { - console.warn('uitest.By.isBefore' + warnMessage) - return new ByClass() - }; - this.isAfter = function(...args) { - console.warn('uitest.By.isAfter' + warnMessage) - return new ByClass() - }; - } -} - -const UiDriverClass = class UiDriverMock { - constructor() { - console.warn('uitest.UiDriver.constructor' + warnMessage); - this.delayMs = function(...args) { - console.warn('uitest.UiDriver.delayMs' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.findComponent = function(...args) { - console.warn('uitest.UiDriver.findComponent' + warnMessage) - return new Promise((resolve) => { - resolve(new UiComponentClass()) - }); - }; - this.findWindow = function(...args) { - console.warn('uitest.UiDriver.findWindow' + warnMessage) - return new Promise((resolve) => { - resolve(new UiWindowClass()) - }); - }; - this.findComponents = function(...args) { - console.warn('uitest.UiDriver.findComponents' + warnMessage) - return new Promise((resolve) => { - resolve(new Array(new UiComponentClass())) - }); - }; - this.waitForComponent = function(...args) { - console.warn('uitest.UiDriver.waitForComponent' + warnMessage) - return new Promise((resolve) => { - resolve(new UiComponentClass()) - }); - }; - this.screenCap = function(...args) { - console.warn('uitest.UiDriver.screenCap' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.assertComponentExist = function(...args) { - console.warn('uitest.UiDriver.assertComponentExist' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.pressBack = function(...args) { - console.warn('uitest.UiDriver.pressBack' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.triggerKey = function(...args) { - console.warn('uitest.UiDriver.triggerKey' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.triggerCombineKeys = function(...args) { - console.warn('uitest.UiDriver.triggerCombineKeys' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.click = function(...args) { - console.warn('uitest.UiDriver.click' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.longClick = function(...args) { - console.warn('uitest.UiDriver.longClick' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.doubleClick = function(...args) { - console.warn('uitest.UiDriver.doubleClick' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.swipe = function(...args) { - console.warn('uitest.UiDriver.swipe' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.drag = function(...args) { - console.warn('uitest.UiDriver.drag' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - } -} - -UiDriverClass.create = function () { - console.warn('uitest.UiDriver.create' + warnMessage) - return new UiDriverClass() -} - -const UiComponentClass = class UiComponentMock { - constructor() { - console.warn('uitest.UiComponent.constructor' + warnMessage); - this.getId = function(...args) { - console.warn('uitest.UiComponent.getId' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }); - }; - this.getText = function(...args) { - console.warn('uitest.UiComponent.getText' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - }; - this.getKey = function(...args) { - console.warn('uitest.UiComponent.getKey' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - }; - this.getType = function(...args) { - console.warn('uitest.UiComponent.getType' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - }; - this.isEnabled = function(...args) { - console.warn('uitest.UiComponent.isEnabled' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isFocused = function(...args) { - console.warn('uitest.UiComponent.isFocused' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isSelected = function(...args) { - console.warn('uitest.UiComponent.isSelected' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isClickable = function(...args) { - console.warn('uitest.UiComponent.isClickable' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isLongClickable = function(...args) { - console.warn('uitest.UiComponent.isLongClickable' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isScrollable = function(...args) { - console.warn('uitest.UiComponent.isScrollable' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isCheckable = function(...args) { - console.warn('uitest.UiComponent.isCheckable' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isChecked = function(...args) { - console.warn('uitest.UiComponent.isChecked' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.getBounds = function(...args) { - console.warn('uitest.UiComponent.getBounds' + warnMessage) - return new Promise((resolve) => { - resolve(Rect) - }); - }; - this.getBoundsCenter = function(...args) { - console.warn('uitest.UiComponent.getBoundsCenter' + warnMessage) - return new Promise((resolve) => { - resolve(Point) - }); - }; - this.click = function(...args) { - console.warn('uitest.UiComponent.click' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.longClick = function(...args) { - console.warn('uitest.UiComponent.longClick' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.doubleClick = function(...args) { - console.warn('uitest.UiComponent.doubleClick' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.scrollToTop = function(...args) { - console.warn('uitest.UiComponent.scrollToTop' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.scrollToBottom = function(...args) { - console.warn('uitest.UiComponent.scrollToBottom' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.inputText = function(...args) { - console.warn('uitest.UiComponent.inputText' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.clearText = function(...args) { - console.warn('uitest.UiComponent.clearText' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.scrollSearch = function(...args) { - console.warn('uitest.UiComponent.scrollSearch' + warnMessage) - return new Promise((resolve) => { - resolve(new UiComponentClass()) - }); - }; - this.dragTo = function(...args) { - console.warn('uitest.UiComponent.dragTo' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.pinchOut = function(...args) { - console.warn('uitest.UiComponent.pinchOut' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - this.pinchIn = function(...args) { - console.warn('uitest.UiComponent.pinchIn' + warnMessage) - return new Promise((resolve) => { - resolve() - }); - }; - } -} - -const UiWindowClass = class UiWindowMock { - constructor() { - console.warn('uitest.UiWindow.constructor' + warnMessage); - this.getBundleName = function(...args) { - console.warn('uitest.UiWindow.getBundleName' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - }; - this.getBounds = function(...args) { - console.warn('uitest.UiWindow.getBounds' + warnMessage) - return new Promise((resolve) => { - resolve(Rect) - }); - }; - this.getTitle = function(...args) { - console.warn('uitest.UiWindow.getTitle' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramStringMock) - }); - }; - this.getWindowMode = function(...args) { - console.warn('uitest.UiWindow.getWindowMode' + warnMessage) - return new Promise((resolve) => { - resolve(WindowMode) - }); - }; - this.isFocused = function(...args) { - console.warn('uitest.UiWindow.isFocused' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.isActived = function(...args) { - console.warn('uitest.UiWindow.isActived' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.focus = function(...args) { - console.warn('uitest.UiWindow.focus' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.moveTo = function(...args) { - console.warn('uitest.UiWindow.moveTo' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.resize = function(...args) { - console.warn('uitest.UiWindow.resize' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.split = function(...args) { - console.warn('uitest.UiWindow.split' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.maximize = function(...args) { - console.warn('uitest.UiWindow.maximize' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.resume = function(...args) { - console.warn('uitest.UiWindow.resume' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.minimize = function(...args) { - console.warn('uitest.UiWindow.minimize' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - this.close = function(...args) { - console.warn('uitest.UiWindow.close' + warnMessage) - return new Promise((resolve) => { - resolve(paramMock.paramBooleanMock) - }); - }; - }; -} - -export function mockUiTest() { - const module = { - ResizeDirection: ResizeDirection, - MatchPattern: MatchPattern, - WindowMode: WindowMode, - Point: Point, - Rect: Rect, - WindowFilter: WindowFilter, - BY: new ByClass(), - UiDriver: UiDriverClass, - UiComponent: UiComponentClass, - UiWindow: UiWindowClass - }; - return module -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js deleted file mode 100644 index 1e45391f..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright (c) 2021-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 mockUpdate() { - const Updater = { - checkNewVersion: function (...args) { - console.warn("Updater.checkNewVersion 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, CheckResult); - } else { - return new Promise((resolve, reject) => { - resolve(CheckResult); - }) - } - }, - getNewVersionInfo: function (...args) { - console.warn("Updater.getNewVersionInfo 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, NewVersionInfo); - } else { - return new Promise((resolve, reject) => { - resolve(NewVersionInfo); - }) - } - }, - 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.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, CurrentVersionInfo); - } else { - return new Promise((resolve, reject) => { - resolve(CurrentVersionInfo); - }) - } - }, - 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.") - const len = args.length - if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, TaskInfo); - } else { - return new Promise((resolve, reject) => { - resolve(TaskInfo); - }) - } - }, - download: function (...args) { - console.warn("Updater.download 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - resumeDownload: function (...args) { - console.warn("Updater.resumeDownload 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - pauseDownload: function (...args) { - console.warn("Updater.pauseDownload 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - upgrade: function (...args) { - console.warn("Updater.upgrade 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - clearError: function (...args) { - console.warn("Updater.clearError 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getUpgradePolicy: function (...args) { - console.warn("Updater.getUpgradePolicy 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, UpgradePolicy); - } else { - return new Promise((resolve, reject) => { - resolve(UpgradePolicy); - }) - } - }, - setUpgradePolicy: function (...args) { - console.warn("Updater.setUpgradePolicy 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - terminateUpgrade: function (...args) { - console.warn("Updater.terminateUpgrade 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("Updater.on 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, EventInfo); - } - }, - off: function (...args) { - console.warn("Updater.off 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, EventInfo); - } - }, - } - const Restorer = { - factoryReset: function (...args) { - console.warn("Restorer.factoryReset 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } - const LocalUpdater = { - verifyUpgradePackage: function (...args) { - console.warn("LocalUpdater.verifyUpgradePackage 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - applyNewVersion: function (...args) { - console.warn("LocalUpdater.applyNewVersion 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("LocalUpdater.on 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, EventInfo); - } - }, - off: function (...args) { - console.warn("LocalUpdater.off 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, EventInfo); - } - }, - } - const update = { - BusinessVendor, - BusinessSubType, - ComponentType, - UpgradeAction, - EffectiveMode, - DescriptionType, - NetType, - Order, - UpgradeStatus, - EventClassify, - EventId, - UpgradeInfo, - BusinessType, - DownloadOptions, - ResumeDownloadOptions, - PauseDownloadOptions, - UpgradeOptions, - ClearOptions, - 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.") - return Updater; - }, - getRestorer: function (...args) { - console.warn("update.getRestorer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return Restorer; - }, - getLocalUpdater: function (...args) { - console.warn("update.getLocalUpdater interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return LocalUpdater; - } - } - return update; -} - -const BusinessVendor = { - PUBLIC: "public", -} - -const BusinessSubType = { - FIRMWARE: 1, -} - -const ComponentType = { - OTA: 1, -} - -const UpgradeAction = { - UPGRADE: "upgrade", - RECOVERY: "recovery", -} - -const EffectiveMode = { - COLD: 1, - LIVE: 2, - LIVE_AND_COLD: 3, -} - -const DescriptionType = { - CONTENT: 0, - URI: 1, -} - -const NetType = { - CELLULAR: 1, - METERED_WIFI: 2, - NOT_METERED_WIFI: 4, - WIFI: 6, - CELLULAR_AND_WIFI: 7 -} - -const Order = { - DOWNLOAD: 1, - INSTALL: 2, - DOWNLOAD_AND_INSTALL: 3, - APPLY: 4, - INSTALL_AND_APPLY: 6 -} - -const UpgradeStatus = { - WAITING_DOWNLOAD: 20, - DOWNLOADING: 21, - DOWNLOAD_PAUSED: 22, - DOWNLOAD_FAIL: 23, - WAITING_INSTALL: 30, - UPDATING: 31, - WAITING_APPLY: 40, - APPLYING: 41, - UPGRADE_SUCCESS: 50, - UPGRADE_FAIL: 51, -} - -const EventClassify = { - TASK: 0x01000000, -} - -const EventId = { - EVENT_TASK_BASE: 0x01000000, - EVENT_TASK_RECEIVE: 0x01000001, - EVENT_TASK_CANCEL: 0x01000010, - EVENT_DOWNLOAD_WAIT: 0x01000011, - EVENT_DOWNLOAD_START: 0x01000100, - EVENT_DOWNLOAD_UPDATE: 0x01000101, - EVENT_DOWNLOAD_PAUSE: 0x01000110, - EVENT_DOWNLOAD_RESUME: 0x01000111, - EVENT_DOWNLOAD_SUCCESS: 0x01001000, - EVENT_DOWNLOAD_FAIL: 0x01001001, - EVENT_UPGRADE_WAIT: 0x01001010, - EVENT_UPGRADE_START: 0x01001011, - EVENT_UPGRADE_UPDATE: 0x01001100, - EVENT_APPLY_WAIT: 0x01001101, - EVENT_APPLY_START: 0x01001110, - EVENT_UPGRADE_SUCCESS: 0x01001111, - EVENT_UPGRADE_FAIL: 0x01010000, -} - -const VersionDigestInfo = { - versionDigest: "[PC Preview] unknown versionDigest", -} - -const DescriptionInfo = { - descriptionType: DescriptionType.CONTENT, - content: "[PC Preview] unknown content", -} - -const VersionComponent = { - componentId: "[PC Preview] unknown componentId", - componentType: ComponentType.OTA, - upgradeAction: UpgradeAction.UPGRADE, - displayVersion: "[PC Preview] unknown displayVersion", - innerVersion: "[PC Preview] unknown innerVersion", - size: "[PC Preview] unknown size", - effectiveMode: EffectiveMode.COLD, - descriptionInfo: DescriptionInfo, -} - -const NewVersionInfo = { - versionDigestInfo: VersionDigestInfo, - versionComponents: [VersionComponent], -} - -const CheckResult = { - isExistNewVersion: "[PC Preview] unknown isExistNewVersion", - newVersionInfo: NewVersionInfo, -} - -const CurrentVersionInfo = { - osVersion: "[PC Preview] unknown osVersion", - deviceName: "[PC Preview] unknown deviceName", - versionComponents: [VersionComponent], -} - -const UpgradePeriod = { - start: "[PC Preview] unknown start", - end: "[PC Preview] unknown end", -} - -const UpgradePolicy = { - downloadStrategy: "[PC Preview] unknown downloadStrategy", - autoUpgradeStrategy: "[PC Preview] unknown autoUpgradeStrategy", - autoUpgradePeriods: [UpgradePeriod], -} - -const ErrorMessage = { - errorCode: "[PC Preview] unknown errorCode", - errorMessage: "[PC Preview] unknown errorMessage", -} - -const TaskBody = { - versionDigestInfo: VersionDigestInfo, - status: UpgradeStatus.WAITING_DOWNLOAD, - subStatus: "[PC Preview] unknown subStatus", - progress: "[PC Preview] unknown progress", - installMode: "[PC Preview] unknown installMode", - errorMessages: [ErrorMessage], - versionComponents: [VersionComponent], -} - -const TaskInfo = { - existTask: "[PC Preview] unknown existTask", - taskBody: TaskBody, -} - -const EventInfo = { - eventId: EventId.EVENT_TASK_RECEIVE, - taskBody: TaskBody, -} - -const UpgradeInfo = { - upgradeApp: "[PC Preview] unknown upgradeApp", - businessType: BusinessType -} - -const BusinessType = { - vendor: BusinessVendor, - subType: BusinessSubType -} - -const DownloadOptions = { - allowNetwork: NetType, - order: Order -} - -const ResumeDownloadOptions = { - allowNetwork: NetType -} - -const PauseDownloadOptions = { - isAllowAutoResume: true -} - -const UpgradeOptions = { - order: Order -} - -const ClearOptions = { - status: UpgradeStatus -} - -const EventClassifyInfo = { - eventClassify: EventClassify, - extraInfo: "[PC Preview] unknown extraInfo" -} - -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 diff --git a/runtime/main/extend/systemplugin/napi/ohos_uri.js b/runtime/main/extend/systemplugin/napi/ohos_uri.js deleted file mode 100644 index 9f13e67e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_uri.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 mockUri() { - const URIClass = class URI { - constructor(...args) { - console.warn("uri.URI.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.toString = function (...args) { - console.warn("URI.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.equals = function (...args) { - console.warn("URI.equals interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.checkIsAbsolute = function (...args) { - console.warn("URI.checkIsAbsolute interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.normalize = function (...args) { - console.warn("URI.normalize interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return new URIClass(); - }; - this.scheme = '[PC preview] unknow scheme'; - this.userInfo = '[PC preview] unknow userInfo'; - this.host = '[PC preview] unknow host'; - this.port = '[PC preview] unknow port'; - this.path = '[PC preview] unknow path'; - this.query = '[PC preview] unknow query'; - this.fragment = '[PC preview] unknow fragment'; - this.authority = '[PC preview] unknow authority'; - this.ssp = '[PC preview] unknow ssp'; - } - }; - const uriMock = { - URI : URIClass - }; - return uriMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_url.js b/runtime/main/extend/systemplugin/napi/ohos_url.js deleted file mode 100644 index 5afb7350..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_url.js +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2021 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 mockUrl() { - const URLSearchParamsClass = class URLSearchParams { - constructor(...args) { - console.warn('url.URLSearchParams.constructor interface mocked in the Previewer. How this interface works on' + - ' the Previewer' + - ' may be different from that on a real device.'); - this.append = function (...args) { - console.warn('url.URLSearchParams.append interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - }; - this.delete = function (...args) { - console.warn('url.URLSearchParams.delete interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - }; - this.getAll = function (...args) { - console.warn('url.URLSearchParams.getAll interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return [paramMock.paramStringMock]; - }; - this.entries = function (...args) { - console.warn('url.URLSearchParams.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorTwoStringMock = { - *[Symbol.iterator]() { - yield [paramMock.paramStringMock, paramMock.paramStringMock]; - } - }; - return IteratorTwoStringMock; - }; - this.forEach = function (...args) { - console.warn('url.URLSearchParams.forEach interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - }; - this.get = function (...args) { - console.warn('url.URLSearchParams.get interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }; - this.has = function (...args) { - console.warn('url.URLSearchParams.has interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }; - this.set = function (...args) { - console.warn('url.URLSearchParams.set interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - }; - this.sort = function (...args) { - console.warn('url.URLSearchParams.sort interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - }; - this.keys = function (...args) { - console.warn('url.URLSearchParams.keys interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorStringMock = { - *[Symbol.iterator]() { - yield paramMock.paramStringMock; - } - }; - return IteratorStringMock; - }; - this.values = function (...args) { - console.warn('url.URLSearchParams.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorStringMock = { - *[Symbol.iterator]() { - yield paramMock.paramStringMock; - } - }; - return IteratorStringMock; - }; - this.toString = function (...args) { - console.warn('url.URLSearchParams.toString interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn('url.URLSearchParams.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - let index = 0; - const IteratorTwoStringMock = { - next: () => { - if (index < 1) { - const returnValue = [paramMock.paramStringMock, paramMock.paramStringMock]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorTwoStringMock; - } - } - }; - const URLClass = class URL { - constructor(...args) { - console.warn('url.URL.constructor interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.toString = function (...args) { - console.warn('URL.toString interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }; - this.toJSON = function (...args) { - console.warn('URL.toJSON interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - return paramMock.paramStringMock; - }; - this.hash = '[PC preview] unknow hash'; - this.host = '[PC preview] unknow host'; - this.hostname = '[PC preview] unknow hostname'; - this.href = '[PC preview] unknow href'; - this.origin = '[PC preview] unknow origin'; - this.password = '[PC preview] unknow password'; - this.pathname = '[PC preview] unknow pathname'; - this.port = '[PC preview] unknow port'; - this.protocol = '[PC preview] unknow protocol'; - this.search = '[PC preview] unknow search'; - this.searchParams = new URLSearchParamsClass(); - this.username = '[PC preview] unknow username'; - } - }; - const urlMock = { - URLSearchParams: URLSearchParamsClass, - URL: URLClass - }; - return urlMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_usb.js b/runtime/main/extend/systemplugin/napi/ohos_usb.js deleted file mode 100644 index 8555f676..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_usb.js +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2021 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 mockUsb() { - const USBDevice = { - busNum: '[PC Preview] unknow busNum', - devAddress: '[PC Preview] unknow devAddress', - serial: '[PC Preview] unknow serial', - name: '[PC Preview] unknow name', - manufacturerName: '[PC Preview] unknow maunfactureName', - productName: '[PC Preview] unknow productName', - version: '[PC Preview] unknow version', - vendorId: '[PC Preview] unknow vendorId', - productId: '[PC Preview] unknow productId', - clazz: '[PC Preview] unknow clazz', - subClass: '[PC Preview] unknow subClass', - protocol: '[PC Preview] unknow protocol', - configs: '[PC Preview] unknow configs', - }; - - const USBConfig = { - id: '[PC Preview] unknow id', - attributes: '[PC Preview] unknow attributes', - maxPower: '[PC Preview] unknow maxPower', - name: '[PC Preview] unknow name', - isRemoteWakeup: '[PC Preview] unknow isRemoteWakeup', - isSelfPowered: '[PC Preview] unknow isSelfPowered', - interfaces: '[PC Preview] unknow interfaces', - }; - - const USBInterface = { - id: '[PC Preview] unknow id', - protocol: '[PC Preview] unknow protocol', - clazz: '[PC Preview] unknow clazz', - subClass: '[PC Preview] unknow subClass', - alternateSetting: '[PC Preview] unknow alternateSetting', - name: '[PC Preview] unknow name', - endpoints: '[PC Preview] unknow endpoints', - }; - - const USBEndpoint = { - address: '[PC Preview] unknow address', - attributes: '[PC Preview] unknow attributes', - interval: '[PC Preview] unknow interval', - maxPacketSize: '[PC Preview] unknow maxPacketSize', - direction: '[PC Preview] unknow direction', - number: '[PC Preview] unknow number', - type: '[PC Preview] unknow type', - interfaceId: '[PC Preview] unknow interfaceId', - }; - - const USBDevicePipe = { - busNum: '[PC Preview] unknow busNum', - devAddress: '[PC Preview] unknow devAddress', - }; - - const PowerRoleType = { - NONE: '[PC Preview] unknow NONE', - SOURCE: '[PC Preview] unknow SOURCE', - SINK: '[PC Preview] unknow SINK', - }; - - const DataRoleType = { - NONE: '[PC Preview] unknow NONE', - HOST: '[PC Preview] unknow HOST', - DEVICE: '[PC Preview] unknow DEVICE', - }; - - const USBPort = { - id: '[PC Preview] unknow id', - supportedModes: '[PC Preview] unknow supportedModes', - status: '[PC Preview] unknow status', - }; - - const PortModeType = { - NONE: '[PC Preview] unknow NONE', - UFP: '[PC Preview] unknow UFP', - DFP: '[PC Preview] unknow DFP', - DRP: '[PC Preview] unknow DRP', - NUM_MODES: '[PC Preview] unknow NUM_MODES', - }; - - const USBPortStatus = { - currentMode: '[PC Preview] unknow currentMode', - currentPowerRole: '[PC Preview] unknow currentPowerRole', - currentDataRole: '[PC Preview] unknow currentDataRole', - }; - - const USBControlParams = { - request: '[PC Preview] unknow request', - target: '[PC Preview] unknow target', - reqType: '[PC Preview] unknow reqType', - direction: '[PC Preview] unknow direction', - value: '[PC Preview] unknow value', - index: '[PC Preview] unknow index', - data: '[PC Preview] unknow data', - }; - - const USBRequestTargetType = { - USB_REQUEST_TARGET_DEVICE: '[PC Preview] unknow USB_REQUEST_TARGET_DEVICE', - USB_REQUEST_TARGET_INTERFACE: '[PC Preview] unknow USB_REQUEST_TARGET_INTERFACE', - USB_REQUEST_TARGET_ENDPOINT: '[PC Preview] unknow USB_REQUEST_TARGET_ENDPOINT', - USB_REQUEST_TARGET_OTHER: '[PC Preview] unknow USB_REQUEST_TARGET_OTHER', - }; - - const USBControlRequestType = { - USB_REQUEST_TYPE_STANDARD: '[PC Preview] unknow USB_REQUEST_TYPE_STANDARD', - USB_REQUEST_TYPE_CLASS: '[PC Preview] unknow USB_REQUEST_TYPE_CLASS', - USB_REQUEST_TYPE_VENDOR: '[PC Preview] unknow USB_REQUEST_TYPE_VENDOR', - }; - - const USBRequestDirection = { - USB_REQUEST_DIR_TO_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_TO_DEVICE', - USB_REQUEST_DIR_FROM_DEVICE: '[PC Preview] unknow USB_REQUEST_DIR_FROM_DEVICE', - }; - - const FunctionType = { - NONE: '[PC Preview] unknow NONE', - ACM: '[PC Preview] unknow ACM', - ECM: '[PC Preview] unknow ECM', - HDC: '[PC Preview] unknow HDC', - MTP: '[PC Preview] unknow MTP', - PTP: '[PC Preview] unknow PTP', - RNDIS: '[PC Preview] unknow RNDIS', - MIDI: '[PC Preview] unknow MIDI', - AUDIO_SOURCE: '[PC Preview] unknow AUDIO_SOURCE', - NCM: '[PC Preview] unknow NCM', - }; - - const usb = { - getVersion: function (...args) { - console.warn('usb.getVersion interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - getDevices: function (...args) { - console.warn('usb.getDevices interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return [USBDevice]; - }, - connectDevice: function (...args) { - console.warn('usb.connectDevice interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return USBDevicePipe; - }, - getPorts: function (...args) { - console.warn('usb.getPorts interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return [USBPort]; - }, - getSupportedModes: function (...args) { - console.warn('usb.getSupportedModes interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return PortModeType; - }, - requestRight: function (...args) { - console.warn('usb.requestRight 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); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getCurrentFunctions: function (...args) { - console.warn('usb.getCurrentFunctions interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return FunctionType; - }, - setCurrentFunctions: function (...args) { - console.warn('usb.setCurrentFunctions 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); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - hasRight: function (...args) { - console.warn('usb.hasRight interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }, - setPortRoles: function (...args) { - console.warn('usb.setPortRoles 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); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }); - } - }, - getRawDescriptor: function (...args) { - console.warn('usb.getRawDescriptor interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramArrayMock; - }, - closePipe: function (...args) { - console.warn('usb.closePipe interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - claimInterface: function (...args) { - console.warn('usb.claimInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - releaseInterface: function (...args) { - console.warn('usb.releaseInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - setInterface: function (...args) { - console.warn('usb.setInterface interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - getFileDescriptor: function (...args) { - console.warn('usb.getFileDescriptor interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - usbFunctionsFromString: function (...args) { - console.warn('usb.usbFunctionsFromString interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - usbFunctionsToString: function (...args) { - console.warn('usb.usbFunctionsToString interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramStringMock; - }, - controlTransfer: function (...args) { - console.warn('usb.controlTransfer 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); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setConfiguration: function (...args) { - console.warn('usb.setConfiguration interface mocked in the Previewer. How this interface works on the' - + ' Previewer may be different from that on a real device.'); - return paramMock.paramNumberMock; - }, - bulkTransfer: function (...args) { - console.warn('usb.bulkTransfer 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); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - }; - return usb; -} - diff --git a/runtime/main/extend/systemplugin/napi/ohos_userIAM_faceAuth.js b/runtime/main/extend/systemplugin/napi/ohos_userIAM_faceAuth.js deleted file mode 100644 index 5eafa70d..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_userIAM_faceAuth.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 mockFaceAuth() { - - const ResultCode = { - FAIL : 12700001 - } - const FaceAuthManagerClass = class FaceAuthManager { - constructor() { - console.warn("faceAuth.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - - this.setSurfaceId = function (...args) { - console.warn("faceAuth.setSurfaceId interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }; - } - } - - const faceAuth = { - ResultCode, - FaceAuthManager : FaceAuthManagerClass - } - return faceAuth; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_userIAM_userAuth.js b/runtime/main/extend/systemplugin/napi/ohos_userIAM_userAuth.js deleted file mode 100644 index 50609cc7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_userIAM_userAuth.js +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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 mockUserAuth() { - - const SUCCESS = 0 - - const contextId = 1234 - - const IUserAuthCallback = { - onResult: function (...args) { - console.warn("uerAuth.onResult interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - - onAcquireInfo: function (...args) { - console.warn("uerAuth.onAcquireInfo interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - }, - } - - const AuthResult = { - token : paramMock.paramArrayMock, - remainTimes : "[PC Preview] unknown remainTimes", - freezingTime : "[PC Preview] unknown freezingTime", - } - - const Authenticator = { - execute: function (...args) { - console.warn("uerAuth.execute 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, SUCCESS); - } else { - return new Promise((resolve, reject) => { - resolve(SUCCESS); - }) - } - } - } - - const UserAuthClass = class UserAuth { - constructor() { - console.warn("uerAuth.constructor interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - this.getVersion = function (...args) { - console.warn("uerAuth.getVersion interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - - this.getAvailableStatus = function (...args) { - console.warn("uerAuth.getAvailableStatus interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return SUCCESS; - }; - - this.auth = function (...args) { - console.warn("uerAuth.auth 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, IUserAuthCallback); - } - return contextId; - }; - - this.cancelAuth = function (...args) { - console.warn("uerAuth.cancelAuth interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return SUCCESS; - }; - - } - } - - const AuthEvent = { - callback: function (...args) { - console.warn("uerAuth.callback interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - } - } - - const AuthResultInfo = { - result : "[PC Preview] unknown result", - token : paramMock.paramArrayMock, - remainAttempts : "[PC Preview] unknown remainAttempts", - lockoutDuration : "[PC Preview] unknown lockoutDuration", - } - - const TipInfo = { - module : "[PC Preview] unknown module", - tip : "[PC Preview] unknown tip", - } - - const AuthInstance = { - on: function (...args) { - console.warn("uerAuth.on 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, AuthEvent); - } - }, - off: function (...args) { - console.warn("uerAuth.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - start: function (...args) { - console.warn("uerAuth.start interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - cancel: function (...args) { - console.warn("uerAuth.cancel interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - } - - const userAuth = { - AuthenticationResult: { - NO_SUPPORT : -1, - SUCCESS : 0, - COMPARE_FAILURE : 1, - CANCELED : 2, - TIMEOUT : 3, - CAMERA_FAIL : 4, - BUSY : 5, - INVALID_PARAMETERS : 6, - LOCKED : 7, - NOT_ENROLLED : 8, - GENERAL_ERROR : 100 - }, - - ResultCode : { - SUCCESS : 0, - FAIL : 1, - GENERAL_ERROR : 2, - CANCELED : 3, - TIMEOUT : 4, - TYPE_NOT_SUPPORT : 5, - TRUST_LEVEL_NOT_SUPPORT : 6, - BUSY : 7, - INVALID_PARAMETERS : 8, - LOCKED : 9, - NOT_ENROLLED : 10 - }, - - FaceTips : { - FACE_AUTH_TIP_TOO_BRIGHT : 1, - FACE_AUTH_TIP_TOO_DARK : 2, - FACE_AUTH_TIP_TOO_CLOSE : 3, - FACE_AUTH_TIP_TOO_FAR : 4, - FACE_AUTH_TIP_TOO_HIGH : 5, - FACE_AUTH_TIP_TOO_LOW : 6, - FACE_AUTH_TIP_TOO_RIGHT : 7, - FACE_AUTH_TIP_TOO_LEFT : 8, - FACE_AUTH_TIP_TOO_MUCH_MOTION : 9, - FACE_AUTH_TIP_POOR_GAZE : 10, - FACE_AUTH_TIP_NOT_DETECTED : 11 - }, - - FingerprintTips : { - FINGERPRINT_AUTH_TIP_GOOD : 0, - FINGERPRINT_AUTH_TIP_DIRTY : 1, - FINGERPRINT_AUTH_TIP_INSUFFICIENT : 2, - FINGERPRINT_AUTH_TIP_PARTIAL : 3, - FINGERPRINT_AUTH_TIP_TOO_FAST : 4, - FINGERPRINT_AUTH_TIP_TOO_SLOW : 5 - }, - - UserAuthType : { - FACE : 2, - FINGERPRINT : 4 - }, - - AuthTrustLevel : { - ATL1 : 10000, - ATL2 : 20000, - ATL3 : 30000, - ATL4 : 40000 - }, - - getAuthenticator : function (...args) { - console.warn("uerAuth.getAuthenticator interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return Authenticator; - }, - - getVersion : function (...args) { - console.warn("uerAuth.getVersion interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getAvailableStatus : function (...args) { - console.warn("uerAuth.getAvailableStatus interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - - getAuthInstance : function (...args) { - console.warn("uerAuth.getAuthInstance interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return AuthInstance; - }, - - ResultCodeV9 : { - SUCCESS : 12500000, - FAIL : 12500001, - GENERAL_ERROR : 12500002, - CANCELED : 12500003, - TIMEOUT : 12500004, - TYPE_NOT_SUPPORT : 12500005, - TRUST_LEVEL_NOT_SUPPORT : 12500006, - BUSY : 12500007, - INVALID_PARAMETERS : 12500008, - LOCKED : 12500009, - NOT_ENROLLED : 12500010 - }, - UserAuth : UserAuthClass - } - return userAuth; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util.js b/runtime/main/extend/systemplugin/napi/ohos_util.js deleted file mode 100644 index 9e36ca56..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util.js +++ /dev/null @@ -1,577 +0,0 @@ -/* - * 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 mockUtil() { - const TextDecoderClass = class TextDecoder { - constructor(...args) { - console.warn("util.TextDecoder.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.decode = function (...args) { - console.warn("TextDecoder.decode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.decodeWithStream = function (...args) { - console.warn("TextDecoder.decodeWithStream interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.encoding = "[PC preview] unknow encoding"; - this.fatal = "[PC preview] unknow fatal"; - this.ignoreBOM = "[PC preview] unknow ignoreBOM" - } - }; - - const TextEncoderClass = class TextEncoder { - constructor(...args) { - console.warn("util.TextEncoder.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.encode = function (...args) { - console.warn("TextEncoder.encode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - const arr = new Uint8Array() - return arr; - }; - this.encodeInto = function (...args) { - console.warn("TextEncoder.encodeInto interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramObjectMock; - }; - this.encoding = "[PC preview] unknow encoding" - } - }; - - const RationalNumberClass = class RationalNumber { - constructor(...args) { - console.warn("util.RationalNumber.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.compareTo = function (...args) { - console.warn("RationalNumber.compareTo​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.equals = function (...args) { - console.warn("RationalNumber.equals​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.valueOf = function (...args) { - console.warn("RationalNumber.valueOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getDenominator = function (...args) { - console.warn("RationalNumber.getDenominator​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getNumerator = function (...args) { - console.warn("RationalNumber.getNumerator​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.isFinite = function (...args) { - console.warn("RationalNumber.isFinite​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isNaN = function (...args) { - console.warn("RationalNumber.isNaN​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isZero = function (...args) { - console.warn("RationalNumber.isZero​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.toString = function (...args) { - console.warn("RationalNumber.toString interface mocked in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramStringMock; - } - } - }; - - RationalNumberClass.getCommonDivisor = function (...args) { - console.warn("RationalNumber.getDenominator​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - - RationalNumberClass.createRationalFromString = function (...args) { - console.warn("RationalNumber.createRationalFromString​ interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return new RationalNumberClass(); - }; - - const LruBufferClass = class LruBuffer { - constructor(...args) { - console.warn("util.LruBuffer.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.updateCapacity = function (...args) { - console.warn("LruBuffer.updateCapacity interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - }; - this.toString = function (...args) { - console.warn("LruBuffer.toString interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.getCapacity = function (...args) { - console.warn("LruBuffer.getCapacity interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.clear = function (...args) { - console.warn("LruBuffer.clear interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - }; - this.getCreateCount = function (...args) { - console.warn("LruBuffer.getCreateCount interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getMissCount = function (...args) { - console.warn("LruBuffer.getMissCount interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getRemovalCount = function (...args) { - console.warn("LruBuffer.getRemovalCount interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getMatchCount = function (...args) { - console.warn("LruBuffer.getMatchCount interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.getPutCount = function (...args) { - console.warn("LruBuffer.getPutCount interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramNumberMock; - }; - this.isEmpty = function (...args) { - console.warn("LruBuffer.isEmpty​ interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.get = function (...args) { - console.warn("LruBuffer.get interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramObjectMock; - }; - this.put = function (...args) { - console.warn("LruBuffer.put interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramObjectMock; - }; - this.values = function (...args) { - console.warn("LruBuffer.values interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramArrayMock; - }; - this.keys = function (...args) { - console.warn("LruBuffer.keys​ interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramArrayMock; - }; - this.remove = function (...args) { - console.warn("LruBuffer.remove interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramObjectMock; - }; - this.afterRemoval = function (...args) { - console.warn("LruBuffer.afterRemoval interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - }; - this.contains = function (...args) { - console.warn("LruBuffer.contains​ interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.createDefault = function (...args) { - console.warn("LruBuffer.createDefault​ interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramObjectMock; - }; - this.entries = function (...args) { - console.warn("LruBuffer.entries interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramArrayMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("LruBuffer.[Symbol.iterator] interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramArrayMock; - }; - this.length = "[PC preview] unknow length" - } - }; - - const ScopeComparableMock = { - compareTo: function(...args) { - console.warn("ScopeComparable.compareTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - } - }; - - const ScopeType = "[PC preview] unknow ScopeType"; - - const ScopeClass = class Scope { - constructor(...args) { - console.warn("util.Scope.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.toString = function (...args) { - console.warn("Scope.toString interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.intersect = function (...args) { - console.warn("Scope.intersect interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return new ScopeClass(); - }; - this.getUpper = function (...args) { - console.warn("Scope.getUpper interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return ScopeType; - }; - this.getLower = function (...args) { - console.warn("Scope.getLower interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return ScopeType; - }; - this.expand = function (...args) { - console.warn("Scope.expand interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return new ScopeClass(); - }; - this.contains = function (...args) { - console.warn("Scope.contains interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.clamp = function (...args) { - console.warn("Scope.clamp interface mockecd in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device."); - return ScopeType; - } - } - }; - - const Base64Class = class Base64 { - constructor(...args) { - console.warn("util.Base64.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.encodeSync = function (...args) { - console.warn("Base64.encodeSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - const arr = new Uint8Array() - return arr; - }; - this.encodeToStringSync = function (...args) { - console.warn("Base64.encodeToStringSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }; - this.decodeSync = function (...args) { - console.warn("Base64.decodeSync interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - const arr = new Uint8Array() - return arr; - }; - this.encode = function (...args) { - console.warn("Base64.encode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - const arr = new Uint8Array() - return new Promise((resolve, reject) => { - resolve(arr); - }) - }; - this.encodeToString = function (...args) { - console.warn("Base64.encodeToString 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(paramMock.paramStringMock); - }) - }; - this.decode = function (...args) { - console.warn("Base64.decode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - const arr = new Uint8Array() - return new Promise((resolve, reject) => { - resolve(arr); - }) - } - } - }; - - const typesClass = class types { - constructor(...args) { - console.warn("util.types.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.isAnyArrayBuffer = function (...args) { - console.warn("types.isAnyArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isArrayBufferView = function (...args) { - console.warn("types.isArrayBufferView interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isArgumentsObject = function (...args) { - console.warn("types.isArgumentsObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isArrayBuffer = function (...args) { - console.warn("types.isArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isAsyncFunction = function (...args) { - console.warn("types.isAsyncFunction interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isBigInt64Array = function (...args) { - console.warn("types.isBigInt64Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isBigUint64Array = function (...args) { - console.warn("types.isBigUint64Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isBooleanObject = function (...args) { - console.warn("types.isBooleanObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isBoxedPrimitive = function (...args) { - console.warn("types.isBoxedPrimitive interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isDataView = function (...args) { - console.warn("types.isDataView interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isDate = function (...args) { - console.warn("types.isDate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isExternal = function (...args) { - console.warn("types.isExternal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isFloat32Array = function (...args) { - console.warn("types.isFloat32Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isFloat64Array = function (...args) { - console.warn("types.isFloat64Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isGeneratorFunction = function (...args) { - console.warn("types.isGeneratorFunction interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isGeneratorObject = function (...args) { - console.warn("types.isGeneratorObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isInt8Array = function (...args) { - console.warn("types.isInt8Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isInt16Array = function (...args) { - console.warn("types.isInt16Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isInt32Array = function (...args) { - console.warn("types.isInt32Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isMap = function (...args) { - console.warn("types.isMap interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isMapIterator = function (...args) { - console.warn("types.isMapIterator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isModuleNamespaceObject = function (...args) { - console.warn("types.isModuleNamespaceObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isNativeError = function (...args) { - console.warn("types.isNativeError interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isNumberObject = function (...args) { - console.warn("types.isNumberObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isPromise = function (...args) { - console.warn("types.isPromise interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isProxy = function (...args) { - console.warn("types.isProxy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isRegExp = function (...args) { - console.warn("types.isRegExp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isSet = function (...args) { - console.warn("types.isSet interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isSetIterator = function (...args) { - console.warn("types.isSetIterator interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isSharedArrayBuffer = function (...args) { - console.warn("types.isSharedArrayBuffer interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isStringObject = function (...args) { - console.warn("types.isStringObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isSymbolObject = function (...args) { - console.warn("types.isSymbolObject interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isTypedArray = function (...args) { - console.warn("types.isTypedArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isUint8Array = function (...args) { - console.warn("types.isUint8Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isUint8ClampedArray = function (...args) { - console.warn("types.isUint8ClampedArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isUint16Array = function (...args) { - console.warn("types.isUint16Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isUint32Array = function (...args) { - console.warn("types.isUint32Array interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isWeakMap = function (...args) { - console.warn("types.isWeakMap interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.isWeakSet = function (...args) { - console.warn("types.isWeakSet interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramBooleanMock; - } - } - }; - - const utilMock = { - TextDecoder : TextDecoderClass, - TextEncoder : TextEncoderClass, - RationalNumber : RationalNumberClass, - LruBuffer : LruBufferClass, - Scope : ScopeClass, - Base64 : Base64Class, - types : typesClass, - printf: function (...args) { - console.warn("util.printf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }, - getErrorString: function (...args) { - console.warn("util.getErrorString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }, - callbackWrapper: function (...args) { - console.warn("util.callbackWrapper interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - promiseWrapper: function (...args) { - console.warn("util.promiseWrapper interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramObjectMock; - }, - promisify: function (...args) { - console.warn("util.promisify interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramObjectMock; - }, - randomUUID: function (...args) { - console.warn("util.randomUUID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramStringMock; - }, - randomBinaryUUID: function (...args) { - console.warn("util.randomBinaryUUID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramArrayMock; - }, - parseUUID: function (...args) { - console.warn("util.parseUUID interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - return paramMock.paramArrayMock; - } - }; - return utilMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_Arraylist.js b/runtime/main/extend/systemplugin/napi/ohos_util_Arraylist.js deleted file mode 100644 index 793e7f38..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_Arraylist.js +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 mockArrayList() { - const paramArrayList = { - paramAnyMock: '[PC Preview] unknow any', - paramArrayListMock: '[PC Preview] unknow ArrayList' - } - const ArrayListClass = class ArrayList { - constructor(...args) { - console.warn('util.ArrayList interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("ArrayList.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.insert = function (...args) { - console.warn("ArrayList.insert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.has = function (...args) { - console.warn("ArrayList.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getIndexOf = function (...args) { - console.warn("ArrayList.getIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.removeByIndex = function (...args) { - console.warn("ArrayList.removeByIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramArrayList.paramAnyMock; - }; - this.remove = function (...args) { - console.warn("ArrayList.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getLastIndexOf = function (...args) { - console.warn("ArrayList.getLastIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.removeByRange = function (...args) { - console.warn("ArrayList.removeByRange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.replaceAllElements = function (...args) { - console.warn("ArrayList.replaceAllElements interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock, paramArrayList.paramAnyMock) - } - }; - this.forEach = function (...args) { - console.warn("ArrayList.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.sort = function (...args) { - console.warn("ArrayList.sort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock) - } - }; - this.subArrayList = function (...args) { - console.warn("ArrayList.subArrayList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramArrayList.paramArrayListMock; - }; - this.clear = function (...args) { - console.warn("ArrayList.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.clone = function (...args) { - console.warn("ArrayList.clone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramArrayList.paramArrayListMock; - }; - this.getCapacity = function (...args) { - console.warn("ArrayList.getCapacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.convertToArray = function (...args) { - console.warn("ArrayList.convertToArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.isEmpty = function (...args) { - console.warn("ArrayList.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.increaseCapacityTo = function (...args) { - console.warn("ArrayList.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.trimToCurrentLength = function (...args) { - console.warn("ArrayList.trimToCurrentLength interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this[Symbol.iterator] = function (...args) { - console.warn("ArrayList.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramArrayList.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return ArrayListClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_Deque.js b/runtime/main/extend/systemplugin/napi/ohos_util_Deque.js deleted file mode 100644 index 807a3021..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_Deque.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 mockDeque() { - const paramDeque = { - paramAnyMock: '[PC Preview] unknow any', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const DequeClass = class Deque { - constructor(...args) { - console.warn('util.Deque interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.insertFront = function (...args) { - console.warn("Deque.insertFront interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.insertEnd = function (...args) { - console.warn("Deque.insertEnd interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.has = function (...args) { - console.warn("Deque.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getFirst = function (...args) { - console.warn("Deque.getFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramDeque.paramAnyMock; - }; - this.getLast = function (...args) { - console.warn("Deque.getLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramDeque.paramAnyMock; - }; - this.popFirst = function (...args) { - console.warn("Deque.popFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramDeque.paramAnyMock; - }; - this.popLast = function (...args) { - console.warn("Deque.popLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramDeque.paramAnyMock; - }; - this.forEach = function (...args) { - console.warn("Deque.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramDeque.businessErrorMock) - } - }; - this[Symbol.iterator] = function (...args) { - console.warn("Deque.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramDeque.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return DequeClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_HashMap.js b/runtime/main/extend/systemplugin/napi/ohos_util_HashMap.js deleted file mode 100644 index 4ffffdf0..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_HashMap.js +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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 mockHashMap() { - const paramHashMap = { - paramAnyMock : '[PC Preview] unknow any', - paramHashMap : '[PC Preview] unknow hashmap', - paramIterMock_K : '[PC Preview] unknow iterableiterator_k', - paramIterMock_V : '[PC Preview] unknow iterableiterator_v' - } - const HashMapClass = class HashMap { - constructor(...args) { - console.warn('util.HashMap interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.isEmpty = function (...args) { - console.warn("HashMap.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasKey = function (...args) { - console.warn("HashMap.hasKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasValue = function (...args) { - console.warn("HashMap.hasValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.get = function (...args) { - console.warn("HashMap.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramHashMap.paramAnyMock; - }; - this.setAll = function (...args) { - console.warn("HashMap.setAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.set = function (...args) { - console.warn("HashMap.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramObjectMock; - }; - this.remove = function (...args) { - console.warn("HashMap.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramHashMap.paramAnyMock; - }; - this.clear = function (...args) { - console.warn("HashMap.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.keys = function (...args) { - console.warn('HashMap.keys interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorKMock = { - *[Symbol.iterator]() { - yield paramHashMap.paramIterMock_K; - } - }; - return IteratorKMock; - }; - this.values = function (...args) { - console.warn('HashMap.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramHashMap.paramIterMock_V; - } - }; - return IteratorVMock; - }; - this.replace = function (...args) { - console.warn("HashMap.replace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.forEach = function (...args) { - console.warn("HashMap.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock); - } - }; - this.entries = function (...args) { - console.warn('HashMap.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramHashMap.paramIterMock_K, paramHashMap.paramIterMock_V]; - } - }; - return IteratorEntriesMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("HashMap.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramHashMap.paramIterMock_K, paramHashMap.paramIterMock_V]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return HashMapClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_HashSet.js b/runtime/main/extend/systemplugin/napi/ohos_util_HashSet.js deleted file mode 100644 index 9475eae4..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_HashSet.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 mockHashSet() { - const paramHashSet = { - paramAnyMock : '[PC Preview] unknow any' - } - const HashSetClass = class HashSet { - constructor(...args) { - console.warn('util.HashSet interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.isEmpty = function (...args) { - console.warn("HashSet.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.has = function (...args) { - console.warn("HashSet.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.add = function (...args) { - console.warn("HashSet.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.remove = function (...args) { - console.warn("HashSet.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.clear = function (...args) { - console.warn("HashSet.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.forEach = function (...args) { - console.warn("HashSet.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (this.args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock); - } - }; - this.values = function (...args) { - console.warn('HashSet.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramHashSet.paramAnyMock; - } - }; - return IteratorVMock; - }; - this.entries = function (...args) { - console.warn('HashSet.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramHashSet.paramAnyMock, paramHashSet.paramAnyMock]; - } - }; - return IteratorEntriesMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("HashSet.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramHashSet.paramAnyMock, paramHashSet.paramAnyMock]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return HashSetClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightMap.js b/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightMap.js deleted file mode 100644 index 9a869876..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightMap.js +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 mockLightWeightMap() { - const paramLightWeightMap = { - paramAnyMock_K : '[PC Preview] unknow any_k', - paramAnyMock_V : '[PC Preview] unknow any_v' - } - const LightWeightMapClass = class LightWeightMap { - constructor(...args) { - console.warn('util.LightWeightMap interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.hasAll = function (...args) { - console.warn("LightWeightMap.hasAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasKey = function (...args) { - console.warn("LightWeightMap.hasKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasValue = function (...args) { - console.warn("LightWeightMap.hasValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.increaseCapacityTo = function (...args) { - console.warn("LightWeightMap.increaseCapacityTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.entries = function (...args) { - console.warn('LightWeightMap.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramLightWeightMap.paramAnyMock_K, paramHashMap.paramAnyMock_V]; - } - }; - return IteratorEntriesMock; - } - this.get = function (...args) { - console.warn("LightWeightMap.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightMap.paramAnyMock_V; - }; - this.getIndexOfKey = function (...args) { - console.warn("LightWeightMap.getIndexOfKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getIndexOfValue = function (...args) { - console.warn("LightWeightMap.getIndexOfValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.isEmpty = function (...args) { - console.warn("LightWeightMap.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getKeyAt = function (...args) { - console.warn("LightWeightMap.getKeyAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightMap.paramAnyMock_K; - }; - this.keys = function (...args) { - console.warn('LightWeightMap.keys interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorKMock = { - *[Symbol.iterator]() { - yield paramLightWeightMap.paramAnyMock_K; - } - }; - return IteratorKMock; - }; - this.setAll = function (...args) { - console.warn("LightWeightMap.setAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.set = function (...args) { - console.warn("LightWeightMap.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramObjectMock; - }; - this.remove = function (...args) { - console.warn("LightWeightMap.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightMap.paramAnyMock_V; - }; - this.removeAt = function (...args) { - console.warn("LightWeightMap.removeAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.clear = function (...args) { - console.warn("LightWeightMap.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.setValueAt = function (...args) { - console.warn("LightWeightMap.setValueAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.forEach = function (...args) { - console.warn("LightWeightMap.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (this.args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.toString = function (...args) { - console.warn("LightWeightMap.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getValueAt = function (...args) { - console.warn("LightWeightMap.getValueAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightMap.paramAnyMock_V; - }; - this.values = function (...args) { - console.warn('LightWeightMap.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramLightWeightMap.paramAnyMock_V; - } - }; - return IteratorVMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("LightWeightMap.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramLightWeightMap.paramAnyMock_K, paramLightWeightMap.paramAnyMock_V]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return LightWeightMapClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightSet.js b/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightSet.js deleted file mode 100644 index afdb1c42..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_LightWeightSet.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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 mockLightWeightSet() { - const paramLightWeightSet = { - paramAnyMock: '[PC Preview] unknow any', - paramIterMock_T: '[PC Preview] unknow IterableIterator_t' - } - const LightWeightSetClass = class LightWeightSet { - constructor(...args) { - console.warn('util.LightWeightSet interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("LightWeightSet.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.addAll = function (...args) { - console.warn("LightWeightSet.addAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasAll = function (...args) { - console.warn("LightWeightSet.hasAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.has = function (...args) { - console.warn("LightWeightSet.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.equal = function (...args) { - console.warn("LightWeightSet.equal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.increaseCapacityTo = function (...args) { - console.warn("LightWeightSet.increaseCapacityTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getIndexOf = function (...args) { - console.warn("LightWeightSet.getIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.remove = function (...args) { - console.warn("LightWeightSet.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightSet.paramAnyMock; - }; - this.removeAt = function (...args) { - console.warn("LightWeightSet.removeAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.clear = function (...args) { - console.warn("LightWeightSet.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.forEach = function (...args) { - console.warn("LightWeightSet.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (this.args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock); - } - }; - this.toString = function (...args) { - console.warn("LightWeightSet.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.toString = function (...args) { - console.warn("LightWeightSet.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.toArray = function (...args) { - console.warn("LightWeightSet.toArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.getValueAt = function (...args) { - console.warn("LightWeightSet.getValueAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLightWeightSet.paramAnyMock; - }; - this.values = function (...args) { - console.warn('LightWeightSet.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramLightWeightSet.paramIterMock_T; - } - }; - return IteratorVMock; - }; - this.entries = function (...args) { - console.warn('LightWeightSet.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramLightWeightSet.paramIterMock_T, paramLightWeightSet.paramIterMock_T]; - } - }; - return IteratorEntriesMock; - }; - this.isEmpty = function (...args) { - console.warn("LightWeightSet.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("LightWeightSet.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramLightWeightSet.paramIterMock_T, paramLightWeightSet.paramIterMock_T]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return LightWeightSetClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_LinkedList.js b/runtime/main/extend/systemplugin/napi/ohos_util_LinkedList.js deleted file mode 100644 index f3a419f7..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_LinkedList.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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 mockLinkedList() { - const paramLinkedList = { - paramAnyMock: '[PC Preview] unknow any', - paramLinkedListMock: '[PC Preview] unknow LinkedList', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const LinkedListClass = class LinkedList { - constructor(...args) { - console.warn('util.LinkedList interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("LinkedList.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.insert = function (...args) { - console.warn("LinkedList.insert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.get = function (...args) { - console.warn("LinkedList.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.addFirst = function (...args) { - console.warn("LinkedList.addFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.removeFirst = function (...args) { - console.warn("LinkedList.removeFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.removeLast = function (...args) { - console.warn("LinkedList.removeLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.has = function (...args) { - console.warn("LinkedList.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getIndexOf = function (...args) { - console.warn("LinkedList.getIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.removeByIndex = function (...args) { - console.warn("LinkedList.removeByIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.remove = function (...args) { - console.warn("LinkedList.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.removeFirstFound = function (...args) { - console.warn("LinkedList.removeFirstFound interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.removeLastFound = function (...args) { - console.warn("LinkedList.removeLastFound interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getLastIndexOf = function (...args) { - console.warn("LinkedList.getLastIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getFirst = function (...args) { - console.warn("LinkedList.getFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.getLast = function (...args) { - console.warn("LinkedList.getLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.set = function (...args) { - console.warn("LinkedList.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramAnyMock; - }; - this.forEach = function (...args) { - console.warn("LinkedList.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.clear = function (...args) { - console.warn("LinkedList.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.clone = function (...args) { - console.warn("LinkedList.clone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramLinkedList.paramLinkedListMock; - }; - this.convertToArray = function (...args) { - console.warn("LinkedList.convertToArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("LinkedList.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramLinkedList.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return LinkedListClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_List.js b/runtime/main/extend/systemplugin/napi/ohos_util_List.js deleted file mode 100644 index a2587ceb..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_List.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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 mockList() { - const paramList = { - paramAnyMock: '[PC Preview] unknow any', - paramListMock: '[PC Preview] unknow List', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const ListClass = class List { - constructor(...args) { - console.warn('util.List interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("List.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.insert = function (...args) { - console.warn("List.insert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.get = function (...args) { - console.warn("List.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramAnyMock; - }; - this.has = function (...args) { - console.warn("List.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getIndexOf = function (...args) { - console.warn("List.getIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.removeByIndex = function (...args) { - console.warn("List.removeByIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramAnyMock; - }; - this.remove = function (...args) { - console.warn("List.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getLastIndexOf = function (...args) { - console.warn("List.getLastIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getFirst = function (...args) { - console.warn("List.getFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramAnyMock; - }; - this.getLast = function (...args) { - console.warn("List.getLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramAnyMock; - }; - this.set = function (...args) { - console.warn("List.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramAnyMock; - }; - this.equal = function (...args) { - console.warn("List.equal interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.forEach = function (...args) { - console.warn("List.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.sort = function (...args) { - console.warn("List.sort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.clear = function (...args) { - console.warn("List.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getSubList = function (...args) { - console.warn("List.getSubList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramList.paramListMock; - }; - this.replaceAllElements = function (...args) { - console.warn("List.replaceAllElements interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock, paramLinkedList.paramAnyMock) - } - }; - this.convertToArray = function (...args) { - console.warn("List.convertToArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.isEmpty = function (...args) { - console.warn("LinkedList.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("List.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramList.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return ListClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_PlainArray.js b/runtime/main/extend/systemplugin/napi/ohos_util_PlainArray.js deleted file mode 100644 index e8c9a551..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_PlainArray.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 mockPlainArray() { - const paramPlainArray = { - paramAnyMock : '[PC Preview] unknow any', - paramPlainArray : '[PC Preview] unknow PlainArray', - paramIterMock_K : '[PC Preview] unknow iterableiterator_k', - paramIterMock_V : '[PC Preview] unknow iterableiterator_v' - } - const PlainArrayClass = class PlainArray { - constructor(...args) { - console.warn('util.PlainArray interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("PlainArray.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.clear = function (...args) { - console.warn("PlainArray.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.clone = function (...args) { - console.warn("PlainArray.clone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramPlainArray.paramPlainArray; - }; - this.has = function (...args) { - console.warn("PlainArray.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.get = function (...args) { - console.warn("PlainArray.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramPlainArray.paramAnyMock; - }; - this.getIndexOfKey = function (...args) { - console.warn("PlainArray.getIndexOfKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getIndexOfValue = function (...args) { - console.warn("PlainArray.getIndexOfValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.isEmpty = function (...args) { - console.warn("PlainArray.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getKeyAt = function (...args) { - console.warn("PlainArray.getKeyAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.remove = function (...args) { - console.warn("PlainArray.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramPlainArray.paramAnyMock; - }; - this.removeAt = function (...args) { - console.warn("PlainArray.removeAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramPlainArray.paramAnyMock; - }; - this.removeRangeFrom = function (...args) { - console.warn("PlainArray.removeRangeFrom interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.setValueAt = function (...args) { - console.warn("PlainArray.setValueAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.toString = function (...args) { - console.warn("PlainArray.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.getValueAt = function (...args) { - console.warn("PlainArray.getValueAt interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramPlainArray.paramAnyMock; - }; - this.forEach = function (...args) { - console.warn("PlainArray.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (this.args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this[Symbol.iterator] = function (...args) { - console.warn("PlainArray.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramPlainArray.paramIterMock_K, paramPlainArray.paramIterMock_V]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return PlainArrayClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_Queue.js b/runtime/main/extend/systemplugin/napi/ohos_util_Queue.js deleted file mode 100644 index 4edce0f9..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_Queue.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 mockQueue() { - const paramQueue = { - paramAnyMock: '[PC Preview] unknow any', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const QueueClass = class Queue { - constructor(...args) { - console.warn('util.Queue interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("Queue.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.getFirst = function (...args) { - console.warn("Queue.getFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramQueue.paramAnyMock; - }; - this.pop = function (...args) { - console.warn("Queue.pop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramQueue.paramAnyMock; - }; - this.forEach = function (...args) { - console.warn("Queue.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this[Symbol.iterator] = function (...args) { - console.warn("Queue.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramQueue.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return QueueClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_Stack.js b/runtime/main/extend/systemplugin/napi/ohos_util_Stack.js deleted file mode 100644 index 23e52e69..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_Stack.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 mockStack() { - const paramStack = { - paramAnyMock: '[PC Preview] unknow any', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const StackClass = class Stack { - constructor(...args) { - console.warn('util.Stack interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.isEmpty = function (...args) { - console.warn("Stack.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.peek = function (...args) { - console.warn("Stack.peek interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramStack.paramAnyMock; - }; - this.pop = function (...args) { - console.warn("Stack.pop interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramStack.paramAnyMock; - }; - this.push = function (...args) { - console.warn("Stack.push interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramStack.paramAnyMock; - }; - this.locate = function (...args) { - console.warn("Stack.locate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.forEach = function (...args) { - console.warn("Stack.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this[Symbol.iterator] = function (...args) { - console.warn("Stack.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramStack.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return StackClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_TreeMap.js b/runtime/main/extend/systemplugin/napi/ohos_util_TreeMap.js deleted file mode 100644 index 4798cbd2..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_TreeMap.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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 mockTreeMap() { - const paramTreeMap = { - paramIterMock_K: '[PC Preview] unknow iterableiterator_k', - paramIterMock_V: '[PC Preview] unknow iterableiterator_v' - } - const TreeMapClass = class TreeMap { - constructor(...args) { - console.warn('util.TreeMap interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.isEmpty = function (...args) { - console.warn("TreeMap.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasKey = function (...args) { - console.warn("TreeMap.hasKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.hasValue = function (...args) { - console.warn("TreeMap.hasValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.get = function (...args) { - console.warn("TreeMap.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_V; - }; - this.getFirstKey = function (...args) { - console.warn("TreeMap.getFirstKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_K; - }; - this.getLastKey = function (...args) { - console.warn("TreeMap.getLastKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_K; - }; - this.setAll = function (...args) { - console.warn("TreeMap.setAll interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.set = function (...args) { - console.warn("TreeMap.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramObjectMock; - }; - this.remove = function (...args) { - console.warn("TreeMap.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_V; - }; - this.clear = function (...args) { - console.warn("TreeMap.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getLowerKey = function (...args) { - console.warn("TreeMap.getLowerKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_K; - }; - this.getHigherKey = function (...args) { - console.warn("TreeMap.getHigherKey interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeMap.paramIterMock_K; - }; - this.keys = function (...args) { - console.warn('TreeMap.keys interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorKMock = { - *[Symbol.iterator]() { - yield paramTreeMap.paramIterMock_K; - } - }; - return IteratorKMock; - }; - this.values = function (...args) { - console.warn('TreeMap.values interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramTreeMap.paramIterMock_V; - } - }; - return IteratorVMock; - }; - this.replace = function (...args) { - console.warn("TreeMap.replace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.forEach = function (...args) { - console.warn("TreeMap.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (this.args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.entries = function (...args) { - console.warn('TreeMap.entries interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - const IteratorEntriesMock = { - *[Symbol.iterator]() { - yield [paramTreeMap.paramIterMock_K, paramTreeMap.paramIterMock_V]; - } - }; - return IteratorEntriesMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("TreeMap.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - const returnValue = [paramTreeMap.paramIterMock_K, paramTreeMap.paramIterMock_V]; - index++; - return { - value: returnValue, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return TreeMapClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_TreeSet.js b/runtime/main/extend/systemplugin/napi/ohos_util_TreeSet.js deleted file mode 100644 index ee44c088..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_TreeSet.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 mockTreeSet() { - const paramTreeSet = { - paramAnyMock: '[PC Preview] unknow any', - paramIterMock_TT: '[PC Preview] unknow IterableIterator_tt', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - const TreeSetClass = class TreeSet { - constructor(...args) { - console.warn('util.TreeSet interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.isEmpty = function (...args) { - console.warn("TreeSet.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.has = function (...args) { - console.warn("TreeSet.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.add = function (...args) { - console.warn("TreeSet.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.remove = function (...args) { - console.warn("TreeSet.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.clear = function (...args) { - console.warn("TreeSet.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getFirstValue = function (...args) { - console.warn("TreeSet.getFirstValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.getLastValue = function (...args) { - console.warn("TreeSet.getLastValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.getLowerValue = function (...args) { - console.warn("TreeSet.getLowerValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.getHigherValue = function (...args) { - console.warn("TreeSet.getHigherValue interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.popFirst = function (...args) { - console.warn("TreeSet.popFirst interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.popLast = function (...args) { - console.warn("TreeSet.popLast interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramTreeSet.paramAnyMock; - }; - this.forEach = function (...args) { - console.warn("TreeSet.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.values = function (...args) { - console.warn("TreeSet.values interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramTreeSet.paramIterMock_TT; - } - }; - return IteratorVMock; - }; - this.entries = function (...args) { - console.warn("TreeSet.entries interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - const IteratorVMock = { - *[Symbol.iterator]() { - yield paramTreeSet.paramIterMock; - } - }; - return IteratorVMock; - }; - this[Symbol.iterator] = function (...args) { - console.warn("TreeSet.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramTreeSet.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return TreeSetClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_util_Vector.js b/runtime/main/extend/systemplugin/napi/ohos_util_Vector.js deleted file mode 100644 index 83fcad63..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_util_Vector.js +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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 mockVector() { - const paramVector = { - paramAnyMock: '[PC Preview] unknow any', - paramVectorMock: '[PC Preview] unknow Vector', - paramIterMock: '[PC Preview] unknow IterableIterator' - } - - const VectorClass = class Vector { - constructor(...args) { - console.warn('util.Vector interface mocked in the Previewer. How this interface works on the Previewer' + - ' may be different from that on a real device.'); - this.length = '[PC preview] unknow length'; - this.add = function (...args) { - console.warn("Vector.add interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.insert = function (...args) { - console.warn("Vector.insert interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.has = function (...args) { - console.warn("Vector.has interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.get = function (...args) { - console.warn("Vector.get interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramAnyMock; - }; - this.getIndexOf = function (...args) { - console.warn("Vector.getIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getFirstElement = function (...args) { - console.warn("Vector.getFirstElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramAnyMock; - }; - this.getLastElement = function (...args) { - console.warn("Vector.getLastElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramAnyMock; - }; - this.removeByIndex = function (...args) { - console.warn("Vector.removeByIndex interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramAnyMock; - }; - this.remove = function (...args) { - console.warn("Vector.remove interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.set = function (...args) { - console.warn("Vector.set interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramAnyMock; - }; - this.getLastIndexOf = function (...args) { - console.warn("Vector.getLastIndexOf interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getLastIndexFrom = function (...args) { - console.warn("Vector.getLastIndexFrom interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.getIndexFrom = function (...args) { - console.warn("Vector.getIndexFrom interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.removeByRange = function (...args) { - console.warn("Vector.removeByRange interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.replaceAllElements = function (...args) { - console.warn("Vector.replaceAllElements interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock, paramVector.paramAnyMock) - } - }; - this.forEach = function (...args) { - console.warn("Vector.forEach interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - if (typeof args[0] === 'function') { - args[0].call(this, paramMock.businessErrorMock) - } - }; - this.sort = function (...args) { - console.warn("Vector.sort interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.subVector = function (...args) { - console.warn("Vector.subVector interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramVectorMock; - }; - this.clear = function (...args) { - console.warn("Vector.clear interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.clone = function (...args) { - console.warn("Vector.clone interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramVector.paramVectorMock; - }; - this.setLength = function (...args) { - console.warn("Vector.setLength interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.getCapacity = function (...args) { - console.warn("Vector.getCapacity interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }; - this.convertToArray = function (...args) { - console.warn("Vector.convertToArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramArrayMock; - }; - this.isEmpty = function (...args) { - console.warn("Vector.isEmpty interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }; - this.increaseCapacityTo = function (...args) { - console.warn("Vector.increaseCapacityTo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.toString = function (...args) { - console.warn("Vector.toString interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }; - this.trimToCurrentLength = function (...args) { - console.warn("Vector.trimToCurrentLength interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this.copyToArray = function (...args) { - console.warn("Vector.copyToArray interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }; - this[Symbol.iterator] = function (...args) { - console.warn("Vector.[Symbol.iterator] interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - let index = 0; - const IteratorMock = { - next: () => { - if (index < 1) { - index++; - return { - value: paramVector.paramAnyMock, - done: false - }; - } else { - return { - done: true - }; - } - } - }; - return IteratorMock; - } - } - } - return VectorClass; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_vibrator.js b/runtime/main/extend/systemplugin/napi/ohos_vibrator.js deleted file mode 100644 index 3968b60a..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_vibrator.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021 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 mockVibrator() { - const EffectId = { - EFFECT_CLOCK_TIMER: "haptic.clock.timer" - } - const VibratorStopMode = { - VIBRATOR_STOP_MODE_TIME: "time", - VIBRATOR_STOP_MODE_PRESET: "preset" - } - const vibrator = { - vibrate: function (...args) { - console.warn("vibrator.vibrate 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - }, - stop: function (...args) { - console.warn("vibrator.stop 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); - } else { - return new Promise((resolve) => { - resolve(); - }) - } - } - } - return vibrator -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_volumeManager.js b/runtime/main/extend/systemplugin/napi/ohos_volumeManager.js deleted file mode 100644 index 4854b912..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_volumeManager.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 mockVolumeManager() { - const Volume = { - id: '[PC preview] unknow id', - uuid: '[PC preview] unknow uuid', - description: '[PC preview] unknow description', - removeAble: '[PC preview] unknow removeAble', - path: '[PC preview] unknow path', - state: '[PC preview] unknow state' - }; - const volumeManager = { - Volume: Volume, - getAllVolumes: function (...args) { - console.warn("volumeManager.getAllVolumes 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, new Array(Volume)); - } else { - return new Promise((resolve, reject) => { - resolve(new Array(Volume)); - }) - } - }, - mount: function (...args) { - console.warn("volumeManager.mount 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - unmount: function (...args) { - console.warn("volumeManager.unmount 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getVolumeByUuid: function (...args) { - console.warn("volumeManager.getVolumeByUuid 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, Volume); - } else { - return new Promise((resolve, reject) => { - resolve(Volume); - }) - } - }, - getVolumeById: function (...args) { - console.warn("volumeManager.getVolumeById 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, Volume); - } else { - return new Promise((resolve, reject) => { - resolve(Volume); - }) - } - }, - setVolumeDescription: function (...args) { - console.warn("volumeManager.setVolumeDescription 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - format: function (...args) { - console.warn("volumeManager.format 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - partition: function (...args) { - console.warn("volumeManager.partition 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - return volumeManager; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js b/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js deleted file mode 100644 index 17d1a718..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_wallpaper.js +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2021-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 { PixelMapMock } from "../multimedia" - -export function mockWallpaper() { - const wallpaper = { - WallpaperType: { - WALLPAPER_SYSTEM: '[PC preview] unknow WALLPAPER_SYSTEM', - WALLPAPER_LOCKSCREEN: '[PC preview] unknow WALLPAPER_LOCKSCREEN' - }, - getColors: function (...args) { - console.warn("wallpaper.getColors 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; - let colors = new Array(); - colors.push(RgbaColorMock); - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, colors); - } else { - return new Promise((resolve, reject) => { - resolve(colors); - }) - } - }, - getColorsSync: function (...args) { - console.warn("wallpaper.getColorsSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - let colors = new Array(); - colors.push(RgbaColorMock); - return colors; - }, - getId: function (...args) { - console.warn("wallpaper.getId 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getIdSync: function (...args) { - console.warn("wallpaper.getIdSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getFile: function (...args) { - console.warn("wallpaper.getFile 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getFileSync: function (...args) { - console.warn("wallpaper.getFileSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getMinHeight: function (...args) { - console.warn("wallpaper.getMinHeight 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinHeightSync: function (...args) { - console.warn("wallpaper.getMinHeightSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getMinWidth: function (...args) { - console.warn("wallpaper.getMinWidth 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.paramNumberMock) - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMinWidthSync: function (...args) { - console.warn("wallpaper.getMinWidthSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - isChangePermitted: function (...args) { - console.warn("wallpaper.isChangePermitted 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isChangeAllowed: function (...args) { - console.warn("wallpaper.isChangeAllowed interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isOperationAllowed: function (...args) { - console.warn("wallpaper.isOperationAllowed 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isUserChangeAllowed: function (...args) { - console.warn("wallpaper.isUserChangeAllowed interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - reset: function (...args) { - console.warn("wallpaper.reset 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - restore: function (...args) { - console.warn("wallpaper.restore 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setWallpaper: function (...args) { - console.warn("wallpaper.setWallpaper 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - setImage: function (...args) { - console.warn("wallpaper.setImage 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getPixelMap: function (...args) { - console.warn("wallpaper.getPixelMap 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, PixelMapMock) - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - getImage: function (...args) { - console.warn("wallpaper.getImage 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, PixelMapMock) - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock); - }) - } - }, - on: function (...args) { - console.warn("wallpaper.on 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') { - if (args[0] == 'colorChange') { - let colors = new Array(); - colors.push(RgbaColorMock); - args[len - 1].call(this, colors, wallpaper.WallpaperType.WALLPAPER_SYSTEM); - } - } - }, - off: function (...args) { - console.warn("wallpaper.off 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') { - if (args[0] == 'colorChange') { - let colors = new Array(); - colors.push(RgbaColorMock); - args[len - 1].call(this, colors, wallpaper.WallpaperType.WALLPAPER_SYSTEM); - } - } - } - } - const RgbaColorMock = { - red: '[PC preview] unknow red', - green: '[PC preview] unknow green', - blue: '[PC preview] unknow blue', - alpha: '[PC preview] unknow alpha' - } - return wallpaper -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_wantAgent.js b/runtime/main/extend/systemplugin/napi/ohos_wantAgent.js deleted file mode 100644 index 0ec5aa2b..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_wantAgent.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2021 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 { WantClass } from "./ohos_application_Want" - -export const WantAgentFlags = { - ONE_TIME_FLAG: 0, - NO_BUILD_FLAG: 1, - CANCEL_PRESENT_FLAG: 2, - UPDATE_PRESENT_FLAG: 3, - CONSTANT_FLAG: 4, - REPLACE_ELEMENT: 5, - REPLACE_ACTION: 6, - REPLACE_URI: 7, - REPLACE_ENTITIES: 8, - REPLACE_BUNDLE: 9 -} -export const OperationType = { - UNKNOWN_TYPE: 0, - START_ABILITY: 1, - START_ABILITIES: 2, - START_SERVICE: 3, - SEND_COMMON_EVENT: 4 -} -export const CompleteData = { - info: WantAgent, - want: new WantClass(), - finalCode: '[PC preview] unknow finalCode', - finalData: '[PC preview] unknow finalData', - extraInfo: {}, -} -export const WantAgent = {} -export function mockWantAgent() { - const wantAgent = { - getBundleName: function (...args) { - console.warn("wantAgent.getBundleName 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); - }); - } - }, - getUid: function (...args) { - console.warn("wantAgent.getUid 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - getWant: function (...args) { - console.warn("wantAgent.getWant 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, new WantClass()); - } else { - return new Promise((resolve) => { - resolve(new WantClass()); - }); - } - }, - cancel: function (...args) { - console.warn("wantAgent.cancel 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - trigger: function (...args) { - console.warn("wantAgent.trigger 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, CompleteData); - } - }, - equal: function (...args) { - console.warn("wantAgent.equal 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); - }); - } - }, - getWantAgent: function (...args) { - console.warn("wantAgent.getWantAgent 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, WantAgent); - } else { - return new Promise((resolve) => { - resolve(WantAgent); - }); - } - }, - getOperationType: function (...args) { - console.warn("wantAgent.getOperationType 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - } - return wantAgent -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_wifi.js b/runtime/main/extend/systemplugin/napi/ohos_wifi.js deleted file mode 100644 index a08836c4..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_wifi.js +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Copyright (c) 2021-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 mockWifi() { - const EapMethod = { - EAP_NONE : 0, - EAP_PEAP : 1, - EAP_TLS : 2, - EAP_TTLS : 3, - EAP_PWD : 4, - EAP_SIM : 5, - EAP_AKA : 6, - EAP_AKA_PRIME : 7, - EAP_UNAUTH_TLS : 8, - } - - const Phase2Method = { - PHASE2_NONE : 0, - PHASE2_PAP : 1, - PHASE2_MSCHAP : 2, - PHASE2_MSCHAPV2 : 3, - PHASE2_GTC : 4, - PHASE2_SIM : 5, - PHASE2_AKA : 6, - PHASE2_AKA_PRIME : 7, - } - - const WifiSecurityType = { - WIFI_SEC_TYPE_INVALID : 0, - WIFI_SEC_TYPE_OPEN : 1, - WIFI_SEC_TYPE_WEP : 2, - WIFI_SEC_TYPE_PSK : 3, - WIFI_SEC_TYPE_SAE : 4, - WIFI_SEC_TYPE_EAP : 5, - WIFI_SEC_TYPE_EAP_SUITE_B : 6, - WIFI_SEC_TYPE_OWE : 7, - WIFI_SEC_TYPE_WAPI_CERT : 8, - WIFI_SEC_TYPE_WAPI_PSK : 9, - } - - const IpType = { - STATIC : 0, - DHCP : 1, - UNKNOWN : 2, - } - - const SuppState = { - DISCONNECTED : 0, - INTERFACE_DISABLED : 1, - INACTIVE : 2, - SCANNING : 3, - AUTHENTICATING : 4, - ASSOCIATING : 5, - ASSOCIATED : 6, - FOUR_WAY_HANDSHAKE : 7, - GROUP_HANDSHAKE : 8, - COMPLETED : 9, - UNINITIALIZED : 10, - INVALID : 11, - } - - const ConnState = { - SCANNING : 0, - CONNECTING : 1, - AUTHENTICATING : 2, - OBTAINING_IPADDR : 3, - CONNECTED : 4, - DISCONNECTING : 5, - DISCONNECTED : 6, - UNKNOWN : 7, - } - - const P2pConnectState = { - DISCONNECTED : 0, - CONNECTED : 1, - } - - const P2pDeviceStatus = { - CONNECTED : 0, - INVITED : 1, - FAILED : 2, - AVAILABLE : 3, - UNAVAILABLE : 4, - } - - const WifiLinkedInfo = { - ssid: '[PC preview] unknow ssid', - bssid: '[PC preview] unknow bssid', - networkId: '[PC preview] unknow networkId', - rssi: '[PC preview] unknow rssi', - band: '[PC preview] unknow band', - linkSpeed: '[PC preview] unknow linkSpeed', - frequency: '[PC preview] unknow frequency', - isHidden: '[PC preview] unknow isHidden', - isRestricted: '[PC preview] unknow isRestricted', - chload: '[PC preview] unknow chload', - snr: '[PC preview] unknow snr', - macType: '[PC preview] unknow macType', - macAddress: '[PC preview] unknow macAddress', - ipAddress: '[PC preview] unknow ipAddress', - suppState: SuppState.INVALID, - connState: ConnState.DISCONNECTED, - } - - const IpInfo = { - ipAddress: '[PC preview] unknow ipAddress', - gateway: '[PC preview] unknow gateway', - netmask: '[PC preview] unknow netmask', - primaryDns: '[PC preview] unknow primaryDns', - secondDns: '[PC preview] unknow secondDns', - serverIp: '[PC preview] unknow serverIp', - leaseDuration: '[PC preview] unknow leaseDuration', - } - - const WifiInfoElem = { - eid: '[PC preview] unknow eid', - content: '[PC preview] unknow content', - } - - const WifiScanInfo = { - ssid: '[PC preview] unknow ssid', - bssid: '[PC preview] unknow bssid', - capabilities: '[PC preview] unknow capabilities', - securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN, - rssi: '[PC preview] unknow rssi', - band: '[PC preview] unknow band', - frequency: '[PC preview] unknow frequency', - channelWidth: '[PC preview] unknow channelWidth', - centerFrequency0: '[PC preview] unknow centerFrequency0', - centerFrequency1: '[PC preview] unknow centerFrequency1', - infoElems: [WifiInfoElem], - timestamp: '[PC preview] unknow timestamp', - } - - const IpConfig = { - ipAddress: '[PC preview] unknow ipAddress', - gateway: '[PC preview] unknow gateway', - dnsServers: [paramMock.paramNumberMock], - domains: [paramMock.paramStringMock], - } - - const WifiEapConfig = { - eapMethod: EapMethod.EAP_NONE, - phase2Method: Phase2Method.PHASE2_NONE, - identity: '[PC preview] unknow identity', - anonymousIdentity: '[PC preview] unknow anonymousIdentity', - password: '[PC preview] unknow password', - caCertAliases: '[PC preview] unknow caCertAliases', - caPath: '[PC preview] unknow caPath', - clientCertAliases: '[PC preview] unknow clientCertAliases', - altSubjectMatch: '[PC preview] unknow altSubjectMatch', - domainSuffixMatch: '[PC preview] unknow domainSuffixMatch', - realm: '[PC preview] unknow realm', - plmn: '[PC preview] unknow plmn', - eapSubId: '[PC preview] unknow eapSubId', - } - - const WifiDeviceConfig = { - ssid: '[PC preview] unknow ssid', - bssid: '[PC preview] unknow bssid', - preSharedKey: '[PC preview] unknow preSharedKey', - isHiddenSsid: '[PC preview] unknow isHiddenSsid', - securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN, - creatorUid: '[PC preview] unknow creatorUid', - disableReason: '[PC preview] unknow disableReason', - netId: '[PC preview] unknow netId', - randomMacType: '[PC preview] unknow randomMacType', - randomMacAddr: '[PC preview] unknow randomMacAddr', - ipType: IpType.DHCP, - staticIp: IpConfig, - eapConfig: WifiEapConfig, - } - - const WifiHotspotConfig = { - ssid: '[PC preview] unknow ssid', - securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN, - band: '[PC preview] unknow band', - preSharedKey: '[PC preview] unknow preSharedKey', - maxConn: '[PC preview] unknow maxConn', - } - - const WifiStationInfo = { - name: '[PC preview] unknow name', - macAddress: '[PC preview] unknow macAddress', - ipAddress: '[PC preview] unknow ipAddress', - } - - const P2pLinkedInfo = { - connectState: P2pConnectState.DISCONNECTED, - isGroupOwner: '[PC preview] unknow isGroupOwner', - groupOwnerAddr: '[PC preview] unknow groupOwnerAddr', - } - - const WifiP2pDevice = { - deviceName: '[PC preview] unknow deviceName', - deviceAddress: '[PC preview] unknow deviceAddress', - primaryDeviceType: '[PC preview] unknow primaryDeviceType', - deviceStatus: P2pDeviceStatus.UNAVAILABLE, - groupCapabilitys: '[PC preview] unknow groupCapabilitys', - } - - const P2pGroupInfo = { - isP2pGo: '[PC preview] unknow connectState', - ownerInfo: WifiP2pDevice, - passphrase: '[PC preview] unknow passphrase', - interface: '[PC preview] unknow interface', - groupName: '[PC preview] unknow groupName', - networkId: '[PC preview] unknow networkId', - frequency: '[PC preview] unknow frequency', - clientDevices: [WifiP2pDevice], - goIpAddress: '[PC preview] unknow goIpAddress', - } - - const wifi = { - enableWifi: function (...args) { - console.warn("wifi.enableWifi interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - disableWifi: function (...args) { - console.warn("wifi.disableWifi interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isWifiActive: function (...args) { - console.warn("wifi.isWifiActive interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - scan: function (...args) { - console.warn("wifi.scan interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getScanInfos: function (...args) { - console.warn("wifi.getScanInfos 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, [WifiScanInfo]) - } else { - return new Promise((resolve) => { - resolve([WifiScanInfo]) - }) - } - }, - - getScanInfosSync: function (...args) { - console.warn("wifi.getScanInfosSync interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [WifiScanInfo]; - }, - - addDeviceConfig: function (...args) { - console.warn("wifi.addDeviceConfig 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - - addUntrustedConfig: function (...args) { - console.warn("wifi.addUntrustedConfig 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) - }) - } - }, - - removeUntrustedConfig: function (...args) { - console.warn("wifi.removeUntrustedConfig 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) - }) - } - }, - - addCandidateConfig: function (...args) { - console.warn("wifi.addCandidateConfig 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - - removeCandidateConfig: function (...args) { - console.warn("wifi.removeCandidateConfig 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - - getCandidateConfigs: function (...args) { - console.warn("wifi.getCandidateConfigs interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [WifiDeviceConfig]; - }, - - connectToCandidateConfig: function (...args) { - console.warn("wifi.connectToCandidateConfig interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return; - }, - - connectToNetwork: function (...args) { - console.warn("wifi.connectToNetwork interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - connectToDevice: function (...args) { - console.warn("wifi.connectToDevice interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - disconnect: function (...args) { - console.warn("wifi.disconnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getSignalLevel: function (...args) { - console.warn("wifi.getSignalLevel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getLinkedInfo: function (...args) { - console.warn("wifi.getLinkedInfo 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, WifiLinkedInfo) - } else { - return new Promise((resolve) => { - resolve(WifiLinkedInfo) - }) - } - }, - - isConnected: function (...args) { - console.warn("wifi.isConnected interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getSupportedFeatures: function (...args) { - console.warn("wifi.getSupportedFeatures interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - isFeatureSupported: function (...args) { - console.warn("wifi.isFeatureSupported interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getDeviceMacAddress: function (...args) { - console.warn("wifi.getDeviceMacAddress interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [paramMock.paramArrayMock]; - }, - - getIpInfo: function (...args) { - console.warn("wifi.getIpInfo interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return IpInfo; - }, - - getCountryCode: function (...args) { - console.warn("wifi.getCountryCode interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - - reassociate: function (...args) { - console.warn("wifi.reassociate interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - reconnect: function (...args) { - console.warn("wifi.reconnect interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getDeviceConfigs: function (...args) { - console.warn("wifi.getDeviceConfigs interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [WifiDeviceConfig]; - }, - - updateNetwork: function (...args) { - console.warn("wifi.updateNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - disableNetwork: function (...args) { - console.warn("wifi.disableNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - removeAllNetwork: function (...args) { - console.warn("wifi.removeAllNetwork interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - removeDevice: function (...args) { - console.warn("wifi.removeDevice interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - enableHotspot: function (...args) { - console.warn("wifi.enableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - disableHotspot: function (...args) { - console.warn("wifi.disableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isHotspotDualBandSupported: function (...args) { - console.warn("wifi.isHotspotDualBandSupported interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isHotspotActive: function (...args) { - console.warn("wifi.isHotspotActive interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - setHotspotConfig: function (...args) { - console.warn("wifi.setHotspotConfig interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getHotspotConfig: function (...args) { - console.warn("wifi.getHotspotConfig interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return WifiHotspotConfig; - }, - - getStations: function (...args) { - console.warn("wifi.getStations interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return [WifiStationInfo]; - }, - - on: function (...args) { - console.warn("wifi.on interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - - off: function (...args) { - console.warn("wifi.off interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - }, - - getP2pLinkedInfo: function (...args) { - console.warn("wifi.getP2pLinkedInfo 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, P2pLinkedInfo) - } else { - return new Promise((resolve) => { - resolve(P2pLinkedInfo) - }) - } - }, - - getCurrentGroup: function (...args) { - console.warn("wifi.getCurrentGroup 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, P2pGroupInfo) - } else { - return new Promise((resolve) => { - resolve(P2pGroupInfo) - }) - } - }, - - getP2pPeerDevices: function (...args) { - console.warn("wifi.getP2pPeerDevices 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, [WifiP2pDevice]) - } else { - return new Promise((resolve) => { - resolve([WifiP2pDevice]) - }) - } - }, - - getP2pLocalDevice: function (...args) { - console.warn("wifi.getP2pLocalDevice 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, WifiP2pDevice) - } else { - return new Promise((resolve) => { - resolve(WifiP2pDevice) - }) - } - }, - - createGroup: function (...args) { - console.warn("wifi.createGroup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - removeGroup: function (...args) { - console.warn("wifi.removeGroup interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - p2pConnect: function (...args) { - console.warn("wifi.p2pConnect interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - p2pCancelConnect: function (...args) { - console.warn("wifi.p2pCancelConnect interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - startDiscoverDevices: function (...args) { - console.warn("wifi.startDiscoverDevices interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - stopDiscoverDevices: function (...args) { - console.warn("wifi.stopDiscoverDevices interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - deletePersistentGroup: function (...args) { - console.warn("wifi.deletePersistentGroup interface mocked in the Previewer. " + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getP2pGroups: function (...args) { - console.warn("wifi.getP2pGroups 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, [P2pGroupInfo]) - } else { - return new Promise((resolve) => { - resolve([P2pGroupInfo]) - }) - } - }, - - setDeviceName: function (...args) { - console.warn("wifi.setDeviceName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - } - return wifi; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_wifiext.js b/runtime/main/extend/systemplugin/napi/ohos_wifiext.js deleted file mode 100644 index 2a4c71d5..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_wifiext.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 mockWifiExt() { - const PowerModel = { - SLEEPING : 0, - GENERAL : 1, - THROUGH_WALL : 2, - } - - const wifiext = { - enableHotspot: function (...args) { - console.warn("wifiext.enableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - disableHotspot: function (...args) { - console.warn("wifiext.disableHotspot interface mocked in the Previewer." + - " How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - getSupportedPowerModel: function (...args) { - console.warn("wifiext.getSupportedPowerModel 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, [PowerModel.GENERAL]) - } else { - return new Promise((resolve) => { - resolve([PowerModel.GENERAL]) - }) - } - }, - - getPowerModel: function (...args) { - console.warn("wifiext.getPowerModel 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, PowerModel.GENERAL) - } else { - return new Promise((resolve) => { - resolve(PowerModel.GENERAL) - }) - } - }, - - setPowerModel: function (...args) { - console.warn("wifiext.setPowerModel interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - } - return wifiext; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_window.js b/runtime/main/extend/systemplugin/napi/ohos_window.js deleted file mode 100644 index c7684fae..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_window.js +++ /dev/null @@ -1,900 +0,0 @@ -/* - * Copyright (c) 2021-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 { PixelMapMock } from "./ohos_multimedia_image" - -export const WindowType = { - TYPE_APP: 0, - TYPE_SYSTEM_ALERT: 1, - TYPE_INPUT_METHOD: 2, - TYPE_STATUS_BAR: 3, - TYPE_PANEL: 4, - TYPE_KEYGUARD: 5, - TYPE_VOLUME_OVERLAY: 6, - TYPE_NAVIGATION_BAR: 7, - TYPE_FLOAT: 8, - TYPE_WALLPAPER: 9, - TYPE_DESKTOP: 10, - TYPE_LAUNCHER_RECENT: 11, - TYPE_LAUNCHER_DOCK: 12, - TYPE_VOICE_INTERACTION: 13, - TYPE_POINTER: 14, - TYPE_FLOAT_CAMERA: 15, - TYPE_DIALOG: 16, - TYPE_SCREENSHOT: 17 -} - -export const AvoidAreaType= { - TYPE_SYSTEM: 0, - TYPE_CUTOUT: 1, - TYPE_SYSTEM_GESTURE: 2, - TYPE_KEYBOARD: 3 -} - -export const Orientation = { - UNSPECIFIED: 0, - PORTRAIT: 1, - LANDSCAPE: 2, - PORTRAIT_INVERTED: 3, - LANDSCAPE_INVERTED: 4, - AUTO_ROTATION: 5, - AUTO_ROTATION_PORTRAIT: 6, - AUTO_ROTATION_LANDSCAPE: 7, - AUTO_ROTATION_RESTRICTED: 8, - AUTO_ROTATION_PORTRAIT_RESTRICTED: 9, - AUTO_ROTATION_LANDSCAPE_RESTRICTED: 10, - LOCKED: 11 -} - - -export const WindowMode= { - UNDEFINED: 1, - FULLSCREEN: 2, - PRIMARY: 3, - SECONDARY: 4, - FLOATING: 5 -} - -export const WindowLayoutMode= { - WINDOW_LAYOUT_MODE_CASCADE: 0, - WINDOW_LAYOUT_MODE_TILE: 1 -} - -export const SystemBarProperties= { - statusBarColor: '[PC preview] unknow statusBarColor', - isStatusBarLightIcon: '[PC preview] unknow isStatusBarLightIcon', - statusBarContentColor: '[PC preview] unknow statusBarContentColor', - navigationBarColor: '[PC preview] unknow navigationBarColor', - isNavigationBarLightIcon: '[PC preview] unknow isNavigationBarLightIcon', - navigationBarContentColor: '[PC preview] unknow navigationBarContentColor' -} - -export const Rect = { - left: '[PC preview] unknow Rect.left', - top: '[PC preview] unknow Rect.top', - width: '[PC preview] unknow Rect.width', - height: '[PC preview] unknow Rect.height' -} - -export const SystemBarRegionTint = { - type: WindowType, - isEnable: '[PC preview] unknow isEnable', - region: Rect, - backgroundColor: '[PC preview] unknow backgroundColor', - contentColor: '[PC preview] unknow contentColor' -} - -export const SystemBarTintState = { - displayId: '[PC preview] unknow brightness', - regionTint:[SystemBarRegionTint] -} - -export const AvoidArea = { - visible: '[PC preview] unknow AvoidArea.visible', - leftRect: Rect, - topRect: Rect, - rightRect: Rect, - bottomRect: Rect -} - -export const Size = { - width: '[PC preview] unknow width', - height: '[PC preview] unknow height' -} - -export const WindowProperties = { - windowRect: '[PC preview] unknow windowRect', - type: '[PC preview] unknow type', - brightness: '[PC preview] unknow brightness', - isTransparent: '[PC preview] unknow isTransparent', - isFullScreen: '[PC preview] unknow isFullScreen', - isKeepScreenOn: '[PC preview] unknow isKeepScreenOn', - dimBehindValue: '[PC preview] unknow dimBehindValue', - isLayoutFullScreen: '[PC preview] unknow isLayoutFullScreen', - focusable: '[PC preview] unknow focusable', - touchable: '[PC preview] unknow touchable', - isPrivacyMode: '[PC preview] unknow isPrivacyMode', - isRoundCorner: '[PC preview] unknow isRoundCorner' -} - -export const ColorSpace = { - DEFAULT: 0, - WIDE_GAMUT: 1 -} - -const TransitionController = { - animationForShown : function(...args) { - console.warn("TransitionController.animationForShown interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - animationForHidden : function(...args) { - console.warn("TransitionController.animationForHidden interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } -} - -const TransitionContext = { - toWindow: Window, - completeTransition : function(...args) { - console.warn("TransitionContext.completeTransition interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } -} - -export const WindowStageEventType = { - FOREGROUND: 1, - ACTIVE: 2, - INACTIVE: 3, - BACKGROUND: 4 -} - -export const WindowStage = { - getMainWindow: function(...args) { - console.warn("WindowStage.getMainWindow 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, Window) - } else { - return new Promise((resolve) => { - resolve(Window) - }) - } - }, - createSubWindow: function(...args) { - console.warn("WindowStage.createSubWindow 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, Window) - } else { - return new Promise((resolve) => { - resolve(Window) - }) - } - }, - getSubWindow: function(...args) { - console.warn("WindowStage.getSubWindow 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, [Window]) - } else { - return new Promise((resolve) => { - resolve([Window]) - }) - } - }, - loadContent: function(...args) { - console.warn("WindowStage.loadContent 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - on: function(...args) { - console.warn("WindowStage.on 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') { - if (args[0] === 'windowStageEvent') { - console.warn(`WindowStage.on you has registered ${args[0]} event`) - } else { - console.warn("WindowStage.on:please check first param!") - } - } else { - console.warn("WindowStage.on:please check param!") - } - }, - off: function(...args) { - console.warn("WindowStage.off 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') { - if (args[0] === 'windowStageEvent') { - console.warn(`you has registered ${args[0]} event`) - }else { - console.warn("WindowStage.off:please check first param!") - } - }else { - console.warn("WindowStage.off:please check param!") - } - }, - disableWindowDecor: function() { - console.warn("WindowStage.disableWindowDecor interface mocked in the Previewer. How this interface works on the Previewer" + - "may be different from that on a real device.") - }, - setShowOnLockScreen: function() { - console.warn("WindowStage.setShowOnLockScreen interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } -} - -export const Window = { - setBrightness: function(...args) { - console.warn("Window.setBrightness 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setBackgroundColor: function(...args) { - console.warn("Window.setBackgroundColor 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setTransparent: function(...args) { - console.warn("Window.setTransparent 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setFullScreen: function(...args) { - console.warn("Window.setFullScreen 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setKeepScreenOn: function(...args) { - console.warn("Window.setKeepScreenOn 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setWakeUpScreen: function(...args) { - console.warn("Window.setWakeUpScreen interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setDimBehind: function(...args) { - console.warn("Window.setDimBehind 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setLayoutFullScreen: function(...args) { - console.warn("Window.setLayoutFullScreen 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setFocusable: function(...args) { - console.warn("Window.setFocusable 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setTouchable: function(...args) { - console.warn("Window.setTouchable 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setPrivacyMode: function(...args) { - console.warn("Window.setPrivacyMode 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setSnapshotSkip: function(...args) { - console.warn("Window.setSnapshotSkip interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setSystemBarEnable: function(...args) { - console.warn("Window.setSystemBarEnable 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setSystemBarProperties: function(...args) { - console.warn("Window.setSystemBarProperties 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setPreferredOrientation: function(...args) { - console.warn("Window.setPreferredOrientation 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,Orientation) - } else { - return new Promise((resolve) => { - resolve(Orientation) - }) - } - }, - setForbidSplitMove: function(...args) { - console.warn("Window.setForbidSplitMove 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - getProperties: function(...args) { - console.warn("Window.getProperties 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, WindowProperties) - } else { - return new Promise((resolve) => { - resolve(WindowProperties) - }) - } - }, - getAvoidArea: function(...args) { - console.warn("Window.getAvoidArea 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, AvoidArea) - } else { - return new Promise((resolve) => { - resolve(AvoidArea) - }) - } - }, - moveTo: function(...args) { - console.warn("Window.moveTo 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - resetSize: function(...args) { - console.warn("Window.resetSize 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setWindowType: function(...args) { - console.warn("Window.setWindowType 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - loadContent: function(...args) { - console.warn("Window.loadContent 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - hide: function(...args) { - console.warn("Window.hide 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - hideWithAnimation: function(...args) { - console.warn("Window.hideWithAnimation 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - show: function(...args) { - console.warn("Window.show 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - showWithAnimation: function(...args) { - console.warn("Window.showWithAnimation 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isShowing: function(...args) { - console.warn("Window.isShowing 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) - }) - } - }, - destroy: function(...args) { - console.warn("Window.destroy 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setOutsideTouchable: function(...args) { - console.warn("Window.setOutsideTouchable 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - on: function(...args) { - console.warn("Window.on 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') { - if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' - || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' - ){ - console.warn(`Window.on you has registered ${args[0]} event`) - } else { - console.warn("Window.on please check first param!") - } - } else { - console.warn("Window.on please check param!") - } - }, - off: function(...args) { - console.warn("Window.off 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') { - if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' - || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' - ){ - console.warn(`Window.off you has registered ${args[0]} event`) - } else { - console.warn("Window.off please check first param!") - } - } else { - console.warn("Window.off please check param!") - } - }, - setColorSpace: function(...args) { - console.warn("Window.setColorSpace 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - getColorSpace: function(...args) { - console.warn("Window.getColorSpace 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - isSupportWideGamut: function(...args) { - console.warn("Window.isSupportWideGamut 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) - }) - } - }, - snapshot: function (...args) { - console.warn("Window.snapshot 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, PixelMapMock) - } else { - return new Promise((resolve, reject) => { - resolve(PixelMapMock) - }) - } - }, - bindDialogTarget: function(...args) { - console.warn("Window.bindDialogTarget 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 - /* 参数带有function,需特殊判断,原型如下 */ - /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback): Promise; */ - /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback, callback: AsyncCallback); */ - if (typeof args[len - 2] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setBlur: function() { - console.warn("Window.setBlur interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setBackdropBlur: function() { - console.warn("Window.setBackdropBlur interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setBackdropBlurStyle: function() { - console.warn("Window.setBackdropBlurStyle interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setShadow: function() { - console.warn("Window.setShadow interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - setCornerRadius: function() { - console.warn("Window.setCornerRadius interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - opacity: function(...args) { - console.warn("Window.opacity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - scale: function(...args) { - console.warn("Window.scale interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - rotate: function(...args) { - console.warn("Window.rotate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - translate: function(...args) { - console.warn("Window.translate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getTransitionController: function() { - console.warn("Window.getTransitionController interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return TransitionController; - } -} - -export const windowMock = Window - -export function mockWindow() { - const ScaleOptions = { - x: '[PC preview] unknow x', - y: '[PC preview] unknow y', - pivotX: '[PC preview] unknow pivotX', - pivotY: '[PC preview] unknow pivotY' - } - - const RotateOptions = { - x: '[PC preview] unknow x', - y: '[PC preview] unknow y', - z: '[PC preview] unknow z', - pivotX: '[PC preview] unknow pivotX', - pivotY: '[PC preview] unknow pivotY' - } - - const TranslateOptions = { - x: '[PC preview] unknow x', - y: '[PC preview] unknow y', - z: '[PC preview] unknow z' - } - - const window = { - BlurStyle: { - OFF: 0, - THIN: 1, - REGULAR: 2, - THICK: 3 - }, - getTopWindow: function(...args) { - console.warn("Window.getTopWindow 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, Window) - } else { - return new Promise((resolve) => { - resolve(Window) - }) - } - }, - create: function(...args) { - console.warn("Window.create 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, Window) - } else { - return new Promise((resolve) => { - resolve(Window) - }) - } - }, - find: function(...args) { - console.warn("Window.find 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, Window) - } else { - return new Promise((resolve) => { - resolve(Window) - }) - } - }, - isFloatingAbilityWindowVisible: function(...args) { - console.warn("Window.isFloatingAbilityWindowVisible 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) - }) - } - }, - setSplitBarVisibility: function(...args) { - console.warn("Window.setSplitBarVisibility 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - minimizeAll: function(...args) { - console.warn("Window.minimizeAll 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - toggleShownStateForAllAppWindows: function(...args) { - console.warn("Window.toggleShownStateForAllAppWindows 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - setWindowLayoutMode: function(...args) { - console.warn("Window.setWindowLayoutMode 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - on: function(...args) { - console.warn("Window.on 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') { - if (args[0] === 'systemBarTintChange') { - console.warn(`Window.on you has registered ${args[0]} event`) - } else { - console.warn("Window.on please check first param!") - } - } else { - console.warn("Window.on please check param!") - } - }, - off: function(...args) { - console.warn("Window.off 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') { - if (args[0] === 'systemBarTintChange') { - console.warn(`Window.off you has registered ${args[0]} event`) - } else { - console.warn("Window.off please check first param!") - } - } else { - console.warn("Window.off please check param!") - } - }, - WindowType, - AvoidAreaType, - WindowMode, - WindowLayoutMode, - SystemBarProperties, - SystemBarRegionTint, - SystemBarTintState, - Rect, - AvoidArea, - Size, - WindowProperties, - ColorSpace, - ScaleOptions, - RotateOptions, - TranslateOptions, - TransitionContext, - TransitionController, - WindowStageEventType, - WindowStage - } - return window -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_workScheduler.js b/runtime/main/extend/systemplugin/napi/ohos_workScheduler.js deleted file mode 100644 index e0cfa2fd..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_workScheduler.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 mockWorkScheduler() { - const WorkInfo = { - workId: '[PC preview] unknown workId', - bundleName: '[PC preview] unknown bundleName', - abilityName: '[PC preview] unknown abilityName', - isPersisted: '[PC preview] unknown isPersisted', - networkType: '[PC preview] unknown networkType', - isCharging: '[PC preview] unknown isCharging', - chargerType: '[PC preview] unknown chargerType', - batteryLevel: '[PC preview] unknown batteryLevel', - batteryStatus: '[PC preview] unknown batteryStatus', - storageRequest: '[PC preview] unknown storageRequest', - repeatCycleTime: '[PC preview] unknown repeatCycleTime', - isRepeat: '[PC preview] unknown isRepeat', - repeatCount: '[PC preview] unknown repeatCount', - isDeepIdle: '[PC preview] unknown isDeepIdle', - idleWaitTime: '[PC preview] unknown idleWaitTime', - parameters: {"key": "unknown any"}, - }; - const WorkInfoArray = [WorkInfo] - const workScheduler = { - NetworkType : { - NETWORK_TYPE_ANY: 0, - NETWORK_TYPE_MOBILE: 1, - NETWORK_TYPE_WIFI: 2, - NETWORK_TYPE_BLUETOOTH: 3, - NETWORK_TYPE_WIFI_P2P: 4, - NETWORK_TYPE_ETHERNET: 5, - }, - ChargingType : { - CHARGING_PLUGGED_ANY: 0, - CHARGING_PLUGGED_AC: 1, - CHARGING_PLUGGED_USB: 2, - CHARGING_PLUGGED_WIRELESS: 3, - }, - BatteryStatus : { - BATTERY_STATUS_LOW: 0, - BATTERY_STATUS_OKAY: 1, - BATTERY_STATUS_LOW_OR_OKAY: 2, - }, - StorageRequest : { - STORAGE_LEVEL_LOW: 0, - STORAGE_LEVEL_OKAY: 1, - STORAGE_LEVEL_LOW_OR_OKAY: 2, - }, - startWork: function (...args) { - console.warn("workScheduler.startWork interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - stopWork: function (...args) { - console.warn("workScheduler.stopWork interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getWorkStatus: function (...args) { - console.warn("workScheduler.getWorkStatus 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, WorkInfo) - } else { - return new Promise(resolve => { - resolve(WorkInfo); - }) - } - }, - obtainAllWorks: function (...args) { - console.warn("workScheduler.obtainAllWorks 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, WorkInfoArray) - } else { - return new Promise(resolve => { - resolve(WorkInfoArray); - }) - } - }, - stopAndClearWorks: function (...args) { - console.warn("workScheduler.stopAndClearWorks interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isLastWorkTimeOut: function (...args) { - console.warn("workScheduler.isLastWorkTimeOut 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); - }) - } - } - } - return workScheduler; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/ohos_worker.js b/runtime/main/extend/systemplugin/napi/ohos_worker.js deleted file mode 100644 index f4a06d4e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_worker.js +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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 mockWorker() { - const WorkerOptionsMock = { - type: '[PC preview] unknow type', - name: '[PC preview] unknow name', - shared: '[PC preview] unknow shared' - }; - - const EventMock = { - type: '[PC preview] unknow type', - timeStamp: '[PC preview] unknow timeStamp' - }; - - const ErrorEventMock = { - message: '[PC preview] unknow message', - filename: '[PC preview] unknow filename', - lineno: '[PC preview] unknow lineno', - colno: '[PC preview] unknow colno', - error: '[PC preview] unknow error' - }; - - const MessageEventMock = { - data: '[PC preview] unknow data' - }; - - const PostMessageOptionsMock = { - transfer:'[PC preview] unknow transfer' - }; - - const EventTargetMock = { - addEventListener : function (...args) { - console.warn('PostMessageOptions.addEventListener interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - }, - dispatchEvent : function (...args) { - console.warn('PostMessageOptions.dispatchEvent interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - return paramMock.paramBooleanMock; - }, - removeEventListener : function (...args) { - console.warn("PostMessageOptions.removeEventListener interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - removeAllListener : function (...args) { - console.warn("PostMessageOptions.removeAllListener interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - } - }; - - const WorkerGlobalScopeMock = { - name: '[PC preview] unknow name', - onerror: function (...args) { - console.warn("WorkerGlobalScope.onerror interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - self: '[PC preview] unknow self' - }; - - const DedicatedWorkerGlobalScopeMock = { - onmessage: function (...args) { - console.warn("DedicatedWorkerGlobalScope.onmessage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - onmessageerror: function (...args) { - console.warn("DedicatedWorkerGlobalScope.onmessageerror interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - close : function (...args) { - console.warn("DedicatedWorkerGlobalScope.close interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - postMessage : function (...args) { - console.warn("DedicatedWorkerGlobalScope.postMessage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }, - postMessage : function (...args) { - console.warn("DedicatedWorkerGlobalScope.postMessage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - } - }; - - const WorkerClass = class Worker { - constructor(...args){ - console.warn('Worker.constructor interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - this.postMessage = function (...args) { - console.warn("Worker.postMessage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.terminate = function (...args) { - console.warn("Worker.terminate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.on = function (...args) { - console.warn("Worker.on interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.once = function (...args) { - console.warn("Worker.once interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.off = function (...args) { - console.warn("Worker.off interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.addEventListener = function (...args) { - console.warn("Worker.addEventListener interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }; - this.dispatchEvent = function (...args) { - console.warn("Worker.dispatchEvent interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - return paramMock.paramBooleanMock; - }; - this.removeEventListener = function (...args) { - console.warn("Worker.removeEventListener interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }; - this.removeAllListener = function (...args) { - console.warn("Worker.removeAllListener interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }; - this.onmessage = function (...args) { - console.warn("Worker.onmessage interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.onmessageerror = function (...agrs) { - console.warn("Worker.onmessageerror interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device."); - }; - this.onerror = function (...args) { - console.warn("Worker.onerror interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.onclose = function (...args) { - console.warn("Worker.onclose interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.onexit = function (...args) { - console.warn("Worker.onexit interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - } - } - }; - - const workerMock = { - Worker : WorkerClass, - parentPort : '[PC preview] unknow parentPort' - }; - return workerMock; -} - diff --git a/runtime/main/extend/systemplugin/napi/ohos_xml.js b/runtime/main/extend/systemplugin/napi/ohos_xml.js deleted file mode 100644 index 772d814e..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_xml.js +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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 mockXml() { - const XmlSerializerClass = class XmlSerializer { - constructor(...args) { - console.warn("XmlSerializer.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.setAttributes = function (...args) { - console.warn("XmlSerializer.setAttributes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.addEmptyElement = function (...args) { - console.warn("XmlSerializer.addEmptyElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setDeclaration = function (...args) { - console.warn("XmlSerializer.setDeclaration interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.startElement = function (...args) { - console.warn("XmlSerializer.startElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.endElement = function (...args) { - console.warn("XmlSerializer.endElement interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setNamespace = function (...args) { - console.warn("XmlSerializer.setNamespace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setComment = function (...args) { - console.warn("XmlSerializer.setCommnet interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setCData = function (...args) { - console.warn("XmlSerializer.setCData interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setText = function (...args) { - console.warn("XmlSerializer.setText interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - }; - this.setDocType = function (...args) { - console.warn("XmlSerializer.setDocType interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - } - } - }; - - const XmlPullParserClass = class XmlPullParser { - constructor(...args) { - console.warn("XmlPullParser.constructor interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - this.parse = function (...args) { - console.warn("XmlPullParser.parse interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device."); - } - } - }; - - const xmlMock = { - XmlSerializer : XmlSerializerClass, - XmlPullParser : XmlPullParserClass, - - EventType : { - START_DOCUMENT: 0, - END_DOCUMENT: 1, - START_TAG: 2, - END_TAG: 3, - TEXT: 4, - CDSECT: 5, - COMMENT: 6, - DOCDECL: 7, - INSTRUCTION: 8, - ENTITY_REFERENCE: 9, - WHITESPACE: 10 - } - }; - - const ParseInfoMock = { - getColumnNumber: function () { - console.warn("ParseInfo.getColumnNumber interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getDepth: function () { - console.warn("ParseInfo.getDepth interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getLineNumber: function () { - console.warn("ParseInfo.getLineNumber interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getName: function () { - console.warn("ParseInfo.getName interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getNamespace: function () { - console.warn("ParseInfo.getNamespace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getPrefix: function () { - console.warn("ParseInfo.getPrefix interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getText: function () { - console.warn("ParseInfo.getText interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramStringMock; - }, - isEmptyElementTag: function () { - console.warn("ParseInfo.isEmptyElementTag interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isWhitespace: function () { - console.warn("ParseInfo.isWhitespace interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getAttributeCount: function () { - console.warn("ParseInfo.getAttributeCount interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - } - }; - - const ParseOptionsMock = { - supportDoctype: '[PC preview] unknow supportDoctype', - ignoreNameSpace: '[PC preview] unknow ignoreNameSpace', - tagValueCallbackFunction: function(...args) { - console.warn("ParseOptions.tagValueCallbackFunction interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - attributeValueCallbackFunction: function(...args) { - console.warn("ParseOptions.attributeValueCallbackFunction interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - tokenValueCallbackFunction: function(...args) { - console.warn("ParseOptions.tokenValueCallbackFunction interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return paramMock.paramNumberMock; - } - }; - return xmlMock; -} diff --git a/runtime/main/extend/systemplugin/napi/ohos_zlib.js b/runtime/main/extend/systemplugin/napi/ohos_zlib.js deleted file mode 100644 index d0a632c1..00000000 --- a/runtime/main/extend/systemplugin/napi/ohos_zlib.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021-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 MemLevel = { - MEM_LEVEL_MIN: 1, - MEM_LEVEL_MAX: 9, - MEM_LEVEL_DEFAULT: 8 -}; -export const ErrorCode = { - 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 -}; -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 -}; -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: 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; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/system_cipher.js b/runtime/main/extend/systemplugin/napi/system_cipher.js deleted file mode 100644 index e8d08809..00000000 --- a/runtime/main/extend/systemplugin/napi/system_cipher.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "../utils" - -export function mockCipher() { - - const CipherResponse = { - text: '[PC preview] unknow text', - } - const CipherRsaOptions = { - action: '[PC preview] unknow action', - text: '[PC preview] unknow text', - key: '[PC preview] unknow key', - transformation: '[PC preview] unknow ransformation', - success: '[PC preview] unknow success', - fail: '[PC preview] unknow fail', - complete: '[PC preview] unknow complete', - } - const CipherAesOptions = { - action: '[PC preview] unknow action', - text: '[PC preview] unknow text', - key: '[PC preview] unknow key', - transformation: '[PC preview] unknow transformation', - iv: '[PC preview] unknow iv', - ivOffset: '[PC preview] unknow ivOffset', - ivLen: '[PC preview] unknow ivLen', - success: '[PC preview] unknow success', - fail: '[PC preview] unknow fail', - complete: '[PC preview] unknow complete', - } - const Cipher = { - rsa: function (...args) { - console.warn("cipher.rsa interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const result = '[PC preview] rsa xxxxxxxxxxxxx' - args[0].success(result) - hasComplete(args[0].complete) - }, - aes: function (...args) { - console.warn("cipher.aes interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const result = '[PC preview] aes xxxxxxxxxxxxx' - args[0].success(result) - hasComplete(args[0].complete) - }, - } - return cipher -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/system_file.js b/runtime/main/extend/systemplugin/napi/system_file.js deleted file mode 100644 index a89f98cc..00000000 --- a/runtime/main/extend/systemplugin/napi/system_file.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "../utils" - -export function mockFile() { - const file = { - move: function (...args) { - console.warn("file.move interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success(args[0].dstUri) - hasComplete(args[0].complete) - }, - copy: function (...args) { - console.warn("file.copy interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success(args[0].dstUri) - hasComplete(args[0].complete) - }, - list: function (...args) { - console.warn("file.list interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const data = { - fileList: [{ - uri: '[PC Preview]: no file', - lastModifiedTime: "[PC Preview]: no file", - length: "[PC Preview]: no file", - type: 'file' - }] - } - args[0].success(data) - hasComplete(args[0].complete) - }, - get: function (...args) { - console.warn("file.get interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - const data = { - uri: '[PC Preview]: no file', - lastModifiedTime: "[PC Preview]: no file", - length: "[PC Preview]: no file", - type: 'file', - subFiles: ["[PC Preview]: no file", "[PC Preview]: no file"] - } - args[0].success(data) - hasComplete(args[0].complete) - }, - delete: function (...args) { - console.warn("file.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - writeText: function (...args) { - console.warn("file.writeText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - writeArrayBuffer: function (...args) { - console.warn("file.writeArrayBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - readText: function (...args) { - console.warn("file.readText interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - const data = { text: "[PC Preview]: success default" } - args[0].success(data) - hasComplete(args[0].complete) - }, - readArrayBuffer: function (...args) { - console.warn("file.readArrayBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const data = { buffer: ["[PC Preview]: default", "[PC Preview]: default", "[PC Preview]: default"] } - args[0].success(data) - hasComplete(args[0].complete) - }, - access: function (...args) { - console.warn("file.access interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - mkdir: function (...args) { - console.warn("file.mkdir interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - }, - rmdir: function (...args) { - console.warn("file.rmdir interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - } - } - return file -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/system_storage.js b/runtime/main/extend/systemplugin/napi/system_storage.js deleted file mode 100644 index c58d7f51..00000000 --- a/runtime/main/extend/systemplugin/napi/system_storage.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2021 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 mockStorage() { - const storageMock = { - getStorageSync: function (...args) { - console.warn("Storage.getStorageSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storage; - }, - getStorage: function (...args) { - console.warn("Storage.getStorage 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, storage); - } else { - return new Promise((resolve, reject) => { - resolve(storage); - }) - } - }, - deleteStorageSync: function (...args) { - console.warn("Storage.deleteStorageSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteStorage: function (...args) { - console.warn("Storage.deleteStorage 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeStorageFromCacheSync: function (...args) { - console.warn("Storage.removeStorageFromCacheSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - removeStorageFromCache: function (...args) { - console.warn("Storage.removeStorageFromCache 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - }; - const storageObserver = { - key: "[PC Preview] unknown key", - }; - const storage = { - getSync: function (...args) { - console.warn("Storage.getSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - get: function (...args) { - console.warn("Storage.get 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, paramMock.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hasSync: function (...args) { - console.warn("Storage.hasSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - has: function (...args) { - console.warn("Storage.has 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, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - putSync: function (...args) { - console.warn("Storage.putSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - put: function (...args) { - console.warn("Storage.put 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - deleteSync: function (...args) { - console.warn("Storage.deleteSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - delete: function (...args) { - console.warn("Storage.delete 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - clearSync: function (...args) { - console.warn("Storage.clearSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clear: function (...args) { - console.warn("Storage.clear 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - flushSync: function (...args) { - console.warn("Storage.flushSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - flush: function (...args) { - console.warn("Storage.flush 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("Storage.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storageObserver; - }, - off: function (...args) { - console.warn("Storage.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return storageObserver; - }, - }; - return storageMock; -} - diff --git a/runtime/main/extend/systemplugin/napi/tv.js b/runtime/main/extend/systemplugin/napi/tv.js deleted file mode 100644 index 9f123479..00000000 --- a/runtime/main/extend/systemplugin/napi/tv.js +++ /dev/null @@ -1,2494 +0,0 @@ -/* - * Copyright (c) 2021 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 mockTv() { - const SoundStereos = { - STEREO_STEREO: "[PC Preview] unknow STEREO_STEREO", - STEREO_MONO: "[PC Preview] unknow STEREO_MONO", - STEREO_DOUBLE_LEFT: "[PC Preview] unknow STEREO_DOUBLE_LEFT", - STEREO_DOUBLE_RIGHT: "[PC Preview] unknow STEREO_DOUBLE_RIGHT", - STEREO_EXCHANGE: "[PC Preview] unknow STEREO_EXCHANGE", - STEREO_ONLY_RIGHT: "[PC Preview] unknow STEREO_ONLY_RIGHT", - STEREO_ONLY_LEFT: "[PC Preview] unknow STEREO_ONLY_LEFT", - STEREO_MUTED: "[PC Preview] unknow STEREO_MUTED" - } - const SoundSpdifs = { - SPDIF_PCM: "[PC Preview] unknow SPDIF_PCM", - SPDIF_RAW: "[PC Preview] unknow SPDIF_RAW", - SPDIF_AUTO: "[PC Preview] unknow SPDIF_AUTO" - } - const SoundArcModes = { - ARC_AUDIO_MODE_LPCM: "[PC Preview] unknow ARC_AUDIO_MODE_LPCM", - ARC_AUDIO_MODE_RAW: "[PC Preview] unknow ARC_AUDIO_MODE_RAW", - ARC_AUDIO_MODE_LEGACY: "[PC Preview] unknow ARC_AUDIO_MODE_LEGACY", - ARC_AUDIO_MODE_AUTO: "[PC Preview] unknow ARC_AUDIO_MODE_AUTO" - } - const AudioStreamInfo = { - type: "[PC Preview] unknow type", - value: "[PC Preview] unknow value" - } - const AudioGainAttr = { - isLinearMode: "[PC Preview] unknow isLinearMode", - gain: "[PC Preview] unknow gain" - } - const HistenSoundModes = { - HISTEN_SNDMODE_MUSIC: "[PC Preview] unknow HISTEN_SNDMODE_MUSIC", - HISTEN_SNDMODE_MOVIE: "[PC Preview] unknow HISTEN_SNDMODE_MOVIE", - HISTEN_SNDMODE_STANDARD: "[PC Preview] unknow HISTEN_SNDMODE_STANDARD", - HISTEN_SNDMODE_SPORTS: "[PC Preview] unknow HISTEN_SNDMODE_SPORTS", - HISTEN_SNDMODE_NEWS: "[PC Preview] unknow HISTEN_SNDMODE_NEWS", - HISTEN_SNDMODE_GAME: "[PC Preview] unknow HISTEN_SNDMODE_GAME", - HISTEN_SNDMODE_AUTO: "[PC Preview] unknow HISTEN_SNDMODE_AUTO", - HISTEN_SNDMODE_DEVIALET: "[PC Preview] unknow HISTEN_SNDMODE_DEVIALET", - HISTEN_SNDMODE_USER: "[PC Preview] unknow HISTEN_SNDMODE_USER" - } - const SoundFields = { - SNDFIELD_DESKTOP: "[PC Preview] unknow SNDFIELD_DESKTOP", - SNDFIELD_HANG: "[PC Preview] unknow SNDFIELD_HANG" - } - const AudioOutDevices = { - DEVICE_NONE: "[PC Preview] unknow DEVICE_NONE", - DEVICE_OUT_SPEAKER: "[PC Preview] unknow DEVICE_OUT_SPEAKER", - DEVICE_OUT_SPDIF: "[PC Preview] unknow DEVICE_OUT_SPDIF", - DEVICE_OUT_HDMI_ARC: "[PC Preview] unknow DEVICE_OUT_HDMI_ARC", - DEVICE_OUT_BLUETOOTH_A2DP: "[PC Preview] unknow DEVICE_OUT_BLUETOOTH_A2DP", - DEVICE_OUT_USB_DEVICE: "[PC Preview] unknow DEVICE_OUT_USB_DEVICE", - DEVICE_OUT_WIFI_SPEAKER: "[PC Preview] unknow DEVICE_OUT_WIFI_SPEAKER" - } - const SourceIndices = { - SOURCE_ATV: "[PC Preview] unknow SOURCE_ATV", - SOURCE_DVBC: "[PC Preview] unknow SOURCE_DVBC", - SOURCE_DTMB: "[PC Preview] unknow SOURCE_DTMB", - SOURCE_CVBS1: "[PC Preview] unknow SOURCE_CVBS1", - SOURCE_CVBS2: "[PC Preview] unknow SOURCE_CVBS2", - SOURCE_CVBS3: "[PC Preview] unknow SOURCE_CVBS3", - SOURCE_VGA: "[PC Preview] unknow SOURCE_VGA", - SOURCE_YPBPR1: "[PC Preview] unknow SOURCE_YPBPR1", - SOURCE_YPBPR2: "[PC Preview] unknow SOURCE_YPBPR2", - SOURCE_HDMI1: "[PC Preview] unknow SOURCE_HDMI1", - SOURCE_HDMI2: "[PC Preview] unknow SOURCE_HDMI2", - SOURCE_HDMI3: "[PC Preview] unknow SOURCE_HDMI3", - SOURCE_HDMI4: "[PC Preview] unknow SOURCE_HDMI4", - SOURCE_MEDIA: "[PC Preview] unknow SOURCE_MEDIA", - SOURCE_MEDIA2: "[PC Preview] unknow SOURCE_MEDIA2", - SOURCE_SCART1: "[PC Preview] unknow SOURCE_SCART1", - SOURCE_SCART2: "[PC Preview] unknow SOURCE_SCART2", - SOURCE_AUTO: "[PC Preview] unknow SOURCE_AUTO", - SOURCE_DVBT: "[PC Preview] unknow SOURCE_DVBT", - SOURCE_ATSC: "[PC Preview] unknow SOURCE_ATSC", - SOURCE_DVBS: "[PC Preview] unknow SOURCE_DVBS", - SOURCE_ISDBT: "[PC Preview] unknow SOURCE_ISDBT", - SOURCE_BUTT: "[PC Preview] unknow SOURCE_BUTT" - } - const TimingInfo = { - width: "[PC Preview] unknow width", - height: "[PC Preview] unknow height", - frame: "[PC Preview] unknow frame", - isInterlace: "[PC Preview] unknow isInterlace", - hdmiFmt: "[PC Preview] unknow hdmiFmt", - threeDimFmt: "[PC Preview] unknow threeDimFmt", - colorSpace: "[PC Preview] unknow colorSpace", - isMhl: "[PC Preview] unknow isMhl" - } - const HdmiCecDeviceInfo = { - hdmiDevPort: "[PC Preview] unknow hdmiDevPort", - logicAddr: "[PC Preview] unknow logicAddr", - devVendId: "[PC Preview] unknow devVendId", - osdName: "[PC Preview] unknow osdName" - } - const PictureClrtmps = { - CLRTMP_NATURE: "[PC Preview] unknow CLRTMP_NATURE", - CLRTMP_COOL: "[PC Preview] unknow CLRTMP_COOL", - CLRTMP_WARM: "[PC Preview] unknow CLRTMP_WARM", - CLRTMP_USER: "[PC Preview] unknow CLRTMP_USER", - CLRTMP_TOCOOL: "[PC Preview] unknow CLRTMP_TOCOOL", - CLRTMP_TOWARM: "[PC Preview] unknow CLRTMP_TOWARM", - CLRTMP_BUTT: "[PC Preview] unknow CLRTMP_BUTT" - } - const PictureLevels = { - LEVEL_OFF: "[PC Preview] unknow LEVEL_OFF", - LEVEL_LOW: "[PC Preview] unknow LEVEL_LOW", - LEVEL_MIDDLE: "[PC Preview] unknow LEVEL_MIDDLE", - LEVEL_HIGH: "[PC Preview] unknow LEVEL_HIGH", - LEVEL_AUTO: "[PC Preview] unknow LEVEL_AUTO" - } - const PictureAspects = { - ASPECT_16_9: "[PC Preview] unknow ASPECT_16_9", - ASPECT_14_9: "[PC Preview] unknow ASPECT_14_9", - ASPECT_4_3: "[PC Preview] unknow ASPECT_4_3", - ASPECT_FULL: "[PC Preview] unknow ASPECT_FULL", - ASPECT_POINT2POINT: "[PC Preview] unknow ASPECT_POINT2POINT", - ASPECT_AUTO: "[PC Preview] unknow ASPECT_AUTO", - ASPECT_SUBTITLE: "[PC Preview] unknow ASPECT_SUBTITLE", - ASPECT_PERSON: "[PC Preview] unknow ASPECT_PERSON", - ASPECT_CINEMA: "[PC Preview] unknow ASPECT_CINEMA", - ASPECT_PANORAMA: "[PC Preview] unknow ASPECT_PANORAMA", - ASPECT_ZOOM: "[PC Preview] unknow ASPECT_ZOOM", - ASPECT_ZOOM1: "[PC Preview] unknow ASPECT_ZOOM1", - ASPECT_ZOOM2: "[PC Preview] unknow ASPECT_ZOOM2", - ASPECT_TRUTH: "[PC Preview] unknow ASPECT_TRUTH", - ASPECT_21_9: "[PC Preview] unknow ASPECT_21_9" - } - const PictureModes = { - PICMODE_VIVID: "[PC Preview] unknow PICMODE_VIVID", - PICMODE_STANDARD: "[PC Preview] unknow PICMODE_STANDARD", - PICMODE_SOFTNESS: "[PC Preview] unknow PICMODE_SOFTNESS", - PICMODE_MOVIE: "[PC Preview] unknow PICMODE_MOVIE", - PICMODE_SPORTS: "[PC Preview] unknow PICMODE_SPORTS", - PICMODE_KID: "[PC Preview] unknow PICMODE_KID", - PICMODE_GAME: "[PC Preview] unknow PICMODE_GAME", - PICMODE_PICTURE: "[PC Preview] unknow PICMODE_PICTURE", - PICMODE_USER: "[PC Preview] unknow PICMODE_USER", - PICMODE_AUTO: "[PC Preview] unknow PICMODE_AUTO", - PICMODE_NATURAL: "[PC Preview] unknow PICMODE_NATURAL", - PICMODE_MASTER: "[PC Preview] unknow PICMODE_MASTER", - PICMODE_DYNAMIC: "[PC Preview] unknow PICMODE_DYNAMIC" - } - const HdmiRanges = { - HDMI_RANGE_AUTO: "[PC Preview] unknow HDMI_RANGE_AUTO", - HDMI_RANGE_COMPLETE: "[PC Preview] unknow HDMI_RANGE_COMPLETE", - HDMI_RANGE_LIMIT: "[PC Preview] unknow HDMI_RANGE_LIMIT" - } - const ColorGamuts = { - COLOR_GAMUT_AUTO: "[PC Preview] unknow COLOR_GAMUT_AUTO", - COLOR_GAMUT_BT2020: "[PC Preview] unknow COLOR_GAMUT_BT2020", - COLOR_GAMUT_P3: "[PC Preview] unknow COLOR_GAMUT_P3", - COLOR_GAMUT_ADOBERGB: "[PC Preview] unknow COLOR_GAMUT_ADOBERGB", - COLOR_GAMUT_BT709: "[PC Preview] unknow COLOR_GAMUT_BT709", - COLOR_GAMUT_BT601_EBU: "[PC Preview] unknow COLOR_GAMUT_BT601_EBU", - COLOR_GAMUT_BT601_SMPTE: "[PC Preview] unknow COLOR_GAMUT_BT601_SMPTE", - COLOR_GAMUT_NATIVE: "[PC Preview] unknow COLOR_GAMUT_NATIVE" - } - const WhitePoints = { - WHITE_POINT_AUTO: "[PC Preview] unknow WHITE_POINT_AUTO", - WHITE_POINT_D50: "[PC Preview] unknow WHITE_POINT_D50", - WHITE_POINT_D60: "[PC Preview] unknow WHITE_POINT_D60", - WHITE_POINT_D63: "[PC Preview] unknow WHITE_POINT_D63", - WHITE_POINT_D65: "[PC Preview] unknow WHITE_POINT_D65", - WHITE_POINT_D93: "[PC Preview] unknow WHITE_POINT_D93", - WHITE_POINT_NATIVE: "[PC Preview] unknow WHITE_POINT_NATIVE" - } - const Oetfs = { - OETF_AUTO: "[PC Preview] unknow OETF_AUTO", - OETF_BT709: "[PC Preview] unknow OETF_BT709", - OETF_SRGB: "[PC Preview] unknow OETF_SRGB", - OETF_22: "[PC Preview] unknow OETF_22", - OETF_24: "[PC Preview] unknow OETF_24", - OETF_26: "[PC Preview] unknow OETF_26", - OETF_BT2084: "[PC Preview] unknow OETF_BT2084", - OETF_HLG: "[PC Preview] unknow OETF_HLG", - OETF_NATIVE: "[PC Preview] unknow OETF_NATIVE" - } - const ColorManagerModes = { - COLOR_MANAGER_AUTO: "[PC Preview] unknow COLOR_MANAGER_AUTO", - COLOR_MANAGER_HDR10: "[PC Preview] unknow COLOR_MANAGER_HDR10", - COLOR_MANAGER_HLG: "[PC Preview] unknow COLOR_MANAGER_HLG", - COLOR_MANAGER_HDTV: "[PC Preview] unknow COLOR_MANAGER_HDTV", - COLOR_MANAGER_SRGB: "[PC Preview] unknow COLOR_MANAGER_SRGB", - COLOR_MANAGER_P3_DCI: "[PC Preview] unknow COLOR_MANAGER_P3_DCI", - COLOR_MANAGER_P3_D65: "[PC Preview] unknow COLOR_MANAGER_P3_D65", - COLOR_MANAGER_P3_D50: "[PC Preview] unknow COLOR_MANAGER_P3_D50", - COLOR_MANAGER_ADOBERGB: "[PC Preview] unknow COLOR_MANAGER_ADOBERGB", - COLOR_MANAGER_EBU: "[PC Preview] unknow COLOR_MANAGER_EBU", - COLOR_MANAGER_SMPTE_C: "[PC Preview] unknow COLOR_MANAGER_SMPTE_C", - COLOR_MANAGER_USER1: "[PC Preview] unknow COLOR_MANAGER_USER1", - COLOR_MANAGER_USER2: "[PC Preview] unknow COLOR_MANAGER_USER2", - COLOR_MANAGER_P3_PG: "[PC Preview] unknow COLOR_MANAGER_P3_PG", - COLOR_MANAGER_CUVA: "[PC Preview] unknow COLOR_MANAGER_CUVA" - } - const PictureUserHdrTypes = { - USER_HDR_TYPE_AUTO: "[PC Preview] unknow USER_HDR_TYPE_AUTO", - USER_HDR_TYPE_CUVA: "[PC Preview] unknow USER_HDR_TYPE_CUVA", - USER_HDR_TYPE_HDR10: "[PC Preview] unknow USER_HDR_TYPE_HDR10", - USER_HDR_TYPE_HLG: "[PC Preview] unknow USER_HDR_TYPE_HLG", - USER_HDR_TYPE_OFF: "[PC Preview] unknow USER_HDR_TYPE_OFF", - USER_HDR_TYPE_BUTT: "[PC Preview] unknow USER_HDR_TYPE_BUTT" - } - const CommonLevels = { - HI_MW_LEVEL_OFF: "[PC Preview] unknow HI_MW_LEVEL_OFF", - HI_MW_LEVEL_LOW: "[PC Preview] unknow HI_MW_LEVEL_LOW", - HI_MW_LEVEL_MID: "[PC Preview] unknow HI_MW_LEVEL_MID", - HI_MW_LEVEL_HIGH: "[PC Preview] unknow HI_MW_LEVEL_HIGH", - HI_MW_LEVEL_AUTO: "[PC Preview] unknow HI_MW_LEVEL_AUTO" - } - const PictureColorTempModes = { - COLOR_TEMP_DEFAULT: "[PC Preview] unknow COLOR_TEMP_DEFAULT", - COLOR_TEMP_NATURAL_TONE: "[PC Preview] unknow COLOR_TEMP_NATURAL_TONE", - COLOR_TEMP_EYE_PROTECT: "[PC Preview] unknow COLOR_TEMP_EYE_PROTECT" - } - const RectInfo = { - x: "[PC Preview] unknow x", - y: "[PC Preview] unknow y", - w: "[PC Preview] unknow w", - h: "[PC Preview] unknow h" - } - const SignalStates = { - SIGSTAT_SUPPORT: "[PC Preview] unknow SIGSTAT_SUPPORT", - SIGSTAT_NOSIGNAL: "[PC Preview] unknow SIGSTAT_NOSIGNAL", - SIGSTAT_UNSUPPORT: "[PC Preview] unknow SIGSTAT_UNSUPPORT", - SIGSTAT_UNSTABLE: "[PC Preview] unknow SIGSTAT_UNSTABLE" - } - const HdmirxEdidTypes = { - HDMIRX_EDID_TYPE_2_0: "[PC Preview] unknow HDMIRX_EDID_TYPE_2_0", - HDMIRX_EDID_TYPE_1_4: "[PC Preview] unknow HDMIRX_EDID_TYPE_1_4", - HDMIRX_EDID_TYPE_AUTO: "[PC Preview] unknow HDMIRX_EDID_TYPE_AUTO" - } - const Wakeup = { - mode: "[PC Preview] unknow mode", - src: "[PC Preview] unknow src", - value: "[PC Preview] unknow value" - } - const result = { - getAudioManager: function () { - console.warn("tv.getAudioManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return AudioManager; - }, - getEventManager: function () { - console.warn("tv.getEventManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return EventManager; - }, - getHdmiCecManager: function () { - console.warn("tv.getHdmiCecManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HdmiCecManager; - }, - getPictureManager: function () { - console.warn("tv.getPictureManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return PictureManager; - }, - getSourceManager: function () { - console.warn("tv.getSourceManager interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return SourceManager; - }, - getSystemSetting: function () { - console.warn("tv.getSystemSetting interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return SystemSetting; - } - } - const AudioManager = { - getMute: function (...args) { - console.warn("AudioManager.getMute 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setMute: function (...args) { - console.warn("AudioManager.setMute 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUsrAudioMute: function (...args) { - console.warn("AudioManager.setUsrAudioMute 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getStereoMode: function (...args) { - console.warn("AudioManager.getStereoMode 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, SoundStereos); - } else { - return new Promise((resolve, reject) => { - resolve(SoundStereos); - }) - } - }, - setStereoMode: function (...args) { - console.warn("AudioManager.setStereoMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableSpdif: function (...args) { - console.warn("AudioManager.enableSpdif 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSpdifEnabled: function (...args) { - console.warn("AudioManager.enableSpdif 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setSpdifMode: function (...args) { - console.warn("AudioManager.enableSpdif 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSpdifMode: function (...args) { - console.warn("AudioManager.getSpdifMode 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, SoundSpdifs); - } else { - return new Promise((resolve, reject) => { - resolve(SoundSpdifs); - }) - } - }, - enableArc: function (...args) { - console.warn("AudioManager.enableArc 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isArcEnabled: function (...args) { - console.warn("AudioManager.isArcEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setArcMode: function (...args) { - console.warn("AudioManager.setArcMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getArcMode: function (...args) { - console.warn("AudioManager.getArcMode 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, SoundArcModes); - } else { - return new Promise((resolve, reject) => { - resolve(SoundArcModes); - }) - } - }, - isArcSupported: function (...args) { - console.warn("AudioManager.isArcSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAdvancedEffectParameter: function (...args) { - console.warn("AudioManager.setAdvancedEffectParameter 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAdvancedEffectParameter: function (...args) { - console.warn("AudioManager.getAdvancedEffectParameter 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAudioStreamInfo: function (...args) { - console.warn("AudioManager.getAudioStreamInfo 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, AudioStreamInfo); - } else { - return new Promise((resolve, reject) => { - resolve(AudioStreamInfo); - }) - } - }, - setTrackWeight: function (...args) { - console.warn("AudioManager.getAdvancedEffectParameter 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTrackWeight: function (...args) { - console.warn("AudioManager.getTrackWeight 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, AudioGainAttr); - } else { - return new Promise((resolve, reject) => { - resolve(AudioGainAttr); - }) - } - }, - getSoundModeList: function (...args) { - console.warn("AudioManager.getSoundModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var histenSoundModesArray = new Array(); - histenSoundModesArray.push(HistenSoundModes); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, histenSoundModesArray); - } else { - return new Promise((resolve, reject) => { - resolve(histenSoundModesArray); - }) - } - }, - setNightMode: function (...args) { - console.warn("AudioManager.setNightMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isNightModeEnabled: function (...args) { - console.warn("AudioManager.isNightModeEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isNightModeSupported: function (...args) { - console.warn("AudioManager.isNightModeSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - soundModeling: function (...args) { - console.warn("AudioManager.soundModeling 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setModelType: function (...args) { - console.warn("AudioManager.setModelType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getModelType: function (...args) { - console.warn("AudioManager.getModelType 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, SoundFields); - } else { - return new Promise((resolve, reject) => { - resolve(SoundFields); - }) - } - }, - startMicRecorder: function (...args) { - console.warn("AudioManager.startMicRecorder 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - stopMicRecorder: function (...args) { - console.warn("AudioManager.stopMicRecorder 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - hasSoundCustomized: function (...args) { - console.warn("AudioManager.stopMicRecorder 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setOutDevice: function (...args) { - console.warn("AudioManager.setOutDevice 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOutDevice: function (...args) { - console.warn("AudioManager.getOutDevice 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, AudioOutDevices); - } else { - return new Promise((resolve, reject) => { - resolve(AudioOutDevices); - }) - } - }, - getHangMode: function (...args) { - console.warn("AudioManager.getHangMode 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, SoundFields); - } else { - return new Promise((resolve, reject) => { - resolve(SoundFields); - }) - } - }, - setHangMode: function (...args) { - console.warn("AudioManager.setHangMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isMicDamaged: function (...args) { - console.warn("AudioManager.isMicDamaged 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isVolAdjustSupported: function (...args) { - console.warn("AudioManager.isVolAdjustSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - recoveryOutDevice: function (...args) { - console.warn("AudioManager.recoveryOutDevice 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVolumeByPid: function (...args) { - console.warn("AudioManager.setVolumeByPid 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenGeqGains: function (...args) { - console.warn("AudioManager.getHistenGeqGains interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - setHistenGeqGain: function (...args) { - console.warn("AudioManager.setHistenGeqGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenVocGain: function (...args) { - console.warn("AudioManager.getHistenVocGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenVocGain: function (...args) { - console.warn("AudioManager.setHistenVocGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenVertSurroundGain: function (...args) { - console.warn("AudioManager.getHistenVertSurroundGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenVertSurroundGain: function (...args) { - console.warn("AudioManager.setHistenVertSurroundGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenHorzSurroundGain: function (...args) { - console.warn("AudioManager.getHistenHorzSurroundGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenHorzSurroundGain: function (...args) { - console.warn("AudioManager.setHistenHorzSurroundGain 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenCustomMode: function (...args) { - console.warn("AudioManager.getHistenCustomMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHistenCustomMode: function (...args) { - console.warn("AudioManager.setHistenCustomMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - resetHistenCustomMode: function (...args) { - console.warn("AudioManager.resetHistenCustomMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHistenCustomModeList: function (...args) { - console.warn("AudioManager.getHistenCustomModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var numberArray = new Array(); - numberArray.push(paramMock.paramNumberMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, numberArray); - } else { - return new Promise((resolve, reject) => { - resolve(numberArray); - }) - } - }, - enableHistenVoip: function (...args) { - console.warn("AudioManager.enableHistenVoip 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isHistenVoipEnabled: function (...args) { - console.warn("AudioManager.isHistenVoipEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - const EventManager = { - on: function (...args) { - console.warn("EventManager.on interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - }, - off: function (...args) { - console.warn("EventManager.off interface mocked in the Previewer. How this interface works on the Previewer may" + - " be different from that on a real device.") - } - } - const HdmiCecManager = { - getUiStatus: function (...args) { - console.warn("HdmiCecManager.getUiStatus 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setUiStatus: function (...args) { - console.warn("HdmiCecManager.setUiStatus 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDeviceList: function (...args) { - console.warn("HdmiCecManager.getDeviceList 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, HdmiCecDeviceInfo); - } else { - return new Promise((resolve, reject) => { - resolve(HdmiCecDeviceInfo); - }) - } - }, - changeSourceToTv: function (...args) { - console.warn("HdmiCecManager.changeSourceToTv 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - sendMenuCommand: function (...args) { - console.warn("HdmiCecManager.sendMenuCommand 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const PictureManager = { - enableAutoPictureMode: function (...args) { - console.warn("PictureManager.enableAutoPictureMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setPictureMode: function (...args) { - console.warn("PictureManager.setPictureMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBrightness: function (...args) { - console.warn("PictureManager.setBrightness 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBrightness: function (...args) { - console.warn("PictureManager.getBrightness 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setContrast: function (...args) { - console.warn("PictureManager.setContrast 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getContrast: function (...args) { - console.warn("PictureManager.getContrast 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSaturation: function (...args) { - console.warn("PictureManager.setSaturation 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSaturation: function (...args) { - console.warn("PictureManager.getSaturation 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setSharpness: function (...args) { - console.warn("PictureManager.setSharpness 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSharpness: function (...args) { - console.warn("PictureManager.getSharpness 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHue: function (...args) { - console.warn("PictureManager.setHue 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHue: function (...args) { - console.warn("PictureManager.getHue 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBacklight: function (...args) { - console.warn("PictureManager.setBacklight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBacklight: function (...args) { - console.warn("PictureManager.getBacklight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBacklightThreshold: function (...args) { - console.warn("PictureManager.setBacklightThreshold 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBacklightThreshold: function (...args) { - console.warn("PictureManager.getBacklightThreshold 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setColorTemp: function (...args) { - console.warn("PictureManager.setColorTemp 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTemp: function (...args) { - console.warn("PictureManager.getColorTemp 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, PictureClrtmps); - } else { - return new Promise((resolve, reject) => { - resolve(PictureClrtmps); - }) - } - }, - setNr: function (...args) { - console.warn("PictureManager.setNr 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNr: function (...args) { - console.warn("PictureManager.getNr 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, PictureLevels); - } else { - return new Promise((resolve, reject) => { - resolve(PictureLevels); - }) - } - }, - setMemcLevel: function (...args) { - console.warn("PictureManager.setMemcLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMemcLevel: function (...args) { - console.warn("PictureManager.getMemcLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableDci: function (...args) { - console.warn("PictureManager.enableDci 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDciEnabled: function (...args) { - console.warn("PictureManager.isDciEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableDynamicBl: function (...args) { - console.warn("PictureManager.enableDynamicBl 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDynamicBlEnabled: function (...args) { - console.warn("PictureManager.isDynamicBlEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setAspect: function (...args) { - console.warn("PictureManager.setAspect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAspect: function (...args) { - console.warn("PictureManager.getAspect 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, PictureAspects); - } else { - return new Promise((resolve, reject) => { - resolve(PictureAspects); - }) - } - }, - enableLocalDimming: function (...args) { - console.warn("PictureManager.enableLocalDimming 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isLocalDimmingEnabled: function (...args) { - console.warn("PictureManager.isLocalDimmingEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isLocalDimmingSupported: function (...args) { - console.warn("PictureManager.isLocalDimmingSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setEyeProtectMode: function (...args) { - console.warn("PictureManager.setEyeProtectMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getEyeProtectMode: function (...args) { - console.warn("PictureManager.getEyeProtectMode 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setVideoInfoStart: function (...args) { - console.warn("PictureManager.setVideoInfoStart 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setVideoInfoStop: function (...args) { - console.warn("PictureManager.setVideoInfoStop 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPictureModeList: function (...args) { - console.warn("PictureManager.getPictureModeList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var pictureModesArray = new Array(); - pictureModesArray.push(PictureModes); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, pictureModesArray); - } else { - return new Promise((resolve, reject) => { - resolve(pictureModesArray); - }) - } - }, - setAutoBlEnable: function (...args) { - console.warn("PictureManager.setAutoBlEnable 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isAutoBacklightEnabled: function (...args) { - console.warn("PictureManager.isAutoBacklightEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setActivityUi: function (...args) { - console.warn("PictureManager.setActivityUi 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDciType: function (...args) { - console.warn("PictureManager.setDciType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDciType: function (...args) { - console.warn("PictureManager.getDciType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setDciGainLevel: function (...args) { - console.warn("PictureManager.setDciGainLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getDciGainLevel: function (...args) { - console.warn("PictureManager.getDciGainLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setUploadBacklight: function (...args) { - console.warn("PictureManager.setUploadBacklight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPictureMode: function (...args) { - console.warn("PictureManager.getPictureMode 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, PictureModes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureModes); - }) - } - }, - enableBacklight: function (...args) { - console.warn("PictureManager.enableBacklight 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isBacklightEnabled: function (...args) { - console.warn("PictureManager.isBacklightEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setHdmiRange: function (...args) { - console.warn("PictureManager.setHdmiRange 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHdmiRange: function (...args) { - console.warn("PictureManager.getHdmiRange 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, HdmiRanges); - } else { - return new Promise((resolve, reject) => { - resolve(HdmiRanges); - }) - } - }, - setColorGamut: function (...args) { - console.warn("PictureManager.setColorGamut 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorGamut: function (...args) { - console.warn("PictureManager.getColorGamut 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, ColorGamuts); - } else { - return new Promise((resolve, reject) => { - resolve(ColorGamuts); - }) - } - }, - setWhitePoint: function (...args) { - console.warn("PictureManager.setWhitePoint 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWhitePoint: function (...args) { - console.warn("PictureManager.getWhitePoint 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, WhitePoints); - } else { - return new Promise((resolve, reject) => { - resolve(WhitePoints); - }) - } - }, - setOetf: function (...args) { - console.warn("PictureManager.setOetf 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getOetf: function (...args) { - console.warn("PictureManager.getOetf 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, Oetfs); - } else { - return new Promise((resolve, reject) => { - resolve(Oetfs); - }) - } - }, - setTwoPointColorTemp: function (...args) { - console.warn("PictureManager.setTwoPointColorTemp 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTwoPointColorTemp: function (...args) { - console.warn("PictureManager.getTwoPointColorTemp 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - setTenGamma: function (...args) { - console.warn("PictureManager.setTenGamma 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTenGamma: function (...args) { - console.warn("PictureManager.getTenGamma 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - enableCreatorMode: function (...args) { - console.warn("PictureManager.enableCreatorMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isCreatorModeEnabled: function (...args) { - console.warn("PictureManager.isCreatorModeEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setColorManagerMode: function (...args) { - console.warn("PictureManager.setColorManagerMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorManagerMode: function (...args) { - console.warn("PictureManager.getColorManagerMode 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, ColorManagerModes); - } else { - return new Promise((resolve, reject) => { - resolve(ColorManagerModes); - }) - } - }, - restoreCalibration: function (...args) { - console.warn("PictureManager.restoreCalibration 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restoreMasterSetting: function (...args) { - console.warn("PictureManager.restoreMasterSetting 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setStandbyLedEnable: function (...args) { - console.warn("PictureManager.setStandbyLedEnable 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isStandbyLedEnabled: function (...args) { - console.warn("PictureManager.isStandbyLedEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - getHdrType: function (...args) { - console.warn("PictureManager.getHdrType 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, PictureUserHdrTypes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureUserHdrTypes); - }) - } - }, - setUserHdrType: function (...args) { - console.warn("PictureManager.setUserHdrType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUserHdrType: function (...args) { - console.warn("PictureManager.getUserHdrType 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, PictureUserHdrTypes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureUserHdrTypes); - }) - } - }, - setMpegNr: function (...args) { - console.warn("PictureManager.setMpegNr 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getMpegNr: function (...args) { - console.warn("PictureManager.getMpegNr 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, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - setBoostPeakLevel: function (...args) { - console.warn("PictureManager.setBoostPeakLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getBoostPeakLevel: function (...args) { - console.warn("PictureManager.getBoostPeakLevel 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, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - enableNaturalTone: function (...args) { - console.warn("PictureManager.enableNaturalTone 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isNaturalToneEnabled: function (...args) { - console.warn("PictureManager.isNaturalToneEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setClearMotionLevel: function (...args) { - console.warn("PictureManager.setClearMotionLevel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getClearMotionLevel: function (...args) { - console.warn("PictureManager.getClearMotionLevel 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, CommonLevels); - } else { - return new Promise((resolve, reject) => { - resolve(CommonLevels); - }) - } - }, - restoreCurrentPictureMode: function (...args) { - console.warn("PictureManager.restoreCurrentPictureMode 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setEyeProtectStep: function (...args) { - console.warn("PictureManager.setEyeProtectStep 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getEyeProtectStep: function (...args) { - console.warn("PictureManager.getEyeProtectStep 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setColorTempMode: function (...args) { - console.warn("PictureManager.setColorTempMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTempMode: function (...args) { - console.warn("PictureManager.getColorTempMode 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, PictureColorTempModes); - } else { - return new Promise((resolve, reject) => { - resolve(PictureColorTempModes); - }) - } - }, - setColorTempStep: function (...args) { - console.warn("PictureManager.setColorTempStep 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getColorTempStep: function (...args) { - console.warn("PictureManager.getColorTempStep 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNormalColorManagerMode: function (...args) { - console.warn("PictureManager.getNormalColorManagerMode 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, ColorManagerModes); - } else { - return new Promise((resolve, reject) => { - resolve(ColorManagerModes); - }) - } - }, - isPdParamSupported: function (...args) { - console.warn("PictureManager.isPdParamSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isCuvaDeviceSupported: function (...args) { - console.warn("PictureManager.isCuvaDeviceSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - const SourceManager = { - selectSource: function (...args) { - console.warn("SourceManager.selectSource 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCurSourceId: function (...args) { - console.warn("SourceManager.getCurSourceId 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, SourceIndices); - } else { - return new Promise((resolve, reject) => { - resolve(SourceIndices); - }) - } - }, - deselectSource: function (...args) { - console.warn("SourceManager.deselectSource 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAvailSourceList: function (...args) { - console.warn("SourceManager.getAvailSourceList interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - getTimingInfo: function (...args) { - console.warn("SourceManager.getTimingInfo 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, TimingInfo); - } else { - return new Promise((resolve, reject) => { - resolve(TimingInfo); - }) - } - }, - getSignalStatus: function (...args) { - console.warn("SourceManager.getSignalStatus 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, SignalStates); - } else { - return new Promise((resolve, reject) => { - resolve(SignalStates); - }) - } - }, - setWindowRect: function (...args) { - console.warn("SourceManager.setWindowRect 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWindowRect: function (...args) { - console.warn("SourceManager.getWindowRect 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, RectInfo); - } else { - return new Promise((resolve, reject) => { - resolve(RectInfo); - }) - } - }, - setVideoDisplay: function (...args) { - console.warn("SourceManager.setVideoDisplay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - clearVideoDisplay: function (...args) { - console.warn("SourceManager.clearVideoDisplay 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getSupportSourceList: function (...args) { - console.warn("SourceManager.getSupportSourceList 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, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - getSelectSourceId: function (...args) { - console.warn("SourceManager.getSelectSourceId 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.paramArrayMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramArrayMock); - }) - } - }, - getSourcePlayingState: function (...args) { - console.warn("SourceManager.getSourcePlayingState interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, sourceIndicesArray); - } else { - return new Promise((resolve, reject) => { - resolve(sourceIndicesArray); - }) - } - }, - connectDistributeService: function (...args) { - console.warn("SourceManager.connectDistributeService 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - const SystemSetting = { - restoreDefault: function (...args) { - console.warn("SystemSetting.restoreDefault 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setHdmirxEdidType: function (...args) { - console.warn("SystemSetting.setHdmirxEdidType 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getHdmirxEdidType: function (...args) { - console.warn("SystemSetting.getHdmirxEdidType 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, HdmirxEdidTypes); - } else { - return new Promise((resolve, reject) => { - resolve(HdmirxEdidTypes); - }) - } - }, - isPowerOnPanelEnabled: function (...args) { - console.warn("SystemSetting.isPowerOnPanelEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enablePowerOnPanel: function (...args) { - console.warn("SystemSetting.enablePowerOnPanel 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - restorePic: function (...args) { - console.warn("SystemSetting.restorePic 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setPowerSaveMode: function (...args) { - console.warn("SystemSetting.setPowerSaveMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getPowerSaveMode: function (...args) { - console.warn("SystemSetting.getPowerSaveMode 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getWakeup: function (...args) { - console.warn("SystemSetting.getWakeup 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, Wakeup); - } else { - return new Promise((resolve, reject) => { - resolve(Wakeup); - }) - } - }, - enableLock: function (...args) { - console.warn("SystemSetting.enableLock 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isLockEnabled: function (...args) { - console.warn("SystemSetting.isLockEnabled interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var sourceIndicesArray = new Array(); - sourceIndicesArray.push(SourceIndices); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setParentLock: function (...args) { - console.warn("SystemSetting.setParentLock 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getParentLock: function (...args) { - console.warn("SystemSetting.getParentLock 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableSrcLock: function (...args) { - console.warn("SystemSetting.enableSrcLock 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isSrcLockEnabled: function (...args) { - console.warn("SystemSetting.isSrcLockEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isCurrentLocked: function (...args) { - console.warn("SystemSetting.isCurrentLocked 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableDtvLock: function (...args) { - console.warn("SystemSetting.enableDtvLock 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isDtvLockEnabled: function (...args) { - console.warn("SystemSetting.isDtvLockEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - setDtvLockDefaultStatus: function (...args) { - console.warn("SystemSetting.setDtvLockDefaultStatus 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - enableTemperatureCtrl: function (...args) { - console.warn("SystemSetting.enableTemperatureCtrl 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - isTemperatureCtrlEnabled: function (...args) { - console.warn("SystemSetting.isTemperatureCtrlEnabled 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isTemperatureCtrlSupported: function (...args) { - console.warn("SystemSetting.isTemperatureCtrlSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - isLampEffectSupported: function (...args) { - console.warn("SystemSetting.isLampEffectSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - return result; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/wantAgent/triggerInfo.js b/runtime/main/extend/systemplugin/napi/wantAgent/triggerInfo.js deleted file mode 100644 index 6c6b07a0..00000000 --- a/runtime/main/extend/systemplugin/napi/wantAgent/triggerInfo.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 { WantClass } from "../ohos_application_Want" -export const TriggerInfo = { - code: '[PC preview] unknow code', - want: new WantClass(), - permission: '[PC preview] unknow permission', - extraInfo: {"key": "unknown any"}, -}; diff --git a/runtime/main/extend/systemplugin/napi/wantAgent/wantAgentInfo.js b/runtime/main/extend/systemplugin/napi/wantAgent/wantAgentInfo.js deleted file mode 100644 index a968baca..00000000 --- a/runtime/main/extend/systemplugin/napi/wantAgent/wantAgentInfo.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 { WantClass } from "../ohos_application_Want" -import { OperationType, WantAgentFlags } from "../ohos_wantAgent" - -export const WantAgentInfo = { - wants: [new WantClass()], - operationType: OperationType, - requestCode: '[PC preview] unknow requestCode', - wantAgentFlags: [WantAgentFlags], - extraInfo: {"key": "unknown any"}, -}; diff --git a/runtime/main/extend/systemplugin/napi/webgl/webgl.js b/runtime/main/extend/systemplugin/napi/webgl/webgl.js deleted file mode 100644 index 57c6de82..00000000 --- a/runtime/main/extend/systemplugin/napi/webgl/webgl.js +++ /dev/null @@ -1,1048 +0,0 @@ -/* - * Copyright (c) 2021 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 mockWebgl() { - const WebGLContextAttributes = { - brightness: '[PC preview] unknow brightness', - alpha: '[PC preview] unknow alpha', - depth: '[PC preview] unknow depth', - stencil: '[PC preview] unknow stencil', - antialias: '[PC preview] unknow antialias', - premultipliedAlpha: '[PC preview] unknow premultipliedAlpha', - preserveDrawingBuffer: '[PC preview] unknow preserveDrawingBuffer', - powerPreference: '[PC preview] unknow powerPreference', - failIfMajorPerformanceCaveat: '[PC preview] unknow failIfMajorPerformanceCaveat', - desynchronized: '[PC preview] unknow desynchronized' - } - const float32ArrayWith2val = [ - paramMock.paramNumberMock, paramMock.paramNumberMock - ] - - const float32ArrayWith4val = [ - paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock - ] - const int32ArrayWith2ele = [ - paramMock.paramNumberMock, paramMock.paramNumberMock - ] - const int32ArrayWith4ele = [ - paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock, paramMock.paramNumberMock - ] - const WebGLShaderArray = [ - WebGLShader, WebGLShader, WebGLShader - ] - const WebGLBuffer = { - } - const WebGLFramebuffer = { - } - const WebGLProgram = { - } - const WebGLRenderbuffer = { - } - const WebGLShader = { - } - const WebGLTexture = { - } - const WebGLUniformLocation = { - } - const WebGLActiveInfo = { - size: '[PC preview] unknow size', - type: '[PC preview] unknow type', - name: '[PC preview] unknow name' - } - const WebGLShaderPrecisionFormat = { - rangeMin: '[PC preview] unknow rangeMin', - rangeMax: '[PC preview] unknow rangeMax', - precision: '[PC preview] unknow precision' - } - const glParamMock = { - paramDoubleMock: '[PC Preview] unknow double', - paramAnyMock: '[PC Preview] unknow any', - stringArray: '[PC preview] unknow stringArray', - uint32Array: '[PC preview] unknow uint32Array', - glBooleanArray: '[PC preview] unknow glBooleanArray', - WebGLShaderArray: '[PC preview] unknow WebGLShaderArray', - } - const WebGLRenderingContext = { - DEPTH_BUFFER_BIT: 0x00000100, - STENCIL_BUFFER_BIT: 0x00000400, - COLOR_BUFFER_BIT: 0x00004000, - POINTS: 0x0000, - LINES: 0x0001, - LINE_LOOP: 0x0002, - LINE_STRIP: 0x0003, - TRIANGLES: 0x0004, - TRIANGLE_STRIP: 0x0005, - TRIANGLE_FAN: 0x0006, - ZERO: 0, - ONE: 1, - SRC_COLOR: 0x0300, - ONE_MINUS_SRC_COLOR: 0x0301, - SRC_ALPHA: 0x0302, - ONE_MINUS_SRC_ALPHA: 0x0303, - DST_ALPHA: 0x0304, - ONE_MINUS_DST_ALPHA: 0x0305, - DST_COLOR: 0x0306, - ONE_MINUS_DST_COLOR: 0x0307, - SRC_ALPHA_SATURATE: 0x0308, - FUNC_ADD: 0x8006, - BLEND_EQUATION: 0x8009, - BLEND_EQUATION_RGB: 0x8009, - BLEND_EQUATION_ALPHA: 0x883D, - FUNC_SUBTRACT: 0x800A, - FUNC_REVERSE_SUBTRACT: 0x800B, - BLEND_DST_RGB: 0x80C8, - BLEND_SRC_RGB: 0x80C9, - BLEND_DST_ALPHA: 0x80CA, - BLEND_SRC_ALPHA: 0x80CB, - CONSTANT_COLOR: 0x8001, - ONE_MINUS_CONSTANT_COLOR: 0x8002, - CONSTANT_ALPHA: 0x8003, - ONE_MINUS_CONSTANT_ALPHA: 0x8004, - BLEND_COLOR: 0x8005, - ARRAY_BUFFER: 0x8892, - ELEMENT_ARRAY_BUFFER: 0x8893, - ARRAY_BUFFER_BINDING: 0x8894, - ELEMENT_ARRAY_BUFFER_BINDING: 0x8895, - STREAM_DRAW: 0x88E0, - STATIC_DRAW: 0x88E4, - DYNAMIC_DRAW: 0x88E8, - BUFFER_SIZE: 0x8764, - BUFFER_USAGE: 0x8765, - CURRENT_VERTEX_ATTRIB: 0x8626, - FRONT: 0x0404, - BACK: 0x0405, - FRONT_AND_BACK: 0x0408, - CULL_FACE: 0x0B44, - BLEND: 0x0BE2, - DITHER: 0x0BD0, - STENCIL_TEST: 0x0B90, - DEPTH_TEST: 0x0B71, - SCISSOR_TEST: 0x0C11, - POLYGON_OFFSET_FILL: 0x8037, - SAMPLE_ALPHA_TO_COVERAGE: 0x809E, - SAMPLE_COVERAGE: 0x80A0, - NO_ERROR: 0, - INVALID_ENUM: 0x0500, - INVALID_VALUE: 0x0501, - INVALID_OPERATION: 0x0502, - OUT_OF_MEMORY: 0x0505, - CW: 0x0900, - CCW: 0x0901, - LINE_WIDTH: 0x0B21, - ALIASED_POINT_SIZE_RANGE: 0x846D, - ALIASED_LINE_WIDTH_RANGE: 0x846E, - CULL_FACE_MODE: 0x0B45, - FRONT_FACE: 0x0B46, - DEPTH_RANGE: 0x0B70, - DEPTH_WRITEMASK: 0x0B72, - DEPTH_CLEAR_VALUE: 0x0B73, - DEPTH_FUNC: 0x0B74, - STENCIL_CLEAR_VALUE: 0x0B91, - STENCIL_FUNC: 0x0B92, - STENCIL_FAIL: 0x0B94, - STENCIL_PASS_DEPTH_FAIL: 0x0B95, - STENCIL_PASS_DEPTH_PASS: 0x0B96, - STENCIL_REF: 0x0B97, - STENCIL_VALUE_MASK: 0x0B93, - STENCIL_WRITEMASK: 0x0B98, - STENCIL_BACK_FUNC: 0x8800, - STENCIL_BACK_FAIL: 0x8801, - STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802, - STENCIL_BACK_PASS_DEPTH_PASS: 0x8803, - STENCIL_BACK_REF: 0x8CA3, - STENCIL_BACK_VALUE_MASK: 0x8CA4, - STENCIL_BACK_WRITEMASK: 0x8CA5, - VIEWPORT: 0x0BA2, - SCISSOR_BOX: 0x0C10, - COLOR_CLEAR_VALUE: 0x0C22, - COLOR_WRITEMASK: 0x0C23, - UNPACK_ALIGNMENT: 0x0CF5, - PACK_ALIGNMENT: 0x0D05, - MAX_TEXTURE_SIZE: 0x0D33, - MAX_VIEWPORT_DIMS: 0x0D3A, - SUBPIXEL_BITS: 0x0D50, - RED_BITS: 0x0D52, - GREEN_BITS: 0x0D53, - BLUE_BITS: 0x0D54, - ALPHA_BITS: 0x0D55, - DEPTH_BITS: 0x0D56, - STENCIL_BITS: 0x0D57, - POLYGON_OFFSET_UNITS: 0x2A00, - POLYGON_OFFSET_FACTOR: 0x8038, - TEXTURE_BINDING_2D: 0x8069, - SAMPLE_BUFFERS: 0x80A8, - SAMPLES: 0x80A9, - SAMPLE_COVERAGE_VALUE: 0x80AA, - SAMPLE_COVERAGE_INVERT: 0x80AB, - COMPRESSED_TEXTURE_FORMATS: 0x86A3, - DONT_CARE: 0x1100, - FASTEST: 0x1101, - NICEST: 0x1102, - GENERATE_MIPMAP_HINT: 0x8192, - BYTE: 0x1400, - UNSIGNED_BYTE: 0x1401, - SHORT: 0x1402, - UNSIGNED_SHORT: 0x1403, - INT: 0x1404, - UNSIGNED_INT: 0x1405, - FLOAT: 0x1406, - DEPTH_COMPONENT: 0x1902, - ALPHA: 0x1906, - RGB: 0x1907, - RGBA: 0x1908, - LUMINANCE: 0x1909, - LUMINANCE_ALPHA: 0x190A, - UNSIGNED_SHORT_4_4_4_4: 0x8033, - UNSIGNED_SHORT_5_5_5_1: 0x8034, - UNSIGNED_SHORT_5_6_5: 0x8363, - FRAGMENT_SHADER: 0x8B30, - VERTEX_SHADER: 0x8B31, - MAX_VERTEX_ATTRIBS: 0x8869, - MAX_VERTEX_UNIFORM_VECTORS: 0x8DFB, - MAX_VARYING_VECTORS: 0x8DFC, - MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8B4D, - MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8B4C, - MAX_TEXTURE_IMAGE_UNITS: 0x8872, - MAX_FRAGMENT_UNIFORM_VECTORS: 0x8DFD, - SHADER_TYPE: 0x8B4F, - DELETE_STATUS: 0x8B80, - LINK_STATUS: 0x8B82, - VALIDATE_STATUS: 0x8B83, - ATTACHED_SHADERS: 0x8B85, - ACTIVE_UNIFORMS: 0x8B86, - ACTIVE_ATTRIBUTES: 0x8B89, - SHADING_LANGUAGE_VERSION: 0x8B8C, - CURRENT_PROGRAM: 0x8B8D, - NEVER: 0x0200, - LESS: 0x0201, - EQUAL: 0x0202, - LEQUAL: 0x0203, - GREATER: 0x0204, - NOTEQUAL: 0x0205, - GEQUAL: 0x0206, - ALWAYS: 0x0207, - KEEP: 0x1E00, - REPLACE: 0x1E01, - INCR: 0x1E02, - DECR: 0x1E03, - INVERT: 0x150A, - INCR_WRAP: 0x8507, - DECR_WRAP: 0x8508, - VENDOR: 0x1F00, - RENDERER: 0x1F01, - VERSION: 0x1F02, - NEAREST: 0x2600, - LINEAR: 0x2601, - NEAREST_MIPMAP_NEAREST: 0x2700, - LINEAR_MIPMAP_NEAREST: 0x2701, - NEAREST_MIPMAP_LINEAR: 0x2702, - LINEAR_MIPMAP_LINEAR: 0x2703, - TEXTURE_MAG_FILTER: 0x2800, - TEXTURE_MIN_FILTER: 0x2801, - TEXTURE_WRAP_S: 0x2802, - TEXTURE_WRAP_T: 0x2803, - TEXTURE_2D: 0x0DE1, - TEXTURE: 0x1702, - TEXTURE_CUBE_MAP: 0x8513, - TEXTURE_BINDING_CUBE_MAP: 0x8514, - TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515, - TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516, - TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517, - TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518, - TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519, - TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851A, - MAX_CUBE_MAP_TEXTURE_SIZE: 0x851C, - TEXTURE0: 0x84C0, - TEXTURE1: 0x84C1, - TEXTURE2: 0x84C2, - TEXTURE3: 0x84C3, - TEXTURE4: 0x84C4, - TEXTURE5: 0x84C5, - TEXTURE6: 0x84C6, - TEXTURE7: 0x84C7, - TEXTURE8: 0x84C8, - TEXTURE9: 0x84C9, - TEXTURE10: 0x84CA, - TEXTURE11: 0x84CB, - TEXTURE12: 0x84CC, - TEXTURE13: 0x84CD, - TEXTURE14: 0x84CE, - TEXTURE15: 0x84CF, - TEXTURE16: 0x84D0, - TEXTURE17: 0x84D1, - TEXTURE18: 0x84D2, - TEXTURE19: 0x84D3, - TEXTURE20: 0x84D4, - TEXTURE21: 0x84D5, - TEXTURE22: 0x84D6, - TEXTURE23: 0x84D7, - TEXTURE24: 0x84D8, - TEXTURE25: 0x84D9, - TEXTURE26: 0x84DA, - TEXTURE27: 0x84DB, - TEXTURE28: 0x84DC, - TEXTURE29: 0x84DD, - TEXTURE30: 0x84DE, - TEXTURE31: 0x84DF, - ACTIVE_TEXTURE: 0x84E0, - REPEAT: 0x2901, - CLAMP_TO_EDGE: 0x812F, - MIRRORED_REPEAT: 0x8370, - FLOAT_VEC2: 0x8B50, - FLOAT_VEC3: 0x8B51, - FLOAT_VEC4: 0x8B52, - INT_VEC2: 0x8B53, - INT_VEC3: 0x8B54, - INT_VEC4: 0x8B55, - BOOL: 0x8B56, - BOOL_VEC2: 0x8B57, - BOOL_VEC3: 0x8B58, - BOOL_VEC4: 0x8B59, - FLOAT_MAT2: 0x8B5A, - FLOAT_MAT3: 0x8B5B, - FLOAT_MAT4: 0x8B5C, - SAMPLER_2D: 0x8B5E, - SAMPLER_CUBE: 0x8B60, - VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622, - VERTEX_ATTRIB_ARRAY_SIZE: 0x8623, - VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624, - VERTEX_ATTRIB_ARRAY_TYPE: 0x8625, - VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886A, - VERTEX_ATTRIB_ARRAY_POINTER: 0x8645, - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889F, - IMPLEMENTATION_COLOR_READ_TYPE: 0x8B9A, - IMPLEMENTATION_COLOR_READ_FORMAT: 0x8B9B, - COMPILE_STATUS: 0x8B81, - LOW_FLOAT: 0x8DF0, - MEDIUM_FLOAT: 0x8DF1, - HIGH_FLOAT: 0x8DF2, - LOW_INT: 0x8DF3, - MEDIUM_INT: 0x8DF4, - HIGH_INT: 0x8DF5, - FRAMEBUFFER: 0x8D40, - RENDERBUFFER: 0x8D41, - RGBA4: 0x8056, - RGB5_A1: 0x8057, - RGB565: 0x8D62, - DEPTH_COMPONENT16: 0x81A5, - STENCIL_INDEX8: 0x8D48, - DEPTH_STENCIL: 0x84F9, - RENDERBUFFER_WIDTH: 0x8D42, - RENDERBUFFER_HEIGHT: 0x8D43, - RENDERBUFFER_INTERNAL_FORMAT: 0x8D44, - RENDERBUFFER_RED_SIZE: 0x8D50, - RENDERBUFFER_GREEN_SIZE: 0x8D51, - RENDERBUFFER_BLUE_SIZE: 0x8D52, - RENDERBUFFER_ALPHA_SIZE: 0x8D53, - RENDERBUFFER_DEPTH_SIZE: 0x8D54, - RENDERBUFFER_STENCIL_SIZE: 0x8D55, - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8CD0, - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8CD1, - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8CD2, - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8CD3, - COLOR_ATTACHMENT0: 0x8CE0, - DEPTH_ATTACHMENT: 0x8D00, - STENCIL_ATTACHMENT: 0x8D20, - DEPTH_STENCIL_ATTACHMENT: 0x821A, - NONE: 0, - FRAMEBUFFER_COMPLETE: 0x8CD5, - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8CD6, - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8CD7, - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8CD9, - FRAMEBUFFER_UNSUPPORTED: 0x8CDD, - FRAMEBUFFER_BINDING: 0x8CA6, - RENDERBUFFER_BINDING: 0x8CA7, - MAX_RENDERBUFFER_SIZE: 0x84E8, - INVALID_FRAMEBUFFER_OPERATION: 0x0506, - UNPACK_FLIP_Y_WEBGL: 0x9240, - UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241, - CONTEXT_LOST_WEBGL: 0x9242, - UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243, - BROWSER_DEFAULT_WEBGL: 0x9244, - canvas: '[PC preview] unknow canvas', - drawingBufferWidth:'[PC preview] unknow drawingBufferWidth', - drawingBufferHeight:'[PC preview] unknow drawingBufferHeight', - getContextAttributes: function (...args) { - console.warn("WebGLRenderingContext.getContextAttributes interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLContextAttributes - }, - isContextLost: function (...args) { - console.warn("WebGLRenderingContext.isContextLost interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - getSupportedExtensions: function (...args) { - console.warn("WebGLRenderingContext.getSupportedExtensions interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.stringArray - }, - getExtension: function (...args) { - console.warn("WebGLRenderingContext.getExtension interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock - }, - activeTexture: function (...args) { - console.warn("WebGLRenderingContext.activeTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - attachShader: function (...args) { - console.warn("WebGLRenderingContext.attachShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindAttribLocation: function (...args) { - console.warn("WebGLRenderingContext.bindAttribLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBuffer: function (...args) { - console.warn("WebGLRenderingContext.bindBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindFramebuffer: function (...args) { - console.warn("WebGLRenderingContext.bindFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindRenderbuffer: function (...args) { - console.warn("WebGLRenderingContext.bindRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindTexture: function (...args) { - console.warn("WebGLRenderingContext.bindTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendColor: function (...args) { - console.warn("WebGLRenderingContext.blendColor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendEquation: function (...args) { - console.warn("WebGLRenderingContext.blendEquation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendEquationSeparate: function (...args) { - console.warn("WebGLRenderingContext.blendEquationSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blendFunc: function (...args) { - console.warn("WebGLRenderingContext.blendFunc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - blendFuncSeparate: function (...args) { - console.warn("WebGLRenderingContext.blendFuncSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - checkFramebufferStatus: function (...args) { - console.warn("WebGLRenderingContext.checkFramebufferStatus interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - clear: function (...args) { - console.warn("WebGLRenderingContext.clear interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearColor: function (...args) { - console.warn("WebGLRenderingContext.clearColor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearDepth: function (...args) { - console.warn("WebGLRenderingContext.clearDepth interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearStencil: function (...args) { - console.warn("WebGLRenderingContext.clearStencil interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - colorMask: function (...args) { - console.warn("WebGLRenderingContext.colorMask interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compileShader: function (...args) { - console.warn("WebGLRenderingContext.compileShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexImage2D: function (...args) { - console.warn("WebGLRenderingContext.copyTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexSubImage2D: function (...args) { - console.warn("WebGLRenderingContext.copyTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createBuffer: function (...args) { - console.warn("WebGLRenderingContext.createBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLBuffer; - }, - createFramebuffer: function (...args) { - console.warn("WebGLRenderingContext.createFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLFramebuffer; - }, - createProgram: function (...args) { - console.warn("WebGLRenderingContext.createProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLProgram; - }, - createRenderbuffer: function (...args) { - console.warn("WebGLRenderingContext.createRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLRenderbuffer; - }, - createShader: function (...args) { - console.warn("WebGLRenderingContext.createShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLShader; - }, - createTexture: function (...args) { - console.warn("WebGLRenderingContext.createTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLTexture; - }, - cullFace: function (...args) { - console.warn("WebGLRenderingContext.cullFace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteBuffer: function (...args) { - console.warn("WebGLRenderingContext.deleteBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteFramebuffer: function (...args) { - console.warn("WebGLRenderingContext.deleteFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteProgram: function (...args) { - console.warn("WebGLRenderingContext.deleteProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - deleteRenderbuffer: function (...args) { - console.warn("WebGLRenderingContext.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteShader: function (...args) { - console.warn("WebGLRenderingContext.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - deleteTexture: function (...args) { - console.warn("WebGLRenderingContext.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - depthFunc: function (...args) { - console.warn("WebGLRenderingContext.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - depthMask: function (...args) { - console.warn("WebGLRenderingContext.deleteRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - depthRange: function (...args) { - console.warn("WebGLRenderingContext.depthRange interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - detachShader: function (...args) { - console.warn("WebGLRenderingContext.detachShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - disable: function (...args) { - console.warn("WebGLRenderingContext.disable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - disableVertexAttribArray: function (...args) { - console.warn("WebGLRenderingContext.disableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawArrays: function (...args) { - console.warn("WebGLRenderingContext.drawArrays interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - drawElements: function (...args) { - console.warn("WebGLRenderingContext.drawElements interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - enable: function (...args) { - console.warn("WebGLRenderingContext.enable interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - enableVertexAttribArray: function (...args) { - console.warn("WebGLRenderingContext.enableVertexAttribArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - finish: function (...args) { - console.warn("WebGLRenderingContext.finish interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - flush: function (...args) { - console.warn("WebGLRenderingContext.flush interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - framebufferRenderbuffer: function (...args) { - console.warn("WebGLRenderingContext.framebufferRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - framebufferTexture2D: function (...args) { - console.warn("WebGLRenderingContext.framebufferTexture2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - frontFace: function (...args) { - console.warn("WebGLRenderingContext.frontFace interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - generateMipmap: function (...args) { - console.warn("WebGLRenderingContext.generateMipmap interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getActiveAttrib: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - getActiveUniform: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - getAttachedShaders: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.WebGLShaderArray; - }, - getAttribLocation: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getBufferParameter: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getParameter: function (...args) { - console.warn("WebGLRenderingContext.getActiveAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[0] == 0x0B73 || args[0] == 0x0B21 || - args[0] == 0x8038 || args[0] == 0x2A00 || - args[0] == 0x80AA) { - return paramMock.paramNumberMock; - } else if (args[0] == 0x8069 || args[0] == 0x8514) { - return WebGLTexture; - } else if (args[0] == 0x1F01 || args[0] == 0x8B8C || - args[0] == 0x1F00 || args[0] == 0x1F02) { - return glParamMock.stringArray; - } else if (args[0] == 0x8894 || args[0] == 0x8895) { - return WebGLBuffer; - } else if (args[0] == 0x8CA6) { - return WebGLFramebuffer; - } else if (args[0] == 0x8B8D) { - return WebGLProgram; - } else if (args[0] == 0x8CA7) { - return WebGLRenderbuffer; - } else if (args[0] == 0x846E || args[0] == 0x846D || - args[0] == 0x0B70) { - return float32ArrayWith2val; - } else if (args[0] == 0x0C22 || args[0] == 0x8005) { - return float32ArrayWith4val; - } else if (args[0] == 0x86A3) { - return glParamMock.uint32Array; - } else if (args[0] == 0x0D3A) { - return int32ArrayWith2ele; - } else if (args[0] == 0x0C10) { - return int32ArrayWith4ele; - } else if (args[0] == 0x0BE2 || args[0] == 0x0B44 || args[0] == 0x0B71 || - args[0] == 0x0B72 || args[0] == 0x0BD0 || args[0] == 0x8037 || - args[0] == 0x809E || args[0] == 0x80A0 || - args[0] == 0x80AB || args[0] == 0x0C11 || args[0] == 0x0B90 || - args[0] == 0x9240 || - args[0] == 0x9241) { - return paramMock.paramBooleanMock; - } else if (args[0] == 0x0C23) { - return glParamMock.glBooleanArray; - } else { - return paramMock.paramNumberMock; - } - }, - getError: function (...args) { - console.warn("WebGLRenderingContext.getError interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getFramebufferAttachmentParameter: function (...args) { - console.warn("WebGLRenderingContext.getFramebufferAttachmentParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[2] == 0x8CD0 || - args[2] == 0x8CD2 || - args[2] == 0x8CD3 || - args[2] == 0x8215 || - args[2] == 0x8214 || - args[2] == 0x8210 || - args[2] == 0x8211 || - args[2] == 0x8216 || - args[2] == 0x8213 || - args[2] == 0x8212 || - args[2] == 0x8217 || - args[2] == 0x8CD4) { - return paramMock.paramNumberMock; - } else if (args[2] == 0x8CD1) { - return paramMock.paramObjectMock; - } - }, - getProgramParameter: function (...args) { - console.warn("WebGLRenderingContext.getProgramParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x8B80 || args[1] == 0x8B82 || args[1] == 0x8B83) { - return paramMock.paramBooleanMock; - } else { - return paramMock.paramNumberMock; - } - }, - getProgramInfoLog: function (...args) { - console.warn("WebGLRenderingContext.getProgramInfoLog interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getRenderbufferParameter: function (...args) { - console.warn("WebGLRenderingContext.getRenderbufferParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - - getShaderParameter: function (...args) { - console.warn("WebGLRenderingContext.getShaderParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x8B4F) { - return paramMock.paramNumberMock; - } else { - return paramMock.paramBooleanMock; - } - }, - getShaderPrecisionFormat: function (...args) { - console.warn("WebGLRenderingContext.getShaderPrecisionFormat interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLShaderPrecisionFormat; - }, - getShaderInfoLog: function (...args) { - console.warn("WebGLRenderingContext.getShaderInfoLog interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getShaderSource: function (...args) { - console.warn("WebGLRenderingContext.getShaderSource interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getTexParameter: function (...args) { - console.warn("WebGLRenderingContext.getTexParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == 0x84FE) { - return glParamMock.paramDoubleMock; - } else { - return paramMock.paramNumberMock; - } - }, - getUniform: function (...args) { - console.warn("WebGLRenderingContext.getUniform interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformLocation: function (...args) { - console.warn("WebGLRenderingContext.getUniformLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLUniformLocation; - }, - getVertexAttrib: function (...args) { - console.warn("WebGLRenderingContext.getVertexAttrib interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getVertexAttribOffset: function (...args) { - console.warn("WebGLRenderingContext.getVertexAttribOffset interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - hint: function (...args) { - console.warn("WebGLRenderingContext.hint interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - isBuffer: function (...args) { - console.warn("WebGLRenderingContext.isBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isEnabled: function (...args) { - console.warn("WebGLRenderingContext.isEnabled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isFramebuffer: function (...args) { - console.warn("WebGLRenderingContext.isFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isProgram: function (...args) { - console.warn("WebGLRenderingContext.isProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isRenderbuffer: function (...args) { - console.warn("WebGLRenderingContext.isRenderbuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - isShader: function (...args) { - console.warn("WebGLRenderingContext.isShader interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - isTexture: function (...args) { - console.warn("WebGLRenderingContext.isTexture interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - lineWidth: function (...args) { - console.warn("WebGLRenderingContext.lineWidth interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - linkProgram: function (...args) { - console.warn("WebGLRenderingContext.linkProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - pixelStorei: function (...args) { - console.warn("WebGLRenderingContext.pixelStorei interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - polygonOffset: function (...args) { - console.warn("WebGLRenderingContext.polygonOffset interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - renderbufferStorage: function (...args) { - console.warn("WebGLRenderingContext.renderbufferStorage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - sampleCoverage: function (...args) { - console.warn("WebGLRenderingContext.sampleCoverage interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - scissor: function (...args) { - console.warn("WebGLRenderingContext.scissor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - shaderSource: function (...args) { - console.warn("WebGLRenderingContext.shaderSource interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - stencilFunc: function (...args) { - console.warn("WebGLRenderingContext.stencilFunc interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilFuncSeparate: function (...args) { - console.warn("WebGLRenderingContext.stencilFuncSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilMask: function (...args) { - console.warn("WebGLRenderingContext.stencilMask interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilMaskSeparate: function (...args) { - console.warn("WebGLRenderingContext.stencilMaskSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - stencilOp: function (...args) { - console.warn("WebGLRenderingContext.stencilOp interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - stencilOpSeparate: function (...args) { - console.warn("WebGLRenderingContext.stencilOpSeparate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texParameterf: function (...args) { - console.warn("WebGLRenderingContext.texParameterf interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texParameteri: function (...args) { - console.warn("WebGLRenderingContext.texParameteri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1f: function (...args) { - console.warn("WebGLRenderingContext.uniform1f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2f: function (...args) { - console.warn("WebGLRenderingContext.uniform2f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform3f: function (...args) { - console.warn("WebGLRenderingContext.uniform3f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4f: function (...args) { - console.warn("WebGLRenderingContext.uniform4f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1i: function (...args) { - console.warn("WebGLRenderingContext.uniform1i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2i: function (...args) { - console.warn("WebGLRenderingContext.uniform2i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3i: function (...args) { - console.warn("WebGLRenderingContext.uniform3i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform4i: function (...args) { - console.warn("WebGLRenderingContext.uniform4i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - useProgram: function (...args) { - console.warn("WebGLRenderingContext.useProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - validateProgram: function (...args) { - console.warn("WebGLRenderingContext.validateProgram interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib1f: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib1f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib2f: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib2f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - vertexAttrib3f: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib3f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib4f: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib4f interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib1fv: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib2fv: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttrib3fv: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - vertexAttrib4fv: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribPointer: function (...args) { - console.warn("WebGLRenderingContext.vertexAttribPointer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - viewport: function (...args) { - console.warn("WebGLRenderingContext.vertexAttrib3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - bufferData: function (...args) { - console.warn("WebGLRenderingContext.bufferData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferSubData: function (...args) { - console.warn("WebGLRenderingContext.bufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage2D: function (...args) { - console.warn("WebGLRenderingContext.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage2D: function (...args) { - console.warn("WebGLRenderingContext.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readPixels: function (...args) { - console.warn("WebGLRenderingContext.readPixels interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - texImage2D: function (...args) { - console.warn("WebGLRenderingContext.texImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage2D: function (...args) { - console.warn("WebGLRenderingContext.texSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1fv: function (...args) { - console.warn("WebGLRenderingContext.uniform1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2fv: function (...args) { - console.warn("WebGLRenderingContext.uniform2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3fv: function (...args) { - console.warn("WebGLRenderingContext.uniform3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniform4fv: function (...args) { - console.warn("WebGLRenderingContext.uniform4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1iv: function (...args) { - console.warn("WebGLRenderingContext.uniform1iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2iv: function (...args) { - console.warn("WebGLRenderingContext.uniform2iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3iv: function (...args) { - console.warn("WebGLRenderingContext.uniform3iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4iv: function (...args) { - console.warn("WebGLRenderingContext.uniform4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - - uniformMatrix2fv: function (...args) { - console.warn("WebGLRenderingContext.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3fv: function (...args) { - console.warn("WebGLRenderingContext.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4fv: function (...args) { - console.warn("WebGLRenderingContext.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } - } - return WebGLRenderingContext; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/napi/webgl/webgl2.js b/runtime/main/extend/systemplugin/napi/webgl/webgl2.js deleted file mode 100644 index 60512150..00000000 --- a/runtime/main/extend/systemplugin/napi/webgl/webgl2.js +++ /dev/null @@ -1,770 +0,0 @@ -/* - * Copyright (c) 2021 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 mockWebgl2() { - const WebGLQuery = { - } - const WebGLSampler = { - } - const WebGLSync = { - } - const WebGLTransformFeedback = { - } - const WebGLVertexArrayObject = { - } - const WebGLActiveInfo = { - size: '[PC preview] unknow size', - type: '[PC preview] unknow type', - name: '[PC preview] unknow name' - } - const glParamMock = { - paramDoubleMock: '[PC Preview] unknow double', - paramAnyMock: '[PC Preview] unknow any', - stringArray: '[PC preview] unknow stringArray', - uint32Array: '[PC preview] unknow uint32Array', - glBooleanArray: '[PC preview] unknow glBooleanArray', - int32Array: '[PC preview] unknow int32Array', - uintArray: '[PC preview] unknow uintArray' - } - - const WebGL2RenderingContext = { - READ_BUFFER: 0x0C02, - UNPACK_ROW_LENGTH: 0x0CF2, - UNPACK_SKIP_ROWS: 0x0CF3, - UNPACK_SKIP_PIXELS: 0x0CF4, - PACK_ROW_LENGTH: 0x0D02, - PACK_SKIP_ROWS: 0x0D03, - PACK_SKIP_PIXELS: 0x0D04, - COLOR: 0x1800, - DEPTH: 0x1801, - STENCIL: 0x1802, - RED: 0x1903, - RGB8: 0x8051, - RGBA8: 0x8058, - RGB10_A2: 0x8059, - TEXTURE_BINDING_3D: 0x806A, - UNPACK_SKIP_IMAGES: 0x806D, - UNPACK_IMAGE_HEIGHT: 0x806E, - TEXTURE_3D: 0x806F, - TEXTURE_WRAP_R: 0x8072, - MAX_3D_TEXTURE_SIZE: 0x8073, - UNSIGNED_INT_2_10_10_10_REV: 0x8368, - MAX_ELEMENTS_VERTICES: 0x80E8, - MAX_ELEMENTS_INDICES: 0x80E9, - TEXTURE_MIN_LOD: 0x813A, - TEXTURE_MAX_LOD: 0x813B, - TEXTURE_BASE_LEVEL: 0x813C, - TEXTURE_MAX_LEVEL: 0x813D, - MIN: 0x8007, - MAX: 0x8008, - DEPTH_COMPONENT24: 0x81A6, - MAX_TEXTURE_LOD_BIAS: 0x84FD, - TEXTURE_COMPARE_MODE: 0x884C, - TEXTURE_COMPARE_FUNC: 0x884D, - CURRENT_QUERY: 0x8865, - QUERY_RESULT: 0x8866, - QUERY_RESULT_AVAILABLE: 0x8867, - STREAM_READ: 0x88E1, - STREAM_COPY: 0x88E2, - STATIC_READ: 0x88E5, - STATIC_COPY: 0x88E6, - DYNAMIC_READ: 0x88E9, - DYNAMIC_COPY: 0x88EA, - MAX_DRAW_BUFFERS: 0x8824, - DRAW_BUFFER0: 0x8825, - DRAW_BUFFER1: 0x8826, - DRAW_BUFFER2: 0x8827, - DRAW_BUFFER3: 0x8828, - DRAW_BUFFER4: 0x8829, - DRAW_BUFFER5: 0x882A, - DRAW_BUFFER6: 0x882B, - DRAW_BUFFER7: 0x882C, - DRAW_BUFFER8: 0x882D, - DRAW_BUFFER9: 0x882E, - DRAW_BUFFER10: 0x882F, - DRAW_BUFFER11: 0x8830, - DRAW_BUFFER12: 0x8831, - DRAW_BUFFER13: 0x8832, - DRAW_BUFFER14: 0x8833, - DRAW_BUFFER15: 0x8834, - MAX_FRAGMENT_UNIFORM_COMPONENTS: 0x8B49, - MAX_VERTEX_UNIFORM_COMPONENTS: 0x8B4A, - SAMPLER_3D: 0x8B5F, - SAMPLER_2D_SHADOW: 0x8B62, - FRAGMENT_SHADER_DERIVATIVE_HINT: 0x8B8B, - PIXEL_PACK_BUFFER: 0x88EB, - PIXEL_UNPACK_BUFFER: 0x88EC, - PIXEL_PACK_BUFFER_BINDING: 0x88ED, - PIXEL_UNPACK_BUFFER_BINDING: 0x88EF, - FLOAT_MAT2x3: 0x8B65, - FLOAT_MAT2x4: 0x8B66, - FLOAT_MAT3x2: 0x8B67, - FLOAT_MAT3x4: 0x8B68, - FLOAT_MAT4x2: 0x8B69, - FLOAT_MAT4x3: 0x8B6A, - SRGB: 0x8C40, - SRGB8: 0x8C41, - SRGB8_ALPHA8: 0x8C43, - COMPARE_REF_TO_TEXTURE: 0x884E, - RGBA32F: 0x8814, - RGB32F: 0x8815, - RGBA16F: 0x881A, - RGB16F: 0x881B, - VERTEX_ATTRIB_ARRAY_INTEGER: 0x88FD, - MAX_ARRAY_TEXTURE_LAYERS: 0x88FF, - MIN_PROGRAM_TEXEL_OFFSET: 0x8904, - MAX_PROGRAM_TEXEL_OFFSET: 0x8905, - MAX_VARYING_COMPONENTS: 0x8B4B, - TEXTURE_2D_ARRAY: 0x8C1A, - TEXTURE_BINDING_2D_ARRAY: 0x8C1D, - R11F_G11F_B10F: 0x8C3A, - UNSIGNED_INT_10F_11F_11F_REV: 0x8C3B, - RGB9_E5: 0x8C3D, - UNSIGNED_INT_5_9_9_9_REV: 0x8C3E, - TRANSFORM_FEEDBACK_BUFFER_MODE: 0x8C7F, - MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 0x8C80, - TRANSFORM_FEEDBACK_VARYINGS: 0x8C83, - TRANSFORM_FEEDBACK_BUFFER_START: 0x8C84, - TRANSFORM_FEEDBACK_BUFFER_SIZE: 0x8C85, - TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8C88, - RASTERIZER_DISCARD: 0x8C89, - MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8C8A, - MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8C8B, - INTERLEAVED_ATTRIBS: 0x8C8C, - SEPARATE_ATTRIBS: 0x8C8D, - TRANSFORM_FEEDBACK_BUFFER: 0x8C8E, - TRANSFORM_FEEDBACK_BUFFER_BINDING: 0x8C8F, - RGBA32UI: 0x8D70, - RGB32UI: 0x8D71, - RGBA16UI: 0x8D76, - RGB16UI: 0x8D77, - RGBA8UI: 0x8D7C, - RGB8UI: 0x8D7D, - RGBA32I: 0x8D82, - RGB32I: 0x8D83, - RGBA16I: 0x8D88, - RGB16I: 0x8D89, - RGBA8I: 0x8D8E, - RGB8I: 0x8D8F, - RED_INTEGER: 0x8D94, - RGB_INTEGER: 0x8D98, - RGBA_INTEGER: 0x8D99, - SAMPLER_2D_ARRAY: 0x8DC1, - SAMPLER_2D_ARRAY_SHADOW: 0x8DC4, - SAMPLER_CUBE_SHADOW: 0x8DC5, - UNSIGNED_INT_VEC2: 0x8DC6, - UNSIGNED_INT_VEC3: 0x8DC7, - UNSIGNED_INT_VEC4: 0x8DC8, - INT_SAMPLER_2D: 0x8DCA, - INT_SAMPLER_3D: 0x8DCB, - INT_SAMPLER_CUBE: 0x8DCC, - INT_SAMPLER_2D_ARRAY: 0x8DCF, - UNSIGNED_INT_SAMPLER_2D: 0x8DD2, - UNSIGNED_INT_SAMPLER_3D: 0x8DD3, - UNSIGNED_INT_SAMPLER_CUBE: 0x8DD4, - UNSIGNED_INT_SAMPLER_2D_ARRAY: 0x8DD7, - DEPTH_COMPONENT32F: 0x8CAC, - DEPTH32F_STENCIL8: 0x8CAD, - FLOAT_32_UNSIGNED_INT_24_8_REV: 0x8DAD, - FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 0x8210, - FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 0x8211, - FRAMEBUFFER_ATTACHMENT_RED_SIZE: 0x8212, - FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 0x8213, - FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 0x8214, - FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 0x8215, - FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 0x8216, - FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 0x8217, - FRAMEBUFFER_DEFAULT: 0x8218, - UNSIGNED_INT_24_8: 0x84FA, - DEPTH24_STENCIL8: 0x88F0, - UNSIGNED_NORMALIZED: 0x8C17, - DRAW_FRAMEBUFFER_BINDING: 0x8CA6, - READ_FRAMEBUFFER: 0x8CA8, - DRAW_FRAMEBUFFER: 0x8CA9, - READ_FRAMEBUFFER_BINDING: 0x8CAA, - RENDERBUFFER_SAMPLES: 0x8CAB, - FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 0x8CD4, - MAX_COLOR_ATTACHMENTS: 0x8CDF, - COLOR_ATTACHMENT1: 0x8CE1, - COLOR_ATTACHMENT2: 0x8CE2, - COLOR_ATTACHMENT3: 0x8CE3, - COLOR_ATTACHMENT4: 0x8CE4, - COLOR_ATTACHMENT5: 0x8CE5, - COLOR_ATTACHMENT6: 0x8CE6, - COLOR_ATTACHMENT7: 0x8CE7, - COLOR_ATTACHMENT8: 0x8CE8, - COLOR_ATTACHMENT9: 0x8CE9, - COLOR_ATTACHMENT10: 0x8CEA, - COLOR_ATTACHMENT11: 0x8CEB, - COLOR_ATTACHMENT12: 0x8CEC, - COLOR_ATTACHMENT13: 0x8CED, - COLOR_ATTACHMENT14: 0x8CEE, - COLOR_ATTACHMENT15: 0x8CEF, - FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 0x8D56, - MAX_SAMPLES: 0x8D57, - HALF_FLOAT: 0x140B, - RG: 0x8227, - RG_INTEGER: 0x8228, - R8: 0x8229, - RG8: 0x822B, - R16F: 0x822D, - R32F: 0x822E, - RG16F: 0x822F, - RG32F: 0x8230, - R8I: 0x8231, - R8UI: 0x8232, - R16I: 0x8233, - R16UI: 0x8234, - R32I: 0x8235, - R32UI: 0x8236, - RG8I: 0x8237, - RG8UI: 0x8238, - RG16I: 0x8239, - RG16UI: 0x823A, - RG32I: 0x823B, - RG32UI: 0x823C, - VERTEX_ARRAY_BINDING: 0x85B5, - R8_SNORM: 0x8F94, - RG8_SNORM: 0x8F95, - RGB8_SNORM: 0x8F96, - RGBA8_SNORM: 0x8F97, - SIGNED_NORMALIZED: 0x8F9C, - COPY_READ_BUFFER: 0x8F36, - COPY_WRITE_BUFFER: 0x8F37, - COPY_READ_BUFFER_BINDING: 0x8F36, - COPY_WRITE_BUFFER_BINDING: 0x8F37, - UNIFORM_BUFFER: 0x8A11, - UNIFORM_BUFFER_BINDING: 0x8A28, - UNIFORM_BUFFER_START: 0x8A29, - UNIFORM_BUFFER_SIZE: 0x8A2A, - MAX_VERTEX_UNIFORM_BLOCKS: 0x8A2B, - MAX_FRAGMENT_UNIFORM_BLOCKS: 0x8A2D, - MAX_COMBINED_UNIFORM_BLOCKS: 0x8A2E, - MAX_UNIFORM_BUFFER_BINDINGS: 0x8A2F, - MAX_UNIFORM_BLOCK_SIZE: 0x8A30, - MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 0x8A31, - MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 0x8A33, - UNIFORM_BUFFER_OFFSET_ALIGNMENT: 0x8A34, - ACTIVE_UNIFORM_BLOCKS: 0x8A36, - UNIFORM_TYPE: 0x8A37, - UNIFORM_SIZE: 0x8A38, - UNIFORM_BLOCK_INDEX: 0x8A3A, - UNIFORM_OFFSET: 0x8A3B, - UNIFORM_ARRAY_STRIDE: 0x8A3C, - UNIFORM_MATRIX_STRIDE: 0x8A3D, - UNIFORM_IS_ROW_MAJOR: 0x8A3E, - UNIFORM_BLOCK_BINDING: 0x8A3F, - UNIFORM_BLOCK_DATA_SIZE: 0x8A40, - UNIFORM_BLOCK_ACTIVE_UNIFORMS: 0x8A42, - UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 0x8A43, - UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 0x8A44, - UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 0x8A46, - INVALID_INDEX: 0xFFFFFFFF, - MAX_VERTEX_OUTPUT_COMPONENTS: 0x9122, - MAX_FRAGMENT_INPUT_COMPONENTS: 0x9125, - MAX_SERVER_WAIT_TIMEOUT: 0x9111, - OBJECT_TYPE: 0x9112, - SYNC_CONDITION: 0x9113, - SYNC_STATUS: 0x9114, - SYNC_FLAGS: 0x9115, - SYNC_FENCE: 0x9116, - SYNC_GPU_COMMANDS_COMPLETE: 0x9117, - UNSIGNALED: 0x9118, - SIGNALED: 0x9119, - ALREADY_SIGNALED: 0x911A, - TIMEOUT_EXPIRED: 0x911B, - CONDITION_SATISFIED: 0x911C, - WAIT_FAILED: 0x911D, - SYNC_FLUSH_COMMANDS_BIT: 0x00000001, - VERTEX_ATTRIB_ARRAY_DIVISOR: 0x88FE, - ANY_SAMPLES_PASSED: 0x8C2F, - ANY_SAMPLES_PASSED_CONSERVATIVE: 0x8D6A, - SAMPLER_BINDING: 0x8919, - RGB10_A2UI: 0x906F, - INT_2_10_10_10_REV: 0x8D9F, - TRANSFORM_FEEDBACK: 0x8E22, - TRANSFORM_FEEDBACK_PAUSED: 0x8E23, - TRANSFORM_FEEDBACK_ACTIVE: 0x8E24, - TRANSFORM_FEEDBACK_BINDING: 0x8E25, - TEXTURE_IMMUTABLE_FORMAT: 0x912F, - MAX_ELEMENT_INDEX: 0x8D6B, - TEXTURE_IMMUTABLE_LEVELS: 0x82DF, - TIMEOUT_IGNORED: -1, - MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 0x9247, - copyBufferSubData: function (...args) { - console.warn("WebGL2RenderingContext.copyBufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getBufferSubData: function (...args) { - console.warn("WebGL2RenderingContext.getBufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - blitFramebuffer: function (...args) { - console.warn("WebGL2RenderingContext.blitFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - framebufferTextureLayer: function (...args) { - console.warn("WebGL2RenderingContext.framebufferTextureLayer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - invalidateFramebuffer: function (...args) { - console.warn("WebGL2RenderingContext.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - invalidateSubFramebuffer: function (...args) { - console.warn("WebGL2RenderingContext.invalidateFramebuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readBuffer: function (...args) { - console.warn("WebGL2RenderingContext.readBuffer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getInternalformatParameter: function (...args) { - console.warn("WebGL2RenderingContext.getInternalformatParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[2] == GL_SAMPLES) { - return glParamMock.int32Array - } - }, - renderbufferStorageMultisample: function (...args) { - console.warn("WebGL2RenderingContext.renderbufferStorageMultisample interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texStorage2D: function (...args) { - console.warn("WebGL2RenderingContext.texStorage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texStorage3D: function (...args) { - console.warn("WebGL2RenderingContext.texStorage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texImage3D: function (...args) { - console.warn("WebGL2RenderingContext.texImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage3D: function (...args) { - console.warn("WebGL2RenderingContext.texSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - copyTexSubImage3D: function (...args) { - console.warn("WebGL2RenderingContext.copyTexSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage3D: function (...args) { - console.warn("WebGL2RenderingContext.compressedTexImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage3D: function (...args) { - console.warn("WebGL2RenderingContext.compressedTexSubImage3D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getFragDataLocation: function (...args) { - console.warn("WebGL2RenderingContext.getFragDataLocation interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - uniform1ui: function (...args) { - console.warn("WebGL2RenderingContext.uniform1ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2ui: function (...args) { - console.warn("WebGL2RenderingContext.uniform2ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3ui: function (...args) { - console.warn("WebGL2RenderingContext.uniform3ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4ui: function (...args) { - console.warn("WebGL2RenderingContext.uniform4ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1uiv: function (...args) { - console.warn("WebGL2RenderingContext.uniform1uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2uiv: function (...args) { - console.warn("WebGL2RenderingContext.uniform2uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3uiv: function (...args) { - console.warn("WebGL2RenderingContext.uniform3uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4uiv: function (...args) { - console.warn("WebGL2RenderingContext.uniform4uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3x2fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix3x2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4x2fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix4x2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2x3fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix2x3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4x3fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix4x3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2x4fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix2x4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3x4fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix3x4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4i: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribI4i interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4iv: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribI4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4ui: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribI4ui interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribI4uiv: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribI4uiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribIPointer: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribIPointer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - vertexAttribDivisor: function (...args) { - console.warn("WebGL2RenderingContext.vertexAttribDivisor interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawArraysInstanced: function (...args) { - console.warn("WebGL2RenderingContext.drawArraysInstanced interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawElementsInstanced: function (...args) { - console.warn("WebGL2RenderingContext.drawElementsInstanced interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawRangeElements: function (...args) { - console.warn("WebGL2RenderingContext.drawRangeElements interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - drawBuffers: function (...args) { - console.warn("WebGL2RenderingContext.drawBuffers interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferfv: function (...args) { - console.warn("WebGL2RenderingContext.clearBufferfv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferiv: function (...args) { - console.warn("WebGL2RenderingContext.clearBufferiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferuiv: function (...args) { - console.warn("WebGL2RenderingContext.clearBufferuiv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clearBufferfi: function (...args) { - console.warn("WebGL2RenderingContext.clearBufferfi interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createQuery: function (...args) { - console.warn("WebGL2RenderingContext.createQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLQuery; - }, - deleteQuery: function (...args) { - console.warn("WebGL2RenderingContext.deleteQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isQuery: function (...args) { - console.warn("WebGL2RenderingContext.isQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - beginQuery: function (...args) { - console.warn("WebGL2RenderingContext.beginQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - endQuery: function (...args) { - console.warn("WebGL2RenderingContext.endQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getQuery: function (...args) { - console.warn("WebGL2RenderingContext.getQuery interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLQuery; - }, - getQueryParameter: function (...args) { - console.warn("WebGL2RenderingContext.getQueryParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == GL_QUERY_RESULT) { - return paramMock.paramNumberMock; - } else if (args[1] == GL_QUERY_RESULT_AVAILABLE) { - return paramMock.paramBooleanMock; - } - }, - createSampler: function (...args) { - console.warn("WebGL2RenderingContext.createSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLSampler; - }, - deleteSampler: function (...args) { - console.warn("WebGL2RenderingContext.deleteSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isSampler: function (...args) { - console.warn("WebGL2RenderingContext.isSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - - bindSampler: function (...args) { - console.warn("WebGL2RenderingContext.bindSampler interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - samplerParameteri: function (...args) { - console.warn("WebGL2RenderingContext.samplerParameteri interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - samplerParameterf: function (...args) { - console.warn("WebGL2RenderingContext.samplerParameterf interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getSamplerParameter: function (...args) { - console.warn("WebGL2RenderingContext.getSamplerParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (args[1] == GL_TEXTURE_MAX_LOD || args[1] == GL_TEXTURE_MIN_LOD) { - return glParamMock.paramDoubleMock; - } else { - return paramMock.paramNumberMock; - } - }, - fenceSync: function (...args) { - console.warn("WebGL2RenderingContext.fenceSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLSync; - }, - isSync: function (...args) { - console.warn("WebGL2RenderingContext.isSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - deleteSync: function (...args) { - console.warn("WebGL2RenderingContext.deleteSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - clientWaitSync: function (...args) { - console.warn("WebGL2RenderingContext.clientWaitSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - waitSync: function (...args) { - console.warn("WebGL2RenderingContext.waitSync interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getSyncParameter: function (...args) { - console.warn("WebGL2RenderingContext.getSyncParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - createTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.createTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLTransformFeedback; - }, - deleteTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.deleteTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.isTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - bindTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.bindTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - beginTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.beginTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - endTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.endTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - transformFeedbackVaryings: function (...args) { - console.warn("WebGL2RenderingContext.transformFeedbackVaryings interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getTransformFeedbackVarying: function (...args) { - console.warn("WebGL2RenderingContext.getTransformFeedbackVarying interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLActiveInfo; - }, - pauseTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.pauseTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - resumeTransformFeedback: function (...args) { - console.warn("WebGL2RenderingContext.resumeTransformFeedback interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBufferBase: function (...args) { - console.warn("WebGL2RenderingContext.bindBufferBase interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bindBufferRange: function (...args) { - console.warn("WebGL2RenderingContext.bindBufferRange interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - getIndexedParameter: function (...args) { - console.warn("WebGL2RenderingContext.getIndexedParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformIndices: function (...args) { - console.warn("WebGL2RenderingContext.getUniformIndices interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.uintArray; - }, - getActiveUniforms: function (...args) { - console.warn("WebGL2RenderingContext.getActiveUniforms interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getUniformBlockIndex: function (...args) { - console.warn("WebGL2RenderingContext.getUniformBlockIndex interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - getActiveUniformBlockParameter: function (...args) { - console.warn("WebGL2RenderingContext.getActiveUniformBlockParameter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return glParamMock.paramAnyMock; - }, - getActiveUniformBlockName: function (...args) { - console.warn("WebGL2RenderingContext.getActiveUniformBlockName interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - uniformBlockBinding: function (...args) { - console.warn("WebGL2RenderingContext.uniformBlockBinding interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - createVertexArray: function (...args) { - console.warn("WebGL2RenderingContext.createVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebGLVertexArrayObject; - }, - deleteVertexArray: function (...args) { - console.warn("WebGL2RenderingContext.deleteVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - isVertexArray: function (...args) { - console.warn("WebGL2RenderingContext.isVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - bindVertexArray: function (...args) { - console.warn("WebGL2RenderingContext.bindVertexArray interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferData: function (...args) { - console.warn("WebGL2RenderingContext.bufferData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - bufferSubData: function (...args) { - console.warn("WebGL2RenderingContext.bufferSubData interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texImage2D: function (...args) { - console.warn("WebGL2RenderingContext.texImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - texSubImage2D: function (...args) { - console.warn("WebGL2RenderingContext.texSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexImage2D: function (...args) { - console.warn("WebGL2RenderingContext.compressedTexImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - compressedTexSubImage2D: function (...args) { - console.warn("WebGL2RenderingContext.compressedTexSubImage2D interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1fv: function (...args) { - console.warn("WebGL2RenderingContext.uniform1fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2fv: function (...args) { - console.warn("WebGL2RenderingContext.uniform2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3fv: function (...args) { - console.warn("WebGL2RenderingContext.uniform3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4fv: function (...args) { - console.warn("WebGL2RenderingContext.uniform4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform1iv: function (...args) { - console.warn("WebGL2RenderingContext.uniform1iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform2iv: function (...args) { - console.warn("WebGL2RenderingContext.uniform2iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform3iv: function (...args) { - console.warn("WebGL2RenderingContext.uniform3iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniform4iv: function (...args) { - console.warn("WebGL2RenderingContext.uniform4iv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix2fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix2fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix3fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix3fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - uniformMatrix4fv: function (...args) { - console.warn("WebGL2RenderingContext.uniformMatrix4fv interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - }, - readPixels: function (...args) { - console.warn("WebGL2RenderingContext.readPixels interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - } - } - return WebGL2RenderingContext; - -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/net.js b/runtime/main/extend/systemplugin/net.js deleted file mode 100644 index eeb048fa..00000000 --- a/runtime/main/extend/systemplugin/net.js +++ /dev/null @@ -1,1179 +0,0 @@ -/* - * Copyright (c) 2021 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 mockWebSocket() { - global.systemplugin.net = {} - const WebSocketMock = { - connect: function (...args) { - console.warn("WebSocket.connect 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - send: function (...args) { - console.warn("WebSocket.send 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - close: function (...args) { - console.warn("WebSocket.close 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - on: function (...args) { - console.warn("WebSocket.on 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') { - if (args[0] === 'open') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'message') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else if (args[0] === 'close') { - args[len - 1].call(this, paramMock.businessErrorMock, { - code: "[PC Preview] unknow code", - reason: "[PC Preview] unknow reason" - }); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("WebSocket.off 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') { - if (args[0] === 'open') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else if (args[0] === 'message') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock); - } else if (args[0] === 'close') { - args[len - 1].call(this, paramMock.businessErrorMock, { - code: "[PC Preview] unknow code", - reason: "[PC Preview] unknow reason" - }); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - global.systemplugin.net.webSocket = { - createWebSocket: function () { - console.warn("net.webSocket.createWebSocket interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - return WebSocketMock; - } - } -} - -export function mockHttp() { - const HttpResponseCacheOptions = { - filePath: "[PC Preview] unknow filePath", - fileChildPath: "[PC Preview] unknow fileChildPath", - cacheSize: "[PC Preview] unknow cacheSize" - } - const HttpResponseCache = { - close: function (...args) { - console.warn("net.HttpResponseCache.close 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - delete: function (...args) { - console.warn("net.HttpResponseCache.delete 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - flush: function (...args) { - console.warn("net.HttpResponseCache.flush 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } - const HttpResponseMock = { - result: "[PC Preview] unknow result", - responseCode: "[PC Preview] unknow responseCode", - header: "[PC Preview] unknow header" - } - const HttpRequestMock = { - request: function (...args) { - console.warn("HttpRequest.request 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, HttpResponseMock); - } else { - return new Promise((resolve, reject) => { - resolve(HttpResponseMock); - }) - } - }, - destroy: function () { - console.warn("HttpRequest.destroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function (...args) { - console.warn("HttpRequest.on 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.paramObjectMock); - } - }, - off: function (...args) { - console.warn("HttpRequest.off 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.paramObjectMock); - } - } - } - global.systemplugin.net.http = { - createHttp: function () { - console.warn("net.http.createHttp interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return HttpRequestMock; - }, - getInstalledHttpResponseCache: function (...args) { - console.warn("net.http.getInstalledHttpResponseCache 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, HttpResponseCache); - } else { - return new Promise((resolve, reject) => { - resolve(HttpResponseCache); - }) - } - }, - createHttpResponseCache: function (...args) { - console.warn("net.http.createHttpResponseCache 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, HttpResponseCacheOptions); - } else { - return new Promise((resolve, reject) => { - resolve(HttpResponseCache); - }) - } - } - } -} - -export function mockMdns() { - const localServiceInfoMock = { - serviceType: "[PC Preview] unknow serviceType", - serviceName: "[PC Preview] unknow serviceName", - host: "[PC Preview] unknow host", - port: "[PC Preview] unknow port" - } - global.systemplugin.net.mdns = { - on: function (...args) { - console.warn("net.mdns.on 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') { - if (args[0] === 'serviceAdd') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceRemove') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceStart') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceStop') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceFound') { - args[len - 1].call(this, localServiceInfoMock); - } else if (args[0] === 'serviceLost') { - args[len - 1].call(this, localServiceInfoMock); - } else if (args[0] === 'serviceResolve') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceLost') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'error') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else { - args[len - 1].call(this); - } - } - }, - off: function (...args) { - console.warn("net.mdns.off 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') { - if (args[0] === 'serviceAdd') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceRemove') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceStart') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceStop') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceFound') { - args[len - 1].call(this, localServiceInfoMock); - } else if (args[0] === 'serviceLost') { - args[len - 1].call(this, localServiceInfoMock); - } else if (args[0] === 'serviceResolve') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'serviceLost') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else if (args[0] === 'error') { - args[len - 1].call(this, { serviceInfo: localServiceInfoMock, errorCode: 0 }); - } else { - args[len - 1].call(this); - } - } - }, - addLocalService: function (...args) { - console.warn("net.mdns.addLocalService 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeLocalService: function (...args) { - console.warn("net.mdns.removeLocalService 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - startSearchingMDNS: function (...args) { - console.warn("net.mdns.startSearchingMDNS 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - stopSearchingMDNS: function (...args) { - console.warn("net.mdns.stopSearchingMDNS 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - } - } -} - -export function mockSocket() { - const SocketStateBase = { - isBound: "[PC Preview] unknow isBound", - isClose: "[PC Preview] unknow isClose", - isConnected: "[PC Preview] unknow isConnected" - } - const SocketRemoteInfo = { - address: "[PC Preview] unknow address", - family: "[PC Preview] unknow family", - port: "[PC Preview] unknow port", - size: "[PC Preview] unknow size" - } - const NetAddress = { - address: "[PC Preview] unknow saddressize", - family: "[PC Preview] unknow family", - port: "[PC Preview] unknow port " - } - const UDPSocket = { - bind: function (...args) { - console.warn("UDPSocket.bind 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - send: function (...args) { - console.warn("UDPSocket.send 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - close: function (...args) { - console.warn("UDPSocket.close 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getState: function (...args) { - console.warn("UDPSocket.getState 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, SocketStateBase) - } else { - return new Promise((resolve, reject) => { - resolve(SocketStateBase); - }) - } - }, - setExtraOptions: function (...args) { - console.warn("UDPSocket.setExtraOptions 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("UDPSocket.on 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') { - if (args[0] === 'message') { - args[len - 1].call(this, { - message: "[PC Preview] unknow message", - remoteInfo: SocketRemoteInfo - }); - } else if (args[0] === 'listening') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("UDPSocket.off 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') { - if (args[0] === 'message') { - args[len - 1].call(this, { - message: "[PC Preview] unknow message", - remoteInfo: SocketRemoteInfo - }); - } else if (args[0] === 'listening') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - - const TCPSocket = { - bind: function (...args) { - console.warn("TcpSocket.bind 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - connect: function (...args) { - console.warn("TcpSocket.connect 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - send: function (...args) { - console.warn("TcpSocket.send 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - close: function (...args) { - console.warn("TcpSocket.close 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getRemoteAddress: function (...args) { - console.warn("TcpSocket.getRemoteAddress 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, NetAddress) - } else { - return new Promise((resolve, reject) => { - resolve(NetAddress); - }) - } - }, - getState: function (...args) { - console.warn("TcpSocket.getState 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, SocketStateBase) - } else { - return new Promise((resolve, reject) => { - resolve(SocketStateBase); - }) - } - }, - setExtraOptions: function (...args) { - console.warn("TcpSocket.setExtraOptions 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) - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - on: function (...args) { - console.warn("TcpSocket.on 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') { - if (args[0] === 'message') { - args[len - 1].call(this, { - message: "[PC Preview] unknow message", - remoteInfo: SocketRemoteInfo - }); - } else if (args[0] === 'listening') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("TcpSocket.off 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') { - if (args[0] === 'message') { - args[len - 1].call(this, { - message: "[PC Preview] unknow message", - remoteInfo: SocketRemoteInfo - }); - } else if (args[0] === 'listening') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] === 'error') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - } - } - global.systemplugin.net.socket = { - constructUDPSocketInstance: function () { - console.warn("net.socket.constructUDPSocketInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return UDPSocket; - }, - constructTCPSocketInstance: function () { - console.warn("net.socket.constructTCPSocketInstance interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return TCPSocket; - } - } -} - -export function mockHotspot() { - global.systemplugin.net.hotspot = { - isHotspotSupported: function (...args) { - console.warn("net.hotspot.isHotspotSupported 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - stopUsbHotspot: function (...args) { - console.warn("net.hotspot.stopUsbHotspot 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - startUsbHotspot: function (...args) { - console.warn("net.hotspot.startUsbHotspot 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getRxBytes: function (...args) { - console.warn("net.hotspot.getRxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getTxBytes: function (...args) { - console.warn("net.hotspot.getTxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getNetHotspotIfaces: function (...args) { - console.warn("net.hotspot.getNetHotspotIfaces interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var stringArray = new Array(); - stringArray.push(paramMock.paramStringMock); - const len = args.length - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, stringArray); - } else { - return new Promise((resolve, reject) => { - resolve(stringArray); - }) - } - }, - } -} -export function mockStatistics() { - global.systemplugin.net.statistics = { - getIfaceRxBytes: function (...args) { - console.warn("net.statistics.getIfaceRxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getIfaceTxBytes: function (...args) { - console.warn("net.statistics.getIfaceTxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCellularRxBytes: function (...args) { - console.warn("net.statistics.getCellularRxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getCellularTxBytes: function (...args) { - console.warn("net.statistics.getCellularTxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAllTxBytes: function (...args) { - console.warn("net.statistics.getAllTxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getAllRxBytes: function (...args) { - console.warn("net.statistics.getAllRxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUidRxBytes: function (...args) { - console.warn("net.statistics.getUidRxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - getUidTxBytes: function (...args) { - console.warn("net.statistics.getUidTxBytes 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - } -} - -const HttpResponse = { - result: "[PC Preview] unknow result", - responseCode: "[PC Preview] unknow responseCode", - header: "[PC Preview] unknow header", - cookies: "[PC Preview] unknow cookies" -}; -const HttpRequest = { - request: function () { - console.warn("HttpRequest.request 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, HttpResponse); - } else { - return new Promise((resolve, reject) => { - resolve(HttpResponse); - }) - } - }, - destroy: function () { - console.warn("HttpRequest.destroy interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - }, - on: function () { - console.warn("HttpRequest.on 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[0] === 'headerReceive') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - }, - off: function () { - console.warn("HttpRequest.off 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[0] === 'headerReceive') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramObjectMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramObjectMock); - }) - } - } -}; -export function mockConnection() { - const NetAddress = "[PC Preview] unknow NetAddress" - const NetHandle = { - netId: "[PC Preview] unknow netId", - bindSocket: function () { - console.warn("NetHandle.bindSocket 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - openConnection: function () { - console.warn("NetHandle.openConnection 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, HttpRequest); - } else { - return new Promise((resolve, reject) => { - resolve(HttpRequest); - }) - } - }, - getAddressesByName: function () { - console.warn("NetHandle.getAddressesByName 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, NetAddress); - } else { - return new Promise((resolve, reject) => { - resolve(NetAddress); - }) - } - }, - getAddressByName: function () { - console.warn("NetHandle.getAddressByName 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, NetAddress); - } else { - return new Promise((resolve, reject) => { - resolve(NetAddress); - }) - } - }, - } - const NetBearType = "[PC Preview] unknow NetBearType" - const NetCapabilities = { - bearerTypes: function () { - console.warn("NetCapabilities.bearerTypes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var netBearTypeArray = new Array(); - netBearTypeArray.push(NetBearType); - return netBearTypeArray; - } - } - const NetCap = "[PC Preview] unknow NetCap" - const ConnectionProperties = { - interfaceName: "[PC Preview] unknow interfaceName", - isUsePrivateDns: "[PC Preview] unknow isUsePrivateDns", - privateDnsServerName: "[PC Preview] unknow privateDnsServerName", - domains: "[PC Preview] unknow domains", - httpProxy: "[PC Preview] unknow httpProxy", - linkAddresses: function () { - console.warn("ConnectionProperties.linkAddresses interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var LinkAddress = new Array(); - LinkAddress.push(NetBearType); - return LinkAddress; - }, - dnses: function () { - console.warn("ConnectionProperties.dnses interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var NetAddress = new Array(); - NetAddress.push(NetBearType); - return NetAddress; - }, - routes: function () { - console.warn("ConnectionProperties.routes interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - var RouteInfo = new Array(); - RouteInfo.push(NetBearType); - return RouteInfo; - }, - mtu: "[PC Preview] unknow mtu" - } - const HttpProxy = { - host: "[PC Preview] unknow host", - port: "[PC Preview] unknow port", - parsedExclusionList: "[PC Preview] unknow parsedExclusionList" - } - const blocked = "[PC Preview] unknow blocked" - const BackgroundPolicy = "[PC Preview] unknow BackgroundPolicy" - global.systemplugin.net.connection = { - on: function (...args) { - console.warn("net.connection.on 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') { - if (args[0] === 'netAvailable') { - args[len - 1].call(this, paramMock.businessErrorMock, NetHandle); - } else if (args[0] === 'netBlockStatusChange') { - args[len - 1].call(this, paramMock.businessErrorMock, { NetHandle, blocked }); - } else if (args[0] === 'netCapabilitiesChange') { - args[len - 1].call(this, { NetHandle, NetCap }); - } else if (args[0] === 'netConnectionPropertiesChange') { - args[len - 1].call(this, { NetHandle, ConnectionProperties }); - } else if (args[0] === 'netLosing') { - args[len - 1].call(this, { - NetHandle, - maxMsToLive: "[PC Preview] unknow maxMsToLive" - }); - } else if (args[0] === 'netLost') { - args[len - 1].call(this, paramMock.businessErrorMock, NetHandle); - } else if (args[0] === 'netUnavailable') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - off: function (...args) { - console.warn("net.connection.off 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') { - if (args[0] === 'netAvailable') { - args[len - 1].call(this, paramMock.businessErrorMock, NetHandle); - } else if (args[0] === 'netBlockStatusChange') { - args[len - 1].call(this, { NetHandle, blocked }); - } else if (args[0] === 'netCapabilitiesChange') { - args[len - 1].call(this, { NetHandle, NetCap }); - } else if (args[0] === 'netConnectionPropertiesChange') { - args[len - 1].call(this, { NetHandle, ConnectionProperties }); - } else if (args[0] === 'netLosing') { - args[len - 1].call(this, { - NetHandle, - maxMsToLive: "[PC Preview] unknow maxMsToLive" - }); - } else if (args[0] === 'netLost') { - args[len - 1].call(this, paramMock.businessErrorMock, NetHandle); - } else if (args[0] === 'netUnavailable') { - args[len - 1].call(this, paramMock.businessErrorMock); - } - } - }, - addNetStatusCallback: function (...args) { - console.warn("net.connection.addNetStatusCallback 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - removeNetStatusCallback: function (...args) { - console.warn("net.connection.removeNetStatusCallback 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getAppNet: function (...args) { - console.warn("net.connection.getAppNet 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, NetHandle); - } else { - return new Promise((resolve, reject) => { - resolve(NetHandle); - }) - } - }, - setAppNet: function (...args) { - console.warn("net.connection.setAppNet 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - getDefaultNet: function (...args) { - console.warn("net.connection.getDefaultNet 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, NetHandle); - } else { - return new Promise((resolve, reject) => { - resolve(NetHandle); - }) - } - }, - getAllNets: function (...args) { - console.warn("net.connection.getAllNets 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, NetHandle); - } else { - return new Promise((resolve, reject) => { - resolve(NetHandle); - }) - } - }, - getDefaultHttpProxy: function (...args) { - console.warn("net.connection.getDefaultHttpProxy 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, HttpProxy); - } else { - return new Promise((resolve, reject) => { - resolve(HttpProxy); - }) - } - }, - getConnectionProperties: function (...args) { - console.warn("net.connection.getConnectionProperties 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, ConnectionProperties); - } else { - return new Promise((resolve, reject) => { - resolve(ConnectionProperties); - }) - } - }, - getNetCapabilities: function (...args) { - console.warn("net.connection.getNetCapabilities 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, NetCapabilities); - } else { - return new Promise((resolve, reject) => { - resolve(NetCapabilities); - }) - } - }, - getBackgroundPolicy: function (...args) { - console.warn("net.connection.getBackgroundPolicy 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, BackgroundPolicy); - } else { - return new Promise((resolve, reject) => { - resolve(BackgroundPolicy); - }) - } - }, - isDefaultNetMetered: function (...args) { - console.warn("net.connection.isDefaultNetMetered 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - hasDefaultNet: function (...args) { - console.warn("net.connection.hasDefaultNet 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - enableAirplaneMode: function (...args) { - console.warn("net.connection.enableAirplaneMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableAirplaneMode: function (...args) { - console.warn("net.connection.disableAirplaneMode 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - enableDistributedCellularData: function (...args) { - console.warn("net.connection.enableDistributedCellularData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - disableDistributedCellularData: function (...args) { - console.warn("net.connection.disableDistributedCellularData 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - reportNetConnected: function (...args) { - console.warn("net.connection.reportNetConnected 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - reportNetDisconnected: function (...args) { - console.warn("net.connection.reportNetDisconnected 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/notification.js b/runtime/main/extend/systemplugin/notification.js deleted file mode 100644 index 10a0cde7..00000000 --- a/runtime/main/extend/systemplugin/notification.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2021 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 mockNotification() { - global.systemplugin.notification = { - show: function () { - console.warn("notification.show interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/app.js b/runtime/main/extend/systemplugin/ohos/app.js deleted file mode 100644 index c392e529..00000000 --- a/runtime/main/extend/systemplugin/ohos/app.js +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2021 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 { PixelMapMock } from "../multimedia" - -export function mockAppAbilityManager() { - global.ohosplugin.app = {} - const ActiveProcessInfoMock = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - processName: "[PC Preview] unknow processName", - bundleNames: ["[PC Preview] unknow bundleNames", "[PC Preview] unknow bundleNames"] - } - const ElementNameMock = { - deviceId: "[PC Preview] unknow deviceId", - bundleName: "[PC Preview] unknow bundleName", - abilityName: "[PC Preview] unknow abilityName", - uri: "[PC Preview] unknow uri", - shortName: "[PC Preview] unknow shortName", - } - const AbilityMissionInfoMock = { - missionId: "[PC Preview] unknow missionId", - bottomAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - topAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - windowMode: "[PC Preview] unknow windowMode" - } - - const ActiveServiceAbilityInfoMock = { - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - processName: "[PC Preview] unknow processName", - serviceAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - } - } - - const ProcessErrorInfoMock = { - errStatus: "[PC Preview] unknow errStatus", - processName: "[PC Preview] unknow processName", - pid: "[PC Preview] unknow pid", - uid: "[PC Preview] unknow uid", - abilityName: "[PC Preview] unknow abilityName", - errMsg: "[PC Preview] unknow errMsg", - backTrace: "[PC Preview] unknow backTrace" - } - const SystemMemoryAttrMock = { - availSysMem: "[PC Preview] unknow availSysMem", - totalSysMem: "[PC Preview] unknow totalSysMem", - threshold: "[PC Preview] unknow threshold", - isSysInlowMem: "[PC Preview] unknow isSysInlowMem" - } - const MissionSnapshotMock = { - topAbility: { - abilityName: ElementNameMock.abilityName, - bundleName: ElementNameMock.bundleName, - deviceId: ElementNameMock.deviceId - }, - snapshot: PixelMapMock - } - const MemoryMapInfoMock = { - vmPss: "[PC Preview] unknow vmPss", - vmPrivateDirty: "[PC Preview] unknow vmPrivateDirty", - vmSharedDirty: "[PC Preview] unknow vmSharedDirty", - nativePss: "[PC Preview] unknow nativePss", - nativePrivateDirty: "[PC Preview] unknow nativePrivateDirty", - nativeSharedDirty: "[PC Preview] unknow nativeSharedDirty", - otherPss: "[PC Preview] unknow otherPss", - otherPrivateDirty: "[PC Preview] unknow otherPrivateDirty", - otherSharedDirty: "[PC Preview] unknow otherSharedDirty" - } - - global.ohosplugin.app.abilityManager = { - getCurrentUserId: function (...args) { - console.warn("app.abilityManager.getCurrentUserId 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getActiveProcessInfos: function (...args) { - console.warn("app.abilityManager.getActiveProcessInfos 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, [ActiveProcessInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ActiveProcessInfoMock]) - }) - } - }, - getActiveAbilityMissionInfos: function (...args) { - console.warn("app.abilityManager.getActiveAbilityMissionInfos 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, [AbilityMissionInfoMock]) - } else { - return new Promise((resolve) => { - resolve([AbilityMissionInfoMock]) - }) - } - }, - getPreviousAbilityMissionInfos: function (...args) { - console.warn("app.abilityManager.getPreviousAbilityMissionInfos 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, [AbilityMissionInfoMock]) - } else { - return new Promise((resolve) => { - resolve([AbilityMissionInfoMock]) - }) - } - }, - deleteMissions: function (...args) { - console.warn("app.abilityManager.deleteMissions 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isUserATestUser: function (...args) { - console.warn("app.abilityManager.isUserATestUser 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) - }) - } - }, - getActiveServiceAbilityInfos: function (...args) { - console.warn("app.abilityManager.getActiveServiceAbilityInfos 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, [ActiveServiceAbilityInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ActiveServiceAbilityInfoMock]) - }) - } - }, - getHomeScreenIconDenseness: function (...args) { - console.warn("app.abilityManager.getHomeScreenIconDenseness 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getHomeScreenIconSize: function (...args) { - console.warn("app.abilityManager.getHomeScreenIconSize 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - isMultiWindowAllowed: function (...args) { - console.warn("app.abilityManager.isMultiWindowAllowed 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) - }) - } - }, - moveMissionToFirstSplitScreen: function (...args) { - console.warn("app.abilityManager.moveMissionToFirstSplitScreen 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) - } else { - return new Promise((resolve) => { - resolve() - }) - } - }, - isRamConstrainedDevice: function (...args) { - console.warn("app.abilityManager.isRamConstrainedDevice 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) - }) - } - }, - getAppMemorySize: function (...args) { - console.warn("app.abilityManager.getAppMemorySize 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.paramNumberMock) - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock) - }) - } - }, - getProcessMemoryMapInfos: function (...args) { - console.warn("app.abilityManager.getProcessMemoryMapInfos 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, [MemoryMapInfoMock]) - } else { - return new Promise((resolve) => { - resolve([MemoryMapInfoMock]) - }) - } - }, - - getSystemMemoryAttr: function (...args) { - console.warn("app.abilityManager.getSystemMemoryAttr 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, SystemMemoryAttrMock) - } else { - return new Promise((resolve) => { - resolve(SystemMemoryAttrMock) - }) - } - }, - getProcessErrorInfos: function (...args) { - console.warn("app.abilityManager.getProcessErrorInfos 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, [ProcessErrorInfoMock]) - } else { - return new Promise((resolve) => { - resolve([ProcessErrorInfoMock]) - }) - } - }, - getAbilityMissionSnapshot: function (...args) { - console.warn("app.abilityManager.getAbilityMissionSnapshot 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, MissionSnapshotMock) - } else { - return new Promise((resolve) => { - resolve(MissionSnapshotMock) - }) - } - } - } -} diff --git a/runtime/main/extend/systemplugin/ohos/bluetooth.js b/runtime/main/extend/systemplugin/ohos/bluetooth.js deleted file mode 100644 index be322110..00000000 --- a/runtime/main/extend/systemplugin/ohos/bluetooth.js +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright (c) 2021 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 mockOhosBluetooth() { - const ArrayStringMock = ["[PC preview] unknown array string"] - const connectedBLEDevicesMock = [ - { - connectedBLEDevice: "[PC Preview] unknow connectedBLEDevice", - } - ] - const gattServiceMock = { - serviceUuid: "[PC preview] unknown serviceUuid", - isPrimary: "[PC preview] unknown isPrimary", - characteristics: [ - BLECharacteristicMock - ], - includeServices: [ - gattServiceMock - ] - } - const BLECharacteristicMock = { - serviceUuid: "[PC preview] unknown serviceUuid", - characteristicUuid: "[PC preview] unknown characteristicUuid", - characteristicValue: "[PC preview] unknown characteristicValue", - descriptors: [ - BLEDescriptorMock - ] - } - const BLEDescriptorMock = { - serviceUuid: "[PC preview] unknown serviceUuid", - characteristicUuid: "[PC preview] unknown characteristicUuid", - descriptorUuid: "[PC preview] unknown descriptorUuid", - descriptorValue: "[PC preview] unknown descriptorValue" - } - const gattServicesMock = [ - gattServiceMock - ] - const scanResultMock = { - deviceId: "[PC preview] unknown deviceId", - rssi: "[PC preview] unknown rssi", - data: "[PC preview] unknown data" - } - const characteristicReadReqMock = { - deviceId: "[PC preview] unknown deviceId", - transId: "[PC preview] unknown transId", - offset: "[PC preview] unknown offset", - characteristicUuid: "[PC preview] unknown characteristicUuid", - serviceUuid: "[PC preview] unknown serviceUuid" - } - const characteristicWriteReqMock = { - deviceId: "[PC preview] unknown deviceId", - transId: "[PC preview] unknown transId", - offset: "[PC preview] unknown offset", - isPrep: "[PC preview] unknown isPrep", - needRsp: "[PC preview] unknown needRsp", - value: "[PC preview] unknown value", - characteristicUuid: "[PC preview] unknown characteristicUuid", - serviceUuid: "[PC preview] unknown serviceUuid" - } - const descriptorReadReqMock = { - deviceId: "[PC preview] unknown v", - transId: "[PC preview] unknown transId", - offset: "[PC preview] unknown offset", - descriptorUuid: "[PC preview] unknown descriptorUuid", - characteristicUuid: "[PC preview] unknown characteristicUuid", - serviceUuid: "[PC preview] unknown serviceUuid" - } - const descriptorWriteReqMock = { - deviceId: "[PC preview] unknown deviceId", - transId: "[PC preview] unknown transId", - offset: "[PC preview] unknown offset", - isPrep: "[PC preview] unknown isPrep", - needRsp: "[PC preview] unknown needRsp", - value: "[PC preview] unknown value", - descriptorUuid: "[PC preview] unknown descriptorUuid", - characteristicUuid: "[PC preview] unknown characteristicUuid", - serviceUuid: "[PC preview] unknown serviceUuid" - } - const BLEConnectChangedStateMock = { - deviceId: "[PC preview] unknown deviceId", - state: "[PC preview] unknown state" - } - const pinRequiredParamMock = { - deviceId: "[PC preview] unknown deviceId", - pinCode: "[PC preview] unknown pinCode" - } - const sppReadMock = { - ArrayBuffer: "[PC preview] unknown ArrayBuffer" - } - const GattServerMock = { - startAdvertising: function (...args) { - console.warn("GattServer.startAdvertising interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - stopAdvertising: function () { - console.warn("GattServer.stopAdvertising interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - addService: function (...args) { - console.warn("GattServer.addService interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - removeService: function (...args) { - console.warn("GattServer.removeService interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - close: function () { - console.warn("GattServer.close interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - notifyCharacteristicChanged: function (...args) { - console.warn("GattServer.notifyCharacteristicChanged interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - sendResponse: function (...args) { - console.warn("GattServer.sendResponse interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - on: function (...args) { - console.warn("GattServer.on 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') { - if (args[0] == 'characteristicRead') { - args[len - 1].call(this, characteristicReadReqMock); - } else if (args[0] == 'characteristicWrite') { - args[len - 1].call(this, characteristicWriteReqMock); - } else if (args[0] == 'descriptorRead') { - args[len - 1].call(this, descriptorReadReqMock); - } else if (args[0] == 'descriptorWrite') { - args[len - 1].call(this, descriptorWriteReqMock); - } else if (args[0] == 'connectStateChange') { - args[len - 1].call(this, BLEConnectChangedStateMock); - } - } - }, - off: function (...args) { - console.warn("GattServer.off 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') { - if (args[0] == 'characteristicRead') { - args[len - 1].call(this, characteristicReadReqMock); - } else if (args[0] == 'characteristicWrite') { - args[len - 1].call(this, characteristicWriteReqMock); - } else if (args[0] == 'descriptorRead') { - args[len - 1].call(this, descriptorReadReqMock); - } else if (args[0] == 'descriptorWrite') { - args[len - 1].call(this, descriptorWriteReqMock); - } else if (args[0] == 'connectStateChange') { - args[len - 1].call(this, BLEConnectChangedStateMock); - } - } - }, - } - const GattClientDeviceMock = { - connect: function () { - console.warn("GattClientDevice.connect interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - disconnect: function () { - console.warn("GattClientDevice.disconnect interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - close: function () { - console.warn("GattClientDevice.close interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - getDeviceName: function (...args) { - console.warn("GattClientDevice.getDeviceName 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - getServices: function (...args) { - console.warn("GattClientDevice.getServices 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, gattServicesMock); - } else { - return new Promise((resolve, reject) => { - resolve(gattServicesMock); - }) - } - }, - readCharacteristicValue: function (...args) { - console.warn("GattClientDevice.readCharacteristicValue 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, BLECharacteristicMock); - } else { - return new Promise((resolve, reject) => { - resolve(BLECharacteristicMock); - }) - } - }, - readDescriptorValue: function (...args) { - console.warn("GattClientDevice.readDescriptorValue 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, BLEDescriptorMock); - } else { - return new Promise((resolve, reject) => { - resolve(BLEDescriptorMock); - }) - } - }, - writeCharacteristicValue: function (...args) { - console.warn("GattClientDevice.writeCharacteristicValue interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - writeDescriptorValue: function (...args) { - console.warn("GattClientDevice.writeDescriptorValue interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - getRssiValue: function (...args) { - console.warn("GattClientDevice.getRssiValue 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.paramNumberMock); - } else { - return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - }, - setBLEMtuSize: function (...args) { - console.warn("GattClientDevice.setBLEMtuSize interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - setNotifyCharacteristicChanged: function (...args) { - console.warn("GattClientDevice.setNotifyCharacteristicChanged interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - on: function (...args) { - console.warn("GattClientDevice.on 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') { - if (args[0] == 'BLECharacteristicChange') { - args[len - 1].call(this, BLECharacteristicMock); - } else if (args[0] == 'BLEConnectionStateChange') { - args[len - 1].call(this, BLEConnectChangedStateMock); - } - } - }, - off: function (...args) { - console.warn("GattClientDevice.off 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') { - if (args[0] == 'BLECharacteristicChange') { - args[len - 1].call(this, BLECharacteristicMock); - } else if (args[0] == 'BLEConnectionStateChange') { - args[len - 1].call(this, BLEConnectChangedStateMock); - } - } - }, - } - global.ohosplugin.bluetooth = { - getState: function () { - console.warn("bluetooth.getState interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - getBtConnectionState: function () { - console.warn("bluetooth.getBtConnectionState interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock - }, - pairDevice: function (...args) { - console.warn("bluetooth.pairDevice interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock - }, - enableBluetooth: function () { - console.warn("bluetooth.enableBluetooth interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - disableBluetooth: function () { - console.warn("bluetooth.disableBluetooth interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getLocalName: function () { - console.warn("bluetooth.getLocalName interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramStringMock; - }, - getPairedDevices: function () { - console.warn("bluetooth.getPairedDevices interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return ArrayStringMock; - }, - setDevicePairingConfirmation: function (...args) { - console.warn("bluetooth.setDevicePairingConfirmation interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setLocalName: function (...args) { - console.warn("bluetooth.setLocalName interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - setBluetoothScanMode: function (...args) { - console.warn("bluetooth.setBluetoothScanMode interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - getBluetoothScanMode: function () { - console.warn("bluetooth.getBluetoothScanMode interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramNumberMock; - }, - startBluetoothDiscovery: function () { - console.warn("bluetooth.startBluetoothDiscovery interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - stopBluetoothDiscovery: function () { - console.warn("bluetooth.stopBluetoothDiscovery interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - on: function (...args) { - console.warn("bluetooth.on 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') { - if (args[0] == 'bluetoothDeviceFind') { - args[len - 1].call(this, ArrayStringMock); - } else if (args[0] == 'bondStateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else if (args[0] == 'pinRequired') { - args[len - 1].call(this, pinRequiredParamMock); - } else if (args[0] == 'stateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else if (args[0] == 'sppRead') { - args[len - 1].call(this, sppReadMock.ArrayBuffer); - } - } - }, - off: function (...args) { - console.warn("bluetooth.off 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') { - if (args[0] == 'bluetoothDeviceFind') { - args[len - 1].call(this, ArrayStringMock); - } else if (args[0] == 'bondStateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else if (args[0] == 'pinRequired') { - args[len - 1].call(this, pinRequiredParamMock); - } else if (args[0] == 'stateChange') { - args[len - 1].call(this, paramMock.paramNumberMock); - } else if (args[0] == 'sppRead') { - args[len - 1].call(this, sppReadMock.ArrayBuffer); - } - } - }, - sppListen: function (...args) { - console.warn("bluetooth.sppListen 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.paramNumberMock); - } - }, - sppAccept: function (...args) { - console.warn("bluetooth.sppAccept 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.paramNumberMock); - } - }, - sppConnect: function (...args) { - console.warn("bluetooth.sppConnect 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.paramNumberMock); - } - }, - sppCloseServerSocket: function (...args) { - console.warn("bluetooth.sppCloseServerSocket interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - sppCloseClientSocket: function (...args) { - console.warn("bluetooth.sppCloseClientSocket interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - sppWrite: function (...args) { - console.warn("bluetooth.sppWrite interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return paramMock.paramBooleanMock; - }, - ScanDuty: { - SCAN_MODE_LOW_POWER: 0, - SCAN_MODE_BALANCED: 1, - SCAN_MODE_LOW_LATENCY: 2 - }, - MatchMode: { - MATCH_MODE_AGGRESSIVE: 1, - MATCH_MODE_STICKY: 2 - }, - ScanMode: { - SCAN_MODE_NONE: 0, - SCAN_MODE_CONNECTABLE: 1, - SCAN_MODE_GENERAL_DISCOVERABLE: 2, - SCAN_MODE_LIMITED_DISCOVERABLE: 3, - SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE: 4, - SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE: 5 - }, - SppType: { - SPP_RFCOMM: 0 - } - } - global.ohosplugin.bluetooth.BLE = { - createGattServer: function () { - console.warn("bluetooth.BLE.createGattServer interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return GattServerMock - }, - createGattClientDevice: function (...args) { - console.warn("bluetooth.BLE.createGattClientDevice interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return GattClientDeviceMock - }, - getConnectedBLEDevices: function () { - console.warn("bluetooth.BLE.getConnectedBLEDevices interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - return connectedBLEDevicesMock - }, - startBLEScan: function (...args) { - console.warn("bluetooth.BLE.startBLEScan interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - stopBLEScan: function () { - console.warn("bluetooth.BLE.stopBLEScan interface mocked in the Previewer." + - "How this interface works on the Previewer may be different from that on a real device.") - }, - on: function (...args) { - console.warn("bluetooth.BLE.on 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') { - if (args[0] == 'BLEDeviceFind') { - args[len - 1].call(this, [scanResultMock]); - } - } - }, - off: function (...args) { - console.warn("bluetooth.BLE.off 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') { - if (args[0] == 'BLEDeviceFind') { - args[len - 1].call(this, [scanResultMock]); - } - } - }, - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/bundleManager.js b/runtime/main/extend/systemplugin/ohos/bundleManager.js deleted file mode 100644 index 642f67cc..00000000 --- a/runtime/main/extend/systemplugin/ohos/bundleManager.js +++ /dev/null @@ -1,1532 +0,0 @@ -/* - * Copyright (c) 2021 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 { PixelMapMock } from "../multimedia" - -export function mockBundleManager() { - - const ArrayNumberMock = ["[PC preview] unknown array number"] - const ArrayStringMock = ["[PC preview] unknown array string"] - const LauncherAbilityInfosMock = [ - { - abilityInfo: { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - 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", - }, - } - ] - }, - }, - elementName: { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - shortName: "[PC preview] unknown short name", - }, - userId: "[PC preview] unknown user id", - installTime: "[PC preview] unknown install time", - }, - ] - const ModeleUsageRecordsMock = [ - { - bundleName: "[PC preview] unknown bundle name", - appLabelId: "[PC preview] unknown app label id", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - abilityName: "[PC preview] unknown ability name", - abilityLabelId: "[PC preview] unknown ability label id", - abilityDescriptionId: "[PC preview] unknown ability description id", - abilityIconId: "[PC preview] unknown ability icon id", - launchedCount: "[PC preview] unknown launched count", - lastLaunchTime: "[PC preview] unknown last launch time", - isRemoved: "[PC preview] unknown is removed", - installationFreeSupported: "[PC preview] unknown installation free supported", - }, - ] - const ShortcutInfosMock = [ - { - id: "[PC preview] unknown id", - bundleName: "[PC preview] unknown bundle name", - hostAbility: "[PC preview] unknown host ability", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - disableMessage: "[PC preview] unknown disable message", - wants: [ - { - targetBundle: "[PC preview] unknown target bundle", - targetClass: "[PC preview] unknown target class", - }], - isStatic: "[PC preview] unknown is static", - isHomeShortcut: "[PC preview] unknown is home shortcut", - isEnabled: "[PC preview] unknown is enabled", - }, - ] - const WantMock = { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - type: "[PC preview] unknown type", - action: "[PC preview] unknown action", - entities: "[PC preview] unknown entities", - flags: "[PC preview] unknown flags", - } - const BundleInstallerMock = {} - const BundleInfoMock = { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - appId: "[PC preview] unknown app id", - uid: "[PC preview] unknown uid", - installTime: "[PC preview] unknown install time", - updateTime: "[PC preview] unknown up date time", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - 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", - usedScene: { - abilities: ["[PC preview] unknown ability"], - when: "[PC preview] unknown when", - } - } - ], - 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", - hapModuleInfo: [ - { - name: "[PC preview] unknown name", - description: "[PC preview] unknown desciption", - descriptionId: "[PC preview] unknown description id", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown iconid", - backgroundImg: "[PC preview] unknown back ground img", - supportedModes: "[PC preview] unknown supported modes", - reqCapabilities: ["[PC preview] unknown reqcapability"], - deviceTypes: ["[PC preview] unknown device type"], - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown back ground modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: " [PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: " [PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability "], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - 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 module name", - mainAbilityName: "[PC preview] unknown main ability name", - installationFree: "[PC preview] unknown installation free", - } - ], - entryModuleName: "[PC preview] unknown entry module name", - cpuAbi: "[PC preview] unknown cpu abi", - isSilentInstallation: "[PC preview] unknown is silent installation", - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - entryInstallationFree: "[PC preview] unknown entry installation free", - } - const PermissionDefMock = { - name: "[PC preview] unknown name", - permissionFlags: "[PC preview] unknown permission flags", - grantMode: "[PC preview] unknown grant mode", - availableScope: "[PC preview] unknown available scope", - labelRes: "[PC preview] unknown label res", - descriptionRes: "[PC preview] unknown description res", - group: "[PC preview] unknown group", - usageInfo: "[PC preview] unknown usage info", - reminderDesc: "[PC preview] unknown reminder desc", - reminderIcon: "[PC preview] unknown reminder icon" - } - const PermissionDefsMock = [ - { - name: "[PC preview] unknown name", - permissionFlags: "[PC preview] unknown permission flags", - grantMode: "[PC preview] unknown grant mode", - availableScope: "[PC preview] unknown available scope", - labelRes: "[PC preview] unknown label res", - descriptionRes: "[PC preview] unknown description res", - group: "[PC preview] unknown group", - usageInfo: "[PC preview] unknown usage info", - reminderDesc: "[PC preview] unknown reminder desc", - reminderIcon: "[PC preview] unknown reminder icon" - } - ] - const BundlePackInfoMock = { - packages: [ - { - deviceType: ["[PC preview] unknown device type"], - name: "[PC preview] unknown name", - moduleType: "[PC preview] unknown module type", - deliveryWithInstall: "[PC preview] unknown deliver with install", - } - ], - summary: { - app: { - bundleName: "[PC preview] unknown bundle name", - version: { - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - name: "[PC preview] unknown name", - code: " [PC preview] unknown code", - } - }, - modules: [ - { - apiVersion: { - releaseType: "[PC preview] unknown release type", - compatible: "[PC preview] unknown compatible", - target: "[PC preview] unknown target", - }, - deviceType: ["[PC preview] unknown device type"], - distro: { - deliveryWithInstall: "[PC preview] unknown deliver with install", - installationFree: "[PC preview] unknown installation free", - moduleName: "[PC preview] unknown module name", - moduleType: "[PC preview] unknown module type", - mainAbility: "[PC preview] unknown main ability", - }, - 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 update enabled", - scheduledUpateTime: "[PC preview] unknown scheduled updte time", - updateDuration: "[PC preview] unknown update duration", - supportDimensions: ["[PC preview] unknown support dimension"], - defaultDimension: "[PC preview] unknown default dimension", - } - ] - } - ] - } - ] - }, - } - const ApplicationInfosMock = [ - { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - - const AbilityInfosMock = [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown descrption", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes ", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: "[PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: "[PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entitty", - minFormHeight: "[PC preview] unknown minForm Height", - defaultFormHeight: "[PC preview] unknown default Form Height", - minFormWidth: "[PC preview] unknown default min Form Width", - defaultFormWidth: "[PC preview] unknown default form width", - 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", - }, - } - ] - }, - } - ] - const AbilityInfoMock = { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown descrption", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes ", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: "[PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: "[PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entitty", - minFormHeight: "[PC preview] unknown minForm Height", - defaultFormHeight: "[PC preview] unknown default Form Height", - minFormWidth: "[PC preview] unknown default min Form Width", - defaultFormWidth: "[PC preview] unknown default form width", - 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", - }, - } - ] - }, - } - const ApplicationInfoMock = { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - - const BundleInfosMock = [ - { - name: "[PC preview] unknown name", - type: "[PC preview] unknown type", - appId: "[PC preview] unknown app id", - uid: "[PC preview] unknown uid", - installTime: "[PC preview] unknown install time", - updateTime: "[PC preview] unknown up date time", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - 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", - usedScene: { - abilities: ["[PC preview] unknown ability"], - when: "[PC preview] unknown when", - } - } - ], - 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", - hapModuleInfo: [ - { - name: "[PC preview] unknown name", - description: "[PC preview] unknown desciption", - descriptionId: "[PC preview] unknown description id", - icon: "[PC preview] unknown icon", - label: "[PC preview] unknown label", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown iconid", - backgroundImg: "[PC preview] unknown back ground img", - supportedModes: "[PC preview] unknown supported modes", - reqCapabilities: ["[PC preview] unknown reqcapability"], - deviceTypes: ["[PC preview] unknown device type"], - abilityInfo: [ - { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown back ground modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown bundle.AbilityType", - subType: " [PC preview] unknown bundle.AbilitySubType", - orientation: "[PC preview] unknown bundle.DisplayOrientation", - launchMode: " [PC preview] unknown bundle.LaunchMode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability "], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - defaultFormWidth: "[PC preview] unknown default form width", - 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 module name", - mainAbilityName: "[PC preview] unknown main ability name", - installationFree: "[PC preview] unknown installation free", - } - ], - entryModuleName: "[PC preview] unknown entry module name", - cpuAbi: "[PC preview] unknown cpu abi", - isSilentInstallation: "[PC preview] unknown is silent installation", - minCompatibleVersionCode: "[PC preview] unknown min compatible version code", - entryInstallationFree: "[PC preview] unknown entry installation free" - } - ] - const BundleOptionsMock = { - userId: "[PC preview] unknown user id", - networkId: "[PC preview] unknown network id", - } - const LauncherAbilityInfoMock = { - abilityInfo: { - bundleName: "[PC preview] unknown bundle name", - name: "[PC preview] unknown name", - label: "[PC preview] unknown label", - description: "[PC preview] unknown description", - icon: "[PC preview] unknown icon", - labelId: "[PC preview] unknown label id", - descriptionId: "[PC preview] unknown description id", - iconId: "[PC preview] unknown icon id", - moduleName: "[PC preview] unknown module name", - process: "[PC preview] unknown process", - targetAbility: "[PC preview] unknown target ability", - backgroundModes: "[PC preview] unknown background modes", - isVisible: "[PC preview] unknown is visible", - formEnabled: "[PC preview] unknown form enabled", - type: "[PC preview] unknown type", - subType: "[PC preview] unknown sub type", - orientation: "[PC preview] unknown orientation", - launchMode: "[PC preview] unknown launch mode", - permissions: ["[PC preview] unknown permission"], - deviceTypes: ["[PC preview] unknown device type"], - deviceCapabilities: ["[PC preview] unknown device capability"], - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - applicationInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - formEntity: "[PC preview] unknown form entity", - minFormHeight: "[PC preview] unknown min form height", - defaultFormHeight: "[PC preview] unknown default form height", - minFormWidth: "[PC preview] unknown min form width", - 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", - }, - } - ] - }, - }, - elementName: { - deviceId: "[PC preview] unknown device id", - bundleName: "[PC preview] unknown bundle name", - abilityName: "[PC preview] unknown ability name", - uri: "[PC preview] unknown uri", - shortName: "[PC preview] unknown short name", - }, - userId: "[PC preview] unknown user id", - installTime: "[PC preview] unknown install time", - } - -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: "[PC preview] unknown extension abilityType", - permissions: "[PC preview] unknown permissions", - applicationInfo: "[PC preview] unknown application info", - metadata: "[PC preview] unknown metadata", - enabled: "[PC preview] unknown enabled", - readPermission: "[PC preview] unknown read permission", - writePermission: "[PC preview] unknown write permission", - } -] - - const ModuleUpdateFlagMock = { - FLAG_MODULE_UPGRADE_CHECK: 0, - FLAG_MODULE_UPGRADE_INSTALL: 1, - FLAG_MODULE_UPGRADE_INSTALL_WITH_CONFIG_WINDOWS: 2, - } - const BundleFlagMock = { - 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, - } - const ColorModeMock = { - AUTO_MODE: -1, - DARK_MODE: 0, - LIGHT_MODE: 1, - } - const ModuleRemoveFlagMock = { - FLAG_MODULE_NOT_USED_BY_FORM: 0, - FLAG_MODULE_USED_BY_FORM: 1, - FLAG_MODULE_NOT_USED_BY_SHORTCUT: 2, - FLAG_MODULE_USED_BY_SHORTCUT: 3, - } - const SignatureCompareResultMock = { - SIGNATURE_MATCHED: 0, - SIGNATURE_NOT_MATCHED: 1, - SIGNATURE_UNKNOWN_BUNDLE: 2, - } - const ShortcutExistenceMock = { - SHORTCUT_EXISTENCE_EXISTS: 0, - SHORTCUT_EXISTENCE_NOT_EXISTS: 1, - SHORTCUT_EXISTENCE_UNKNOWN: 2, - } - const QueryShortCutFlagMock = { - QUERY_SHORYCUT_HOME: 0, - } - const GrantStatusMock = { - PERMISSION_DENIED: -1, - PERMISSION_GRANTED: 0, - } - const AbilityTypeMock = { - UNKNOWN: 0, - PAGE: 1, - SERVICE: 2, - DATA: 3 - } - const AbilitySubTypeMock = { - UNSPECIFIED: 0, - CA: 1, - } - const DisplayOrientationMock = { - UNSPECIFIED: 0, - LANDSCAPE: 1, - PORTRAIT: 2, - FOLLOW_RECENT: 3 - } - const LaunchModeMock = { - SINGLETON: 0, - STANDARD: 1, - } - const InstallErrorCodeMock = { - 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_BLOCKE: 8, - STATUS_UNINSTALL_FAILURE_ABORTED: 9, - STATUS_UNINSTALL_FAILURE_CONFLICT: 10, - STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT: 0x0B, - STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED: 0x0C, - STATUS_ABILITY_NOT_FOUND: 0x40, - STATUS_BMS_SERVICE_ERROR: 0x41 - } - const BundleErrorMock = { - REMOTE_EXCEPTION: 0, - SECURITY_EXCEPTION: 1 - } - - global.ohosplugin.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) - } else { - return new Promise((resolve) => { - resolve(BundleInfoMock) - }); - } - }, - getBundleInstaller: function (...args) { - console.warn("bundle.getBundleInstaller 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, BundleInstallerMock) - } else { - return new Promise((resolve) => { - resolve(BundleInstallerMock) - }); - } - }, - getApplicationInfo: function (...args) { - console.warn("bundle.getApplicationInfo 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, ApplicationInfoMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfoMock) - }); - } - }, - queryAbilityByWant: function (...args) { - console.warn("bundle.queryAbilityByWant 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, AbilityInfosMock) - } else { - return new Promise((resolve) => { - resolve(AbilityInfosMock) - }); - } - }, - getAllBundleInfo: function (...args) { - console.warn("bundle.getAllBundleInfo 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, BundleInfosMock) - } else { - return new Promise((resolve) => { - resolve(BundleInfosMock) - }); - } - }, - getBundlesForUid: function (...args) { - console.warn("bundle.getBundlesForUid 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, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - getAllApplicationInfo: function (...args) { - console.warn("bundle.getAllApplicationInfo 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, ApplicationInfosMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfosMock) - }); - } - }, - getSystemAvailableCapabilities: function (...args) { - console.warn("bundle.getSystemAvailableCapabilities 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, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - hasSystemCapability: function (...args) { - console.warn("bundle.hasSystemCapability 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) - }); - } - }, - getBundleGids: function (...args) { - console.warn("bundle.getBundleGids 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, ArrayNumberMock) - } else { - return new Promise((resolve) => { - resolve(ArrayNumberMock) - }); - } - }, - checkPublicKeys: function (...args) { - console.warn("bundle.checkPublicKeys 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, SignatureCompareResultMock.SIGNATURE_MATCHED) - } else { - return new Promise((resolve) => { - resolve(SignatureCompareResultMock.SIGNATURE_MATCHED) - }); - } - }, - 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) - }); - } - }, - getBundleArchiveInfo: function (...args) { - console.warn("bundle.getBundleArchiveInfo 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) - } else { - return new Promise((resolve) => { - resolve(BundleInfoMock) - }); - } - }, - isSafeMode: function (...args) { - console.warn("bundle.isSafeMode 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) - }); - } - }, - getLaunchWantForBundle: function (...args) { - console.warn("bundle.getLaunchWantForBundle 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, WantMock) - } else { - return new Promise((resolve) => { - resolve(WantMock) - }); - } - }, - setApplicationEnabled: function (...args) { - console.warn("bundle.setApplicationEnabled 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - setAbilityEnabled: function (...args) { - console.warn("bundle.setAbilityEnabled 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - 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) - }); - } - }, - 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) - }); - } - }, - cleanBundleCacheFiles: function (...args) { - console.warn("bundle.cleanBundleCacheFiles 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - startShortcut: function (...args) { - console.warn("bundle.startShortcut 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getAppType: function (...args) { - console.warn("bundle.getAppType 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) - }); - } - }, - isShortcutExist: function (...args) { - console.warn("bundle.isShortcutExist 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, ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) - } else { - return new Promise((resolve) => { - resolve(ShortcutExistenceMock.SHORTCUT_EXISTENCE_EXISTS) - }); - } - }, - isHomeShortcutSupported: function (...args) { - console.warn("bundle.isHomeShortcutSupported 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) - }); - } - }, - addHomeShortcut: function (...args) { - console.warn("bundle.addHomeShortcut 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - updateShortcuts: function (...args) { - console.warn("bundle.updateShortcuts 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - disableHomeShortcuts: function (...args) { - console.warn("bundle.disableHomeShortcuts 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - enableHomeShortcuts: function (...args) { - console.warn("bundle.enableHomeShortcuts 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getAllHomeShortcutInfo: function (...args) { - console.warn("bundle.getAllHomeShortcutInfo 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, ShortcutInfosMock) - } else { - return new Promise((resolve) => { - resolve(ShortcutInfosMock) - }); - } - }, - getAppsGrantedPermissions: function (...args) { - console.warn("bundle.getAppsGrantedPermissions 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, ArrayStringMock) - } else { - return new Promise((resolve) => { - resolve(ArrayStringMock) - }); - } - }, - 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, PixelMapMock) - } else { - return new Promise((resolve) => { - resolve(PixelMapMock) - }); - } - }, - 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) - }); - } - }, - getClearUserDataFlag: function (...args) { - console.warn("bundle.getClearUserDataFlag 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) - }); - } - }, - setClearUserDataFlag: function (...args) { - console.warn("bundle.setClearUserDataFlag 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) - } else { - return new Promise((resolve) => { - resolve() - }); - } - }, - getBundlePackInfo: function (...args) { - console.warn("bundle.getBundlePackInfo 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, BundlePackInfoMock) - } else { - return new Promise((resolve) => { - resolve(BundlePackInfoMock) - }); - } - }, - getAbilityList: function (...args) { - console.warn("bundle.getAbilityList 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, LauncherAbilityInfosMock) - } else { - return new Promise((resolve) => { - resolve(LauncherAbilityInfosMock) - }); - } - }, - 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[0] === 'string') { - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, AbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(AbilityInfoMock) - }); - } - } else if (typeof args[0] === 'object') { - if (typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, LauncherAbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(LauncherAbilityInfoMock) - }); - } - } - }, - isBundleEnabled: function (...args) { - console.warn("bundle.isBundleEnabled 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) - }); - } - }, - 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, PermissionDefMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefMock) - }); - } - }, - getPermissionGroupDef: function (...args) { - console.warn("bundle.getPermissionGroupDef 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, PermissionDefMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefMock) - }); - } - }, - getAllPermissionGroupDefs: function (...args) { - console.warn("bundle.getAllPermissionGroupDefs 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, PermissionDefsMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefsMock) - }); - } - }, - getPermissionDefByGroup: function (...args) { - console.warn("bundle.getPermissionDefByGroup 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, PermissionDefsMock) - } else { - return new Promise((resolve) => { - resolve(PermissionDefsMock) - }); - } - }, - getModuleUsageRecords: function (...args) { - console.warn("bundle.getModuleUsageRecords 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,ModeleUsageRecordsMock) - } else { - return new Promise((resolve) => { - resolve(ModeleUsageRecordsMock) - }); - } - }, - queryExtensionAbilityInfosByWant: function (...args) { - console.warn("bundle.queryExtensionAbilityInfosByWant 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,ExtensionAbilityInfoMock) - } else { - return new Promise((resolve) => { - resolve(ExtensionAbilityInfoMock) - }); - } - } - } -} diff --git a/runtime/main/extend/systemplugin/ohos/commonEvent.js b/runtime/main/extend/systemplugin/ohos/commonEvent.js deleted file mode 100644 index 097fc26b..00000000 --- a/runtime/main/extend/systemplugin/ohos/commonEvent.js +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2021 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 mockCommonEvent() { - const CommonEventSubscriberMock = { - getCode: function (...args) { - console.warn("CommonEventSubscriber.getCode 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.paramNumberMock); - } else { - return new Promise((resolve) => { - resolve(paramMock.paramNumberMock); - }); - } - }, - setCode: function (...args) { - console.warn("CommonEventSubscriber.setCode 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getData: function (...args) { - console.warn("CommonEventSubscriber.getData 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); - }); - } - }, - setData: function (...args) { - console.warn("CommonEventSubscriber.setData 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - setCodeAndData: function (...args) { - console.warn("CommonEventSubscriber.setCodeAndData 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - isOrderedCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.isOrderedCommonEvent 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); - }); - } - }, - isStickyCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.isStickyCommonEvent 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); - }); - } - }, - abortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.abortCommonEvent 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - clearAbortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.clearAbortCommonEvent 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); - } else { - return new Promise((resolve) => { - resolve(); - }); - } - }, - getAbortCommonEvent: function (...args) { - console.warn("CommonEventSubscriber.getAbortCommonEvent 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); - }); - } - }, - getSubscribeInfo: function (...args) { - console.warn("CommonEventSubscriber.getSubscribeInfo 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, CommonEventSubscribeInfoMock); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscribeInfoMock); - }); - } - } - } - const CommonEventDataMock = { - event: '[PC preview] unknow event', - bundleName: '[PC preview] unknow bundleName', - code: '[PC preview] unknow code', - data: '[PC preview] unknow data', - parameters: '[PC preview] unknow parameters', - } - const CommonEventSubscribeInfoMock = { - events: '[PC preview] unknow events', - publisherPermission: '[PC preview] unknow publisherPermission', - publisherDeviceId: '[PC preview] unknow publisherDeviceId', - userId: '[PC preview] unknow userId', - priority: '[PC preview] unknow priority', - } - global.ohosplugin.commonEvent = { - publish: function (...args) { - console.warn("commonEvent.publish 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); - } - }, - createSubscriber: function (...args) { - console.warn("commonEvent.createSubscriber 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, CommonEventSubscriberMock); - } else { - return new Promise((resolve) => { - resolve(CommonEventSubscriberMock); - }); - } - }, - subscribe: function (...args) { - console.warn("commonEvent.subscribe 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, CommonEventDataMock); - } - }, - unsubscribe: function (...args) { - console.warn("commonEvent.unsubscribe 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); - } - }, - } - -} diff --git a/runtime/main/extend/systemplugin/ohos/inputMonitor.js b/runtime/main/extend/systemplugin/ohos/inputMonitor.js deleted file mode 100644 index eb730cc1..00000000 --- a/runtime/main/extend/systemplugin/ohos/inputMonitor.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2021 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 mockInputMonitor() { - const touches = [{ - force: 1.67, - globalX: 122, - globalY: 3654, - localX: 0, - localY: 0, - size: 2.03 - }]; - const changedTouches = [{ - force: 1.67, - globalX: 122, - globalY: 3654, - localX: 0, - localY: 0, - size: 2.03 - }]; - const pressedButtons = [10, 11 , 12, 13, 14]; - global.systemplugin.multimodalInput = {}; - global.systemplugin.multimodalInput.inputMonitor = { - on: function (...args) { - console.warn('multimodalInput.inputMonitor.on interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - clearInterval(this.offInputMonitor); - delete this.offInputMonitor; - this.offInputMonitor = setInterval(() => { - const len = args.length; - if (len !== 2 || typeof args[0] !== 'string' || typeof args[len - 1] !== 'function') { - console.warn('multimodalInput.inputMonitor.on param invalid.'); - return; - } - if (args[0] !== 'touch' && args[0] !== 'mouse') { - console.warn('multimodalInput.inputMonitor.on first param should be touch or mouse.'); - return; - } - const value = {}; - value.type = 'up'; - value.timestamp = 318878; - value.deviceId = 0; - value.touches = touches; - value.changedTouches = changedTouches; - const mouse = {}; - mouse.type = 'move'; - mouse.pressedButtons = pressedButtons; - mouse.displayId = 20; - mouse.targetWindowId = 21; - mouse.agentWindowId = 22; - mouse.localX = 450; - mouse.localY = 736; - mouse.globalX = 450; - mouse.globalY = 784; - mouse.timestamp = 55670246; - mouse.axisVerticalValue = 15; - mouse.axisHorizontalValue = 20; - if (args[0] === 'touch') { - console.warn('multimodalInput.inputMonitor.on touch callback.'); - args[len - 1].call(this, value); - } else if (args[0] === 'mouse') { - console.warn('multimodalInput.inputMonitor.on mouse callback.'); - args[len - 1].call(this, mouse); - } - }, 1000); - }, - - off: function (...args) { - console.warn('multimodalInput.inputMonitor.off interface mocked in the Previewer. How this interface works on the' + - ' Previewer may be different from that on a real device.'); - clearInterval(this.offInputMonitor); - delete this.offInputMonitor; - } - }; -} - diff --git a/runtime/main/extend/systemplugin/ohos/packageManager.js b/runtime/main/extend/systemplugin/ohos/packageManager.js deleted file mode 100644 index 1eafe6b6..00000000 --- a/runtime/main/extend/systemplugin/ohos/packageManager.js +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2021 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 mockPackageManager() { - const PackageFlagMock = { - DEFAULT: 0x00000000, - GET_ACTIVITIES: 0x00000001, - GET_META_DATA: 0x00000080, - MATCH_UNINSTALLED_PACKAGES: 0x00002000, - MATCH_ALL: 0x00020000 - } - const PackageErrorMock = { - NAME_NOT_FOUND_EXCEPTION: 0 - } - const ApplicationInfosMock = [ - { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - const ApplicationInfoMock = { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - const ApplicationFlagMock = { - FLAG_SYSTEM: 0x0000000001, - FLAG_IS_DATA_ONLY: 0x1000000000, - } - const PackageInfoMock = { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name ", - lastUpdateTime: "[PC preview] unknown last update time", - versionCode: "[PC preview] unknown version code", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - } - const PackageInfosMock = [ - { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name ", - lastUpdateTime: "[PC preview] unknown last update time", - versionCode: "[PC preview] unknown version code", - appInfo: { - packageName: "[PC preview] unknown package name", - className: "[PC preview] unknown class name", - name: "[PC preview] unknown name", - labelId: "[PC preview] unknown label id", - iconId: "[PC preview] unknown icon id", - sourceDir: "[PC preview] unknown source dir", - flags: "[PC preview] unknown flags", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - }, - ] - - const CustomizeDataMock = { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - const BundleErrorMock = { - REMOTE_EXCEPTION: 0, - SECURITY_EXCEPTION: 1 - } - const ActivityInfoMock = { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name", - iconId: "[PC preview] unknown icon id", - labelId: "[PC preview] unknown label id", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - } - const ActivityInfosMock = [ - { - packageName: "[PC preview] unknown package name", - name: "[PC preview] unknown name", - iconId: "[PC preview] unknown icon id", - labelId: "[PC preview] unknown label id", - customizeData: { - key: "[PC preview] unknown key", - value: { - CustomizeData: { - name: "[PC preview] unknown name", - value: "[PC preview] unknown value", - } - } - } - }, - ] - const ComponentNameMock = { - package: "[PC preview] unknown package", - name: "[PC preview] unknown name", - } - global.ohosplugin.package = { - getApplicationInfo: function (...args) { - console.warn("PackageManger.getApplicationInfo 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, ApplicationInfoMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfoMock) - }); - } - }, - getInstalledApplications: function (...args) { - console.warn("PackageManger.getInstalledApplications 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, ApplicationInfosMock) - } else { - return new Promise((resolve) => { - resolve(ApplicationInfosMock) - }); - } - }, - getPackageInfo: function (...args) { - console.warn("PackageManger.getPackageInfo 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, PackageInfoMock) - } else { - return new Promise((resolve) => { - resolve(PackageInfoMock) - }); - } - }, - getInstalledPackages: function (...args) { - console.warn("PackageManger.getInstalledPackages 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, PackageInfosMock) - } else { - return new Promise((resolve) => { - resolve(PackageInfosMock) - }); - } - }, - getActivityInfo: function (...args) { - console.warn("PackageManger.getActivityInfo 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, ActivityInfoMock) - } else { - return new Promise((resolve) => { - resolve(ActivityInfoMock) - }); - } - }, - getActivityList: function (...args) { - console.warn("PackageManger.getActivityList 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, ActivityInfosMock) - } else { - return new Promise((resolve) => { - resolve(ActivityInfosMock) - }); - } - }, - } -} diff --git a/runtime/main/extend/systemplugin/ohos/request.js b/runtime/main/extend/systemplugin/ohos/request.js deleted file mode 100644 index f1f69503..00000000 --- a/runtime/main/extend/systemplugin/ohos/request.js +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2021 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"; - -const NOTIFY = "[PC Preview] unknow" -const Properties = [ - 'NETWORK_MOBILE', - 'NETWORK_WIFI', - 'ERROR_CANNOT_RESUME', - 'ERROR_DEVICE_NOT_FOUND', - 'ERROR_FILE_ALREADY_EXISTS', - 'ERROR_FILE_ERROR', - 'ERROR_HTTP_DATA_ERROR', - 'ERROR_INSUFFICIENT_SPACE', - 'ERROR_TOO_MANY_REDIRECTS', - 'ERROR_UNHANDLED_HTTP_CODE', - 'ERROR_UNKNOWN', - 'PAUSED_QUEUED_FOR_WIFI', - 'PAUSED_UNKNOWN', - 'PAUSED_WAITING_FOR_NETWORK', - 'PAUSED_WAITING_TO_RETRY', - 'SESSION_FAILED', - 'SESSION_PAUSED', - 'SESSION_PENDING', - 'SESSION_RUNNING', - 'SESSION_SUCCESSFUL' -] - -export function mockOhosRequest() { - const ErrorMock = { - ERROR_HTTP_DATA_ERROR: 501, - ERROR_DEVICE_NOT_FOUND: 502, - ERROR_UNHANDLED_HTTP_CODE: 503, - ERROR_INSUFFICIENT_SPACE: 504, - ERROR_TOO_MANY_REDIRECTS: 505, - ERROR_CANNOT_RESUME: 506, - ERROR_FILE_ALREADY_EXISTS: 507, - ERROR_FILE_ERROR: 508, - ERROR_UNKNOWN: 509 - } - const PauseMock = { - PAUSED_WAITING_TO_RETRY: 301, - PAUSED_WAITING_FOR_NETWORK: 302, - PAUSED_QUEUED_FOR_WIFI: 303, - PAUSED_UNKNOWN: 304, - } - const SessionMock = { - SESSION_PENDING: 1, - SESSION_RUNNING: 2, - SESSION_PAUSED: 4, - SESSION_SUCCESSFUL: 8, - SESSION_FAILED: 16, - } - const downloadInfo = { - downloadId: 1, - failedReason: ErrorMock, - fileName: "[PC preview] unknown file name", - filePath: "[PC preview] unknown file path", - pausedReason: PauseMock, - status: SessionMock, - targetURI: "[PC preview] unknown targetURI", - downloadTitle: "[PC preview] unknown download title", - downloadTotalBytes: 1024, - description: "[PC preview] unknown description", - downloadedBytes: 1 - } - const DownloadTaskMock = { - on: function (...args) { - console.warn("DownloadTask.on 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') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'fail') { - args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); - } - } - }, - off: function (...args) { - console.warn("DownloadTask.off 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') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'complete' || args[0] == 'pause' || args[0] == 'remove') { - args[len - 1].call(this, paramMock.businessErrorMock); - } else if (args[0] == 'fail') { - args[len - 1].call(this, paramMock.businessErrorMock, ErrorMock); - } - } - }, - remove: function (...args) { - console.warn("DownloadTask.remove 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - }, - pause: function (...args) { - console.warn("DownloadTask.pause 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - resume: function (...args) { - console.warn("DownloadTask.resume 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); - } else { - return new Promise((resolve, reject) => { - resolve(); - }) - } - }, - queryMimeType: function (...args) { - console.warn("DownloadTask.queryMimeType 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, reject) => { - resolve(paramMock.paramStringMock); - }) - } - }, - query: function (...args) { - console.warn("DownloadTask.query 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, downloadInfo); - } else { - return new Promise((resolve, reject) => { - resolve(downloadInfo); - }) - } - } - } - const UploadTaskMock = { - on: function (...args) { - console.warn("UploadTask.on 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') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'headerReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } - } - }, - off: function (...args) { - console.warn("UploadTask.off 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') { - if (args[0] == 'progress') { - args[len - 1].call(this, paramMock.paramNumberMock, paramMock.paramNumberMock); - } else if (args[0] == 'headerReceive') { - args[len - 1].call(this, paramMock.paramObjectMock); - } - } - }, - remove: function (...args) { - console.warn("UploadTask.remove 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, reject) => { - resolve(paramMock.paramBooleanMock); - }) - } - } - } - global.ohosplugin.request = { - download: function (...args) { - console.warn("ohos.request.download 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, DownloadTaskMock); - } else { - return new Promise((resolve, reject) => { - resolve(DownloadTaskMock); - }) - } - }, - upload: function (...args) { - console.warn("ohos.request.upload 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, UploadTaskMock); - } else { - return new Promise((resolve, reject) => { - resolve(UploadTaskMock); - }) - } - } - } - - for (let property of Properties) { - global.ohosplugin.request[property] = NOTIFY + " " + property - } -} diff --git a/runtime/main/extend/systemplugin/ohos/storageInfoManager.js b/runtime/main/extend/systemplugin/ohos/storageInfoManager.js deleted file mode 100644 index 4268f844..00000000 --- a/runtime/main/extend/systemplugin/ohos/storageInfoManager.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2021 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 mockStorageInfoManager() { - const infoMock = { - storageInfo: { - appSize: 472897, - cacheSize: 483, - dataSize: 32543 - }, - totalSize: 12800000, - freeSize: 23700000, - } - global.ohosplugin.storageInfoManager = { - queryInfoByPackageName: function (...args) { - console.warn("storageInfoManager.queryInfoByPackageName 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, infoMock.storageInfo); - } else { - return new Promise((resolve) => { - resolve(infoMock.storageInfo); - }) - } - }, - getTotalSize: function (...args) { - console.warn("storageInfoManager.getTotalSize 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, infoMock.totalSize); - } else { - return new Promise((resolve) => { - resolve(infoMock.totalSize); - }) - } - }, - getFreeSize: function (...args) { - console.warn("storageInfoManager.getFreeSize 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, infoMock.freeSize); - } else { - return new Promise((resolve) => { - resolve(infoMock.freeSize); - }) - } - }, - queryInfoByUid: function (...args) { - console.warn("storageInfoManager.queryInfoByUid 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, infoMock.storageInfo); - } else { - return new Promise((resolve) => { - resolve(infoMock.storageInfo); - }) - } - }, - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js b/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js deleted file mode 100644 index 72eda57f..00000000 --- a/runtime/main/extend/systemplugin/ohos/userIAMuserAuth.js +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2021 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 mockUserIAMUserAuth() { - const AuthenticationResult = { - NO_SUPPORT: -1, - SUCCESS: 0, - COMPARE_FAILURE: 1, - CANCELED: 2, - TIMEOUT: 3, - CAMERA_FAIL: 4, - BUSY: 5, - INVALID_PARAMETERS: 6, - LOCKED: 7, - NOT_ENROLLED: 8, - GENERAL_ERROR: 100, - } - - const CheckAvailabilityResult = { - SUPPORTED: 0, - AUTH_TYPE_NOT_SUPPORT: 1, - SECURE_LEVEL_NOT_SUPPORT: 2, - DISTRIBUTED_AUTH_NOT_SUPPORT: 3, - NOT_ENROLLED: 4, - PARAM_NUM_ERROR: 5, - } - - const TipEvent = { - RESULT: 1, - CANCEL: 2, - ACQUIRE: 3, - BUSY: 4, - OUT_OF_MEM: 5, - FACE_ID: 6, - } - - const TipCode = { - FACE_AUTH_TIP_TOO_BRIGHT: 1, - FACE_AUTH_TIP_TOO_DARK: 2, - FACE_AUTH_TIP_TOO_CLOSE: 3, - FACE_AUTH_TIP_TOO_FAR: 4, - FACE_AUTH_TIP_TOO_HIGH: 5, - FACE_AUTH_TIP_TOO_LOW: 6, - FACE_AUTH_TIP_TOO_RIGHT: 7, - FACE_AUTH_TIP_TOO_LEFT: 8, - FACE_AUTH_TIP_TOO_MUCH_MOTION: 9, - FACE_AUTH_TIP_POOR_GAZE: 10, - FACE_AUTH_TIP_NOT_DETECTED: 11, - } - - const Result = { - SUCCESS: 0, - FAILED: 1, - } - - function checkAuthParam(authType, secureLevel) { - if ((typeof authType !== 'string') || (["ALL", "FACE_ONLY"].indexOf(authType) < 0)) { - console.error('invalid authType'); - return CheckAvailabilityResult.AUTH_TYPE_NOT_SUPPORT; - } - - if ((typeof secureLevel !== 'string') || (["S1", "S2", "S3", "S4"].indexOf(secureLevel) < 0)) { - console.error('invalid secureLevel'); - return CheckAvailabilityResult.SECURE_LEVEL_NOT_SUPPORT; - } - - return Result.SUCCESS; - } - - let Authenticator = class { - constructor() { - } - - async execute(authType, secureLevel, callback) { - console.warn("Authenticator.execute interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - function handleCallback(callback, ret) { - if (typeof callback === 'function') { - callback(ret); - } else { - if (ret === 0) { - return ret; - } else { - throw ret; - } - } - } - - if (checkAuthParam(authType, secureLevel) != Result.SUCCESS) { - return handleCallback(callback, AuthenticationResult.INVALID_PARAMETERS); - } - - let successTip = { - "errorCode": Result.FAILED, - "tipEvent": TipEvent.RESULT, - "tipCode": AuthenticationResult.SUCCESS, - "tipInfo": "success", - }; - - for (let localCallback of userAuth.subscribeTipSet.values()) { - localCallback(successTip); - } - - // mock - return handleCallback(callback, AuthenticationResult.SUCCESS); - } - - checkAvailability(authType, secureLevel) { - console.warn("Authenticator.checkAvailability interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - let result = checkAuthParam(authType, secureLevel); - if (result != Result.SUCCESS) { - return result; - } - - // mock - return CheckAvailabilityResult.SUPPORTED; - } - - cancel() { - console.warn("Authenticator.cancel interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - - // mock - return Result.SUCCESS; - } - - async on(type, callback) { - console.warn("Authenticator.on interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - let errorTip = { - "errorCode": Result.FAILED, - "tipEvent": 0, - "tipCode": 0, - "tipInfo": "", - }; - - if (type !== 'tip') { - console.error('type is invalid') - callback(errorTip); - return; - } - - if (typeof callback !== 'function') { - console.error('callback parameter is invalid'); - callback(errorTip); - return; - } - - userAuth.subscribeTipSet.add(callback); - if (userAuth.subscribeToTip) { - console.log('already subscribe to event'); - return; - } - - // mock - userAuth.subscribeToTip = true; - console.info('subscribe success'); - } - - async off(type, optCallback) { - console.warn("Authenticator.off interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (type !== 'tip') { - console.error('type is invalid') - return; - } - - if (typeof optCallback === 'function') { - userAuth.subscribeTipSet.delete(optCallback); - } else { - userAuth.subscribeTipSet.clear(); - } - - if (!userAuth.subscribeToTip) { - console.info('not subscribing event, no need unsubscribe'); - return; - } - - if (userAuth.subscribeTipSet.size !== 0) { - console.info('subscriber is not 0, no need unsubscribe'); - return; - } - - // mock - userAuth.subscribeToTip = false; - console.info('unsubscribe success'); - } - } - - var userAuth = { - moduleGroup: null, - eventGroup: null, - authenticator: null, - subscribeToTip: false, - subscribeTipSet: new Set([]), - getAuthenticator: function getAuthenticator() { - console.warn("userAuth.getAuthenticator interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - if (this.authenticator == null) { - this.authenticator = new Authenticator() - } - return this.authenticator; - } - } - - global.systemplugin.userIAM = global.systemplugin.userIAM || {}; - global.systemplugin.userIAM.userAuth = { - getAuthenticator: userAuth.getAuthenticator, - AuthenticationResult: AuthenticationResult, - CheckAvailabilityResult: CheckAvailabilityResult, - TipEvent: TipEvent, - TipCode: TipCode, - Result: Result, - }; -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/sensor.js b/runtime/main/extend/systemplugin/sensor.js deleted file mode 100644 index 55fa3d8a..00000000 --- a/runtime/main/extend/systemplugin/sensor.js +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright (c) 2021 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 { getRandomArbitrary, hasComplete, paramMock } from './utils' - -export function mockSensor() { - global.systemplugin.sensor = {} - mockAccelerometer() - mockBarometer() - mockCompass() - mockDeviceOrientation() - mockGyroscope() - mockHeartRate() - mockLight() - mockOnBodyState() - mockProximity() - mockStepCounter() - mockGravity() - mockMagnetic() - mockHall() -} - -function mockAccelerometer() { - global.systemplugin.sensor.subscribeAccelerometer = function (...args) { - console.warn("sensor.subscribeAccelerometer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeAcc) - delete this.unsubscribeAcc - this.unsubscribeAcc = setInterval(() => { - ret.x = Math.ceil(Math.random() * 10) - ret.y = Math.ceil(Math.random() * 10) - ret.z = Math.ceil(Math.random() * 10) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeAccelerometer = function () { - console.warn("sensor.unsubscribeAccelerometer interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeAcc) - delete this.unsubscribeAcc - } -} - -function mockBarometer() { - global.systemplugin.sensor.subscribeBarometer = function (...args) { - console.warn("sensor.subscribeBarometer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribePressure) { - let ret = {} - this.unsubscribePressure = setInterval(() => { - ret.pressure = getRandomArbitrary(1110, 1111) - args[0].success(ret) - }, 500) - } - } - global.systemplugin.sensor.unsubscribeBarometer = function () { - console.warn("sensor.unsubscribeBarometer interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribePressure) - delete this.unsubscribePressure - } -} - -function mockCompass() { - global.systemplugin.sensor.subscribeCompass = function (...args) { - console.warn("sensor.subscribeCompass interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeDirection) { - let ret = {} - this.unsubscribeDirection = setInterval(() => { - ret.direction = getRandomArbitrary(49, 50) - args[0].success(ret) - }, 100) - } - } - global.systemplugin.sensor.unsubscribeCompass = function () { - console.warn("sensor.unsubscribeCompass interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeDirection) - delete this.unsubscribeDirection - } -} - -function mockGyroscope() { - global.systemplugin.sensor.subscribeGyroscope = function (...args) { - console.warn("sensor.subscribeGyroscope interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeGyr) - delete this.unsubscribeGyr - this.unsubscribeGyr = setInterval(() => { - ret.x = Math.ceil(Math.random() * 10) - ret.y = Math.ceil(Math.random() * 10) - ret.z = Math.ceil(Math.random() * 10) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeGyroscope = function () { - console.warn("sensor.unsubscribeGyroscope interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeGyr) - delete this.unsubscribeGyr - } -} - -function mockDeviceOrientation() { - global.systemplugin.sensor.subscribeDeviceOrientation = function (...args) { - console.warn("sensor.subscribeDeviceOrientation interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeDevOri) - delete this.unsubscribeDevOri - this.unsubscribeDevOri = setInterval(() => { - ret.alpha = Math.ceil(Math.random() * 10) - ret.beta = Math.ceil(Math.random() * 10) - ret.gamma = Math.ceil(Math.random() * 10) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeDeviceOrientation = function () { - console.warn("sensor.unsubscribeDeviceOrientation interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeDevOri) - delete this.unsubscribeDevOri - } -} - -function mockHeartRate() { - global.systemplugin.sensor.subscribeHeartRate = function (...args) { - console.warn("sensor.subscribeHeartRate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeRate) { - let ret = {} - this.unsubscribeRate = setInterval(() => { - ret.heartRate = Math.ceil(Math.random() * 30) - args[0].success(ret) - }, 500) - } - } - global.systemplugin.sensor.unsubscribeHeartRate = function () { - console.warn("sensor.unsubscribeHeartRate interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeRate) - delete this.unsubscribeRate - } -} - -function mockLight() { - global.systemplugin.sensor.subscribeLight = function (...args) { - console.warn("sensor.subscribeLight interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeIntensity) { - let ret = {} - this.unsubscribeIntensity = setInterval(() => { - ret.intensity = getRandomArbitrary(660, 680) - args[0].success(ret) - }, 500) - } - } - global.systemplugin.sensor.unsubscribeLight = function () { - console.warn("sensor.unsubscribeLight interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeIntensity) - delete this.unsubscribeIntensity - } -} - -function mockOnBodyState() { - global.systemplugin.sensor.subscribeOnBodyState = function (...args) { - console.warn("sensor.subscribeOnBodyState interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeBodyState) { - let ret = {} - this.unsubscribeBodyState = setInterval(() => { - ret.value = Math.ceil(Math.random() * 20) - args[0].success(ret) - }, 500) - } - } - global.systemplugin.sensor.unsubscribeOnBodyState = function () { - console.warn("sensor.unsubscribeOnBodyState interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeBodyState) - delete this.unsubscribeBodyState - } - global.systemplugin.sensor.getOnBodyState = function (...args) { - console.warn("sensor.getOnBodyState interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - let OnBodyStateResponseMock = { - value: paramMock.paramBooleanMock - } - args[0].success(OnBodyStateResponseMock) - hasComplete(args[0].complete) - } -} - -function mockProximity() { - global.systemplugin.sensor.subscribeProximity = function (...args) { - console.warn("sensor.subscribeProximity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeDistance) { - let ret = {} - this.unsubscribeDistance = setInterval(() => { - ret.distance = Math.ceil(Math.random() * 100) - args[0].success(ret) - }, 1000) - } - } - global.systemplugin.sensor.unsubscribeProximity = function () { - console.warn("sensor.unsubscribeProximity interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeDistance) - delete this.unsubscribeDistance - } -} - -function mockStepCounter() { - global.systemplugin.sensor.subscribeStepCounter = function (...args) { - console.warn("sensor.subscribeStepCounter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - if (!this.unsubscribeSteps) { - let ret = { steps: 0 } - this.unsubscribeSteps = setInterval(() => { - ret.steps += 1 - args[0].success(ret) - }, 1000) - } - } - global.systemplugin.sensor.unsubscribeStepCounter = function () { - console.warn("sensor.unsubscribeStepCounter interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeSteps) - delete this.unsubscribeSteps - } -} - -function mockGravity() { - global.systemplugin.sensor.subscribeGravity = function (...args) { - console.warn("sensor.subscribeGravity interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeGrav) - delete this.unsubscribeGrav - this.unsubscribeGrav = setInterval(() => { - ret.x = Math.ceil(Math.random() * 10) - ret.y = Math.ceil(Math.random() * 10) - ret.z = Math.ceil(Math.random() * 10) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeGravity = function () { - console.warn("sensor.unsubscribeGravity interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeGrav) - delete this.unsubscribeGrav - } -} - -function mockMagnetic() { - global.systemplugin.sensor.subscribeMagnetic = function (...args) { - console.warn("sensor.subscribeMagnetic interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeMag) - delete this.unsubscribeMag - this.unsubscribeMag = setInterval(() => { - ret.x = getRandomArbitrary(-100, 100) - ret.y = getRandomArbitrary(-100, 100) - ret.z = getRandomArbitrary(-100, 100) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeMagnetic = function () { - console.warn("sensor.unsubscribeMagnetic interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeMag) - delete this.unsubscribeMag - } -} - -function mockHall() { - global.systemplugin.sensor.subscribeHall = function (...args) { - console.warn("sensor.subscribeHall interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - const time = { - normal: 200, - game: 20, - ui: 60 - } - let ret = {} - let timer = 0 - if (!args[0].interval) { - timer = time.normal - } else { - timer = time[args[0].interval] - } - clearInterval(this.unsubscribeHal) - delete this.unsubscribeHal - this.unsubscribeHal = setInterval(() => { - ret.value = Math.round(Math.random()) - args[0].success(ret) - }, timer) - } - global.systemplugin.sensor.unsubscribeHall = function () { - console.warn("sensor.unsubscribeHall interface mocked in the Previewer. How this interface works" + - " on the Previewer may be different from that on a real device.") - clearInterval(this.unsubscribeHal) - delete this.unsubscribeHal - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/storage.js b/runtime/main/extend/systemplugin/storage.js deleted file mode 100644 index bb6ba3f7..00000000 --- a/runtime/main/extend/systemplugin/storage.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "./utils" - -export function mockStorage() { - global.systemplugin.storage = { - get: function (...args) { - console.warn("storage.get interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - set: function (...args) { - console.warn("storage.set interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - clear: function (...args) { - console.warn("storage.clear interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - }, - delete: function (...args) { - console.warn("storage.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + - " different from that on a real device.") - args[0].success("[PC Preview]: no system") - hasComplete(args[0].complete) - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/systemPackage.js b/runtime/main/extend/systemplugin/systemPackage.js deleted file mode 100644 index d17d10ac..00000000 --- a/runtime/main/extend/systemplugin/systemPackage.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "./utils" - -export function mockSystemPackage() { - global.systemplugin.package = { - hasInstalled: function (...args) { - console.warn("package.hasInstalled interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success(true) - hasComplete(args[0].complete) - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/userIAM.js b/runtime/main/extend/systemplugin/userIAM.js deleted file mode 100644 index 06ed6212..00000000 --- a/runtime/main/extend/systemplugin/userIAM.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021 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 mockUserauth() { - global.systemplugin.userIAM = {} - const AuthenticatorMock = { - execuate: function (...args) { - console.warn("Authenticator.execuate 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, reject) => { - resolve(paramMock.paramNumberMock); - }) - } - } - } - global.systemplugin.userIAM.userAuth = { - getAuthenticator: function (...args) { - console.warn("userIAM.userAuth.getAuthenticator interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - return AuthenticatorMock; - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/utils.js b/runtime/main/extend/systemplugin/utils.js deleted file mode 100644 index fdfd56c8..00000000 --- a/runtime/main/extend/systemplugin/utils.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 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 hasComplete(...args) { - if (args[0] === undefined) { - return; - } - args[0].call(this); -} - -export function getRandomArbitrary(min, max) { - return Math.random().toFixed(6) * (max - min) + min; -} - -export const paramMock = { - businessErrorMock: null, - paramNumberMock: '[PC Preview] unknow number', - paramStringMock: '[PC Preview] unknow string', - paramBooleanMock: '[PC Preview] unknow boolean', - paramObjectMock: '[PC Preview] unknow object', - paramArrayMock: '[PC Preview] unknow Array' -}; diff --git a/runtime/main/extend/systemplugin/vibrator.js b/runtime/main/extend/systemplugin/vibrator.js deleted file mode 100644 index f4013d6d..00000000 --- a/runtime/main/extend/systemplugin/vibrator.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021 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 { hasComplete } from "./utils" - -export function mockVibrator() { - global.systemplugin.vibrator = { - vibrate: function (...args) { - console.warn("vibrator.vibrate interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - args[0].success() - hasComplete(args[0].complete) - } - } -} \ No newline at end of file diff --git a/runtime/main/extend/systemplugin/wifi.js b/runtime/main/extend/systemplugin/wifi.js deleted file mode 100644 index b329990f..00000000 --- a/runtime/main/extend/systemplugin/wifi.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2021 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 mockWifi() { - const linkedInfoMock = { - ssid: '[PC preview] unknow ssid', - bssid: '[PC preview] unknow bssid', - networkId: '[PC preview] unknow networkId', - rssi: '[PC preview] unknow rssi', - band: '[PC preview] unknow band', - linkSpeed: '[PC preview] unknow linkSpeed', - frequency: '[PC preview] unknow frequency', - isHidden: '[PC preview] unknow isHidden', - isRestricted: '[PC preview] unknow isRestricted', - chload: '[PC preview] unknow chload', - snr: '[PC preview] unknow snr', - macAddress: '[PC preview] unknow macAddress', - ipAddress: '[PC preview] unknow ipAddress', - suppState: '[PC preview] unknow suppState', - connState: '[PC preview] unknow connState' - } - global.systemplugin.wifi = { - getLinkedInfo: function (...args) { - console.warn("wifi.getLinkedInfo 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, linkedInfoMock) - } else { - return new Promise((resolve) => { - resolve(linkedInfoMock) - }) - } - } - } -} \ No newline at end of file