diff --git a/CODEOWNERS b/CODEOWNERS index abde348a4d10568535df2c66a8a8fcda79190092..e62f30a3bd5e21f7ed3f181a108e770f518ac4da 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -397,7 +397,7 @@ zh-cn/application-dev/reference/apis/js-apis-notification.md @jayleehw @RayShih zh-cn/application-dev/reference/apis/js-apis-observer.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785 zh-cn/application-dev/reference/apis/js-apis-osAccount.md @nianCode @zengyawen @JiDong-CS @murphy1984 zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen -zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @feng-aiwen @ge-yafang @gong-a-shi @logic42 +zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @han-zhengshi @ge-yafang @logic42 zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen zh-cn/application-dev/reference/apis/js-apis-plainarray.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-pointer.md @yuanxinying @ningningW @cococoler @alien0208 diff --git a/README_zh.md b/README_zh.md index 6e71a0abd9fba5cbe4b4de47c77437d3a851aa45..b69235fdbdc19771dbae119f8873b610a7adf65c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -18,7 +18,7 @@ - master:最新开发版本。 - - OpenHarmony 3.2 Beta5版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-beta5.md)了解版本详情。 + - OpenHarmony 3.2 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-release.md)了解版本详情。 - OpenHarmony 3.1 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.1-release.md)了解版本详情。 diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md index 2c1505fc1c12e57a96f22fcda7faf92ba9ea7418..b38074f214762a1d42474e7e12005314427d3ee1 100644 --- a/en/application-dev/application-models/Readme-EN.md +++ b/en/application-dev/application-models/Readme-EN.md @@ -17,7 +17,6 @@ - ExtensionAbility Component - [ExtensionAbility Component Overview](extensionability-overview.md) - [ServiceExtensionAbility](serviceextensionability.md) - - [DataShareExtensionAbility (for System Applications Only)](datashareextensionability.md) - [FormExtensionAbility (Widget)](widget-development-stage.md) - [AccessibilityExtensionAbility](accessibilityextensionability.md) - [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md) @@ -46,7 +45,7 @@ - [Common Event Subscription Overview](common-event-subscription-overview.md) - [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md) - [Subscribing to Common Events in Static Mode (for System Applications Only)](common-event-static-subscription.md) - - [Unsubscribing from Common Events](common-event-unsubscription.md) + - [Unsubscribing from Common Events](common-event-unsubscription.md) - [Publishing Common Events](common-event-publish.md) - [Background Services](background-services.md) - Inter-Thread Communication diff --git a/en/application-dev/application-models/extensionability-overview.md b/en/application-dev/application-models/extensionability-overview.md index 809e4e8f70ed31ad361e18dd8cb7e079ddf93086..a287fe9ac7a590bb8675a0ae0f459463ade4ff1b 100644 --- a/en/application-dev/application-models/extensionability-overview.md +++ b/en/application-dev/application-models/extensionability-overview.md @@ -25,6 +25,12 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab - [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md): ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts. +> **NOTE**
+> 1. Third-party applications cannot implement ServiceExtensionAbility, DataShareExtensionAbility, StaticSubscriberExtensionAbility, or WindowExtensionAbility. +> +> 2. To implement transaction processing in the background for a third-party application, use background tasks rather than ServiceExtensionAbility. For details, see [Background Task](../task-management/background-task-overview.md). +> +> 3. Third-party applications can use other types of ExtensionAbility components that have been defined. ## Using ExtensionAbility of the Specified Type diff --git a/en/application-dev/application-models/stage-model-development-overview.md b/en/application-dev/application-models/stage-model-development-overview.md index d7f8123a379fc7950820e531a14f45dfca68f961..451649bdb1a63147b79f8c7e2d4523d6c651c548 100644 --- a/en/application-dev/application-models/stage-model-development-overview.md +++ b/en/application-dev/application-models/stage-model-development-overview.md @@ -10,7 +10,7 @@ The following figure shows the basic concepts used in the stage model. - [UIAbility component](uiability-overview.md) and [ExtensionAbility component](extensionability-overview.md) - The stage model provides two types of application components: UIAbility and ExtensionAbility. Both have specific classes and support object-oriented development. They are the specific implementation of the abstract ability concept on the stage model. They are also units scheduled by the Ability Manager Service (AMS), which schedules their lifecycles as well. + The stage model provides two types of application components: UIAbility and ExtensionAbility. Both have specific classes and support object-oriented development. - UIAbility has the UI and is mainly used for user interaction. For example, with UIAbility, the Gallery application can display images in the liquid layout. After a user selects an image, it uses a new UI to display the image details. The user can touch the **Back** button to return to the liquid layout. The lifecycle of the UIAbility component contains the creation, destruction, foreground, and background states. Display-related states are exposed through WindowStage events. @@ -22,6 +22,7 @@ The following figure shows the basic concepts used in the stage model. - [Context](application-context-stage.md) In the stage model, Context and its derived classes provide a variety of resources and capabilities that can be called during the runtime. The UIAbility component and ExtensionAbility derived classes have different Context classes. These classes, which all inherit from the base class Context, provide different capabilities. + - [AbilityStage](abilitystage.md) Each HAP of the Entry or Feature type has an AbilityStage class instance during the runtime. When the code in the HAP is loaded to the process for the first time, the system creates an AbilityStage class instance first. Each UIAbility class defined in the HAP is associated with this class instance after instantiation. Through this class instance, you can obtain the runtime information of the UIAbility instances in the HAP. diff --git a/en/application-dev/application-models/uiability-overview.md b/en/application-dev/application-models/uiability-overview.md index 7e31ab130df2ba9eaf959d1bfb3ddccfb7172480..cd059b9555bfd80c02c9bce66f4c50cd58fff568 100644 --- a/en/application-dev/application-models/uiability-overview.md +++ b/en/application-dev/application-models/uiability-overview.md @@ -5,10 +5,25 @@ UIAbility is a type of application component that provides the UI for user interaction. -UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. An application can contain one or more UIAbility components. For example, for a payment application, you can use two UIAbility components to carry the entry and payment functionalities. You are advised to use one UIAbility component to carry the same functional module, with multiple pages (if necessary). +The following design philosophy is behind UIAbility: + +1. Native support for [cross-device migration](hop-cross-device-migration.md) and [multi-device collaboration](hop-multi-device-collaboration.md) at the application component level + +2. Support for multiple device types and window forms + +For details, see [Interpretation of the Application Model](application-model-description.md). + +The UIAbility division principles and suggestions are as follows: + +UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. An application can contain one or more UIAbility components. For example, for a payment application, you can use two UIAbility components to carry the entry and payment functionalities. Each UIAbility component instance is displayed as a mission in Recents. +You can develop a single UIAbility or multiple UIAbilities for your application based on service requirements. + +- If you want only one mission to be displayed in Recents, use one UIAbility and multiple pages. + +- If you want multiple missions to be displayed in Recents or multiple windows to be opened simultaneously, use multiple UIAbilities. ## Privacy Statement Configuration diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 1e54b4855892e964dd3445764e0b5abc39c66d3b..9b3805f5d1b89168c919abdceeb5a4b9512b9d5a 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -173,6 +173,7 @@ - [@ohos.promptAction (Prompt)](js-apis-promptAction.md) - [@ohos.router (Page Routing)](js-apis-router.md) - [@ohos.measure (Text Measurement)](js-apis-measure.md) + - [@ohos.uiAppearance (UI Appearance)](js-apis-uiappearance.md) - Graphics - [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md) @@ -227,7 +228,7 @@ - [@ohos.data.dataShareResultSet (DataShare Result Set)](js-apis-data-DataShareResultSet.md) - [@ohos.data.distributedDataObject (Distributed Data Object)](js-apis-data-distributedobject.md) - [@ohos.data.distributedKVStore (Distributed KV Store)](js-apis-distributedKVStore.md) - - [@ohos.data.preferences (Preferences)](js-apis-data-preferences.md) + - [@ohos.data.preferences (User Preferences)](js-apis-data-preferences.md) - [@ohos.data.relationalStore (RDB Store)](js-apis-data-relationalStore.md) - [@ohos.data.ValuesBucket (Value Bucket)](js-apis-data-valuesBucket.md) @@ -266,6 +267,7 @@ - [@ohos.request (Upload and Download)](js-apis-request.md) - Connectivity + - [@ohos.bluetooth (Bluetooth)(To Be Deprecated Soon)](js-apis-bluetooth.md) - [@ohos.bluetoothManager (Bluetooth)(js-apis-bluetoothManager.md) - [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md) - [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md) @@ -274,8 +276,8 @@ - [@ohos.rpc (RPC)](js-apis-rpc.md) - [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md) - [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md) - - [@ohos.wifi (To Be Deprecated Soon)](js-apis-wifi.md) - - [@ohos.wifiext (To Be Deprecated Soon)](js-apis-wifiext.md) + - [@ohos.wifi (WLAN)(To Be Deprecated Soon)](js-apis-wifi.md) + - [@ohos.wifiext (WLAN Extension)(To Be Deprecated Soon)](js-apis-wifiext.md) - tag - [nfctech (Standard NFC Technologies)](js-apis-nfctech.md) - [tagSession (Standard NFC Tag Session)](js-apis-tagSession.md) @@ -340,7 +342,7 @@ - [@ohos.systemParameterEnhance (System Parameter)](js-apis-system-parameterEnhance.md) - [@ohos.thermal (Thermal Management)](js-apis-thermal.md) - [@ohos.update (Update)](js-apis-update.md) - - [@ohos.usbManager (USB Management)](js-apis-usbManager.md) + - [@ohos.usbManager (USB Manager)](js-apis-usbManager.md) - [@ohos.vibrator (Vibrator)](js-apis-vibrator.md) - Account Management @@ -390,7 +392,6 @@ - APIs No Longer Maintained - [@ohos.backgroundTaskManager (Background Task Management)](js-apis-backgroundTaskManager.md) - - [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md) - [@ohos.bundle (Bundle)](js-apis-Bundle.md) - [@ohos.bundle.innerBundleManager (innerBundleManager)](js-apis-Bundle-InnerBundleManager.md) - [@ohos.bundleState (Device Usage Statistics)](js-apis-deviceUsageStatistics.md) diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 73d21161ce9aa37f7242b49f615759e547c1925a..3cb32c4a2cdcbf7dbe451e3a8e880bc3414cc689 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -79,7 +79,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -135,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -177,7 +177,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -217,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -262,7 +262,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -310,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 3304f535b5fd5fe52562e237a9f48c60cd794067..eb92543feba85b2ce4abe3cb0f213fd19dccffe4 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -306,7 +306,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +392,7 @@ Obtains information about all missions. This API uses an asynchronous callback t try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md index b57435673e0d2372d4980c5a540fea618719c839..d50bb380f662b1c992b10ef8f8b2b8ff7088d061 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index b85364df96d39f3b8bd66f64910f3e15e5867ca7..fbf50f68387385c7d69c02ce599285a5b8ad2310 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -375,10 +375,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -456,10 +456,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -498,10 +498,10 @@ Releases the caller interface of the target ability. try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -538,10 +538,10 @@ Registers a callback that is invoked when the stub on the target ability is disc console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -587,10 +587,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -637,10 +637,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -686,10 +686,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -759,7 +759,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -798,7 +798,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index c7fd0b0f4a3f21eec8dbf66c51f890d6436b08f0..89c8919f494252120fff49a42cc8335c29ec702b 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -186,10 +186,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -280,7 +280,7 @@ function getWantAgentCallback(err, data) { // getBundleName callback function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -391,16 +391,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) { // getUid callback function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -603,16 +603,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -704,7 +704,7 @@ function getWantAgentCallback(err, data) { // getWant callback function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -817,16 +817,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -917,7 +917,7 @@ function getWantAgentCallback(err, data) { // cancel callback function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1028,16 +1028,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1131,7 +1131,7 @@ function getWantAgentCallback(err, data) { // trigger callback function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1239,7 +1239,7 @@ function getWantAgentCallback(err, data) { // equal callback function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1353,16 +1353,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1451,7 +1451,7 @@ function getWantAgentCallback(err, data) { // getOperationTypeCallback callback function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1560,16 +1560,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-application-missionManager.md b/en/application-dev/reference/apis/js-apis-application-missionManager.md index 97ea9181621dbc9b95d355762cb839af903771cc..9cc1ecce166669fa3962ba8a32007f81c43a7af8 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ Obtains information about all missions. This API uses an asynchronous callback t missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -408,7 +408,7 @@ Locks a given mission. This API uses an asynchronous callback to return the resu missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -492,7 +492,7 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -580,7 +580,7 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -716,7 +716,7 @@ Switches a given mission to the foreground. This API uses an asynchronous callba missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -757,7 +757,7 @@ Switches a given mission to the foreground, with the startup parameters for the missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index b3f5def410251e954ee3f7b00c211e2f7f5116a0..65340798c550ca38dab020b44c15351be885ab81 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -690,21 +690,19 @@ Describes the interruption event received by the application when playback is in | forceType | [InterruptForceType](#interruptforcetype9) | Yes | Whether the interruption is taken by the system or to be taken by the application.| | hintType | [InterruptHint](#interrupthint) | Yes | Hint provided along the interruption. | -## VolumeEvent8+ +## VolumeEvent9+ Describes the event received by the application when the volume is changed. -**System API**: This is a system API. - **System capability**: SystemCapability.Multimedia.Audio.Volume | Name | Type | Mandatory | Description | | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | -| volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | -| volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**.| -| updateUi | boolean | Yes | Whether to show the volume change in UI. | -| volumeGroupId9+ | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**. | -| networkId9+ | string | Yes | Network ID. | +| volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | +| volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**. | +| updateUi | boolean | Yes | Whether to show the volume change in UI. | +| volumeGroupId | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**.
This is a system API. | +| networkId | string | Yes | Network ID.
This is a system API. | ## MicStateChangeEvent9+ @@ -1112,7 +1110,7 @@ Sets the volume for a stream. This API uses an asynchronous callback to return t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1148,7 +1146,7 @@ Sets the volume for a stream. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1374,7 +1372,7 @@ Mutes or unmutes a stream. This API uses an asynchronous callback to return the > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **System capability**: SystemCapability.Multimedia.Audio.Volume @@ -1406,7 +1404,7 @@ Mutes or unmutes a stream. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **System capability**: SystemCapability.Multimedia.Audio.Volume @@ -1566,7 +1564,7 @@ Sets the ringer mode. This API uses an asynchronous callback to return the resul > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1601,7 +1599,8 @@ Sets the ringer mode. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. + **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -2003,13 +2002,13 @@ audioManager.isMicrophoneMute().then((value) => { }); ``` -### on('volumeChange')(deprecated) +### on('volumeChange')9+ on(type: 'volumeChange', callback: Callback\): void > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [on](#on9) in **AudioVolumeManager**. +> You are advised to use [on('volumeChange')](#onvolumechange9) in **AudioVolumeManager**. Subscribes to system volume change events. @@ -2024,7 +2023,7 @@ Currently, when multiple **AudioManager** instances are used in a single process | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when a system volume change is detected.| -| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | +| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. | **Example** @@ -2073,7 +2072,7 @@ Subscribes to device change events. When a device is connected or disconnected, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [on](#on9) in **AudioRoutingManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [on('deviceChange')](#ondevicechange9) in **AudioRoutingManager**. **System capability**: SystemCapability.Multimedia.Audio.Device @@ -2103,7 +2102,7 @@ Unsubscribes from device change events. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [off](#off9) in **AudioRoutingManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [off('deviceChange')](#offdevicechange9) in **AudioRoutingManager**. **System capability**: SystemCapability.Multimedia.Audio.Device @@ -2338,7 +2337,7 @@ Subscribes to system volume change events. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when the system volume changes.| -| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | +| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. | **Error codes** @@ -3465,7 +3464,7 @@ audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) }); ``` -### on9+ +### on('deviceChange')9+ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void @@ -3500,7 +3499,7 @@ audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (de }); ``` -### off9+ +### off('deviceChange')9+ off(type: 'deviceChange', callback?: Callback): void @@ -3934,6 +3933,126 @@ async function selectOutputDeviceByFilter(){ } ``` +### getPreferOutputDeviceForRendererInfo10+ + +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void + +Obtains the output device with the highest priority based on the audio renderer information. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | +| callback | AsyncCallback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Yes | Callback used to return the information about the output device with the highest priority.| + +**Example** +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 }; + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo, (err, desc) => { + if (err) { + console.error(`Result ERROR: ${JSON.stringify(err)}`); + } else { + console.info('device descriptor: ' + JSON.stringify(desc)); + } + }); +} +``` + +### getPreferOutputDeviceForRendererInfo9+ + +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors> + +Obtains the output device with the highest priority based on the audio renderer information. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------------| ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | + +**Return value** + +| Type | Description | +| --------------------- | --------------------------- | +| Promise<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Promise used to return the information about the output device with the highest priority.| + +**Example** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 }; + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo).then((desc) => { + console.info('device descriptor: ' + JSON.stringify(desc)); + }).catch((err) => { + console.error(`Result ERROR: ${JSON.stringify(err)}`); + }) +} +``` + +### on('preferOutputDeviceChangeForRendererInfo')10+ + +on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void + +Subscribes to the change of the output device with the highest priority. This API uses an asynchronous callback to return the result. + +**Parameters** + +| Name | Type | Mandatory| Description | +| :------- | :--------------------------------------------------- | :--- | :----------------------------------------- | +| type | string | Yes | Event type. The value **'preferOutputDeviceChangeForRendererInfo'** means the event triggered when the output device with the highest priority changes.| +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)\> | Yes | Callback used to return the information about the output device with the highest priority. | + +**Example** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 }; + +audioRoutingManager.on('preferOutputDeviceChangeForRendererInfo', rendererInfo, (desc) => { + console.info('device descriptor: ' + JSON.stringify(desc)); +}); +``` + +### off('preferOutputDeviceChangeForRendererInfo')10+ + +off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void + +Unsubscribes from the change of the output device with the highest priority. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------- | ---- | ------------------------------------------ | +| type | string | Yes | Event type. The value **'preferOutputDeviceChangeForRendererInfo'** means the event triggered when the output device with the highest priority changes.| +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | No | Callback used for unsubscription. | + +**Example** + +```js +audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo', () => { + console.info('Should be no callback.'); +}); +``` + ## AudioRendererChangeInfoArray9+ Defines an **AudioRenderChangeInfo** array, which is read-only. @@ -3946,17 +4065,17 @@ Describes the audio renderer change event. **System capability**: SystemCapability.Multimedia.Audio.Renderer -| Name | Type | Readable | Writable | Description | -| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | -| streamId | number | Yes | No | Unique ID of an audio stream. | -| clientUid | number | Yes | No | UID of the audio renderer client.
This is a system API. | -| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | -| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| Name | Type | Readable | Writable | Description | +| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | +| streamId | number | Yes | No | Unique ID of an audio stream. | +| clientUid | number | Yes | No | UID of the audio renderer client.
This is a system API. | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | +| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | **Example** ```js - import audio from '@ohos.multimedia.audio'; const audioManager = audio.getAudioManager(); @@ -4004,12 +4123,13 @@ Describes the audio capturer change event. **System capability**: SystemCapability.Multimedia.Audio.Capturer -| Name | Type | Readable | Writable | Description | -| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | -| streamId | number | Yes | No | Unique ID of an audio stream. | -| clientUid | number | Yes | No | UID of the audio capturer client.
This is a system API. | -| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | -| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| Name | Type | Readable | Writable | Description | +| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | +| streamId | number | Yes | No | Unique ID of an audio stream. | +| clientUid | number | Yes | No | UID of the audio capturer client.
This is a system API. | +| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | +| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | **Example** @@ -4103,7 +4223,7 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m | Name | Type | Mandatory | Description | | ------------ | ---------------------------------------- | --------- | ------------------------------------------------------------ | -| uid | number | Yes | Application ID.
**System capability**: SystemCapability.Multimedia.Audio.Core | +| uid | number | No | Application ID.
**System capability**: SystemCapability.Multimedia.Audio.Core | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.
**System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererId | number | No | Unique ID of an audio stream.
**System capability**: SystemCapability.Multimedia.Audio.Renderer | @@ -4241,6 +4361,7 @@ audioRenderer.getStreamInfo().then((streamInfo) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### getAudioStreamId9+ @@ -4263,6 +4384,7 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async audioRenderer.getAudioStreamId((err, streamid) => { console.info(`Renderer GetStreamId: ${streamid}`); }); + ``` ### getAudioStreamId9+ @@ -4287,6 +4409,7 @@ audioRenderer.getAudioStreamId().then((streamid) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### start8+ @@ -4313,6 +4436,7 @@ audioRenderer.start((err) => { console.info('Renderer start success.'); } }); + ``` ### start8+ @@ -4337,6 +4461,7 @@ audioRenderer.start().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### pause8+ @@ -4363,6 +4488,7 @@ audioRenderer.pause((err) => { console.info('Renderer paused.'); } }); + ``` ### pause8+ @@ -4387,6 +4513,7 @@ audioRenderer.pause().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### drain8+ @@ -4413,6 +4540,7 @@ audioRenderer.drain((err) => { console.info('Renderer drained.'); } }); + ``` ### drain8+ @@ -4437,6 +4565,7 @@ audioRenderer.drain().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### stop8+ @@ -4463,6 +4592,7 @@ audioRenderer.stop((err) => { console.info('Renderer stopped.'); } }); + ``` ### stop8+ @@ -4487,6 +4617,7 @@ audioRenderer.stop().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### release8+ @@ -4513,6 +4644,7 @@ audioRenderer.release((err) => { console.info('Renderer released.'); } }); + ``` ### release8+ @@ -4537,6 +4669,7 @@ audioRenderer.release().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### write8+ @@ -4592,6 +4725,7 @@ for (let i = 0;i < len; i++) { }) } + ``` ### write8+ @@ -4641,6 +4775,7 @@ for (let i = 0;i < len; i++) { console.error(`audioRenderer.write err: ${err}`); } } + ``` ### getAudioTime8+ @@ -4663,6 +4798,7 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). audioRenderer.getAudioTime((err, timestamp) => { console.info(`Current timestamp: ${timestamp}`); }); + ``` ### getAudioTime8+ @@ -4687,6 +4823,7 @@ audioRenderer.getAudioTime().then((timestamp) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### getBufferSize8+ @@ -4711,6 +4848,7 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => { console.error('getBufferSize error'); } }); + ``` ### getBufferSize8+ @@ -4737,6 +4875,7 @@ audioRenderer.getBufferSize().then((data) => { }).catch((err) => { console.error(`AudioFrameworkRenderLog: getBufferSize: ERROR: ${err}`); }); + ``` ### setRenderRate8+ @@ -4764,6 +4903,7 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) => console.info('Callback invoked to indicate a successful render rate setting.'); } }); + ``` ### setRenderRate8+ @@ -4794,6 +4934,7 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### getRenderRate8+ @@ -4816,6 +4957,7 @@ Obtains the current render rate. This API uses an asynchronous callback to retur audioRenderer.getRenderRate((err, renderrate) => { console.info(`getRenderRate: ${renderrate}`); }); + ``` ### getRenderRate8+ @@ -4840,7 +4982,9 @@ audioRenderer.getRenderRate().then((renderRate) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` + ### setInterruptMode9+ setInterruptMode(mode: InterruptMode): Promise<void> @@ -4870,7 +5014,9 @@ audioRenderer.setInterruptMode(mode).then(data=>{ }).catch((err) => { console.error(`setInterruptMode Fail: ${err}`); }); + ``` + ### setInterruptMode9+ setInterruptMode(mode: InterruptMode, callback: AsyncCallback\): void @@ -4896,6 +5042,7 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{ } console.info('setInterruptMode Success!'); }); + ``` ### setVolume9+ @@ -4926,7 +5073,9 @@ audioRenderer.setVolume(0.5).then(data=>{ }).catch((err) => { console.error(`setVolume Fail: ${err}`); }); + ``` + ### setVolume9+ setVolume(volume: number, callback: AsyncCallback\): void @@ -4951,6 +5100,7 @@ audioRenderer.setVolume(0.5, (err, data)=>{ } console.info('setVolume Success!'); }); + ``` ### on('audioInterrupt')9+ @@ -4976,7 +5126,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco | ID | Error Message | | ------- | ------------------------------ | -| 6800101 | if input parameter value error | +| 6800101 | if input parameter value error | **Example** @@ -5030,6 +5180,7 @@ async function onAudioInterrupt(){ } }); } + ``` ### on('markReach')8+ @@ -5056,6 +5207,7 @@ audioRenderer.on('markReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); + ``` @@ -5077,6 +5229,7 @@ Unsubscribes from mark reached events. ```js audioRenderer.off('markReach'); + ``` ### on('periodReach') 8+ @@ -5103,6 +5256,7 @@ audioRenderer.on('periodReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); + ``` ### off('periodReach') 8+ @@ -5123,9 +5277,10 @@ Unsubscribes from period reached events. ```js audioRenderer.off('periodReach') + ``` -### on('stateChange') 8+ +### on('stateChange')8+ on(type: 'stateChange', callback: Callback): void @@ -5151,6 +5306,7 @@ audioRenderer.on('stateChange', (state) => { console.info('audio renderer state is: STATE_RUNNING'); } }); + ``` ## AudioCapturer8+ @@ -5169,6 +5325,7 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo ```js let state = audioCapturer.state; + ``` ### getCapturerInfo8+ @@ -5197,6 +5354,7 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => { console.info(`Capturer flags: ${capturerInfo.capturerFlags}`); } }); + ``` @@ -5229,6 +5387,7 @@ audioCapturer.getCapturerInfo().then((audioParamsGet) => { }).catch((err) => { console.error(`AudioFrameworkRecLog: CapturerInfo :ERROR: ${err}`); }); + ``` ### getStreamInfo8+ @@ -5259,6 +5418,7 @@ audioCapturer.getStreamInfo((err, streamInfo) => { console.info(`Capturer encoding type: ${streamInfo.encodingType}`); } }); + ``` ### getStreamInfo8+ @@ -5287,6 +5447,7 @@ audioCapturer.getStreamInfo().then((audioParamsGet) => { }).catch((err) => { console.error(`getStreamInfo :ERROR: ${err}`); }); + ``` ### getAudioStreamId9+ @@ -5309,6 +5470,7 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async audioCapturer.getAudioStreamId((err, streamid) => { console.info(`audioCapturer GetStreamId: ${streamid}`); }); + ``` ### getAudioStreamId9+ @@ -5333,6 +5495,7 @@ audioCapturer.getAudioStreamId().then((streamid) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); + ``` ### start8+ @@ -5359,6 +5522,7 @@ audioCapturer.start((err) => { console.info('Capturer start success.'); } }); + ``` @@ -5390,6 +5554,7 @@ audioCapturer.start().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer start :ERROR : ${err}`); }); + ``` ### stop8+ @@ -5416,6 +5581,7 @@ audioCapturer.stop((err) => { console.info('Capturer stopped.'); } }); + ``` @@ -5445,6 +5611,7 @@ audioCapturer.stop().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); }); + ``` ### release8+ @@ -5471,6 +5638,7 @@ audioCapturer.release((err) => { console.info('capturer released.'); } }); + ``` @@ -5500,6 +5668,7 @@ audioCapturer.release().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); }); + ``` ### read8+ @@ -5533,6 +5702,7 @@ audioCapturer.read(bufferSize, true, async(err, buffer) => { console.info('Success in reading the buffer data'); } }); + ``` ### read8+ @@ -5572,6 +5742,7 @@ audioCapturer.read(bufferSize, true).then((buffer) => { }).catch((err) => { console.info(`ERROR : ${err}`); }); + ``` ### getAudioTime8+ @@ -5594,6 +5765,7 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). audioCapturer.getAudioTime((err, timestamp) => { console.info(`Current timestamp: ${timestamp}`); }); + ``` ### getAudioTime8+ @@ -5618,6 +5790,7 @@ audioCapturer.getAudioTime().then((audioTime) => { }).catch((err) => { console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${err}`); }); + ``` ### getBufferSize8+ @@ -5647,6 +5820,7 @@ audioCapturer.getBufferSize((err, bufferSize) => { }); } }); + ``` ### getBufferSize8+ @@ -5673,6 +5847,7 @@ audioCapturer.getBufferSize().then((data) => { }).catch((err) => { console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`); }); + ``` ### on('markReach')8+ @@ -5699,6 +5874,7 @@ audioCapturer.on('markReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); + ``` ### off('markReach')8+ @@ -5719,6 +5895,7 @@ Unsubscribes from mark reached events. ```js audioCapturer.off('markReach'); + ``` ### on('periodReach')8+ @@ -5745,6 +5922,7 @@ audioCapturer.on('periodReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); + ``` ### off('periodReach')8+ @@ -5765,9 +5943,10 @@ Unsubscribes from period reached events. ```js audioCapturer.off('periodReach') + ``` -### on('stateChange') 8+ +### on('stateChange')8+ on(type: 'stateChange', callback: Callback): void @@ -5793,6 +5972,7 @@ audioCapturer.on('stateChange', (state) => { console.info('audio capturer state is: STATE_RUNNING'); } }); + ``` ## ToneType9+ @@ -5867,6 +6047,7 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_5, (err) => { console.info('callback call load success'); } }); + ``` ### load9+ @@ -5899,6 +6080,7 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_1).then(() => { }).catch(() => { console.error('promise call load fail'); }); + ``` ### start9+ @@ -5928,6 +6110,7 @@ tonePlayer.start((err) => { console.info('callback call start success'); } }); + ``` ### start9+ @@ -5954,6 +6137,7 @@ tonePlayer.start().then(() => { }).catch(() => { console.error('promise call start fail'); }); + ``` ### stop9+ @@ -5983,6 +6167,7 @@ tonePlayer.stop((err) => { console.error('callback call stop success '); } }); + ``` ### stop9+ @@ -6009,6 +6194,7 @@ tonePlayer.stop().then(() => { }).catch(() => { console.error('promise call stop fail'); }); + ``` ### release9+ @@ -6038,6 +6224,7 @@ tonePlayer.release((err) => { console.info('callback call release success '); } }); + ``` ### release9+ @@ -6064,6 +6251,7 @@ tonePlayer.release().then(() => { }).catch(() => { console.error('promise call release fail'); }); + ``` ## ActiveDeviceType(deprecated) diff --git a/en/application-dev/reference/apis/js-apis-bluetoothManager.md b/en/application-dev/reference/apis/js-apis-bluetoothManager.md index 9711dd232291c9863725c5ed3dba6a64f654cea7..7ec3e7b70c6671ddf6b58313e1a7c86cb98e2978 100644 --- a/en/application-dev/reference/apis/js-apis-bluetoothManager.md +++ b/en/application-dev/reference/apis/js-apis-bluetoothManager.md @@ -547,7 +547,7 @@ startBluetoothDiscovery(): void Starts Bluetooth scan to discover remote devices. -**Rquired permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -652,6 +652,98 @@ try { ``` +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string, callback: AsyncCallback<void>): void + +Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. + +**Required permissions**: ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| code | string | Yes | PIN to set. | +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +//callback +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => { + console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data)); + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string): Promise<void> + +Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| code | string | Yes | PIN to set. | + +**Return value** + +| Type | Description | +| ------------------- | ------------- | +| Promise<void> | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +//promise +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => { + console.info('setDevicePinCode'); + }, error => { + console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message); + }) + +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + ## bluetoothManager.on('bluetoothDeviceFind') on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void @@ -1385,7 +1477,7 @@ Creates a **GattServer** instance. | Type | Description | | ------------------------- | ------------------------------------ | -| [GattServer](#gattserver) | **GattServer** instance created. Before using an API of the server, you must create a **GattSever** instance.| +| [GattServer](#gattserver) | **GattServer** instance created. Before using an API of this class, you must create a **GattSever** instance.| **Example** @@ -2333,17 +2425,6 @@ Obtains the network sharing status. | --------------------- | --------------------------------- | | boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.| -**Error codes** - -For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). - -| ID| Error Message| -| -------- | ---------------------------- | -|2900001 | Service stopped. | -|2900003 | Bluetooth switch is off. | -|2900004 | Profile is not supported. | -|2900099 | Operation failed. | - **Example** ```js @@ -3258,7 +3339,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901000 | Read forbidden. | +|2901000 | Read forbidden. | |2900099 | Operation failed. | **Example** @@ -3327,7 +3408,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901000 | Read forbidden. | +|2901000 | Read forbidden. | |2900099 | Operation failed. | **Example** @@ -3382,7 +3463,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901000 | Read forbidden. | +|2901000 | Read forbidden. | |2900099 | Operation failed. | **Example** @@ -3444,7 +3525,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901000 | Read forbidden. | +|2901000 | Read forbidden. | |2900099 | Operation failed. | **Example** @@ -3491,7 +3572,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901001 | Write forbidden. | +|2901001 | Write forbidden. | |2900099 | Operation failed. | **Example** @@ -3545,7 +3626,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err | ID| Error Message| | -------- | ---------------------------- | |2900001 | Service stopped. | -|2901001 | Write forbidden. | +|2901001 | Write forbidden. | |2900099 | Operation failed. | **Example** @@ -4016,17 +4097,18 @@ Defines the characteristic API parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Type | Readable | Writable | Description | +| Name | Type | Readable | Writable | Description | | ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | | serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| | characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | -| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. | +| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | +| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. | +| properties10+ | [GattProperties](#gattproperties10) | Yes | Yes | Properties of the characteristic. | ## BLEDescriptor -Defines the descriptor API parameters. +Defines the BLE descriptor. **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -4229,6 +4311,7 @@ Defines the scan result. | deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.| | rssi | number | Yes | No | RSSI of the device. | | data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. | +| deviceName10+ | string | Yes | No | Name of the device detected. | ## BluetoothState @@ -4308,6 +4391,7 @@ Defines the pairing request parameters. | -------- | ------ | ---- | ---- | ----------- | | deviceId | string | Yes | No | ID of the device to pair.| | pinCode | string | Yes | No | Key for the device pairing. | +| pinType10+ | [PinType](#pintype10) | Yes | No | Type of the device to pair. | ## BondStateParam @@ -4334,6 +4418,21 @@ Defines the profile state change parameters. | state | [ProfileConnectionState](#profileconnectionstate) | Yes | No | Profile connection state of the device.| +## GattProperties10+ + +Defines the properties of a GATT characteristic. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Read-only | Mandatory | Description | +| -------- | ------ | ---- | ---- | ----------- | +| write10+ | boolean | Yes | Yes | Permits writes of the characteristic value (with a response).| +| writeNoResponse10+ | boolean | Yes | Yes | Permits writes of the characteristic value (without a response).| +| read10+ | boolean | Yes | Yes | Permits reads of the characteristic value.| +| notify10+ | boolean | Yes | Yes | Permits notifications of the characteristic value.| +| indicate10+ | boolean | Yes | Yes | Permits notifications of the characteristic value without acknowledgement.| + + ## DeviceClass Defines the class of a Bluetooth device. @@ -4347,7 +4446,6 @@ Defines the class of a Bluetooth device. | classOfDevice | number | Yes | No | Class of the device. | - ## MajorClass Enumerates the major classes of Bluetooth devices. @@ -4489,3 +4587,21 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS | PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. | | PROFILE_HID_HOST | 6 | Human Interface Device (HID) profile. | | PROFILE_PAN_NETWORK | 7 | PAN profile. | + + +## PinType10+ + +Enumerates the Bluetooth pairing types. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| -------------------------------- | ------ | --------------- | +| PIN_TYPE_ENTER_PIN_CODE10+ | 0 | The user needs to enter the PIN displayed on the peer device.| +| PIN_TYPE_ENTER_PASSKEY10+ | 1 | The user needs to enter the PASSKEY displayed on the peer device. | +| PIN_TYPE_CONFIRM_PASSKEY10+ | 2 | The user needs to confirm the PASSKEY displayed on the local device. | +| PIN_TYPE_NO_PASSKEY_CONSENT10+ | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request. | +| PIN_TYPE_NOTIFY_PASSKEY10+ | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device. | +| PIN_TYPE_DISPLAY_PIN_CODE10+ | 5 | The user needs to enter the PIN displayed on the peer device for Bluetooth 2.0 devices. | +| PIN_TYPE_OOB_CONSENT10+ | 6 | The user needs to accept or reject the out of band (OOB) pairing request. | +| PIN_TYPE_PIN_16_DIGITS10+ | 7 | The user needs to enter the 16-digit PIN displayed on the peer device. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md index e6fd8bd2c8cd018a0ed0fe0d5cfdb226f542b438..1724888a4d646c1f105fdb9b60ef1be7d098dc3d 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md @@ -5,6 +5,8 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th > **NOTE** > > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. ## BundlePackInfo @@ -63,10 +65,10 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th | ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- | | mainAbility | string | Yes| No| Name of the main ability.| | apiVersion | [ApiVersion](#apiversion) | Yes | No | API version of the module. | -| deviceType | Array\ | Yes | No | Device types supported by the module. | +| deviceTypes | Array\ | Yes | No | Device types supported by the module. | | distro | [ModuleDistroInfo](#moduledistroinfo) | Yes | No | Distribution information of the module. | | abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | Yes | No | Ability information of the module. | -| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | Yes | No | ExtensionAbility information of the module.| +| extensionAbilities | Array\<[ExtensionAbility](#extensionability)> | Yes | No | ExtensionAbility information of the module.| ## ModuleDistroInfo @@ -123,7 +125,7 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th ## ApiVersion -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md index 8997e94099071ce9b4e806f06b008477352af187..3447ba9b6dacd6a5606902caa24269931ff0d09e 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md @@ -32,3 +32,4 @@ The **ApplicationInfo** module defines the application information. A system app | appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. | | appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. | | systemApp | boolean | Yes | No | Whether the application is a system application. | +| bundleType |[BundleType](js-apis-bundleManager.md#bundletype) | Yes | No | Bundle type, which can be **APP** (common application) or **ATOMIC_SERVICE** (atomic service). | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md index 146e3da56069f96ce10e20a62b9d2474bc51508a..d5962d34571e7c1cafdcb520643c029812603d12 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md @@ -26,3 +26,28 @@ The **HapModuleInfo** module defines the HAP module information. A system applic | deviceTypes | Array\ | Yes | No | Types of devices where the module can run. | | installationFree | boolean | Yes | No | Whether installation-free is supported. | | hashValue | string | Yes | No | Hash value of the module. | +| moduleType | [ModuleType](js-apis-bundleManager.md#moduletype) | Yes | No | Type of the module. | +| preloads | Array\<[PreloadItem](#preloaditem)> | Yes | No | Preloaded modules in the atomic service.| +| dependencies | Array\<[Dependency](#dependency)> | Yes | No | Dynamic shared libraries on which the module depends. | + +## PreloadItem + +Describes the preloaded module information in the atomic service. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| --------- | -------------- | ---- | ---- | --------------------------- | +|moduleName | string | Yes | No | Name of the module automatically preloaded by the system.| + +## Dependency + +Describes the information about the dynamic shared library on which the module depends. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| ----------- | ------ | ---- | ---- | ---------------------- | +| bundleName | string | Yes | No | Name of the shared bundle on which the current module depends. | +| moduleName | string | Yes | No | Module name of the shared bundle on which the current module depends.| +| versionCode | number | Yes | No | Version number of the shared bundle. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md index a05187320802cde128cfacbd9105c23a13ea5269..e7d165f90fb2fade864f2e7bf2d5408d6fd190ae 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager.md @@ -49,7 +49,7 @@ Enumerates the application flags, which indicate the type of application informa **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | ------------------------------------ | ---------- | ------------------------------------------------------------ | @@ -64,7 +64,7 @@ Enumerates the ability flags, which indicate the type of ability information to **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | --------------------------------- | ---------- | ------------------------------------------------------------ | @@ -81,7 +81,7 @@ Enumerates the Extension ability flags, which indicate the type of Extension abi **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | ------------------------------------------- | ---------- | ------------------------------------------------------------ | @@ -187,6 +187,39 @@ Enumerates the display orientations of the ability. This attribute applies only | AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.| | LOCKED |12|Locked.| +### CompatiblePolicy + +Defines the version compatibility type of the shared library. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ---------------------- | ---- | -------------------------------- | +| BACKWARD_COMPATIBILITY | 1 | The shared library is backward compatible.| + +### ModuleType + +Enumerates the module types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ------- | ---- | -------------------- | +| ENTRY | 1 | Main module of the application. | +| FEATURE | 2 | Dynamic feature module of the application.| +| SHARED | 3 | Dynamic shared library module of the application. | + +### BundleType + +Enumerates the bundle types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| -------------- | ---- | --------------- | +| APP | 0 | The bundle is a common application. | +| ATOMIC_SERVICE | 1 | The bundle is an atomic service.| + ## APIs ### bundleManager.getBundleInfoForSelf @@ -1077,7 +1110,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ------------------------------------- | | 17700001 | The specified bundleName is not found. | -| 17700003 | The specified extensionAbility is not found. | +| 17700003 | The specified ability is not found. | | 17700004 | The specified userId is invalid. | | 17700026 | The specified bundle is disabled. | | 17700029 | The specified ability is disabled. | @@ -3036,47 +3069,3 @@ try { hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); } ``` - -## CompatiblePolicy - -Defines the version compatibility type of the shared library. - - **System capability**: SystemCapability.BundleManager.BundleFramework.Core - -| Name | Value | Description | -| ---------------------- | ---- | -------------------------------- | -| BACKWARD_COMPATIBILITY | 1 | The shared library is backward compatible.| - -## ModuleType - -Enumerates the module types. - - **System capability**: SystemCapability.BundleManager.BundleFramework.Core - -| Name | Value | Description | -| ------- | ---- | -------------------- | -| ENTRY | 1 | Main module of the application. | -| FEATURE | 2 | Dynamic feature module of the application.| -| SHARED | 3 | Dynamic shared library module of the application. | - -## BundleType - -Enumerates the bundle types. - - **System capability**: SystemCapability.BundleManager.BundleFramework.Core - -| Name | Value | Description | -| -------------- | ---- | --------------- | -| APP | 0 | The bundle is a common application. | -| ATOMIC_SERVICE | 1 | The bundle is an atomic service.| - -## AtomicServiceModuleType - -Enumerates the module types of an atomic service. - - **System capability**: SystemCapability.BundleManager.BundleFramework.Core - -| Name | Value | Description | -| ------ | ---- | --------------------------- | -| NORMAL | 0 | Page package in the atomic service. | -| MAIN | 1 | Landing page package in the atomic service.| diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md index 99e43bc6a0e1a748dcea5eb8777db5361ded3040..156078c63ad8f33a7747e493948f59d511a1c791 100644 --- a/en/application-dev/reference/apis/js-apis-data-preferences.md +++ b/en/application-dev/reference/apis/js-apis-data-preferences.md @@ -1,6 +1,6 @@ -# @ohos.data.preferences (Preferences) +# @ohos.data.preferences (User Preferences) -The **Preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required. +The **user preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required. The key is of the string type, and the value can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values. @@ -176,12 +176,12 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | -| name | string | Yes | Name of the **Preferences** instance to delete. | +| name | string | Yes | Name of the **Preferences** instance to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.| **Error codes** -For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md). +For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md). | ID| Error Message | | -------- | ------------------------------| @@ -213,6 +213,7 @@ Stage model: ```ts import UIAbility from '@ohos.app.ability.UIAbility'; + class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { try { @@ -257,7 +258,7 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi **Error codes** -For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md). +For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md). | ID| Error Message | | -------- | ------------------------------| @@ -288,6 +289,7 @@ Stage model: ```ts import UIAbility from '@ohos.app.ability.UIAbility'; + class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { try{ @@ -348,6 +350,7 @@ Stage model: ```ts import UIAbility from '@ohos.app.ability.UIAbility'; + class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { try { @@ -500,7 +503,7 @@ try { promise.then((data) => { console.info("Got the value of 'startup'. Data: " + data); }).catch((err) => { - console.info("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); }) } catch(err) { console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); diff --git a/en/application-dev/reference/apis/js-apis-freeInstall.md b/en/application-dev/reference/apis/js-apis-freeInstall.md index 937cc8437c21d80b54b241d746803e0aae9d4f18..160d0ebbcef331046e6bb52fb84971aba1cbe5b2 100644 --- a/en/application-dev/reference/apis/js-apis-freeInstall.md +++ b/en/application-dev/reference/apis/js-apis-freeInstall.md @@ -299,7 +299,7 @@ try { getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\; -Obtains **bundlePackInfo** based on **bundleName** and **bundleFlag**. This API uses a promise to return the result. +Obtains **bundlePackInfo** based on **bundleName** and **BundlePackFlag**. This API uses a promise to return the result. **System API**: This is a system API. diff --git a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md index 23328be8945eb8c1aa55ba993077ff64f99b8fcc..ca06c2e4c8fb37d3a3c2d8987a13c5cb716aa327 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -20,7 +20,7 @@ import appManager from '@ohos.app.ability.appManager'; function getForegroundAppInfos() { appManager.getForegroundApplications((error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } for (let i = 0; i < data.length; i++) { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-context.md b/en/application-dev/reference/apis/js-apis-inner-application-context.md index 4b0dc98ea7bb95c66ebfe29cf938d376419a46f0..25e82e90dbf0137f11cdb092497b967515ad8166 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-context.md @@ -62,7 +62,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -101,7 +101,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -141,7 +141,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,6 +166,6 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 1ada23c202d88e7afa85da2a021130be1a434bc0..10b65b8ce5a815a9d4f4355bbf3f6abbc17d3dd9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Called when the mission continuation is complete. distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 5c3200aedcf788ea30bba84156fd623ae7a2138f..ce50489a861c8ef4d519266bbaa50500ada2d18e 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 3d3e1d3190082c757a442371fa671576cc5a6758..43771f06405de4d48c6b3831a5bf853b12bd9bca 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -30,6 +30,6 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 17441d6bb281e87f0ae45c8a4764f657809b7bee..4480583a2c123786c71d75356c7773bbcb08d75a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -33,7 +33,7 @@ let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { if (error && error.code) { - console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index d7cfc2a25b572c3178c3da71d9e04c5fb9c3a8af..43d1896b408f7296781a4e5b8b96b3748b44b8b1 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -25,7 +25,7 @@ try { missionManager.getMissionInfo('', 1, (error, data) => { if (error.code) { // Process service logic errors. - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cafe6d2675bfd9fe1deae8d548f4d07dc78f2e9b..744c2d363f20b94ee8a839062416e805f5e12734 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -27,7 +27,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -36,7 +36,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** missionManager.getMissionSnapShot('', id, (err, snapshot) => { if (err.code) { - console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); + console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 687ccf64618e815fe3f19d261340fcb11fb1ae87..f84648998cc5d6201a7d8af6e0021896651063b7 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -17,6 +17,7 @@ Before using the **ServiceExtensionContext** module, you must define a child cla import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; let context; + let commRemote; // Release the instance when the connection is disconnected. class EntryAbility extends ServiceExtensionAbility { onCreate() { context = this.context; // Obtain a ServiceExtensionContext instance. @@ -55,6 +56,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -77,7 +79,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -85,7 +87,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -126,6 +128,7 @@ Starts an ability. This API uses a promise to return the result. | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -155,11 +158,11 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -195,6 +198,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -221,7 +225,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -229,7 +233,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -271,6 +275,7 @@ Observe the following when using this API: | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -295,7 +300,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -303,7 +308,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -346,6 +351,7 @@ Observe the following when using this API: | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -373,7 +379,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -381,7 +387,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -430,6 +436,7 @@ Observe the following when using this API: | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -461,11 +468,11 @@ Observe the following when using this API: }) .catch((error) => { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -516,7 +523,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -524,7 +531,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -584,11 +591,11 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu }) .catch((error) => { // Process service logic errors. - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -645,7 +652,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -653,7 +660,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -718,11 +725,11 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }) .catch((error) => { // Process service logic errors. - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -770,7 +777,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -778,7 +785,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -835,11 +842,11 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise }) .catch((error) => { // Process service logic errors. - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -892,7 +899,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -900,7 +907,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -962,11 +969,11 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }) .catch((error) => { // Process service logic errors. - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1003,7 +1010,7 @@ Terminates this ability. This API uses an asynchronous callback to return the re this.context.terminateSelf((error) => { if (error.code) { // Process service logic errors. - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -1046,7 +1053,7 @@ Terminates this ability. This API uses a promise to return the result. console.log('terminateSelf succeed'); }).catch((error) => { // Process service logic errors. - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1054,7 +1061,7 @@ Terminates this ability. This API uses a promise to return the result. connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; -Connects this ability to a ServiceAbility. +Connects this ability to a ServiceExtensionAbility. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1093,7 +1100,10 @@ Connects this ability to a ServiceAbility. abilityName: 'MyAbility' }; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.error('----------- onFailed -----------') } }; @@ -1103,7 +1113,7 @@ Connects this ability to a ServiceAbility. connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1154,7 +1164,10 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect }; let accountId = 100; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------'); }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------'); }, onFailed(code) { console.log('----------- onFailed -----------'); } }; @@ -1164,7 +1177,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1172,7 +1185,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<void>): void; -Disconnects this ability from the ServiceAbility. This API uses an asynchronous callback to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1204,17 +1217,19 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous try { this.context.disconnectServiceExtensionAbility(connection, (error) => { + commRemote = null; if (error.code) { // Process service logic errors. - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. console.log('disconnectServiceExtensionAbility succeed'); }); } catch (paramError) { + commRemote = null; // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1222,7 +1237,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous disconnectServiceExtensionAbility(connection: number): Promise<void>; -Disconnects this ability from the ServiceAbility. This API uses a promise to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1260,16 +1275,19 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret try { this.context.disconnectServiceExtensionAbility(connection) .then((data) => { + commRemote = null; // Carry out normal service processing. console.log('disconnectServiceExtensionAbility succeed'); }) .catch((error) => { + commRemote = null; // Process service logic errors. - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { + commRemote = null; // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1312,6 +1330,7 @@ Observe the following when using this API: | 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | | 16000008 | Crowdtest App Expiration. | | 16000009 | Can not start ability in wukong mode. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal Error. | **Example** @@ -1337,11 +1356,11 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1369,10 +1388,10 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 9960a9bbedd04f2ceb18c3b7d34731df1689228a..b930a1027edd7c68715178a2229dbeb4979673eb 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -54,6 +54,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -117,6 +118,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -189,6 +191,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -257,6 +260,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -324,6 +328,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -401,6 +406,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -471,6 +477,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -542,6 +549,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -621,6 +629,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1349,6 +1358,7 @@ let want = { }; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1415,6 +1425,7 @@ let want = { let accountId = 100; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1438,7 +1449,7 @@ try { disconnectServiceExtensionAbility(connection: number): Promise\; -Disconnects from a ServiceExtensionAbility. This API uses a promise to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1471,6 +1482,7 @@ let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (err) => { + commRemote = null; if (err.code) { // Process service logic errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1480,6 +1492,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // Process input parameter errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1489,7 +1502,7 @@ try { disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\): void; -Disconnects from a ServiceExtensionAbility. This API uses an asynchronous callback to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1517,6 +1530,7 @@ let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (err) => { + commRemote = null; if (err.code) { // Process service logic errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1526,6 +1540,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // Process input parameter errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1569,6 +1584,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1675,6 +1691,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1746,6 +1763,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1819,6 +1837,7 @@ Observe the following when using this API: | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | diff --git a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index b4818183f77657d3852de06570e199086dc70941..c2dd40beaed0071db3277e86e86aacfb032f98b5 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -66,7 +66,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index c131d9bbd3e50790624d4eca0ea41c94d7022dd2..c0d5352efa43ffe6e98a4bd911a5e89d4beba3ca 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -31,7 +31,7 @@ try { inputDevice.getDeviceIds((error, ids) => { if (error) { console.log(`Failed to get device list. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } this.data = ids; @@ -91,7 +91,7 @@ try { inputDevice.getDeviceInfo(1, (error, inputDevice) => { if (error) { console.log(`Failed to get device information. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The device name is: " + inputDevice.name); @@ -421,7 +421,7 @@ try { inputDevice.getKeyboardType(1, (error, number) => { if (error) { console.log(`Failed to get keyboardtype. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The keyboard type of the device is: " + number); diff --git a/en/application-dev/reference/apis/js-apis-installer.md b/en/application-dev/reference/apis/js-apis-installer.md index 625883cf0313cf47a28e8dae9f1cec7ff79b39b2..e45395f5ed1b4c15a1aa77c1a651a884b40f0b21 100644 --- a/en/application-dev/reference/apis/js-apis-installer.md +++ b/en/application-dev/reference/apis/js-apis-installer.md @@ -26,7 +26,7 @@ getBundleInstaller(callback: AsyncCallback\): void; Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core @@ -60,7 +60,7 @@ getBundleInstaller(): Promise\; Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core @@ -90,7 +90,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: Installs a bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -119,7 +119,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | | 17700018 | Failed to install because the dependent module does not exist. | | 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | -| 17700036 | Failed to install because without allow app shared bundle permission. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | **Example** @@ -149,13 +151,84 @@ try { } ``` +## BundleInstaller.install + +install(hapFilePaths: Array\, installParam?: InstallParam) : Promise\; + +Installs a bundle. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array\ | Yes | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.| +| installParam | [InstallParam](#installparam) | No | Parameters required for the installation. | + +**Return value** + +| Type | Description | +| --------------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700004 | The specified user ID is not found. | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, installParam) + .then((data) => { + console.info('install success: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('install failed:' + err.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + ## BundleInstaller.uninstall uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void; Uninstalls a bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -177,6 +250,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | -------- | ------------------------------------------------------------ | | 17700004 | The specified user ID is not found. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | **Example** @@ -212,7 +286,7 @@ uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\) : voi Uninstalls a shared bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -266,7 +340,7 @@ uninstall(uninstallParam: UninstallParam) : Promise\; Uninstalls a shared bundle. This API uses a promise to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -325,7 +399,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& Recovers a bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -381,7 +455,7 @@ Defines the hash parameters for bundle installation and uninstall. **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Type | Mandatory| Description | | ---------- | ------ | ---------------- | ---------------- | @@ -394,15 +468,15 @@ Defines the parameters that need to be specified for bundle installation, uninst **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Type | Mandatory | Description | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.| -| installFlag | number | Yes | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| -| isKeepData | boolean | Yes | Whether to retain the data directory during bundle uninstall.| -| hashParams | Array<[HashParam](#hashparam)> | Yes| Hash parameters. | -| crowdtestDeadline| number | Yes |End date of crowdtesting.| +| userId | number | No | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.| +| installFlag | number | No | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| +| isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.| +| hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. | +| crowdtestDeadline| number | No |End date of crowdtesting.| | sharedBundleDirPaths | Array\ | No|Paths of the shared bundle files.| ## UninstallParam10+ @@ -411,7 +485,7 @@ Defines the parameters required for the uninstallation of a shared bundle. **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ------------------------------------------------------------ | diff --git a/en/application-dev/reference/apis/js-apis-overlay.md b/en/application-dev/reference/apis/js-apis-overlay.md index 61181d1767aeb33951b983163b376478cf3d1f36..1542953d78f5f09b01cbbe795c02e4170a195ef3 100644 --- a/en/application-dev/reference/apis/js-apis-overlay.md +++ b/en/application-dev/reference/apis/js-apis-overlay.md @@ -5,8 +5,6 @@ The **overlay** module provides APIs for installing a [module with the overlay f > **NOTE** > > The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> The APIs provided by this module are system APIs. ## Modules to Import @@ -41,8 +39,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -84,8 +82,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -116,7 +114,7 @@ Enables or disables a module with the overlay feature in another application. Th **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -138,10 +136,10 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700001 | The specified bundleName is not found. | -| 17700002 | The specified moduleName is not existed. | -| 17700032 | The specified bundleName does not contain any overlay module. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -172,7 +170,7 @@ Enables or disables a module with the overlay feature in another application. Th **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -181,7 +179,7 @@ Enables or disables a module with the overlay feature in another application. Th | bundleName | string | Yes | Bundle name of the application. | | moduleName | string | Yes | HAP name of the module with the overlay feature. | | isEnabled | boolean | Yes | Whether to enable the module with the overlay feature. The value **true** means to enable the module, and **false** means to disable the module.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the processing result obtained; otherwise, **err** is an error object. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and data is the processing result obtained; otherwise, **err** is an error object. | **Error codes** @@ -189,10 +187,10 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700001 | The specified bundleName is not found. | -| 17700002 | The specified moduleName is not existed. | -| 17700032 | The specified bundleName does not contain any overlay module. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -240,8 +238,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700032 | he specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -271,7 +270,7 @@ Obtains the information about a module with the overlay feature in the current a | Name | Type | Mandatory | Description | | ----------- | ------ | ---- | --------------------------------------- | | moduleName | string | Yes | HAP name of the module with the overlay feature. | -| callback | AsyncCallback\ | Yes | Callback used to return the result, which is an **OverlayModuleInfo** object. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -279,8 +278,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700032 | he specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -325,8 +325,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700034 | The specified moduleName is overlay module. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | **Example** @@ -356,7 +356,7 @@ Obtains the information about modules with the overlay feature in the current ap | Name | Type | Mandatory | Description | | ----------- | ------ | ---- | --------------------------------------- | | targetModuleName | string | Yes | HAP name of the target module specified by modules with the overlay feature. | -| callback | AsyncCallback\> | Yes | Callback used to return the result, which is an array of **OverlayModuleInfo** objects. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -364,8 +364,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | -| 17700002 | The specified moduleName is not existed. | -| 17700034 | The specified moduleName is overlay module. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | **Example** @@ -394,7 +394,7 @@ Obtains the information about a module with the overlay feature in another appli **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -416,9 +416,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700032 | The specified bundleName does not contain any overlay module. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -446,7 +446,7 @@ Obtains the information about a module with the overlay feature in another appli **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -454,7 +454,7 @@ Obtains the information about a module with the overlay feature in another appli | ----------- | ------ | ---- | --------------------------------------- | | bundleName | string | Yes | Bundle name of the application. | | moduleName | string | Yes | HAP name of the module with the overlay feature. If this parameter is not specified, the API obtains the information of all modules with the overlay feature in that application. | -| callback | AsyncCallback\> | Yes | Callback used to return the result, which is an array of **OverlayModuleInfo** objects. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -463,9 +463,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700032 | The specified bundleName does not contain any overlay module. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -496,14 +496,14 @@ Obtains the information about all modules with the overlay feature in another ap **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** | Name | Type | Mandatory | Description | | ----------- | ------ | ---- | --------------------------------------- | | bundleName | string | Yes | Bundle name of the application. | -| callback | AsyncCallback\> | Yes | Callback used to return the result, which is an array of **OverlayModuleInfo** objects. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -512,9 +512,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700032 | The specified bundleName does not contain any overlay module. | -| 17700033 | The specified moduleName is not overlay module. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | **Example** @@ -544,7 +544,7 @@ Obtains the information about modules with the overlay feature in another applic **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -557,7 +557,7 @@ Obtains the information about modules with the overlay feature in another applic | Type | Description | | ------------------------- | ------------------ | -| Promise\> | Promise used to return the result, which is an array of **OverlayModuleInfo** objects.| +| Promise\> | Promise used to return the array of overlay module information obtained.| **Error codes** @@ -566,9 +566,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700034 | The specified moduleName is overlay module. | -| 17700035 | The specified bundleName is overlay bundle. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | **Example** @@ -596,15 +596,15 @@ Obtains the information about modules with the overlay feature in another applic **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** | Name | Type | Mandatory | Description | | ----------- | ------ | ---- | --------------------------------------- | | targetBundleName | string | Yes | Bundle name of the application. | -| moduleName | string | No | HAP name of the target module, which is **targetModuleName** specified by modules with the overlay feature. If this parameter is not specified, the API obtains the information associated with all modules in that application. | -| callback | AsyncCallback\> | Yes | Callback used to return the result, which is an array of **OverlayModuleInfo** objects. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| moduleName | string | Yes | HAP name of the target module, which is **targetModuleName** specified by modules with the overlay feature. If this parameter is not specified, the API obtains the information associated with all modules in that application. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -613,9 +613,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700034 | The specified moduleName is overlay module. | -| 17700035 | The specified bundleName is overlay bundle. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | **Example** @@ -646,14 +646,14 @@ Obtains the information about all modules with the overlay feature in another ap **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** | Name | Type | Mandatory | Description | | ----------- | ------ | ---- | --------------------------------------- | | targetBundleName | string | Yes | Bundle name of the application. | -| callback | AsyncCallback\> | Yes | Callback used to return the result, which is an array of **OverlayModuleInfo** objects. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** @@ -662,9 +662,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | ------ | -------------------------------------- | | 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not existed. | -| 17700034 | The specified moduleName is overlay module. | -| 17700035 | The specified bundleName is overlay bundle. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-taskpool.md b/en/application-dev/reference/apis/js-apis-taskpool.md index 8773e4c9df7945a5b686601b7ad8f3de3694d2f4..c1741b242f4b98d76df8ad4868dfc75d8089b36a 100644 --- a/en/application-dev/reference/apis/js-apis-taskpool.md +++ b/en/application-dev/reference/apis/js-apis-taskpool.md @@ -13,7 +13,7 @@ The **TaskPool** APIs return error codes in numeric format. For details about th ## Modules to Import -```js +```ts import taskpool from '@ohos.taskpool'; ``` @@ -58,9 +58,9 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -110,9 +110,9 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -158,9 +158,9 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -199,9 +199,9 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -209,7 +209,11 @@ function func(args) { async function taskpoolTest() { let task = new taskpool.Task(func, 100); let value = await taskpool.execute(task); - taskpool.cancel(task); + try { + taskpool.cancel(task); + } catch (e) { + console.log("taskpool.cancel occur error:" + e); + } } taskpoolTest(); @@ -221,12 +225,19 @@ taskpoolTest(); The following sequenceable data types are supported: All Primitive Type (excluding symbol), Date, String, RegExp, Array, Map, Set, Object, ArrayBuffer, and TypedArray. ### Precautions -A task in the task pool can reference only variables passed in by input parameters or imported variables. It does not support closure variables. +- The task pool APIs can be used only in the module with **compileMode** set to **esmodule** in the stage model. To check the **compileMode** setting of a module, open the **build-profile.json5** file of the module and check for **"compileMode": "esmodule"** under **buildOption**. +- A task in the task pool can reference only variables passed in by input parameters or imported variables, rather than closure variables. The decorator **@Concurrent** is used to intercept unsupported variables. +- A task in the task pool supports only common functions or async functions, rather than class member functions or anonymous functions. The decorator **@Concurrent** is used to intercept unsupported functions. +- The decorator **@Concurrent** can be used only in the .ets file. To create a task in the task pool in the .ts file, use the statement **use concurrent**. -```js -// 1. Reference a variable passed in by the input parameter. +### Using the Task Pool in Simple Mode + +**Example 1** + +```ts +// Common functions are supported, and variables passed in by input parameters are also supported. +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -245,17 +256,19 @@ async function taskpoolTest() { taskpoolTest(); ``` -```js -// 2. Reference an imported variable. +**Example 2** -// b.ts +```ts +// b.ets export var c = 2000; +``` +```ts +// Reference an imported variable. +// a.ets (in the same directory as b.ets) +import { c } from "./b"; -// a.ts (in the same directory as b.ts) -import { c } from './b' - +@Concurrent function test(a) { - "use concurrent" console.log(a); console.log(c); return a; @@ -274,3 +287,63 @@ async function taskpoolTest() { taskpoolTest(); ``` + +**Example 3** + +```ts +// The async functions are supported. +@Concurrent +async function task() { + let ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} + +async function taskpoolTest() { + taskpool.execute(task).then((result) => { + console.log("TaskPoolTest task result: " + result); + }); +} + +taskpoolTest(); +``` + +**Example 4** + +```ts +// Use use concurrent to create a task in the task pool in the .ts file. +// c.ts +function test1(n) { + "use concurrent" + return n; +} +export async function taskpoolTest1() { + console.log("taskpoolTest1 start"); + var task = new taskpool.Task(test1, 100); + var result = await taskpool.execute(task); + console.log("taskpoolTest1 result:" + result); +} + +async function test2() { + "use concurrent" + var ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} +export async function taskpoolTest2() { + console.log("taskpoolTest2 start"); + taskpool.execute(test2).then((result) => { + console.log("TaskPoolTest2 result: " + result); + }); +} +``` + +```ts +/ / a.ets (in the same directory as c.ts) +import { taskpoolTest1, taskpoolTest2 } from "./c"; + +taskpoolTest1(); +taskpoolTest2(); +``` diff --git a/en/application-dev/reference/apis/js-apis-uiappearance.md b/en/application-dev/reference/apis/js-apis-uiappearance.md new file mode 100644 index 0000000000000000000000000000000000000000..3bac964627675b3475e273551d06b146636b410d --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-uiappearance.md @@ -0,0 +1,106 @@ +# UI Appearance + +The **uiAppearance** module provides basic capabilities for managing the system appearance. It allows for color mode configuration currently, and will introduce more features over time. + +> **NOTE** +> +> The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + + +## Modules to Import + +```ts +import uiAppearance from '@ohos.uiAppearance' +``` + + +## DarkMode + +Enumerates the color modes. + + +**System capability**: SystemCapability.ArkUI.UiAppearance + +| Name| Value| Description| +| -- | -- | -- | +| ALWAYS_DARK | 0 | The system is always in dark mode. | +| ALWAYS_LIGHT | 1 | The system is always in light mode.| + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode, callback: AsyncCallback\): void + +Sets the system color mode. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| +| callback | AsyncCallback\| Yes| Callback used to return the result.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); +}) + ``` + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode): Promise\; + +Sets the system color mode. This API uses a promise to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| + +**Return value** + +| Type | Description | +| ------ | ------------------------------ | +| Promise\ | Promise that returns no value.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.log('Set dark-mode successfully.'); +}).catch((err) => { + console.log(`Set dark-mode failed, ${err}`); +}); + ``` + + +## uiAppearance.getDarkMode + +getDarkMode(): DarkMode; + +Obtains the system color mode. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Return value** +| Type| Description| +| -- | -- | +|[DarkMode](#darkmode) | Color mode obtained.| + +**Example** + ```ts +let darkMode = uiAppearance.getDarkMode(); +console.log(`Get dark-mode ${darkMode}`); + ``` diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index 769c7d3905a01f7709e6a47c14590b8658f91f9d..32a9f00da8e8b45373629f13cadd7b9414855591 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -43,7 +43,7 @@ - [DataShare Error Codes](errorcode-datashare.md) - [Distributed Data Object Error Codes](errorcode-distributed-dataObject.md) - [Distributed KV Store Error Codes](errorcode-distributedKVStore.md) - - [Preferences Error Codes](errorcode-preferences.md) + - [User Preference Error Codes](errorcode-preferences.md) - File Management - [File Management Error Codes](errorcode-filemanagement.md) - Telephony Service diff --git a/en/application-dev/reference/errorcodes/errorcode-CommonEventService.md b/en/application-dev/reference/errorcodes/errorcode-CommonEventService.md index 9b61d8e62ed722b1a3409d8d8ddcfe8c31962cc6..d63e1bc200c6b22299436e63893d8570414863b9 100644 --- a/en/application-dev/reference/errorcodes/errorcode-CommonEventService.md +++ b/en/application-dev/reference/errorcodes/errorcode-CommonEventService.md @@ -1,5 +1,9 @@ # Event Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1500001 Want Action Is Null **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md b/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md index 2edb0dc58a5b83676839ec55eaa32c0c3af53bcc..1e2ff942731b5f17f0aad6e5057f095dc682c538 100644 --- a/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md +++ b/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md @@ -1,5 +1,9 @@ # DeviceUsageStatistics Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 10000001 Memory Operation Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md b/en/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md index 9ecc659b536a7fe844ada31138d292593e0dc41a..dc3bdb66c077ad2a50da4bf1b71f39a20ea80efc 100644 --- a/en/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md +++ b/en/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md @@ -1,5 +1,9 @@ # DistributedNotificationService Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1600001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md b/en/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md index e815e8e881396cde327155f2c4593778d277b19c..62539888a7dc19cae0adf2ea3010affb637e9a96 100644 --- a/en/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md +++ b/en/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md @@ -1,5 +1,9 @@ # Distributed Scheduler Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 16600001 The system ability works abnormally. **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-ability.md b/en/application-dev/reference/errorcodes/errorcode-ability.md index 8c7aa0c06ccc996e96b05514e6f85ccfe8d22a69..b8ca0fb14876dadf9b5e925f715430c1f6a26e24 100644 --- a/en/application-dev/reference/errorcodes/errorcode-ability.md +++ b/en/application-dev/reference/errorcodes/errorcode-ability.md @@ -1,5 +1,9 @@ # Ability Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 16000001 Ability Name Does Not Exist **Error Message** @@ -182,6 +186,24 @@ The context passed in the API does not exist. Use the correct context. +## 16000017 Waiting for the Previous Abilities to Finish Startup + +**Error Message** + +The previous ability is starting, wait start later. + +**Description** + +Too many abilities need to be started. Due to the limited processing capability of the system, the requests are cached in the queue and processed in sequence. + +**Possible Causes** + +The system has a large number of concurrent requests. + +**Solution** + +No action is required. Wait for the previous abilities to finish startup. + ## 100001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-access-token.md b/en/application-dev/reference/errorcodes/errorcode-access-token.md index b5280137e6fb1751020324750e5c7fa2b56c6127..73eb9b7292928683a8efa45f741c97f9faf9b18f 100644 --- a/en/application-dev/reference/errorcodes/errorcode-access-token.md +++ b/en/application-dev/reference/errorcodes/errorcode-access-token.md @@ -1,5 +1,9 @@ # Application Access Control Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 12100001 Invalid Parameters **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-accessibility.md b/en/application-dev/reference/errorcodes/errorcode-accessibility.md index 954c8464f3fd81d2f6c980f42711871d546dc078..4a2d8a131c6c1eb4790b33d69d21ab9bc60b6377 100644 --- a/en/application-dev/reference/errorcodes/errorcode-accessibility.md +++ b/en/application-dev/reference/errorcodes/errorcode-accessibility.md @@ -1,5 +1,9 @@ # Accessibility Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 9300001 Invalid Bundle Name or Ability Name **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-account.md b/en/application-dev/reference/errorcodes/errorcode-account.md index 5c146225a1d3b2e3d19ae10b95a9cb776ef5b5aa..cf585060c6cf440ab2c269b6b5eb40cb8e04dc9c 100644 --- a/en/application-dev/reference/errorcodes/errorcode-account.md +++ b/en/application-dev/reference/errorcodes/errorcode-account.md @@ -1,5 +1,9 @@ # Account Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + The following includes the error codes for OS accounts, distributed accounts, and app accounts. ## 12300001 System Service Abnormal diff --git a/en/application-dev/reference/errorcodes/errorcode-animator.md b/en/application-dev/reference/errorcodes/errorcode-animator.md index 7ddd8302de3908526f9fcc18c3e6d76f13d2345c..8c196fd7913a58609976dce5980239dc319bd196 100644 --- a/en/application-dev/reference/errorcodes/errorcode-animator.md +++ b/en/application-dev/reference/errorcodes/errorcode-animator.md @@ -1,5 +1,9 @@ # Animator Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 100001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-audio.md b/en/application-dev/reference/errorcodes/errorcode-audio.md index 42642c804e9e5be20c9f3045270e51344084d24a..e6cdd5562ad108021899723e367a98182f1314c9 100644 --- a/en/application-dev/reference/errorcodes/errorcode-audio.md +++ b/en/application-dev/reference/errorcodes/errorcode-audio.md @@ -1,5 +1,9 @@ # Audio Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 6800101 Invalid Parameter **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-avsession.md b/en/application-dev/reference/errorcodes/errorcode-avsession.md index a072aa68d0d35b21470b3c68e55b06a856466932..1510be9cb5de7590955c0e274e9b27cd0241b1c6 100644 --- a/en/application-dev/reference/errorcodes/errorcode-avsession.md +++ b/en/application-dev/reference/errorcodes/errorcode-avsession.md @@ -1,5 +1,9 @@ # AVSession Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 6600101 Session Service Exception **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md b/en/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md index ffd2abc37593135bd0d1b921d98cbec3319501b2..a92c890358492459fdf13ef213ac3a392628a5b7 100644 --- a/en/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md +++ b/en/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md @@ -1,5 +1,9 @@ # backgroundTaskManager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 9800001 Memory Operation Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-batteryStatistics.md b/en/application-dev/reference/errorcodes/errorcode-batteryStatistics.md index 6618e266707d3e187e0b79fcef9c67ac9ae5d142..d2a31edb90d43d210dc1a58d3234b20dbae58650 100644 --- a/en/application-dev/reference/errorcodes/errorcode-batteryStatistics.md +++ b/en/application-dev/reference/errorcodes/errorcode-batteryStatistics.md @@ -1,5 +1,9 @@ # Power Consumption Statistics Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4600101 Service Connection Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-brightness.md b/en/application-dev/reference/errorcodes/errorcode-brightness.md index 98dbced9c54a41dc6c55eb35ddf018c5a089d4be..d8c754926877014aa43c18c9951da7c31316c75d 100644 --- a/en/application-dev/reference/errorcodes/errorcode-brightness.md +++ b/en/application-dev/reference/errorcodes/errorcode-brightness.md @@ -1,5 +1,9 @@ # Brightness Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4700101 Service Connection Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-bundle.md b/en/application-dev/reference/errorcodes/errorcode-bundle.md index 0787c1a76568ac0baf10306de38b8d97d6ada58e..f86c810b07e06b53797010d3b95080b5a7ca258d 100644 --- a/en/application-dev/reference/errorcodes/errorcode-bundle.md +++ b/en/application-dev/reference/errorcodes/errorcode-bundle.md @@ -1,4 +1,8 @@ -# Bundle Error Codes +# Bundle Error Codes + +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). ## 17700001 Bundle Name Does Not Exist @@ -506,7 +510,7 @@ Check whether the application contains a module with the overlay feature. **Error Message** -The specified module is not overlay module. +The specified module is not an overlay module. **Description** @@ -524,7 +528,7 @@ Check whether the module is configured with the overlay feature. **Error Message** -The specified module is overlay module. +The specified module is an overlay module. **Description** @@ -542,7 +546,7 @@ Check whether the specified module is configured with the overlay feature. **Error Message** -The specified bundle is overlay bundle. +The specified bundle is an overlay bundle. **Description** @@ -560,7 +564,7 @@ Check whether the application contains only modules with the overlay feature. **Error Message** -Failed to install because without allow app shared bundle permission. +Failed to install the HSP because lacks appropriate permissions. **Description** @@ -609,3 +613,39 @@ The shared library to uninstall does not exist. **Solution** 1. Check whether the shared library exists. 2. Check whether the version of the shared library is the same as that installed. + +## 17700039 Failure in Installing an Inter-Application Shared Library + +**Error Message** + +Failed to install because disallow install a shared bundle by hapFilePaths. + +**Description** + +During application installation, the installation package passed in is of the inter-application shared library type. + +**Possible Causes** +1. When the Bundle Manager tool is used to install an application, the **-p** parameter is set to the installation package path of an inter-application shared library. +2. When the **install** API is called to install an application, the **hapFilePaths** parameter is set to the installation package path of an inter-application shared library. + +**Solution** +1. Use the **-s** parameter to specify the installation package path of an inter-application shared library. +2. Use the **sharedBundleDirPaths** parameter in **installParam** to specify the installation package path of an inter-application shared library. + +## 17700040 Failure in Uninstalling an Inter-Application Shared Library + +**Error Message** + +The specified bundle is a shared bundle which cannot be uninstalled. + +**Description** + +During application uninstall, the bundle name of an inter-application shared library is passed in. + +**Possible Causes** +1. When the Bundle Manager tool is used to uninstall an application, the **-n** parameter is set to the bundle name of an inter-application shared library. +2. When the **install** API is called to uninstall an application, the **bundleName** parameter is set to the bundle name of an inter-application shared library. + +**Solution** +1. Use the **-s** parameter to specify the application to be uninstalled as a shared library application. +2. Use the **bundleName** and **versionCode** parameters in **UninstallParam** to specify the bundle name and version of the shared library to be uninstalled. diff --git a/en/application-dev/reference/errorcodes/errorcode-cert.md b/en/application-dev/reference/errorcodes/errorcode-cert.md index 1aab03ff6f10cb18bf9c780c993f16c97789679b..2fdcd645aa577c962d0d994edf791378223c2691 100644 --- a/en/application-dev/reference/errorcodes/errorcode-cert.md +++ b/en/application-dev/reference/errorcodes/errorcode-cert.md @@ -1,5 +1,9 @@ # Certificate Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 19020001 Memory Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-colorspace-manager.md b/en/application-dev/reference/errorcodes/errorcode-colorspace-manager.md index c2afdd192f26f11593f0a8c6a72f4586c523071e..b319c808661af7f43156a6a5368d9e060d2ce7d9 100644 --- a/en/application-dev/reference/errorcodes/errorcode-colorspace-manager.md +++ b/en/application-dev/reference/errorcodes/errorcode-colorspace-manager.md @@ -1,5 +1,9 @@ # colorSpaceManager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 18600001 Abnormal Parameter Value **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-crypto-framework.md b/en/application-dev/reference/errorcodes/errorcode-crypto-framework.md index 59dc2e59239c06f3111e0a481a65651b06f266d8..cbc28bcecae6b07c34b0cf1b2b0f474dec2369bb 100644 --- a/en/application-dev/reference/errorcodes/errorcode-crypto-framework.md +++ b/en/application-dev/reference/errorcodes/errorcode-crypto-framework.md @@ -1,5 +1,9 @@ # Crypto Framework Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 17620001 Memory Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-data-rdb.md b/en/application-dev/reference/errorcodes/errorcode-data-rdb.md index d7e89e178783267e178ef45da2174ce8cffd28ba..7da8eb85ea4d4c94d68f8057900a204743afbf5b 100644 --- a/en/application-dev/reference/errorcodes/errorcode-data-rdb.md +++ b/en/application-dev/reference/errorcodes/errorcode-data-rdb.md @@ -1,5 +1,9 @@ # RDB Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 14800010 Invalid RDB Name **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-datashare.md b/en/application-dev/reference/errorcodes/errorcode-datashare.md index 1dae1ebbae1af4b9940ffa6a81e9130eeaa4a94d..d97e4218f2132e0e9fc211450df1e7faebff0fef 100644 --- a/en/application-dev/reference/errorcodes/errorcode-datashare.md +++ b/en/application-dev/reference/errorcodes/errorcode-datashare.md @@ -1,5 +1,9 @@ # DataShare Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 15700010 Failed to Create a DataShareHelper **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-device-manager.md b/en/application-dev/reference/errorcodes/errorcode-device-manager.md index 30d834b33b6e2e037162d35bd39d7fa2e7967a06..ff0ba0b7f1444e32ed77b2e41fe772ec6675a657 100644 --- a/en/application-dev/reference/errorcodes/errorcode-device-manager.md +++ b/en/application-dev/reference/errorcodes/errorcode-device-manager.md @@ -1,5 +1,9 @@ # Device Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 11600101 Service Invoking Exception **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-display.md b/en/application-dev/reference/errorcodes/errorcode-display.md index 1a0fb96dbb909a8915569e0daf8f7aa497425038..15a3ca5d7c42e4ac9ec1f7e92fca5d191755854d 100644 --- a/en/application-dev/reference/errorcodes/errorcode-display.md +++ b/en/application-dev/reference/errorcodes/errorcode-display.md @@ -1,5 +1,9 @@ # Display Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1400001 Invalid Display or Screen **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md b/en/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md index 0ebad934ac37ea27b349fa9e2b0c0d4941f83ca3..e8bbc49064746828fbe26c057a0acd00fbc32482 100644 --- a/en/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md +++ b/en/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md @@ -1,5 +1,9 @@ # Distributed Data Object Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 15400001 Failed to Create the In-Memory Database **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-distributedKVStore.md b/en/application-dev/reference/errorcodes/errorcode-distributedKVStore.md index 5d1c22ab4c978474af0f12f896d0159857e271a8..878c33b3080b6572ef571e10ab18742abe56887b 100644 --- a/en/application-dev/reference/errorcodes/errorcode-distributedKVStore.md +++ b/en/application-dev/reference/errorcodes/errorcode-distributedKVStore.md @@ -1,5 +1,9 @@ # Distributed KV Store Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 15100001 Subscription Count Reaches the Limit **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md b/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md index 635183c8dad822894f02d4173cc8000f52d862f7..0e391ecb073dd2c6d3c5bc36d07ae30529c67c9e 100644 --- a/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md +++ b/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md @@ -1,5 +1,9 @@ # Enterprise Device Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 9200001 Application Not a Device Administrator **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-faultlogger.md b/en/application-dev/reference/errorcodes/errorcode-faultlogger.md index 303a61f8fc53975e9a71173970ed29a63f8a387b..6dd6ea38c8f780996d4fab9d28496886cfcb3f9d 100644 --- a/en/application-dev/reference/errorcodes/errorcode-faultlogger.md +++ b/en/application-dev/reference/errorcodes/errorcode-faultlogger.md @@ -1,5 +1,9 @@ # FaultLogger Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 10600001 Service Faulty or Not Started **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-filemanagement.md b/en/application-dev/reference/errorcodes/errorcode-filemanagement.md index 2c352ff97bc21223625ffc048353711b949e040a..4f45c7d0057984677b67f5a494667462e4a3fedb 100644 --- a/en/application-dev/reference/errorcodes/errorcode-filemanagement.md +++ b/en/application-dev/reference/errorcodes/errorcode-filemanagement.md @@ -1,4 +1,9 @@ # File Management Error Codes + +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + The error codes of the file management subsystem consist of the following:
- Basic file I/O error codes
- User data management error codes
- User file access error codes
- Spatial statistics error codes ## Basic File I/O Error Codes @@ -6,121 +11,153 @@ The error codes of the file management subsystem consist of the following:
- ### 13900001 Operation Not Permitted **Error Message** + Operation not permitted **Possible Causes** + The current operation on the file is not allowed. **Solution** + Check the permission for the file. ### 13900002 File or Directory Not Exist **Error Message** + No such file or directory **Possible Causes** + The file or directory does not exist. **Solution** + Check whether the file directory exists. ### 13900003 Process Not Exist **Error Message** + No such process **Possible Causes** + The process does not exist. **Solution** + 1. Check whether the process is killed unexpectedly. 2. Check whether the service related to the process has started. ### 13900004 System Call Interrupted **Error Message** + Interrupted system call **Possible Causes** + The system call is interrupted by another thread. **Solution** + 1. Check the multi-thread code logic. 2. Invoke the system call again. ### 13900005 I/O Error **Error Message** + I/O error **Possible Causes** + The I/O request is invalid. **Solution** + Initiate the I/O request again. ### 13900006 Device or Address Not Exist **Error Message** + No such device or address **Possible Causes** + The device information or address is incorrect. **Solution** + Check that the device information or address is correct. ### 13900007 Long Parameter List **Error Message** + Arg list too long **Possible Causes** + The parameter list is too long. **Solution** + Reduce the number of parameters. ### 13900008 Invalid File Descriptor **Error Message** + Bad file descriptor **Possible Causes** + This file descriptor is closed. **Solution** + Check whether the file descriptor is closed. ### 13900009 Child Process Not Exist **Error Message** + No child processes **Possible Causes** + The child process cannot be created. **Solution** + Check the maximum number of processes in the system. ### 13900010 Resource Unavailable **Error Message** + Try again **Possible Causes** + The resources are blocked. **Solution** + Request resources. ### 13900011 Memory Overflow **Error Message** + Out of memory **Possible Causes** + A memory overflow occurs. **Solution** @@ -130,9 +167,13 @@ A memory overflow occurs. ### 13900012 Permission Denied **Error Message** + Permission denied **Possible Causes** + + + 1. You do not have the permission to operate the file. 2. The file sandbox path is incorrect. @@ -143,329 +184,418 @@ Permission denied ### 13900013 Incorrect Address **Error Message** + Bad address **Possible Causes** + The address is incorrect. **Solution** + Check that the address is correct. ### 13900014 Device or Resource Not Available **Error Message** + Device or resource busy **Possible Causes** + The requested resource is unavailable. **Solution** + Request the resource again. ### 13900015 File Already Exists **Error Message** + File exists **Possible Causes** + The file to be created already exists. **Solution** + Check whether the file path is correct. ### 13900016 Invalid Cross-Device Link **Error Message** + Cross-device link **Possible Causes** + The link between devices is incorrect. **Solution** + Check the devices and create the link correctly. ### 13900017 Device Not Exist **Error Message** + No such device **Possible Causes** + The device is not identified. **Solution** + Check the connection to the target device. ### 13900018 Invalid Directory **Error Message** + Not a directory **Possible Causes** + The specified directory is invalid. **Solution** + Check that the directory is correct. ### 13900019 The Specified Object Is a Directory **Error Message** + Is a directory **Possible Causes** + The specified object is a directory. **Solution** + Check that the specified data is correct. ### 13900020 Invalid Parameter **Error Message** + Invalid argument **Possible Causes** + Invalid input parameter is detected. **Solution** + Check that the input parameters are valid. ### 13900021 Too Many File Descriptors Opened **Error Message** + File table overflow **Possible Causes** + The number of file descriptors opened has reached the limit. **Solution** + Close the file descriptors that are no longer required. ### 13900022 Too Many Files Opened **Error Message** + Too many open files **Possible Causes** + The number of files opened has reached the limit. **Solution** + Close the files that are not required. ### 13900023 Text File Not Respond **Error Message** + Text file busy **Possible Causes** + The executable file of the program is in use. **Solution** + Close the program that is being debugged. ### 13900024 File Oversized **Error Message** + File too large **Possible Causes** + The file size exceeds the limit. **Solution** + Check whether the file size exceeds the limit. ### 13900025 Insufficient Space on the Device **Error Message** + No space left on device **Possible Causes** + The device storage space is insufficient. **Solution** + Clear the space of the device. ### 13900026 Invalid Shift **Error Message** + Illegal seek **Possible Causes** + Seek is used in pipe or FIFO. **Solution** + Check the use of seek. ### 13900027 Read-Only File System **Error Message** + Read-only file system **Possible Causes** + The file system allows read operations only. **Solution** + Check whether the file is read-only. ### 13900028 Links Reach the Limit **Error Message** + Too many links **Possible Causes** + The number of links to the file has reached the limit. **Solution** + Delete the links that are no longer required. ### 13900029 Resource Deadlock **Error Message** + Resource deadlock would occur **Possible Causes** + Resource deadlock occurs. **Solution** + Terminate the deadlock process. ### 13900030 Long File Name **Error Message** + Filename too Long **Possible Causes** + The length of the path or file name exceeds the limit. **Solution** + Modify the path or file name. ### 13900031 Function Not Implemented **Error Message** + Function not implemented **Possible Causes** + The function is not supported by the system. **Solution** + Check the system version and update the system if required. ### 13900032 Directory Not Empty **Error Message** + Directory not empty **Possible Causes** + The specified directory is not empty. **Solution** + 1. Check the directory. 2. Ensure that the directory is empty. ### 13900033 Too Many Symbol Links **Error Message** + Too many symbolic links **Possible Causes** + There are too many symbolic links. **Solution** + Delete unnecessary symbol links. ### 13900034 Operation Blocked **Error Message** + Operation would block **Possible Causes** + The operation is blocked. **Solution** + Perform the operation again. ### 13900035 Invalid File Descriptor **Error Message** -Invalid request desecriptor + +Invalid request descriptor **Possible Causes** + The requested file descriptor is invalid. **Solution** + Check that the file descriptor is valid. ### 13900036 Target Is Not a Character Stream Device **Error Message** + Device not a stream **Possible Causes** + The device pointed to by the file descriptor is not a character stream device. **Solution** + Check whether the file descriptor points to a stream device. ### 13900037 No Data Available **Error Message** + No data available **Possible Causes** + The required data is not available. **Solution** + Request the data again. ### 13900038 Value Mismatches the Data Type **Error Message** + Value too large for defined data type **Possible Causes** + The specified value is out of the range defined for the data type. **Solution** + Modify the data type. ### 13900039 File Descriptor Corrupted **Error Message** + File descriptor in bad state **Possible Causes** + The file descriptor is corrupted. **Solution** + Check that the file descriptor is valid. ### 13900040 System Call Interrupted **Error Message** -Interrupted systen call should be restarted + +Interrupted system call should be restarted **Possible Causes** + The system call is interrupted. **Solution** + Invoke the system call again. ### 13900041 Disk Quota Exceeded **Error Message** + Quota exceeded **Possible Causes** + The disk space is insufficient. **Solution** + Clear disk space. ### 13900042 Unknown Error **Error Message** + Unknown error **Possible Causes** + The error is unidentified. **Solution** @@ -477,45 +607,57 @@ The error is unidentified. ### 14000001 Invalid File Name **Error Message** + Invalid display name **Possible Causes** + The file name contains invalid characters. **Solution** + Modify the file name. ### 14000002 Invalid URI **Error Message** + Invalid uri **Possible Causes** + The URI is invalid. **Solution** + Use the obtained URI. ### 14000003 Invalid File Name Extension **Error Message** + Invalid file extension **Possible Causes** + The file name extension is incorrect. **Solution** + Modify the file name extension. ### 14000004 File in Recycle Bin **Error Message** + File has been put into trash bin **Possible Causes** + The file is moved to the Recycle Bin. **Solution** + Check whether the file is in the Recycle Bin. ## Spatial Statistics Error Codes @@ -523,83 +665,105 @@ Check whether the file is in the Recycle Bin. ### 13600001 IPC Failed **Error Message** + IPC error **Possible Causes** + The called service does not exist. **Solution** + Check whether the service is started. ### 13600002 File System Not Supported **Error Message** -Not supported filesystem + +Not supported file system **Possible Causes** + The file system is not supported. **Solution** + Use a supported file system. ### 13600003 Mount Failed **Error Message** + Failed to mount **Possible Causes** + The **mount** command fails. **Solution** + Remove the card and run the **mount** command again. ### 13600004 Unmount Failed **Error Message** + Failed to unmount **Possible Causes** + The device does not respond. **Solution** + Check whether the file is being used. If yes, kill the thread that uses the file. ### 13600005 Incorrect Volume State **Error Message** + Incorrect volume state **Possible Causes** + The volume state is incorrect. **Solution** + Check whether the current volume state is correct. ### 13600006 Failed to Create a Directory or Node **Error Message** + Prepare directory or node error **Possible Causes** + The directory or node to be created already exists. **Solution** + Check whether the directory or node to be created already exists. ### 13600007 Failed to Delete a Directory or Node **Error Message** + Delete directory or node error **Possible Causes** + The specified directory or node has been deleted. **Solution** + Check whether the specified directory or node exists. ### 13600008 Object Not Exist **Error Message** + No such object **Possible Causes** @@ -613,12 +777,15 @@ No such object ### 13600009 Invalid User ID **Error Message** + User id out of range **Possible Causes** + The specified user ID is incorrect. **Solution** + Check that the user ID is correct. ## User File Access Error Codes @@ -626,51 +793,64 @@ Check that the user ID is correct. ### 14300001 IPC Failed **Error Message** + IPC error **Possible Causes** + 1. The server service does not exist. 2. The extension mechanism is abnormal. **Solution** + Check that the server service exists. ### 14300002 Incorrect URI Format **Error Message** + Invalid uri **Possible Causes** + The URI is invalid. **Solution** + Check that the URI is in correct format. ### 14300003 Failed to Obtain the Server Ability Information **Error Message** + Fail to get fileextension info **Possible Causes** + The BMS interface is abnormal. **Solution** + Check for basic system capability errors. ### 14300004 Incorrect Result Returned by js-server **Error Message** + Get wrong result **Possible Causes** + The data returned by the server is incorrect. **Solution** + Check the data returned by the server. ### 14300005 Failed to Register Notify **Error Message** + Fail to register notification **Possible Causes** @@ -678,11 +858,13 @@ Fail to register notification 2. The extension mechanism is abnormal. **Solution** + Check that the server service exists. ### 14300006 Failed to Unregister Notify **Error Message** + Fail to remove notification **Possible Causes** @@ -690,22 +872,27 @@ Fail to remove notification 2. The extension mechanism is abnormal. **Solution** + Check that the server service exists. ### 14300007 Failed to Initialize the Notify Agent **Error Message** + Fail to init notification agent **Possible Causes** + The specified Notify agent has not been registered. **Solution** + Check whether the specified Notify agent is registered. ### 14300008 Failed to Notify the Agent **Error Message** + Fail to notify agent **Possible Causes** @@ -713,6 +900,7 @@ Fail to notify agent 2. The extension mechanism is abnormal. **Solution** + Check whether the client is normal. ## Error Code Adaptation diff --git a/en/application-dev/reference/errorcodes/errorcode-form.md b/en/application-dev/reference/errorcodes/errorcode-form.md index 44184be85518557f141f05c49732fb3d2572399e..e3a3aa6ce0d23899aa9140f6650ab3d0aab01ba2 100644 --- a/en/application-dev/reference/errorcodes/errorcode-form.md +++ b/en/application-dev/reference/errorcodes/errorcode-form.md @@ -1,5 +1,9 @@ # Form Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 16500001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md b/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md index d0c02263c609d1fc477d39db80eb632b00bec2b5..dc6a45cfa530873862570dfaa50eb0d00a3766cb 100644 --- a/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md +++ b/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md @@ -1,5 +1,9 @@ # Location Subsystem Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 3301000 Location Service Unavailable **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md index 46256b87f89e224891a4428c9cc429bec0781bf6..e0b7e16e0510883addf190635795e08c35a68502 100644 --- a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md +++ b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md @@ -1,5 +1,9 @@ # Application Event Logging Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 11100001 Application Event Logging Disabled **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-hisysevent.md b/en/application-dev/reference/errorcodes/errorcode-hisysevent.md index 1263dbdbe531a6473069cc7c30b04987fbe4d582..78a9d504ffe3160f23c0e168201f66fd2a48abb3 100644 --- a/en/application-dev/reference/errorcodes/errorcode-hisysevent.md +++ b/en/application-dev/reference/errorcodes/errorcode-hisysevent.md @@ -1,5 +1,9 @@ # HiSysEvent Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1120001 Invalid Event Domain **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md b/en/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md index 627f5bf75be41bf261c3033a23234a26a0c0fce5..81311df1e71883918fb1fdeaac4e41ffecac53ae 100644 --- a/en/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md +++ b/en/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md @@ -1,5 +1,9 @@ # HiDebug Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 11400101 Failed to Obtain the System Service diff --git a/en/application-dev/reference/errorcodes/errorcode-huks.md b/en/application-dev/reference/errorcodes/errorcode-huks.md index 48907ecd87d3eff3ba9bb408aa1cc8b16f40218d..b8191e7ca53b6ef8eb73e921d30a6351c51b80db 100644 --- a/en/application-dev/reference/errorcodes/errorcode-huks.md +++ b/en/application-dev/reference/errorcodes/errorcode-huks.md @@ -1,5 +1,9 @@ # HUKS Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 12000001 Feature Not Supported **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-i18n.md b/en/application-dev/reference/errorcodes/errorcode-i18n.md index 8a1392286491b7e7173d26a2e62c740de4abdbdf..e78abf39b82bf0e4da3f35c0dfc14aaa78e31165 100644 --- a/en/application-dev/reference/errorcodes/errorcode-i18n.md +++ b/en/application-dev/reference/errorcodes/errorcode-i18n.md @@ -1,5 +1,9 @@ # i18n Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 890001 Incorrect Parameter Type **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md b/en/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md index 9633df375135c4bf168bb7e26d5c88c9405c15a3..a35dbe3700e4237c7ce9c1bfa6f4c0c8752a6c3e 100644 --- a/en/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md +++ b/en/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md @@ -1,5 +1,9 @@ # Input Method Framework Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 12800001 Package Manager Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-media.md b/en/application-dev/reference/errorcodes/errorcode-media.md index e6c8494be123c47090a5a3c04eba8c700dff1541..154e8bebb06101e414eed77a18042f5653d1691e 100644 --- a/en/application-dev/reference/errorcodes/errorcode-media.md +++ b/en/application-dev/reference/errorcodes/errorcode-media.md @@ -1,5 +1,9 @@ # Media Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 5400101 Memory Allocation Failed **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-multimodalinput.md b/en/application-dev/reference/errorcodes/errorcode-multimodalinput.md index bca5dbf90bcec2b16c36c45edee7576ef50f3358..6933bfcf7075ca21cf7a63959f11059da061ff36 100644 --- a/en/application-dev/reference/errorcodes/errorcode-multimodalinput.md +++ b/en/application-dev/reference/errorcodes/errorcode-multimodalinput.md @@ -1,5 +1,9 @@ # Screen Hopping Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4400001 Incorrect Target Device Descriptor **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-net-connection.md b/en/application-dev/reference/errorcodes/errorcode-net-connection.md index 00e1eaaf78562f95549c4724e182c66878ea249b..5504a70e8977dcf8d0f5fd172fa300de2f744a07 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-connection.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-connection.md @@ -1,5 +1,9 @@ # Network Connection Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2100001 Invalid Parameter Value **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md b/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md index b8a940de2a94863b309c4e6fd86600c39354a444..f7efa587738efb667dbf2292b077d2824f20e019 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-ethernet.md @@ -1,5 +1,9 @@ # Ethernet Connection Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2200001 Invalid Parameter Value **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-net-http.md b/en/application-dev/reference/errorcodes/errorcode-net-http.md index bece9d1b26bdeae59cfd489432aa88f49bc7fe60..a460d5d3a6e238658cf06ac2195c6f235de3b6bd 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-http.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-http.md @@ -1,5 +1,9 @@ # HTTP Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2300001 Protocol Not Supported **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-net-policy.md b/en/application-dev/reference/errorcodes/errorcode-net-policy.md index 87e1ad36f03dc74003787c764521fca1de10e3b2..594f498f72ce70daaf714111b411ac704baf0b1c 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-policy.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-policy.md @@ -1,5 +1,9 @@ # Policy Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2100001 Invalid Parameter Value **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-net-sharing.md b/en/application-dev/reference/errorcodes/errorcode-net-sharing.md index 5535d15e992c96d063746f89112be0d341f9a641..d5b529ec20a08bf7026c7153e073b4eb98b8bbd6 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-sharing.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-sharing.md @@ -1,5 +1,9 @@ # Network Sharing Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2200001 Invalid Parameter Value **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-nfc.md b/en/application-dev/reference/errorcodes/errorcode-nfc.md index 1de2fd7e62e83f485b8377a61b0e7146d59ce62c..07e1648fe3256d63c9a74a0a580041ebd4b869d9 100644 --- a/en/application-dev/reference/errorcodes/errorcode-nfc.md +++ b/en/application-dev/reference/errorcodes/errorcode-nfc.md @@ -1,5 +1,9 @@ # NFC Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 3100101 **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-notification.md b/en/application-dev/reference/errorcodes/errorcode-notification.md index 9f1d5219020314fb4e8b945cda3b2435f67ac1eb..610a13fafe60562eb5e8dfa363bf288e7930557f 100644 --- a/en/application-dev/reference/errorcodes/errorcode-notification.md +++ b/en/application-dev/reference/errorcodes/errorcode-notification.md @@ -1,5 +1,9 @@ # Notification Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1600001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-pasteboard.md b/en/application-dev/reference/errorcodes/errorcode-pasteboard.md index 05cee20afa712b867ddb31f46db98a74b7bd75cc..8f80d3822bf57f749fe2c5da0cd69a2ebad2e145 100644 --- a/en/application-dev/reference/errorcodes/errorcode-pasteboard.md +++ b/en/application-dev/reference/errorcodes/errorcode-pasteboard.md @@ -1,5 +1,9 @@ # Pasteboard Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 12900001 Index Out of Range **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-power.md b/en/application-dev/reference/errorcodes/errorcode-power.md index 83bbb2cdea786fd43b780fb9c153a31faf924e17..04e487e000dcce49af8f1aef1157dcd538dd4ceb 100644 --- a/en/application-dev/reference/errorcodes/errorcode-power.md +++ b/en/application-dev/reference/errorcodes/errorcode-power.md @@ -1,5 +1,9 @@ # Power Manager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4900101 Service Connection Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-preferences.md b/en/application-dev/reference/errorcodes/errorcode-preferences.md index 8abc1aaf4839704add8351d336b0f1bef8e154b9..67cd7ab9760d36627b0c29e0b4d3715bb3e9824a 100644 --- a/en/application-dev/reference/errorcodes/errorcode-preferences.md +++ b/en/application-dev/reference/errorcodes/errorcode-preferences.md @@ -1,13 +1,17 @@ -# Preferences Error Codes +# User Preference Error Codes -## 15500010 Failed to Delete Preferences +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + +## 15500010 Failed to Delete the User Preference Persistence File **Error Message** Failed to delete preferences. **Description** -Failed to delete the preference. +The operation of deleting the user preference persistence file failed. **Possible Causes** diff --git a/en/application-dev/reference/errorcodes/errorcode-promptAction.md b/en/application-dev/reference/errorcodes/errorcode-promptAction.md index 15266ac738f9f330d1327b517e8494dce04971d1..0f4ca91bbe7e6d985355751b7e0e8ed52a357133 100644 --- a/en/application-dev/reference/errorcodes/errorcode-promptAction.md +++ b/en/application-dev/reference/errorcodes/errorcode-promptAction.md @@ -1,5 +1,9 @@ # promptAction Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 100001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md b/en/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md index d48540a009d9ab4e529d1df8d29a42e3f5c11150..b74df9ec5663370f4d47e27eea0f71f100087479 100644 --- a/en/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md +++ b/en/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md @@ -1,5 +1,9 @@ # reminderAgentManager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1700001 Notification Disabled **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-request.md b/en/application-dev/reference/errorcodes/errorcode-request.md index 20de2eeb4639a8e85da7b916b6524c427ca23537..281c59764eacfc8a2b72ad15adfb8c65362ec19f 100644 --- a/en/application-dev/reference/errorcodes/errorcode-request.md +++ b/en/application-dev/reference/errorcodes/errorcode-request.md @@ -1,5 +1,9 @@ # Upload and Download Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 13400001 File Operation Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-resource-manager.md b/en/application-dev/reference/errorcodes/errorcode-resource-manager.md index 55bdbcc0fd70c6564e83d6e67fa8e34d08c1150b..d22ffb059b5459811ba5f332be94155c50022886 100644 --- a/en/application-dev/reference/errorcodes/errorcode-resource-manager.md +++ b/en/application-dev/reference/errorcodes/errorcode-resource-manager.md @@ -1,5 +1,9 @@ # Resource Manager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 9001001 Invalid Resource ID **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-router.md b/en/application-dev/reference/errorcodes/errorcode-router.md index 9a993e71c1fbcac9d28d8039b674770c1175174d..6c805ee9853deda64bce96a325ac7175d6d9bd97 100644 --- a/en/application-dev/reference/errorcodes/errorcode-router.md +++ b/en/application-dev/reference/errorcodes/errorcode-router.md @@ -1,5 +1,9 @@ # Router Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 100001 Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-rpc.md b/en/application-dev/reference/errorcodes/errorcode-rpc.md index 0487476f615d5f48ce534a7e79012ecb397bd7a5..f0aa4c443dfc34864a4af5eb1b01aa4a4d619ba6 100644 --- a/en/application-dev/reference/errorcodes/errorcode-rpc.md +++ b/en/application-dev/reference/errorcodes/errorcode-rpc.md @@ -1,5 +1,9 @@ # RPC Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + The APIs of the **rpc** module return exceptions since API version 9. ## 1900001 Failed to Call mmap diff --git a/en/application-dev/reference/errorcodes/errorcode-runninglock.md b/en/application-dev/reference/errorcodes/errorcode-runninglock.md index 5e55c69b6304f626ab2bc247e17547703c424056..ad628d5faff06576d018ff4700bbac4a5b79fd74 100644 --- a/en/application-dev/reference/errorcodes/errorcode-runninglock.md +++ b/en/application-dev/reference/errorcodes/errorcode-runninglock.md @@ -1,5 +1,9 @@ # Running Lock Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4900101 Service Connection Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-screenlock.md b/en/application-dev/reference/errorcodes/errorcode-screenlock.md index db1c6481b874be4d422528172f55467521185028..c1725934866cc4b6c90f23ddd0169c42f9a30415 100644 --- a/en/application-dev/reference/errorcodes/errorcode-screenlock.md +++ b/en/application-dev/reference/errorcodes/errorcode-screenlock.md @@ -1,5 +1,9 @@ # Screen Lock Management Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 13200002 Screen Lock Management Service Is Abnormal **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-sensor.md b/en/application-dev/reference/errorcodes/errorcode-sensor.md index 3e4170b55dcd6235031e1c4aea41b048a6a883da..dc8a1cad873d4a369bc6204ce94adb112d0c53e0 100644 --- a/en/application-dev/reference/errorcodes/errorcode-sensor.md +++ b/en/application-dev/reference/errorcodes/errorcode-sensor.md @@ -1,5 +1,9 @@ # Sensor Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 14500101 Service Exception **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-system-parameterV9.md b/en/application-dev/reference/errorcodes/errorcode-system-parameterV9.md index f959417bd8b1bef207591ce1178366791e202a01..189f5007d26ff11d050717bc4916017da8c65a8b 100644 --- a/en/application-dev/reference/errorcodes/errorcode-system-parameterV9.md +++ b/en/application-dev/reference/errorcodes/errorcode-system-parameterV9.md @@ -1,5 +1,9 @@ # System Parameter Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 14700101 Failure to Query the System Parameter **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-telephony.md b/en/application-dev/reference/errorcodes/errorcode-telephony.md index a39655b6cfb9183f32f99aae8e70023b8d35e4f4..dbe973a86c740e77f39261bb7274bd11024ecc30 100644 --- a/en/application-dev/reference/errorcodes/errorcode-telephony.md +++ b/en/application-dev/reference/errorcodes/errorcode-telephony.md @@ -1,5 +1,9 @@ # Telephony Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 8300001 Input Parameter Value Out of Range **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-thermal.md b/en/application-dev/reference/errorcodes/errorcode-thermal.md index d831a9ebe63ccff1a86ea8e77cb56a969c115f0b..f9b730f3dff3e2be0d484e316bcac5df99d4971c 100644 --- a/en/application-dev/reference/errorcodes/errorcode-thermal.md +++ b/en/application-dev/reference/errorcodes/errorcode-thermal.md @@ -1,5 +1,9 @@ # Thermal Manager Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 4800101 Service Connection Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-time.md b/en/application-dev/reference/errorcodes/errorcode-time.md index d63b3914ad6f480fdaa3808cf98ba25e390c7ebc..2d1ae51757f07996132956164d21a4bcb396b9c7 100644 --- a/en/application-dev/reference/errorcodes/errorcode-time.md +++ b/en/application-dev/reference/errorcodes/errorcode-time.md @@ -1,5 +1,9 @@ # Time and Time Zone Service Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## -1 Screen Unlock Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-uitest.md b/en/application-dev/reference/errorcodes/errorcode-uitest.md index 1a890ff377ca4e594729c610e888d4f455b87379..ac13f6dd628842b4ec86c4d194e96b7585a916a1 100644 --- a/en/application-dev/reference/errorcodes/errorcode-uitest.md +++ b/en/application-dev/reference/errorcodes/errorcode-uitest.md @@ -1,5 +1,9 @@ # UiTest Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 17000001 Initialization Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-update.md b/en/application-dev/reference/errorcodes/errorcode-update.md index 53318c851936ac7d09a8f1de4f35cfc56e249fb3..e17e94455cd13a82ad245dcc7325837d37b3a450 100644 --- a/en/application-dev/reference/errorcodes/errorcode-update.md +++ b/en/application-dev/reference/errorcodes/errorcode-update.md @@ -1,5 +1,9 @@ # Update Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 11500104 IPC Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-usb.md b/en/application-dev/reference/errorcodes/errorcode-usb.md index af2056cd5619cb45ee4af02f9424489fab63ffef..a29c15a13d740a4f8cdf6a9e62fea6dc9131ff77 100644 --- a/en/application-dev/reference/errorcodes/errorcode-usb.md +++ b/en/application-dev/reference/errorcodes/errorcode-usb.md @@ -1,5 +1,9 @@ # USB Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 14400001 USB Device Connection Denied **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-useriam.md b/en/application-dev/reference/errorcodes/errorcode-useriam.md index 2e84641a549af91c9101e94da86b54cf0db9d712..0a6fcdaa5ef57793930c22fad3e92971f52046a1 100644 --- a/en/application-dev/reference/errorcodes/errorcode-useriam.md +++ b/en/application-dev/reference/errorcodes/errorcode-useriam.md @@ -1,16 +1,8 @@ -# User Authentication Error Codes +# User Authentication Error Codes -## 201 Permission Verification Failed - -For details, see [Universal Error Codes](./errorcode-universal.md). - -## 202 Invoker Is Not a System Application - -For details, see [Universal Error Codes](./errorcode-universal.md). - -## 401 Parameter Check Failed. - -For details, see [Universal Error Codes](./errorcode-universal.md). +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). ## 12500001 Authentication Failed diff --git a/en/application-dev/reference/errorcodes/errorcode-utils.md b/en/application-dev/reference/errorcodes/errorcode-utils.md index c69ef691fe54f0949dba7858b46a6faee32c46a9..5301d298d0b95a5806c20a1f28151a8272193e3d 100644 --- a/en/application-dev/reference/errorcodes/errorcode-utils.md +++ b/en/application-dev/reference/errorcodes/errorcode-utils.md @@ -1,5 +1,9 @@ # Utils Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 10200001 Value Out of Range **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-vibrator.md b/en/application-dev/reference/errorcodes/errorcode-vibrator.md index f04a47bb5f5578d61eafa9b75ae650acdab41747..acf94929a0e78b50ede48e9da738178eae41fee7 100644 --- a/en/application-dev/reference/errorcodes/errorcode-vibrator.md +++ b/en/application-dev/reference/errorcodes/errorcode-vibrator.md @@ -1,5 +1,9 @@ # Vibrator Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 14600101 Device operation failed. **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-webview.md b/en/application-dev/reference/errorcodes/errorcode-webview.md index 20c9fbac29971072650bc3a06fa74eebd994e558..d298583a7e63749b6ff5bdfe4548fe26422887e5 100644 --- a/en/application-dev/reference/errorcodes/errorcode-webview.md +++ b/en/application-dev/reference/errorcodes/errorcode-webview.md @@ -1,5 +1,9 @@ # Webview Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 17100001 WebviewController Not Associated with a Web Component diff --git a/en/application-dev/reference/errorcodes/errorcode-wifi.md b/en/application-dev/reference/errorcodes/errorcode-wifi.md index 1d7443e49c03cc29f89c5b5d426eda752e7c36a7..80c30b43fb45abf38b6feba7514c98dcbacef216 100644 --- a/en/application-dev/reference/errorcodes/errorcode-wifi.md +++ b/en/application-dev/reference/errorcodes/errorcode-wifi.md @@ -1,5 +1,9 @@ # Wi-Fi Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 2401000 STA Internal Error **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-window.md b/en/application-dev/reference/errorcodes/errorcode-window.md index 5c034e88468111e4a67ad56da737ee62d8cbf536..d71a6744b622432f3d5dd5e4a02b71a97baac204 100644 --- a/en/application-dev/reference/errorcodes/errorcode-window.md +++ b/en/application-dev/reference/errorcodes/errorcode-window.md @@ -1,5 +1,9 @@ # Window Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 1300001 Repeated Operation **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-workScheduler.md b/en/application-dev/reference/errorcodes/errorcode-workScheduler.md index 12b28da09aaa4e072fff099c69f251949c3ad02a..34e8a080061c3c7be0c0eb64c0c9bf617ff26d05 100644 --- a/en/application-dev/reference/errorcodes/errorcode-workScheduler.md +++ b/en/application-dev/reference/errorcodes/errorcode-workScheduler.md @@ -1,5 +1,9 @@ # workScheduler Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 9700001 Memory Operation Failure **Error Message** diff --git a/en/application-dev/reference/errorcodes/errorcode-zlib.md b/en/application-dev/reference/errorcodes/errorcode-zlib.md index 3fb887f1fbac58b02fb356a703240bf07258ca0c..0a5aa80a0fc249c9613412a5111e7ea7e266e4e7 100644 --- a/en/application-dev/reference/errorcodes/errorcode-zlib.md +++ b/en/application-dev/reference/errorcodes/errorcode-zlib.md @@ -1,5 +1,9 @@ # zlib Error Codes +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). + ## 900001 Invalid Source File **Error Message** diff --git a/en/application-dev/security/app-provision-structure.md b/en/application-dev/security/app-provision-structure.md index c21fd0f533e72e41062a28d2c0d9f1ffdaabd9a1..6bc3bc69bf205192e58f5e3b3100b9d20e21067a 100644 --- a/en/application-dev/security/app-provision-structure.md +++ b/en/application-dev/security/app-provision-structure.md @@ -62,7 +62,7 @@ An example of the **HarmonyAppProvision** file is as follows: ### Internal Structure of the bundle-info Object -**NOTE**
The value of **bundle-name** in the **bundle-info** object in the HarmonyAppProvision file must be the same as the value of **bundleName** (in **config.js**/**module.json5**) of the signed application. To prevent a HarmonyAppProvision file from being used for signatures of different applications, the system checks whether the value of **bundleName** in the HAP signature is the same as that in the HAP configuration file during application installation. If they are different, the HAP cannot be installed. +**NOTE**
The value of **bundle-name** in the **bundle-info** object in the HarmonyAppProvision file must be the same as the value of **bundleName** (in **config.json** or **module.json5**) of the signed application. To prevent a HarmonyAppProvision file from being used for signatures of different applications, the system checks whether the value of **bundleName** in the HAP signature is the same as that in the HAP configuration file during application installation. If they are different, the HAP cannot be installed. | Name | Description | Data Type| Mandatory| Initial Value Allowed| | ------------------------ | ------------------------------- | ------- | -------- | --------- | diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md index 69885fb26ca0665683dad072fbeab5f3858d830b..fc3d8593e3bfcf75888d985d69c556db2dbe15b4 100644 --- a/en/application-dev/security/permission-list.md +++ b/en/application-dev/security/permission-list.md @@ -964,6 +964,16 @@ Allows the device administrator to set account management policies. **Enable via ACL**: TRUE +## ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +Allows the device administrator to set bundle installation policies. + +**Permission level**: system_basic + +**Authorization mode**: system_grant + +**Enable via ACL**: TRUE + ## ohos.permission.NFC_TAG Allows an application to read NFC tag information. @@ -1717,3 +1727,33 @@ Allows a system application to disable the application with the overlay feature **Authorization mode**: system_grant **Enable via ACL**: TRUE + +## ohos.permission.CONNECT_CELLULAR_CALL_SERVICE + +Allows a system ability (SA) to access the cellular call SA. + +**Permission level**: system_basic + +**Authorization mode**: system_grant + +**Enable ACL**: FALSE + +## ohos.permission.CONNECT_IMS_SERVICE + +Allows an SA to access the IMS SA. + +**Permission level**: system_basic + +**Authorization mode**: system_grant + +**Enable ACL**: FALSE + +## ohos.permission.ACCESS_SENSING_WITH_ULTRASOUND + +Allows an application to use ultrasonic sensing. + +**Permission level**: system_basic + +**Authorization mode**: system_grant + +**Enable ACL**: FALSE diff --git a/en/application-dev/security/userauth-guidelines.md b/en/application-dev/security/userauth-guidelines.md index 2902e73fe80c57942023674bb174cac384a218e2..f2bac259a83a5b595b69875cd99f47afda0b27e2 100644 --- a/en/application-dev/security/userauth-guidelines.md +++ b/en/application-dev/security/userauth-guidelines.md @@ -17,7 +17,6 @@ Before authentication, you must specify the [authentication type](../reference/a | API | Description | | ---------- | ----------------------- | -| getVersion() : number | Obtains the version information of an authentication object. | | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void | Checks whether the device supports the specified authentication type and level.| | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel): AuthInstance | Obtains an **AuthInstance** instance for user authentication.| | on(name : AuthEventKey, callback : AuthEvent) : void | Subscribes to the user authentication events of the specified type.| @@ -25,26 +24,6 @@ Before authentication, you must specify the [authentication type](../reference/a | start: void | Starts user authentication. | | cancel: void | Cancel this user authentication. | -## Obtaining Authentication Object Version Information - -### How to Develop - -1. Apply for the permission.
Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md). - -2. Use [getVersion](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetversion9) to obtain the version information. - - ```js - import userIAM_userAuth from '@ohos.userIAM.userAuth'; - - // Obtain version information. - try { - let version = userIAM_userAuth.getVersion(); - console.info("auth version = " + version); - } catch (error) { - console.info("get version failed, error = " + error); - } - ``` - ## Checking Authentication Capabilities Supported by a Device ### How to Develop diff --git a/en/application-dev/tools/bm-tool.md b/en/application-dev/tools/bm-tool.md index fad43d6ec5b00af19ad1255614725d3fccef75cf..324a4bf814a69e09bf06036208779d4519587afd 100644 --- a/en/application-dev/tools/bm-tool.md +++ b/en/application-dev/tools/bm-tool.md @@ -15,7 +15,7 @@ The Bundle Manager enables you to install, uninstall, update, and query a bundle | help | Displays the commands supported by the Bundle Manager tool.| | install | Installs a bundle.| | uninstall | Uninstalls a bundle.| -| dump | Queries bundle information.| +| dump | Displays bundle information.| | clean | Clears the cache and data of a bundle.| | enable | Enables a bundle. A bundle can be used after being enabled.| | disable | Disables a bundle. A bundle cannot be used after being disabled.| @@ -56,6 +56,7 @@ bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time] | -u | No| User whose HAP is to be installed. By default, the current user's HAP is installed.| | -r | No| Whether to install the HAP in overwrite mode. By default, the HAP is installed in overwrite mode.| | -w | No| Time that the Bundle Manager tool waits before installing the HAP. The minimum waiting time is 5s, and the maximum waiting time is 600s. The default waiting time is 5s.| +| -s | No| Installation path of an inter-application shared library (.hsp file). Multiple paths can be specified for simultaneous installation.| Example @@ -64,6 +65,12 @@ Example bm install -p /data/app/ohosapp.hap -u 100 -w 5s -r // The execution result is as follows: install bundle successfully. +# Install an inter-application shared library. +bm install -s xxx.hsp +# Install multiple inter-application shared libraries simultaneously. +bm install -s xxx.hsp yyy.hsp +# Install an application and the dependent inter-application shared library. +bm install -p aaa.hap -s xxx.hsp yyy.hsp ``` @@ -83,6 +90,8 @@ bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] | -m | No| Module of the bundle to uninstall. By default, all modules are uninstalled.| | -u | No| User whose bundle is to be uninstalled. By default, the current user's bundle is uninstalled.| | -k | No| Whether the application data is retained when the bundle is uninstalled. By default, the application data is deleted along the uninstall.| +| -s | No| Installation path of an inter-application shared library (.hsp file). Multiple paths can be specified for simultaneous installation.| +| -v | No| Version number of the shared bundle. By default, all shared bundles with the specified bundle name are uninstalled.| Example @@ -91,6 +100,10 @@ Example bm uninstall -n com.ohos.app -m com.ohos.app.EntryAbility -u 100 -k // The execution result is as follows: uninstall bundle successfully. +# Uninstall a shared bundle. +bm uninstall -s -n com.ohos.example +# Uninstall a shared bundle of the specified version. +bm uninstall -s -n com.ohos.example -v 100001 ``` @@ -286,3 +299,30 @@ bm quickfix -a -f /data/app/ // The execution result is as follows: apply quickfix succeed. ``` + +## Commands for Querying the Shared Library + +```bash +bm dump-shared [-h help] [-a] [-n bundleName] [-m moudleName] +``` + + **Table 11** Commands for querying the shared library + +| Name | Description | +| ------------------------------------------------ | -------------------------------------- | +| bm dump-shared -h | Displays the parameters supported by the **dump-shared** command. | +| bm dump-shared -a | Displays all shared libraries installed in the system. | +| bm dump-shared -n | Displays details about a shared library. | +| bm dump-dependencies -h | Displays the parameters supported by the **bm dump-dependencies** command.| +| bm dump-dependencies -n bundleName -m moudleName | Displays information about the shared library on which a specified module of an application depends. | + +Example + +```bash +# Display the bundle names of all shared libraries installed in the system. +bm dump-shared -a +# Display the details about the specified shared library. +bm dump-shared -n com.ohos.lib +# Display information about the shared library on which a specified module of an application depends. +bm dump-dependencies -n com.ohos.app -m entry +``` diff --git a/en/device-dev/subsystems/subsys-app-privilege-config-guide.md b/en/device-dev/subsystems/subsys-app-privilege-config-guide.md index 6f4e44001ea752418c234c7f68f6ac2b3dc50c57..32b52a3fe5616b1d0f8adb3bdb57ee6a51caeef2 100644 --- a/en/device-dev/subsystems/subsys-app-privilege-config-guide.md +++ b/en/device-dev/subsystems/subsys-app-privilege-config-guide.md @@ -63,6 +63,7 @@ In addition to general application privileges, device vendors can define device- | allowAbilityExcludeFromMissions | bool | false| Allows an ability to be hidden in the mission stack.| | allowAppUsePrivilegeExtension | bool | false|Allows an application to use ServiceExtension and DataExtension abilities.| | allowFormVisibleNotify | bool | false| Allows a widget to be visible on the home screen.| +| allowAppShareLibrary | bool | false | Allows an application to provide the [inter-application HSP capability](../../application-dev/quick-start/cross-app-hsp.md) for other applications. ### How to Configure @@ -90,6 +91,7 @@ Configure the required privileges in the [configuration file](https://gitee.com/ "allowAbilityExcludeFromMissions": true, // Allow the ability to be hidden in the mission stack. "allowAppUsePrivilegeExtension": true, // Allow the application to use ServiceExtension and DataExtension abilities. "allowFormVisibleNotify": true // Allow a widget to be visible on the home screen. + "allowAppShareLibrary": true // Allow the application to provide the inter-application HSP capability. }, } ``` diff --git a/en/device-dev/subsystems/subsys-toolchain-hiperf.md b/en/device-dev/subsystems/subsys-toolchain-hiperf.md index bccdb1f7b7edb9c67ba247040a9516f8bfadad5f..879a2df09ff2a2ae83ee9f405110f027574adab6 100644 --- a/en/device-dev/subsystems/subsys-toolchain-hiperf.md +++ b/en/device-dev/subsystems/subsys-toolchain-hiperf.md @@ -1,34 +1,41 @@ -# hiperf +# hiperf + hiperf is a performance sampling and analysis tool provided for developers. It extends the user-mode capabilities based on the kernel perf mechanism and can conduct performance sampling of the specified application or the entire system. -You can run the **hiperf -h** command to display the commands supported by hiperf. -The following describes the common commands \(**list**, **stat**, **record**, and **report**\) supported by hiperf. +You can run the **hiperf -h** command to display the commands supported by hiperf. + + +The following describes the common commands (**list**, **stat**, **record**, and **report**) supported by hiperf. + + +## list -## list -### Parameters +### Parameters + +The **list** command lists all the perf events supported by the device. The event names are used for the **-e** and **-g** parameters of the **stat** and **record** commands. -The **list** command lists all the perf events supported by the device. The event names are used for the **-e** and **-g** parameters of the **stat** and **record** commands. ``` hiperf list [event type] ``` -| Parameter | Description | -| ----------- | ---------------- | -| hw | Lists the hardware events supported by the performance monitoring unit (PMU). | +| Parameter| Description| +| -------- | -------- | +| hw | Lists the hardware events supported by the performance monitoring unit (PMU).| | sw | Lists the software events supported. | | tp | Lists the tracepotint events supported. | | cache | Lists the cache events supported by the PMU. | -| raw | Lists the raw PMU events supported. | +| raw | Lists the raw PMU events supported.| -### Example +### Example List the hardware events supported by the PMU. The command also lists the events that are not supported by the PMU. + ``` hiperf list hw event not support hw-stalled-cycles-backend @@ -45,35 +52,39 @@ Supported events for hardware: hw-bus-cycles ``` -## stat -### Parameters +## stat + + +### Parameters -The **stat** command monitors the specified application and periodically prints the values of performance counters. + The **stat** command monitors the specified application and periodically prints the values of performance counters. ``` hiperf stat [options] - Collect performance counter information. +Collect performance counter information. ``` -| Parameter | Description | -| ----------- | ---------------- | -| -a | Collects the values of all threads and default performance counters of the system. | + +| Parameter| Description| +| -------- | -------- | +| -a | Collects the values of all threads and default performance counters of the system.| | -c | Specifies the IDs of the CPUs to monitor. Use commas (,) to separate multiple CPU IDs, for example **0,1,2**. | | -d <_sec_> | Specifies the monitoring period, in seconds. | | -i <_ms_> | Specifies the interval for printing the monitored events, in milliseconds. | | -e | Specifies the events to monitor. You can run the **list** command to list all the events supported. **event:u** indicates an event in the user space, and **event:k** indicates an event in the kernel space. | -| -g | Specifies a group of events to monitor. The events in the same group are monitored by the same PMU. | -| --no-inherit | Leaves the sub-threads of the target thread or process not monitored. | -| -p | Specifies the process IDs (PIDs) to monitor. | -| -t | Specifies the thread IDs (TIDs) to monitor. | -| --verbose | Displays detailed report, including raw time data. | +| -g | Specifies a group of events to monitor. The events in the same group are monitored by the same PMU.| +| --no-inherit | Leaves the sub-threads of the target thread or process not monitored.| +| -p | Specifies the process IDs (PIDs) to monitor.| +| -t | Specifies the thread IDs (TIDs) to monitor.| +| --verbose | Displays detailed report, including raw time data.| -### Example +### Example Monitor the entire system for 3 seconds. + ``` hiperf stat -d 3 -a this is root mode, perfEventParanoid assume as -1 @@ -89,173 +100,186 @@ Timeout exit (total 3009 ms) 9402580 sw-task-clock | 0.002758 cpus used | (100%) ``` -### Field Description -| Field | Description | -| ----------- | ---------------- | -| count | Indicates the times that an event occurred. | -| name | Indicates the event name. You can run the **list** command to list all the supported events. **hw** stands for hardware, and **sw** stands for software. | +### Field Description + +| Field| Description| +| -------- | -------- | +| count | Indicates the times that an event occurred.| +| name | Indicates the event name. You can run the **list** command to list all the supported events. **hw** stands for hardware, and **sw** for software. | | comment | Provides values calculated from those in the **Count** column for easy understanding. For example, the CPU frequency (**hw-cpu-cycles**) is converted to **0.832068** GHz from **6994768**. | -| coverage | Indicates the percentage of PMU resources occupied by the event. The number of events to be monitored by a PMU varies depending on the number of PMUs. | +| coverage | Indicates the percentage of PMU resources occupied by the event. The number of events to be monitored by a PMU varies depending on the number of PMUs.| + +## record -## record -### Parameters +### Parameters + +The **record** command samples the specified application and saves the sampling data to a file (**perf.data** by default). -The **record** command samples the specified application and saves the sampling data to a file \(**perf.data** by default\). ``` hiperf record [options] - Collect performance sampling information. +Collect performance sampling information. ``` -| Parameter | Description | -| ----------- | ---------------- | -| -a | Samples all processes and threads in the system. | -| --exclude-hiperf | Leaves the hiperf process not sampled. | -| -c | Specifies the IDs of the CPUs to sample. | +| Parameter| Description| +| -------- | -------- | +| -a | Samples all processes and threads in the system.| +| --exclude-hiperf | Leaves the hiperf process not sampled.| +| -c | Specifies the IDs of the CPUs to sample.| | --cpu-limit <_percent_> | Specifies the maximum percentage of CPU resources occupied by the sampling. | -| -d <sec> | Specifies the sampling duration, in seconds. | -| -f <freq> | Specifies how often a sampling event is triggered. The default value is 4000 times/second.
Note:
A higher value indicates heavier CPU load but more sampling data. | +| -d <sec> | Specifies the sampling duration, in seconds.| +| -f <freq> | Specifies how often a sampling event is triggered. The default value is 4000 times/second.
Note: A higher value indicates heavier CPU load but more sampling data.| | --period <_num_> | Specifies the number of occurrence times of an event that triggers a sampling. That is, a sampling is performed once when the event occurs the specified number of times. | -| -e | Specifies the events to monitor. You can run the list command to list all the events supported. **event:u** indicates an event in the user space, and **event:k** indicates an event in the kernel space. | -| -g | Specifies a group of events to monitor. The events in the same group are monitored by the same PMU. | -| --no-inherit | Leaves the sub-threads of the target thread or process not monitored. | -| -p | Specifies the processes to monitor. | -| -t | Specifies the threads to monitor. | -| --offcpu | Monitors the CPU scheduling event, which is equivalent to the **--period 1 -e sched:sched_switch** event. | +| -e | Specifies the events to monitor. You can run the **list** command to list all the events supported. **event:u** indicates an event in the user space, and **event:k** indicates an event in the kernel space.| +| -g | Specifies a group of events to monitor. The events in the same group are monitored by the same PMU.| +| --no-inherit | Leaves the sub-threads of the target thread or process not monitored.| +| -p | Specifies the processes to monitor.| +| -t | Specifies the threads to monitor.| +| --offcpu | Monitors the CPU scheduling event, which is equivalent to the **--period 1 -e sched:sched_switch** event.| | -j <_branch_filter1_>[,_branch_filter2_]... | Monitors the branch prediction events. Branch prediction tries to predict the next instruction to be executed if there are multiple if else conditions. | | -s / --call-stack <_fp \\| dwarf[,size]_> | Sets the user stack unwinding mode, which can be **fp** or **dwarf**. If **dwarf** is used, you can specify the size of the user stack to be sampled. The default value is **65528**. | -| --delay-unwind | Delays the stack unwinding till the sampling is complete. | -| --disable-unwind | Disables stack unwinding. The user register and stack data is stored in **perf.data** for offline stack unwinding. | -| --disable-callstack-expend | Disables the unwound call stack information from being combined or extended. | +| --delay-unwind | Delays the stack unwinding till the sampling is complete.| +| --disable-unwind | Disables stack unwinding. The user register and stack data is stored in **perf.data** for offline stack unwinding.| +| --disable-callstack-expend | Disables the unwound call stack information from being combined or extended.| | --clockid <_clock type_> | Sets the clock source for the sampling data. The options are **monotonic**, **boottime**, and **realtime**. | | --symbol-dir <_dir_> | Specifies the directory of the symbol table. The specified symbol table will be preferentially used in stack unwinding. | | -m <_mmap pages_> | Specifies the cache size, in pages. The default value is **1024**. The parameter value must be a power of 2. The value range is [2 - 1024].
Note:
A higher value indicates a lower event loss rate but higher memory usage. | | --app <_package name_> | Specifies the bundle name of the target application to be sampled. The default timeout interval is 10 seconds. If the specified application does not exist, the hiperf process exits after 10 seconds. | -| --data-limit <_SIZE[K\|M\|G]_> | Specifies the maximum size of the sampling result, in KB, MB, or GB. By default, there is no limit on the size. | +| --data-limit <_SIZE[K\|M\|G]_> | Specifies the maximum size of the sampling result, in KB, MB, or GB. By default, there is no limit on the size.| | -o <_output file name_> | Specifies the name of the sampling result file. It is **/data/local/tmp/perf.data** by default. | -| -z | Saves the output file in .gzip format. | -| --verbose | Displays detailed log information during sampling. | - - -### Example - -- Sample all processes in the system for 3 seconds and display detailed log information during the sampling process. +| -z | Saves the output file in .gzip format.| +| --verbose | Displays detailed log information during sampling.| - ``` - hiperf record -d 3 -a --verbose - ``` +### Example -- Enable stack unwinding in fp mode. +- Sample all processes in the system for 3 seconds and display detailed log information during the sampling process. + + ``` + hiperf record -d 3 -a --verbose + ``` - ``` - hiperf record -s fp -d 3 -a - ``` +- Enable stack unwinding in fp mode. + + ``` + hiperf record -s fp -d 3 -a + ``` -- Enable stack unwinding in dwarf mode. +- Enable stack unwinding in dwarf mode. + + ``` + hiperf record -s dwarf -d 3 -a + ``` - ``` - hiperf record -s dwarf -d 3 -a - ``` +- Sample offcpu events. + + ``` + hiperf record --offcpu -s dwarf -d 3 -a + ``` -- Sample offcpu events. +- Delay stack unwinding. + + ``` + hiperf record -d 3 -s dwarf --delay-unwind -a + ``` - ``` - hiperf record --offcpu -s dwarf -d 3 -a - ``` +- Disable stack unwinding. In this case, the stack data is saved to the **perf.data** file. + + ``` + hiperf record -d 3 -s dwarf --disable-unwind -a + ``` -- Delay stack unwinding. +- Monitor the **com.ohos.launch** application. The hiperf process exits after 10 seconds if the process corresponding to the specified bundle name does not exist. + + ``` + hiperf record -d 3 -s dwarf --app com.ohos.launch + ``` - ``` - hiperf record -d 3 -s dwarf --delay-unwind -a - ``` +- Compress the sampling results. + + ``` + hiperf record -z -s dwarf -d 3 -a + ``` -- Disable stack unwinding. In this case, the stack data is saved to the **perf.data** file. - ``` - hiperf record -d 3 -s dwarf --disable-unwind -a - ``` +## report -- Monitor the **com.ohos.launch** application. The hiperf process exits after 10 seconds if the process corresponding to the specified bundle name does not exist. - ``` - hiperf record -d 3 -s dwarf --app com.ohos.launch - ``` - -- Compress the sampling results. - - ``` - hiperf record -z -s dwarf -d 3 -a - ``` - - -## report +### Parameters The **report** command displays the sampling data that is captured by using **record**. + ``` -hiperf report [option] - Report sampling information from perf.data. +hiperf report [option] +Report sampling information from perf.data. ``` -| Parameter | Description | -| ----------- | ---------------- | +| Parameter| Description| +| -------- | -------- | | --symbol-dir <_dir_> | Specifies the directory of the symbol table. | | --limit-percent <_number_> | Specifies the minimum percentage of the result to display. The result that is lower than the minimum percentage is not displayed. | -| -s / --call-stack | Displays detailed call stack information. | +| -s / --call-stack | Displays detailed call stack information.| | --call-stack-limit-percent <_number_> | Specifies the minimum percentage of the call stack to display. The call stack that is lower than the minimum percentage is not displayed. | | --proto | Converts the **perf.data** file into the proto format. The default file name is **perf.proto**. | | --json | Converts the **perf.data** file into the JSON format. The default file name is **perf.json**. | -| --branch | Displays the report based on the branch prediction result address instead of the IP address of the call stack. | -| --<_keys_> <_keyname1_>[,_keyname2_][,...] | Filters and displays reports based on the given keywords. keys can be comms, pids, and tids. For example, **--comms hiperf,hilog** displays only the records whose process or thread name is **hiperf** or **hilog**. | +| --branch | Displays the report based on the branch prediction result address instead of the IP address of the call stack.| +| --<_keys_> <_keyname1_>[,_keyname2_][,...] | Filters and displays reports based on the given keywords. **keys** supports **comms**, **pids**, and **tids**. For example, **--comms hiperf,hilog** displays only the records whose process or thread name is **hiperf** or **hilog**.| | --sort <_key1_>[,_key2_][,...] | Sorts and displays information based on specified keywords, such as **pid**, **tid**, and **comm**. Multiple keywords can be specified. | | -i <_filename_> | Specifies the sampling data (**perf.data** by default). | | -o <_filename_> | Specifies the name of the report to output. | -## Example - -- Output the report of the sampling data \(**perf.data** by default\). - - ``` - hiperf report - ``` - - Output \(example\): - - ``` - Heating count comm pid tid dso func - 5.68% 15073949 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 malloc - 2.57% 6834119 hiperf_example_ 1085 1091 [kernel.kallsyms] vector_swi - 2.27% 6013910 hiperf_example_ 1085 1087 /system/lib/ld-musl-arm.so.1 malloc - 2.19% 5805738 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 vfprintf - 2.09% 5543362 hiperf_example_ 1085 1091 [kernel.kallsyms] ktime_get_ts64 - report done - ``` - -- Output the call stack report of the sampling data. - - ``` - hiperf report -s - ``` - -- Set the symbol table directory. - - ``` - hiperf report -s --symbol-dir /data/local/tmp - ``` - -- Display only the information containing **libutils.z.so**. - - ``` - hiperf report --dsos libuitls.z.so - ``` - -- Sort the result by **dso**. - - ``` - hiperf report --sort dso - ``` +### Example + +- Output the report of the sampling data (perf.data by default). + + ``` + hiperf report + ``` + + Output (example): + + + ``` + Heating count comm pid tid dso func + 5.68% 15073949 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 malloc + 2.57% 6834119 hiperf_example_ 1085 1091 [kernel.kallsyms] vector_swi + 2.27% 6013910 hiperf_example_ 1085 1087 /system/lib/ld-musl-arm.so.1 malloc + 2.19% 5805738 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 vfprintf + 2.09% 5543362 hiperf_example_ 1085 1091 [kernel.kallsyms] ktime_get_ts64 + report done + ``` + +- Output the call stack report of the sampling data. + + ``` + hiperf report -s + ``` + + + +- Set the symbol table directory. + + ``` + hiperf report -s --symbol-dir /data/local/tmp + ``` + + + +- Display only the information containing **libutils.z.so**. + + ``` + hiperf report --dsos libuitls.z.so + ``` + + + +- Sort the result by **dso**. + + ``` + hiperf report --sort dso + ``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md index 6ebe3fe1b7988aab988b1b93cdf1664378665304..8e6be70a746f74f91a5b4f1fb5778c37f80428ed 100644 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md @@ -216,8 +216,8 @@ Code before the change: try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } @@ -260,8 +260,8 @@ Code after the change: try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md index 869ff66b05c240d76e5382b493942c712e04579a..a060017598caf758524179f7fa4ee836ee5f6fec 100644 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md +++ b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -71,7 +71,7 @@ function getWantAgentCallback(err, data) { // getUid callback function triggerCallback(err, data) { if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } else { console.info('getUid ok!' + JSON.stringify(data)); } @@ -79,12 +79,12 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } } try{ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err){ - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getWantAgent failed!' + err.code + err.message); } ``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..b1011149ce89079e6e45212f0d1631794c406742 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md @@ -0,0 +1,35 @@ +# User IAM Subsystem Changelog + +## cl.useriam.1 Deletion of API9 GetVesion + +Deleted the **GetVersion()** API. + +**Change Impact** + +The **GetVersion()** API cannot be used from this version. + +**Key API/Component Changes** + +| Module | Class | Method/Attribute/Enum/Constant | Change Type | +| ---------------------- | ------------------- | ------------------------- | ------------------------ | +| ohos.userIAM.userAuth | function | getVersion() : number | Deleted| + +**Adaptation Guide** + +Delete the use of **GetVersion()**. + +## cl.useriam.2 Change of the API8 GetVesion() Return Value + +Changed the return value of **GetVersion()** (in API version 8) from **0** to **1**. + +**Change Impact** + +If the application verifies the return value of **GetVersion()** (API version 8), the verification fails. + +**Key API/Component Changes** + +The return value of **GetVersion()** (in API version 8) is changed from **0** to **1**. + +**Adaptation Guide** + +Delete the use of **GetVersion()** (API version 8) because this API has been deprecated. diff --git a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md index c7d4a8c3860cbb4396a519bce9627e6c67109c78..9c353df983cc3c226e8f3d0c5d53817856cc7f40 100644 --- a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md +++ b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md @@ -397,7 +397,7 @@ import Ability from '@ohos.app.ability.UIAbility'; ``` 2. 获取Caller通信接口。 - Ability的context属性实现了startAbilityByCall方法,用于获取指定通用组件的Caller通信接口。如下示例通过this.context获取Ability实例的context属性,使用startAbilityByCall拉起Callee被调用端并获取Caller通信接口,注册Caller的onRelease监听。应用开发者根据实际业务需要做相应处理。 + Ability的context属性实现了startAbilityByCall方法,用于获取指定通用组件的Caller通信接口。如下示例通过this.context获取Ability实例的context属性,使用startAbilityByCall拉起Callee被调用端并获取Caller通信接口,注册Caller的onRelease和onRemoteStateChange监听。应用开发者根据实际业务需要做相应处理。 ```ts @@ -418,6 +418,14 @@ console.info(`remote caller onRelease is called ${msg}`); }) console.info('remote caller register OnRelease succeed'); + // 注册caller的协同场景下跨设备组件状态变化监听通知 + try { + caller.onRemoteStateChange((str) => { + console.log('Remote state changed ' + str); + }); + } catch (error) { + console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + } } }).catch((error) => { console.error(`get remote caller failed with ${error}`); diff --git a/zh-cn/application-dev/media/avplayer-playback.md b/zh-cn/application-dev/media/avplayer-playback.md index 900a193f3dd9743e5aaa0a6f9fa2b0d463a9279e..22891308f9bb0af7eb47c94da7f06833557e510c 100644 --- a/zh-cn/application-dev/media/avplayer-playback.md +++ b/zh-cn/application-dev/media/avplayer-playback.md @@ -41,8 +41,17 @@ AVPlayer主要工作是将Audio/Video媒体资源转码为可供渲染的图像 ## 兼容性说明 +视频播放支持的视频格式分必选规格和可选规格。必选规格为所有厂商均支持的视频格式。对于可选规格,厂商将基于实际情况决定是否实现。建议开发者做兼容处理,保证全平台兼容。 推荐使用主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。 +| 视频格式 | 是否必选规格 | +|:--------:|:-----:| +| H264 | 是 | +| MPEG2 | 否 | +| MPEG4 | 否 | +| H263 | 否 | +| VP8 | 否 | + 主流的播放格式和主流分辨率如下: | 视频容器规格 | 规格描述 | 分辨率 | diff --git a/zh-cn/application-dev/media/avrecorder.md b/zh-cn/application-dev/media/avrecorder.md index 3cee29c0291e18d417b32fa1ec1a41871f56fd09..83597f5e940d50ffc6ed7e5974fbe1bf6c5bae93 100644 --- a/zh-cn/application-dev/media/avrecorder.md +++ b/zh-cn/application-dev/media/avrecorder.md @@ -77,7 +77,7 @@ export class AVRecorderDemo { audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -369,7 +369,7 @@ export class VideoRecorderDemo { let videoProfile = { fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -487,4 +487,4 @@ export class VideoRecorderDemo { 音视频录制APP案例包含:创建实例、设置录制参数、获取输入surface、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 -详细代码可参考:[AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording | 媒体播放和录制功能实现 - Gitee.com](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/appdemo/AVRecorderDemo)) \ No newline at end of file +详细代码可参考:[AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording | 媒体播放和录制功能实现 - Gitee.com](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/sample/AVRecorder)) \ No newline at end of file diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md index f62da644b121076322bb2c5a155113dcd2601112..ae650343e6f553dc08bbac682b3803de491577cc 100644 --- a/zh-cn/application-dev/media/video-playback.md +++ b/zh-cn/application-dev/media/video-playback.md @@ -25,8 +25,16 @@ 3. 媒体服务把帧数据flush给surface buffer。 ## 兼容性说明 - -推荐使用视频软件主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。 +视频播放支持的视频格式分必选规格和可选规格。必选规格为所有厂商均支持的视频格式。对于可选规格,厂商将基于实际情况决定是否实现。建议开发者做兼容处理,保证全平台兼容。 +推荐使用主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。 + +| 视频格式 | 是否必选规格 | +|:--------:|:-----:| +| H264 | 是 | +| MPEG2 | 否 | +| MPEG4 | 否 | +| H263 | 否 | +| VP8 | 否 | 主流的播放格式和主流分辨率如下: diff --git a/zh-cn/application-dev/media/video-recorder.md b/zh-cn/application-dev/media/video-recorder.md index 2f6d5b6bbded1c2622fd767db91b807b263f94c4..a1ea9d11fa885806eb5510bb09bef69f942e6beb 100644 --- a/zh-cn/application-dev/media/video-recorder.md +++ b/zh-cn/application-dev/media/video-recorder.md @@ -84,7 +84,7 @@ export class VideoRecorderDemo { audioSampleRate : 48000, fileFormat : 'mp4', videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', + videoCodec : 'video/avc', videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 diff --git a/zh-cn/application-dev/napi/napi-guidelines.md b/zh-cn/application-dev/napi/napi-guidelines.md index 39a1a1d09fc3f4d02c3eb3a02e8274798b7acee4..e2788d6106d55f287f045f51a68841bc44e18b7d 100644 --- a/zh-cn/application-dev/napi/napi-guidelines.md +++ b/zh-cn/application-dev/napi/napi-guidelines.md @@ -1,652 +1,192 @@ -# Native API在应用工程中的使用指导 +# N-API在应用工程中的使用指导 -OpenHarmony的应用必须用js来桥接native。需要使用[ace_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓中提供的napi接口来处理js交互。napi提供的接口名与三方Node.js一致,目前支持部分接口,符号表见ace_napi仓中的`libnapi.ndk.json`文件。 +在OpenHarmony中,C API中的N-API接口可以实现ArkTS/TS/JS与C/C++之间的交互。N-API提供的接口名与三方Node.js一致,目前支持部分接口,支持列表见[链接](https://gitee.com/openharmony/arkui_napi/blob/master/libnapi.ndk.json)。 ## 开发流程 -在DevEco Studio的模板工程中包含使用Native API的默认工程,使用`File`->`New`->`Create Project`创建`Native C++`模板工程。创建后在`main`目录下会包含`cpp`目录,可以使用ace_napi仓下提供的napi接口进行开发。 +在DevEco Studio的模板工程中包含使用N-API的默认工程,使用`File`->`New`->`Create Project`创建`Native C++`模板工程。创建后在`entry/src/main`目录下会包含`cpp`目录,可以使用N-API接口,开发C/C++代码(native侧代码)。 -js侧通过`import`引入native侧包含处理js逻辑的so,如:`import hello from 'libhello.so'`,意为使用libhello.so的能力,native侧通过napi接口创建的js对象会给到应用js侧的`hello`对象。 - -## 开发建议 - -### 注册建议 - -* nm_register_func对应的函数需要加上static,防止与其他so里的符号冲突。 -* 模块注册的入口,即使用\_\_attribute\_\_((constructor))修饰的函数的函数名需要确保不与其他模块重复。 - -### so命名规则 - -**so命名必须符合以下规则:** - -* 每个模块对应一个so。 -* 如模块名为`hello`,则so的名字为`libhello.so`,`napi_module`中`nm_modname`字段应为`hello`,大小写与模块名保持一致,应用使用时写作:`import hello from 'libhello.so'`。 - -### js对象线程限制 - -ark引擎会对js对象线程使用进行保护,使用不当会引起应用crash,因此需要遵循如下原则: - -* napi接口只能在js线程使用。 -* env与线程绑定,不能跨线程使用。native侧js对象只能在创建时的线程使用,即与线程所持有的env绑定。 - -### 头文件引入限制 - -在使用napi的对象和方法时需要引用"napi/native_api.h"。否则在只引入三方库头文件时,会出现接口无法找到的编译报错。 - -### napi_create_async_work接口说明 - -napi_create_async_work里有两个回调: - -* execute:用于异步处理业务逻辑。因为不在js线程中,所以不允许调用napi的接口。业务逻辑的返回值可以返回到complete回调中处理。 - -* complete:可以调用napi的接口,将execute中的返回值封装成js对象返回。此回调在js线程中执行。 - -```c++ -napi_status napi_create_async_work(napi_env env, - napi_value async_resource, - napi_value async_resource_name, - napi_async_execute_callback execute, - napi_async_complete_callback complete, - void* data, - napi_async_work* result) -``` +ArkTS/TS/JS侧通过`import`引入native侧的so文件,如:`import hello from 'libhello.so'`,意为使用libhello.so的能力,并将名为`hello`的ArkTS/TS/JS对象给到应用的ArkTS/TS/JS侧,开发者可通过该对象,调用到在`cpp`中开发的native方法。 +## 基本功能 +N-API接口可以实现ArkTS/TS/JS和C/C++之间的交互,这里以HelloWorld工程的两个例子: +1. 提供一个名为`Add`的native方法,ArkTS侧调用该方法并传入两个number,native方法将这两个number相加并返回到ArkTS侧。 +2. 提供一个名为`NativeCallArkTS`的native方法,ArkTS侧调用该方法并传入一个ArkTS function,native方法中调用这个ArkTS function,并将其结果返回ArkTS侧。 +以此来介绍: +1. ArkTS侧如何调用到C++侧方法。 +2. C++侧如何调用到ArkTS侧方法。 -## storage 模块——同步异步接口封装 +下面给出了工程中的: +1. `entry\src\main\cpp\hello.cpp`, 包含native侧逻辑。 +2. `entry\src\main\ets\pages\index.ets`,包含ArkTS侧逻辑。 +3. `entry\src\main\cpp\types\libentry\index.d.ts`,包含native侧暴露给ArkTS侧接口的声明。 -### 模块简介 +同时给出了注解,工程中其余部分均与native默认工程相同。 -本示例通过实现 `storage` 模块展示了同步和异步方法的封装。`storage ` 模块实现了数据的保存、获取、删除、清除功能。 - -### 接口声明 - -```typescript -import { AsyncCallback } from './basic'; -declare namespace storage { - function get(key: string, callback: AsyncCallback): void; - function get(key: string, defaultValue: string, callback: AsyncCallback): void; - function get(key: string, defaultValue?: string): Promise; - function set(key: string, value: string, callback: AsyncCallback): void; - function remove(key: string, callback: AsyncCallback): void; - function clear(callback: AsyncCallback): void; - function getSync(key: string, defaultValue?: string): string; - function setSync(key: string, value: string): void; - function removeSync(key: string): void; - function clearClear(): void; -} -export default storage; -``` - - - -### 具体实现 - -完整代码参见仓下路径:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_storage/` - -**1、模块注册** - -如下,注册了4个同步接口(`getSync`、`setSync`、`removeSync`、`clearSync`)、4个异步接口(`get`、`set`、`remove`、`clear`)。 - -```c++ -/*********************************************** - * Module export and register - ***********************************************/ -static napi_value StorageExport(napi_env env, napi_value exports) -{ - napi_property_descriptor desc[] = { - DECLARE_NAPI_FUNCTION("get", JSStorageGet), - DECLARE_NAPI_FUNCTION("set", JSStorageSet), - DECLARE_NAPI_FUNCTION("remove", JSStorageDelete), - DECLARE_NAPI_FUNCTION("clear", JSStorageClear), - - DECLARE_NAPI_FUNCTION("getSync", JSStorageGetSync), - DECLARE_NAPI_FUNCTION("setSync", JSStorageSetSync), - DECLARE_NAPI_FUNCTION("deleteSync", JSStorageDeleteSync), - DECLARE_NAPI_FUNCTION("clearSync", JSStorageClearSync), - }; - NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); - return exports; -} +```C++ +// entry\src\main\cpp\hello.cpp +// 引入N-API相关头文件。 +#include "napi/native_api.h" -// storage module -static napi_module storage_module = {.nm_version = 1, - .nm_flags = 0, - .nm_filename = nullptr, - .nm_register_func = StorageExport, - .nm_modname = "storage", - .nm_priv = ((void*)0), - .reserved = {0}}; - -// storage module register -extern "C" __attribute__((constructor)) void StorageRegister() +// 开发者提供的native方法,入参有且仅有如下两个,开发者不需进行变更。 +// napi_env 为当前运行的上下文。 +// napi_callback_info 记录了一些信息,包括从ArkTS侧传递过来参数等。 +static napi_value Add(napi_env env, napi_callback_info info) { - napi_module_register(&storage_module); -} -``` - -**2、getSync 函数实现** + // 期望从ArkTS侧获取的参数的数量,napi_value可理解为ArkTS value在native方法中的表现形式。 + size_t argc = 2; + napi_value args[2] = {nullptr}; + + // 从info中,拿到从ArkTS侧传递过来的参数,此处获取了两个ArkTS参数,即arg[0]和arg[1]。 + napi_get_cb_info(env, info, &argc, args , nullptr, nullptr); -如上注册时所写,`getSync` 对应的函数是 `JSStorageGetSync` 。从 `gKeyValueStorage` 中获取数据后,创建一个字符串对象并返回。 + // 将获取的ArkTS参数转换为native信息,此处ArkTS侧传入了两个number,这里将其转换为native侧可以操作的double类型。 + double value0; + napi_get_value_double(env, args[0], &value0); -```c -static napi_value JSStorageGetSync(napi_env env, napi_callback_info info) -{ - GET_PARAMS(env, info, 2); - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - char key[32] = {0}; - size_t keyLen = 0; - char value[128] = {0}; - size_t valueLen = 0; - - // 参数解析 - for (size_t i = 0; i < argc; i++) { - napi_valuetype valueType; - napi_typeof(env, argv[i], &valueType); - - if (i == 0 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], key, 31, &keyLen); - } else if (i == 1 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], value, 127, &valueLen); - break; - } else { - NAPI_ASSERT(env, false, "type mismatch"); - } - } - - // 获取数据的业务逻辑,这里简单地从一个全局变量中获取 - auto itr = gKeyValueStorage.find(key); - napi_value result = nullptr; - if (itr != gKeyValueStorage.end()) { - // 获取到数据后创建一个string类型的JS对象 - napi_create_string_utf8(env, itr->second.c_str(), itr->second.length(), &result); - } else if (valueLen > 0) { - // 没有获取到数据使用默认值创建JS对象 - napi_create_string_utf8(env, value, valueLen, &result); - } else { - NAPI_ASSERT(env, false, "key does not exist"); - } - // 返回结果 - return result; + double value1; + napi_get_value_double(env, args[1], &value1); + + // native侧的业务逻辑,这里简单以两数相加为例。 + double nativeSum = value0 + value1; + + // 此处将native侧业务逻辑处理结果转换为ArkTS值,并返回给ArkTS。 + napi_value sum; + napi_create_double(env, nativeSum , &sum); + return sum; } -``` - -**3、get 函数实现** - -如上注册时所写,`get`对应的函数式`JSStorageGet`。 -```c -static napi_value JSStorageGet(napi_env env, napi_callback_info info) +static napi_value NativeCallArkTS(napi_env env, napi_callback_info info) { - GET_PARAMS(env, info, 3); - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - - // StorageAsyncContext是自己定义的一个类,用于保存执行过程中的数据 - StorageAsyncContext* asyncContext = new StorageAsyncContext(); - - asyncContext->env = env; - - // 获取参数 - for (size_t i = 0; i < argc; i++) { - napi_valuetype valueType; - napi_typeof(env, argv[i], &valueType); - - if (i == 0 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], asyncContext->key, 31, &asyncContext->keyLen); - } else if (i == 1 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], asyncContext->value, 127, &asyncContext->valueLen); - } else if (i == 1 && valueType == napi_function) { - napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); - break; - } else if (i == 2 && valueType == napi_function) { - napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); - } else { - NAPI_ASSERT(env, false, "type mismatch"); - } - } - + // 期望从ArkTS侧获取的参数的数量,napi_value可理解为ArkTS value在native方法中的表现形式。 + size_t argc = 1; + napi_value args[1] = {nullptr}; + + // 从info中,拿到从ArkTS侧传递过来的参数,此处获取了一个ArkTS参数,即arg[0]。 + napi_get_cb_info(env, info, &argc, args , nullptr, nullptr); + + // 创建一个ArkTS number作为ArkTS function的入参。 + napi_value argv = nullptr; + napi_create_int32(env, 10, &argv); + napi_value result = nullptr; - - // 根据参数判断开发者使用的是promise还是callback - if (asyncContext->callbackRef == nullptr) { - // 创建promise - napi_create_promise(env, &asyncContext->deferred, &result); - } else { - napi_get_undefined(env, &result); - } - - napi_value resource = nullptr; - napi_create_string_utf8(env, "JSStorageGet", NAPI_AUTO_LENGTH, &resource); - - napi_create_async_work( - env, nullptr, resource, - // 回调1:此回调由napi异步执行,里面就是需要异步执行的业务逻辑。由于是异步线程执行,所以不要在此通过napi接口操作JS对象。 - [](napi_env env, void* data) { - StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; - auto itr = gKeyValueStorage.find(asyncContext->key); - if (itr != gKeyValueStorage.end()) { - strncpy_s(asyncContext->value, 127, itr->second.c_str(), itr->second.length()); - asyncContext->status = 0; - } else { - asyncContext->status = 1; - } - }, - // 回调2:此回调在上述异步回调执行完后执行,此时回到了JS线程来回调开发者传入的回调 - [](napi_env env, napi_status status, void* data) { - StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; - napi_value result[2] = {0}; - if (!asyncContext->status) { - napi_get_undefined(env, &result[0]); - napi_create_string_utf8(env, asyncContext->value, strlen(asyncContext->value), &result[1]); - } else { - napi_value message = nullptr; - napi_create_string_utf8(env, "key does not exist", NAPI_AUTO_LENGTH, &message); - napi_create_error(env, nullptr, message, &result[0]); - napi_get_undefined(env, &result[1]); - } - if (asyncContext->deferred) { - // 如果走的是promise,那么判断回调1的结果 - if (!asyncContext->status) { - // 回调1执行成功(status为1)时触发,也就是触发promise里then里面的回调 - napi_resolve_deferred(env, asyncContext->deferred, result[1]); - } else { - // 回调1执行失败(status为0)时触发,也就是触发promise里catch里面的回调 - napi_reject_deferred(env, asyncContext->deferred, result[0]); - } - } else { - // 如果走的是callback,则通过napi_call_function调用callback回调返回结果 - napi_value callback = nullptr; - napi_value returnVal; - napi_get_reference_value(env, asyncContext->callbackRef, &callback); - napi_call_function(env, nullptr, callback, 2, result, &returnVal); - napi_delete_reference(env, asyncContext->callbackRef); - } - napi_delete_async_work(env, asyncContext->work); - delete asyncContext; - }, - (void*)asyncContext, &asyncContext->work); - napi_queue_async_work(env, asyncContext->work); - + // native方法中调用ArkTS function,其返回值保存到result中并返到ArkTS侧。 + napi_call_function(env, nullptr, args[0], 1, &argv, &result); + return result; } -``` -**4、js示例代码** - -```js -import storage from 'libstorage.so'; - -export default { - testGetSync() { - const name = storage.getSync('name'); - console.log('name is ' + name); - }, - testGet() { - storage.get('name') - .then(date => { - console.log('name is ' + data); - }) - .catch(error => { - console.log('error: ' + error); - }); - } -} -``` - - - -## NetServer 模块——native与js对象绑定 - -### 模块简介 - -本示例展示了`on/off/once`订阅方法的实现,同时也包含了 C++ 与 js对象通过 wrap 接口的绑定。NetServer 模块实现了一个网络服务。 - -### 接口声明 - -```typescript -export class NetServer { - function start(port: number): void; - function stop(): void; - function on('start' | 'stop', callback: Function): void; - function once('start' | 'stop', callback: Function): void; - function off('start' | 'stop', callback: Function): void; -} -``` - -### 具体实现 - -完整代码参见:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_netserver/` - -**1、模块注册** - -```c -static napi_value NetServer::Export(napi_env env, napi_value exports) +EXTERN_C_START +// Init将在exports上挂上Add/NativeCallArkTS这些native方法,此处的exports就是开发者import之后获取到的ArkTS对象。 +static napi_value Init(napi_env env, napi_value exports) { - const char className[] = "NetServer"; - napi_property_descriptor properties[] = { - DECLARE_NAPI_FUNCTION("start", JS_Start), - DECLARE_NAPI_FUNCTION("stop", JS_Stop), - DECLARE_NAPI_FUNCTION("on", JS_On), - DECLARE_NAPI_FUNCTION("once", JS_Once), - DECLARE_NAPI_FUNCTION("off", JS_Off), + // 函数描述结构体,以Add为例,第三个参数"Add"为上述的native方法, + // 第一个参数"add"为ArkTS侧对应方法的名称。 + napi_property_descriptor desc[] = { + { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }, + { "nativeCallArkTS", nullptr, NativeCallArkTS, nullptr, nullptr, nullptr, napi_default, nullptr }, }; - napi_value netServerClass = nullptr; - - napi_define_class(env, className, sizeof(className), JS_Constructor, nullptr, countof(properties), properties, - &netServerClass); - - napi_set_named_property(env, exports, "NetServer", netServerClass); - + // 在exports这个ArkTS对象上,挂载native方法。 + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; } -``` - -**2、在构造函数中绑定 C++ 与 JS 对象** +EXTERN_C_END -```c -napi_value NetServer::JS_Constructor(napi_env env, napi_callback_info cbinfo) -{ - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, nullptr, nullptr, &thisVar, &data); - - // C++ Native对象,准备与JS对象映射在一起 - NetServer* netServer = new NetServer(env, thisVar); - - // 使用napi_wrap将netServer与thisVar(即当前创建的这个JS对象)做绑定 - napi_wrap( - env, thisVar, netServer, - // JS对象由引擎自动回收释放,当JS对象释放时触发该回调,在改回调中释放netServer - [](napi_env env, void* data, void* hint) { - printf("NetServer::Destructor\n"); - NetServer* netServer = (NetServer*)data; - delete netServer; - }, - nullptr, nullptr); - - return thisVar; -} -``` - -**3、从 JS 对象中取出 C++ 对象** +// 准备模块加载相关信息,将上述Init函数与本模块名等信息记录下来。 +static napi_module demoModule = { + .nm_version =1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "entry", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; -```c -napi_value NetServer::JS_Start(napi_env env, napi_callback_info cbinfo) +// 打开so时,该函数将自动被调用,使用上述demoModule模块信息,进行模块注册相关动作。 +extern "C" __attribute__((constructor)) void RegisterHelloModule(void) { - size_t argc = 1; - napi_value argv[1] = {0}; - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); - - NetServer* netServer = nullptr; - // 通过napi_unwrap从thisVar中取出C++对象 - napi_unwrap(env, thisVar, (void**)&netServer); - - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - - napi_valuetype valueType; - napi_typeof(env, argv[0], &valueType); - NAPI_ASSERT(env, valueType == napi_number, "type mismatch for parameter 1"); - - int32_t port = 0; - napi_get_value_int32(env, argv[0], &port); - - // 开启服务 - netServer->Start(port); - - napi_value result = nullptr; - napi_get_undefined(env, &result); - return result; + napi_module_register(&demoModule); } ``` -`netServer->Start`后回调通过`on`注册的`start`事件。 - -```c -int NetServer::Start(int port) -{ - printf("NetServer::Start thread_id: %ld \n", uv_thread_self()); - - struct sockaddr_in addr; - int r; - - uv_ip4_addr("0.0.0.0", port, &addr); - - r = uv_tcp_init(loop_, &tcpServer_); - if (r) { - fprintf(stderr, "Socket creation error\n"); - return 1; - } - - r = uv_tcp_bind(&tcpServer_, (const struct sockaddr*)&addr, 0); - if (r) { - fprintf(stderr, "Bind error\n"); - return 1; - } - - r = uv_listen((uv_stream_t*)&tcpServer_, SOMAXCONN, OnConnection); - if (r) { - fprintf(stderr, "Listen error %s\n", uv_err_name(r)); - return 1; +```js +// entry\src\main\ets\pages\index.ets + +import hilog from '@ohos.hilog'; +// 通过import的方式,引入native能力。 +import entry from 'libentry.so' + +@Entry +@Component +struct Index { + + build() { + Row() { + Column() { + // 第一个按钮,调用add方法,对应到native侧的Add方法,进行两数相加。 + Button('ArkTS call C++') + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(() => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Test NAPI 2 + 3 = %{public}d', entry.add(2, 3)); + }) + // 第二个按钮,调用nativeCallArkTS方法,对应到native的NativeCallArkTS,在native中执行ArkTS function。 + Button('C++ call ArkTS') + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(() => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + let ret = entry.nativeCallArkTS((value)=>{return value * 2;}); + hilog.info(0x0000, 'testTag', 'Test NAPI nativeCallArkTS ret = %{public}d', ret); + }) + } + .width('100%') } - - // 服务启动后触发“start”事件 - Emit("start", nullptr); - - return 0; -} -``` - -**4、注册或释放(on/off/once)事件,以 on 为例** - -```c -napi_value NetServer::JS_On(napi_env env, napi_callback_info cbinfo) -{ - size_t argc = 2; - napi_value argv[2] = {0}; - napi_value thisVar = 0; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); - - NetServer* netServer = nullptr; - // 通过napi_unwrap取出NetServer指针 - napi_unwrap(env, thisVar, (void**)&netServer); - - NAPI_ASSERT(env, argc >= 2, "requires 2 parameter"); - - // 参数类型校验 - napi_valuetype eventValueType; - napi_typeof(env, argv[0], &eventValueType); - NAPI_ASSERT(env, eventValueType == napi_string, "type mismatch for parameter 1"); - - napi_valuetype eventHandleType; - napi_typeof(env, argv[1], &eventHandleType); - NAPI_ASSERT(env, eventHandleType == napi_function, "type mismatch for parameter 2"); - - char type[64] = {0}; - size_t typeLen = 0; - - napi_get_value_string_utf8(env, argv[0], type, 63, &typeLen); - - // 注册事件handler - netServer->On((const char*)type, argv[1]); - - napi_value result = nullptr; - napi_get_undefined(env, &result); - return result; -} -``` - -**5、js示例代码** - -```javascript -import { NetServer } from 'libnetserver.so'; - -export default { - testNetServer() { - var netServer = new NetServer(); - netServer.on('start', (event) => {}); - netServer.start(1000); // 端口号1000, start完成后回调上面注册的 “start” 回调 + .height('100%') } } -``` - - - -## 在非JS线程中回调JS接口 -### 模块简介 - -本示例介绍如何在非JS线程中回调JS应用的回调函数。例如JS应用中注册了某个sensor的监听,这个sensor的数据是由一个SA服务来上报的,当SA通过IPC调到客户端时,此时的执行线程是一个IPC通信线程,与应用的JS线程是两个不同的线程。这时就需要将执行JS回调的任务抛到JS线程中才能执行,否则会出现崩溃。 - -### 具体实现 - -完整代码参见:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_callback/` - -**1、模块注册** - -如下,注册了1个接口`test`,会传入一个参数,类型为包含一个参数的函数。 +``` -```c++ -/*********************************************** - * Module export and register - ***********************************************/ -static napi_value CallbackExport(napi_env env, napi_value exports) -{ - static napi_property_descriptor desc[] = { - DECLARE_NAPI_FUNCTION("test", JSTest) - }; - NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); - return exports; -} +```js +// entry\src\main\cpp\types\libentry\index.d.ts +// native侧暴露给ArkTS侧接口的声明。 +export const add: (a: number, b: number) => number; +export const nativeCallArkTS: (a: object) => number; +``` -// callback module define -static napi_module callbackModule = { - .nm_version = 1, - .nm_flags = 0, - .nm_filename = nullptr, - .nm_register_func = CallbackExport, - .nm_modname = "callback", - .nm_priv = ((void*)0), - .reserved = { 0 }, -}; +## 开发建议 -// callback module register -extern "C" __attribute__((constructor)) void CallbackTestRegister() -{ - napi_module_register(&callbackModule); -} -``` +### 注册建议 -**2、获取env中的loop,抛任务回JS线程** +* nm_register_func对应的函数(如上述Init函数)需要加上static,防止与其他so里的符号冲突。 +* 模块注册的入口,即使用\_\_attribute\_\_((constructor))修饰的函数的函数名(如上述RegisterHelloModule函数)需要确保不与其他模块重复。 -```c++ -#include +### so命名规则 -#include "napi/native_api.h" -#include "napi/native_node_api.h" +**so命名必须符合以下规则:** -#include "uv.h" +* 每个模块对应一个so。 +* 如模块名为`hello`,则so的名字为`libhello.so`,`napi_module`中`nm_modname`字段应为`hello`,大小写与模块名保持一致,应用使用时写作:`import hello from 'libhello.so'`。 -struct CallbackContext { - napi_env env = nullptr; - napi_ref callbackRef = nullptr; - int retData = 0; -}; +### JS对象线程限制 -void callbackTest(CallbackContext* context) -{ - uv_loop_s* loop = nullptr; - // 此处的env需要在注册JS回调时保存下来。从env中获取对应的JS线程的loop。 - napi_get_uv_event_loop(context->env, &loop); - - // 创建uv_work_t用于传递私有数据,注意回调完成后需要释放内存,此处省略生成回传数据的逻辑,传回int类型1。 - uv_work_t* work = new uv_work_t; - context->retData = 1; - work->data = (void*)context; - - // 调用libuv接口抛JS任务到loop中执行。 - uv_queue_work( - loop, - work, - // 此回调在另一个普通线程中执行,用于处理异步任务,回调执行完后执行下面的回调。本场景下该回调不需要执行任务。 - [](uv_work_t* work) {}, - // 此回调会在env对应的JS线程中执行。 - [](uv_work_t* work, int status) { - CallbackContext* context = (CallbackContext*)work->data; - napi_handle_scope scope = nullptr; - // 打开handle scope用于管理napi_value的生命周期,否则会内存泄露。 - napi_open_handle_scope(context->env, &scope); - if (scope == nullptr) { - return; - } - - // 调用napi。 - napi_value callback = nullptr; - napi_get_reference_value(context->env, context->callbackRef, &callback); - napi_value retArg; - napi_create_int32(context->env, context->retData, &retArg); - napi_value ret; - napi_call_function(context->env, nullptr, callback, 1, &retArg, &ret); - napi_delete_reference(context->env, context->callbackRef); - - // 关闭handle scope释放napi_value。 - napi_close_handle_scope(context->env, scope); - - // 释放work指针。 - if (work != nullptr) { - delete work; - } - - delete context; - } - ); -} +ArkCompiler会对JS对象线程进行保护,使用不当会引起应用crash,因此需要遵循如下原则: -static napi_value JSTest(napi_env env, napi_callback_info info) -{ - size_t argc = 1; - napi_value argv[1] = { 0 }; - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, info, &argc, argv, &thisVar, &data); - - // 获取第一个入参,即需要后续触发的回调函数 - napi_valuetype valueType = napi_undefined; - napi_typeof(env, argv[0], &valueType); - if (valueType != napi_function) { - return nullptr; - } - // 存下env与回调函数,用于传递 - auto asyncContext = new CallbackContext(); - asyncContext->env = env; - napi_create_reference(env, argv[0], 1, &asyncContext->callbackRef); - // 模拟抛到非js线程执行逻辑 - std::thread testThread(callbackTest, asyncContext); - testThread.detach(); - - return nullptr; -} -``` +* N-API接口只能在JS线程使用。 +* env与线程绑定,不能跨线程使用。native侧JS对象只能在创建时的线程使用,即与线程所持有的env绑定。 -**3、js示例代码** +### 头文件引入限制 -```js -import callback from 'libcallback.so'; +在引入头文件时,需引入"napi/native_api.h",否则会出现N-API接口无法找到的编译报错。 -export default { - testcallback() { - callback.test((data) => { - console.error('test result = ' + data) - }) - } -} -``` ## 相关实例 -针对Native API的开发,有以下相关完整实例可供参考: +针对N-API的开发,有以下相关完整实例可供参考: - [第一个Native C++应用(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo) diff --git a/zh-cn/application-dev/quick-start/module-configuration-file.md b/zh-cn/application-dev/quick-start/module-configuration-file.md index 399fb7f2641c92d5dd08f150a873b6b934961e2d..740339412f0f6eb1712b47860595db44c1066040 100644 --- a/zh-cn/application-dev/quick-start/module-configuration-file.md +++ b/zh-cn/application-dev/quick-start/module-configuration-file.md @@ -275,7 +275,7 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口 * 用户点击该桌面图标,页面跳转到该应用的详情页面(图1) * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。

- + 应用的详情页例图 ![应用的详情页例图](figures/application_details.jpg) diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index c128daff39dbe566fb49eb253d268a237b405b68..92d01f33bc2bc141374a1317bfd0734bc407cfd4 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -413,7 +413,6 @@ - [@ohos.systemParameter (系统属性)](js-apis-system-parameter.md) - [@ohos.systemTime (系统时间、时区)](js-apis-system-time.md) - [@ohos.usb (USB管理)](js-apis-usb-deprecated.md) - - [@ohos.usbV9 (USB管理)](js-apis-usb.md) - [@system.app (应用上下文)](js-apis-system-app.md) - [@system.battery (电量信息)](js-apis-system-battery.md) - [@system.bluetooth (蓝牙)](js-apis-system-bluetooth.md) diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index a55df44d265784d78e092607c61e1a01a048f565..5217f9096de80f2e3a3d13669864adc5d663176e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -79,7 +79,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -135,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -177,7 +177,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -217,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -262,7 +262,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -310,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 13170311701300302241b40d1e4f934e8feb6b20..566ae59852950a9c918485661e57fee21474faae 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -306,7 +306,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +392,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md index ca1f60b2d08a6d425c0ac15af6ebdcf31c464efe..c02ff5f4cdae2883cc6dcc85d5c252b26a0c1f08 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 8b83fbb08dc2883a58a4d760449f913d1198efad..2301738bc5f83b30c6139ed963e20eac4c260930 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -402,10 +402,10 @@ call(method: string, data: rpc.Parcelable): Promise<void>; console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -483,10 +483,10 @@ callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequ data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -525,10 +525,10 @@ release(): void; try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -565,15 +565,58 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: $error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } ``` + ## Caller.onRemoteStateChange + + onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; + +注册协同场景下跨设备组件状态变化监听通知。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| callback | [OnRemoteStateChangeCallback](#onremotestatechangecallback) | 是 | 返回onRemoteStateChange回调结果。 | + +**示例:** + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + + let caller; + let dstDeviceId: string; + export default class MainAbility extends UIAbility { + onWindowStageCreate(windowStage: Window.WindowStage) { + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainUIAbility', + deviceId: dstDeviceId + }).then((obj) => { + caller = obj; + try { + caller.onRemoteStateChange((str) => { + console.log('Remote state changed ' + str); + }); + } catch (error) { + console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + } + }).catch((err) => { + console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + }); + } + } + ``` + ## Caller.on on(type: 'release', callback: OnReleaseCallback): void; @@ -614,10 +657,10 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -664,10 +707,10 @@ off(type: 'release', callback: OnReleaseCallback): void; caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -713,10 +756,10 @@ off(type: 'release'): void; caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -786,7 +829,7 @@ on(method: string, callback: CalleeCallback): void; try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -825,7 +868,7 @@ off(method: string): void; try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -841,6 +884,16 @@ off(method: string): void; | -------- | -------- | -------- | -------- | -------- | | (msg: string) | 是 | 否 | function | 调用者注册的侦听器函数接口的原型。 | +## OnRemoteStateChangeCallback + +(msg: string): void; + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +| 名称 | 可读 | 可写 | 类型 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| (msg: string) | 是 | 否 | function | 调用者注册的协同场景下组件状态变化监听函数接口的原型。 | + ## CalleeCallback (indata: rpc.MessageSequence): rpc.Parcelable; diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index 1091421a39f7461e182a2ad5f5b149670d14abb7..540592747ed6c478f156cfb3fe9aea85e2bebb6b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -186,10 +186,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -280,7 +280,7 @@ function getWantAgentCallback(err, data) { //getBundleName回调 function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -391,16 +391,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -603,16 +603,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -704,7 +704,7 @@ function getWantAgentCallback(err, data) { //getWant回调 function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -817,16 +817,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}}'); } ``` @@ -917,7 +917,7 @@ function getWantAgentCallback(err, data) { //cancel回调 function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1028,16 +1028,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1131,7 +1131,7 @@ function getWantAgentCallback(err, data) { //trigger回调 function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1239,7 +1239,7 @@ function getWantAgentCallback(err, data) { //equal回调 function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1353,16 +1353,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1451,7 +1451,7 @@ function getWantAgentCallback(err, data) { //getOperationTypeCallback回调 function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1560,16 +1560,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md index 576ac1cb96871d0ff6bbd4b39072da650ca08f89..6adc781f2409e7ecad6367f64542eba349747470 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md @@ -2085,31 +2085,34 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>): **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; - featureAbility.getWant((err, want) => { - var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; - try { - appAccountManager.getAuthCallback(sessionId, (err, callback) => { - if (err.code != account_appAccount.ResultCode.SUCCESS) { - console.log("getAuthCallback err: " + JSON.stringify(err)); - return; - } - var result = { - accountInfo: { - name: "Lisi", - owner: "com.example.accountjsdemo", - }, - tokenInfo: { - token: "xxxxxx", - authType: "getSocialData" + import UIAbility from '@ohos.app.ability.UIAbility'; + + export default class EntryAbility extends UIAbility { + onCreate(want, param) { + var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; + try { + appAccountManager.getAuthCallback(sessionId, (err, callback) => { + if (err.code != account_appAccount.ResultCode.SUCCESS) { + console.log("getAuthCallback err: " + JSON.stringify(err)); + return; } - }; - callback.onResult(account_appAccount.ResultCode.SUCCESS, result); - }); - } catch (err) { - console.log("getAuthCallback exception: " + JSON.stringify(err)); + var result = { + accountInfo: { + name: "Lisi", + owner: "com.example.accountjsdemo", + }, + tokenInfo: { + token: "xxxxxx", + authType: "getSocialData" + } + }; + callback.onResult(account_appAccount.ResultCode.SUCCESS, result); + }); + } catch (err) { + console.log("getAuthCallback exception: " + JSON.stringify(err)); + } } - }); + } ``` ### getAuthCallback9+ @@ -2143,9 +2146,10 @@ getAuthCallback(sessionId: string): Promise<AuthCallback> **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; - featureAbility.getWant().then((want) => { + export default class EntryAbility extends UIAbility { + onCreate(want, param) { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; try { appAccountManager.getAuthCallback(sessionId).then((callback) => { @@ -2161,14 +2165,13 @@ getAuthCallback(sessionId: string): Promise<AuthCallback> }; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); }).catch((err) => { - console.log("getAuthCallback err: " + JSON.stringify(err)); + console.log("getAuthCallback err: " + JSON.stringify(err)); }); } catch (err) { console.log("getAuthCallback exception: " + JSON.stringify(err)); } - }).catch((err) => { - console.log("getWant err: " + JSON.stringify(err)); - }); + } + } ``` ### queryAuthenticatorInfo9+ @@ -4280,10 +4283,12 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; - featureAbility.getWant((err, want) => { - var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; - appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { + import UIAbility from '@ohos.app.ability.UIAbility'; + + export default class EntryAbility extends UIAbility { + onCreate(want, param) { + var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; + appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { if (err.code != account_appAccount.ResultCode.SUCCESS) { console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); return; @@ -4293,8 +4298,9 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); - }); - }); + }); + } + } ``` ### getAuthenticatorCallback(deprecated) @@ -4324,22 +4330,22 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback> **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; - featureAbility.getWant().then((want) => { + export default class EntryAbility extends UIAbility { + onCreate(want, param) { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { - var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", - [account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", - [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", - [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; - callback.onResult(account_appAccount.ResultCode.SUCCESS, result); + var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", + [account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", + [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", + [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; + callback.onResult(account_appAccount.ResultCode.SUCCESS, result); }).catch((err) => { - console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); + console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); }); - }).catch((err) => { - console.log("getWant err: " + JSON.stringify(err)); - }); + } + } ``` ### getAuthenticatorInfo(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md index 6338badb4810ea184689de12d0278260db64c76f..bc25988f7a20c5d3693aa5f0b9949045965299be 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -408,7 +408,7 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -492,7 +492,7 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -580,7 +580,7 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -716,7 +716,7 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -757,7 +757,7 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index 279865ea3c8f8d367f0be83d945e8b9b21e0a017..d11cf7f204326c6826f63265a719df589d5c1741 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -2088,7 +2088,7 @@ audioManager.off('deviceChange', (deviceChanged) => { }); ``` -### on('interrupt')(deprecated) +### on('interrupt') on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\): void @@ -2096,9 +2096,6 @@ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\ **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 - **系统能力:** SystemCapability.Multimedia.Audio.Renderer **参数:** @@ -2129,15 +2126,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { }); ``` -### off('interrupt')(deprecated) +### off('interrupt') off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\): void 取消监听音频打断事件(删除监听事件,取消打断)。 -> **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 - **系统能力:** SystemCapability.Multimedia.Audio.Renderer **参数:** @@ -3918,20 +3912,20 @@ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: let rendererInfo = { content : audio.ContentType.CONTENT_TYPE_MUSIC, usage : audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags : 0 }; + rendererFlags : 0 } async function getPreferOutputDevice() { audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo, (err, desc) => { if (err) { - console.error(`Result ERROR: ${JSON.stringify(err)}`); + console.error(`Result ERROR: ${err}`); } else { - console.info('device descriptor: ' + JSON.stringify(desc)); + console.info(`device descriptor: ${desc}`); } }); } ``` -### getPreferOutputDeviceForRendererInfo9+ +### getPreferOutputDeviceForRendererInfo10+ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors> 根据音频信息,返回优先级最高的输出设备,使用promise方式异步返回结果。 @@ -3950,19 +3944,27 @@ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise&l | --------------------- | --------------------------- | | Promise<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Promise返回优先级最高的输出设备信息。 | +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + **示例:** ```js let rendererInfo = { content : audio.ContentType.CONTENT_TYPE_MUSIC, usage : audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags : 0 }; + rendererFlags : 0 } async function getPreferOutputDevice() { audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo).then((desc) => { - console.info('device descriptor: ' + JSON.stringify(desc)); + console.info(`device descriptor: ${desc}`); }).catch((err) => { - console.error(`Result ERROR: ${JSON.stringify(err)}`); + console.error(`Result ERROR: ${err}`); }) } ``` @@ -3973,6 +3975,8 @@ on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererI 订阅最高优先级输出设备变化事件,使用callback获取最高优先级输出设备。 +**系统能力:** SystemCapability.Multimedia.Audio.Device + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -3981,16 +3985,24 @@ on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererI | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 表示渲染器信息。 | | callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)\> | 是 | 获取优先级最高的输出设备信息。 | +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + **示例:** ```js let rendererInfo = { content : audio.ContentType.CONTENT_TYPE_MUSIC, usage : audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags : 0 }; + rendererFlags : 0 } audioRoutingManager.on('preferOutputDeviceChangeForRendererInfo', rendererInfo, (desc) => { - console.info('device descriptor: ' + JSON.stringify(desc)); + console.info(`device descriptor: ${desc}`); }); ``` @@ -4009,6 +4021,14 @@ off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback | 否 | 监听方法的回调函数。 | +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + **示例:** ```js @@ -5044,7 +5064,7 @@ on(type: 'audioInterrupt', callback: Callback\): void 监听音频中断事件。使用callback获取中断事件。 -与[on('interrupt')](#oninterruptdeprecated)一致,均用于监听焦点变化。AudioRenderer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 +与[on('interrupt')](#oninterrupt)一致,均用于监听焦点变化。AudioRenderer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 **系统能力:** SystemCapability.Multimedia.Audio.Interrupt @@ -5784,7 +5804,7 @@ on(type: 'audioInterrupt', callback: Callback\): void 监听音频中断事件。使用callback获取中断事件。 -与[on('interrupt')](#oninterruptdeprecated)一致,均用于监听焦点变化。AudioCapturer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 +与[on('interrupt')](#oninterrupt)一致,均用于监听焦点变化。AudioCapturer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 **系统能力:** SystemCapability.Multimedia.Audio.Interrupt @@ -6294,7 +6314,7 @@ tonePlayer.release().then(() => { 音频打断/获取焦点事件的回调方法。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用[InterruptEvent](#interruptevent9)替代。 **系统能力:** SystemCapability.Multimedia.Audio.Renderer diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md index 13b7c2e15489346fc2b37edbde593dce3260d6e5..bf0cbbb9a8716a44ddc1929e97dde91ac8949119 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md @@ -31,4 +31,5 @@ | appDistributionType | string | 是 | 否 | 应用程序签名证书的分发类型,分为:app_gallery、enterprise、os_integration和crowdtesting。 | | appProvisionType | string | 是 | 否 | 应用程序签名证书文件的类型,分为debug和release两种类型。 | | systemApp | boolean | 是 | 否 | 标识应用是否为系统应用。 | -| bundleType |[BundleType](js-apis-bundleManager.md#bundletype) | 是 | 否 | 标识包的类型,取值为APP(普通应用)或者ATOMIC_SERVICE(原子化服务)。 | \ No newline at end of file +| bundleType |[BundleType](js-apis-bundleManager.md#bundletype) | 是 | 否 | 标识包的类型,取值为APP(普通应用)或者ATOMIC_SERVICE(原子化服务)。 | +| debug10+ | boolean | 是 | 否 | 标识应用是否处于调试模式,默认为false。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md index b3bdfc02bd4ab3e0e3dd7081dcab3205f2b11dd8..71359cac05b2716a4ed36012a18c4734cdc4e60b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @@ -20,13 +20,11 @@ import CommonEventManager from '@ohos.commonEventManager'; ## CommonEventManager.publish -```ts publish(event: string, callback: AsyncCallback): void -``` 发布公共事件,并在发布后执行相应的回调函数。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -61,13 +59,11 @@ try { ## CommonEventManager.publish -```ts publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void -``` 以回调的形式发布公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:**SystemCapability.Notification.CommonEvent **参数:** @@ -110,13 +106,11 @@ try { ## CommonEventManager.publishAsUser -```ts publishAsUser(event: string, userId: number, callback: AsyncCallback): void -``` 以回调的形式向指定用户发布公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **系统API**:此接口为系统接口,三方应用不支持调用。 @@ -157,13 +151,11 @@ try { ## CommonEventManager.publishAsUser -```ts publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback): void -``` 以回调形式向指定用户发布公共事件并指定发布信息。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **系统API**:此接口为系统接口,三方应用不支持调用。 @@ -212,13 +204,11 @@ try { ## CommonEventManager.createSubscriber -```ts createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback): void -``` 以回调形式创建订阅者。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -258,13 +248,11 @@ try { ## CommonEventManager.createSubscriber -```ts createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise -``` 以Promise形式创建订阅者。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -299,13 +287,11 @@ CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber) ## CommonEventManager.subscribe -```ts subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback): void -``` 以回调形式订阅公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -360,13 +346,11 @@ try { ## CommonEventManager.unsubscribe -```ts unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): void -``` 以回调形式取消订阅公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -427,4 +411,69 @@ try { } catch (err) { console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`); } -``` \ No newline at end of file +``` + +## CommonEventManager.removeStickyCommonEvent10+ + +removeStickyCommonEvent(event: string, callback: AsyncCallback): void + +以回调形式移除粘性公共事件。 + +**系统能力:** SystemCapability.Notification.CommonEvent + +**需要权限**: ohos.permission.COMMONEVENT_STICKY + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------- | +| event | string | 是 | 表示被移除的粘性公共事件。 | +| callback | AsyncCallback\ | 是 | 表示移除粘性公共事件的回调方法。 | + +**示例:** + + +```ts +CommonEventManager.removeStickyCommonEvent("sticky_event", (err) => { + if (err) { + console.info(`Remove sticky event AsyncCallback failed, errCode: ${err.code}, errMes: ${err.message}`); + return; + } + console.info(`Remove sticky event AsyncCallback success`); + } +}); +``` + +## CommonEventManager.removeStickyCommonEvent10+ + +removeStickyCommonEvent(event: string): Promise + +以Promise形式移除粘性公共事件。 + +**系统能力:** SystemCapability.Notification.CommonEvent + +**需要权限**: ohos.permission.COMMONEVENT_STICKY + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------- | +| event | string | 是 | 表示被移除的粘性公共事件。 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ---------------------------- | +| Promise\ | 表示移除粘性公共事件的对象。 | + +**示例:** + + +```ts +commonEventManager.removeStickyCommonEvent("sticky_event").then(() => { + console.info(`Remove sticky event AsyncCallback success`); +}).catch ((err) => { + console.info(`Remove sticky event AsyncCallback failed, errCode: ${err.code}, errMes: ${err.message}`); +}); +``` + diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index 1858e49ff90e8b98d9b321f5811ff72a366c4ead..5fa7bee77f0b5861f21bdbe481c115a5f9d50a44 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -5179,7 +5179,7 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void > **说明:** > -> 其中devicesId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> 其中deviceIds通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md index bed48f3ffc6401166c69140a567cfaa5b258743d..8e113385b7371271107f7afd45c99adc546205f1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md @@ -1486,7 +1486,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。 位置服务中的错误码信息。 > **说明:**
-> 从API version 9开始废弃。 +> 从API version 9开始废弃,建议使用[位置服务子系统错误码](../errorcodes/errorcode-geoLocationManager.md)替代。 **需要权限**:ohos.permission.LOCATION diff --git a/zh-cn/application-dev/reference/apis/js-apis-huks.md b/zh-cn/application-dev/reference/apis/js-apis-huks.md index 4619c537101ab040caeb87d2067f32e419988914..4f14da26e6a27829a6b5f0990dad081de9edd4b6 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-huks.md +++ b/zh-cn/application-dev/reference/apis/js-apis-huks.md @@ -75,7 +75,7 @@ generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ | -------- | --------------------------- | ---- | --------------------------------------------- | | keyAlias | string | 是 | 别名。 | | options | [HuksOptions](#huksoptions) | 是 | 用于存放生成key所需TAG。其中密钥使用的算法、密钥用途、密钥长度为必选参数。 | -| callback | AsyncCallback\ | 是 | 回调函数。不返回err值时表示接口使用成功,其他时为错误。 | +| callback | AsyncCallback\ | 是 | 回调函数。未捕获error时代表用户指定别名的密钥生成成功,基于密钥不出TEE原则,此接口不会返回密钥材料内容,若捕获error,则为生成阶段出现异常。 | **示例:** @@ -121,7 +121,7 @@ try { generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\ -生成密钥,使用Promise方式异步返回结果。 +生成密钥,使用Promise方式异步返回结果,基于密钥不出TEE原则,通过promise不会返回密钥材料内容,只用于表示此次调用是否成功。 **系统能力**:SystemCapability.Security.Huks @@ -1084,7 +1084,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\< | -------- | --------------------------- | ---- | --------------------------------------- | | keyAlias | string | 是 | 所需查找的密钥的别名。 | | options | [HuksOptions](#huksoptions) | 是 | 空对象(此处传空即可)。 | -| callback | AsyncCallback\ | 是 | 回调函数。FALSE代表密钥不存在,TRUE代表密钥存在。 | +| callback | AsyncCallback\ | 是 | 回调函数。若密钥存在,data为true,若密钥不存在,则error中会输出不存在的error code | **示例:** @@ -1094,17 +1094,19 @@ let keyAlias = 'keyAlias'; let emptyOptions = { properties: [] }; -try { - huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) { - if (error) { - console.error(`callback: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`); - } else { - console.info(`callback: isKeyItemExist success, data = ${JSON.stringify(data)}`); - } - }); -} catch (error) { - console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`); -} +huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) { + if (data) { + promptAction.showToast({ + message: "keyAlias: " + keyAlias +"is existed!", + duration: 2500, + }) + } else { + promptAction.showToast({ + message: "find key failed,error code: " + error.code + " error msg: " + error.message, + duration: 2500, + }) + } +}); ``` ## huks.isKeyItemExist9+ @@ -1126,7 +1128,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise\ | 类型 | 说明 | | ----------------- | --------------------------------------- | -| Promise\ | Promise对象。FALSE代表密钥不存在,TRUE代表密钥存在。 | +| Promise\ | Promise对象。密钥存在时,可通过then 进行密钥存在后的相关处理,若不存在,可通过error 处理密钥不存在后的相关业务操作 | **示例:** @@ -1136,17 +1138,17 @@ let keyAlias = 'keyAlias'; let emptyOptions = { properties: [] }; -try { - huks.isKeyItemExist(keyAlias, emptyOptions) - .then ((data) => { - console.info(`promise: isKeyItemExist success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - console.error(`promise: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`); - }); -} catch (error) { - console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`); -} +await huks.isKeyItemExist(keyAlias, emptyOptions).then((data) => { + promptAction.showToast({ + message: "keyAlias: " + keyAlias +"is existed!", + duration: 500, + }) + }).catch((err)=>{ + promptAction.showToast({ + message: "find key failed, error code: " + err.code + " error message: " + err.message, + duration: 6500, + }) + }) ``` ## huks.initSession9+ @@ -1707,7 +1709,7 @@ async function huksAbort() { | HUKS_ECC_KEY_SIZE_384 | 384 | 表示使用ECC算法的密钥长度为384bit。 | | HUKS_ECC_KEY_SIZE_521 | 521 | 表示使用ECC算法的密钥长度为521bit。 | | HUKS_AES_KEY_SIZE_128 | 128 | 表示使用AES算法的密钥长度为128bit。 | -| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为196bit。 | +| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为192bit。 | | HUKS_AES_KEY_SIZE_256 | 256 | 表示使用AES算法的密钥长度为256bit。 | | HUKS_AES_KEY_SIZE_512 | 512 | 表示使用AES算法的密钥长度为512bit。 | | HUKS_CURVE25519_KEY_SIZE_256 | 256 | 表示使用CURVE25519算法的密钥长度为256bit。 | @@ -1918,16 +1920,16 @@ async function huksAbort() { | HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | 表示派生密钥的大小。 | | HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | 表示导入的密钥类型。 | | HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | 表示导入加密密钥的套件。 | -| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 预留。 | -| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 预留。 | -| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 预留。 | -| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 预留。 | -| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留。 | -| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 预留。 | +| HUKS_TAG_ACTIVE_DATETIMEdeprecated | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_ORIGINATION_EXPIRE_DATETIMEdeprecated | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_USAGE_EXPIRE_DATETIMEdeprecated | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_CREATION_DATETIMEdeprecated | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留 | +| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 表示当前密钥属于哪个userID | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 | | HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 表示用户认证类型。从[HuksUserAuthType](#huksuserauthtype9)中选择,需要与安全访问控制类型同时设置。支持同时指定两种用户认证类型,如:安全访问控制类型指定为HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL时,密钥访问认证类型可以指定以下三种: HKS_USER_AUTH_TYPE_FACE 、HKS_USER_AUTH_TYPE_FINGERPRINT、HKS_USER_AUTH_TYPE_FACE \| HKS_USER_AUTH_TYPE_FINGERPRINT | -| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 预留。 | -| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 预留。 | +| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 表示authtoken 单次有效期。 | +| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 用于传入authToken 的字段 | | HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | 表示安全访问控制类型。从[HuksAuthAccessType](#huksauthaccesstype9)中选择,需要和用户认证类型同时设置。 | | HUKS_TAG_KEY_SECURE_SIGN_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | 表示生成或导入密钥时,指定该密钥的签名类型。 | | HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | 表示密钥使用时生成的challenge类型。从[HuksChallengeType](#hukschallengetype9)中选择 | @@ -1966,7 +1968,7 @@ async function huksAbort() { | HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | 预留。 | | HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | 表示密钥版本的Tag。 | | HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | 预留。 | -| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 预留。 | +| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 用于传入GCM模式中的AEAD 数据的字段。 | | HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | 预留。 | | HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | 表示操作系统版本的Tag。 | | HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | 表示操作系统补丁级别的Tag。 | @@ -2821,6 +2823,7 @@ function huksAbort() { huks Handle结构体。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksSessionHandle9+](#hukssessionhandle9)替代。 | 名称 | 类型 | 必填 | 说明 | | ---------- | ---------------- | ---- | -------- | @@ -2834,6 +2837,8 @@ huks Handle结构体。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksReturnResult9+](#huksreturnresult9)替代。 + | 名称 | 类型 | 必填 | 说明 | | ---------- | ------------------------------- | ---- | ---------------- | | errorCode | number | 是 | 表示错误码。 | @@ -2847,6 +2852,7 @@ huks Handle结构体。 表示错误码的枚举。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksExceptionErrCode9+](#huksexceptionerrcode9)替代。 | 名称 | 值 | 说明 | | -------------------------- | ----- | ---- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md index ca60f6ebdfae984ee378a10acbd0efff756731e5..5c8754dc11a5a7e2c7cb4dfe2bb381835113e465 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -20,7 +20,7 @@ import appManager from '@ohos.app.ability.appManager'; function getForegroundAppInfos() { appManager.getForegroundApplications((error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } for (let i = 0; i < data.length; i++) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md index 2c78be7ca1adbe8592335d2f25f27efab5b0329e..618cae585d94f5d1bbfbfd1204672925147bd38d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md @@ -62,7 +62,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -101,7 +101,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -141,7 +141,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,7 +166,7 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 63c005cac40f77ebbf57a1ceab9fba2ef75a907d..768e509c1ec52fbd1060017a06dd431f253b108a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Mission迁移完成后调用,返回迁移结果。 distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 0a2b55830f4d7a3f6c5fe0d8fa3f1b1557aedd30..209d0a0567bf64818844ce7fac0057b31fa6de56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 54c4504afc1b44ba1cd7055715447ec6c8c2bd80..d18486f4fff03e6e5066159985929df272fb207d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -30,7 +30,7 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -69,6 +69,6 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 5dd3ccabac7f20b0c74aad2abf0cfa9a81f488c5..37e2743da7dd4cc4f1d2f8b63c4cf310edad4da1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -33,7 +33,7 @@ let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { if (error && error.code) { - console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index cab87eea78ef2427c8ae3c346f81552deff4a6a0..389f8af0a9dfe2e91a2adaa8b3e345c6491bfab6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -25,7 +25,7 @@ try { missionManager.getMissionInfo('', 1, (error, data) => { if (error.code) { // 处理业务逻辑错误 - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cc8c511b378e4af108e98ce5051bd95d45e7c3c0..df07e847693276b618c1b13b6fa906f85782577b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -27,7 +27,7 @@ try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -36,7 +36,7 @@ missionManager.getMissionSnapShot('', id, (err, snapshot) => { if (err.code) { - console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); + console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 9b835fee85ba01b9ccfd41b2bc65ccca524763f1..9e8a8d1c933b74518fc3aa3b0b6ed4b77b9f956b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -79,7 +79,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; this.context.startAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -87,7 +87,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -158,11 +158,11 @@ startAbility(want: Want, options?: StartOptions): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -225,7 +225,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -233,7 +233,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -300,7 +300,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -308,7 +308,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -379,7 +379,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -387,7 +387,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -468,11 +468,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -523,7 +523,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -531,7 +531,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -591,11 +591,11 @@ startServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -652,7 +652,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -660,7 +660,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -725,11 +725,11 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -777,7 +777,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -785,7 +785,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -842,11 +842,11 @@ stopServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -899,7 +899,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // 执行正常业务 @@ -907,7 +907,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -969,11 +969,11 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1010,7 +1010,7 @@ terminateSelf(callback: AsyncCallback<void>): void; this.context.terminateSelf((error) => { if (error.code) { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -1053,7 +1053,7 @@ terminateSelf(): Promise<void>; console.log('terminateSelf succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1113,7 +1113,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1177,7 +1177,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1220,7 +1220,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< commRemote = null; if (error.code) { // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -1229,7 +1229,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< } catch (paramError) { commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1282,12 +1282,12 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; .catch((error) => { commRemote = null; // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1356,11 +1356,11 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1388,10 +1388,10 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index 363fce781c87703a4b5de91ebd2b3e0d4398589e..70808c6cf9a511ae825b4ab8b878978cd4b094b8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -66,7 +66,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ startAbility(want: Want, options?: StartOptions): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index 67763454ef51f5844a638f5310c4a3ba6ac8966a..99703db51cdf6183a2d20767901dd3f5190877c9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -1138,7 +1138,7 @@ setBitrate(bitrate: number): void | 参数名 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------------ | -| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。 | +| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。如果通过availableBitrates时间获得的比特率列表长度为0,则不支持指定比特率,也不会产生bitrateDone回调。 | **示例:** @@ -1203,7 +1203,7 @@ on(type: 'availableBitrates', callback: (bitrates: Array\) => void): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | ---- | ------------------------------------------------------------ | | type | string | 是 | HLS协议可用比特率上报事件回调类型,支持的事件:'availableBitrates',只会在prepared之后上报一次。 | -| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。 | +| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。如果数组长度为0,则不支持指定比特率。 | **示例:** @@ -1762,7 +1762,7 @@ let AVRecorderProfile = { audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -1833,7 +1833,7 @@ let AVRecorderProfile = { audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -2535,7 +2535,7 @@ avRecorder.off('error'); | audioSampleRate | number | 否 | 音频采样率,选择音频录制时必填。 | | fileFormat | [ContainerFormatType](#containerformattype8) | 是 | 文件的容器格式,必要参数。 | | videoBitrate | number | 否 | 视频编码比特率,选择视频录制时必填。 | -| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。当前仅支持VIDEO_AVC和VIDEO_MPEG4。 | +| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。需要查询设备支持的编码能力(包括编码格式,分辨率大小等)。 | | videoFrameWidth | number | 否 | 视频帧的宽,选择视频录制时必填。 | | videoFrameHeight | number | 否 | 视频帧的高,选择视频录制时必填。 | | videoFrameRate | number | 否 | 视频帧率,选择视频录制时必填。 | @@ -2644,7 +2644,7 @@ let videoProfile = { audioSampleRate : 48000, fileFormat : 'mp4', videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', + videoCodec : 'video/avc', videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -2715,7 +2715,7 @@ let videoProfile = { audioSampleRate : 48000, fileFormat : 'mp4', videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', + videoCodec : 'video/avc', videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md b/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md index cfbda46e5bce0aca5c80331cc37e80692d9c4365..81a87e215601ac6f93cbae94025c587d81b357ba 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md @@ -399,7 +399,7 @@ discoveryService.stopSearchingMDNS(); ### on('discoveryStart') -on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MDNS_ERR}>): void +on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void 订阅开启监听mDNS服务的通知。 @@ -410,7 +410,7 @@ on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, er | 参数名 | 类型 | 必填 | 说明 | |-------------|--------------|-----------|-----------------------------------------------------| | type | string | 是 |订阅事件,固定为'discoveryStart'。
discoveryStart:开始搜索局域网内的mDNS服务事件。 | -| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | mDNS服务的信息和事件错误信息。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 | **示例:** @@ -428,7 +428,7 @@ discoveryService.stopSearchingMDNS(); ### on('discoveryStop') -on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MDNS_ERR}>): void +on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void 订阅停止监听mDNS服务的通知。 @@ -439,7 +439,7 @@ on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, err | 参数名 | 类型 | 必填 | 说明 | |-------------|--------------|-----------|-----------------------------------------------------| | type | string | 是 |订阅事件,固定为'discoveryStop'。
discoveryStop:停止搜索局域网内的mDNS服务事件。 | -| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | mDNS服务的信息和事件错误信息。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 | **示例:** @@ -538,7 +538,7 @@ mDNS服务属性信息 | key | string | 是 | mDNS服务属性键值,键值长度应该小于9个字符。 | | value | Array\ | 是 | mDNS服务属性值。 | -## MDNS_ERR +## MdnsError mDNS错误信息。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index dfe530d7cbc066330dff01f5f35a35a97ecc6654..4e0465e809a0ce71c95130aacc88d58bc3707260 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -2432,7 +2432,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback<number | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------- | ---- | ------------------------------------------------------------ | | type | 'activate' \| 'activating' | 是 | 取消订阅类型,activate表示取消订阅帐号已激活完成的事件,activating取消订阅帐号正在激活的事件。 | -| name | string | 是 | 订阅名称,可自定义,,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 | +| name | string | 是 | 订阅名称,可自定义,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 | | callback | Callback<number> | 否 | 取消订阅系统帐号激活完成与激活中的事件回调,默认返回0。 | **错误码:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md index ea2ca253bf4c6499d0318ddf972b9cdb218e14df..495cc3b17c604a55ac2a62cc97004f1786dcbcb6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -376,11 +376,11 @@ let record = pasteboard.createUriRecord('dataability:///com.example.myapplicatio | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- |--------------------------------------------------------------------------------------------| -| additions7+ | {[key:string]:object} | 是 | 是 | 设置的其他附加属性数据, 暂不支持。 | +| additions7+ | {[key:string]:object} | 是 | 是 | 设置其他附加属性数据。 | | mimeTypes7+ | Array<string> | 是 | 否 | 剪贴板内容条目的数据类型,非重复的类型列表。 | -| tag7+ | string | 是 | 是 | 用户自定义标签, 暂不支持。 | +| tag7+ | string | 是 | 是 | 用户自定义标签。 | | timestamp7+ | number | 是 | 否 | 剪贴板数据的写入时间戳(单位:ms)。 | -| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”, 默认值为true。暂不支持, 推荐使用shareOption属性。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | +| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”,默认值为false。暂不支持,推荐使用shareOption属性。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | | shareOption9+ | [ShareOption](#shareoption9) | 是 | 是 | 指示剪贴板数据可以粘贴到的范围,如果未设置或设置不正确,则默认值为CROSSDEVICE。 | ## PasteDataRecord7+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md index 6a30bba2bd23574989482edb27fbf0c7fd7c870c..31dbd8ec9098fb32ed006aff8501a1155dcef3c0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @@ -1543,7 +1543,7 @@ closeRawFd(path: string, callback: AsyncCallback<void>): void ``` -### closeRawFd8+ +### closeRawFd9+ closeRawFd(path: string): Promise<void> diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md index 46f766d853ce0331c15e26d6d4f936800b698289..84cb3f5d01d51e217035371df3e1e447103eaa8d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uitest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -542,7 +542,7 @@ inWindow(bundleName: string): On; **示例:** ```js -let on = ON.inWindow(ON.inWindow('com.uitestScene.acts')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的应用窗口内。 +let on = ON.inWindow('com.uitestScene.acts'); // 使用静态构造器ON创建On对象,指定目标控件位于给出的应用窗口内。 ``` ## Component9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb.md b/zh-cn/application-dev/reference/apis/js-apis-usb.md deleted file mode 100644 index df58b15f33dd1b1668795996d324ca2aeeedd347..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/apis/js-apis-usb.md +++ /dev/null @@ -1,953 +0,0 @@ -# @ohos.usbV9 (USB管理) - -本模块主要提供管理USB设备的相关功能,包括主设备上查询USB设备列表、批量数据传输、控制命令传输、权限控制等;从设备上端口管理、功能切换及查询等。 - -> **说明:** -> -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> -> 从API version 9开始,该接口不再维护,推荐使用新接口[`@ohos.usbManager`](js-apis-usbManager.md)。 - -## 导入模块 - -```js -import usb from "@ohos.usbV9"; -``` - -## usb.getDevices - -getDevices(): Array<Readonly<USBDevice>> - -获取接入主设备的USB设备列表。如果没有设备接入,那么将会返回一个空的列表。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ---------------------------------------------------- | ------- | -| Array<Readonly<[USBDevice](#usbdevice)>> | 设备信息列表。 | - -**示例:** - -```js -let devicesList = usb.getDevices(); -console.log(`devicesList = ${devicesList}`); -//devicesList 返回的数据结构 -//此处提供一个简单的示例,如下 -[ - { - name: "1-1", - serial: "", - manufacturerName: "", - productName: "", - version: "", - vendorId: 7531, - productId: 2, - clazz: 9, - subClass: 0, - protocol: 1, - devAddress: 1, - busNum: 1, - configs: [ - { - id: 1, - attributes: 224, - isRemoteWakeup: true, - isSelfPowered: true, - maxPower: 0, - name: "1-1", - interfaces: [ - { - id: 0, - protocol: 0, - clazz: 9, - subClass: 0, - alternateSetting: 0, - name: "1-1", - endpoints: [ - { - address: 129, - attributes: 3, - interval: 12, - maxPacketSize: 4, - direction: 128, - number: 1, - type: 3, - interfaceId: 0, - }, - ], - }, - ], - }, - ], - }, -] -``` - -## usb.connectDevice - -connectDevice(device: USBDevice): Readonly<USBDevicePipe> - -根据getDevices()返回的设备信息打开USB设备。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及device,再调用[usb.requestRight](#usbrequestright)请求使用该设备的权限。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| device | [USBDevice](#usbdevice) | 是 | USB设备信息。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Readonly<[USBDevicePipe](#usbdevicepipe)> | 指定的传输通道对象。 | - -**错误码:** - -以下错误码的详细介绍参见[USB错误码](../errorcodes/errorcode-usb.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 14400001 |Permission denied. Need call requestRight to get permission. | - -**示例:** - -```js -let devicesList = usb.getDevices(); -if (devicesList.length == 0) { - console.log(`device list is empty`); -} - -let device = devicesList[0]; -usb.requestRight(device.name); -let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${devicepipe}`); -``` - -## usb.hasRight - -hasRight(deviceName: string): boolean - -判断是否有权访问该设备。 - -如果“使用者”(如各种App或系统)有权访问设备则返回true;无权访问设备则返回false。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | true表示有访问设备的权限,false表示没有访问设备的权限。 | - -**示例:** - -```js -let devicesName="1-1"; -let bool = usb.hasRight(devicesName); -console.log(bool); -``` - -## usb.requestRight - -requestRight(deviceName: string): Promise<boolean> - -请求软件包的临时权限以访问设备。使用Promise异步回调。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<boolean> | Promise对象,返回临时权限的申请结果。返回true表示临时权限申请成功;返回false则表示临时权限申请失败。 | - -**示例:** - -```js -let devicesName="1-1"; -usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${ret}`); -}); -``` - -## usb.removeRight - -removeRight(deviceName: string): boolean - -移除软件包访问设备的权限。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回权限移除结果。返回true表示权限移除成功;返回false则表示权限移除失败。 | - -**示例:** - -```js -let devicesName="1-1"; -if usb.removeRight(devicesName) { - console.log(`Succeed in removing right`); -} -``` - -## usb.addRight - -addRight(bundleName: string, deviceName: string): boolean - -添加软件包访问设备的权限。 - -[requestRight](#usbrequestright)会触发弹框请求用户授权;addRight不会触发弹框,而是直接添加软件包访问设备的权限。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | -| bundleName | string | 是 | 软件包名称。| - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回权限添加结果。返回true表示权限添加成功;返回false则表示权限添加失败。 | - -**示例:** - -```js -let devicesName = "1-1"; -let bundleName = "com.example.hello"; -if usb.addRight(bundleName, devicesName) { - console.log(`Succeed in adding right`); -} -``` - -## usb.claimInterface - -claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number - -注册通信接口。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要获取接口的索引。 | -| force | boolean | 否 | 可选参数,是否强制获取。默认值为false ,表示不强制获取。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 注册通信接口成功返回0;注册通信接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.claimInterface(devicepipe, interfaces); -console.log(`claimInterface = ${ret}`); -``` - -## usb.releaseInterface - -releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number - -释放注册过的通信接口。 - -需要调用[usb.claimInterface](#usbclaiminterface)先获取接口,才能使用此方法释放接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要释放接口的索引。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 释放接口成功返回0;释放接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.releaseInterface(devicepipe, interfaces); -console.log(`releaseInterface = ${ret}`); -``` - -## usb.setConfiguration - -setConfiguration(pipe: USBDevicePipe, config: USBConfig): number - -设置设备配置。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及config;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| config | [USBConfig](#usbconfig) | 是 | 用于确定需要设置的配置。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 设置设备配置成功返回0;设置设备配置失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.setConfiguration(devicepipe, config); -console.log(`setConfiguration = ${ret}`); -``` - -## usb.setInterface - -setInterface(pipe: USBDevicePipe, iface: USBInterface): number - -设置设备接口。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数;调用[usb.claimInterface](#usbclaiminterface)注册通信接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ----- | ------------------------------- | --- | ------------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要设置的接口。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 设置设备接口成功返回0;设置设备接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.setInterface(devicepipe, interfaces); -console.log(`setInterface = ${ret}`); -``` - -## usb.getRawDescriptor - -getRawDescriptor(pipe: USBDevicePipe): Uint8Array - -获取原始的USB描述符。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Uint8Array | 返回获取的原始数据;失败返回undefined。 | - -**示例:** - -```js -let ret = usb.getRawDescriptor(devicepipe); -``` - -## usb.getFileDescriptor - -getFileDescriptor(pipe: USBDevicePipe): number - -获取文件描述符。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | -------------------- | -| number | 返回设备对应的文件描述符;失败返回-1。 | - -**示例:** - -```js -let ret = usb.getFileDescriptor(devicepipe); -``` - -## usb.controlTransfer - -controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise<number> - -控制传输。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定设备。 | -| controlparam | [USBControlParams](#usbcontrolparams) | 是 | 控制传输参数。 | -| timeout | number | 否 | 超时时间(单位:ms),可选参数,默认为0不超时。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | Promise对象,获取传输或接收到的数据块大小。失败返回-1。 | - -**示例:** - -```js -let param = new usb.USBControlParams(); -usb.controlTransfer(devicepipe, param).then((ret) => { - console.log(`controlTransfer = ${ret}`); -}) -``` - -## usb.bulkTransfer - -bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise<number> - -批量传输。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息列表以及endpoint;再调用[usb.requestRight](#usbrequestright)获取设备请求权限;然后调用[usb.connectDevice](#usbconnectdevice)接口得到返回数据devicepipe之后,再次获取接口[usb.claimInterface](#usbclaiminterface);再调用usb.bulkTransfer接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定设备。 | -| endpoint | [USBEndpoint](#usbendpoint) | 是 | 用于确定传输的端口。 | -| buffer | Uint8Array | 是 | 用于写入或读取的缓冲区。 | -| timeout | number | 否 | 超时时间(单位:ms),可选参数,默认为0不超时。| - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | Promise对象,获取传输或接收到的数据块大小。失败返回-1。 | - -**示例:** - -```js -//usb.getDevices 接口返回数据集合,取其中一个设备对象,并获取权限 。 -//把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; -//才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 -usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${ret}`); -}); -``` - -## usb.closePipe - -closePipe(pipe: USBDevicePipe): number - -关闭设备消息控制通道。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定USB设备消息控制通道。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 关闭设备消息控制通道成功返回0;关闭设备消息控制通道失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.closePipe(devicepipe); -console.log(`closePipe = ${ret}`); -``` - -## usb.usbFunctionsFromString - -usbFunctionsFromString(funcs: string): number - -在设备模式下,将字符串形式的USB功能列表转化为数字掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------------- | -| funcs | string | 是 | 字符串形式的功能列表。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | ------------------ | -| number | 转化后的数字掩码。 | - -**示例:** - -```js -let funcs = "acm"; -let ret = usb.usbFunctionsFromString(funcs); -``` - -## usb.usbFunctionsToString - -usbFunctionsToString(funcs: FunctionType): string - -在设备模式下,将数字掩码形式的USB功能列表转化为字符串。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | 是 | USB功能数字掩码。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | ------------------------------ | -| string | 转化后的字符串形式的功能列表。 | - -**示例:** - -```js -let funcs = usb.ACM | usb.ECM; -let ret = usb.usbFunctionsToString(funcs); -``` - -## usb.setCurrentFunctions - -setCurrentFunctions(funcs: FunctionType): Promise\ - -在设备模式下,设置当前的USB功能列表。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | 是 | USB功能数字掩码。 | - -**返回值:** - -| 类型 | 说明 | -| --------------- | ------------- | -| Promise\ | Promise对象。 | - -**示例:** - -```js -let funcs = usb.HDC; -usb.setCurrentFunctions(funcs).then(() => { - console.info('usb setCurrentFunctions successfully.'); -}).catch(err => { - console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## usb.getCurrentFunctions - -getCurrentFunctions(): FunctionType - -在设备模式下,获取当前的USB功能列表的数字组合掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ------------------------------ | --------------------------------- | -| [FunctionType](#functiontype) | 当前的USB功能列表的数字组合掩码。 | - -**示例:** - -```js -let ret = usb.getCurrentFunctions(); -``` - -## usb.getPorts - -getPorts(): Array\ - -获取所有物理USB端口描述信息。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ----------------------------- | --------------------- | -| [Array\](#usbport) | USB端口描述信息列表。 | - -**示例:** - -```js -let ret = usb.getPorts(); -``` - -## usb.getSupportedModes - -getSupportedModes(portId: number): PortModeType - -获取指定的端口支持的模式列表的组合掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------- | -| portId | number | 是 | 端口号。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------------------ | -------------------------- | -| [PortModeType](#portmodetype) | 支持的模式列表的组合掩码。 | - -**示例:** - -```js -let ret = usb.getSupportedModes(0); -``` - -## usb.setPortRoles - -setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\ - -设置指定的端口支持的角色模式,包含充电角色、数据传输角色。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| --------- | -------------------------------- | ---- | ---------------- | -| portId | number | 是 | 端口号。 | -| powerRole | [PowerRoleType](#powerroletype) | 是 | 充电的角色。 | -| dataRole | [DataRoleType](#dataroletype) | 是 | 数据传输的角色。 | - -**返回值:** - -| 类型 | 说明 | -| --------------- | ------------- | -| Promise\ | Promise对象。 | - -**示例:** - -```js -let portId = 1; -usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { - console.info('usb setPortRoles successfully.'); -}).catch(err => { - console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## USBEndpoint - -通过USB发送和接收数据的端口。通过[USBInterface](#usbinterface)获取。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ------------- | ------------------------------------------- | ------------- |------------- | -| address | number | 是 |端点地址。 | -| attributes | number | 是 |端点属性。 | -| interval | number | 是 |端点间隔。 | -| maxPacketSize | number | 是 |端点最大数据包大小。 | -| direction | [USBRequestDirection](#usbrequestdirection) | 是 |端点的方向。 | -| number | number | 是 |端点号。 | -| type | number | 是 |端点类型。 | -| interfaceId | number | 是 |端点所属的接口的唯一标识。 | - -## USBInterface - -一个[USBConfig](#usbconfig)中可以含有多个USBInterface,每个USBInterface提供一个功能。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ---------------- | ---------------------------------------- | ------------- |--------------------- | -| id | number | 是 |接口的唯一标识。 | -| protocol | number | 是 |接口的协议。 | -| clazz | number | 是 |设备类型。 | -| subClass | number | 是 |设备子类。 | -| alternateSetting | number | 是 |在同一个接口中的多个描述符中进行切换设置。 | -| name | string | 是 |接口名称。 | -| endpoints | Array<[USBEndpoint](#usbendpoint)> | 是 |当前接口所包含的端点。 | - -## USBConfig - -USB配置,一个[USBDevice](#usbdevice)中可以含有多个配置。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| -------------- | ------------------------------------------------ | --------------- |--------------- | -| id | number | 是 |配置的唯一标识。 | -| attributes | number | 是 |配置的属性。 | -| maxPower | number | 是 |最大功耗,以毫安为单位。 | -| name | string | 是 |配置的名称,可以为空。 | -| isRemoteWakeup | boolean | 是 |检查当前配置是否支持远程唤醒。 | -| isSelfPowered | boolean | 是 | 检查当前配置是否支持独立电源。 | -| interfaces | Array <[USBInterface](#usbinterface)> | 是 |配置支持的接口属性。 | - -## USBDevice - -USB设备信息。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ---------------- | ------------------------------------ | ---------- |---------- | -| busNum | number | 是 |总线地址。 | -| devAddress | number | 是 |设备地址。 | -| serial | string | 是 |序列号。 | -| name | string | 是 |设备名字。 | -| manufacturerName | string | 是 | 产商信息。 | -| productName | string | 是 |产品信息。 | -| version | string | 是 |版本。 | -| vendorId | number | 是 |厂商ID。 | -| productId | number | 是 |产品ID。 | -| clazz | number | 是 |设备类。 | -| subClass | number | 是 |设备子类。 | -| protocol | number | 是 |设备协议码。 | -| configs | Array<[USBConfig](#usbconfig)> | 是 |设备配置描述符信息。 | - -## USBDevicePipe - -USB设备消息传输通道,用于确定设备。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ---------- | ------ | ----- |----- | -| busNum | number |是 | 总线地址。 | -| devAddress | number |是 | 设备地址。 | - -## USBControlParams - -控制传输参数。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ------- | ----------------------------------------------- | ---------------- |---------------- | -| request | number | 是 |请求类型。 | -| target | [USBRequestTargetType](#usbrequesttargettype) | 是 |请求目标类型。 | -| reqType | [USBControlRequestType](#usbcontrolrequesttype) | 是 |请求控制类型。 | -| value | number | 是 |请求参数。 | -| index | number | 是 |请求参数value对应的索引值。 | -| data | Uint8Array | 是 |用于写入或读取的缓冲区。 | - -## USBPort - -USB设备端口。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| -------------- | ------------------------------- | ------------------- |------------------------ | -| id | number | 是 |USB端口唯一标识。 | -| supportedModes | [PortModeType](#portmodetype) | 是 |USB端口所支持的模式的数字组合掩码。 | -| status | [USBPortStatus](#usbportstatus) | 是 |USB端口角色。 | - -## USBPortStatus - -USB设备端口角色信息。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ---------------- | -------- | ---------------- |---------------------- | -| currentMode | number | 是 |当前的USB模式。 | -| currentPowerRole | number | 是 |当前设备充电模式。 | -| currentDataRole | number | 是 |当前设备数据传输模式。 | - -## USBRequestTargetType - -请求目标类型。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ---------------------------- | ---- | ------ | -| USB_REQUEST_TARGET_DEVICE | 0 | 设备。 | -| USB_REQUEST_TARGET_INTERFACE | 1 | 接口。 | -| USB_REQUEST_TARGET_ENDPOINT | 2 | 端点。 | -| USB_REQUEST_TARGET_OTHER | 3 | 其他。 | - -## USBControlRequestType - -控制请求类型。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------------------------- | ---- | ------ | -| USB_REQUEST_TYPE_STANDARD | 0 | 标准。 | -| USB_REQUEST_TYPE_CLASS | 1 | 类。 | -| USB_REQUEST_TYPE_VENDOR | 2 | 厂商。 | - -## USBRequestDirection - -请求方向。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| --------------------------- | ---- | ------------------------ | -| USB_REQUEST_DIR_TO_DEVICE | 0 | 写数据,主设备往从设备。 | -| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | 读数据,从设备往主设备。 | - -## FunctionType - -USB设备侧功能。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------------ | ---- | ---------- | -| NONE | 0 | 没有功能。 | -| ACM | 1 | acm功能。 | -| ECM | 2 | ecm功能。 | -| HDC | 4 | hdc功能。 | -| MTP | 8 | 暂不支持。 | -| PTP | 16 | 暂不支持。 | -| RNDIS | 32 | 暂不支持。 | -| MIDI | 64 | 暂不支持。 | -| AUDIO_SOURCE | 128 | 暂不支持。 | -| NCM | 256 | 暂不支持。 | - -## PortModeType - -USB端口模式类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| --------- | ---- | ---------------------------------------------------- | -| NONE | 0 | 无。 | -| UFP | 1 | 数据上行,需要外部供电。 | -| DFP | 2 | 数据下行,对外提供电源。 | -| DRP | 3 | 既可以做DFP(Host),也可以做UFP(Device),当前不支持。 | -| NUM_MODES | 4 | 当前不支持。 | - -## PowerRoleType - -电源角色类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------ | ---- | ---------- | -| NONE | 0 | 无。 | -| SOURCE | 1 | 外部供电。 | -| SINK | 2 | 内部供电。 | - -## DataRoleType - -数据角色类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------ | ---- | ------------ | -| NONE | 0 | 无。 | -| HOST | 1 | 主设备角色。 | -| DEVICE | 2 | 从设备角色。 | - diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md index fa258500f81b3b9436188afb6cb77740202ec831..8eae2cbea67e59d15aba3e9d848e037a5d54ade1 100644 --- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md @@ -41,8 +41,8 @@ | text-align | string | left | 否 | 设置文本的文本对齐方式,可选值为:
- left:文本左对齐;
- center:文本居中对齐;
- right:文本右对齐; | | text-overflow | string | clip | 否 | 可选值为:
- clip:将文本根据父容器大小进行裁剪显示;
- ellipsis:根据父容器大小显示,显示不下的文本用省略号代替。 | | font-family | string | SourceHanSansSC-Regular | 否 | 字体。目前仅支持SourceHanSansSC-Regular 字体。 | -| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | -| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。
未设置时组件高度默认为0。 | +| width | <length> \| <percentage>5+ | 0px | 否 | 设置组件自身的宽度。
单位:px
未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | 0px | 否 | 设置组件自身的高度。
单位:px
未设置时组件高度默认为0。 | | padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | | padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | | margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | @@ -54,6 +54,7 @@ | opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | | display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | | [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | +| line-height10+ | number | 0px | 否 | 设置文本的行高。
单位:px
未设置时文本行高默认为适应性行高。 | ## 示例 diff --git a/zh-cn/application-dev/reference/native-apis/_audio_decoder.md b/zh-cn/application-dev/reference/native-apis/_audio_decoder.md index dba176333f7234ad5a5cdb60e543d58c43138df8..bd434a343ca936184a44d9c07b44710b844ff51a 100644 --- a/zh-cn/application-dev/reference/native-apis/_audio_decoder.md +++ b/zh-cn/application-dev/reference/native-apis/_audio_decoder.md @@ -3,7 +3,7 @@ ## 概述 -AudioDecoder模块提供用于音频解码功能的函数。 +AudioDecoder模块提供用于音频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.AudioDecoder diff --git a/zh-cn/application-dev/reference/native-apis/_audio_encoder.md b/zh-cn/application-dev/reference/native-apis/_audio_encoder.md index 088def8941959030ba924013f6a729c998957bc0..3c011bcc363ab52cb91aa0a969d43fcde062b2ba 100644 --- a/zh-cn/application-dev/reference/native-apis/_audio_encoder.md +++ b/zh-cn/application-dev/reference/native-apis/_audio_encoder.md @@ -3,7 +3,7 @@ ## 概述 -AudioEncoder模块提供用于音频编码功能的函数。 +AudioEncoder模块提供用于音频编码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.AudioEncoder diff --git a/zh-cn/application-dev/reference/native-apis/_codec_base.md b/zh-cn/application-dev/reference/native-apis/_codec_base.md index 8447b567a850200de0311367940e1a6da35ca65e..aa3be62e1ec6e78273ea5fc1316d1f5d18d9eb9f 100644 --- a/zh-cn/application-dev/reference/native-apis/_codec_base.md +++ b/zh-cn/application-dev/reference/native-apis/_codec_base.md @@ -3,7 +3,7 @@ ## 概述 -CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。 +CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.CodecBase diff --git a/zh-cn/application-dev/reference/native-apis/_video_decoder.md b/zh-cn/application-dev/reference/native-apis/_video_decoder.md index e14a226d2513e514cf448d2e81772bb452598723..a53a04ceaac7926389522bd400869fefc1859bf3 100644 --- a/zh-cn/application-dev/reference/native-apis/_video_decoder.md +++ b/zh-cn/application-dev/reference/native-apis/_video_decoder.md @@ -3,7 +3,7 @@ ## 概述 -VideoDecoder模块提供用于视频解码功能的函数。 +VideoDecoder模块提供用于视频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.VideoDecoder diff --git a/zh-cn/application-dev/reference/native-apis/_video_encoder.md b/zh-cn/application-dev/reference/native-apis/_video_encoder.md index 1add6078088f5133af03e1e7565e653957364e75..b7bf9abf6a31cdb4201bb87b8b3c2649d2f0f816 100644 --- a/zh-cn/application-dev/reference/native-apis/_video_encoder.md +++ b/zh-cn/application-dev/reference/native-apis/_video_encoder.md @@ -3,7 +3,7 @@ ## 概述 -VideoEncoder模块提供用于视频编码功能的函数和枚举。 +VideoEncoder模块提供用于视频编码功能的函数和枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.VideoEncoder diff --git a/zh-cn/application-dev/task-management/workscheduler-extensionability.md b/zh-cn/application-dev/task-management/workscheduler-extensionability.md index 5f9b24c861275432eb5667180325e2381b01a992..7e5361f54b46cfecdbac6142a64c221d3d2c0a94 100644 --- a/zh-cn/application-dev/task-management/workscheduler-extensionability.md +++ b/zh-cn/application-dev/task-management/workscheduler-extensionability.md @@ -195,6 +195,16 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 } ``` +## 限制 + +为了降低WorkSchedulerExtensionAbility能力被三方应用滥用的风险,在WorkSchedulerExtensionAbility中限制以下接口的调用 + +- @ohos.backgroundTaskManager.d.ts +- @ohos.resourceschedule.backgroundTaskManager.d.ts +- @ohos.multimedia.camera.d.ts +- @ohos.multimedia.audio.d.ts +- @ohos.multimedia.media.d.ts + ## 相关实例 针对WorkSchedulerExtensionAbility开发,有以下相关示例可供参考: diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-release.md b/zh-cn/release-notes/OpenHarmony-v3.2-release.md new file mode 100644 index 0000000000000000000000000000000000000000..e979333d968e57aa25598715158eb221af973077 --- /dev/null +++ b/zh-cn/release-notes/OpenHarmony-v3.2-release.md @@ -0,0 +1,649 @@ +# OpenHarmony 3.2 Release + +## 版本概述 +OpenHarmony 3.2版本标准系统能力进一步完善,支持采用ArkTS语言+Stage应用模型进行大型应用、原子化服务开发。[ArkCompiler](#arkcompiler)的优化、Taskpool机制提升应用运行性能;ArkUI组件能力增强,强化图形渲染能力和系统安全能力,丰富分布式业务开发;OpenHarmony 3.2 Release版本提供API Level 9稳定接口,在OpenHarmony 3.1 Release版本的基础上,进一步提升系统的整体性能、稳定性和安全性。 + + +OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更多关键特性及能力。 + + + **图1** OpenHarmony 3.2社区版本里程碑   +![release](figures/release.png) + +## 特性更新 +### ArkUI + + + **组件能力增强** + +- 支持XComponent控件,可用于EGL/OpenGL ES和媒体数据写入,并在XComponent组件显示;通过XComponent组件,配合NDK能力,构建C++/ArkTS混合开发能力,支持游戏、媒体应用开发 +- 支持AbilityComponent控件,支持嵌入其他应用作为控件(Component)显示。 +- 增加基础的ArkTS卡片开发能力:支持卡片交互、能动态更新内容;统一卡片和页面的开发范式,页面的布局可以直接复用到卡片布局中,提升卡片开发体验和开发效率。 +- 系统默认支持纯文本、纯图片复制、粘贴、拖拽,无需开发者处理复制、粘贴、拖拽事件。 +- 支持多级菜单和分组菜单。 +- 支持切换深色模式/浅色模式,仅系统应用支持。 + + **UI界面开发支持一次开发适配多屏幕规格** + +- 交互归一能力增强,交互归一事件对接TP、鼠标、键盘、触摸板、手写笔,ArkUI原生组件支持归一化的操作方式。 +- 响应式布局能力优化,增强了媒体查询能力,栅格系统重构且对接自由窗口。 +- 走焦能力增强,支持Tab键和方向键走焦,支持配置组件是否可获焦。 +- 支持增强分栏与侧边栏组件能力,支持拖拽自动隐藏等能力。 + +详细内容请参考[ArkUI指南](../application-dev/ui/arkui-overview.md/)。 + + +### 应用框架 + +- Stage模型,OpenHarmony API 9新增模型,提供了应用程序必备的组件和运行机制。开发者可以基于该模型进行复杂应用开发,使应用开发更简单、高效。 + - 以类形式提供组件开发,方便开发者基于类扩展。 + - 进程内共享虚拟机实例,减少应用内存占用。 + - 支持在进程内共享数据对象,方便开发者在多模块间共享状态。 + - Ability生命周期和窗口显示/焦点事件分离,统一了多设备形态下组件的生命周期,有利于多设备应用开发。 + - Ability与UI职责分离且具备RPC调用能力,原生支持组件级的跨设备迁移与协同,有利于分布式应用开发。 + +- 提供Extension机制,借助Extension,应用在与其他应用或系统进行交互时向他们提供自定义功能和内容,例如:应用可以作为卡片显示在系统桌面或者系统闲时执行后台任务等。当前支持的常用Extenson有:FormExtensionAbility、WorkSchedulerExtensionAbility、InputMethodExtensionAbility、AccessibilityExtensionAbility等。 + +- 原子化服务支持分包预加载,提升服务首次加载性能。 + +- 支持HSP(Harmony Shared Package)动态共享包,支持应用内代码和资源的共享。 + + +详细内容请参考[应用模型指南](../application-dev/application-models/application-model-composition.md)。 + + +### 应用包管理 + +- 支持选择默认应用,例如用户使用应用程序打开文件或url地址时选择了默认程序,后续将自动打开该应用程序操作文件。 + +- 支持对部分预置应用如Launcher、SystemUI、Settings等,系统事先授予权限(如定位、电话联系人等权限)、简化设备开箱后的授权过程,提升用户体验。详细请参考[user_grant权限预授权](../application-dev/security/accesstoken-guidelines.md)。 + +- 支持预置应用配置是否可常驻、是否可以多进程,是否允许使用Service类型的ExtensionAbility等能力,加强对预置应用的权限管控。详细请参考[应用特权配置指南](../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 + +- 支持动态修改和更新应用程序的代码,提供快速修复程序包便于应用快速响应需求和修复问题(此能力依赖设备厂商构建应用市场并提供分发能力)。详细请参考[快速修复介绍](../application-dev/quick-start/quickfix-principles.md)。 + +- 支持so基于hap包的隔离,方便开发者在不同的模块中部署so文件,避免了不同模块so重名的问题。 + + +### 系统应用 + + **Launcher应用增强** + +提供长按应用图标添加服务卡片的能力(当前支持相机、图库应用)。 + + + **SystemUI应用增强** + +- 支持控制中心打开和退出。 + +- 支持通知中心打开和退出;通知显示、删除、组展开与收起;横幅通知的显示与隐藏。 + + + **Settings应用增强** + +- 提供在隐私设置菜单设置权限的能力。 + +- 开发者选项增加布局边界调试、过渡动画调试、过渡绘制调试开关。 + + + **Photos应用增强** + +- 新增PhotoPicker能力。PhotoPicker是系统向用户提供图片和视频文件选择的统一入口,避免用户向应用授权文件权限,图片文件使用权限最小化控制提升应用安全。 + +- 支持相册服务卡片,提供相册浏览能力。 + +- 支持图片编辑能力,如自由裁剪图片、旋转图片等操作。 + 详细请参考[Application Photos](https://gitee.com/openharmony/applications_photos)。 + + + **FilePicker** + +新增FilePicker能力。FilePicker是系统向用户提供文件(媒体文件除外)选择的统一入口,避免用户向应用授权文件权限,确保文件使用权限最小化控制提升应用安全。 + + + **浏览器** + +当前版本未内置浏览器应用。可手动安装[浏览器应用示例](https://gitee.com/openharmony/applications_app_samples/tree/samples_3.2_Release/code/BasicFeature/Web/Browser)后进行网络内容浏览等场景的体验。 + + + +### 分布式技术 + +支持元服务和卡片跨设备流转,包括:跨设备查询、添加、刷新、删除等。 + + +#### 分布式软总线 + +- 提供基于蓝牙链路的文件传输能力,蓝牙数据传输通道相比OpenHarmony 3.1版本性能提升约10%。 + +- 通过为每个进程分别建立Message和Byte高低优先级队列,确保在Message和Byte并发的情况下,优先保障消息队列的数据发送,同时也能保障Byte得到有效传输,解决了在字节数据拥塞的情况下,消息数据不能及时传输的问题。 + +- 在支持RAW流的基础上,新增COMMON流传输能力,将未加密音视频流交由软总线进行加解密,调用者只需要把原始的音视频流数据传递给软总线,软总线保障数据的安全传输。 + +- 支持传输链路(WLAN/WiFi P2P/蓝牙BR)动态选择。根据双端设备支持的传输链路以及业务调用软总线传输接口(SendFile、SendSteam、SendMessage、SendBytes)进行链路选择。例如当需要传输流数据时,优先选择WLAN(5G频段)进行传输,如果WLAN不可用,则选择其它链路(例如WiFi P2P)进行传输。 + + + +#### 分布式硬件 + +- 分布式相机拍照支持设置拍摄地理位置信息和照片质量级别(影响照片的压缩比和画质清晰度)。 + +- 分布式相机支持录像功能。 + +- 设备管理支持将帐号认证信息导入到设备安全认证系统中,相同帐号的设备可以自动完成设备认证和组网。 + + +#### 分布式数据管理 + + **跨应用数据访问** + +- 通过代理方式实现同设备内跨应用数据访问,避免频繁拉起数据源应用。 + +- 支持同设备内关系型数据库、键值型数据库的跨应用数据访问。 + + **本地数据库** + +- 支持键值型数据库和关系型数据库。 + +- 支持对数据库文件的加密保存。 + +- 支持数据库的异常损坏检测以及异常重建。 + +- 支持应用通过客户端进行备份和恢复数据库。 + +- 支持自动备份键值型数据库。 + +- 支持同应用跨设备对关系型数据库远程查询。 + +- 支持元数据库异常损坏检测和自动重建。 + +- 键值型数据库从统一的系统沙箱切换到各应用沙箱,缩小应用数据的访问权限,提升了应用数据的安全性。 + + **数据同步** + +- 支持按条件(时间段、时间排序、同步时长)同步键值型数据,实现高能效、精准数据同步。 + +- 设备上线优先同步系统数据,缩短设备唤醒时间。 + +- 支持多用户场景下的跨设备数据同步。 + + **分布式对象:** 支持对象数据持久化。 + + **沙箱应用:** 支持键值型数据库、关系型数据库、分布式对象的持久化。 + + +#### 分布式调度 + +增强Ability流转能力,通过支持数据结构自动序列化降低应用程序适配复杂度;支持使用分布式对象传输流转的业务数据;在流转过程中可自动免安装原子化服务。 + + +### 文件管理 + +- 增强文件加密特性,支持用户级文件加密。 + +- 新增按应用空间统计接口,支持获取应用各级目录空间大小。 + +- 增强应用文件共享能力,提供跨应用文件打开能力。 + +- 支持应用文件备份恢复能力。 + +- 支持文件系统外置存储挂载卸载、格式化等能力,支持外置存储读写访问能力。 + +- 增强文件管理IO接口能力:新增list file接口提供目录遍历能力、新增RamdomAccess接口提供大文件快速随机访问能力。 + + +### 图形显示 & 窗口 + +- 提升多窗口场景的显示帧率。 + +- 增强属性动画,支持动画自定义属性。 + +- 增强Native层图形开发能力,SurfaceImage接口支持buffer管理、内容更新、变换矩阵等接口能力;Vsync支持请求下一帧、回调等接口能力;Hardwarebuffer接口支持申请、释放、获取、访问等接口能力 ,NativeWindow接口支持设置缩放模式。 + +- 构建EGL层,增强南向GPU适配能力。 + +- 提供窗口阴影、模糊、圆角等视觉效果的能力。 + +- 提供一镜到底、输入法切换、应用切换、转屏等转场动效能力。 + +- 支持窗口属性设置,窗口隐私图层避免截屏、录屏时泄露用户隐私。 + + +### 媒体 + + + **音频** + +- 提供选择蓝牙设备进行音频播放和通话的能力。 + +- 支持生成DTMF拨号音并进行播放。 + +- 支持OpenSL ES基础录音接口。 + +- 支持应用查询当前可用的音频设备列表,并携带具体设备信息,比如设备采样率、通道数、通道掩码。 + +- 支持查询系统中已建立的播放流和录音流信息。 + + + **播放** + +- 媒体播放支持fd格式输入的本地播放、支持HTTPS、HLS协议网络点播功能。媒体播放支持基于HDI的H264硬解播放能力。 + +- 提供音视频编解码能力,基于HDI codec接口的视频硬编码/硬解码能力。 + + + **相机** + +- 支持相机拍照配置:格式、分辨率、质量(影响照片的压缩比和画质清晰度)、地理位置等。支持录像和录像中抓拍。 + +- 支持相机精准隐私保护策略,仅允许前台使用(包含相机悬浮窗场景);支持系统服务后台使用相机,不允许第三方APP后台静默使用相机。提供系统接口,供相机全局开关开启、禁用调用。 + + + **图片** :增加支持raw、Webp图片格式。 + + + + +### 事件通知 + +- 支持应用设置显示在桌面上的角标数量。 + +- 支持系统应用移除粘性事件,某个粘性事件移除后,新的订阅者将不再收到对应的事件。 + +- 支持系统应用使能/去使能静态订阅,静态订阅事件去使能后,StaticSubscriberExtensionAbility不再被关联拉起。 + +- 补齐静态订阅Extension上下文的能力,StaticSubscriberExtensionAbility运行时可以通过上下文获取安装包的静态信息(如包路径、包名等)。 + +### Web + +- 支持配置Web组件,包括网络加载拦截配置、字体管理配置、滚动条配置、fetch自定义拦截配置。 + +- 支持网页操作,包括获取历史记录和前进后退列表、获取源URL、支持滚动、判断页面中是否有图片。 + +- 支持网页事件处理,支持页面加载各类事件上报、支持原始输入事件上报。 + +- 支持处理网页与应用的互通,消息互通支持ArrayBuffer类型。 + +- 增强Web性能,支持渲染进程的只读数据段共享节省内存、支持预读动态库加速网页加载。 + + +### 通信与连接 + +- 支持NFC卡读写能力。 + +- 支持蓝牙音频通话和蓝牙视频播放。 + +- 提供网络管理多网并发、网络协议栈http/https增强及TLSSocket ArkTS API能力。 + - 多网并发: + - 支持基于socket的路由绑定。 + - 支持基于网卡的路由绑定。 + - http/https: + - 支持http2.0。 + - 支持http缓存。 + - 支持http并发框架。 + - 支持gzip压缩、指定数据返回格式。 + - TLSSocket: + - 支持客户端指定证书、密钥、CA等安全传输选项,向服务器发起连接,建立TLSSocket连接。 + - 支持TLSv1.2和TLSv1.3。 + - WebSocket。 + - 以太网连接、网络热点。 + +- 蜂窝通信框架能力(如需提供完整蜂窝通信能力需芯片厂商适配支持HDI接口): + - 支持双卡管理,双卡通话、短信、搜网等基础能力接口和框架。 + - 支持VoLTE语音通话接口和框架。(需要芯片厂商实现IMS服务(含HDI)) + - 支持IMS短信收发接口和框架。(需要芯片厂商实现IMS服务(含HDI)) + - 支持蜂窝数据漫游,蜂窝数据自愈接口和框架。 + - 支持双卡数据切换接口和框架。 + + +### 设备管理 + +位置服务支持模糊位置、后台定位显性化等隐私增强特性。 + + + **DeviceProfile** + +开放基础系统服务的KV数据的保存、查询、端端同步的能力。 + + + **电源** + +- 支持从系统参数中读取系统的最大、最小和默认亮度值。 + +- 支持进入挂起状态和从挂起状态唤醒的系统接口。 + +- 支持电池的电量等级接口。 + +- 支持预估充电剩余时间、瞬时电流、剩余电量和总电量的系统接口。 + +- 支持相机、音频、通话和短距等软硬件特性的耗电统计。 + +- 支持设备发热时,对CPU频率、音量和系统亮度的管控动作。 + + +### 安全 + +- 提供系统级的证书管理能力,支撑OpenHarmony生态应用和系统应用,实现证书管理全生命周期(生成,存储,使用,销毁)的管理和安全使用。 + +- 提供加解密算法库框架,实现对openssl加解密库对应能力的封装,提供统一的加解密算法库相关的ArkTS接口。 + +- HUKS支持国密SM2/SM3/SM4的部分算法。 + +- 提供基于帐号管理的分布式设备互信认证能力。 + + +### 程序访问控制 + +- 实现应用和系统进程的权限管理框架,提供如下应用权限的操作接口: + - 提供权限的校验、权限的授予、权限的撤销功能。 + - 提供权限的授权变化监听功能。 + - 提供拉起权限弹窗的接口,应用可以通过该接口拉起弹窗,向用户申请授权。 + +- 提供权限弹窗应用以及Setting应用的隐私权限管理功能。 + +- 提供隐私报告功能,支持添加/查询权限访问记录、监听权限使用状态变化接口。 + +- 提供隐私保护增强特性,提升用户的隐私保护体验,包括: + - 相机使用提醒,在相机使用时,通知systemUI在右上角显示小圆点,提示用户。 + - 一键开关功能,提供用户一键开关,管控设备麦克风/相机敏感资源的使用。 + +- 提供SELinux功能的permissive模式。 + + +### ArkCompiler + + **语言特性增强:** 支持严格模式的Ecma2021规范。 + + **编译器运行时功能** + +- 提供es2abc编译器,优化字节码编译性能、缩短编译时间。 + +- 提供汇编解释器提升应用高级语言运行性能。 + +- 提供基于PGO配置文件的Host AOT优化编译器,提升应用高级语言高负载性能。 + +- 支持模块化能力,更好、更规范的支持复杂应用工程开发。 + +- 支持热补丁机制,提供应用热修复运行时技术底座。 + +- 调试增强,支持多实例调试、热重载调试,提升开发者开发效率。 + +- 支持基于CDP协议的CPU Profiler/Heap Profiler调优能力,提供应用性能调优和内存调优能力。 + + **语言基础库** + +- utils功能增强,支持uuid提供通用统一标识符功能,支持Buffer提供缓冲区读写比较查找功能。 + +- Concurrent并发库增加并发API TaskPool基础版,提供并发任务接口。任务池(Taskpool)作用是为应用程序提供一个多线程的运行环境,降低整体资源的消耗、提高系统的整体性能。 + + **C/C++工具链** + +- 工具链升级:LLVM升级到12.0.0,支持MIPS架构、RISC-V架构。 + +- 功能增强:支持stack pageguard保护,地址随机化,namespace隔离,CFI功能,Fortify功能,时区数据更新等,提升C/C++库安全。 + +- 性能优化:实现高频函数性能优化提升c库基础性能,实现linker优化提升库加载性能。 + +- 支持locale提供时区设置刷新功能。 + + +### 内核 + +- 支持ASLR内核地址随机化、KASAN地址检测能力、CFI等,减少系统攻击面,提升内核安全性。 + +- 提升musl内存分配器安全,提高堆内存安全性,有效避免堆溢出、double-free、UAF等危险。 + +- 支持内存管理精细化管控,OnMemoryLevel特性针对不同内存压力进行通知,应用根据不同压力场景进行相应回调处理;同时对系统资源进行系统化、集中化管理,对应用资源占用及时监控与管理。 + +- 本地存储增强,F2FS特性优化末端性能,通过存储空闲时自动碎片回收、分级SSR等手段降低系统碎片,恢复系统性能。 + +### 驱动 + + **HDF驱动框架能力** + + - 支持内核态驱动动态加载、外接设备即插即用事件上报、驱动安全策略配置,为开发者提供更稳定、安全的驱动平台底座。 + + - HDI接口支持IPC调用和直通调用两种通路模式,开发者可根据实际业务灵活使用,提升业务性能。 + + - 支持HDI服务化代码自动生成能力、模板化驱动代码生成能力、HCS宏式解析及配置可视化编辑等能力,降低驱动开发门槛,提高开发效率。 + + - Platform平台驱动支持用户态中断、新增CAN总线HDF驱动框架、MMC驱动实现优化等。 + + **外设驱动模型能力** + + - Camera驱动模型支持自拍镜像、镜头控制、JPEG位置信息添加、Sensor捕获角查询、人脸识别Meta流支持,简化相机驱动开发难度。 + + - Audio的ADM模型增加耳机接入、听筒和喇叭切换控制、通话音量设置、通话静音等关键控制能力,支撑音频硬件生态拓展。 + + - Display驱动模型支持多屏管理、软件Vsync机制、兼容FrameBuffer架构,支持不同显示架构高效接入。 + + - 支持标准系统的Codec硬件编解码驱动模型、提供Codec HDI 2.0接口及参考实现,支持更完备的硬件编解码能力。 + + - 支持马达驱动模型,包括马达振动启停、基础马达效果控制,为用户提供丰富的振感体验。 + + - 支持手势驱动模型,包括状态事件、设备状态事件上报;支持手势启停、功能状态配置。 + + - USB驱动模型支持设备模式和主机模式,新增支持设备模式下RNDIS网络驱动等DDK能力。 + + - 支持WLAN驱动能力抗干扰能力,提供最优P2P信道选择能力,持续提升WLAN信号质量。 + +### 工具提升 + + **DevEco Studio代码开发** + +- 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。 + +- 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片,帮助开发者快速开发应用和服务。 + +- 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。 + +- 支持按照ArkUI新语法和新规范,检查代码提示错误;新增Code Linter代码检查功能,支持配置检查规则,修复检查结果。 + +- 支持C++代码Quick Fix基础能力,具体请参考代码Quick Fix快速修复。 + +- 提供全新的OHPM CLI(OpenHarmony Package Manager Command-line Interface) 生态三方库包管理工具,支持OpenHarmony共享包发布、安装和依赖管理。支持API 9的历史工程迁移为OHPM工程,详细参考历史工程手动迁移。 + +- 支持构建闭源HAR,并支持配置HAR的混淆能力。 + +- 支持AOT编译模式,提供高负载TS性能选择和构建能力,提升应用运行性能,具体请参考开启AOT编译模式。 + +- API 9的Stage工程默认开启模块化编译,可有效缩短增量编译时间、减小编译后的包体积。 + +- 支持并发编译提升编译速度。 + + **DevEco Studio应用调试调优** + +- 支持ArkTS/JS与C/C++跨语言调试特性,在C/C++工程中,采用ArkTS/JS与C/C++进行混合开发,能够在ArkTS或JS调用C/C++方法处,直接进入C/C++代码中进行调试,方便开发者快速发现并解决跨语言调用相关代码问题。具体请参考ArkTS/JS与C/C++工程跨语言调试。 + +- 支持Hot Reload热重载,支持保存代码后在真机上使用最新的代码而无需重启应用。 + +- 支持OpenHarmony多包推送和多实例调试功能。 + +- 支持OpenHarmony API 9 C/C++工程的内存错误检测。 + +- OpenHarmony日志功能支持打印FaultLog,便于应用开发者快速查询、定位、导出应用故障信息。 + +- 测试框架能力增强,针对JS/ArkTS API Version 8和9的工程,测试框架的执行效率显著提升;同时优化了测试框架模板,提升模板代码的可读性。 + +详细内容请参考[DevEco Studio版本说明](https://developer.harmonyos.com/cn/docs/documentation/doc-releases/release_notes-0000001057597449)及[使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_versions_overview-0000001356521213)。 + + + **调试工具** + +- hdc文件传输支持目录接收发送、权限同步、同网段CS文件发送,提升调试调优、自动化测试效率。 + + +### 测试能力 + +- 新增测试用例筛选执行能力,支持在用例中配置指定字段如用例类型、级别等参数,通过命令执行筛选后的用例,帮助开发者提升测试执行效率,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E5%9F%BA%E7%A1%80%E6%B5%81%E7%A8%8B)。 + +- 新增测试用例驱动执行能力,可将相似测试逻辑的不同输入输出数据配置到辅助文件中使用,帮助开发者减少测试代码量,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E6%95%B0%E6%8D%AE%E9%A9%B1%E5%8A%A8)。 + +- 新增多窗口、双指捏合、抛滑等UI场景模拟操作能力,提升UI自动化支持范围,详细请参考[API说明](../application-dev/reference/apis/js-apis-uitest.md)。 + +- 新增OpenHarmony应用质量要求兼容性测试规范,涵盖UX、性能、功耗、稳定性、兼容性和安全六大方面,规范OpenHarmony应用基础质量要求,详细请参考[官网说明](https://www.openharmony.cn/certification/moreStandard)。 + +- [SmartPerf-Host](https://gitee.com/openharmony-sig/smartperf/tree/master)性能功耗调试调优工具,为开发者提供一套性能调优平台,支持GUI(图形用户界面)操作进行详细数据分析。3.2版本新增: + - 支持功耗分析能力,展示应用各子类别功耗占比信息、资源申请使用记录、功耗异常事件、功耗与系统状态关联信息,详细请参考HiSystemEvent[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_hisystemevent.md)。 + - 支持Web端抓取trace,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_web_record.md)。 + - 支持SQL查询和Metrics说明,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_sql_metrics.md)。 + - 支持内核内存事件分析,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_page_fault.md)。 + +- [wukong](https://gitee.com/openharmony/ostest_wukong)软件稳定性工具能力增强: + - 支持注入滑动、鼠标、字符、系统按键、控件事件,模拟用户多样化随机操作,覆盖真实用户操作场景,挖掘更多稳定性问题。 + - 支持设置运行总时长、应用黑白名单,实现个性化测试。 + - 支持控件顺序遍历测试,测试过程中支持界面截图;支持休眠唤醒测试。 + +## 配套关系 + + **表1** 版本软件和工具配套关系 + +| 软件 | 版本 | 备注 | +| -------- | -------- | -------- | +| OpenHarmony | 3.2 Release | NA | +| Public SDK | Ohos_sdk_public 3.2.11.9 (API Version 9 Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。通过DevEco Studio默认获取的SDK为Public SDK。 | +| HUAWEI DevEco Studio(可选) | 3.1 Beta2 | OpenHarmony应用开发推荐使用。获取方式:
[Windows(64-bit)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/f3/v3/uJyuq3syQ2ak4hE1QZmAug/devecostudio-windows-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013335Z&HW-CC-Expire=315360000&HW-CC-Sign=96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70)
[Mac(X86)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b7/v3/4z3mLQPCQR-g5KlC56SC1w/devecostudio-mac-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013430Z&HW-CC-Expire=315360000&HW-CC-Sign=93E83FD1F1CE504EF8F098E08955A938FDA4E4926A2555CF1E02DC8D57210D76)
[Mac(ARM)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/2e/v3/Fl9IY6PiQxqc3tnI2cftiw/devecostudio-mac-arm-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013540Z&HW-CC-Expire=315360000&HW-CC-Sign=0906243123734033AAD34A7A005ED7671F00CAA693B6E674F81A094A0159ECCE) | +| HUAWEI DevEco Device Tool(可选) | 3.1 Release | OpenHarmony智能设备集成开发环境推荐使用。
[点击此处获取](https://device.harmonyos.com/cn/develop/ide/) | + +## 源码获取 + + +### 前提条件 + +1. 注册码云gitee帐号。 + +2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)。 + +3. 安装[git客户端](https://gitee.com/link?target=https%3A%2F%2Fgit-scm.com%2Fbook%2Fzh%2Fv2%2F%25E8%25B5%25B7%25E6%25AD%25A5-%25E5%25AE%2589%25E8%25A3%2585-Git)和[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。 + + ``` + git config --global user.name "yourname" + git config --global user.email "your-email-address" + git config --global credential.helper store + ``` + +4. 安装码云repo工具,可以执行如下命令。 + + ``` + curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中chmod a+x /usr/local/bin/repo + pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests + ``` + + +### 通过repo获取 + +**方式一(推荐)** + +通过repo + ssh 下载(需注册公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191))。 + +- 从版本分支获取源码。可获取该版本分支的最新源码,包括版本发布后在该分支的合入。 + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。 + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +**方式二** + +通过repo + https 下载。 + +- 从版本分支获取源码。可获取该版本分支的最新源码,包括版本发布后在该分支的合入。 + ``` + repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。 + ``` + repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + + +### 从镜像站点获取 + + **表2** 获取源码路径 + +| 版本源码 | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** | +| --------------------------------------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | +| 全量代码(标准、轻量和小型系统) | 3.2 Release | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256) | | +| Hi3861解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256) | | +| Hi3516解决方案-LiteOS(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | | +| Hi3516解决方案-Linux(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | | +| RK3568标准系统解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/dayu200_standard_arm32.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/dayu200_standard_arm32.tar.gz.sha256) | | +| 标准系统Public SDK包(Mac) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/ohos-sdk-mac-public.tar.gz.sha256) | | +| 标准系统Public SDK包(Mac-M1) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz.sha256) | | +| 标准系统Public SDK包(Windows\Linux) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz.sha256) | | + +## 更新说明 + +本版本在OpenHarmony 3.2 Beta5的基础上有如下变更: + +### API + +API变更请参考[*API差异报告*](api-diff/Beta5%20to%20v3.2-Release)。 + +### 芯片及开发板适配 + +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 + +### Samples + + **表3** 新增Samples + +| 子系统 | 名称 | 简介 | 开发语言 | +| -------- | -------- | -------- | -------- | +| 无障碍 | [AccessibilityExtensionAbility示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) | 本示例展示了AccessibilityExtensionAbility的简单应用,使用多个辅助功能接口实现了一些快捷的交互方式。 | ArkTS | +| 企业管理 | [企业设备管理ExtensionAbility](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) | 企业设备管理扩展能力,是MDM应用必备组件。当开发者为企业开发MDM(Mobile Device Management)应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 | ArkTS | +| 任务管理 | [任务延时调度](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例使用\@ohos.WorkSchedulerExtensionAbility 、\@ohos.net.http 、\@ohos.notification 、\@ohos.bundle 、\@ohos.fileio 等接口,实现了设置后台任务、下载更新包 、保存更新包、发送通知 、安装更新包实现升级的功能。 | ArkTS | +| 网络 | [上传](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Connectivity/Upload) | 本示例主要展示Request服务向三方应用提供系统上传服务能力,通过\@ohos.request,\@ohos.multimedia.mediaLibrary等接口去实现图片的选取与上传。 | ArkTS | +| 任务管理 | [短时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/TransientTask) | 本示例主要展示后台任务中的短时任务。通过\@ohos.resourceschedule.backgroundTaskManager,\@ohos.app.ability.quickFixManager等接口实现应用热更新的方式去展现短时任务机制。 | ArkTS | +| 任务管理 | [长时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ContinuousTask) | 本示例展示后台任务的长时任务。通过使用\@ohos.resourceschedule.backgroundTaskManager实现后台播放音乐时避免进入挂起(Suspend)状态。 | ArkTS | +| 元能力 | [ArkTS卡片计算器](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSFormCalc) | 本示例展示了使用ArkTS卡片开发的计算器模型。 | ArkTS | +| 元能力 | [ArkTS卡片Canvas小游戏](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/CanvasGame) | 本示例展示了如何通过ArkTS卡片的Canvas自定义绘制能力实现一个简单的五子棋游戏卡片。
- 使用Canvas绘制棋盘和黑白棋子的落子。
- 通过卡片支持的点击事件进行交互,让用户在棋盘上进行黑白棋子的对局。
- 通过TS的逻辑代码实现五子棋输赢判定、回退等逻辑计算,整个游戏过程无需拉起FormExtensionAbility。 | ArkTS | +| 元能力 | [ArkTs音乐卡片](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/ArkTSCardMusicSample) | 本示例展示了如何通过ArkTs卡片实现一个简单的音乐卡片。 | ArkTS | + +请访问[Samples](https://gitee.com/openharmony/app_samples)仓了解更多信息。 + + +## 修复缺陷列表 + + **表4** 修复缺陷ISSUE列表 + +| ISSUE单 | 问题描述 | +| -------- | -------- | +| I6ATXO | 【RK3568】XTS执行测试,OpenGL测试套执行结果存在失败项 | +| I6BJ9Z
I6BJ82 | alloc_file_pseudo 内存泄漏问题跟踪 | +| I6BRTS | 调用rdb::executeSql接口会引起内存泄漏风险 | +| I6AZ4T | 带textinput输入框组件的应用存在内存泄漏风险 | + + +## 遗留缺陷列表 + + **表5** 遗留缺陷列表 + +| ISSUE | 问题描述 | 影响 | 计划解决日期 | +| -------- | -------- | -------- | -------- | +| I6AB3T | 首次启动联系人应用的用时超出预期基线。 | 设备启动后,联系人进程为非常驻进程,启动联系人应用时需要拉启联系人数据库进程导致有时延偏长。 | 遗留挂起 | +| I6SMQA | 浏览器加载微博,滑动过程中出现抖动。 | 通过浏览器加载微博web网页后,快速滑动时,内容会闪现未加载,然后很快能加载出来,影响滑动体验。 | 2023年5月15日 | +| I6TRE6 | 进程com.ohos.contacts下的com.ohos.contacts线程导致libdatashare_consumer.z.so低概率出现crash。 | 联系人应用快速启动和退出场景,发现在启动后600ms内退出,联系人进程低概率出现crash,出现crash后联系人进程会被重新拉起,影响可控。 | 2023年4月30日 | +| I6SXBI | wukong的ohos.samples.distributedcalc进程下的libdistributeddata.z.so低概率出现cppcrash。 | 计算器应用快速启动和退出场景,启动后1秒内退出,计算器应用低概率出现cppcrash,出现crash后计算器进程会被重新拉起,影响可控。 | 2023年4月30日 | +| I6U00Q | RK3568使用3.5mm耳机播放音频文件,存在pop音。 | 影响设备使用体验,影响可控。 | 2023年5月30日 | +| I6TNY9 | 通话记录处于充满记录的状态时,向上滑动时拨号键盘无法隐藏。 | 影响拨号键盘的隐藏体验。 | 2023年4月30日 | +| I6TOTV | tabs组件中tabs_animation在反复切换过程中,两种颜色同时显示在界面。 | tabs_animation在反复切换场景下,影响tabs组件的颜色显示。 | 2023年4月30日 | +| I6TOV2
I6TOYV
I6TOQO
I6TOK5 | WiFi或BLE组网引导P2P循环发送100次linktype为stream的通路,会概率性失败。 | WiFi组网引导P2P压测100次,成功率大于80%。而在低概率P2P组网失败后,重新触发组网时高概率能成功,影响可控。 | 2023年5月30日 | +| I6TMP3 | 长按应用进入图片预览,向后滑动150张卡片左右,点击添加卡片,桌面不显示卡片。 | 图片较多的场景下,进入图形预览,添加卡片,桌面概率不显示卡片,影响使用体验,影响可控。 | 2023年4月30日 | +| I6B4U3 | 压力测试出现进程com.ohos.launcher出现appfreeze。 | 安装应用较多(测试场景安装超过40个应用),且内存较小的设备场景下,低概率出现appfreeze,但桌面功能正常,不影响整体功能和使用。 | 2023年5月30日 | +| I64726
I641A2 | 蓝牙功能接口bluetooth.pairDevice在与其他设备配对时无配对提示,与其他设备静默配对后通过蓝牙键盘、鼠标完全可控制设备。 | 无配对弹窗提示,但能配对成功,不影响软总线的配对组网功能,已在新版本规划需求完成对此功能的支持。 | 2023年6月30日日 | +| I6U1H9 | GridCol的属性 gridColOffset 在预览器未包含。 | 影响预览inspector的属性显示,不影响预览器整体效果。 | 2023年4月30日 | + + \ No newline at end of file diff --git a/zh-cn/release-notes/Readme.md b/zh-cn/release-notes/Readme.md index 01ccb35c2358f600ea31658dc200c256b22bb6b2..1bfd660ebdc2263495d3f6d2d57aff7aa057a16f 100644 --- a/zh-cn/release-notes/Readme.md +++ b/zh-cn/release-notes/Readme.md @@ -1,6 +1,7 @@ # OpenHarmony Release Notes ## OpenHarmony 3.x Releases +- [OpenHarmony v3.2 Release (2023-04-09)](OpenHarmony-v3.2-release.md) - [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md) - [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md) - [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md index 39968eb10919ed8bf08043a50f47d79bc248e9e6..b5289610acebcfd24695f527efc2ae51f2198da1 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md @@ -213,8 +213,8 @@ Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用R try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } @@ -257,10 +257,35 @@ Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用R try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } ``` + + +## cl.ability.7 WantConstant.Flags接口变更 + +wantConstant接口有两个类似的枚举,合并成一个。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------- | ---------------------- | ----------------------------------- | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Parameter | ABILITY_BACK_TO_OTHER_MISSION_STACK | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Params | ABILITY_BACK_TO_OTHER_MISSION_STACK | 新增 | + +**适配指导** + +使用@ohos.app.ability.wantConstant.d.ts中的ABILITY_BACK_TO_OTHER_MISSION_STACK + +```ts +import wantConstant from '@ohos.app.ability.wantConstant'; +let backToOtherMissionStack: wantConstant.Params = wantParam.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK; +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md index 468cdd16e5e625acc563890bea2ddf380245ba4e..cc403f2572f2c267f01450cf85126e183e1bce96 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -71,7 +71,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function triggerCallback(err, data) { if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } else { console.info('getUid ok!' + JSON.stringify(data)); } @@ -79,12 +79,12 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } } try{ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err){ - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getWantAgent failed!' + err.code + err.message); } ``` diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md index e6f0ac779385ce65a679d6f5840d80004f124bab..639d94dadba885f48137602e7925977eb10a171c 100755 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md @@ -1,4 +1,4 @@ -USB管理 changeLog +# USB服务子系统ChangeLog ## cl.usb_manager.1 系统接口变更 @@ -13,6 +13,16 @@ USB系统API运行时鉴权,异步接口以Promise reject形式抛出错误码 | ohos.usbV9.d.ts | function setCurrentFunctions(funcs: FunctionType): Promise; | function setCurrentFunctions(funcs: FunctionType): Promise; | | ohos.usbV9.d.ts | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; | +## cl.usb_manager.2 sdk接口删除 + +继OpenHarmony 4.0.5.5版本3.30之后,@ohos.usbV9.d.ts文件已删除。 + +后续需要import @ohos.usbManager才能使用USB服务的接口: + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + **适配指导** 请参考各接口的[API参考](../../../application-dev/reference/errorcodes/errorcode-universal.md) \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..9eda299dc1cfb943f70ee828580107c78b52aa2b --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md @@ -0,0 +1,23 @@ +# USB服务子系统ChangeLog + +## cl.usb_manager.1 sdk接口删除 + +基于此前版本开发的应用,需修改导入的包名,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +@ohos.usbV9.d.ts文件已删除,由@ohos.usbManager.d.ts替代。 + +| 新包名 | 旧包名 | 已删除包名 | +| -------------------- | ------------- | --------------- | +| ohos.usbManager.d.ts | ohos.usb.d.ts | ohos.usbV9.d.ts | + +后续需要import @ohos.usbManager才能使用USB服务的接口: + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + +**适配指导** + +请参考各接口的[API参考](../../../application-dev/reference/errorcodes/errorcode-universal.md) \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..310b4e1338e302bb4fe1aff913b74e1ece3e12a5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md @@ -0,0 +1,22 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 应用帐号取消帐号名中空格字符限制 + +变更前,应用帐号接口传入包含空格字符的帐号名时,返回无效参数错误;变更后,不报错。 + +**变更影响** + +基于此前版本开发的应用不受变更影响; +基于此后版本开发的应用,调用API 9以及之后版本的应用帐号相关接口,帐号名不再做空格字符限制。 + +**关键接口/组件变更** + +涉及的接口: +- AppAccountManager + - createAccount(name: string, callback: AsyncCallback<void>): void; + - auth(name: string, owner: string, authType: string, callback: AuthCallback): void; + - setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback<void>): void; + - setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void; + - setCustomData(name: string, key: string, value: string, callback: AsyncCallback<void>): void; + - setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void; + - setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback<void>): void; diff --git a/zh-cn/release-notes/figures/release.png b/zh-cn/release-notes/figures/release.png new file mode 100644 index 0000000000000000000000000000000000000000..f4bb63ef5b79798fe7c6c0cfc6ccd1ed35504aa4 Binary files /dev/null and b/zh-cn/release-notes/figures/release.png differ