diff --git a/en/application-dev/IDL/idl-guidelines.md b/en/application-dev/IDL/idl-guidelines.md index b770a7bb881b780ff7b231f04fe02bc18aa3026e..018d639341ef02753bca7cc03b2c471160da4ec8 100644 --- a/en/application-dev/IDL/idl-guidelines.md +++ b/en/application-dev/IDL/idl-guidelines.md @@ -3,7 +3,7 @@ ## IDL Overview To ensure successful communications between the client and server, interfaces recognized by both parties must be defined. The OpenHarmony Interface Definition Language (IDL) is a tool for defining such interfaces. OpenHarmony IDL decomposes objects to be transferred into primitives that can be understood by the operating system and encapsulates cross-boundary objects based on developers' requirements. - **Figure 1** IDL interface description +**Figure 1** IDL interface description ![IDL-interface-description](./figures/IDL-interface-description.png) @@ -156,9 +156,11 @@ On DevEco Studio, choose **Tools > SDK Manager** to view the local installation Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder named after the version number), and check whether the executable file of IDL exists. -> **NOTE**: Use the SDK of the latest version. The use of an earlier version may cause errors in some statements. +> **NOTE** +> +> Use the SDK of the latest version. The use of an earlier version may cause errors in some statements. -If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses the [3.2 Beta5]((../../release-notes/OpenHarmony-v3.2-beta5.md#acquiring-source-code-from-mirrors) as an example. +If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses [3.2 Beta5](../../release-notes/OpenHarmony-v3.2-beta5.md#acquiring-source-code-from-mirrors) as an example. For details about how to replace the SDK package, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md). @@ -176,6 +178,8 @@ You can use TS to create IDL files. interface OHOS.IIdlTestService { int TestIntTransaction([in] int data); void TestStringTransaction([in] String data); + void TestMapTransaction([in] Map data); + int TestArrayTransaction([in] String[] data); } ``` @@ -183,7 +187,9 @@ Run the **idl -gen-ts -d *dir* -c dir/IIdlTestService.idl** command in the folde -*dir* next to **d** is the target output folder. For example, if the target output folder is **IIdlTestServiceTs**, run the **idl -gen-ts -d IIdlTestServiceTs -c IIdlTestServiceTs/IIdlTestService.idl** command in the folder where the executable file is located. The interface file, stub file, and proxy file are generated in the *dir* directory (**IIdlTestServiceTs** directory in this example) in the execution environment. -> **NOTE**: The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation. +> **NOTE** +> +> The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation. For example, for an .idl file named **IIdlTestService.idl** and target output directory named **IIdlTestServiceTs**, the directory structure is similar to the following: @@ -203,6 +209,8 @@ The stub class generated by IDL is an abstract implementation of the interface c ```ts import {testIntTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service"; +import {testMapTransactionCallback} from "./i_idl_test_service"; +import {testArrayTransactionCallback} from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service"; import rpc from "@ohos.rpc"; @@ -211,8 +219,8 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl super(des); } - async onRemoteRequestEx(code: number, data, reply, option): Promise { - console.log("onRemoteRequestEx called, code = " + code); + async onRemoteMessageRequest(code: number, data, reply, option): Promise { + console.log("onRemoteMessageRequest called, code = " + code); switch(code) { case IdlTestServiceStub.COMMAND_TEST_INT_TRANSACTION: { let _data = data.readInt(); @@ -231,6 +239,29 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl }); return true; } + case IdlTestServiceStub.COMMAND_TEST_MAP_TRANSACTION: { + let _data = new Map(); + let _dataSize = data.readInt(); + for (let i = 0; i < _dataSize; ++i) { + let key = data.readInt(); + let value = data.readInt(); + _data.set(key, value); + } + this.testMapTransaction(_data, (errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case IdlTestServiceStub.COMMAND_TEST_ARRAY_TRANSACTION: { + let _data = data.readStringArray(); + this.testArrayTransaction(_data, (errCode, returnValue) => { + reply.writeInt(errCode); + if (errCode == 0) { + reply.writeInt(returnValue); + } + }); + return true; + } default: { console.log("invalid request code" + code); break; @@ -241,17 +272,23 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl testIntTransaction(data: number, callback: testIntTransactionCallback): void{} testStringTransaction(data: string, callback: testStringTransactionCallback): void{} + testMapTransaction(data: Map, callback: testMapTransactionCallback): void{} + testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void{} static readonly COMMAND_TEST_INT_TRANSACTION = 1; static readonly COMMAND_TEST_STRING_TRANSACTION = 2; + static readonly COMMAND_TEST_MAP_TRANSACTION = 3; + static readonly COMMAND_TEST_ARRAY_TRANSACTION = 4; } ``` -You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction** and **testStringTransaction** methods. +You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction**, **testStringTransaction**, **testMapTransaction**, and **testArrayTransaction** methods. ```ts import {testIntTransactionCallback} from "./i_idl_test_service" import {testStringTransactionCallback} from "./i_idl_test_service" +import {testMapTransactionCallback} from "./i_idl_test_service"; +import {testArrayTransactionCallback} from "./i_idl_test_service"; import IdlTestServiceStub from "./idl_test_service_stub" @@ -265,6 +302,14 @@ class IdlTestImp extends IdlTestServiceStub { { callback(0); } + testMapTransaction(data: Map, callback: testMapTransactionCallback): void + { + callback(0); + } + testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void + { + callback(0, 1); + } } ``` @@ -320,11 +365,28 @@ function callbackTestStringTransaction(result: number): void { } } +function callbackTestMapTransaction(result: number): void { + if (result == 0) { + console.log('case 3 success'); + } +} + +function callbackTestArrayTransaction(result: number, ret: number): void { + if (result == 0 && ret == 124) { + console.log('case 4 success'); + } +} + var onAbilityConnectDone = { onConnect:function (elementName, proxy) { let testProxy = new IdlTestServiceProxy(proxy); + let testMap = new Map(); + testMap.set(1, 1); + testMap.set(1, 2); testProxy.testIntTransaction(123, callbackTestIntTransaction); testProxy.testStringTransaction('hello', callbackTestStringTransaction); + testProxy.testMapTransaction(testMap, callbackTestMapTransaction); + testProxy.testArrayTransaction(['1','2'], callbackTestMapTransaction); }, onDisconnect:function (elementName) { console.log('onDisconnectService onDisconnect'); diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md index d2bca637ca2d62cc7a6ea5ca64a9f55cdf5793f0..2d70222630a25f38b0f66367e46fcfdef2487091 100644 --- a/en/application-dev/application-models/Readme-EN.md +++ b/en/application-dev/application-models/Readme-EN.md @@ -18,7 +18,6 @@ - [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) - [InputMethodExtensionAbility](inputmethodextentionability.md) diff --git a/en/application-dev/application-models/ability-startup-with-explicit-want.md b/en/application-dev/application-models/ability-startup-with-explicit-want.md index cb4642d108382c48a2e2b2285adfafc1df99d62b..80b96ce801bed7d8ae79aa2b3ddc566f10fc2bcf 100644 --- a/en/application-dev/application-models/ability-startup-with-explicit-want.md +++ b/en/application-dev/application-models/ability-startup-with-explicit-want.md @@ -1,73 +1,5 @@ # Using Explicit Want to Start an Ability +When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. If the **abilityName** and **bundleName** parameters are specified when starting a UIAbility, then the explicit Want is used. Using Explicit Want -When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. The following describes how to use explicit Want to start a UIAbility component in an application. - - -## How to Develop - -1. In a project of the stage model, create an ability and a page, named **callerAbility** and **Index.ets**, respectively. Use the **windowStage.loadContent()** method in the **onWindowStageCreate** function in the **callerAbility.ts** file to bind the two. - - ```ts - // ... - // callerAbility.ts - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.info('[Demo] EntryAbility onWindowStageCreate') - // Bind callerAbility with a paged named Index - windowStage.loadContent('pages/Index') - } - // ... - ``` - -2. Repeat the preceding operation to create another ability named **calleeAbility**. - -3. Add a button to the **Index.ets** page of **callerAbility**. - - ```ts - // ... - build() { - Row() { - Column() { - Text('hello') - .fontSize(50) - .fontWeight(FontWeight.Bold) - // A new button with will call explicitStartAbility() when clicked. - Button("CLICKME") - .onClick(this.explicitStartAbility) // For details about explicitStartAbility, see the sample code below. - // ... - } - .width('100%') - } - .height('100%') - } - // ... - ``` - -4. Override the **onClick** method and use explicit Want to start **calleeAbility** in the method. The **bundleName** field can be obtained from the **AppScope > app.json5** file of the project. The **abilityName** field can be obtained from the **yourModuleName > src > main > module.json5** file of the corresponding module. - - ```ts - import common from '@ohos.app.ability.common'; - - // ... - async explicitStartAbility() { - try { - // Explicit want with abilityName specified. - let want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "calleeAbility" - }; - let context = getContext(this) as common.UIAbilityContext; - await context.startAbility(want); - console.info(`explicit start ability succeed`); - } catch (error) { - console.info(`explicit start ability failed with ${error.code}`); - } - } - // ... - ``` - -5. When you touch **CLICKME**, the corresponding page is displayed. - - startAbilityWtExplicitWant +The user touches a button in the application to start the UIAbility component to complete a specific task. To start the UIAbility component in explicit Want mode, the **abilityName** and **bundleName** parameters must be specified. For details, see [Starting UIAbility in the Same Application](uiability-intra-device-interaction.md#starting-uiability-in-the-same-application). diff --git a/en/application-dev/application-models/ability-startup-with-implicit-want.md b/en/application-dev/application-models/ability-startup-with-implicit-want.md index 6550e5c628c642cf227cfde5f74eef7b61c8a52b..e3c94b2963e73aaa896eb5691a2af1932aba7d3c 100644 --- a/en/application-dev/application-models/ability-startup-with-implicit-want.md +++ b/en/application-dev/application-models/ability-startup-with-implicit-want.md @@ -1,77 +1,78 @@ # Using Implicit Want to Open a Website - -## Prerequisites - -One or more browsers are installed on your device. - -The **module.json5** of a browser application is as follows: +This section uses the operation of using a browser to open a website as an example. It is assumed that one or more browser applications are installed on the device. To ensure that the browser application can work properly, configure the [module.json5 file](../quick-start/module-configuration-file.md) as follows: ```json -"skills": [ - { - "entities": [ - "entity.system.browsable" - // ... - ], - "actions": [ - "ohos.want.action.viewData" - // ... - ], - "uris": [ - { - "scheme": "https", - "host": "www.test.com", - "port": "8080", - // Prefix matching is used. - "pathStartWith": "query", - "type": "text/*" - }, +{ + "module": { + // ... + "abilities": [ { - "scheme": "http", // ... + "skills": [ + { + "entities": [ + "entity.system.home", + "entity.system.browsable" + // ... + ], + "actions": [ + "action.system.home", + "ohos.want.action.viewData" + // ... + ], + "uris": [ + { + "scheme": "https", + "host": "www.test.com", + "port": "8080", + // Prefix matching is used. + "pathStartWith": "query" + }, + { + "scheme": "http", + // ... + } + // ... + ] + } + ] } - // ... ] - }, -] + } +} ``` +In the initiator UIAbility, use implicit Want to start the browser application. -## How to Develop +```ts +import common from '@ohos.app.ability.common'; -1. Use the custom function **implicitStartAbility** to start an ability. - - ```ts - async implicitStartAbility() { - try { - let want = { - // Uncomment the line below if you want to implicitly query data only in the specific bundle. - // bundleName: "com.example.myapplication", - "action": "ohos.want.action.viewData", - // entities can be omitted. - "entities": [ "entity.system.browsable" ], - "uri": "https://www.test.com:8080/query/student", - "type": "text/plain" - } - let context = getContext(this) as common.UIAbilityContext; - await context.startAbility(want) - console.info(`explicit start ability succeed`) - } catch (error) { - console.info(`explicit start ability failed with ${error.code}`) - } - } - ``` - - The matching process is as follows: - 1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills**, the matching is successful. - - 2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills**, the matching is successful. +function implicitStartAbility() { + let context = getContext(this) as common.UIAbilityContext; + let wantInfo = { + // Uncomment the line below if you want to implicitly query data only in the specific bundle. + // bundleName: 'com.example.myapplication', + 'action': 'ohos.want.action.viewData', + // entities can be omitted. + 'entities': ['entity.system.browsable'], + 'uri': 'https://www.test.com:8080/query/student' + } + context.startAbility(wantInfo).then(() => { + // ... + }).catch((err) => { + // ... + }) +} +``` - 3. If **uri** in the passed **want** parameter is included in **uris** under **skills**, which is concatenated into `https://www.test.com:8080/query*` (where \* is a wildcard), the matching is successful. +The matching process is as follows: - 4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills**, the matching is successful. +1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the ability to match, the matching is successful. +2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the ability to match, the matching is successful. +3. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the ability to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful. +4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills** of the ability to match, the matching is successful. -2. When there are multiple matching applications, a dialog box is displayed for you to select one of them. +If there are multiple matching applications, the system displays a dialog box for you to select one of them. The following figure shows an example. - ![stage-want1](figures/stage-want1.png) +![stage-want1](figures/stage-want1.png) diff --git a/en/application-dev/application-models/application-context-stage.md b/en/application-dev/application-models/application-context-stage.md index 23bd8d29ec742f7591d8f7982245cc17ddc770ec..aa40d3aedf9dbb3db775a634dbd81f60f22fed51 100644 --- a/en/application-dev/application-models/application-context-stage.md +++ b/en/application-dev/application-models/application-context-stage.md @@ -6,56 +6,60 @@ [Context](../reference/apis/js-apis-inner-application-context.md) is the context of an object in an application. It provides basic information about the application, for example, **resourceManager**, **applicationInfo**, **dir** (application development path), and **area** (encrypted area). It also provides basic methods such as **createBundleContext()** and **getApplicationContext()**. The UIAbility component and ExtensionAbility derived class components have their own **Context** classes, for example, the base class **Context**, **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, **ExtensionContext**, and **ServiceExtensionContext**. - The figure below illustrates the inheritance relationship of contexts. - + ![context-inheritance](figures/context-inheritance.png) - The figure below illustrates the holding relationship of contexts. - + ![context-holding](figures/context-holding.png) - The following describes the information provided by different contexts. - - [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md): Each UIAbility has the **Context** attribute, which provides APIs to operate the ability, obtain the ability configuration, and more. + - [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md): Each UIAbility has the **Context** attribute, which provides APIs to operate an application component, obtain the application component configuration, and more. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let uiAbilityContext = this.context; - // ... - } + onCreate(want, launchParam) { + let uiAbilityContext = this.context; + // ... + } } ``` + + > **NOTE** + > + > For details about how to obtain the context of a **UIAbility** instance on the page, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). - Scenario-specific [ExtensionContext](../reference/apis/js-apis-inner-application-extensionContext.md): For example, ServiceExtensionContext, inherited from ExtensionContext, provides APIs related to background services. ```ts import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; export default class MyService extends ServiceExtensionAbility { - onCreate(want) { - let serviceExtensionContext = this.context; - // ... - } + onCreate(want) { + let serviceExtensionContext = this.context; + // ... + } } ``` - [AbilityStageContext](../reference/apis/js-apis-inner-application-abilityStageContext.md): module-level context. It provides **HapModuleInfo** and **Configuration** in addition to those provided by the base class **Context**. ```ts - import AbilityStage from "@ohos.app.ability.AbilityStage"; + import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { - onCreate() { - let abilityStageContext = this.context; - // ... - } + onCreate() { + let abilityStageContext = this.context; + // ... + } } ``` - - [ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md): application-level context. It provides APIs for subscribing to ability lifecycle changes, system memory changes, and system environment changes. The application-level context can be obtained from UIAbility, ExtensionAbility, and AbilityStage. + - [ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md): application-level context. It provides APIs for subscribing to application component lifecycle changes, system memory changes, and system environment changes. The application-level context can be obtained from UIAbility, ExtensionAbility, and AbilityStage. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let applicationContext = this.context.getApplicationContext(); - // ... - } + onCreate(want, launchParam) { + let applicationContext = this.context.getApplicationContext(); + // ... + } } ``` @@ -67,9 +71,9 @@ This topic describes how to use the context in the following scenarios: - [Obtaining the Application Development Path](#obtaining-the-application-development-path) -- [Obtaining and Modifying Encrypted Areas](#obtaining-and-modifying-encrypted-areas) +- [Obtaining and Modifying Encryption Areas](#obtaining-and-modifying-encryption-areas) - [Creating Context of Another Application or Module](#creating-context-of-another-application-or-module) -- [Subscribing to Ability Lifecycle Changes in a Process](#subscribing-to-ability-lifecycle-changes-in-a-process) +- [Subscribing to UIAbility Lifecycle Changes in a Process](#subscribing-to-uiability-lifecycle-changes-in-a-process) ### Obtaining the Application Development Path @@ -80,13 +84,13 @@ The following table describes the application development paths obtained from co | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.
It is the content of **Storage** of an application under **Settings > Apps & services > Apps**.| -| tempDir | string | Yes| No| Temporary file directory of the application.
Files in this directory are deleted after the application is uninstalled.| -| filesDir | string | Yes| No| File directory of the application on the internal storage.
Files in this directory may be synchronized to other directories during application migration or backup.| -| databaseDir | string | Yes| No| Storage directory of the local database.| -| bundleCodeDir | string | Yes| No| Installation directory of the application on the internal storage. A resource file cannot be accessed by combining paths. Use [Resource Manager](../reference/apis/js-apis-resource-manager.md) to access it. | -| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.| -| preferencesDir | string | Yes| Yes| Preferences directory of the application.| +| bundleCodeDir | string | Yes | No | Path for storing the application's installation package, that is, installation directory of the application on the internal storage. | +| cacheDir | string | Yes| No| Path for storing the application's cache files, that is, cache directory of the application on the internal storage.
It is the content of **Storage** of an application under **Settings > Apps & services > Apps**.| +| filesDir | string | Yes | No | Path for storing the application's common files, that is, file directory of the application on the internal storage.
Files in this directory may be synchronized to other directories during application migration or backup.| +| preferencesDir | string | Yes | Yes | Path for storing the application's preference files, that is, preferences directory of the application. | +| tempDir | string | Yes | No | Path for storing the application's temporary files.
Files in this directory are deleted after the application is uninstalled.| +| databaseDir | string | Yes | No | Path for storing the application's database, that is, storage directory of the local database. | +| distributedFilesDir | string | Yes| No| Path for storing the application's distributed files.| The capability of obtaining the application development path is provided by the base class **Context**. This capability is also provided by **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext**. However, the paths obtained from different contexts may differ, as shown below. @@ -111,7 +115,7 @@ The capability of obtaining the application development path is provided by the | bundleCodeDir | {Path prefix}/el1/bundle/| | cacheDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/cache/| | filesDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/files/| - | preferencesDir | {path prefix}/{encryption level}/base/**haps/{moduleName}**/preferences/| + | preferencesDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/preferences/| | tempDir | {Path prefix}/{Encryption level}/base/**haps/{moduleName}**/temp/| | databaseDir | {Path prefix}/{Encryption level}/database/**{moduleName}**/| | distributedFilesDir | {Path prefix}/el2/distributedFiles/**{moduleName}**/| @@ -123,83 +127,92 @@ The sample code for obtaining the application development paths is as follows: import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let cacheDir = this.context.cacheDir; - let tempDir = this.context.tempDir; - let filesDir = this.context.filesDir; - let databaseDir = this.context.databaseDir; - let bundleCodeDir = this.context.bundleCodeDir; - let distributedFilesDir = this.context.distributedFilesDir; - let preferencesDir = this.context.preferencesDir; - // ... - } + onCreate(want, launchParam) { + let cacheDir = this.context.cacheDir; + let tempDir = this.context.tempDir; + let filesDir = this.context.filesDir; + let databaseDir = this.context.databaseDir; + let bundleCodeDir = this.context.bundleCodeDir; + let distributedFilesDir = this.context.distributedFilesDir; + let preferencesDir = this.context.preferencesDir; + // ... + } } ``` +> **NOTE** +> +> The sample code obtains the sandbox path of the application development path. The absolute path can be obtained by running the **find / -name ** command in the hdc shell after file creation or modification. -### Obtaining and Modifying Encrypted Areas +### Obtaining and Modifying Encryption Areas -You can read and write [the area attribute in the context](../reference/apis/js-apis-inner-application-context.md) to obtain and set an encrypted area. Two encryption levels are supported: +Encrypting application files enhances data security by preventing files from unauthorized access. Different application files require different levels of protection. For private files, such as alarms and wallpapers, the application must place them in the device-level encryption area (EL1) to ensure that they can be accessed before the user enters the password. For sensitive files, such as personal privacy data, the application must place them in the user-level encryption area (EL2). -- AreaMode.EL1: device-level encryption area, which is accessible after the device is powered on. +In practice, you need to select a proper encrypted area based on scenario-specific requirements to protect application data security. The proper use of EL1 and the EL2 can efficiently improve the security. -- AreaMode.EL2: user-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time). +> **NOTE** +> +> - AreaMode.EL1: device-level encryption area, which is accessible after the device is powered on. +> +> - AreaMode.EL2: user-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time). + +You can obtain and set the encryption area by reading and writing the [area attribute in Context](../reference/apis/js-apis-inner-application-context.md). ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - // Before storing common information, switch the encryption level to EL1. - if (this.context.area === 1) {// Obtain the area. - this.context.area = 0; // Modify the area. - } - // Store common information. - - // Before storing sensitive information, switch the encryption level to EL2. - if (this.context.area === 0) { // Obtain the area. - this.context.area = 1; // Modify the area. - } - // Store sensitive information. + onCreate(want, launchParam) { + // Before storing common information, switch the encryption level to EL1. + if (this.context.area === 1) {// Obtain the area. + this.context.area = 0; // Modify the area. } + // Store common information. + + // Before storing sensitive information, switch the encryption level to EL2. + if (this.context.area === 0) { // Obtain the area. + this.context.area = 1; // Modify the area. + } + // Store sensitive information. + } } ``` ### Creating Context of Another Application or Module -The base class **Context** provides the [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) methods for creating the context of other applications or modules, so as to obtain the resource information, for example, [obtaining the application development paths](#obtaining-the-application-development-path) of other modules. +The base class **Context** provides [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) to create the context of other applications or modules, so as to obtain the resource information, for example, [obtaining the application development paths](#obtaining-the-application-development-path) of other modules. - Call **createBundleContext(bundleName:string)** to create the context of another application. > **NOTE** > > To obtain the context of another application: > - > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). > > - This is a system API and cannot be called by third-party applications. - + For example, application information displayed on the home screen includes the application name and icon. The home screen application calls the foregoing method to obtain the context information, so as to obtain the resource information including the application name and icon. - + ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let bundleName2 = "com.example.application"; - let context2 = this.context.createBundleContext(bundleName2); - let label2 = context2.applicationInfo.label; - // ... - } + onCreate(want, launchParam) { + let bundleName2 = 'com.example.application'; + let context2 = this.context.createBundleContext(bundleName2); + let label2 = context2.applicationInfo.label; + // ... + } } ``` - + - Call **createModuleContext(bundleName:string, moduleName:string)** to obtain the context of a specified module of another application. After obtaining the context, you can obtain the resource information of that module. > **NOTE** > > To obtain the context of a specified module of another application: > - > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). > > - This is a system API and cannot be called by third-party applications. @@ -207,12 +220,12 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let bundleName2 = "com.example.application"; - let moduleName2 = "module1"; - let context2 = this.context.createModuleContext(bundleName2, moduleName2); - // ... - } + onCreate(want, launchParam) { + let bundleName2 = 'com.example.application'; + let moduleName2 = 'module1'; + let context2 = this.context.createModuleContext(bundleName2, moduleName2); + // ... + } } ``` @@ -222,77 +235,90 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let moduleName2 = "module1"; - let context2 = this.context.createModuleContext(moduleName2); - // ... - } + onCreate(want, launchParam) { + let moduleName2 = 'module1'; + let context2 = this.context.createModuleContext(moduleName2); + // ... + } } ``` -### Subscribing to Ability Lifecycle Changes in a Process +### Subscribing to UIAbility Lifecycle Changes in a Process -In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to ability lifecycle changes. +In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to UIAbility lifecycle changes in a process. -When the ability lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered, and a listener ID is returned. The ID is incremented by 1 each time the listener is registered. When the number of listeners exceeds the upper limit (2^63-1), -1 is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example. +[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; import window from '@ohos.window'; -const TAG: string = "[Example].[Entry].[EntryAbility]"; +const TAG: string = '[Example].[Entry].[EntryAbility]'; export default class EntryAbility extends UIAbility { - lifecycleId: number; - - onCreate(want, launchParam) { - let abilityLifecycleCallback = { - onAbilityCreate(ability) { - console.info(TAG, "onAbilityCreate ability:" + JSON.stringify(ability)); - }, - onWindowStageCreate(ability, windowStage) { - console.info(TAG, "onWindowStageCreate ability:" + JSON.stringify(ability)); - console.info(TAG, "onWindowStageCreate windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageActive(ability, windowStage) { - console.info(TAG, "onWindowStageActive ability:" + JSON.stringify(ability)); - console.info(TAG, "onWindowStageActive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageInactive(ability, windowStage) { - console.info(TAG, "onWindowStageInactive ability:" + JSON.stringify(ability)); - console.info(TAG, "onWindowStageInactive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageDestroy(ability, windowStage) { - console.info(TAG, "onWindowStageDestroy ability:" + JSON.stringify(ability)); - console.info(TAG, "onWindowStageDestroy windowStage:" + JSON.stringify(windowStage)); - }, - onAbilityDestroy(ability) { - console.info(TAG, "onAbilityDestroy ability:" + JSON.stringify(ability)); - }, - onAbilityForeground(ability) { - console.info(TAG, "onAbilityForeground ability:" + JSON.stringify(ability)); - }, - onAbilityBackground(ability) { - console.info(TAG, "onAbilityBackground ability:" + JSON.stringify(ability)); - }, - onAbilityContinue(ability) { - console.info(TAG, "onAbilityContinue ability:" + JSON.stringify(ability)); - } - } - // 1. Obtain the application context through the context attribute. - let applicationContext = this.context.getApplicationContext(); - // 2. Register a listener for the lifecycle changes through the application context. - this.lifecycleId = applicationContext.on("abilityLifecycle", abilityLifecycleCallback); - console.info(TAG, "register callback number: " + JSON.stringify(this.lifecycleId)); + // Define a lifecycle ID. + lifecycleId: number; + + onCreate(want, launchParam) { + // Define a lifecycle callback object. + let abilityLifecycleCallback = { + // Called when a UIAbility is created. + onAbilityCreate(uiAbility) { + console.log(TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when a window is created. + onWindowStageCreate(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window becomes active. + onWindowStageActive(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageActive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageActive windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window becomes inactive. + onWindowStageInactive(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageInactive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageInactive windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window is destroyed. + onWindowStageDestroy(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the UIAbility is destroyed. + onAbilityDestroy(uiAbility) { + console.log(TAG, `onAbilityDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when the UIAbility is switched from the background to the foreground. + onAbilityForeground(uiAbility) { + console.log(TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when the UIAbility is switched from the foreground to the background. + onAbilityBackground(uiAbility) { + console.log(TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when UIAbility is continued on another device. + onAbilityContinue(uiAbility) { + console.log(TAG, `onAbilityContinue uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + } } + // Obtain the application context. + let applicationContext = this.context.getApplicationContext(); + // Register the application lifecycle callback. + this.lifecycleId = applicationContext.on('Lifecycle', abilityLifecycleCallback); + console.log(TAG, `register callback number: ${this.lifecycleId}`); + } - onDestroy() { - let applicationContext = this.context.getApplicationContext(); - applicationContext.off("abilityLifecycle", this.lifecycleId, (error, data) => { - console.info(TAG, "unregister callback success, err: " + JSON.stringify(error)); - }); - } + // ... + + onDestroy() { + // Obtain the application context. + let applicationContext = this.context.getApplicationContext(); + // Deregister the application lifecycle callback. + applicationContext.off('abilityLifecycle', this.lifecycleId); + } } ``` diff --git a/en/application-dev/application-models/component-startup-rules.md b/en/application-dev/application-models/component-startup-rules.md index 0e6c2ce33c68913221c7b09f02e96327b0ea1c30..26b2446893aea096611f896e878ef15888830afa 100644 --- a/en/application-dev/application-models/component-startup-rules.md +++ b/en/application-dev/application-models/component-startup-rules.md @@ -30,7 +30,7 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol - An application is considered as a foreground application only when the application process gains focus or its UIAbility component is running in the foreground. - Verify the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. -- **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Ability Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction) and [Using Cross-Device Ability Call](hop-multi-device-collaboration.md#using-cross-device-ability-call). +- **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction) and [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call). - Verify the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** permission. diff --git a/en/application-dev/application-models/create-pageability.md b/en/application-dev/application-models/create-pageability.md index 783646ff4cfd5fa2ab193005bfa9d182dc75b70c..d33b7af946dd0e935a149ebb11ef1ecbedf05ca8 100644 --- a/en/application-dev/application-models/create-pageability.md +++ b/en/application-dev/application-models/create-pageability.md @@ -30,7 +30,7 @@ export default { ``` -After the PageAbility is created, its abilities-related configuration items are displayed in the **config.json** file. The following is an example **config.json** file of an ability named EntryAbility: +After the PageAbility is created, its abilities-related configuration items are displayed in the **config.json** file. The following is an example **config.json** file of an ability named MainAbility: ```json { @@ -48,13 +48,13 @@ After the PageAbility is created, its abilities-related configuration items are ], "orientation": "unspecified", "visible": true, - "srcPath": "EntryAbility", - "name": ".EntryAbility", + "srcPath": "MainAbility", + "name": ".MainAbility", "srcLanguage": "ets", "icon": "$media:icon", - "description": "$string:EntryAbility_desc", + "description": "$string:MainAbility_desc", "formsEnabled": false, - "label": "$string:EntryAbility_label", + "label": "$string:MainAbility_label", "type": "page", "launchType": "singleton" } @@ -76,22 +76,22 @@ In the FA model, you can call **getContext** of **featureAbility** to obtain the The following code snippet shows how to use **getContext()** to obtain the application context and distributed directory: ```ts -import featureAbility from '@ohos.ability.featureAbility' -import fileIo from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility'; +import fs from '@ohos.file.fs'; (async () => { - let dir: string + let dir: string; try { - console.info('Begin to getOrCreateDistributedDir') - dir = await featureAbility.getContext().getOrCreateDistributedDir() + console.info('Begin to getOrCreateDistributedDir'); + dir = await featureAbility.getContext().getOrCreateDistributedDir(); console.info('distribute dir is ' + dir) } catch (error) { - console.error('getOrCreateDistributedDir failed with ' + error) + console.error('getOrCreateDistributedDir failed with ' + error); } let fd: number; let path = dir + "/a.txt"; - fd = fileIo.openSync(path, 0o2 | 0o100, 0o666); - fileIo.close(fd); + fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; + fs.close(fd); })() ``` diff --git a/en/application-dev/application-models/data-share-via-want.md b/en/application-dev/application-models/data-share-via-want.md index c04bea2916647804b51022cee1853f3b5d0a7d90..05da4e529947cf62a98fa81a4b6ed4578c9e0346 100644 --- a/en/application-dev/application-models/data-share-via-want.md +++ b/en/application-dev/application-models/data-share-via-want.md @@ -1,111 +1,133 @@ # Using Want to Share Data Between Applications - Users often need to share data (such as a text or an image) from one application to another. The following uses PDF file sharing as an example to describe how to use Want to share data between applications. +Data sharing requires two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application sharing box). When the sharing party initiates data sharing by calling **startAbility()**, the system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts the application to complete data sharing. -## Prerequisites - -1. There are two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application selector). When the sharing party initiates data sharing through **startAbility()**, the application selector is started. The system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts that application to complete data sharing. - -2. In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on the Want configuration used for data sharing. - -3. The following actions are involved in this section: - - **ACTION_SELECT (ohos.want.action.select)**: action of displaying the application selector. - - **ACTION_SEND_DATA (ohos.want.action.sendData)**: action of launching the UI for sending a single data record. It is used to transfer data to the shared party. - - -## How to Develop - -- Sharing party - 1. In the stage mode, the [File Descriptor (FD)](../reference/apis/js-apis-fileio.md#fileioopensync) is used for file transfer. This example assumes that the path of the file to share is obtained. - - ```ts - import fileIO from '@ohos.fileio'; - - // let path = ... - // Open the file whose path is a variable. - let fileFd = fileIO.openSync(path, 0o102, 0o666); - ``` - - 2. As described in the prerequisites, the sharing party starts an application selector and shares the data to the selector, and the selector transfers the data to the shared party. Want of the sharing party must be nested at two layers. At the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application selector. At the second layer, complete Want is declared in the custom field **parameters** to transfer the data to share. - - ```ts - import wantConstant from '@ohos.app.ability.wantConstant'; - - // let path = ... - // let fileFd = ... - // let fileSize = ... - let want = { - / This action is used to implicitly match the application selector. - action: wantConstant.Action.ACTION_SELECT, - // This is the custom parameter in the first layer of Want, - / which is intended to add information to the application selector. - parameters: { - // MIME type of PDF. - "ability.picker.type": "application/pdf", - "ability.picker.fileNames": [path], - "ability.picker.fileSizes": [fileSize], - // This nested Want ,which will be directly sent to the selected application. - "ability.want.params.INTENT": { - "action": "ohos.want.action.sendData", - "type": "application/pdf", - "parameters": { - "keyFd": {"type": "FD", "value": fileFd} - } - } - } +In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on how to configure Want to implement data sharing. + +The following actions are involved for data sharing: + +- **ohos.want.action.select**: action of starting the application sharing box. +- **ohos.want.action.sendData**: action of sending a single data record, that is, transferring data to the shared party. + +## Sharing Party + +The sharing party starts an application sharing box and transfers the data to the shared party. Therefore, Want of the sharing party must be nested at two layers. In the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application sharing box. In the second layer, the data to share is declared + +in the custom field **parameters**, and then the Want that includes the **ohos.want.action.sendData** action and the **parameters** field is transferred to the application sharing box. The shared party obtains the shared data from **parameters**. + +```ts +import common from '@ohos.app.ability.common'; + +let fileType = 'application/pdf'; +let fileName = 'TestFile.pdf'; +let fileFd = -1; // Obtain the file descriptor (FD) of the file to share. +let fileSize; // Obtain the size of the file to share. + +function implicitStartAbility() { + let context = getContext(this) as common.UIAbilityContext; + let wantInfo = { + / This action is used to implicitly match the application sharing box. + action: 'ohos.want.action.select', + // This is the custom parameter in the first layer of Want, + / which is intended to add information to the application sharing box. + parameters: { + // MIME type of PDF. + 'ability.picker.type': fileType, + 'ability.picker.fileNames': [fileName], + 'ability.picker.fileSizes': [fileSize], + // This is nested Want ,which will be directly sent to the selected application. + 'ability.want.params.INTENT': { + 'action': 'ohos.want.action.sendData', + 'type': 'application/pdf', + 'parameters': { + 'keyFd': { 'type': 'FD', 'value': fileFd } + } } - ``` - - In the preceding code, the custom field **parameters** is used. The **ability.picker.\*** fields in the first-layer **parameters** are used to pass the information to be displayed on the application selector. The following fields are involved: - - - **"ability.picker.type"**: The application selector renders the file type icon based on this field. - - **"ability.picker.fileNames"**: The application selector displays the file name based on this field. - - **"ability.picker.fileSizes"**: The application selector displays the file size based on this field. The unit is byte. - - **"ability.picker.fileNames"** and **"ability.picker.fileSizes"** are arrays and have a one-to-one mapping. - - For example, when **"ability.picker.type"** is **"application/pdf"**, **"ability.picker.fileNames"** is **"["APIs.pdf"]"**, and **"ability.picker.fileSizes"** is **"[350 \* 1024]"**, the application selector is displayed as follows: - - ![stage-want2](figures/stage-want2.png) - - In the preceding code, the **ability.want.params.INTENT** field is nested Want. In this field, **action** and **type** are used for implicit matching by the application selector. For details about implicit matching, see [Matching Rules of Implicit Want](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want). After the user selects an application, the nested Want of the **ability.want.params.INTENT** field is passed to that application. - -- Shared party - 1. As mentioned above, the application selector performs implicit matching based on the **ability.want.params.INTENT** field. Therefore, you must set **skills** in the ability configuration file (**module.json5** file in the stage model) of the shared party as follows: - - ```ts - "skills": [ - { - "entities": [ + } + } + context.startAbility(wantInfo).then(() => { + // ... + }).catch((err) => { + // ... + }) +} +``` + +> **NOTE** +> +> Data sharing can be implemented only in FD format. For details about how to obtain the FD and file name, see [File Management](../reference/apis/js-apis-file-fs.md). + +In the preceding code, under the custom field **parameters**, the following **ability.picker.*** fields are used to pass the information to be displayed on the application sharing box: + +- **ability.picker.type**: file type icon. +- **ability.picker.fileNames**: file name. +- **ability.picker.fileSizes**: file size, in bytes. +- **ability.picker.fileNames** and **ability.picker.fileSizes** are arrays and have a one-to-one mapping. + +The following figure shows an example. + +![stage-want2](figures/stage-want2.png) + +## Shared Party + +To enable the shared party to identify the shared content, configure **skills** in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility of the shared party. The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT** of the sharing party, respectively. + +```json +{ + "module": { + // ... + "abilities": [ + { + // ... + "skills": [ + { // ... - ], - "actions": [ + "actions": [ + "action.system.home", "ohos.want.action.sendData" // ... - ], - "uris": [ - { - "type": "application/pdf" - }, - // ... - ] - }, - ] - ``` - - The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT**, respectively. - - Files can be transferred in FD mode, but not URI mode. In implicit matching, the **type** field in Want must match the **type** field in **uris** under **skills** of the shared party. Therefore, specify only the **type** field in **uris**. If **host** and **port** are specified, the matching fails. The application selector initiates implicit matching based on **ability.want.params.INTENT**. Therefore, when the **uri** field added to **ability.want.params.INTENT** matches the **uris** field under **skills**, the matching is successful and additional data can be transferred. - 2. After the application selector starts the shared party, the system calls **onCreate** and passes **ability.want.params.INTENT** to the **want** parameter. - - ```ts - onCreate(want, launchParam) { - // When keyFd is undefined, the application crashes. - if (want["parameters"]["keyFd"] !== undefined) { - // Receive the file descriptor. - let fd = want["parameters"]["keyFd"].value; - // ... - } + ], + "uris": [ + { + "type": "application/pdf" + }, + ] + } + ] } - ``` + ] + } +} +``` + +After the user selects an application, the Want nested in the **ability.want.params.INTENT** field is passed to that application. The UIAbility of the shared party, after being started, can call [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to obtain the passed Want. + +The following is an example of the Want obtained. You can use the FD of the shared file to perform required operations. + +```json +{ + "deviceId": "", + "bundleName": "com.example.myapplication", + "abilityName": "EntryAbility", + "moduleName": "entry", + "uri": "", + "type": "application/pdf", + "flags": 0, + "action": "ohos.want.action.sendData", + "parameters": { + "component.startup.newRules": true, + "keyFd": { + "type": "FD", + "value": 36 + }, + "mime-type": "application/pdf", + "moduleName": "entry", + "ohos.aafwk.param.callerPid": 3488, + "ohos.aafwk.param.callerToken": 537379209, + "ohos.aafwk.param.callerUid": 20010014 + }, + "entities": [] +} +``` diff --git a/en/application-dev/application-models/explicit-implicit-want-mappings.md b/en/application-dev/application-models/explicit-implicit-want-mappings.md index d2c44bb4b47eff6347d6b4a6c098feadb7a9eead..921cdec8ba0cd051292421fba0ecbb2e9f57797e 100644 --- a/en/application-dev/application-models/explicit-implicit-want-mappings.md +++ b/en/application-dev/application-models/explicit-implicit-want-mappings.md @@ -4,9 +4,6 @@ Both explicit Want and implicit Want can be used to match an ability to start ba ## Matching Rules of Explicit Want - -The table below describes the matching rules of explicit Want. - | Name| Type| Matching Item| Mandatory| Rule Description| | -------- | -------- | -------- | -------- | -------- | | deviceId | string | Yes| No| If this field is unspecified, only abilities on the local device are matched.| @@ -22,8 +19,6 @@ The table below describes the matching rules of explicit Want. ## Matching Rules for Implicit Want -The table below describes the matching rules of implicit Want. - | Name | Type | Matching Item| Mandatory| Rule Description | | ----------- | ------------------------------ | ------ | ---- | ------------------------------------------------------------ | | deviceId | string | Yes | No | Implicit invoking is not supported across devices. | @@ -37,8 +32,9 @@ The table below describes the matching rules of implicit Want. | flags | number | No | No | This field is not used for matching and is directly transferred to the system for processing. It is generally used to set runtime information, such as URI data authorization.| | parameters | {[key: string]: any} | No | No | This field is not used for matching. It is passed to the target ability as a parameter. | -Get familiar with the following about implicit Want: +## Interpretation of Implicit Want Matching Rules +Get familiar with the following about implicit Want: - The **want** parameter passed by the caller indicates the operation to be performed by the caller. It also provides data and application type restrictions. @@ -50,7 +46,7 @@ The system matches the **want** parameter (including the **action**, **entities* ### Matching Rules of action in the want Parameter -The system matches the [action](../reference/apis/js-apis-ability-wantConstant.md#wantconstantaction) attribute in the **want** parameter passed by the caller against **actions** under **skills** of the abilities. +The system matches the **action** attribute in the **want** parameter passed by the caller against **actions** under **skills** of the abilities. - If **action** in the passed **want** parameter is specified but **actions** under **skills** of an ability is unspecified, the matching fails. @@ -60,14 +56,14 @@ The system matches the [action](../reference/apis/js-apis-ability-wantConstant.m - If **action** in the passed **want** parameter is specified, and **actions** under **skills** of an ability is specified but does not contain **action** in the passed **want** parameter, the matching fails. - **Figure 1** Matching rules of action in the want parameter - - ![want-action](figures/want-action.png) + **Figure 1** Matching rules of action in the want parameter + + ![want-action](figures/want-action.png) ### Matching Rules of entities in the want Parameter -The system matches the [entities](../reference/apis/js-apis-ability-wantConstant.md#wantconstantentity) attribute in the **want** parameter passed by the caller against **entities** under **skills** of the abilities. +The system matches the **entities** attribute in the **want** parameter passed by the caller against **entities** under **skills** of the abilities. - If **entities** in the passed **want** parameter is unspecified but **entities** under **skills** of an ability is specified, the matching is successful. @@ -79,19 +75,15 @@ The system matches the [entities](../reference/apis/js-apis-ability-wantConstant - If **entities** in the passed **want** parameter is specified, and **entities** under **skills** of an ability is specified but does not contain **entities** in the passed **want** parameter, the matching fails. - Figure 2 Matching rule of entities in the want parameter + **Figure 2** Matching rule of entities in the want parameter - ![want-entities](figures/want-entities.png) + ![want-entities](figures/want-entities.png) ### Matching Rules of uri and type in the want Parameter When the **uri** and **type** parameters are specified in the **want** parameter to initiate a component startup request, the system traverses the list of installed components and matches the **uris** array under **skills** of the abilities one by one. If one of the **uris** arrays under **skills** matches the **uri** and **type** in the passed **want**, the matching is successful. -Figure 3 Matching rules when uri and type are specified in the want parameter - -![want-uri-type1](figures/want-uri-type1.png) - There are four combinations of **uri** and **type** settings. The matching rules are as follows: - Neither **uri** or **type** is specified in the **want** parameter. @@ -111,13 +103,19 @@ There are four combinations of **uri** and **type** settings. The matching rules - If the **uris** array under **skills** of an ability is unspecified, the matching fails. - If the **uris** array under **skills** of an ability contains an element whose [uri is matched](#matching-rules-of-uri) and [type is matched](#matching-rules-of-type), the matching is successful. Otherwise, the matching fails. +Leftmost URI matching: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the **uris** array under **skills** of the ability, +the matching is successful only if the leftmost URI in the passed **want** parameter matches **scheme**, the combination of **scheme** and **host**, or the combination of **scheme**, **host**, and **port**. -To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom. +**Figure 3** Matching rules when uri and type are specified in the want parameter + + ![want-uri-type1](figures/want-uri-type1.png) -Figure 4 Matching rules of uri and type in the want parameter +To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom. + +**Figure 4** Matching rules of uri and type in the want parameter -![want-uri-type2](figures/want-uri-type2.png) +![want-uri-type2](figures/want-uri-type2.png) ### Matching Rules of uri @@ -128,7 +126,9 @@ To simplify the description, **uri** in the passed **want** parameter is called - If **host** of **s_uri** is unspecified and **scheme** of **w_uri** and **scheme** of **s_uri** are the same, the matching is successful. Otherwise, the matching fails. -- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching fails. +- If **port** of **s_uri** is unspecified and the combination of **scheme** and **host** of **w_uri** is the same as the combination of **scheme** and **host** of **s_uri**, the matching is successful. Otherwise, the matching fails. + +- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and the combination of **scheme**, **host**, and **port** of **w_uri** is the same as the combination of **scheme**, **host**, and **port** of **s_uri**, the matching is successful. Otherwise, the matching fails. - If **path** of **s_uri** is specified and the **full path expressions** of **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching of **pathStartWith** continues. @@ -139,12 +139,17 @@ To simplify the description, **uri** in the passed **want** parameter is called > **NOTE** > > The **scheme**, **host**, **port**, **path**, **pathStartWith**, and **pathRegex** attributes of **uris** under **skills** of an ability are concatenated. If **path**, **pathStartWith**, and **pathRegex** are declared in sequence, **uris** can be concatenated into the following expressions: +> +> - **Full path expression**: scheme://host:port/path +> +> - **Prefix expression**: scheme://host:port/pathStartWith +> +> - **Regular expression**: scheme://host:port/pathRegex > -> - **Full path expression**: `scheme://host:port/path` -> -> - **Prefix expression**: `scheme://host:port/pathStartWith` -> -> - **Regular expression**: `scheme://host:port/pathRegex` +> - **Prefix URI expression**: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the configuration file, the matching is successful if a URI prefixed with the configuration file is passed in. +> * `scheme://` +> * `scheme://host` +> * `scheme://host:port` ### Matching Rules of type diff --git a/en/application-dev/application-models/figures/want-uri-type1.png b/en/application-dev/application-models/figures/want-uri-type1.png index e0fe40d1a3cd40b72379bd947aaf2e3977021b32..ed53694a9608e8529c5e4633fca42b041bc7ab76 100644 Binary files a/en/application-dev/application-models/figures/want-uri-type1.png and b/en/application-dev/application-models/figures/want-uri-type1.png differ diff --git a/en/application-dev/application-models/hop-cross-device-migration.md b/en/application-dev/application-models/hop-cross-device-migration.md index d90a10995f0aeba773179fc7807ab25711b4594c..714698d002237cf3c2d45267596089c1317c66af 100644 --- a/en/application-dev/application-models/hop-cross-device-migration.md +++ b/en/application-dev/application-models/hop-cross-device-migration.md @@ -1,4 +1,4 @@ -# Cross-Device Migration (for System Applications Only)] +# Cross-Device Migration (for System Applications Only) ## When to Use diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md index e5dfb522fcc8ffa05106e87197de6b276e4c9e00..7cf66fbab7a98b109de3f9ffcc2fc7b7a2ecd127 100644 --- a/en/application-dev/application-models/hop-multi-device-collaboration.md +++ b/en/application-dev/application-models/hop-multi-device-collaboration.md @@ -11,7 +11,7 @@ Multi-device coordination involves the following scenarios: - [Connecting to ServiceExtensionAbility Across Devices](#connecting-to-serviceextensionability-across-devices) -- [Using Cross-Device Ability Call](#using-cross-device-ability-call) +- [Using Cross-Device Call](#using-cross-device-call) ## Multi-Device Collaboration Process @@ -102,7 +102,7 @@ On device A, touch the **Start** button provided by the initiator application to abilityName: 'FuncAbility', moduleName: 'module1', // moduleName is optional. } - // context is the ability-level context of the initiator UIAbility. + // context is the AbilityContext of the initiator UIAbility. this.context.startAbility(want).then(() => { // ... }).catch((err) => { @@ -118,7 +118,7 @@ On device A, touch the **Start** button provided by the initiator application to ### Available APIs -**Table 2** APIs for starting an ability across devices and returning the result data +**Table 2** APIs for starting a UIAbility across devices and returning the result data | API| Description| | -------- | -------- | @@ -154,7 +154,7 @@ On device A, touch the **Start** button provided by the initiator application to abilityName: 'FuncAbility', moduleName: 'module1', // moduleName is optional. } - // context is the ability-level context of the initiator UIAbility. + // context is the AbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { // ... }).catch((err) => { @@ -174,7 +174,7 @@ On device A, touch the **Start** button provided by the initiator application to moduleName: 'module1', }, } - // context is the ability-level context of the target UIAbility. + // context is the AbilityContext of the target UIAbility. this.context.terminateSelfWithResult(abilityResult, (err) => { // ... }); @@ -187,7 +187,7 @@ On device A, touch the **Start** button provided by the initiator application to // ... - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { if (data?.resultCode === RESULT_CODE) { // Parse the information returned by the target UIAbility. @@ -315,24 +315,24 @@ A system application can connect to a service on another device by calling [conn ``` -## Using Cross-Device Ability Call +## Using Cross-Device Call -The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction-for-system-applications-only). +The basic principle of cross-device call is the same as that of intra-device call. For details, see [Using Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction-for-system-applications-only). -The following describes how to implement multi-device collaboration through cross-device ability call. +The following describes how to implement multi-device collaboration through cross-device call. ### Available APIs -**Table 4** Ability call APIs +**Table 4** Call APIs | API| Description| | -------- | -------- | | startAbilityByCall(want: Want): Promise<Caller>; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.| -| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.| -| off(method: string): void | Callback invoked when the callee ability deregisters a method.| -| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.| -| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.| +| on(method: string, callback: CalleeCallBack): void | Callback invoked when the CalleeAbility registers a method.| +| off(method: string): void | Callback invoked when the CalleeAbility deregisters a method.| +| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the CalleeAbility.| +| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the CalleeAbility and obtains the agreed parcelable data returned by the CalleeAbility.| | release(): void | Releases the caller object.| | on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| @@ -367,17 +367,17 @@ The following describes how to implement multi-device collaboration through cros } ``` -3. Create the callee ability. +3. Create the CalleeAbility. - For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. + For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. 1. Configure the launch type of the UIAbility. - Set **launchType** of the callee ability to **singleton** in the **module.json5** file. + Set **launchType** of the CalleeAbility to **singleton** in the **module.json5** file. | JSON Field| Description| | -------- | -------- | - | "launchType"| Ability launch type. Set this parameter to **singleton**.| + | "launchType"| UIAbility launch type. Set this parameter to **singleton**.| An example of the UIAbility configuration is as follows: @@ -401,7 +401,7 @@ The following describes how to implement multi-device collaboration through cros 3. Define the agreed parcelable data. - The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. + The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string. ```ts export default class MyParcelable { @@ -438,13 +438,13 @@ The following describes how to implement multi-device collaboration through cros function sendMsgCallback(data) { console.info('CalleeSortFunc called') - // Obtain the parcelable data sent by the caller ability. + // Obtain the parcelable data sent by the CallerAbility. let receivedData = new MyParcelable(0, '') data.readParcelable(receivedData) console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) // Process the data. - // Return the parcelable data result to the caller ability. + // Return the parcelable data result to the CallerAbility. return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`) } @@ -467,7 +467,7 @@ The following describes how to implement multi-device collaboration through cros } ``` -4. Obtain the caller object and access the callee ability. +4. Obtain the caller object and access the CalleeAbility. 1. Import the **UIAbility** module. ```ts @@ -476,7 +476,7 @@ The following describes how to implement multi-device collaboration through cros 2. Obtain the caller object. - The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. + The **context** attribute of the UIAbility implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the UIAbility, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements. ```ts async onButtonGetRemoteCaller() { @@ -491,7 +491,7 @@ The following describes how to implement multi-device collaboration through cros if (data != null) { caller = data console.info('get remote caller success') - // 注册caller的release监听 + // Register the onRelease listener of the CallerAbility. caller.onRelease((msg) => { console.info(`remote caller onRelease is called ${msg}`) }) @@ -505,8 +505,8 @@ The following describes how to implement multi-device collaboration through cros For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned). -5. Sends agreed parcelable data to the callee ability. - 1. The parcelable data can be sent to the callee ability with or without a return value. The method and parcelable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability. +5. Sends agreed parcelable data to the CalleeAbility. + 1. The parcelable data can be sent to the CalleeAbility with or without a return value. The method and parcelable data must be consistent with those of the CalleeAbility. The following example describes how to send data to the CalleeAbility. ```ts const MSG_SEND_METHOD: string = 'CallSendMsg' @@ -520,7 +520,7 @@ The following describes how to implement multi-device collaboration through cros } ``` - 2. In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**. + 2. In the following, **CallWithResult** is used to send data **originMsg** to the CalleeAbility and assign the data processed by the **CallSendMsg** method to **backMsg**. ```ts const MSG_SEND_METHOD: string = 'CallSendMsg' diff --git a/en/application-dev/application-models/mission-management-overview.md b/en/application-dev/application-models/mission-management-overview.md index b6f6668f7ce56a9de0b5a3d0182b14ec189703c9..e371e8380fbd7e181e13f1d5f5e7487b15eb9ff1 100644 --- a/en/application-dev/application-models/mission-management-overview.md +++ b/en/application-dev/application-models/mission-management-overview.md @@ -28,10 +28,10 @@ Missions are managed by system applications (such as home screen), rather than t - Switch a mission to the foreground. -A UIAbility instance corresponds to an independent mission. Therefore, when an application calls the **startAbility()** method to start a UIAbility, a mission is created. +A UIAbility instance corresponds to an independent mission. Therefore, when an application calls **startAbility()** to start a UIAbility, a mission is created. -To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). You can use **missionManager** to manage missions, for example, listening for mission changes, obtaining mission information or snapshots, and clearing, locking, or unlocking missions. The sample code is as follows: diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md index 58cea75a988647cbbc3e53e3918990812cfdc702..5ea819219e45d219e68aee7f34988f4822dda5a9 100644 --- a/en/application-dev/application-models/uiability-intra-device-interaction.md +++ b/en/application-dev/application-models/uiability-intra-device-interaction.md @@ -17,7 +17,7 @@ This topic describes the UIAbility interaction modes in the following scenarios. - [Starting a Specified Page of UIAbility](#starting-a-specified-page-of-uiability) -- [Using Ability Call to Implement UIAbility Interaction (for System Applications Only)](#using-ability-call-to-implement-uiability-interaction-for-system-applications-only) +- [Using Call to Implement UIAbility Interaction (for System Applications Only)](#using-call-to-implement-uiability-interaction-for-system-applications-only) ## Starting UIAbility in the Same Application @@ -38,7 +38,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func info: 'From the Index page of EntryAbility', }, } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbility(wantInfo).then(() => { // ... }).catch((err) => { @@ -54,7 +54,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func export default class FuncAbility extends UIAbility { onCreate(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. + // Receive the parameters passed by the initiator UIAbility. let funcAbilityWant = want; let info = funcAbilityWant?.parameters?.info; // ... @@ -65,7 +65,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func 3. To stop the **UIAbility** instance after the FuncAbility service is complete, call **terminateSelf()** in FuncAbility. ```ts - // context is the ability-level context of the UIAbility instance to stop. + // context is the UIAbilityContext of the UIAbility instance to stop. this.context.terminateSelf((err) => { // ... }); @@ -88,7 +88,7 @@ When starting FuncAbility from EntryAbility, you want the result to be returned info: 'From the Index page of EntryAbility', }, } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(wantInfo).then((data) => { // ... }).catch((err) => { @@ -111,23 +111,23 @@ When starting FuncAbility from EntryAbility, you want the result to be returned }, }, } - // context is the ability-level context of the callee UIAbility. + // context is the AbilityContext of the target UIAbility. this.context.terminateSelfWithResult(abilityResult, (err) => { // ... }); ``` -3. After FuncAbility stops itself, EntryAbility uses the **startAbilityForResult()** method to receive the information returned by FuncAbility. The value of **RESULT_CODE** must be the same as the preceding value. +3. After FuncAbility stops itself, EntryAbility uses **startAbilityForResult()** to receive the information returned by FuncAbility. The value of **RESULT_CODE** must be the same as the preceding value. ```ts const RESULT_CODE: number = 1001; // ... - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { if (data?.resultCode === RESULT_CODE) { - // Parse the information returned by the callee UIAbility. + // Parse the information returned by the target UIAbility. let info = data.want?.parameters?.info; // ... } @@ -139,13 +139,13 @@ When starting FuncAbility from EntryAbility, you want the result to be returned ## Starting UIAbility of Another Application -Generally, the user only needs to do a common operation (for example, selecting a document application to view the document content) to start the UIAbility of another application. The [implicit Want launch mode](want-overview.md#types-of-want) is recommended. The system identifies a matched UIAbility and starts it based on the **want** parameter of the caller. +Generally, the user only needs to do a common operation (for example, selecting a document application to view the document content) to start the UIAbility of another application. The [implicit Want launch mode](want-overview.md#types-of-want) is recommended. The system identifies a matched UIAbility and starts it based on the **want** parameter of the initiator UIAbility. There are two ways to start **UIAbility**: [explicit and implicit](want-overview.md). - Explicit Want launch: This mode is used to start a determined UIAbility component of an application. You need to set **bundleName** and **abilityName** of the target application in the **want** parameter. -- Implicit Want launch: The user selects a UIAbility to start based on the matching conditions. That is, the UIAbility to start is not determined (the **abilityName** parameter is not specified). When the **startAbility()** method is called, the **want** parameter specifies a series of parameters such as [entities](../reference/apis/js-apis-ability-wantConstant.md#wantconstantentity) and [actions](../reference/apis/js-apis-ability-wantConstant.md#wantconstantaction). **entities** provides additional type information of the target UIAbility, such as the browser or video player. **actions** specifies the common operations to perform, such as viewing, sharing, and application details. Then the system analyzes the **want** parameter to find the right UIAbility to start. You usually do not know whether the target application is installed and what **bundleName** and **abilityName** of the target application are. Therefore, implicit Want launch is usually used to start the UIAbility of another application. +- Implicit Want launch: The user selects a UIAbility to start based on the matching conditions. That is, the UIAbility to start is not determined (the **abilityName** parameter is not specified). When **startAbility()** is called, the **want** parameter specifies a series of parameters such as [entities](../reference/apis/js-apis-ability-wantConstant.md#wantconstantentity) and [actions](../reference/apis/js-apis-ability-wantConstant.md#wantconstantaction). **entities** provides category information of the target UIAbility, such as the browser or video player. **actions** specifies the common operations to perform, such as viewing, sharing, and application details. Then the system analyzes the **want** parameter to find the right UIAbility to start. You usually do not know whether the target application is installed and what **bundleName** and **abilityName** of the target application are. Therefore, implicit Want launch is usually used to start the UIAbility of another application. This section describes how to start the UIAbility of another application through implicit Want. @@ -175,7 +175,7 @@ This section describes how to start the UIAbility of another application through } ``` -2. Include **entities** and **actions** of the caller's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). +2. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts let wantInfo = { @@ -187,7 +187,7 @@ This section describes how to start the UIAbility of another application through entities: ['entity.system.default'], } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbility(wantInfo).then(() => { // ... }).catch((err) => { @@ -202,7 +202,7 @@ This section describes how to start the UIAbility of another application through 3. To stop the **UIAbility** instance after the document application is used, call **terminateSelf()**. ```ts - // context is the ability-level context of the UIAbility instance to stop. + // context is the AbilityContext of the UIAbility instance to stop. this.context.terminateSelf((err) => { // ... }); @@ -211,7 +211,7 @@ This section describes how to start the UIAbility of another application through ## Starting UIAbility of Another Application and Obtaining the Return Result -If you want to obtain the return result when using implicit Want to start the UIAbility of another application, use the **startAbilityForResult()** method. An example scenario is that the main application needs to start a third-party payment application and obtain the payment result. +If you want to obtain the return result when using implicit Want to start the UIAbility of another application, use **startAbilityForResult()**. An example scenario is that the main application needs to start a third-party payment application and obtain the payment result. 1. In the **module.json5** file of the UIAbility corresponding to the payment application, set [entities](../reference/apis/js-apis-ability-wantConstant.md#wantconstantentity) and [actions](../reference/apis/js-apis-ability-wantConstant.md#wantconstantaction) under **skills**. @@ -239,7 +239,7 @@ If you want to obtain the return result when using implicit Want to start the UI } ``` -2. Call the **startAbilityForResult()** method to start the UIAbility of the payment application. Include **entities** and **actions** of the caller's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the caller after the payment UIAbility stops itself. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. +2. Call **startAbilityForResult()** to start the UIAbility of the payment application. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the initiator UIAbility after the payment UIAbility stops itself. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. ```ts let wantInfo = { @@ -251,7 +251,7 @@ If you want to obtain the return result when using implicit Want to start the UI entities: ['entity.system.default'], } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(wantInfo).then((data) => { // ... }).catch((err) => { @@ -259,7 +259,7 @@ If you want to obtain the return result when using implicit Want to start the UI }) ``` -3. After the payment is finished, call the **terminateSelfWithResult()** method to stop the payment UIAbility and return the **abilityResult** parameter. +3. After the payment is finished, call **terminateSelfWithResult()** to stop the payment UIAbility and return the **abilityResult** parameter. ```ts const RESULT_CODE: number = 1001; @@ -274,13 +274,13 @@ If you want to obtain the return result when using implicit Want to start the UI }, }, } - // context is the ability-level context of the callee UIAbility. + // context is the AbilityContext of the target UIAbility. this.context.terminateSelfWithResult(abilityResult, (err) => { // ... }); ``` -4. Receive the information returned by the payment application in the callback of the **startAbilityForResult()** method. The value of **RESULT_CODE** must be the same as that returned by **terminateSelfWithResult()**. +4. Receive the information returned by the payment application in the callback of **startAbilityForResult()**. The value of **RESULT_CODE** must be the same as that returned by **terminateSelfWithResult()**. ```ts const RESULT_CODE: number = 1001; @@ -289,10 +289,10 @@ If you want to obtain the return result when using implicit Want to start the UI // Want parameter information. }; - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { if (data?.resultCode === RESULT_CODE) { - // Parse the information returned by the callee UIAbility. + // Parse the information returned by the target UIAbility. let payResult = data.want?.parameters?.payResult; // ... } @@ -309,7 +309,7 @@ A UIAbility component can have multiple pages. When it is started in different s ### Specifying a Startup Page -When the caller UIAbility starts another UIAbility, it usually needs to redirect to a specified page. For example, FuncAbility contains two pages: Index (corresponding to the home page) and Second (corresponding to function A page). You can configure the specified page URL in the **want** parameter by adding a custom parameter to **parameters** in **want**. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). +When the initiator UIAbility starts another UIAbility, it usually needs to redirect to a specified page. For example, FuncAbility contains two pages: Index (corresponding to the home page) and Second (corresponding to function A page). You can configure the specified page URL in the **want** parameter by adding a custom parameter to **parameters** in **want**. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts @@ -322,7 +322,7 @@ let wantInfo = { router: 'funcA', }, } -// context is the ability-level context of the initiator UIAbility. +// context is the UIAbilityContext of the initiator UIAbility. this.context.startAbility(wantInfo).then(() => { // ... }).catch((err) => { @@ -344,12 +344,12 @@ export default class FuncAbility extends UIAbility { funcAbilityWant; onCreate(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. + // Receive the parameters passed by the initiator UIAbility. this.funcAbilityWant = want; } onWindowStageCreate(windowStage: Window.WindowStage) { - // Main window is created. Set a main page for this ability. + // Main window is created. Set a main page for this UIAbility. let url = 'pages/Index'; if (this.funcAbilityWant?.parameters?.router) { if (this.funcAbilityWant.parameters.router === 'funA') { @@ -379,7 +379,7 @@ In summary, when a UIAbility instance of application A has been created and the export default class FuncAbility extends UIAbility { onNewWant(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. + // Receive the parameters passed by the initiator UIAbility. globalThis.funcAbilityWant = want; // ... } @@ -412,81 +412,83 @@ In summary, when a UIAbility instance of application A has been created and the ``` > **NOTE** -> When the [launch type of the callee UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the callee UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked. +> +> When the [launch type of the target UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the target UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked. -## Using Ability Call to Implement UIAbility Interaction (for System Applications Only) +## Using Call to Implement UIAbility Interaction (for System Applications Only) -Ability call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the ability call to implement data sharing between two UIAbility instances (caller ability and callee ability) through IPC. +Call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the call to implement data sharing between two UIAbility instances (CallerAbility and CalleeAbility) through IPC. -The core API used for the ability call is **startAbilityByCall**, which differs from **startAbility** in the following ways: +The core API used for the call is **startAbilityByCall**, which differs from **startAbility** in the following ways: -- **startAbilityByCall** supports ability launch in the foreground and background, whereas **startAbility** supports ability launch in the foreground only. +- **startAbilityByCall** supports UIAbility launch in the foreground and background, whereas **startAbility** supports UIAbility launch in the foreground only. -- The caller ability can use the caller object returned by **startAbilityByCall** to communicate with the callee ability, but **startAbility** does not provide the communication capability. +- The CallerAbility can use the caller object returned by **startAbilityByCall** to communicate with the CalleeAbility, but **startAbility** does not provide the communication capability. -Ability call is usually used in the following scenarios: +Call is usually used in the following scenarios: -- Communicating with the callee ability +- Communicating with the CalleeAbility -- Starting the callee ability in the background +- Starting the CalleeAbility in the background -**Table 1** Terms used in the ability call +**Table 1** Terms used in the call | **Term**| Description| | -------- | -------- | -| CallerAbility | UIAbility that triggers the ability call.| -| CalleeAbility | UIAbility invoked by the ability call.| -| Caller | Object returned by **startAbilityByCall** and used by the caller ability to communicate with the callee ability.| -| Callee | Object held by the callee ability to communicate with the caller ability.| +| CallerAbility | UIAbility that triggers the call.| +| CalleeAbility | UIAbility invoked by the call.| +| Caller | Object returned by **startAbilityByCall** and used by the CallerAbility to communicate with the CalleeAbility.| +| Callee | Object held by the CalleeAbility to communicate with the CallerAbility.| -The following figure shows the ability call process. +The following figure shows the call process. - Figure 1 Ability call process + Figure 1 Call process ![call](figures/call.png) -- The caller ability uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the callee ability. +- The CallerAbility uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the CalleeAbility. -- The callee ability, which holds a **Callee** object, uses **on()** of the **Callee** object to register a callback. This callback is invoked when the callee ability receives data from the caller ability. +- The CalleeAbility, which holds a **Callee** object, uses **on()** of the **Callee** object to register a callback. This callback is invoked when the CalleeAbility receives data from the CallerAbility. > **NOTE** -> 1. Currently, only system applications can use the ability call. +> 1. Currently, only system applications can use the call. > -> 2. The launch type of the callee ability must be **singleton**. +> 2. The launch type of the CalleeAbility must be **singleton**. > -> 3. Both local (intra-device) and cross-device ability calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device ability call, see [Using Cross-Device Ability Call](hop-multi-device-collaboration.md#using-cross-device-ability-call). +> 3. Both local (intra-device) and cross-device calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device call, see [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call). ### Available APIs -The following table describes the main APIs used for the ability call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller). +The following table describes the main APIs used for the call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller). - **Table 2** Ability call APIs + **Table 2** Call APIs | API| Description| | -------- | -------- | | startAbilityByCall(want: Want): Promise<Caller> | Starts a UIAbility in the foreground (through the **want** configuration) or background (default) and obtains the caller object for communication with the UIAbility. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextstartabilitybycall).| -| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.| -| off(method: string): void | Callback invoked when the callee ability deregisters a method.| -| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.| -| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.| +| on(method: string, callback: CalleeCallBack): void | Callback invoked when the CalleeAbility registers a method.| +| off(method: string): void | Callback invoked when the CalleeAbility deregisters a method.| +| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the CalleeAbility.| +| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the CalleeAbility and obtains the agreed parcelable data returned by the CalleeAbility.| | release(): void | Releases the caller object.| | on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| -The implementation of using the ability call for UIAbility interaction involves two parts. +The implementation of using the call for UIAbility interaction involves two parts. -- [Creating a Callee Ability](#creating-a-callee-ability) +- [Creating a CalleeAbility](#creating-a-calleeability) -- [Accessing the Callee Ability](#accessing-the-callee-ability) +- [Accessing the CalleeAbility](#accessing-the-calleeability) -### Creating a Callee Ability +### Creating a CalleeAbility -For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. +For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. -1. Configure the ability launch type. - Set **launchType** of the callee ability to **singleton** in the **module.json5** file. +1. Configure the launch type of the UIAbility. + + Set **launchType** of the CalleeAbility to **singleton** in the **module.json5** file. | JSON Field| Description| | -------- | -------- | @@ -514,7 +516,8 @@ For the callee ability, implement the callback to receive data and the methods t ``` 3. Define the agreed parcelable data. - The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. + + The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string. ```ts @@ -542,7 +545,8 @@ For the callee ability, implement the callback to receive data and the methods t ``` 4. Implement **Callee.on** and **Callee.off**. - The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows: + + The time to register a listener for the CalleeAbility depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the UIAbility and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows: ```ts @@ -552,13 +556,13 @@ For the callee ability, implement the callback to receive data and the methods t function sendMsgCallback(data) { console.info('CalleeSortFunc called'); - // Obtain the parcelable data sent by the caller ability. + // Obtain the parcelable data sent by the CallerAbility. let receivedData = new MyParcelable(0, ''); data.readParcelable(receivedData); console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`); // Process the data. - // Return the parcelable data result to the caller ability. + // Return the parcelable data result to the CallerAbility. return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`); } @@ -582,7 +586,7 @@ For the callee ability, implement the callback to receive data and the methods t ``` -### Accessing the Callee Ability +### Accessing the CalleeAbility 1. Import the **UIAbility** module. @@ -591,11 +595,12 @@ For the callee ability, implement the callback to receive data and the methods t ``` 2. Obtain the caller interface. - The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. + + The **UIAbilityContext** attribute implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **UIAbilityContext**, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements. ```ts - // Register the onRelease() listener of the caller ability. + // Register the onRelease() listener of the CallerAbility. private regOnRelease(caller) { try { caller.on("release", (msg) => { diff --git a/en/application-dev/application-models/uiability-launch-type.md b/en/application-dev/application-models/uiability-launch-type.md index 19d7b73402e354027c1ff72ff4c2432dc56f8862..cf185cd9dad9593534afef59babe5cbf37585cae 100644 --- a/en/application-dev/application-models/uiability-launch-type.md +++ b/en/application-dev/application-models/uiability-launch-type.md @@ -77,9 +77,9 @@ The **specified** mode is used in some special scenarios. For example, in a docu ![uiability-launch-type2](figures/uiability-launch-type2.png) -For example, there are EntryAbility and SpecifiedAbility, and the launch type of SpecifiedAbility is set to **specified**. You are required to start SpecifiedAbility from EntryAbility. +For example, there are two UIAbility components: EntryAbility and SpecifiedAbility (with the launch type **specified**). You are required to start SpecifiedAbility from EntryAbility. -1. In SpecifiedAbility, set the **launchType** field in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **specified**. +1. In SpecifiedAbility, set the **launchType** field in the [module.json5 file](../quick-start/module-configuration-file.md) to **specified**. ```json { @@ -95,8 +95,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of } ``` -2. Before a UIAbility instance is created, you can create a unique string key for the instance. The key is bound to the UIAbility instance when it is created. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application is asked which UIAbility instance is used to respond to the [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) request. - In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instances. +2. Create a unique string key for the instance. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application, based on the key, identifies the UIAbility instance used to respond to the request. In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instance. ```ts // Configure an independent key for each UIAbility instance. @@ -114,7 +113,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of instanceKey: getInstance(), }, } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbility(want).then(() => { // ... }).catch((err) => { @@ -133,7 +132,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of // In the AbilityStage instance of the callee, a key value corresponding to a UIAbility instance is returned for UIAbility whose launch type is specified. // In this example, SpecifiedAbility of module1 is returned. if (want.abilityName === 'SpecifiedAbility') { - // The returned string key is a custom string. + // The returned key string is a custom string. return `SpecifiedAbilityInstance_${want.parameters.instanceKey}`; } @@ -147,16 +146,13 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of > 1. Assume that the application already has a UIAbility instance created, and the launch type of the UIAbility instance is set to **specified**. If [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called again to start the UIAbility instance, and the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) matches a created UIAbility instance, the original UIAbility instance is started, and no new UIAbility instance is created. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback is invoked, but the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks are not. > 2. AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md). - For example, in the document application, different key values are bound to different document instances. Each time a document is created, a new key value (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage. - + For example, in the document application, different keys are bound to different document instances. Each time a document is created, a new key (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage. + + The following steps are used as an example. -The following steps are used as an example. 1. Open file A. A UIAbility instance, for example, UIAbility instance 1, is started. - 2. Close the process of file A in **Recents**. UIAbility instance 1 is destroyed. Return to the home screen and open file A again. A new UIAbility instance is started, for example, UIAbility instance 2. - 3. Return to the home screen and open file B. A new UIAbility instance is started, for example, UIAbility instance 3. - 4. Return to the home screen and open file A again. UIAbility instance 2 is started. \ No newline at end of file diff --git a/en/application-dev/quick-start/arkts-rendering-control.md b/en/application-dev/quick-start/arkts-rendering-control.md index c59ee04dccef3411c25326851c446dcdd3f7164f..13904097ef69fc988fe3b1ed8d5a98714c38c2aa 100644 --- a/en/application-dev/quick-start/arkts-rendering-control.md +++ b/en/application-dev/quick-start/arkts-rendering-control.md @@ -256,7 +256,7 @@ struct MyComponent { this.data.pushData('/path/image' + this.data.totalCount() + '.png') }) }, item => item) - } + }.height('100%').width('100%') } } ``` diff --git a/en/application-dev/quick-start/arkts-restrictions-and-extensions.md b/en/application-dev/quick-start/arkts-restrictions-and-extensions.md index fa62ed392100f7ff0b60dcc6e8ee66ef465fbb3a..1c1a9a2ed4066f2d55badd2a02e0421a9a01f09b 100644 --- a/en/application-dev/quick-start/arkts-restrictions-and-extensions.md +++ b/en/application-dev/quick-start/arkts-restrictions-and-extensions.md @@ -83,7 +83,7 @@ struct bindPopupPage { } ``` - ![datePicker](../../application-dev/reference/arkui-ts/figures/datePicker.gif) + ![datePicker](figures/restrictions-data-type-declarations.gif) 2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types. @@ -232,3 +232,26 @@ struct Child { } } ``` + +## Restrictions on Naming Custom Components, Classes, and Functions + +The name of a custom component, class, or function cannot be the same as any system component name. + +Example: + +``` +// Rect.ets +export class Rect { + constructor(){} +} +// Index.ets +// ERROR: The module name 'Rect' can not be the same as the inner component name. +import { Rect } from './Rect'; +@Entry +@Component +struct Index { + build() { + + } +} +``` diff --git a/en/application-dev/quick-start/figures/restrictions-data-type-declarations.gif b/en/application-dev/quick-start/figures/restrictions-data-type-declarations.gif new file mode 100644 index 0000000000000000000000000000000000000000..52ee9ca7eb42b521cf879e364c95694ca698b834 Binary files /dev/null and b/en/application-dev/quick-start/figures/restrictions-data-type-declarations.gif differ diff --git a/en/application-dev/reference/apis/commonEventManager-definitions.md b/en/application-dev/reference/apis/commonEventManager-definitions.md index c2fafb52cf98e900836e5a583e4cc2ef5172974b..ea6015bbfa79bdc5ee49c00dffce5a9098e2091c 100644 --- a/en/application-dev/reference/apis/commonEventManager-definitions.md +++ b/en/application-dev/reference/apis/commonEventManager-definitions.md @@ -11,7 +11,7 @@ Indicates that the user has finished booting and the system has been loaded. - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED ## COMMON_EVENT_LOCKED_BOOT_COMPLETED -(Reserved, not supported yet) Indicates that the user has finished booting and the system has been loaded but the screen is still locked. +(Deprecated) Indicates that the user has finished booting and the system has been loaded but the screen is still locked. - Value: **usual.event.LOCKED_BOOT_COMPLETED** - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED @@ -59,14 +59,14 @@ Indicates that the device screen is on and the device is in interactive state. - Required subscriber permissions: none -## COMMON_EVENT_THERMAL_LEVEL_CHANGED8+ +## COMMON_EVENT_THERMAL_LEVEL_CHANGED Indicates that the device's thermal level has changed. - Value: **usual.event.THERMAL_LEVEL_CHANGED** - Required subscriber permissions: none ## COMMON_EVENT_USER_PRESENT -(Reserved, not supported yet) Indicates that the user unlocks the device. +(Deprecated) Indicates that the user unlocks the device. - Value: **usual.event.USER_PRESENT** - Required subscriber permissions: none @@ -84,7 +84,7 @@ Indicates that the system time is set. ## COMMON_EVENT_DATE_CHANGED -(Reserved, not supported yet) Indicates that the system date has changed. +(Deprecated) Indicates that the system date has changed. - Value: **usual.event.DATE_CHANGED** - Required subscriber permissions: none @@ -96,7 +96,7 @@ Indicates that the system time zone has changed. ## COMMON_EVENT_CLOSE_SYSTEM_DIALOGS -(Reserved, not supported yet) Indicates that the user closes a temporary system dialog box. +(Deprecated) Indicates that the user closes a temporary system dialog box. - Value: **usual.event.CLOSE_SYSTEM_DIALOGS** - Required subscriber permissions: none @@ -108,13 +108,13 @@ Indicates that a new application package has been installed on the device. ## COMMON_EVENT_PACKAGE_REPLACED -(Reserved, not supported yet) Indicates that a later version of an installed application package has replaced the previous one on the device. +(Deprecated) Indicates that a later version of an installed application package has replaced the previous one on the device. - Value: **usual.event.PACKAGE_REPLACED** - Required subscriber permissions: none ## COMMON_EVENT_MY_PACKAGE_REPLACED -(Reserved, not supported yet) Indicates that a later version of your application package has replaced the previous one. +(Deprecated) Indicates that a later version of your application package has replaced the previous one. - Value: **usual.event.MY_PACKAGE_REPLACED** - Required subscriber permissions: none @@ -125,13 +125,13 @@ Indicates that an installed application has been uninstalled from the device wit ## COMMON_EVENT_BUNDLE_REMOVED -(Reserved, not supported yet) Indicates that an installed bundle has been uninstalled from the device with the application data retained. +(Deprecated) Indicates that an installed bundle has been uninstalled from the device with the application data retained. - Value: **usual.event.BUNDLE_REMOVED** - Required subscriber permissions: none ## COMMON_EVENT_PACKAGE_FULLY_REMOVED -(Reserved, not supported yet) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device. +(Deprecated) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device. - Value: **usual.event.PACKAGE_FULLY_REMOVED** - Required subscriber permissions: none @@ -161,79 +161,79 @@ Indicates that the user cleared the application package cache. ## COMMON_EVENT_PACKAGES_SUSPENDED -(Reserved, not supported yet) Indicates that application HAP files are suspended. +(Deprecated) Indicates that application HAP files are suspended. - Value: **usual.event.PACKAGES_SUSPENDED** - Required subscriber permissions: none ## COMMON_EVENT_PACKAGES_UNSUSPENDED -(Reserved, not supported yet) Indicates that application HAP files are not suspended (restored from the suspended state). +(Deprecated) Indicates that application HAP files are not suspended (restored from the suspended state). - Value: **usual.event.PACKAGES_UNSUSPENDED** - Required subscriber permissions: none ## COMMON_EVENT_MY_PACKAGE_SUSPENDED -Indicates that an application HAP file is suspended. +(Deprecated) Indicates that an application HAP file is suspended. - Value: **usual.event.MY_PACKAGE_SUSPENDED** - Required subscriber permissions: none ## COMMON_EVENT_MY_PACKAGE_UNSUSPENDED -Indicates that an application HAP file is not suspended. +(Deprecated) Indicates that an application HAP file is not suspended. - Value: **usual.event.MY_PACKAGE_UNSUSPENDED** - Required subscriber permissions: none ## COMMON_EVENT_UID_REMOVED -(Reserved, not supported yet) Indicates that a user ID has been removed from the system. +(Deprecated) Indicates that a user ID has been removed from the system. - Value: **usual.event.UID_REMOVED** - Required subscriber permissions: none ## COMMON_EVENT_PACKAGE_FIRST_LAUNCH -(Reserved, not supported yet) Indicates that an installed application is started for the first time. +(Deprecated) Indicates that an installed application is started for the first time. - Value: **usual.event.PACKAGE_FIRST_LAUNCH** - Required subscriber permissions: none ## COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION -(Reserved, not supported yet) Indicates that an application requires system verification. +(Deprecated) Indicates that an application requires system verification. - Value: **usual.event.PACKAGE_NEEDS_VERIFICATION** - Required subscriber permissions: none ## COMMON_EVENT_PACKAGE_VERIFIED -(Reserved, not supported yet) Indicates that an application has been verified by the system. +(Deprecated) Indicates that an application has been verified by the system. - Value: **usual.event.PACKAGE_VERIFIED** - Required subscriber permissions: none ## COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE -(Reserved, not supported yet) Indicates that applications installed on the external storage are available for the system. +(Deprecated) Indicates that applications installed on the external storage are available for the system. - Value: **usual.event.EXTERNAL_APPLICATIONS_AVAILABLE** - Required subscriber permissions: none ## COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE -(Reserved, not supported yet) Indicates that applications installed on the external storage are not available for the system. +(Deprecated) Indicates that applications installed on the external storage are not available for the system. - Value: **usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE** - Required subscriber permissions: none ## COMMON_EVENT_CONFIGURATION_CHANGED -(Reserved, not supported yet) Indicates that the device state (for example, orientation and locale) has changed. +(Deprecated) Indicates that the device state (for example, orientation and locale) has changed. - Value: **usual.event.CONFIGURATION_CHANGED** - Required subscriber permissions: none ## COMMON_EVENT_LOCALE_CHANGED -(Reserved, not supported yet) Indicates that the device locale has changed. +(Deprecated) Indicates that the device locale has changed. - Value: **usual.event.LOCALE_CHANGED** - Required subscriber permissions: none ## COMMON_EVENT_MANAGE_PACKAGE_STORAGE -(Reserved, not supported yet) Indicates that the device storage is insufficient. +(Deprecated) Indicates that the device storage is insufficient. - Value: **usual.event.MANAGE_PACKAGE_STORAGE** - Required subscriber permissions: none @@ -245,31 +245,31 @@ Indicates that an application HAP file is not suspended. ## COMMON_EVENT_HOME_MODE -(Reserved, not supported yet) Indicates that the system is in home mode. +(Deprecated) Indicates that the system is in home mode. - Value: **common.event.HOME_MODE** - Required subscriber permissions: none ## COMMON_EVENT_OFFICE_MODE -(Reserved, not supported yet) Indicates that the system is in office mode. +(Deprecated) Indicates that the system is in office mode. - Value: **common.event.OFFICE_MODE** - Required subscriber permissions: none ## COMMON_EVENT_USER_STARTED -(Reserved, not supported yet) Indicates that the user has been started. +(Deprecated) Indicates that the user has been started. - Value: **usual.event.USER_STARTED** - Required subscriber permissions: none ## COMMON_EVENT_USER_BACKGROUND -(Reserved, not supported yet) Indicates that the user has been brought to the background. +(Deprecated) Indicates that the user has been brought to the background. - Value: **usual.event.USER_BACKGROUND** - Required subscriber permissions: none ## COMMON_EVENT_USER_FOREGROUND -(Reserved, not supported yet) Indicates that the user has been brought to the foreground. +(Deprecated) Indicates that the user has been brought to the foreground. - Value: **usual.event.USER_FOREGROUND** - Required subscriber permissions: none @@ -281,7 +281,7 @@ Indicates that user switching is in progress. ## COMMON_EVENT_USER_STARTING -(Reserved, not supported yet) Indicates that the user is being started. +(Deprecated) Indicates that the user is being started. - Value: **usual.event.USER_STARTING** - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS @@ -293,13 +293,13 @@ Indicates that user switching is in progress. ## COMMON_EVENT_USER_STOPPING -(Reserved, not supported yet) Indicates that the user is going to be stopped. +(Deprecated) Indicates that the user is going to be stopped. - Value: **usual.event.USER_STOPPING** - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS ## COMMON_EVENT_USER_STOPPED -(Reserved, not supported yet) Indicates that the user has been stopped. +(Deprecated) Indicates that the user has been stopped. - Value: **usual.event.USER_STOPPED** - Required subscriber permissions: none @@ -474,7 +474,7 @@ Indicates that the Wi-Fi P2P group information has changed. ## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED -(Reserved, not supported yet) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated. +(Deprecated) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated. - Value: **usual.event.bluetooth.remotedevice.ACL_DISCONNECTED** - Required subscriber permissions: ohos.permission.USE_BLUETOOTH @@ -618,19 +618,19 @@ Indicates that the Wi-Fi P2P group information has changed. ## COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE -(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP Sink has changed. +(Deprecated) Indicates that the playing state of Bluetooth A2DP Sink has changed. - Value: **usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE** - Required subscriber permissions: ohos.permission.USE_BLUETOOTH ## COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE -(Reserved, not supported yet) Indicates that the audio state of Bluetooth A2DP Sink has changed. +(Deprecated) Indicates that the audio state of Bluetooth A2DP Sink has changed. - Value: **usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE** - Required subscriber permissions: ohos.permission.USE_BLUETOOTH ## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED -(Reserved, not supported yet) Indicates that the state of the device NFC adapter has changed. +Indicates that the state of the device NFC adapter has changed. - Value: **usual.event.nfc.action.ADAPTER_STATE_CHANGED** - Required subscriber permissions: none @@ -642,7 +642,7 @@ Indicates that the Wi-Fi P2P group information has changed. ## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED -(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the disabled state. +(Deprecated) Indicates that the NFC RF field is detected to be in the disabled state. - Value: **usual.event.nfc.action.RF_FIELD_OFF_DETECTED** - Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS @@ -659,7 +659,7 @@ Indicates that the system starts charging the battery. - Required subscriber permissions: none ## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED -(Reserved, not supported yet) Indicates that the system idle mode has changed. +(Deprecated) Indicates that the system idle mode has changed. - Value: **usual.event.DEVICE_IDLE_MODE_CHANGED** - Required subscriber permissions: none @@ -683,19 +683,19 @@ Indicates that a user has been removed from the system. ## COMMON_EVENT_ABILITY_ADDED -(Reserved, not supported yet) Indicates that an ability has been added. +(Deprecated) Indicates that an ability has been added. - Value: **usual.event.ABILITY_ADDED** - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE ## COMMON_EVENT_ABILITY_REMOVED -(Reserved, not supported yet) Indicates that an ability has been removed. +(Deprecated) Indicates that an ability has been removed. - Value: **usual.event.ABILITY_REMOVED** - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE ## COMMON_EVENT_ABILITY_UPDATED -(Reserved, not supported yet) Indicates that an ability has been updated. +(Deprecated) Indicates that an ability has been updated. - Value: **usual.event.ABILITY_UPDATED** - Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE @@ -707,67 +707,67 @@ Indicates that a user has been removed from the system. ## COMMON_EVENT_IVI_SLEEP -(Reserved, not supported yet) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode. +(Deprecated) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode. - Value: **common.event.IVI_SLEEP** - Required subscriber permissions: none ## COMMON_EVENT_IVI_PAUSE -(Reserved, not supported yet) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback. +(Deprecated) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback. - Value: **common.event.IVI_PAUSE** - Required subscriber permissions: none ## COMMON_EVENT_IVI_STANDBY -(Reserved, not supported yet) Requests a third-party application in the IVI system to pause the current work. +(Deprecated) Requests a third-party application in the IVI system to pause the current work. - Value: **common.event.IVI_STANDBY** - Required subscriber permissions: none ## COMMON_EVENT_IVI_LASTMODE_SAVE -(Reserved, not supported yet) Requests a third-party application in the IVI system to save its last mode. +(Deprecated) Requests a third-party application in the IVI system to save its last mode. - Value: **common.event.IVI_LASTMODE_SAVE** - Required subscriber permissions: none ## COMMON_EVENT_IVI_VOLTAGE_ABNORMAL -(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is abnormal. +(Deprecated) Indicates that the voltage of the vehicle's power system is abnormal. - Value: **common.event.IVI_VOLTAGE_ABNORMAL** - Required subscriber permissions: none ## COMMON_EVENT_IVI_HIGH_TEMPERATURE -(Reserved, not supported yet) Indicates that the temperature of the IVI system is high. +(Deprecated) Indicates that the temperature of the IVI system is high. - Value: **common.event.IVI_HIGH_TEMPERATURE** - Required subscriber permissions: none ## COMMON_EVENT_IVI_EXTREME_TEMPERATURE -(Reserved, not supported yet) Indicates that the temperature of the IVI system is extremely high. +(Deprecated) Indicates that the temperature of the IVI system is extremely high. - Value: **common.event.IVI_EXTREME_TEMPERATURE** - Required subscriber permissions: none ## COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL -(Reserved, not supported yet) Indicates that the IVI system is at an extreme temperature. +(Deprecated) Indicates that the IVI system is at an extreme temperature. - Value: **common.event.IVI_TEMPERATURE_ABNORMAL** - Required subscriber permissions: none ## COMMON_EVENT_IVI_VOLTAGE_RECOVERY -(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is restored to normal. +(Deprecated) Indicates that the voltage of the vehicle's power system is restored to normal. - Value: **common.event.IVI_VOLTAGE_RECOVERY** - Required subscriber permissions: none ## COMMON_EVENT_IVI_TEMPERATURE_RECOVERY -(Reserved, not supported yet) Indicates that the temperature of the IVI system is restored to normal. +(Deprecated) Indicates that the temperature of the IVI system is restored to normal. - Value: **common.event.IVI_TEMPERATURE_RECOVERY** - Required subscriber permissions: none ## COMMON_EVENT_IVI_ACTIVE -(Reserved, not supported yet) Indicates that the battery service of the IVI system is active. +(Deprecated) Indicates that the battery service of the IVI system is active. - Value: **common.event.IVI_ACTIVE** - Required subscriber permissions: none @@ -809,37 +809,37 @@ Indicates that a USB device has been detached from the device functioning as a U ## COMMON_EVENT_DISK_REMOVED -(Reserved, not supported yet) Indicates that an external storage device was removed. +(Deprecated) Indicates that an external storage device was removed. - Value: **usual.event.data.DISK_BAD_REMOVAL** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER ## COMMON_EVENT_DISK_UNMOUNTED -(Reserved, not supported yet) Indicates that an external storage device was unmounted. +(Deprecated) Indicates that an external storage device was unmounted. - Value: **usual.event.data.DISK_UNMOUNTABLE** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER ## COMMON_EVENT_DISK_MOUNTED -(Reserved, not supported yet) Indicates that an external storage device was mounted. +(Deprecated) Indicates that an external storage device was mounted. - Value: **usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER ## COMMON_EVENT_DISK_BAD_REMOVAL -(Reserved, not supported yet) Indicates that an external storage device was removed without being unmounted. +(Deprecated) Indicates that an external storage device was removed without being unmounted. - Value: usual.event.data.DISK_REMOVED - Required subscriber permissions: ohos.permission.STORAGE_MANAGER ## COMMON_EVENT_DISK_UNMOUNTABLE -(Reserved, not supported yet) Indicates that an external storage device is unmountable when the card is inserted. +(Deprecated) Indicates that an external storage device is unmountable when the card is inserted. - Value: **usual.event.data.DISK_UNMOUNTED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER ## COMMON_EVENT_DISK_EJECT -(Reserved, not supported yet) Indicates that an external storage device was ejected (at the software level). +(Deprecated) Indicates that an external storage device was ejected (at the software level). - Value: **usual.event.data.DISK_EJECT** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER @@ -875,19 +875,19 @@ Indicates that an external storage device was ejected (at the software level). ## COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED -(Reserved, not supported yet) Indicates that the account visibility changed. +(Deprecated) Indicates that the account visibility changed. - Value: **usual.event.data.VISIBLE_ACCOUNTS_UPDATED** - Required subscriber permissions: ohos.permission.GET_APP_ACCOUNTS ## COMMON_EVENT_ACCOUNT_DELETED -(Reserved, not supported yet) Indicates that an account was deleted. +(Deprecated) Indicates that an account was deleted. - Value: **usual.event.data.ACCOUNT_DELETED** - Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS ## COMMON_EVENT_FOUNDATION_READY -(Reserved, not supported yet) Indicates that the foundation is ready. +(Deprecated) Indicates that the foundation is ready. - Value: **usual.event.data.FOUNDATION_READY** - Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index fdaa1f97d9d7d0f51e17feae64c632ba7eb11b9d..db559d0ef3d858958e0353a13baa14f684201158 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -684,21 +684,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+ @@ -1106,7 +1104,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 @@ -1142,7 +1140,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 @@ -1368,7 +1366,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 @@ -1400,7 +1398,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 @@ -1560,7 +1558,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 @@ -1595,7 +1593,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 @@ -1997,13 +1996,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](#on9) in **AudioVolumeManager**. Subscribes to system volume change events. @@ -2018,7 +2017,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** @@ -2116,7 +2115,7 @@ audioManager.off('deviceChange', (deviceChanged) => { }); ``` -### on('interrupt')(deprecated) +### on('interrupt') on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\): void @@ -2124,10 +2123,6 @@ Subscribes to audio interruption events. When the application's audio is interru Same as [on('audioInterrupt')](#onaudiointerrupt9), this API is used to listen for focus changes. However, this API is used in scenarios without audio streams (no **AudioRenderer** instance is created), such as frequency modulation (FM) and voice wakeup. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.Audio.Renderer **Parameters** @@ -2158,16 +2153,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { }); ``` -### off('interrupt')(deprecated) +### off('interrupt') off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\): void Unsubscribes from audio interruption events. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.Audio.Renderer **Parameters** @@ -2332,7 +2323,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** @@ -3940,12 +3931,13 @@ 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** @@ -3998,12 +3990,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** @@ -4097,7 +4090,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 | Yes | 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 | @@ -4950,18 +4943,18 @@ audioRenderer.setVolume(0.5, (err, data)=>{ on(type: 'audioInterrupt', callback: Callback\): void -Subscribes to audio interruption events. This API uses a callback to get interrupt events. +Subscribes to audio interruption events. This API uses a callback to obtain interrupt events. -Same as [on('interrupt')](#oninterruptdeprecated), this API has obtained the focus before **start**, **pause**, or **stop** of **AudioRenderer** is called. Therefore, you do not need to request the focus. +Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioRenderer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus. **System capability**: SystemCapability.Multimedia.Audio.Interrupt **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio playback is interrupted. | -| callback | Callback<[InterruptEvent](#interruptevent9)> | Yes | Callback used to return the audio interruption event. | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | +| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio playback is interrupted. | +| callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. | **Error codes** @@ -4969,7 +4962,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** @@ -6111,7 +6104,7 @@ Describes the callback invoked for audio interruption or focus gain events. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [InterruptEvent](#interruptevent9). **System capability**: SystemCapability.Multimedia.Audio.Renderer diff --git a/en/application-dev/reference/apis/js-apis-curve.md b/en/application-dev/reference/apis/js-apis-curve.md index 57429452128ed66558b340473c88aacddfb88b59..c5a95f48d331f665d89a8fd5449315ee4502046b 100644 --- a/en/application-dev/reference/apis/js-apis-curve.md +++ b/en/application-dev/reference/apis/js-apis-curve.md @@ -35,7 +35,6 @@ Implements initialization for the interpolation curve, which is used to create a | ---------------------------------- | ---------------- | | [ICurve](#icurve) | Interpolation curve.| - **Example** ```ts @@ -57,7 +56,7 @@ Creates a step curve. | Name| Type | Mandatory| Description | | ------ | ------- | ----| ------------------------------------------------------------ | -| count | number | Yes | Number of steps. The value must be a positive integer. | +| count | number | Yes | Number of steps. The value must be a positive integer.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.| | end | boolean | Yes | Whether jumping occurs when the interpolation ends.
- **true**: Jumping occurs when the interpolation ends.
- **false**: Jumping occurs when the interpolation starts.| **Return value** @@ -66,7 +65,6 @@ Creates a step curve. | ---------------------------------- | ---------------- | | [ICurve](#icurve) | Interpolation curve.| - **Example** ```ts @@ -85,12 +83,13 @@ Creates a cubic Bezier curve. The curve values must be between 0 and 1. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | -------------- | -| x1 | number | Yes | X coordinate of the first point on the Bezier curve.| -| y1 | number | Yes | Y coordinate of the first point on the Bezier curve.| -| x2 | number | Yes | X coordinate of the second point on the Bezier curve.| -| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.| + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| x1 | number | Yes | X coordinate of the first point on the Bezier curve.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| y1 | number | Yes | Y coordinate of the first point on the Bezier curve.
Value range: (-∞, +∞) | +| x2 | number | Yes | X coordinate of the second point on the Bezier curve.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.
Value range: (-∞, +∞) | **Return value** @@ -117,12 +116,12 @@ Creates a spring curve. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** -| Name | Type | Mandatory | Description | -| --------- | ------ | ---- | ----- | -| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| -| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| -| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| -| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | ------------------------------------------------------------ | +| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.
Value range: (-∞, +∞)| +| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| +| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| +| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| **Return value** @@ -149,18 +148,19 @@ Creates a spring animation curve. If multiple spring animations are applied to t **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** + | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| response | number | No | Duration of one complete oscillation, in seconds.
Default value: **0.55**| -| dampingFraction | number | No | Damping coefficient.
**0**: undamped. In this case, the spring oscillates forever.
> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.
**1**: critically damped.
> 1: overdamped. In this case, the spring approaches equilibrium gradually.
Default value: **0.825**| -| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.
Default value: **0**| +| response | number | No | Duration of one complete oscillation,
Default value: **0.55**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.55**.| +| dampingFraction | number | No | Damping coefficient.
**0**: undamped. In this case, the spring oscillates forever.
> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.
**1**: critically damped.
> 1: overdamped. In this case, the spring approaches equilibrium gradually.
Default value: **0.825**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.55**.| +| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.

Default value: **0**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0**.
The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Return value** | Type | Description | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| Curve.
Note: The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| +| [ICurve](#icurve)| Curve.
**NOTE**
The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Example** @@ -182,17 +182,18 @@ Creates a responsive spring animation curve. It is a special case of [springMoti **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** + | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| response | number | No | See **response** in **springMotion**. Default value: **0.15**| -| dampingFraction | number | No | See **dampingFraction** in **springMotion**. Default value: **0.86**| -| overlapDuration | number | No | See **overlapDuration** in **springMotion**. Default value: **0.25**| +| response | number | No | See **response** in **springMotion**.
Default value: **0.15**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.15**.| +| dampingFraction | number | No | See **dampingFraction** in **springMotion**.
Default value: **0.86**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.86**.| +| overlapDuration | number | No | See **overlapDuration** in **springMotion**.
Default value: **0.25**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.25**.
To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. In addition, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Return value** | Type | Description | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| Curve.
**NOTE**
1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| +| [ICurve](#icurve)| Curve.
**NOTE**
1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the **interpolate** function of the curve.| **Example** @@ -217,9 +218,9 @@ Since API version 9, this API is supported in ArkTS widgets. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | -------------------------------------------- | -| fraction | number | Yes | Current normalized time. The value ranges from 0 to 1.| +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| fraction | number | Yes | Current normalized time.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| **Return value** @@ -300,7 +301,7 @@ Creates a spring curve. This API is deprecated since API version 9. You are advi | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| +| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.| | mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| | stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| | damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md index 123602526ffa59a7af9f20c7ee7eb0775ffae0e6..b707f54df167497056052a8524ec00d7bbe11188 100644 --- a/en/application-dev/reference/apis/js-apis-matrix4.md +++ b/en/application-dev/reference/apis/js-apis-matrix4.md @@ -281,11 +281,11 @@ Translates this matrix object along the x, y, and z axes. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| x | number | No | Translation distance along the x-axis, in px.
Default value: **0**| -| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**| -| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ----------------------------------------------------------- | +| x | number | No | Translation distance along the x-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| **Return value** @@ -328,13 +328,13 @@ Scales this matrix object along the x, y, and z axes. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | --------------------------------- | -| x | number | No | Scaling multiple along the x-axis.
Default value: **1** | -| y | number | No | Scaling multiple along the y-axis.
Default value: **1** | -| z | number | No | Scaling multiple along the z-axis.
Default value: **1** | -| centerX | number | No | X coordinate of the center point.
Default value: **0**| -| centerY | number | No | Y coordinate of the center point.
Default value: **0**| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | ------------------------------------------------------------ | +| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| centerX | number | No | X coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | +| centerY | number | No | Y coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | **Return value** @@ -376,14 +376,14 @@ Rotates this matrix object along the x, y, and z axes. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | --------------------------------- | -| x | number | No | X coordinate of the rotation axis vector.
Default value: **1** | -| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1** | -| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1** | -| angle | number | No | Rotation angle.
Default value: **0** | -| centerX | number | No | X coordinate of the center point.
Default value: **0**| -| centerY | number | No | Y coordinate of the center point.
Default value: **0**| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | ------------------------------------------------------- | +| x | number | No | X coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| angle | number | No | Rotation angle.
Default value: **0** | +| centerX | number | No | X coordinate of the center point.
Default value: **0** | +| centerY | number | No | Y coordinate of the center point.
Default value: **0** | **Return value** diff --git a/en/application-dev/reference/arkui-ts/figures/align.png b/en/application-dev/reference/arkui-ts/figures/align.png index ffabc26d3ee59984dda6cb375f8b18bb319b4fc7..5cdeb7cfd622b90a6fe52ef8cc94f187847d05b7 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/align.png and b/en/application-dev/reference/arkui-ts/figures/align.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.PNG b/en/application-dev/reference/arkui-ts/figures/animation.PNG deleted file mode 100644 index 92f92e0001a90840d03ebd00e0b0ef736c2a94c8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.gif b/en/application-dev/reference/arkui-ts/figures/animation.gif index 6cfbc07fc5122be3ecd69e6b33b6f00c0f676a0f..e1f1e9d8eedba5f4d7e9895fe10c1028cb8e19bd 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.gif and b/en/application-dev/reference/arkui-ts/figures/animation.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.PNG b/en/application-dev/reference/arkui-ts/figures/animation1.PNG deleted file mode 100644 index 98cc1fa8c0537071549fa8185fa14f7ad103e7f8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation1.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.gif b/en/application-dev/reference/arkui-ts/figures/animation1.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4fae00973755cc243e1d48f10acf9ef4b24682e Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/animation1.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif new file mode 100644 index 0000000000000000000000000000000000000000..da442c6a4f02d281bafff3f9fde8a51c6ebbf932 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif differ diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md index f22e531ac3a0f8423c9e8de5af520a92d2828d5f..11ce9d0312a22f1e9c432d99716319589b551d43 100644 --- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -14,13 +14,13 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Description | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | -| duration | number | No | Animation duration, in ms.
Default value: **1000**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used. | -| tempo | number | No | Animation playback speed. A greater value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**| -| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | No | Animation curve.
Default value: **Curve.Linear**
Since API version 9, this API is supported in ArkTS widgets. | -| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.
Default value: **0** | -| iterations | number | No | Number of times that the animation is played. The value **-1** indicates that the animation is played for an unlimited number of times.
Default value: **1**| +| duration | number | No | Animation duration, in ms.
Default value: **1000**
Unit: ms
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms.
- A value less than 1 evaluates to the value **0**.
- If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| +| tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**
**NOTE**
A value less than 1 evaluates to the value **1**.| +| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | No | Animation curve. The default curve is linear.
Default value: **Curve.Linear**
Since API version 9, this API is supported in ArkTS widgets.| +| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.
Default value: **0**
Value range: [0, +∞)
**NOTE**
A value less than 1 evaluates to the value **0**. If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| +| iterations | number | No | Number of times that the animation is played.
Default value: **1**
Value range: [-1, +∞)
**NOTE**
The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.| | playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**
Since API version 9, this API is supported in ArkTS widgets.| -| onFinish | () => void | No | Callback invoked when the animation playback is complete.
Since API version 9, this API is supported in ArkTS widgets.| +| onFinish | () => void | No | Callback invoked when the animation playback is complete.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This callback is not invoked when **iterations** is set to **-1**.| ## Example @@ -37,11 +37,11 @@ struct AttrAnimationExample { build() { Column() { - Button('change width and height') + Button('change size') .onClick(() => { if (this.flag) { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 } else { this.widthSize = 250 this.heightSize = 100 @@ -67,8 +67,8 @@ struct AttrAnimationExample { duration: 1200, curve: Curve.Friction, delay: 500, - iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse + iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. + playMode: PlayMode.Alternate }) }.width('100%').margin({ top: 20 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md index 967d9a0f35c6e5ee71a4ebe8a09ceaed21305c53..02df27c18b45a96f6f409cf498a8b91b93c4641e 100644 --- a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -237,8 +237,8 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Description | | ------ | -------------------------------------------------- | | All | The transition takes effect in all scenarios.| -| Insert | The transition takes effect when a component is inserted. | -| Delete | The transition takes effect when a component is deleted. | +| Insert | The transition takes effect when a component is inserted or displayed.| +| Delete | The transition takes effect when a component is deleted or hidden.| ## RelateType @@ -307,12 +307,12 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Description | | -------- | ------------------------------------------------------------ | -| Auto | The default configuration in the flex container is used. | -| Start | The elements are in the flex container, top-aligned in the cross-axis direction. | -| Center | The elements are in the flex container, centered in the cross-axis direction. | -| End | The elements are in the flex container, bottom-aligned in the cross-axis direction. | -| Stretch | The elements are in the flex container, stretched and padded in the cross-axis direction. If the size is not set, the elements are stretched to the container size.| -| Baseline | The elements are in the flex container, text baseline aligned in the cross-axis direction. | +| Auto | The default configuration of the flex container is used. | +| Start | The items in the flex container are aligned with the cross-start edge. | +| Center | The items in the flex container are centered along the cross axis. | +| End | The items in the flex container are aligned with the cross-end edge. | +| Stretch | The items in the flex container are stretched and padded along the cross axis. If the flex container has the **Wrap** attribute set to **FlexWrap.Wrap** or **FlexWrap.WrapReverse**, the items are stretched to the cross size of the widest element on the current row or column. In other cases, the items with no size set are stretched to the container size.| +| Baseline | The items in the flex container are aligned in such a manner that their text baselines are aligned along the cross axis. | ## FlexDirection @@ -417,21 +417,21 @@ Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets. -| Name | Description | -| ------ | -------------- | -| Start | Aligned with the start.| -| Center | Horizontally centered.| -| End | Aligned with the end.| +| Name | Description | +| --------------------- | -------------- | +| Start | Aligned with the start.| +| Center | Horizontally centered.| +| End | Aligned with the end.| ## TextOverflow Since API version 9, this API is supported in ArkTS widgets. -| Name | Description | -| -------- | -------------------------------------- | -| Clip | Extra-long text is clipped. | -| Ellipsis | An ellipsis (...) is used to represent clipped text.| -| None | No clipping or ellipsis is used for extra-long text. | +| Name | Description | +| --------------------- | -------------------------------------- | +| Clip | Extra-long text is clipped. | +| Ellipsis | An ellipsis (...) is used to represent text overflow.| +| None | No clipping or ellipsis is used for text overflow. | ## TextDecorationType diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md index 75d67936b62bf0ac72456673ef1474e4840cb9fd..036deb4f97a0c1f02e72a62d4c2a15e38e4e4ba5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -25,10 +25,9 @@ Since API version 9, this API is supported in ArkTS widgets. | type | ButtonType | No | Button type.
Default value: **ButtonType.Capsule** | | stateEffect | boolean | No | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**| - **API 2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) - Creates a button component based on text content. In this case, the component cannot contain child components. +Creates a button component based on text content. In this case, the component cannot contain child components. Since API version 9, this API is supported in ArkTS widgets. @@ -39,15 +38,16 @@ Since API version 9, this API is supported in ArkTS widgets. | label | [ResourceStr](ts-types.md#resourcestr) | No | Button text. | | options | { type?: ButtonType, stateEffect?: boolean } | No | See parameters of API 1.| - ## Attributes +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + | Name | Type | Description | | ----------- | ----------- | --------------------------------- | | type | ButtonType | Button type.
Default value: **ButtonType.Capsule**
Since API version 9, this API is supported in ArkTS widgets.| | stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| -## ButtonType enums +## ButtonType Since API version 9, this API is supported in ArkTS widgets. @@ -58,11 +58,14 @@ Since API version 9, this API is supported in ArkTS widgets. | Normal | Normal button (without rounded corners by default). | > **NOTE** -> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a button-wide rounded corner setting is supported. -> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height. +> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a rounded corner whose parameter is [Length](ts-types.md#length) is supported. +> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and the radius of its rounded corner is always half of the button height or width, whichever is smaller. > - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller). > - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md). +> - Before setting the [gradient color](ts-universal-attributes-gradient-color.md), you need to set [backgroundColor](ts-universal-attributes-background.md) to transparent. + +The [universal events](ts-universal-events-click.md) are supported. ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index 08d913698286ee0cb2cbfbc66386cd4a52a45bc9..f65895eba487b20b68d4dc26f74f5c5493f3dccb 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -24,10 +24,20 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Description| | ----------------- | -------- | ----- | -------- | -| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. If the value is less than 0, the value 0 is used.| +| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. A value less than 0 evaluates to the value **0**. | | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.
- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.
Default value: **100**| | type8+ | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).
Default value: **DataPanelType.Circle**| +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ----------- | ------- | -------------------------------------------- | +| closeEffect | boolean | Whether to disable the rotation effect for the component.
Default value: **false**| + + + ## DataPanelType Since API version 9, this API is supported in ArkTS widgets. diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md index cee85008404560b115d9dc021ed98e59da47d36a..f4b378341d89b821c42ac0bfec8f47c0c023dc92 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md @@ -25,16 +25,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------- | ---------- | ------------------ | | vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.
**true**: A vertical divider is used.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | number \| string | Width of the divider.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.
Default value: **'\#33182431'**
Since API version 9, this API is supported in ArkTS widgets. | +| strokeWidth | number \| string | Width of the divider.
Default value: **1**
Unit: vp
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute cannot be set to a percentage. | | lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.
Default value: **LineCapStyle.Butt**
Since API version 9, this API is supported in ArkTS widgets.| -## Events - -The universal events are not supported. - - ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index a2162ebc684e42bd3f9cd9341fe18fd07505cb56..a53546a07c3a570f44824f72114f300ad8f60d3c 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -80,11 +80,11 @@ Since API version 9, this API is supported in ArkTS widgets. In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status.
Since API version 9, this API is supported in ArkTS widgets.| -| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
Since API version 9, this API is supported in ArkTS widgets.| -| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.
Since API version 9, this API is supported in ArkTS widgets.| +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status. The value **1** means that the image is successfully loaded, and **0** means the opposite.
Since API version 9, this API is supported in ArkTS widgets. | +| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
Since API version 9, this API is supported in ArkTS widgets. | +| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.
Since API version 9, this API is supported in ArkTS widgets. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index 8ae6b8443439678c5e10fda4c566edfa3037563b..85745ba42d26583d369fe5f652c756ae318440f5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md @@ -2,7 +2,7 @@ The **\** component is used to display a QR code. -> **NOTE** +> **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ## Events -Among all the universal events, only the [click event](ts-universal-events-click.md) is supported. +Among the universal events, the [click event](ts-universal-events-click.md), [touch event](ts-universal-events-touch.md), and [show/hide event](ts-universal-events-show-hide.md) are supported. ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md index d78f3a705501daf305b4d3ee01a33a57c568a6a0..eb3d4489f8cadd3df86f727fe68be24596b407ee 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md @@ -32,7 +32,7 @@ Since API version 9, this API is supported in ArkTS widgets. | -------- | -------- | -------- | | stars | number | Total number of stars.
Default value: **5**
Since API version 9, this API is supported in ArkTS widgets.| | stepSize | number | Step of an operation.
Default value: **0.5**
Since API version 9, this API is supported in ArkTS widgets.| -| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | **backgroundUri**: image link of the unselected star. You can use the default image or a custom local image.
**foregroundUri**: image path of the selected star. You can use the default image or a custom local image.
**secondaryUir**: image path of the partially selected star. You can use the default image or a custom local image.
Since API version 9, this API is supported in ArkTS widgets.| +| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | Star style.
**backgroundUri**: image path for the unselected star. You can use the default system image or a custom image.
**foregroundUri**: image path for the selected star. You can use the default system image or a custom image.
**secondaryUir**: image path for the partially selected star. You can use the default system image or a custom image.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
For details about the image types supported by the **startStyle** attribute, see [Image](ts-basic-components-image.md).
Local and online images are supported, but not **PixelMap** and **Resource** objects.
By default, the image is loaded in asynchronous mode. Synchronous loading is not supported.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md index bea534a1a1861e1ad2183d0ed1455127f762c65c..d16baa17d64de593d8f559d5de19ed5ded17ab30 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -50,7 +50,7 @@ Except touch target attributes, the universal attributes are supported. | trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.
Since API version 9, this API is supported in ArkTS widgets.| | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.
Since API version 9, this API is supported in ArkTS widgets.| | showSteps | boolean | Whether to display the current step.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
When **direction** is set to **Axis.Horizontal**, the bubble is displayed right above the slider. When **direction** is set to **Axis.Vertical**, the bubble is displayed on the left of the slider.
The drawing area of the bubble is the overlay of the slider.
If no margin is set for the slider or the margin is not large enough, the bubble will be clipped.| | trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.
Since API version 9, this API is supported in ArkTS widgets.| @@ -60,7 +60,7 @@ In addition to the **OnAppear** and **OnDisAppear** universal events, the follow | Name| Description| | -------- | -------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider slides.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: dragging state.
Since API version 9, this API is supported in ArkTS widgets.| +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider is dragged or clicked.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: state triggered by the event.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The **Begin** and **End** states are triggered when the slider is clicked with a gesture. The **Moving** and **Click** states are triggered when the value of **value** changes.
If the coherent action is a drag action, the **Click** state will not be triggered.
The value range of **value** is the **steps** value array.| ## SliderChangeMode @@ -68,9 +68,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Value| Description| | -------- | -------- | -------- | -| Begin | 0 | The user starts to drag the slider.| +| Begin | 0 | The user touches or presses the slider with a gesture or mouse.| | Moving | 1 | The user is dragging the slider.| -| End | 2 | The user stops dragging the slider.| +| End | 2 | The user stops dragging the slider by lifting their finger or releasing the mouse.| | Click | 3 | The user moves the slider by touching the slider track.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index e4b6ba1ad47c9e06f3f26e6b47f4afd505b6aa36..48970be3a76da10962f6a1576dcc5d25750b1469 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -38,6 +38,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 8 vp, left: 16 vp } + ## Events @@ -72,7 +76,6 @@ Sets the position of the caret. | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| - ## Example ```ts @@ -86,6 +89,7 @@ struct TextAreaExample { build() { Column() { TextArea({ + text: this.text, placeholder: 'The text area can hold an unlimited amount of text. input your word...', controller: this.controller }) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index aef50da2fed1f32ad0ceb82aecbf7006fcbae009..b77cb3e53a6136c6dc4d407efcb9ed14dc390f2e 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -31,18 +31,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ------------------------ | ---------------------------------------- | ---------------------------------------- | -| type | InputType | Input box type.
Default value: **InputType.Normal** | +| type | InputType | Input box type.
Default value: **InputType.Normal** | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.| | placeholderFont | [Font](ts-types.md#font) | Placeholder text font.| -| enterKeyType | EnterKeyType | Type of the Enter key. Currently, only the default value is supported.
Default value: **EnterKeyType.Done**| +| enterKeyType | EnterKeyType | Type of the Enter key. Only the default value is supported.
Default value: **EnterKeyType.Done**| | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | maxLength | number | Maximum number of characters in the text input. | -| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| +| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | showPasswordIcon9+ | boolean | Whether to display the show password icon at the end of the password text box.
Default value: **true**| | style9+ | TextInputStyle | Text input style.
Default value: **TextInputStyle.Default**| | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.
Default value: **TextAlign.Start** | +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 8 vp,
right: 16 vp,
bottom: 16 vp,
left: 8 vp
} + ## EnterKeyType | Name | Description | @@ -74,12 +78,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name | Description | -| ---------------------------------------- | ---------------------------------------- | -| onChange(callback: (value: string) => void) | Triggered when the input changes. | -| onSubmit(callback: (enterKey: EnterKeyType) => void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key. | -| onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | Triggered when the input status changes. Sicne API version 8, **onEditChange** is recommended. | -| onEditChange(callback: (isEditing: boolean) => void)8+ | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. | +| Name | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| onChange(callback: (value: string) => void) | Triggered when the input changes.
**value**: text content.| +| onSubmit(callback: (enterKey: EnterKeyType) => void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.
**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).| +| onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.| +| onEditChange(callback: (isEditing: boolean) => void)8+ | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. | | onCopy(callback:(value: string) => void)8+ | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be copied.| | onCut(callback:(value: string) => void)8+ | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be cut.| | onPaste(callback:(value: string) => void)8+ | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be pasted.| @@ -104,7 +108,6 @@ Sets the position of the caret. | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| - ## Example ```ts @@ -117,7 +120,7 @@ struct TextInputExample { build() { Column() { - TextInput({ placeholder: 'input your word...', controller: this.controller }) + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) .placeholderColor(Color.Grey) .placeholderFont({ size: 14, weight: 400 }) .caretColor(Color.Blue) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index 7c3994074a9bf4124800346196515150f020ffc6..17aba7ea6f738561443a049ec3e0e54674fa3f4c 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -35,21 +35,23 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Description | | -------- | ---------------- | -| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right: 6 vp,
bottom: 14 vp,
left: 6 vp
} | +| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | | Button | Button type. The set string, if any, will be displayed inside the button. | -| Switch | Switch type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | - +| Switch | Switch type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right:6 vp,
bottom: 6 vp,
left: 14 vp
} | ## Attributes +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + | Name | Parameter | Description | | ---------------- | --------------------------- | ---------------------- | | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component when it is turned on.
Since API version 9, this API is supported in ArkTS widgets.| | switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the circular slider when the component is of the **Switch** type.
**NOTE**
This attribute is valid only when **type** is set to **ToggleType.Switch**.
Since API version 9, this API is supported in ArkTS widgets.| - ## Events +In addition to the [universal events](ts-universal-events-click.md), the following events are supported. + | Name| Description| | -------- | -------- | | onChange(callback: (isOn: boolean) => void) | Triggered when the toggle status changes.
Since API version 9, this API is supported in ArkTS widgets.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md index 4b8520cfa0e7a2b173eda68caa17d379f5c42759..e1e0af8f5fa486e762f569c7a9f1f628147f9e64 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md @@ -17,7 +17,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.
Default value: **1**| +| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.
Default value: **1**
Value range: 1 to 10
**NOTE**
If the value is less than 1 or is not set, the default value is used.| | direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&) and OR (\|) operations.
Default value: **PanDirection.All**| | distance | number | No| Minimum pan distance to trigger the gesture, in vp.
Default value: **5**
**NOTE**
If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md index 03109744f1cdc09ed7b2d9f7d7687db8944f602f..ef9a851b418959eeb04ed06675815d82a9bd7dc4 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md @@ -1,6 +1,6 @@ # TapGesture -**TapGesture** is used to trigger a tap gesture with one or more taps. +**TapGesture** is used to trigger a tap gesture with one, two, or more taps. > **NOTE** > @@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number }) | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| count | number | No| Number of consecutive taps. If this parameter is set to a value less than **1**, the default value will be used.
Default value: **1**
> **NOTE**
> If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.| -| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10.
Default value: **1**
> **NOTE**
> 1. When multi-finger is configured, the gesture will fail to be recognized if the number of fingers used for tapping is less than the configured number within 300 ms of tapping by the first finger.
> 2. The gesture will fail to be recognized if the number of fingers used for tapping exceeds the configured number.| +| count | number | No| Number of consecutive taps. If the value is less than 1 or is not set, the default value is used.
Default value: **1**
**NOTE**
If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.| +| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value is used.
Default value: **1**
**NOTE**
1. When multi-finger is configured, if the number of fingers used for tap does not reach the specified number within 300 ms after the first finger is tapped, the gesture fails to be recognized.
2. Gesture recognition fails if the number of fingers used for tap exceeds the configured number.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-container-flex.md b/en/application-dev/reference/arkui-ts/ts-container-flex.md index 6a5908578950850fbedda096b33f03c858097cd0..327533e907cef5e8b76dcba472e1258d164e252e 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/en/application-dev/reference/arkui-ts/ts-container-flex.md @@ -6,6 +6,7 @@ The **\** component allows for flexible layout of child components. > > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\](ts-container-column.md)** or **[\](ts-container-row.md)** instead under scenarios where consistently high performance is required. +> - If the main axis of the **\** component is not set, it follows the size of the parent container. On the contrary, if the main axis of the [\](ts-container-column.md) or [\](ts-container-row.md) component is not set, it follows the size of their child component. ## Child Components diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md index 1cee9be56077b524b2bb71e098336701e7dd9593..3e756f519e74b7f851b3af2401e7272eb133a4a9 100644 --- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -42,7 +42,7 @@ struct AnimateToExample { build() { Column() { - Button('change width and height') + Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) @@ -57,8 +57,8 @@ struct AnimateToExample { console.info('play end') } }, () => { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 }) } else { animateTo({}, () => { @@ -77,7 +77,7 @@ struct AnimateToExample { curve: Curve.Friction, delay: 500, iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse, + playMode: PlayMode.Alternate, onFinish: () => { console.info('play end') } @@ -90,10 +90,4 @@ struct AnimateToExample { } ``` -The figure below shows two buttons in their initial state. - -![animation](figures/animation.PNG) - -Clicking the first button plays the animation of resizing the button, and clicking the second button plays the animation of rotating the button clockwise by 90 degrees. The figure below shows the two buttons when the animations have finished. - -![animation1](figures/animation1.PNG) +![animation1](figures/animation1.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md index feb0d96571dd263205252f8c849b5a0f6ee967b1..0c143bd234578db616fb7a86fccca80cb592b983 100644 --- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -118,9 +118,9 @@ Requests full-screen mode. **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------- | ---- | --------------------- | -| value | boolean | Yes | Whether the playback is in full-screen mode.
Default value: **false**| +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | -------------------------------------------------- | +| value | boolean | Yes | Whether to play the video in full screen mode within the application window.
Default value: **false**| ### exitFullscreen @@ -173,7 +173,7 @@ struct VideoCreateComponent { previewUri: this.previewUri, currentProgressRate: this.curRate, controller: this.controller - }).width(800).height(600) + }).width('100%').height(600) .autoPlay(this.isAutoPlay) .controls(this.showControls) .onStart(() => { @@ -186,7 +186,7 @@ struct VideoCreateComponent { console.info('onFinish') }) .onError(() => { - console.info('onFinish') + console.info('onError') }) .onPrepared((e) => { console.info('onPrepared is ' + e.duration) diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md index f32762ea1dd342ff52e4ff80c4bc7fb4245b6137..fd98aadd3525b1d6d37262125bdc544833e9d129 100644 --- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -11,7 +11,7 @@ The motion path animation is used to animate a component along a custom path. | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path. The default value is **0.0**.
- **to**: end point of the motion path. The default value is **1.0**.
- **rotatable**: whether to rotate along the path. | +| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path.
Default value: **0.0**
Value range: [0, 1]
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.
- **to**: end point of the motion path.
Default value: **1.0**
Value range: [0, 1]
A value less than 0 evaluates to the value **0**. A value larger than 1 evaluates to the value **1**.
- **rotatable**: whether to rotate along the path. | ## Example @@ -25,7 +25,7 @@ struct MotionPathExample { build() { Column() { - Button('click me') + Button('click me').margin(50) // Execute the animation: Move from the start point to (300,200), then to (300,500), and finally to the end point. .motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true }) .onClick(() => { @@ -38,4 +38,4 @@ struct MotionPathExample { } ``` -![en-us_image_0000001212378420](figures/en-us_image_0000001212378420.gif) +![en-us_image_0000001174104400](figures/en-us_image_0000001174104400.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md index fe419d713fe257eb593064363f8e1e8d1afe0e92..5cd36a45df7a1b6720be03d6ca9fe59d5f555cbf 100644 --- a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md @@ -1,6 +1,6 @@ # Page Transition -The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the global **pageTransition** API. +The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the **pageTransition** API. > **NOTE** > @@ -8,12 +8,12 @@ The page transition navigates users between pages. You can customize page transi > -| Name | Parameter | Description | -| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | Page entrance animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".
Default value: **Curve.Linear**
- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| -| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | Page exit animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.
Default value: **Curve.Linear**
- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| +| Name | Parameter | Mandatory| Description | +| ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | No | Page entrance animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**NOTE**
If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration.
Unit: ms
- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".
Default value: **Curve.Linear**
- **delay**: animation delay.
Default value: **0**
Unit: ms| +| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | No | Page exit animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**NOTE**
If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.
Default value: **Curve.Linear**
- **delay**: animation delay.
Default value: **0**
Unit: ms| -## RouteType enums +## RouteType | Name| Description | | ---- | ------------------------------------------------------------ | @@ -28,7 +28,7 @@ The page transition navigates users between pages. You can customize page transi | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | slide | [SlideEffect](#slideeffect) | No | Slide effect during page transition.
Default value: **SlideEffect.Right**| | translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default.
- **x**: translation distance along the x-axis.
- **y**: translation distance along the y-axis.
- **z**: translation distance along the y-axis.| -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.
- **x**: scale ratio along the x-axis.
- **y**: scale ratio along the y-axis.
- **z**: scale ratio along the z-axis.
- **centerX** and **centerY**: scale center point.
- If the center point is 0, it refers to the upper left corner of the component.
| +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.
- **x**: scale ratio along the x-axis.
- **y**: scale ratio along the y-axis.
- **z**: scale ratio along the z-axis.
- **centerX** and **centerY**: scale center point.
- If the center point is 0, it refers to the upper left corner of the component. | | opacity | number | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit.
Default value: **1**| ## SlideEffect @@ -43,10 +43,10 @@ The page transition navigates users between pages. You can customize page transi ## Events -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onEnter(event: (type?: RouteType, progress?: number) => void) | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress.| -| onExit(event: (type?: RouteType, progress?: number) => void) | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress.| +| onEnter(event: (type?: RouteType, progress?: number) => void) | Invoked once every animation frame until the entrance animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress. | +| onExit(event: (type?: RouteType, progress?: number) => void) | Invoked once every animation frame until the exit animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current exit animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md index 7c62710b64759d42e205eb91b010fb50e478e108..cd072648a81f68b080ae88b9a90cf6a157376dc6 100644 --- a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md +++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md @@ -12,17 +12,17 @@ Configure the component transition animations for when a component is inserted o | Name| Type| Description| | -------- | -------- | -------- | -| transition | TransitionOptions | Transition parameters, which are all optional. For details, see **TransitionOptions**.| +| transition | TransitionOptions | Transition effects when the component is inserted, displayed, deleted, or hidden.
If no transition effect is set, an opacity transition from 0 to 1 is applied.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
Transition parameters, which are all optional. For details, see **TransitionOptions**.| ## TransitionOptions | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.
Default value: **TransitionType.All**
**NOTE**
If **type** is not specified, insertion and deletion use the same transition type.| -| opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.
Default value: **1**| -| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
-**x**: distance to translate along the x-axis.
-**y**: distance to translate along the y-axis.
-**z**: distance to translate along the z-axis.| -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: scale factor along the x-axis.
- **y**: scale factor along the y-axis.
- **z**: scale factor along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.
- If the center point is 0, it indicates the upper left corner of the component.
| -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: rotation vector along the x-axis.
- **y**: rotation vector along the y-axis.
- **z**: rotation vector along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.
- If the center point is (0, 0), it indicates the upper left corner of the component.| +| type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.
Default value: **TransitionType.All**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If **type** is not specified, insertion and deletion use the same transition type.| +| opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.
Default value: **1**
Value range: [0, 1]
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
-**x**: distance to translate along the x-axis.
-**y**: distance to translate along the y-axis.
-**z**: distance to translate along the z-axis.
Since API version 9, this API is supported in ArkTS widgets.| +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: scale factor along the x-axis.
- **y**: scale factor along the y-axis.
- **z**: scale factor along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.
- If the center point is 0, it indicates the upper left corner of the component.
Since API version 9, this API is supported in ArkTS widgets.| +| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: rotation vector along the x-axis.
- **y**: rotation vector along the y-axis.
- **z**: rotation vector along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.
- If the center point is (0, 0), it indicates the upper left corner of the component.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md index cd3f67300cfa8b63bac83b973dcb404590426d27..2fcbfe67f010ea80ca278932bf4210074d438878 100644 --- a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md +++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md @@ -1,6 +1,6 @@ -# Transition of Shared Elements +# Shared Element Transition -Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page. +A shared element transition is a transition animation applied to a component that is present on two pages. This component is called the shared element and can be set in the **sharedTransition** attribute. > **NOTE** > @@ -10,14 +10,14 @@ Shared element transition can be used for transition between pages, for example, ## Attributes -| Name | Parameters | Description | +| Name | Parameter | Description | | ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| sharedTransition | id: string,
{
duration?: number,
curve?: Curve \| string,
delay?: number,
motionPath?:
{
path: string,
form?: number,
to?: number,
rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.
- **id**: component ID.
- **duration**: animation duration, in ms. The default duration is 1000 ms.
- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).
- **delay**: Delay of animation playback, in ms. By default, the playback is not delayed.
- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).
- **path**: path.
- **from**: start value.
- **to**: end value.
- **rotatable**: whether to rotate.
- **zIndex**: z-axis.
- **type**: animation type.| +| sharedTransition | id: string,
{
duration?: number,
curve?: Curve \| string,
delay?: number,
motionPath?:
{
path: string,
form?: number,
to?: number,
rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.
- **id**: component ID.
- **duration**: animation duration.
Default value: **1000**
Unit: ms
Value range: [0, +∞)
The value **0** indicates that no animation is applied. A value less than 0 evaluates to the value **0**.
- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).
- **delay**: animation delay.
Default value: **0**
Unit: ms
Value range: [0, +∞)
A value less than 0 evaluates to the value **0**.
- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).
- **path**: path.
- **from**: start value.
- **to**: end value.
- **rotatable**: whether to rotate.
- **zIndex**: z-axis.
- **type**: animation type.| ## Example - The example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image. +This example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image. ```ts // xxx.ets diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index d28294adf2e11dd3c2bdd47c9bf3abe66dce6623..378a573d7c4434707380f0a0bbe8d8fe23405d9d 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md @@ -14,7 +14,7 @@ The location attributes set the alignment mode, layout direction, and position o | -------- | -------- | -------- | | align | [Alignment](ts-appendix-enums.md#alignment) | Alignment mode of the component content in the drawing area.
Default value: **Alignment.Center**
Since API version 9, this API is supported in ArkTS widgets.| | direction | [Direction](ts-appendix-enums.md#direction) | Horizontal layout of the component.
Default value: **Direction.Auto**
Since API version 9, this API is supported in ArkTS widgets.| -| position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
Since API version 9, this API is supported in ArkTS widgets.| +| position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
This attribute is applicable to scenarios where the component is fixed at a position in the parent container, for example, where it is pinned to top or floating above the UI.
Since API version 9, this API is supported in ArkTS widgets.| | markAnchor | [Position](ts-types.md#position8) | Anchor point of the component for positioning. The upper left corner of the component is used as the reference point for offset. Generally, this attribute is used together with the **position** and **offset** attributes. When used independently, this attribute is similar to **offset**.
Default value:
{
x: 0,
y: 0
}
Since API version 9, this API is supported in ArkTS widgets.| | offset | [Position](ts-types.md#position8) | Offset of the component relative to itself. This offset is expressed using relative values. This attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
Default value:
{
x: 0,
y: 0
}
Since API version 9, this API is supported in ArkTS widgets.| | alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | Alignment rules relative to the container.
- **left**: left-aligned.
- **right**: right-aligned.
- **middle**: center-aligned.
- **top**: top-aligned.
- **bottom**: bottom-aligned.
- **center**: center-aligned.
This API is supported in ArkTS widgets.
**NOTE**
- **anchor**: ID of the component that functions as the anchor point.
- **align**: alignment mode relative to the anchor component. | @@ -32,19 +32,15 @@ struct PositionExample1 { Column({ space: 10 }) { // When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component. Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%') - Text('top start') - .align(Alignment.TopStart) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) - - Text('Bottom end') - .align(Alignment.BottomEnd) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) + Stack() { + Text('First show in bottom end').height('65%').backgroundColor(0xD2B48C) + Text('Second show in bottom end').backgroundColor(0xF5DEB3).opacity(0.9) + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.BottomEnd) + Stack() { + Text('top start') + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.TopStart) // To arrange the child components from left to right, set direction of the parent container to Direction.Ltr. Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%') @@ -86,6 +82,7 @@ struct PositionExample2 { Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 position(30, 10)') .size({ width: '60%', height: '30' }) .backgroundColor(0xbbb2cb) @@ -94,6 +91,7 @@ struct PositionExample2 { .align(Alignment.Start) .position({ x: 30, y: 10 }) Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 position(50%, 70%)') .size({ width: '50%', height: '50' }) .backgroundColor(0xbbb2cb) @@ -110,14 +108,20 @@ struct PositionExample2 { .size({ width: '100', height: '100' }) .backgroundColor(0xdeb887) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: 25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: -100, y: -25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: -25 }) @@ -127,6 +131,7 @@ struct PositionExample2 { Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 offset(15, 30)') .size({ width: 120, height: '50' }) .backgroundColor(0xbbb2cb) @@ -135,6 +140,7 @@ struct PositionExample2 { .align(Alignment.Start) .offset({ x: 15, y: 30 }) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 offset(-10%, 20%)') .size({ width: 100, height: '50' }) .backgroundColor(0xbbb2cb) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 4137fd80dcc1eb91901af56241b4f3ee700274aa..4bb9ffdcc334869e7a7d862e4c6a095887ad74ea 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -18,13 +18,14 @@ You can bind a popup to a component, specifying its content, interaction logic, | Name | Type | Mandatory | Description | | -------------------------| ------------------------------------------------| -----| ----------------------------------------- | -| message | string | Yes | Content of the popup message. | -| placementOnTop | boolean | No | Whether to display the popup above the component.
Default value: **false** | -| primaryButton | {
value: string,
action: () => void
} | No | Primary button.
**value**: text of the primary button in the popup.
**action**: callback for clicking the primary button.| -| secondaryButton | {
value: string,
action: () => void
} | No | Secondary button.
**value**: text of the secondary button in the popup.
**action**: callback for clicking the secondary button.| -| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | -| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | -| showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | +| message | string | Yes | Content of the popup message. | +| placementOnTop | boolean | No | Whether to display the popup above the component.
Default value: **false** | +| primaryButton | {
value: string,
action: () => void
} | No | Primary button.
**value**: text of the primary button in the popup.
**action**: callback for clicking the primary button.| +| secondaryButton | {
value: string,
action: () => void
} | No | Secondary button.
**value**: text of the secondary button in the popup.
**action**: callback for clicking the secondary button.| +| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | +| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | +| showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | + ## CustomPopupOptions8+ @@ -33,13 +34,12 @@ You can bind a popup to a component, specifying its content, interaction logic, | builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder. | | placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.
Default value: **Placement.Bottom** | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. | -| enableArrow | boolean | No | Whether to display an arrow.
Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left** but the popup height is less than twice the arrow width (64 vp), the arrow will not be displayed.
Default value: **true**| +| enableArrow | boolean | No | Whether to display an arrow.
Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left**, but the popup height (80 vp) is less than the sum of the arrow width (32 vp) and diameter of popup rounded corner (48 vp), the arrow will not be displayed.
Default value: **true**| | autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.
Default value: **true** | | onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | | arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | | showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | - ## Example ```ts // xxx.ets diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md index 3fe2fd67e04bb818ccc5625f7f7d9d61e9347ea2..19fb0da84c1cafd88ea971c93db167934313de3f 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md @@ -2,7 +2,7 @@ The text style attributes set the style for text in a component. -> **NOTE** +> **NOTE** > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -18,6 +18,8 @@ The text style attributes set the style for text in a component. | fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | Font style.
Default value: **FontStyle.Normal** | | fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.
Default value: **FontWeight.Normal** | | fontFamily | string \| [Resource](ts-types.md#resource) | Font family.
Default value: **'HarmonyOS Sans'**
Currently, only the default font is supported. | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.| +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None,
color: Color.Black
} | ## Example diff --git a/en/application-dev/ui/ui-ts-animation-feature.md b/en/application-dev/ui/ui-ts-animation-feature.md index 0f96e137cff81f4d86cc714faf3356d8331e3af6..3d6467e08cc112b6b9a953aa4d0a649486042bd2 100644 --- a/en/application-dev/ui/ui-ts-animation-feature.md +++ b/en/application-dev/ui/ui-ts-animation-feature.md @@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte } ``` -5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replace** to display the **FoodCategoryList** page. +5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replaceUrl** to display the **FoodCategoryList** page. ```ts import router from '@ohos.router' @@ -240,11 +240,11 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte Implement the shared element transition between the food list page and the food details page. That is, after you click **FoodListItem** or **FoodGridItem**, the food thumbnail is zoomed in, and then you are redirected to the large image on the food details page. -1. Set the **sharedTransition** method for the **\** component of **FoodListItem** and **FoodGridItem**. The transition ID is **foodItem.id**, the duration of the transition animation is 1s, and the delay is 0.1s. The change curve is **Curves.cubicBezier(0.2, 0.2, 0.1, 1.0)**. You need to import the **Curves** module first. +1. Set the **sharedTransition** method for the **** component of **FoodListItem** and **FoodGridItem**. The transition ID is **foodItem.id**, the duration of the transition animation is 1s, and the delay is 0.1s. The change curve is **Curves.cubicBezier(0.2, 0.2, 0.1, 1.0)**. You need to import the **Curves** module first. - During the shared element transition, the attributes of the current element are carried. Therefore, create a **\** component as the parent component of the **\** component, and set the background color on the **\** component. + During the shared element transition, the attributes of the current element are carried. Therefore, create a **** component as the parent component of the **** component, and set the background color on the **** component. - Set **autoResize** to **false** for the **\** component of **FoodListItem**. The **\** component adjusts the size of the image source based on the final display area by default to optimize the image rendering performance. In the transition animation, the image will be reloaded during the zoom-in process. Therefore, to ensure the smoothness of the transition animation, set **autoResize** to **false**. + Set **autoResize** to **false** for the **** component of **FoodListItem**. The **** component adjusts the size of the image source based on the final display area by default to optimize the image rendering performance. In the transition animation, the image will be reloaded during the zoom-in process. Therefore, to ensure the smoothness of the transition animation, set **autoResize** to **false**. ```ts // FoodList.ets @@ -316,7 +316,7 @@ Implement the shared element transition between the food list page and the food ``` -2. Sets the **sharedTransition** method for the **\** component of **FoodImageDisplay** on the **FoodDetail** page. The setting method is the same as that mentioned above. +2. Sets the **sharedTransition** method for the **** component of **FoodImageDisplay** on the **FoodDetail** page. The setting method is the same as that mentioned above. ```ts import Curves from '@ohos.curves' diff --git a/en/application-dev/ui/ui-ts-layout-mediaquery.md b/en/application-dev/ui/ui-ts-layout-mediaquery.md index c57de9e82ec6bb20226f282c88f2fcd88f7cc8fb..c37468c67f14b37878f22c9138612aebba805975 100644 --- a/en/application-dev/ui/ui-ts-layout-mediaquery.md +++ b/en/application-dev/ui/ui-ts-layout-mediaquery.md @@ -10,32 +10,32 @@ ## Usage -Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. +Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. The procedure is as follows: -First, import the **mediaquery** module, as shown below: +1. Import the **mediaquery** module, as shown below: -```ts -import mediaquery from '@ohos.mediaquery' -``` + ```ts + import mediaquery from '@ohos.mediaquery' + ``` -Then, use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below: +2. Use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below: -```ts -listener = mediaquery.matchMediaSync('(orientation: landscape)') -``` + ```ts + listener = mediaquery.matchMediaSync('(orientation: landscape)') + ``` -Finally, register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows: +3. Register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows: -```ts -onPortrait(mediaQueryResult) { - if (mediaQueryResult.matches) { - // do something here - } else { - // do something here - } -} -listener.on('change', onPortrait) -``` + ```ts + onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + // do something here + } else { + // do something here + } + } + listener.on('change', onPortrait) + ``` ## Media Query Conditions @@ -92,23 +92,23 @@ At MediaQuery Level 4, range query is imported so that you can use the operators | Type | Description | | ----------------- | ------------------------------------------------------------ | -| height | Height of the display area on the application page. | -| min-height | Minimum height of the display area on the application page. | -| max-height | Maximum height of the display area on the application page. | -| width | Width of the display area on the app page. | -| min-width | Minimum width of the display area on the application page. | -| max-width | Maximum width of the display area on the application page. | -| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.
- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.
- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.
- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.| -| min-resolution | Minimum device resolution. | -| max-resolution | Maximum device resolution. | +| height | Height of the display area on the application page. | +| min-height | Minimum height of the display area on the application page. | +| max-height | Maximum height of the display area on the application page. | +| width | Width of the display area on the application page. | +| min-width | Minimum width of the display area on the application page. | +| max-width | Maximum width of the display area on the application page. | +| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.
- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.
- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.
- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.| +| min-resolution | Minimum device resolution. | +| max-resolution | Maximum device resolution. | | orientation | Screen orientation.
Options are as follows:
- orientation: portrait
- orientation: landscape| -| device-height | Height of the device. | -| min-device-height | Minimum height of the device. | -| max-device-height | Maximum height of the device. | -| device-width | Width of the device. | -| min-device-width | Minimum width of the device. | -| max-device-width | Maximum width of the device. | -| device-type | Type of the device.
Value range: **default** | +| device-height | Height of the device. | +| min-device-height | Minimum height of the device. | +| max-device-height | Maximum height of the device. | +| device-width | Width of the device. | +| device-type | Type of the device.
Options: **default** and tablet | +| min-device-width | Minimum width of the device. | +| max-device-width | Maximum width of the device. | | round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. | | dark-mode | Whether the device is in dark mode. The value **true** means that the device is in dark mode, and **false** means the opposite. | diff --git a/en/device-dev/Readme-EN.md b/en/device-dev/Readme-EN.md index 048e956eb631431d1806199f7bb5f106f9034f76..09d4af6ebf56653027512d19c644711a90f7b2df 100644 --- a/en/device-dev/Readme-EN.md +++ b/en/device-dev/Readme-EN.md @@ -40,7 +40,6 @@ - [AI Framework](subsystems/subsys-ai-aiframework-devguide.md) - [Data Management](subsystems/subsys-data-relational-database-overview.md) - [Sensor](subsystems/subsys-sensor-overview.md) - - [USB](subsystems/subsys-usbservice-overview.md) - [Application Framework](subsystems/subsys-application-framework-overview.md) - [OTA Update](subsystems/subsys-ota-guide.md) - [Telephony](subsystems/subsys-tel-overview.md) diff --git a/en/device-dev/website.md b/en/device-dev/website.md index ea70ddb256ecf8b273da770317aac926fbb5fd6f..0880175f99c9a1a61b30f2ce181358ae22284c92 100644 --- a/en/device-dev/website.md +++ b/en/device-dev/website.md @@ -178,6 +178,7 @@ - [Exception Debugging](kernel/kernel-mini-memory-exception.md) - [Trace](kernel/kernel-mini-memory-trace.md) - [LMS](kernel/kernel-mini-memory-lms.md) + - [Shell](kernel/kernel-mini-debug-shell.md) - Appendix - [Kernel Coding Specification](kernel/kernel-mini-appx-code.md) - [Standard Libraries](kernel/kernel-mini-appx-lib.md) @@ -426,10 +427,6 @@ - [Sensor Overview](subsystems/subsys-sensor-overview.md) - [Sensor Usage Guidelines](subsystems/subsys-sensor-guide.md) - [Sensor Usage Example](subsystems/subsys-sensor-demo.md) - - USB - - [USB Overview](subsystems/subsys-usbservice-overview.md) - - [USB Usage Guidelines](subsystems/subsys-usbservice-guide.md) - - [USB Usage Example](subsystems/subsys-usbservice-demo.md) - Application Framework - [Overview](subsystems/subsys-application-framework-overview.md) - [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md) diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md index 504640b4175263b959c86fbb69539fdfd205b198..efdf832e6ddc2c210b135ef00a08a24043091862 100644 --- a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md +++ b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md @@ -1,10 +1,19 @@ # 创建一个ArkTS卡片 +在已有的应用工程中,创建ArkTS卡片,具体的操作方式如下。 -开发者可以使用IDE创建ArkTS卡片,具体步骤请参见[DevEco Studio服务卡片开发指南](https://gitee.com/link?target=https%3A%2F%2Fdeveloper.harmonyos.com%2Fcn%2Fdocs%2Fdocumentation%2Fdoc-guides%2Fohos-development-service-widget-0000001263280425)。使用IDE生成的卡片模板包括三个部分:卡片页面(WidgetCard.ets)、卡片生命周期管理(FormExtensionAbility)和卡片配置文件(form_config.json)。 +1. 创建卡片。 + ![WidgetProjectCreate1](figures/WidgetProjectCreate1.png) -在选择卡片的开发语言类型(Language)时,需要选择ArkTS选项,如下图所示。 +2. 根据实际业务场景,选择一个卡片模板。 + ![WidgetProjectCreate2](figures/WidgetProjectCreate2.png) -![WidgetCreateProject](figures/WidgetCreateProject.png) +3. 在选择卡片的开发语言类型(Language)时,选择ArkTS选项,然后单击“Finish”,即可完成ArkTS卡片创建。 + + ![WidgetProjectCreate3](figures/WidgetProjectCreate3.png) + +ArkTS卡片创建完成后,工程中会新增如下卡片相关文件:卡片生命周期管理文件(EntryFormAbility.ts)、卡片页面文件(WidgetCard.ets)和卡片配置文件(form_config.json) + +![WidgetProjectView](figures/WidgetProjectView.png) \ No newline at end of file diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md b/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md index 947af74c94943117de9fdd59b7bd9c1e6d210ef5..dc785d9c544b324faab02dc4a0666fa4e096e9a6 100644 --- a/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md +++ b/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md @@ -1,7 +1,7 @@ # 卡片数据交互说明 -ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新。**(介绍下LocalStorageProp在这个过程中起到的作用)** +ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新。 ![WidgetLocalStorageProp](figures/WidgetLocalStorageProp.png) diff --git a/zh-cn/application-dev/application-models/extensionability-overview.md b/zh-cn/application-dev/application-models/extensionability-overview.md index fe1b760cad8a6a40e0e80595116d4c7522026698..98409360b568920071a7580e16227297e40afacc 100644 --- a/zh-cn/application-dev/application-models/extensionability-overview.md +++ b/zh-cn/application-dev/application-models/extensionability-overview.md @@ -45,7 +45,7 @@ ExtensionAbility组件是基于特定场景(例如服务卡片、输入法等 ## 实现指定类型的ExtensionAbility组件 -以实现卡片[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)为例进行说明。卡片框架提供了[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)基类,开发者通过派生此基类(如MyFormExtensionAbility),实现回调(如创建卡片的onCreate()回调、更新卡片的onUpdateForm()回调等)来实现具体卡片功能,具体见开发指导见[服务卡片FormExtensionAbility](widget-development-stage.md)。 +以实现卡片[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)为例进行说明。卡片框架提供了[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)基类,开发者通过派生此基类(如MyFormExtensionAbility),实现回调(如创建卡片的onCreate()回调、更新卡片的onUpdateForm()回调等)来实现具体卡片功能,具体见开发指导见[服务卡片FormExtensionAbility](service-widget-overview.md)。 卡片FormExtensionAbility实现方不用关心使用方何时去请求添加、删除卡片,FormExtensionAbility实例及其所在的ExtensionAbility进程的整个生命周期,都是由卡片管理系统服务FormManagerService进行调度管理。 diff --git a/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png b/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png deleted file mode 100644 index 53e5229f52724d188862053ae8870120b7d90469..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/application-models/figures/WidgetCreateProject.png and /dev/null differ diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectCreate1.png b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate1.png new file mode 100644 index 0000000000000000000000000000000000000000..5369f48edcee476ae8317b9f0e1fb98b06607e93 Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate1.png differ diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectCreate2.png b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate2.png new file mode 100644 index 0000000000000000000000000000000000000000..7bf742e04e2f30febb05f2d8638193dc10532863 Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate2.png differ diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectCreate3.png b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate3.png new file mode 100644 index 0000000000000000000000000000000000000000..98429567ad24b1a83c67118173bf6cb504bea25d Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/WidgetProjectCreate3.png differ diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectView.png b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png new file mode 100644 index 0000000000000000000000000000000000000000..9d1c06e47502131983b0b7cd56e66269b5be6d88 Binary files /dev/null and b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png differ diff --git a/zh-cn/application-dev/application-models/js-ui-widget-development.md b/zh-cn/application-dev/application-models/js-ui-widget-development.md index e66332d72ff4ffdc0bcbec2b060bef21db98dafe..34a0af5ea36388dfbfa74b22f26581d192110e82 100644 --- a/zh-cn/application-dev/application-models/js-ui-widget-development.md +++ b/zh-cn/application-dev/application-models/js-ui-widget-development.md @@ -57,13 +57,6 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口 | onConfigurationUpdate(config: Configuration): void | 当系统配置更新时调用。 | | onShareForm?(formId: string): { [key: string]: any } | 卡片提供方接收卡片分享的通知接口。 | -FormExtensionAbility类还拥有成员context,为FormExtensionContext类,具体的API介绍详见[接口文档](../reference/apis/js-apis-inner-application-formExtensionContext.md)。 - -| 接口名 | 描述 | -| -------- | -------- | -| startAbility(want: Want, callback: AsyncCallback<void>): void | 回调形式拉起一个卡片所属应用的UIAbility(系统接口,三方应用不支持调用,需申请后台拉起权限)。 | -| startAbility(want: Want): Promise<void> | Promise形式拉起一个卡片所属应用的UIAbility(系统接口,三方应用不支持调用,需申请后台拉起权限)。 | - formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md)。 | 接口名 | 描述 | @@ -324,7 +317,7 @@ export default class EntryFormAbility extends FormExtension { } ``` -具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-preference-guidelines.md)。 +具体的持久化方法可以参考[轻量级数据存储开发指导](../database/app-data-persistence-overview.md)。 需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片: diff --git a/zh-cn/application-dev/application-models/service-widget-overview.md b/zh-cn/application-dev/application-models/service-widget-overview.md index 2df4807cdec519a0dab3f79cd40c12b2a42c015f..fa58595b04ff56145b7f11f8df3dd32e69ec306a 100644 --- a/zh-cn/application-dev/application-models/service-widget-overview.md +++ b/zh-cn/application-dev/application-models/service-widget-overview.md @@ -54,14 +54,3 @@ ArkTS卡片与JS卡片具备不同的实现原理及特征,在场景能力上 | 逻辑代码执行(不包含import能力) | 不支持 | 支持 | 相比于JS卡片,ArkTS卡片在能力和场景方面更加丰富,因此无论开发何种用途的卡片,都推荐使用ArkTS卡片,因为它可以提高开发效率并实现动态化。但如果只需要做静态页面展示的卡片,可以考虑使用JS卡片。 - -## 限制 - -为了降低FormExtensionAbility能力被三方应用滥用的风险,在FormExtensionAbility中限制以下接口的调用 - -- @ohos.ability.particleAbility.d.ts -- @ohos.backgroundTaskManager.d.ts -- @ohos.resourceschedule.backgroundTaskManager.d.ts -- @ohos.multimedia.camera.d.ts -- @ohos.multimedia.audio.d.ts -- @ohos.multimedia.media.d.ts \ No newline at end of file diff --git a/zh-cn/application-dev/database/sync-app-data-across-devices-overview.md b/zh-cn/application-dev/database/sync-app-data-across-devices-overview.md index 5cac356b79fa7848cd794418212c945d23c91ded..c4d09d08da110e5f5e8c658a41ad808f47317bcb 100644 --- a/zh-cn/application-dev/database/sync-app-data-across-devices-overview.md +++ b/zh-cn/application-dev/database/sync-app-data-across-devices-overview.md @@ -36,7 +36,7 @@ ## 跨设备同步访问控制机制 -数据跨设备同步时,数据管理基于设备等级和[数据安全标签](access-control-by-device-and-data-level.md#基本概念)进行访问控制。规则为,数据只允许向数据安全标签不高于设备安全等级的设备同步数据,具体访问控制矩阵如下: +数据跨设备同步时,数据管理基于设备等级和[数据安全标签](access-control-by-device-and-data-level.md#数据安全标签)进行访问控制。规则为,数据只允许向数据安全标签不高于设备安全等级的设备同步数据,具体访问控制矩阵如下: |设备安全级别|可同步的数据安全标签| |---|---| diff --git a/zh-cn/application-dev/file-management/file-management-overview.md b/zh-cn/application-dev/file-management/file-management-overview.md index a46e4ccd5111670d9ea509b5ca55d21f6b969081..212697e0904ca1798c1d2804aff1f9ec910a2909 100644 --- a/zh-cn/application-dev/file-management/file-management-overview.md +++ b/zh-cn/application-dev/file-management/file-management-overview.md @@ -2,7 +2,7 @@ 在操作系统中,存在各种各样的数据,按数据结构可分为: -- 结构化数据:能够用统一的数据模型加以描述的数据。常见的是各类数据库数据。在应用开发中,对结构化数据的开发活动隶属于[数据管理模块](database/data-mgmt-overview.md)。 +- 结构化数据:能够用统一的数据模型加以描述的数据。常见的是各类数据库数据。在应用开发中,对结构化数据的开发活动隶属于[数据管理模块](../database/data-mgmt-overview.md)。 - 非结构化数据:指数据结构不规则或不完整,没有预定义的数据结构/模型,不方便用数据库二维逻辑表来表现的数据。常见的是各类文件,如文档、图片、音频、视频等。在应用开发中,对非结构化数据的开发活动隶属于文件管理模块,将在下文展开介绍。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index ce2ed77a0d1e8b184f8a483a93643637d6602631..28f6e081dde750c878f11d11c5ce9523d1240e17 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -97,12 +97,12 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 | 名称 | 值 | 说明 | |:----------------:|:---:|-----| -| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md):卡片扩展能力,提供卡片开发能力。 | +| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md):卡片扩展能力,提供卡片开发能力。 | | WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 | | INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md):输入法扩展能力,用于开发输入法应用。 | | SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md):后台服务扩展能力,提供后台运行并对外提供相应能力。 | | ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md):无障碍服务扩展能力,支持访问与操作前台界面。 | -| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md):数据共享扩展能力,用于对外提供数据读写服务。 | +| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md):数据共享扩展能力,用于对外提供数据读写服务。 | | FILE_SHARE | 6 | FileShareExtensionAbility:文件共享扩展能力,用于应用间的文件分享。预留能力,当前暂未支持。 | | STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md):静态广播扩展能力,用于处理静态事件,比如开机事件。 | | WALLPAPER | 8 | WallpaperExtensionAbility:壁纸扩展能力,用于实现桌面壁纸。预留能力,当前暂未支持。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md index 5610c212819c32fc322225e6824da36fbc87a736..f2b678070965feb3482655cfe52f12f6aa57844f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md +++ b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md @@ -29,7 +29,7 @@ createEffect(source: image.PixelMap): Filter | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------- | ---- | -------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | **返回值:** @@ -61,7 +61,7 @@ createColorPicker(source: image.PixelMap): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------- | ---- | -------------------------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | **返回值:** @@ -95,7 +95,7 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\) | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------ | ---- | -------------------------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 | **示例:** 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 8a3a2c3bdc47a87426f469dd462e7e853d753fe4..265e2b50937efcef7ed216d4d48deb8c220fd864 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -476,9 +476,9 @@ AVPlayer回调的**错误分类**可以分为以下几 | 801 | Unsupport Capability: | 不支持该API能力,表示调用无效。 | | 5400101 | No Memory: | 播放内存不足,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400102 | Operate Not Permit: | 当前状态机不支持此操作,表示调用无效。 | -| 5400103 | IO Error: | 播放中发现码流异常。 | +| 5400103 | IO Error: | 播放中发现码流异常,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400104 | Network Timeout: | 网络原因超时响应,[AVPlayerState](#avplayerstate9)会进入error状态。 | -| 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态。 | +| 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态,需要调用release后重新创建实例。 | | 5400106 | Unsupport Format: | 不支持的文件格式,[AVPlayerState](#avplayerstate9)会进入error状态。 | **示例:** @@ -3775,7 +3775,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh **示例:** ```js -import fileio from '@ohos.fileio' +import fs from '@ohos.file.fs'; let audioPlayer = media.createAudioPlayer(); //创建一个音频播放实例 audioPlayer.on('dataLoad', () => { //设置'dataLoad'事件回调,src属性设置成功后,触发此回调 @@ -3819,15 +3819,15 @@ audioPlayer.on('error', (error) => { //设置'error'事件回调 let fdPath = 'fd://'; // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/accounts/account_0/appdata" 命令,将其推送到设备上 let path = '/data/accounts/account_0/appdata/ohos.xxx.xxx.xxx/01.mp3'; -fileio.open(path).then((fdValue) => { - fdPath = fdPath + '' + fdValue; +fs.open(path).then((file) => { + fdPath = fdPath + '' + file.fd; console.info('open fd success fd is' + fdPath); + audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调 }, (err) => { console.info('open fd failed err is' + err); }).catch((err) => { console.info('open fd failed err is' + err); }); -audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调 ``` ### on('timeUpdate') diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md index 9e777fcbe54b3fb0f98a1952f8d2202939effa03..defb0b218c35b1c0e5b5c5e9d2fa8009d330ce29 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md @@ -352,7 +352,7 @@ let res: boolean = AppStorage.IsMutable('simpleProp'); static Size(): number -返回LocalStorage中的属性数量。 +返回AppStorage中的属性数量。 **返回值:** @@ -487,7 +487,7 @@ let res1: boolean = storage.set('PropB', 47); // false ### setOrCreate9+ -setOrCreate<T>(propName: string, newValue?: T): boolean +setOrCreate<T>(propName: string, newValue: T): boolean propName如果已经在LocalStorage中存在,则设置propName对应是属性的值为newValue。如果不存在,则创建propName属性,初始化为newValue。 @@ -496,7 +496,7 @@ propName如果已经在LocalStorage中存在,则设置propName对应是属性 | 参数名 | 类型 | 必填 | 参数描述 | | -------- | ------ | ---- | ----------------------- | | propName | string | 是 | LocalStorage中的属性名。 | -| newValue | T | 否 | 属性值,不能为undefined或者null。 | +| newValue | T | 是 | 属性值,不能为undefined或者null。 | **返回值:** @@ -573,7 +573,7 @@ var link2: SubscribedAbstractProperty = storage.setAndLink('PropA', 50); ### prop9+ -prop<T>(propName: string): SubscribedAbstractProperty<T> +prop<S>(propName: string): SubscribedAbstractProperty<S> 如果给定的propName在LocalStorage存在,则返回与LocalStorage中propName对应属性的单向绑定数据。如果LocalStorage中不存在propName,则返回undefined。单向绑定数据的修改不会被同步回LocalStorage中。 @@ -587,7 +587,7 @@ prop<T>(propName: string): SubscribedAbstractProperty<T> | 类型 | 描述 | | ----------------------------------- | ---------------------------------------- | -| SubscribedAbstractProperty<T> | SubscribedAbstractProperty<T>的实例,如果AppStorage不存在对应的propName,在返回undefined。 | +| SubscribedAbstractProperty<S> | SubscribedAbstractProperty<S>的实例,如果AppStorage不存在对应的propName,在返回undefined。 | ```ts @@ -600,7 +600,7 @@ prop1.set(1); // one-way sync: prop1.get()=1; but prop2.get() == 47 ### setAndProp9+ -setAndProp<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> +setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S> propName在LocalStorage存在,则返回该propName对应的属性的单向绑定数据。如果不存在,则使用defaultValue在LocalStorage创建和初始化propName对应的属性,返回其单向绑定数据。 @@ -609,13 +609,13 @@ propName在LocalStorage存在,则返回该propName对应的属性的单向绑 | 参数名 | 类型 | 必填 | 参数描述 | | ------------ | ------ | ---- | ---------------------------------------- | | propName | string | 是 | LocalStorage中的属性名。 | -| defaultValue | T | 是 | 当propName在AppStorage中不存在,使用default在AppStorage中初始化对应的propName。 | +| defaultValue | S | 是 | 当propName在AppStorage中不存在,使用default在AppStorage中初始化对应的propName。 | **返回值:** | 类型 | 描述 | | ----------------------------------- | ---------------------------------------- | -| SubscribedAbstractProperty<T> | SubscribedAbstractProperty<T>的实例,和AppStorage中propName对应属性的单向绑定的数据。 | +| SubscribedAbstractProperty<S> | SubscribedAbstractProperty<S>的实例,和AppStorage中propName对应属性的单向绑定的数据。 | ```ts @@ -762,20 +762,6 @@ let prop1 = AppStorage.Prop('PropA'); prop1.set(1); // prop1.get()=1 ``` -### aboutToBeDeleted10+ - -abstract aboutToBeDeleted(): void - -取消SubscribedAbstractProperty实例对AppStorage/LocalStorage单/双向同步关系。 - - -```ts -AppStorage.SetOrCreate('PropA', 47); -let link = AppStorage.SetAndLink('PropB', 49); // PropA -> 47, PropB -> 49 -link.aboutToBeDeleted(); -link.set(50); // PropB -> 49, link.get() --> undefined -``` - ## PersistentStorage diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md index 76f57c4f3118b417549835e71ec8232ad2efff84..cfe46dcd3b83e79e90b8b4b29479214e3b179932 100644 --- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md +++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md @@ -60,4 +60,4 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下: FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../application-models/widget-development-fa.md#配置卡片配置文件)。 -Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/arkts-ui-widget-configuration.md)。 \ No newline at end of file +Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/arkts-ui-widget-configuration.md)。 diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-release.md b/zh-cn/release-notes/OpenHarmony-v3.2-release.md index 0fe1b08b14f35b79318c45002d7cee2356ca1e97..9f0c91c2de1f45c9e8236300ae91d8f8fc96d32f 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-release.md @@ -433,7 +433,7 @@ OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更 - 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。 -- 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片,帮助开发者快速开发应用和服务。 +- 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片。 - 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。 @@ -610,12 +610,6 @@ API变更请参考: | 无障碍 | [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/applications_app_samples)仓了解更多信息。 diff --git a/zh-cn/release-notes/api-change/Beta5 to v3.2-Release/Readme-CN.md b/zh-cn/release-notes/api-change/Beta5 to v3.2-Release/Readme-CN.md index 6301907a6b2f6c9e111e319a12edbfb62fb00e61..655f26f623bcf6418a99b254cdbe66c7886b0308 100644 --- a/zh-cn/release-notes/api-change/Beta5 to v3.2-Release/Readme-CN.md +++ b/zh-cn/release-notes/api-change/Beta5 to v3.2-Release/Readme-CN.md @@ -8,7 +8,6 @@ - [包管理](js-apidiff-bundle.md) - [网络及通信](js-apidiff-communication.md) - [语言编译器运行时](js-apidiff-compiler-and-runtime.md) -- [定制](js-apidiff-customization.md) - [DFX](js-apidiff-dfx.md) - [分布式数据](js-apidiff-distributed-data.md) - [文件管理](js-apidiff-file-management.md) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md deleted file mode 100644 index e781172a332f8bc19c89d43cfa72c29eb8df44d3..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md +++ /dev/null @@ -1,39 +0,0 @@ -# 用户IAM子系统Changelog - -## cl.useriam.1 API9 GetVesion接口删除 - -为优化用户IAM接口,从当前版本开始做如下变更: - -用户IAM删除GetVersion(API 9)接口。 - -**变更影响** - -对用户IAM GetVersion(API 9)接口的使用有影响,需删除对此接口的调用,否则会调用失败。 - -**关键接口/组件变更** - -| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | -| ---------------------- | ------------------- | ------------------------- | ------------------------ | -| ohos.userIAM.userAuth | function | getVersion() : number | 删除 | - -**适配指导** - -需删除对用户IAM GetVersion(API 9)接口的调用。 - -## cl.useriam.2 API8 GetVesion接口返回值变更 - -为统一用户IAM GetVersion(API 8)接口的返回值。从当前版本开始做如下变更: - -用户IAM GetVersion(API 8)接口的返回值由0变更为1。 - -**变更影响** - -对用户IAM GetVersion(API 8)接口的使用有影响,如应用校验了此接口的返回值,修改后校验不通过。 - -**关键接口/组件变更** - -用户IAM GetVersion(API 8)接口的返回值由0变更为1。 - -**适配指导** - -此接口已废弃,需删除对用户IAM GetVersion(API 8)接口的使用。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md deleted file mode 100644 index 29f562ed9ceb239771cdc78b59ebbf91959877f0..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-pasteboard.md +++ /dev/null @@ -1,66 +0,0 @@ -# 剪贴板子系统ChangeLog - -OpenHarmony 4.0.3.2 版本相较于OpenHarmony 之前的版本,剪贴板子系统的API变更如下。 - -## cl.pasteboard.1 convertToTextV9接口变更 - -接口convertToTextV9由于命名规范和接口返回方式问题,名称变更为toPlainText(),返回方式改为同步方式。 - -**变更影响** - -4.0.3.3版本之前使用接口convertToTextV9开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。 - -**关键的接口/组件变更** - -- 涉及接口 - - function convertToTextV9 - -- 变更前: - - ```ts - convertToTextV9(callback: AsyncCallback): void; - convertToTextV9(): Promise; - ``` - -- 变更后: - - ```ts - toPlainText(): string; - ``` -变更前: - -**适配指导** - -请使用toPlainText替换convertToTextV9,并注意接口返回方式。 - -## cl.pasteboard.2 ShareOption属性名称变更,删除了未支持的属性 - -ShareOption枚举命名从**大驼峰**改成了**全大写**。 - -**变更影响** - -4.0.3.3版本之前使用InApp/LocalDevice/CrossDevice类型开发的应用,在4.0.3.3版本及后续版本中无法继续正常使用。 - -**关键接口/组件变更** - -ShareOption9+ - -变更前: -| 名称 | 值 | 说明 | -| ---- |---|-------------------| -| InApp | 0 | 表示仅允许同应用内粘贴。 | -| LocalDevice | 1 | 表示允许在此设备中任何应用内粘贴。 | -| CrossDevice | 2 | 表示允许跨设备在任何应用内粘贴。 | - - -变更后: -| 名称 | 值 | 说明 | -| ---- |---|-------------------| -| INAPP | 0 | 表示仅允许同应用内粘贴。 | -| LOCALDEVICE | 1 | 表示允许在此设备中任何应用内粘贴。 | -| CROSSDEVICE | 2 | 表示允许跨设备在任何应用内粘贴。 | - -**适配指导** - -按新的语义进行适配。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md deleted file mode 100644 index ab3394f4e13afe53c829846576a323b719b69dec..0000000000000000000000000000000000000000 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md +++ /dev/null @@ -1,391 +0,0 @@ -# 帐号子系统ChangeLog - -OpenHarmony4.0.3.2版本相较于OpenHarmony之前的版本,帐号模块的API变更如下。 - -## cl.account_os_account.1 应用帐号isAccountRemovable命名变更 - -类Authenticator中的成员函数isAccountRemovable由于命名不统一问题,名称变更为checkAccountRemovable。 - -**变更影响** - -类Authenticator中的成员函数isAccountRemovable,在4.0.3.2版本及后续版本中无法继续正常使用,由checkAccountRemovable代替。 - -**关键的接口/组件变更** - -- 涉及接口 - ```ts - class Authenticator { - ... - isAccountRemovable - ... - } - ``` -- 变更前: - - ```ts - class Authenticator { - ... - /** - * Checks whether the specified account can be removed. - * @param name Indicates the account name. - * @param callback Indicates the authenticator callback. - * @returns void. - * @since 9 - */ - isAccountRemovable(name: string, callback: AuthCallback): void; - ... - } - ``` - -- 变更后: - - ```ts - class Authenticator { - ... - /** - * Checks whether the specified account can be removed. - * @param name Indicates the account name. - * @param callback Indicates the authenticator callback. - * @returns void. - * @since 9 - */ - checkAccountRemovable(name: string, callback: AuthCallback): void; - ... - } - ``` - -## cl.account_os_account.2 系统帐号checkConstraintEnabled命名变更 - -checkConstraintEnabled由于命名不统一问题,名称变更为checkOsAccountConstraintEnabled。 - -**变更影响** - -checkConstraintEnabled接口,在4.0.3.2版本及后续版本中无法继续正常使用,由checkOsAccountConstraintEnabled代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - checkConstraintEnabled - ... -} -``` - -- 变更前: - - ```ts - checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -- 变更后: - - ```ts - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -## cl.account_os_account.3 系统帐号checkOsAccountConstraintEnabled权限场景变更 - -checkOsAccountConstraintEnabled接口的权限管控新增可选权限:ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS。 - -**变更影响** - -在4.0.3.2版本及后续版本中,应用申请ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限亦可调用checkOsAccountConstraintEnabled, -切此前版本申请ohos.permission.MANAGE_LOCAL_ACCOUNTS权限的不影响使用 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - checkOsAccountConstraintEnabled - ... -} -``` - -- 变更前: - - ```ts - ... - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS - ... - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -- 变更后: - - ```ts - ... - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - ... - checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; - checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; - ``` - -## cl.account_os_account.4 系统帐号queryOsAccountLocalIdFromProcessd命名变更 - -queryOsAccountLocalIdFromProcess由于命名不统一问题,名称变更为getOsAccountLocalId。 - -**变更影响** - -queryOsAccountLocalIdFromProcess接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalId代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromProcess - ... -} -``` -- 变更前: - - ```ts - queryOsAccountLocalIdFromProcess(callback: AsyncCallback): void; - queryOsAccountLocalIdFromProcess(): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalId(callback: AsyncCallback): void; - getOsAccountLocalId(): Promise; - ``` - -## cl.account_os_account.5 系统帐号queryOsAccountLocalIdFromUid命名变更 - -queryOsAccountLocalIdFromUid由于命名不统一问题,名称变更为getOsAccountLocalIdForUid。 - -**变更影响** - -queryOsAccountLocalIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForUid代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromUid - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback): void; - queryOsAccountLocalIdFromUid(uid: number): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback): void; - getOsAccountLocalIdForUid(uid: number): Promise; - ``` - -## cl.account_os_account.6 系统帐号queryOsAccountLocalIdFromDomain命名变更 - -queryOsAccountLocalIdFromDomain由于命名不统一问题,名称变更为getOsAccountLocalIdForDomain。 - -**变更影响** - -queryOsAccountLocalIdFromDomain接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForDomain代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdFromDomain - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; - queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; - getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise; - ``` - -## cl.account_os_account.7 系统帐号getActivatedOsAccountIds命名变更 - -getActivatedOsAccountIds由于命名不统一问题,名称变更为getActivatedOsAccountLocalIds。 - -**变更影响** - -getActivatedOsAccountIds接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getActivatedOsAccountLocalIds代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - getActivatedOsAccountIds - ... -} -``` - -- 变更前: - - ```ts - getActivatedOsAccountIds(callback: AsyncCallback>): void; - getActivatedOsAccountIds(): Promise>; - ``` - -- 变更后: - - ```ts - getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; - getActivatedOsAccountLocalIds(): Promise>; - ``` - -## cl.account_os_account.8 系统帐号queryOsAccountLocalIdBySerialNumber命名变更 - -queryOsAccountLocalIdBySerialNumber由于命名不统一问题,名称变更为getOsAccountLocalIdForSerialNumber。 - -**变更影响** - -queryOsAccountLocalIdBySerialNumber接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForSerialNumber代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountLocalIdBySerialNumber - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; - queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise; - ``` - -- 变更后: - - ```ts - getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void; - getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise; - ``` - -## cl.account_os_account.9 系统帐号querySerialNumberByOsAccountLocalId命名变更 - -querySerialNumberByOsAccountLocalId由于命名不统一问题,名称变更为getSerialNumberForOsAccountLocalId。 - -**变更影响** - -querySerialNumberByOsAccountLocalId接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getSerialNumberForOsAccountLocalId代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - querySerialNumberByOsAccountLocalId - ... -} -``` - -- 变更前: - - ```ts - querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void; - querySerialNumberByOsAccountLocalId(localId: number): Promise; - ``` - -- 变更后: - - ```ts - getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void; - getSerialNumberForOsAccountLocalId(localId: number): Promise; - ``` - -## cl.account_os_account.10 系统帐号getBundleIdFromUid命名变更 - -getBundleIdFromUid由于命名不统一问题,名称变更为getBundleIdForUid。 - -**变更影响** - -getBundleIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getBundleIdForUid代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - getBundleIdFromUid - ... -} -``` - -- 变更前: - - ```ts - getBundleIdFromUid(uid: number, callback: AsyncCallback): void; - getBundleIdFromUid(uid: number): Promise; - ``` - -- 变更后: - - ```ts - getBundleIdForUid(uid: number, callback: AsyncCallback): void; - getBundleIdForUid(uid: number): Promise; - ``` - -## cl.account_os_account.11 系统帐号queryOsAccountConstraintSourceTypes命名变更 - -queryOsAccountConstraintSourceTypes由于命名不统一问题,名称变更为getOsAccountConstraintSourceTypes。 - -**变更影响** - -queryOsAccountConstraintSourceTypes接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountConstraintSourceTypes代替。 - -**关键的接口/组件变更** - -- 涉及接口 -``` -interface AccountManager { - ... - queryOsAccountConstraintSourceTypes - ... -} -``` - -- 变更前: - - ```ts - queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; - queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; - ``` - -- 变更后: - - ```ts - getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; - getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; - ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md b/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..5d4b22da0f35a9f9b96f87b4af34eab2e4c1830c --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/Readme.md @@ -0,0 +1,29 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [帐号](changelogs-account_os_account.md) +- [ArkUI](changelogs-arkui.md) +- [多媒体-相机](changelogs-camera.md) +- [设备管理](changelogs-device-manager.md) +- [USB](changelogs-device-usb.md) +- [分布式调度](changelogs-dmsfwk.md) +- [分布式软总线](changelogs-dsoftbus.md) +- [定制管理](changelogs-enterprise_device_management.md) +- [文件管理](changelogs-filemanagement.md) +- [位置服务](changelogs-geolocation.md) +- [全球化](changelogs-global.md) +- [输入法框架](changelogs-inputmethod-framworks.md) +- [多媒体](changelogs-multimedia.md) +- [多模输入](changelogs-multimodalinput.md) +- [事件通知](changelogs-notification.md) +- [电源管理](changelogs-power.md) +- [上传下载](changelogs-request.md) +- [资源管理](changelogs-resource-manager.md) +- [资源调度](changelogs-resourceschedule.md) +- [电话服务](changelogs-telephony.md) +- [测试](changelogs-testfwk_arkxtest.md) +- [主题](changelogs-theme.md) +- [用户IAM](changelogs-useriam.md) +- [元能力-WantAgent](changelogs-wantAgent.md) +- [Web](changelogs-web.md) +- [基础通信-WIFI](changelogs-wifi.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md new file mode 100644 index 0000000000000000000000000000000000000000..b20dbfc1fc13ba0dc94a8044119ac0ae2473cfb7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelog-x-x.md @@ -0,0 +1,31 @@ +# xxx子系统ChangeLog + +相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 + +## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) + +每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。 +以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。 +如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。 + +**变更影响** + +是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。 +是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +列举此功能变更涉及的接口/组件变更。 + +**适配指导(可选,不涉及则可以删除)** + +提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。 +例: +在xxx文件中将xxx参数修改为xxx。 + +``` +sample code +``` + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..2c6f17521f8bef0ed9b63dceaed6505fb082aa63 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-ability.md @@ -0,0 +1,359 @@ +# 元能力子系统ChangeLog + +## cl.ability.1 应用组件启动规则变更 + +元能力子系统应用组件启动规则在如下场景中存在变更: + + - 应用位于后台启动应用组件 + - 跨应用启动invisible应用组件 + - 跨应用启动FA模型的serviceAbility与dataAbility + - 使用startAbilityByCall接口 + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +若未适配新规则,在上述场景下将无法启动应用组件 +> **注意,启动应用组件是指一切启动或连接Ability的行为:** +
1. 启动Ability,如使用startAbility、startServiceExtensionAbility、startAbilityByCall等接口。 +
2. 连接Ability,如使用connectAbility、connectServiceExtensionAbility、acquireDataAbilityHelper、createDataShareHelper等接口。 + +**关键的接口/组件变更** + + - 涉及的应用组件 + - Stage模型 + - Ability + - ServiceExtension + - DataShareExtension + - FA模型 + - PageAbility + - ServiceAbility + - DataAbility + - 涉及接口 + - Stage模型 + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbility(want: Want, options?: StartOptions): Promise; + - startAbilityByCall(want: Want): Promise; + - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + - startAbilityForResult(want: Want, callback: AsyncCallback): void; + - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbilityForResult(want: Want, options?: StartOptions): Promise; + - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + - startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + - startServiceExtensionAbility(want: Want): Promise; + - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + - stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + - stopServiceExtensionAbility(want: Want): Promise; + - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + - connectAbility(want: Want, options: ConnectOptions): number; + - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + - createDataShareHelper(context: Context, uri: string, callback: AsyncCallback): void + - FA模型 + - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbility(parameter: StartAbilityParameter): Promise; + - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbilityForResult(parameter: StartAbilityParameter): Promise; + - acquireDataAbilityHelper(uri: string): DataAbilityHelper; + - connectAbility(request: Want, options:ConnectOptions ): number; + +**适配指导** + +不同场景下的启动规则说明如下: + - **应用后台启动应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 应用位于后台时,启动应用组件不受任何限制。 + - OpenHarmony 3.2-beta4 版本新规则: + - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
1. 即使启动同应用的组件,也受该规则限制。 +
2. 对于API8以及之前的SDK,启动serviceAbility和dataAbility不受此规则限制。 + + - **跨应用启动invisible应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 对于APL为normal的应用,无法跨应用启动invisible的应用组件 + - OpenHarmony 3.2-beta4 版本新规则: + - 所有应用,若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_INVISIBLE_ABILITY", + "grantMode": "system_grant", + "availableLevel": "system_core", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + + - **跨应用启动FA模型的serviceAbility与dataAbility** + + - OpenHarmony 3.2-beta3 版本规则: + - 可任意跨应用启动serviceAbility与dataAbility + - OpenHarmony 3.2-beta4 版本新规则: + - serviceAbility与dataAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动) + + + - **startAbilityByCall接口** + - OpenHarmony 3.2-beta3 版本规则: + - 可任意进行Call调用 + - OpenHarmony 3.2-beta4 版本新规则: + - 不支持同应用startAbilityByCall调用 + - 跨应用startAbilityByCall调用需鉴权,需申请的权限如下: + + - ```json + { + "name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
使用startAbilityByCall接口同时也受上述后台启动、跨应用启动invisible规则的限制。 + +## cl.ability.2 跨设备应用组件启动规则变更(仅支持系统应用) + +元能力子系统跨设备应用组件启动规则在如下场景中存在变更: + + - 应用位于后台启动应用组件 + - 跨应用启动invisible应用组件 + - 跨应用启动FA模型的serviceAbility + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +若未适配新规则,在上述场景下将无法启动应用组件 +> **注意,启动应用组件是指一切启动或连接Ability的行为:** +
1. 启动Ability,如使用startAbility、startAbilityForResult、startAbilityByCall等接口。 +
2. 连接Ability,如使用connectAbility等接口。 + +**关键的接口/组件变更** + + - 涉及的应用组件 + - Stage模型 + - Ability + - ServiceExtension + - FA模型 + - PageAbility + - ServiceAbility + - 涉及接口 + - Stage模型 + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbilityByCall(want: Want): Promise; + - startAbilityForResult(want: Want, callback: AsyncCallback): void; + - connectAbility(want: Want, options: ConnectOptions): number; + - FA模型 + - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbility(parameter: StartAbilityParameter): Promise; + - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + - startAbilityForResult(parameter: StartAbilityParameter): Promise; + - connectAbility(request: Want, options:ConnectOptions ): number; + +**适配指导** + +不同场景下的启动规则说明如下: + - **应用后台启动应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 应用位于后台时,启动应用组件不受任何限制。 + - OpenHarmony 3.2-beta4 版本新规则: + - 当应用位于后台时,启动应用组件需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "grantMode": "system_grant", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + > **注:** +
1. 即使启动同应用的组件,也受该规则限制。 +
2. 对于API8以及之前的SDK,启动serviceAbility不受此规则限制。 + + - **跨应用启动invisible应用组件** + - OpenHarmony 3.2-beta3 版本规则: + - 无法跨应用启动invisible的应用组件 + - OpenHarmony 3.2-beta4 版本新规则: + - 若需要跨应用启动invisible的应用组件,需鉴权,需申请的权限如下: + - ```json + { + "name": "ohos.permission.START_INVISIBLE_ABILITY", + "grantMode": "system_grant", + "availableLevel": "system_core", + "provisionEnable": true, + "distributedSceneEnable": false + } + ``` + + - **跨应用启动FA模型的serviceAbility** + + - OpenHarmony 3.2-beta3 版本规则: + - 可任意跨应用启动serviceAbility + - OpenHarmony 3.2-beta4 版本新规则: + - serviceAbility的提供方应用需配置关联启动,否则无法被跨应用拉起。(普通应用无法配置关联启动) + - 关联启动配置 + - ```json + { + "bundleName": "", + "app_signature": ["xxxxxxxxxxxxxxxxxxx"], + "associatedWakeUp": true + } + ``` + +## cl.ability.3 API异常处理方式变更 + +元能力部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对元能力相关接口进行废弃(下表中 原接口 列内容,其中的API9接口将被删除,API8及以前的接口将被标注为废弃),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 原接口 | 新接口 | +| ----------------------------------------------- | ----------------------------------------------- | +| @ohos.ability.wantConstant.d.ts | @ohos.app.ability.wantConstant.d.ts | +| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts | +| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts | +| @ohos.application.abilityDelegatorRegistry.d.ts | @ohos.app.ability.abilityDelegatorRegistry.d.ts | +| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts | +| @ohos.application.abilityManager.d.ts | @ohos.app.ability.abilityManager.d.ts | +| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts | +| @ohos.application.appManager.d.ts | @ohos.app.ability.appManager.d.ts | +| @ohos.application.Configuration.d.ts | @ohos.app.ability.Configuration.d.ts | +| @ohos.application.ConfigurationConstant.d.ts | @ohos.app.ability.ConfigurationConstant.d.ts | +| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts | +| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts | +| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts | +| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts | +| @ohos.application.formBindingData.d.ts | @ohos.app.form.formBindingData.d.ts | +| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts | +| @ohos.application.formHost.d.ts | @ohos.app.form.formHost.d.ts | +| @ohos.application.formInfo.d.ts | @ohos.app.form.formInfo.d.ts | +| @ohos.application.formProvider.d.ts | @ohos.app.form.formProvider.d.ts | +| @ohos.application.missionManager.d.ts | @ohos.app.ability.missionManager.d.ts | +| @ohos.application.quickFixManager.d.ts | @ohos.app.ability.quickFixManager.d.ts | +| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts | +| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts | +| @ohos.application.Want.d.ts | @ohos.app.ability.Want.d.ts | +| @ohos.wantAgent.d.ts | @ohos.app.ability.wantAgent.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.application.missionManager + +```js +import missionManager from '@ohos.application.missionManager'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import missionManager from '@ohos.app.ability.missionManager'; +``` + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.ability.4 接口变更 + +对元能力部分接口名进行了变更。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------- | +| @ohos.application.Ability | Caller | onRelease(callback: OnReleaseCallBack): **void**; | 废弃 | +| @ohos.app.ability.UIAbility | Caller | on(**type**: "release", callback: OnReleaseCallBack): **void**; | 新增 | +| @ohos.application.Ability | Ability | dump(params: Array<**string**>): Array<**string**>; | 废弃 | +| @ohos.app.ability.UIAbility | UIAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 | +| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver): **number**; | 废弃 | +| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 废弃 | +| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver): **number**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.errorManager | errorManager | **function** registerErrorObserver(observer: ErrorObserver): **number**; | 废弃 | +| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.errorManager | errorManager | **function** on(**type**: "error", observer: ErrorObserver): **number**; | 新增 | +| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.missionManager | missionManager | **function** registerMissionListener(listener: MissionListener): **number**; | 废弃 | +| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**): Promise<**void**>; | 废弃 | +| @ohos.app.ability.missionManager | missionManager | **function** on(**type**: "mission", listener: MissionListener): **number**; | 新增 | +| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**): Promise<**void**>; | 新增 | +| @ohos.application.FormExtension | FormExtension | onCreate(want: Want): formBindingData.FormBindingData; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onCastToNormal(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onUpdate(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onVisibilityChange(newStatus: { [key: **string**]: **number** }): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onEvent(formId: **string**, message: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onDestroy(formId: **string**): **void**; | 废弃 | +| @ohos.application.FormExtension | FormExtension | onShare?(formId: **string**): {[key: **string**]: **any**}; | 废弃 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onAddForm(want: Want): formBindingData.FormBindingData; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onCastToNormalForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onUpdateForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onChangeFormVisibility(newStatus: { [key: **string**]: **number** }): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onFormEvent(formId: **string**, message: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onRemoveForm(formId: **string**): **void**; | 新增 | +| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onShareForm?(formId: **string**): {[key: **string**]: **any**}; | 新增 | +| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**): Promise<**void**>; | 废弃 | +| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**): Promise<**void**>; | 新增 | +| @ohos.application.ServiceExtensionAbility | ServiceExtensionAbility | dump(params: Array<**string**>): Array<**string**>; | 废弃 | +| @ohos.app.ability.ServiceExtensionAbility | ServiceExtensionAbility | onDump(params: Array<**string**>): Array<**string**>; | 新增 | +| application/AbilityContext | AbilityContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 | +| application/AbilityContext | AbilityContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 | +| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 | +| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 | +| application/ApplicationContext | ApplicationContext | registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**): Promise<**void**>; | 废弃 | +| application/ApplicationContext | ApplicationContext | registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**): Promise<**void**>; | 废弃 | +| application/ApplicationContext | ApplicationContext | on(**type**: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**): Promise<**void**>; | 新增 | +| application/ApplicationContext | ApplicationContext | on(**type**: "environment", callback: EnvironmentCallback): **number**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**): Promise<**void**>; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectAbility(want: Want, options: ConnectOptions): **number**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**): Promise<**void**>; | 废弃 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbility(want: Want, options: ConnectOptions): **number**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | 新增 | +| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | 新增 | + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..e59049fbac5248afaa1d120c47ea574dc4da2fa4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-account_os_account.md @@ -0,0 +1,235 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 变更错误码定义及其返回方式 + +针对帐号子系统API存在错误码定义不统一和抛出方式不符合OpenHarmony错误码规范的问题,从API9开始作以下变更: + +- 新增统一的错误码定义: + - [帐号公共错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-account.md) + - [应用帐号错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-app-account.md) + +- 按以下方式返回错误码: + - 异步接口:错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。 + - 同步接口:错误信息通过抛出异常的方式返回。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下接口涉及新错误码和错误信息返回方式变更: + - class AccountManager + - activateOsAccount(localId: number, callback: AsyncCallback<void>): void; + - removeOsAccount(localId: number, callback: AsyncCallback<void>): void; + - setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean, callback: AsyncCallback<void>): void; + - setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void; + - queryMaxOsAccountNumber(callback: AsyncCallback<number>): void; + - queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void; + - createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void; + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>): void; + - queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void; + - getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void; + - setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void; + - on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void; + - off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void; + - isMainOsAccount(callback: AsyncCallback<boolean>): void; + - queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; + - class UserAuth + - constructor(); + - getVersion(): number; + - getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; + - getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void; + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; + - auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + - authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + - cancelAuth(contextID: Uint8Array): number; + - class PINAuth + - constructor(); + - registerInputer(inputer: IInputer): boolean; + - unregisterInputer(authType: AuthType): void; + - class UserIdentityManager + - constructor(); + - openSession(callback: AsyncCallback<Uint8Array>): void; + - addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + - updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + - closeSession(): void; + - cancel(challenge: Uint8Array): number; + - delUser(token: Uint8Array, callback: IIdmCallback): void; + - delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void; + - getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; + - interface IInputData + - onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; + +**适配指导** + +异步接口的错误信息处理逻辑以activateOsAccount为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" +let accountMgr = account_osAccount.getAccountManager() +let callbackFunc = (err) => { + if (err != null) { // handle the bussiness error + console.log("account_osAccount failed, error: " + JSON.stringify(err)); + } else { + console.log("account_osAccount successfully"); + } +} +try { + accountMgr.activateOsAccount("100", callbackFunc); +} catch (err) { // handle the parameter type error + console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err)); +} +try { + accountMgr.activateOsAccount(); +} catch (err) { // handle the parameter number error + console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err)); +} +``` + +同步接口的错误信息处理以registerInputer为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" +let pinAuth = new account_osAccount.PINAuth() +try { + pinAuth.registerInputer({}) +} catch (err) { // handle the parameter type error + console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err)); +} +try { + pinAuth.registerInputer() +} catch (err) { // handle the parameter number error + console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err)); +} +``` + +# 帐号子系统ChangeLog + +## cl.account_os_account.2 帐号SystemAPI错误信息返回方式变更 + +已发布的部分帐号SystemAPI使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +变更前: + + - class UserAuth + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; + - setProperty(request: SetPropertyRequest): Promise<number>; + - cancelAuth(contextID: Uint8Array): number; + - class PINAuth + - registerInputer(inputer: Inputer): boolean; + - UserIdentityManager + - cancel(challenge: Uint8Array): number; + +变更后: + + - class UserAuth + - setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; + - setProperty(request: SetPropertyRequest): Promise<void>; + - cancelAuth(contextID: Uint8Array): void; + - class PINAuth + - registerInputer(inputer: Inputer): void; + - UserIdentityManager + - cancel(challenge: Uint8Array): void; + +**适配指导** + +异步接口以setProperty为例,示例代码如下: + +``` +import account_osAccount from "@ohos.account.osAccount" +userAuth.setProperty({ + authType: account_osAccount.AuthType.PIN, + key: account_osAccount.SetPropertyType.INIT_ALGORITHM, + setInfo: new Uint8Array([0]) +}, (err) => { + if (err) { + console.log("setProperty failed, error: " + JSON.stringify(err)); + } else { + console.log("setProperty successfully"); + } +}); + +userAuth.setProperty({ + authType: account_osAccount.AuthType.PIN, + key: account_osAccount.SetPropertyType.INIT_ALGORITHM, + setInfo: new Uint8Array([0]) +}).catch((err) => { + if (err) { + console.log("setProperty failed, error: " + JSON.stringify(err)); + } else { + console.log("setProperty successfully"); + } +}); +``` + +同步接口以registerInputer为例,示例代码如下: + +``` +import account_osAccount from "@ohos.account.osAccount" +let pinAuth = new account_osAccount.PINAuth() +let inputer = { + onGetData: (authType, passwordRecipient) => { + let password = new Uint8Array([0]); + passwordRecipient.onSetData(authType, password); + } +} +try { + pinAuth.registerInputer(inputer); +} catch (err) { + console.log("registerInputer failed, error: " + JSON.stringify(err)); +} +``` + +## cl.account_os_account.3 应用帐号鉴权服务ACTION定义变更 + +**变更影响** + +基于此前版本开发的应用,需适配修改应用配置文件(FA模型为config.json或Stage模型为module.json5)中的ACTION才能正常对外提供应用鉴权服务。 + +**关键接口/组件变更** + +涉及的常量: + +@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH + +变更前: + +ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth" + +变更后: + +ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth" + +**适配指导** + +提供应用帐号鉴权服务的三方应用,需要在相关ServiceAbility的配置文件(FA模型为config.json或Stage模型为module.json5)中适配变更后的应用帐号认证ACTION,示例如下: + +``` +"abilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + ... + "visible": true, + "skills": { + { + "actions": [ + "ohos.appAccount.action.auth" + ] + } + } + }] +} + +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..4ce56f7346c9f1f0c92dc1037eb9eb1845e7a6e5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-arkui.md @@ -0,0 +1,126 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 xcomponent组件接口变更 + +arkui子系统xcomponent组件接口存在变更: + + - 去除getXComponentSurfaceId和setXComponentSurfaceSize接口的@systemapi标签 + - 指定getXComponentSurfaceId,getXComponentContext和setXComponentSurfaceSize接口的返回值类型 + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +影响已发布的JS接口,应用需要进行适配才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + + - getXComponentSurfaceId:改为public接口,指定返回值类型为string + - setXComponentSurfaceSize:改为public接口,指定返回值类型为void + - getXComponentContext:指定返回值类型为Object + +**适配指导** + +不同场景下的启动规则说明如下: +开发者适配内容: + + - **getXComponentSurfaceId** + - OpenHarmony 3.2-beta3 版本规则: + - 系统接口systemapi。 + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 公共接口。 + - 指定返回值类型为string + - 开发者需要按照string类型处理返回值 + - **setXComponentSurfaceSize** + - OpenHarmony 3.2-beta3 版本规则: + - 系统接口systemapi。 + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 公共接口。 + - 指定返回值类型为void + - 开发者需要按照void类型处理返回值 + - **getXComponentContext** + - OpenHarmony 3.2-beta3 版本规则: + - 未指定返回值 + - OpenHarmony 3.2-Beta4 版本新规则: + - 指定返回值类型为Object + - 开发者需要按照Object类型处理返回值 + +## cl.arkui.2 弹窗类组件接口样式变更 + +ArkUI子系统alertDialog, actionSheet, customDialog组件及prompt, promptAction接口存在样式变更: + + - promptAction.showDialog, promptAction.showActionMenu, alertDialog, actionSheet, customDialog更新弹窗底板模糊效果 + +**变更影响** + +默认弹窗底板模糊效果 + +**关键的接口/组件变更** + +涉及接口: promptAction.showDialog, promptAction.showActionMenu; +涉及组件: alertDialog, actionSheet, customDialog + +**适配指导** + +无需适配 + +## cl.arkui.3 自定义组件成员变量初始化的方式与约束校验场景补全 + +[自定义组件成员变量初始化规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。 + + +**变更影响** + +如果未按照文档规范,进行自定义组件成员变量初始化赋值,编译报错。 + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +按文档提示修改。 + +## cl.arkui.4 自定义父子组件成员变量赋值约束校验场景补全 + +[自定义父子组件成员变量赋值规则](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)请参考文档,此版本修复了某些遗漏场景的校验。 + + +**变更影响** + +如果自定义父子组件成员变量初始化未按照文档规范,编译报错。 + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +按文档提示修改,使用其它装饰器变量或常规变量赋值。 + +## cl.arkui.5 单一子组件校验补全 + +对 'Button', 'FlowItem','GridItem','GridCol','ListItem','Navigator','Refresh','RichText','ScrollBar','StepperItem','TabContent'等只支持一个子组件的开启校验。 + + +**变更影响** + +如果上述组件内有超过一个子组件,编译报错。 + +**关键的接口/组件变更** + +```js +RichText('RichText') { + Text('Text1') + Text('Text2') +} +/* ArkTS:ERROR File: /root/newOH/developtools/ace-ets2bundle/compiler/sample/pages/home.ets:25:7 + The component 'RichText' can only have a single child component. */ +``` + +**适配指导** + +按报错提示修改,指定组件内只能有一个子组件。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md new file mode 100644 index 0000000000000000000000000000000000000000..b7b5b8c3c884f8d23e6bd4bb2faf319702d88a29 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-camera.md @@ -0,0 +1,781 @@ +# 媒体子系统JS API变更Changelog + +## camera接口变更 +基于以下原因新增部分功能接口以及废弃部分接口: +1. 提升开发者使用相机接口的便利。 +2. 帮助开发者快速掌握相机开发接口,快速投入到开发当中。 +3. 易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。 + +具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ---------------------- | ----------------------- | ------------------------------------------------------------ | -------- | +| ohos.multimedia.camera | Profile | readonly format:CameraFormat; | 新增 | +| ohos.multimedia.camera | Profile | readonly size: Size; | 新增 | +| ohos.multimedia.camera | FrameRateRange | readonly min: number; | 新增 | +| ohos.multimedia.camera | FrameRateRange | readonly max: number; | 新增 | +| ohos.multimedia.camera | VideoProfile | readonly frameRateRange: FrameRateRange; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly previewProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly photoProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly videoProfiles: Array; | 新增 | +| ohos.multimedia.camera | CameraOutputCapability | readonly supportedMetadataObjectTypes: Array; | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>; | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | isCameraMuted(): boolean; | 新增 | +| ohos.multimedia.camera | CameraManager | isCameraMuteSupported(): boolean; | 新增 | +| ohos.multimedia.camera | CameraManager | muteCamera(mute: boolean): void; | 新增 | +| ohos.multimedia.camera | CameraManager | createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | 新增 | +| ohos.multimedia.camera | CameraManager | on(type: 'cameraMute', callback: AsyncCallback): void; | 新增 | +| ohos.multimedia.camera | CameraManager | getCameras(callback: AsyncCallback>): void;
getCameras(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraManager | createCameraInput(cameraId: string, callback: AsyncCallback): void;
createCameraInput(cameraId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createCaptureSession(context: Context, callback: AsyncCallback): void;
createCaptureSession(context: Context): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createPreviewOutput(surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | CreatePhotoOutput(surfaceId: string, callback: AsyncCallback): void;
CreatePhotoOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createVideoOutput(surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(surfaceId: string): Promise; | 废弃 | +| ohos.multimedia.camera | CameraManager | createMetadataOutput(callback: AsyncCallback): void;
createVideoOutput(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraStatusInfo | camera: CameraDevice; | 新增 | +| ohos.multimedia.camera | CameraStatusInfo | camera: Camera; | 废弃 | +| ohos.multimedia.camera | CameraDevice | interface CameraDevice | 新增 | +| ohos.multimedia.camera | Camera | interface Camera | 废弃 | +| ohos.multimedia.camera | CameraInput | open(callback: AsyncCallback): void;
open(): Promise; | 新增 | +| ohos.multimedia.camera | CameraInput | close(callback: AsyncCallback): void;
close(): Promise; | 新增 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 新增 | +| ohos.multimedia.camera | CameraInput | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getCameraId(callback: AsyncCallback): void;
getCameraId(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposurePoint(callback: AsyncCallback): void;
getExposurePoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposurePoint(exposurePoint: Point, callback: AsyncCallback): void;
setExposurePoint(exposurePoint: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 废弃 | +| ohos.multimedia.camera | CameraInput | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'focusStateChange', callback: AsyncCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'exposureStateChange', callback: AsyncCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', callback: ErrorCallback): void; | 废弃 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_NO_PERMISSION = 0 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_PREEMPTED = 1 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_DISCONNECTED = 2 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DEVICE_IN_USE = 3 | 新增 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_DRIVER_ERROR = 4 | 新增 | +| ohos.multimedia.camera | CameraFormat | CAMERA_FORMAT_RGBA_8888 = 3 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_AUTO = 1 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_CONTINUOUS_AUTO = 2 | 新增 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_AUTO | 废弃 | +| ohos.multimedia.camera | ExposureMode | EXPOSURE_MODE_CONTINUOUS_AUTO | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | LOW = 1 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | MIDDLE = 2 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | HIGH = 3 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | AUTO = 4 | 新增 | +| ohos.multimedia.camera | VideoStabilizationMode | LOW | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | MIDDLE | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | HIGH | 废弃 | +| ohos.multimedia.camera | VideoStabilizationMode | AUTO | 废弃 | +| ohos.multimedia.camera | CaptureSession | addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | on(type: 'focusStateChange', callback: AsyncCallback): void; | 新增 | +| ohos.multimedia.camera | CaptureSession | hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>; | 新增 | +| ohos.multimedia.camera | CaptureSession | setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>; | 新增 | +| ohos.multimedia.camera | CaptureSession | getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; | 新增 | +| ohos.multimedia.camera | CaptureSession | addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
addOutput(previewOutput: PreviewOutput): Promise;
addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
addOutput(photoOutput: PhotoOutput): Promise;
addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
addOutput(videoOutput: VideoOutput): Promise; | 废弃 | +| ohos.multimedia.camera | CaptureSession | removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
removeOutput(previewOutput: PreviewOutput): Promise;
removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
removeOutput(photoOutput: PhotoOutput): Promise;removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
removeOutput(videoOutput: VideoOutput): Promise;
removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
removeOutput(metadataOutput: MetadataOutput): Promise; | 废弃 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0 | 新增 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_TIMEOUT = 1 | 新增 | +| ohos.multimedia.camera | CameraOutput | release(callback: AsyncCallback): void;
release(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | start(callback: AsyncCallback): void;
start(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | stop(callback: AsyncCallback): void;
stop(): Promise; | 新增 | +| ohos.multimedia.camera | PreviewOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | PhotoOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | VideoOutput | release(callback: AsyncCallback): void;
release(): Promise; | 废弃 | +| ohos.multimedia.camera | PhotoCaptureSetting | mirror?: boolean; | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_DRIVER_ERROR = 0 | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_INSUFFICIENT_RESOURCES = 1 | 新增 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_TIMEOUT = 2 | 新增 | +| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_DRIVER_ERROR = 0 | 新增 | +| ohos.multimedia.camera | MetadataObjectType | FACE_DETECTION = 0 | 新增 | +| ohos.multimedia.camera | MetadataObjectType | FACE = 0 | 废弃 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 新增 | +| ohos.multimedia.camera | MetadataOutput | setCapturingMetadataObjectTypes(metadataObjectTypes: Array, callback: AsyncCallback): void;
setCapturingMetadataObjectTypes(metadataObjectTypes: Array): Promise; | 废弃 | +| ohos.multimedia.camera | MetadataOutput | getSupportedMetadataObjectTypes(callback: AsyncCallback>): void;
getSupportedMetadataObjectTypes(): Promise>; | 废弃 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1 | 新增 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0 | 新增 | +| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode; | 新增 | + +**适配指导** + +除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配: + +从Beta4版本开始,对以下接口进行调整: + +**新增接口** + +1. Profile接口 + + 属性1:readonly format,类型:CameraFormat; + + 属性2:readonly size,类型:Size; + +2. FrameRateRange接口 + + 属性1:readonly min,类型:number; + + 属性2:readonly max,类型:number; + +3. VideoProfile接口,继承自Profile + + 属性:readonly frameRateRange,类型:FrameRateRange; + +4. CameraOutputCapability接口 + + 属性1:readonly previewProfiles,类型:Array; + + 属性2:readonly photoProfiles,类型:Array; + + 属性3:readonly videoProfiles,类型:Array; + + 属性4:readonly supportedMetadataObjectTypes,类型:Array; + +5. CameraManager中新增 + + getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void; + + getSupportedOutputCapability(camera: CameraDevice): Promise; + + 参考代码如下: + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + let cameraDevice = cameras[0]; + cameraManager.getSupportedOutputCapability(cameraDevice, (err, CameraOutputCapability) => { + if (err) { + console.error(`Failed to get the outputCapability. ${err.message}`); + return; + } + console.log('Callback returned with an array of supported outputCapability'); + }) + }) + ``` + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + let cameraDevice = cameras[0]; + cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapability) => { + console.log('Promise returned with an array of supported outputCapability'); + }) + }) + ``` + +6. CameraManager中新增isCameraMuted(): boolean; + + 参考代码如下: + + ``` + let ismuted = cameraManager.isCameraMuted(); + ``` + +7. CameraManager中新增isCameraMuteSupported(): boolean; + + 参考代码如下: + + ``` + let ismutesuppotred = cameraManager.isCameraMuteSupported(); + ``` + +8. CameraManager中新增muteCamera(mute: boolean): void; + + 参考代码如下: + + ``` + let mute = true; + cameraManager.muteCamera(mute); + ``` + +9. CameraManager中新增on(type: 'cameraMute', callback: AsyncCallback): void; + + 参考代码如下: + + ``` + cameraManager.on('cameraMute', (err, curMuetd) => { + if (err) { + console.error(`Failed to get cameraMute callback. ${err.message}`); + return; + } + }) + ``` + +10. CameraInput中新增open(callback: AsyncCallback): void;以及open(): Promise; + +参考代码如下: + +``` +cameraInput.open((err) => { + if (err) { + console.error(`Failed to open the camera. ${err.message}`); + return; + } + console.log('Callback returned with camera opened.'); +}) +``` + +``` +cameraInput.open().then(() => { + console.log('Promise returned with camera opened.'); +}) +``` + +11. CameraInput中新增close(callback: AsyncCallback): void;以及close(): Promise; + + 参考代码如下: + + ``` + cameraInput.close((err) => { + if (err) { + console.error(`Failed to close the cameras. ${err.message}`); + return; + } + console.log('Callback returned with camera closed.'); + }) + ``` + + ``` + cameraInput.close().then(() => { + console.log('Promise returned with camera closed.'); + }) + ``` + +12. 枚举CameraInputErrorCode中新增 + + 枚举值名称:ERROR_NO_PERMISSION,值:0; + + 枚举值名称:ERROR_DEVICE_PREEMPTED,值:1; + + 枚举值名称:ERROR_DEVICE_DISCONNECTED,值:2; + + 枚举值名称:ERROR_DEVICE_IN_USE,值:3; + + 枚举值名称:ERROR_DRIVER_ERROR,值:4; + +13. 枚举CameraFormat中新增 + + 枚举值名称:CAMERA_FORMAT_RGBA_8888,值:3; + +14. CaptureSession中新增getMeteringPoint(callback: AsyncCallback): void;以及getMeteringPoint(): Promise; + + 参考代码如下: + + ``` + captureSession.getMeteringPoint((err, exposurePoint) => { + if (err) { + console.log(`Failed to get the current exposure point ${err.message}`); + return ; + } + console.log(`Callback returned with current exposure point: ${exposurePoint}`); + }) + ``` + + ``` + captureSession.getMeteringPoint().then((exposurePoint) => { + console.log(`Promise returned with current exposure point : ${exposurePoint}`); + }) + ``` + +15. CaptureSession中新增setMeteringPoint(point: Point, callback: AsyncCallback): void;以及setMeteringPoint(point: Point): Promise; + + 参考代码如下: + + ``` + const Point1 = {x: 1, y: 1}; + + captureSession.setMeteringPoint(Point1,(err) => { + if (err) { + console.log(`Failed to set the exposure point ${err.message}`); + return ; + } + console.log('Callback returned with the successful execution of setMeteringPoint'); + }) + ``` + + ``` + const Point2 = {x: 2, y: 2}; + + captureSession.setMeteringPoint(Point2).then(() => { + console.log('Promise returned with the successful execution of setMeteringPoint'); + }) + ``` + +16. 枚举CaptureSessionErrorCode中新增 + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0; + + 枚举值名称:ERROR_TIMEOUT,值:1; + +17. 新增接口CameraOutput,接口下有release(callback: AsyncCallback): void;以及release(): Promise;方法 + + 参考代码如下:用previewOutput做示例 + + ``` + previewOutput.release((err) => { + if (err) { + console.error(`Failed to release the PreviewOutput instance ${err.message}`); + return; + } + console.log('Callback invoked to indicate that the PreviewOutput instance is released successfully.'); + }); + ``` + + ``` + previewOutput.release().then(() => { + console.log('Promise returned to indicate that the PreviewOutput instance is released successfully.'); + }) + ``` + +18. PreviewOutput中新增start(callback: AsyncCallback): void;以及start(): Promise; + + 参考代码如下 + + ``` + previewOutput.start((err) => { + if (err) { + console.error(`Failed to start the previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput started.'); + }) + ``` + + ``` + previewOutput.start().then(() => { + console.log('Promise returned with previewOutput started.'); + }) + ``` + +19. PreviewOutput中新增stop(callback: AsyncCallback): void;以及stop(): Promise; + + 参考代码如下 + + ``` + previewOutput.stop((err) => { + if (err) { + console.error(`Failed to stop the previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput stopped.'); + }) + ``` + + ``` + previewOutput.stop().then(() => { + console.log('Callback returned with previewOutput stopped.'); + }) + ``` + +20. PhotoCaptureSetting接口 + + 属性1:mirror?,类型:boolean; + +21. 枚举PhotoOutputErrorCode中新增 + + 枚举值名称:ERROR_DRIVER_ERROR,值:0; + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:1; + + 枚举值名称:ERROR_TIMEOUT,值:2; + +22. 枚举VideoOutputErrorCode中新增 + + 枚举值名称:ERROR_DRIVER_ERROR,值:0; + +23. MetadataOutput中新增on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下 + + ``` + metadataOutput.on('error', (metadataOutputError) => { + console.log(`Metadata output error code: ${metadataOutputError.code}`); + }) + ``` + +24. MetadataOutputErrorCode枚举 + + 枚举值名称:ERROR_UNKNOWN,值:-1; + + 枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0; + +25. MetadataOutputError接口 + + 属性名称:code,值:MetadataOutputErrorCode + +**废弃接口** + +1. CameraInput中废弃接口on(type: 'exposureStateChange', callback: AsyncCallback): void; + +2. previewOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +3. metadataOutput中废弃接口 + + setCapturingMetadataObjectTypes(metadataObjectTypes: Array, callback: AsyncCallback): void;
setCapturingMetadataObjectTypes(metadataObjectTypes: Array): Promise; + +4. metadataOutput中废弃接口 + + getSupportedMetadataObjectTypes(callback: AsyncCallback>): void;
getSupportedMetadataObjectTypes(): Promise>; + +5. PreviewOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +6. PhotoOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +7. VideoOutput中废弃接口release(callback: AsyncCallback): void;以及release(): Promise; + +8. CameraInput中废弃接口getCameraId(callback: AsyncCallback): void;以及getCameraId(): Promise; + +9. CameraInput中废弃接口getExposurePoint(callback: AsyncCallback): void;以及getExposurePoint(): Promise; + +10. CameraInput中废弃接口setExposurePoint(exposurePoint: Point, callback: AsyncCallback): void;以及setExposurePoint(exposurePoint: Point): Promise; + +**接口变更** + +1. CameraManager中接口getCameras返回值由Array变更为Array,接口名由getCameras 更换为 getSupportedCameras,因此旧接口getCameras(callback: AsyncCallback>): void;以及getCameras(): Promise>;变更为getSupportedCameras(callback: AsyncCallback>): void和getSupportedCameras(): Promise>; + + 参考代码如下: + + ``` + cameraManager.getSupportedCameras((err, cameras) => { + if (err) { + console.error(`Failed to get the cameras. ${err.message}`); + return; + } + console.log(`Callback returned with an array of supported cameras: ${cameras.length}`); + }) + ``` + + ``` + cameraManager.getSupportedCameras().then((cameras) => { + console.log(`Promise returned with an array of supported cameras: ${cameras.length}`); + }) + ``` + +2. CameraManager中接口createCameraInput传递参数由原来cameraId: string变更为camera: CameraDevice,因此旧接口createCameraInput(cameraId: string, callback: AsyncCallback): void;以及createCameraInput(cameraId: string): Promise;变更为createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;和createCameraInput(camera: CameraDevice): Promise; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraManager.createCameraInput(cameraDevice, (err, cameraInput) => { + if (err) { + console.error(`Failed to create the CameraInput instance. ${err.message}`); + return; + } + console.log('Callback returned with the CameraInput instance.'); + }) + ``` + + ``` + let cameraDevice = cameras[0]; + cameraManager.createCameraInput(cameraDevice).then((cameraInput) => { + console.log('Promise returned with the CameraInput instance'); + }) + ``` + +3. CameraManager中接口createPreviewOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createPreviewOutput(surfaceId: string, callback: AsyncCallback): void;以及createPreviewOutput(surfaceId: string): Promise;变更为createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;createPreviewOutput(profile: Profile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + cameraManager.createPreviewOutput(profile, surfaceId, (err, previewOutput) => { + if (err) { + console.error(`Failed to gcreate previewOutput. ${err.message}`); + return; + } + console.log('Callback returned with previewOutput created.'); + }) + ``` + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + cameraManager.createPreviewOutput(profile, surfaceId).then((previewOutput) => { + console.log('Promise returned with previewOutput created.'); + }) + ``` + +4. CameraManager中接口createPhotoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口CreatePhotoOutput(surfaceId: string, callback: AsyncCallback): void;以及CreatePhotoOutput(surfaceId: string): Promise;变更为createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;和createPhotoOutput(profile: Profile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + cameraManager.createPhotoOutput(profile, surfaceId, (err, photoOutput) => { + if (err) { + console.error(`Failed to create photoOutput. ${err.message}`); + return; + } + console.log('Callback returned with photoOutput created.'); + }) + ``` + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + cameraManager.createPhotoOutput(profile, surfaceId).then((photoOutput) => { + console.log('Promise returned with photoOutput created.'); + }) + ``` + +5. CameraManager中接口createVideoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createVideoOutput(surfaceId: string, callback: AsyncCallback): void;以及createVideoOutput(surfaceId: string): Promise;变更为createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;和createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + cameraManager.createVideoOutput(profile, surfaceId, (err, videoOutput) => { + if (err) { + console.error(`Failed to create videoOutput. ${err.message}`); + return; + } + console.log('Callback returned with an array of supported outputCapability' ); + }) + ``` + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + cameraManager.createVideoOutput(profile, surfaceId).then((videoOutput) => { + console.log('Promise returned with videoOutput created.'); + }) + ``` + +6. CameraManager中接口createMetadataOutput新增传递参数metadataObjectTypes: Array,metadataObjectTypes参数由getSupportedOutputCapability接口获取,因此旧接口function createMetadataOutput(callback: AsyncCallback): void;以及function createMetadataOutput(): Promise;变更为createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;和createMetadataOutput(metadataObjectTypes: Array): Promise; + + 参考代码如下: + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + cameraManager.createMetadataOutput(metadataObjectTypes, (err, metadataOutput) => { + if (err) { + console.error(`Failed to create metadataOutput. ${err.message}`); + return; + } + console.log('Callback returned with metadataOutput created.'); + }) + ``` + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + cameraManager.createMetadataOutput(metadataObjectTypes).then((metadataOutput) => { + console.log('Promise returned with metadataOutput created.'); + }) + ``` + +7. CameraManager中createCaptureSession不需要考虑context属性,因此旧接口createCaptureSession(context: Context, callback: AsyncCallback): void;以及createCaptureSession(context: Context): Promise;改为createCaptureSession(callback: AsyncCallback): void;和createCaptureSession(): Promise; + + 参考代码如下: + + ```typescript + cameraManager.createCaptureSession((err, captureSession) => { + if (err) { + console.error(`Failed to create captureSession. ${err.message}`); + return; + } + console.log('Callback returned with captureSession created.'); + }) + ``` + + ``` + cameraManager.createCaptureSession().then((captureSession) => { + console.log('Promise returned with captureSession created.'); + }) + ``` + +8. CameraStatusInfo接口下属性camera类型由Camera变更为CameraDevice + +9. CameraInput中接口on(type: 'error')新增传递参数camera: CameraDevice,因此旧接口on(type: 'error', callback: ErrorCallback): void;变更为on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraInput.on('error', cameraDevice, (cameraInputError) => { + console.log(`Camera input error code: ${cameraInputError.code}`); + }) + ``` + +10. CameraInput中以下接口调整到CaptureSession中 + + hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
+ + isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
+ + getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
+ + setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
+ + isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
+ + getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
+ + setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
+ + getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
+ + setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
+ + getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
+ + setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
+ + getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
+ + isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
+ + getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
+ + setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
+ + setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
+ + getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
+ + getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
+ + getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
+ + getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
+ + setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise; + +11. CameraInput中接口on(type: 'focusStateChange', callback: AsyncCallback): void;调整到CaptureSession中,对应接口on(type: 'focusStateChange', callback: AsyncCallback): void; + + 参考代码如下: + + ``` + captureSession.on('focusStateChange', (focusState) => { + console.log(`Focus state : ${focusState}`); + }) + ``` + +12. 枚举ExposureMode中 + + 枚举值名称:EXPOSURE_MODE_AUTO,初值由默认变更为1; + + 枚举值名称:EXPOSURE_MODE_CONTINUOUS_AUTO,初值由默认变更为2; + +13. 枚举VideoStabilizationMode中 + + 枚举值名称:LOW,初值由默认变更为1; + + 枚举值名称:MIDDLE,初值由默认变更为2; + + 枚举值名称:HIGH,初值由默认变更为3; + + 枚举值名称:AUTO,初值由默认变更为4; + +14. CaptureSession中接口addOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。 + + 改变前接口为: + + addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
addOutput(previewOutput: PreviewOutput): Promise;
addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
addOutput(photoOutput: PhotoOutput): Promise;
addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
addOutput(videoOutput: VideoOutput): Promise;
addOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
addOutput(metadataOutput: MetadataOutput): Promise; + + 改变后接口为: + + addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise; + + 参考代码如下:以PreviewOutput为例 + + ``` + captureSession.addOutput(previewOutput, (err) => { + if (err) { + console.error(`Failed to add output. ${err.message}`); + return; + } + console.log('Callback returned with output added.'); + }) + ``` + + ``` + captureSession.addOutput(previewOutput).then(() => { + console.log('Promise returned with cameraOutput added.'); + }) + ``` + +15. CaptureSession中接口removeOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。 + + 改变前接口为: + + removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void;
removeOutput(previewOutput: PreviewOutput): Promise;
removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void;
removeOutput(photoOutput: PhotoOutput): Promise;
removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void;
removeOutput(videoOutput: VideoOutput): Promise;
removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback): void;
removeOutput(metadataOutput: MetadataOutput): Promise; + + 改变后接口为: + + removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise; + + 参考代码如下:以PreviewOutput为例 + + ``` + captureSession.removeOutput(previewOutput, (err) => { + if (err) { + console.error(`Failed to remove the CameraOutput instance. ${err.message}`); + return; + } + console.log('Callback invoked to indicate that the CameraOutput instance is removed.'); + }); + ``` + + ``` + captureSession.removeOutput(previewOutput).then(() => { + console.log('Promise returned to indicate that the CameraOutput instance is removed.'); + }) + ``` + +16. 枚举MetadataObjectType中 + + 枚举值名称由FACE变更为FACE_DETECTION; + +17. 接口Camera名称更改为CameraDevice diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..fae8ef1cad1a2526e86c85b4be6d64e690e285ce --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-manager.md @@ -0,0 +1,106 @@ +# 设备管理changeLog + +## cl.device_manager.1 API错误信息返回方式变更 + +设备管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +在以下接口增加错误码处理: + - createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void; + - release(): void; + - getTrustedDeviceListSync(): Array<DeviceInfo> + - getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void; + - getTrustedDeviceList(): Promise<Array<DeviceInfo>> + - getLocalDeviceInfoSync(): DeviceInfo; + - getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void; + - getLocalDeviceInfo(): Promise<DeviceInfo> + - startDeviceDiscovery(subscribeInfo: SubscribeInfo): void; + - startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void; + - stopDeviceDiscovery(subscribeId: number): void; + - publishDeviceDiscovery(publishInfo: PublishInfo): void; + - unPublishDeviceDiscovery(publishId: number): void; + - authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void; + - unAuthenticateDevice(deviceInfo: DeviceInfo): void; + - verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void; + - setUserOperation(operateAction: number, params: string): void; + - on(type: 'uiStateChange', callback: Callback<{ param: string}>): void; + - off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void; + - on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; + - off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; + - on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void; + - off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void; + - on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void; + - off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void; + - on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): void; + - off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void; + - on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void; + - off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void; + - on(type: 'serviceDie', callback: () => void): void; + - off(type: 'serviceDie', callback?: () => void): void; + +**适配指导** + +异步接口以getTrustedDeviceList为例,示例代码如下: + +```ts +import account_osAccount from "@ohos.distributedHardware.deviceManager" +dmInstance.getTrustedDeviceList((err, data) => { + console.log("getTrustedDeviceList err: " + JSON.stringify(err)); + console.log('get trusted device info: ' + JSON.stringify(data)); +}); + +try { + dmInstance.getTrustedDeviceList((err, data) => { + if (err) { + console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message); + return; + } + console.log('get trusted device info: ' + JSON.stringify(data)); + }); +} catch (err) { + console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +同步接口以startDeviceDiscovery为例,示例代码如下: + +```ts +// 生成发现标识,随机数确保每次调用发现接口的标识不一致 +var subscribeId = Math.floor(Math.random() * 10000 + 1000); +var subscribeInfo = { + "subscribeId": subscribeId, + "mode": 0xAA, // 主动模式 + "medium": 0, // 自动发现类型,同时支持多种发现类型 + "freq": 2, // 高频率 + "isSameAccount": false, + "isWakeRemote": false, + "capability": 1 +}; +dmInstance.startDeviceDiscovery(subscribeInfo); // 当有设备发现时,通过deviceFound回调通知给应用程序 + +// 生成发现标识,随机数确保每次调用发现接口的标识不一致 +var subscribeId = Math.floor(Math.random() * 10000 + 1000); +var subscribeInfo = { + "subscribeId": subscribeId, + "mode": 0xAA, // 主动模式 + "medium": 0, // 自动发现类型,同时支持多种发现类型 + "freq": 2, // 高频率 + "isSameAccount": false, + "isWakeRemote": false, + "capability": 1 +}; +try { + dmInstance.startDeviceDiscovery(subscribeInfo); // 当有设备发现时,通过deviceFound回调通知给应用程序 +} catch (err) { + console.error("startDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..15629e935378b84f4f5aab0bebde0e4523c3ee00 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-device-usb.md @@ -0,0 +1,27 @@ +# USB管理 changeLog + +## cl.usb_manager.1 API错误信息返回方式变更 + +USB管理接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作出变更,选择通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +USB模块名由@ohos.usb.d.ts 变更为 @ohos.usbV9.d.ts,模块内所有接口均增加错误码处理。 + +**适配指导** + +接口以getDevices为例,示例代码如下: + +```ts +import usbV9 from '@ohos.usbV9' + +try { +usbV9.getDevices(); // 如果给该接口传入不合适的参数,则会抛出异常 +} catch (err) { +console.error("getDevices errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md new file mode 100644 index 0000000000000000000000000000000000000000..6876e374974e37a027a336788294f9ef6fbf3fdc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dmsfwk.md @@ -0,0 +1,122 @@ +# 分布式调度子系统ChangeLog + +## cl.DistributedManagerService.1 continuationManager事件监听接口on/off变更 + +- continuationManager事件监听接口on/off传入的参数事件类型名,命名不符合OpenHarmony的API接口规范。 +- continuationManager.on对于不同的事件接口返回值未进行统一,不符合OpenHarmony的API接口规范。 + +已做出以下变更: + +- continuationManager.on和continuationManager.off的设备选择事件名由原来的"deviceConnect"变更为"deviceSelected",设备取消选择事件名由原来的"deviceDisconnect"变更为"deviceUnselected"。 +- continuationManager.on对于不同事件统一callback返回值类型"Callback<Array<ContinuationResult>>"。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +- 涉及接口 + + continuationManager.on; + continuationManager.off; + +- 变更前: + +```js + function on(type: "deviceConnect", token: number, callback: Callback>): void; + function off(type: "deviceConnect", token: number): void; + function on(type: "deviceDisconnect", token: number, callback: Callback>): void; + function off(type: "deviceDisconnect", token: number): void; +``` + +- 变更后: + +```js + function on(type: "deviceSelected", token: number, callback: Callback>): void; + function off(type: "deviceSelected", token: number): void; + function on(type: "deviceUnselected", token: number, callback: Callback>): void; + function off(type: "deviceUnselected", token: number): void; +``` + +**适配指导** +修改事件名称,示例代码如下: + +continuationManager.on 设备选择事件 + +```ts + let token = 1; + try { + continuationManager.on("deviceSelected", token, (data) => { + console.info('onDeviceSelected len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name)); + } + }); + } catch (err) { + console.error('on failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.off 设备选择事件 + +```ts + let token = 1; + try { + continuationManager.off("deviceSelected", token); + } catch (err) { + console.error('off failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.on 设备取消选择事件 + +```ts + let token = 1; + try { + continuationManager.on("deviceUnselected", token, (data) => { + console.info('onDeviceUnselected len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name)); + } + console.info('onDeviceUnselected finished.'); + }); + } catch (err) { + console.error('on failed, cause: ' + JSON.stringify(err)); + } +``` + +continuationManager.off 设备取消选择事件 + +```ts + let token = 1; + try { + continuationManager.off("deviceUnselected", token); + } catch (err) { + console.error('off failed, cause: ' + JSON.stringify(err)); + } +``` + +## cl.DistributedManagerService.2 continuationManager接口新增DATASYNC权限校验 + +此前版本continuationManager接口未对调用方进行校验,不符合OpenHarmony的API接口规范。 +已做出以下变更:调用方使用continuationManager前需提前申请"ohos.permission.DISTRIBUTED_DATASYNC"权限。 + +**变更影响** + +基于此前版本开发的应用,需提前申请"ohos.permission.DISTRIBUTED_DATASYNC"权限,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +涉及接口 + + - continuationManager.registerContinuation; + - continuationManager.on; + - continuationManager.off; + - continuationManager.unregisterContinuation; + - continuationManager.updateContinuationState; + - continuationManager.startContinuationDeviceManager; \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md new file mode 100644 index 0000000000000000000000000000000000000000..e52128d7c3aaf93f56a760fa9cf0e2d95ad6dee4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-dsoftbus.md @@ -0,0 +1,145 @@ +# 软总线子系统Changelog + +## IPC&RPC API支持异常处理方式和支持传入布尔值与数值选择同步或异步方式发送信息变更 +1. 软总线IPC&RPC部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误规范; +2. 支持传入布尔值选择同步或异步方式发送信息。 +#### 变更影响 + +此版本兼容之前的应用开发,不需要适配,后续可调用新增接口支持以下两个变更: +1. 支持异常处理并返回错误码; +2. 提供通过布尔值或通过0与非0数字选择同步或异步发消息。 + +#### 关键接口/组件变更 + +为适配统一的API异常处理方式,对IPC&RPC相关接口进行废弃,并新增对应接口和方法。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 +| 类名 | 废弃接口 | 新增替换类名 | 新增替代接口 | +| ------------ | ------------ | ------------ | ------------ | +| MessageParcel | static create(): MessageParcel | MessageSequence | static create(): MessageSequence | +| MessageParcel | reclaim(): void | MessageSequence | reclaim(): void | +| MessageParcel | writeRemoteObject(object: IRemoteObject): boolean| MessageSequence |writeRemoteObject(object: IRemoteObject): void| +| MessageParcel | readRemoteObject(): IRemoteObject | MessageSequence | readRemoteObject(): IRemoteObject | +| MessageParcel | writeInterfaceToken(token: string): boolean | MessageSequence | writeInterfaceToken(token: string): void | +| MessageParcel | readInterfaceToken(): string | MessageSequence | readInterfaceToken(): string | +| MessageParcel | getSize(): number | MessageSequence | getSize(): number | +| MessageParcel | getCapacity(): number | MessageSequence | getCapacity(): number| +| MessageParcel | setSize(size: number): boolean | MessageSequence | setCapacity(size: number): void | +| MessageParcel | getReadableBytes(): number | MessageSequence | getReadableBytes(): number | +| MessageParcel | getReadPosition(): number | MessageSequence | getReadPosition(): number | +| MessageParcel | getWritePosition(): number | MessageSequence | getWritePosition(): number | +| MessageParcel | rewindRead(pos: number): boolean | MessageSequence | rewindRead(pos: number): void | +| MessageParcel | rewindWrite(pos: number): boolean | MessageSequence | rewindWrite(pos: number): void | +| MessageParcel | writeNoException(): void | MessageSequence | writeNoException(): void | +| MessageParcel | readException(): void | MessageSequence | readException(): void | +| MessageParcel | writeByte(val: number): boolean | MessageSequence | writeByte(val: number): void | +| MessageParcel | writeShort(val: number): boolean | MessageSequence | writeShort(val: number): void | +| MessageParcel | writeInt(val: number): boolean | MessageSequence | writeInt(val: number): void | +| MessageParcel | writeLong(val: number): boolean | MessageSequence | writeLong(val: number): void | +| MessageParcel | writeFloat(val: number): boolean | MessageSequence | writeFloat(val: number): void | +| MessageParcel | writeDouble(val: number): boolean | MessageSequence | writeDouble(val: number): void | +| MessageParcel | writeBoolean(val: boolean): boolean | MessageSequence | writeBoolean(val: boolean): void | +| MessageParcel | writeChar(val: number): boolean | MessageSequence | writeChar(val: number): void | +| MessageParcel | writeString(val: string): boolean | MessageSequence | writeString(val: string): void | +| MessageParcel | writeSequenceable(val: Sequenceable): boolean | MessageSequence | writeParcelable(val: Parcelable): void | +| MessageParcel | writeByteArray(byteArray: number[]): boolean | MessageSequence | writeByteArray(byteArray: number[]): void | +| MessageParcel | writeShortArray(shortArray: number[]): boolean | MessageSequence | writeShortArray(shortArray: number[]): void | +| MessageParcel | writeIntArray(intArray: number[]): boolean | MessageSequence | writeIntArray(intArray: number[]): void | +| MessageParcel | writeLongArray(longArray: number[]): boolean | MessageSequence | writeLongArray(longArray: number[]): void | +| MessageParcel | writeFloatArray(floatArray: number[]): boolean | MessageSequence | writeFloatArray(floatArray: number[]): void | +| MessageParcel | writeDoubleArray(doubleArray: number[]): boolean | MessageSequence | writeDoubleArray(doubleArray: number[]): void | +| MessageParcel | writeBooleanArray(booleanArray: boolean[]): boolean | MessageSequence | writeBooleanArray(booleanArray: boolean[]): void | +| MessageParcel | writeCharArray(charArray: number[]): boolean | MessageSequence | writeCharArray(charArray: number[]): void | +| MessageParcel | writeStringArray(stringArray: string[]): boolean | MessageSequence | writeStringArray(stringArray: string[]): void | +| MessageParcel | writeSequenceableArray(sequenceableArray: Sequenceable[]): boolean | MessageSequence | writeParcelableArray(sequenceableArray: Parcelable[]): void | +| MessageParcel | writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean | MessageSequence | writeRemoteObjectArray(objectArray: IRemoteObject[]): void | +| MessageParcel | readByte(): number | MessageSequence | readByte(): number | +| MessageParcel | readShort(): number | MessageSequence | readShort(): number | +| MessageParcel | readLong(): number | MessageSequence | readLong(): number | +| MessageParcel | readFloat(): number | MessageSequence | readFloat(): number | +| MessageParcel | readDouble(): number | MessageSequence | readDouble(): number | +| MessageParcel | readBoolean(): boolean | MessageSequence | readBoolean(): boolean | +| MessageParcel | readChar(): number | MessageSequence | readChar(): number | +| MessageParcel | readString(): string | MessageSequence | readString(): string | +| MessageParcel | readSequenceable(dataIn: Sequenceable) : boolean | MessageSequence | readSequenceable(dataIn: Parcelable) : void | +| MessageParcel | readByteArray(dataIn: number[]) : void | MessageSequence | readByteArray(dataIn: number[]) : void | +| MessageParcel | readByteArray(): number[] | MessageSequence | readByteArray(): number[] | +| MessageParcel | readShortArray(dataIn: number[]) : void | MessageSequence | readShortArray(dataIn: number[]) : void | +| MessageParcel | readShortArray(): number[] | MessageSequence | readShortArray(): number[] | +| MessageParcel | readIntArray(dataIn: number[]) : void | MessageSequence | readIntArray(dataIn: number[]) : void | +| MessageParcel | readIntArray() : number[] | MessageSequence | readIntArray() : number[] | +| MessageParcel | readLongArray(dataIn: number[]) : void | MessageSequence | readLongArray(dataIn: number[]) : void | +| MessageParcel | readLongArray(): number[] | MessageSequence | readLongArray(): number[] | +| MessageParcel | readFloatArray(dataIn: number[]) : void | MessageSequence | readFloatArray(dataIn: number[]) : void | +| MessageParcel | readFloatArray(): number[] | MessageSequence | readFloatArray(): number[] | +| MessageParcel | readDoubleArray(dataIn: number[]) : void | MessageSequence | readDoubleArray(dataIn: number[]) : void | +| MessageParcel | readDoubleArray(): number[] | MessageSequence | readDoubleArray(): number[] | +| MessageParcel | readBooleanArray(dataIn: boolean[]) : void | MessageSequence | readBooleanArray(dataIn: boolean[]) : void | +| MessageParcel | readBooleanArray(): boolean[] | MessageSequence | readBooleanArray(): boolean[] | +| MessageParcel | readCharArray(dataIn: number[]) : void | MessageSequence | readCharArray(dataIn: number[]) : void | +| MessageParcel | readCharArray(): number[] | MessageSequence | readCharArray(): number[] | +| MessageParcel | readStringArray(dataIn: string[]) : void | MessageSequence | readStringArray(dataIn: string[]) : void | +| MessageParcel | readStringArray(): string[] | MessageSequence | readStringArray(): string[] | +| MessageParcel | readSequenceableArray(sequenceableArray: Sequenceable[]): void | MessageSequence | readSequenceableArray(sequenceableArray: Parcelable[]): void | +| MessageParcel | readRemoteObjectArray(objects: IRemoteObject[]): void | MessageSequence | readRemoteObjectArray(objects: IRemoteObject[]): void | +| MessageParcel | readRemoteObjectArray(): IRemoteObject[] | MessageSequence | readRemoteObjectArray(): IRemoteObject[] | +| MessageParcel | static closeFileDescriptor(fd: number): void | MessageSequence | static closeFileDescriptor(fd: number): void | +| MessageParcel | static dupFileDescriptor(fd: number) :number | MessageSequence | static dupFileDescriptor(fd: number) :number | +| MessageParcel | containFileDescriptors(): boolean | MessageSequence | containFileDescriptors(): boolean | +| MessageParcel | writeFileDescriptor(fd: number): boolean | MessageSequence | writeFileDescriptor(fd: number): void | +| MessageParcel | readFileDescriptor(): number | MessageSequence | readFileDescriptor(): number | +| MessageParcel | writeAshmem(ashmem: Ashmem): boolean | MessageSequence | writeAshmem(ashmem: Ashmem): void | +| MessageParcel | readAshmem(): Ashmem | MessageSequence | readAshmem(): Ashmem | +| MessageParcel | writeRawData(rawData: number[], size: number): boolean | MessageSequence | writeRawData(rawData: number[], size: number): void | +| MessageParcel | readRawData(size: number): number[] | MessageSequence | readRawData(size: number): number[] | +| Sequenceable | marshalling(dataOut: MessageParcel): boolean | Parcelable | marshalling(dataOut: MessageSequence): boolean | +| Sequenceable | unmarshalling(dataIn: MessageParcel) : boolean | Parcelable | unmarshalling(dataIn: MessageSequence) : boolean | +| SendRequestResult | errCode: number | RequestResult | errCode: number | +| SendRequestResult | code: number | RequestResult | code: number | +| SendRequestResult | data: MessageParcel | RequestResult | data: MessageSequence | +| SendRequestResult | reply: MessageParcel | RequestResult | reply: MessageSequence | +| IRemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| IRemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| IRemoteObject | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void | +| IRemoteObject | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void | +| IRemoteObject | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| IRemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption,callback: AsyncCallback): void | +| MessageOption | NA | NA | isAsync(): boolean | +| MessageOption | NA | NA | setAsync(async: boolean): void | +| MessageOption | NA | NA | constructor(async?: boolean) | +| RemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| RemoteObject | attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void | NA | modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void | +| RemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| RemoteObject | onRemoteRequestEx(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean \| Promise | NA | onRemoteMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): boolean \| Promise | +| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback): void | +| RemoteProxy | queryLocalInterface(interface: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker | +| RemoteProxy | getInterfaceDescriptor(): string | NA | getDescriptor(): string | +| RemoteProxy | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void | +| RemoteProxy | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void | +| RemoteProxy | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise | +| RemoteProxy | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback): void | +| IPCSkeleton | static flushCommands(object: IRemoteObject): number | NA | static flushCmdBuffer(object: IRemoteObject): void | +| IPCSkeleton | static setCallingIdentity(identity: string): boolean | NA | static restoreCallingIdentity(identity: string): void | +| Ashmem | static createAshmem(name: string, size: number): Ashmem | NA | static create(name: string, size: number): Ashmem | +| Ashmem | static createAshmemFromExisting(ashmem: Ashmem): Ashmem | NA | static create(ashmem: Ashmem): Ashmem | +| Ashmem | mapAshmem(mapType: number): boolean | NA | mapTypedAshmem(mapType: number): void | +| Ashmem | mapReadAndWriteAshmem(): boolean | NA | mapReadWriteAshmem(): void | +| Ashmem | mapReadOnlyAshmem(): boolean | NA | mapReadonlyAshmem(): void | +| Ashmem | setProtection(protectionType: number): boolean | NA | setProtectionType(protectionType: number): void | +| Ashmem | writeToAshmem(buf: number[], size: number, offset: number): boolean | NA | writeAshmem(buf: number[], size: number, offset: number): void | +| Ashmem | readFromAshmem(size: number, offset: number): number[] | NA | readAshmem(size: number, offset: number): number[] | + +#### 适配指导 + +新增的接口以抛异常的方式返回错误码及对应的错误信息,以MessageParcel中的create接口为例,使用示例代码如下: +```js +import rpc from '@ohos.rpc' + +try { + var data = rpc.MessageParcel.create(); + data.reclaim(); +} catch (error) { + console.info("create meassageParcel failed, errorCode = " + error.errCode); + console.info("create meassageParcel failed, errorMessage = " + error.errorMessage); +} +``` +更多接口的示例代码可参考[RPC通信API文档](../../../application-dev/reference/apis/js-apis-rpc.md)。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md new file mode 100644 index 0000000000000000000000000000000000000000..1a345ef8f67651188c67f4365154d16c5102f1d0 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-enterprise_device_management.md @@ -0,0 +1,157 @@ +# 定制子系统ChangeLog + +## cl.Customization.1 企业设备管理模块名称变更 + +从Opeharmonny 3.2.8.3版本开始,将"@ohos.enterpriseDeviceManager.d.ts"改为"@ohos.enterprise.adminManager.d.ts",开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| 原接口 | 新接口 | +| --------------------------------- | ---------------------------------- | +| @ohos.enterpriseDeviceManager.d.ts | @ohos.enterprise.adminManager.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.enterpriseDeviceManager: + +```js +import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import enterpriseDeviceManager from '@ohos.enterprise.adminManager'; +``` + +## cl.Customization.2 enterpriseDeviceManager/DeviceSettingsManager.d.ts模块变更 + +从Opeharmonny 3.2.8.3版本开始,将enterpriseDeviceManager/DeviceSettingsManager.d.ts更改为"ohos.enterprise.dateTimeManager.d.ts"。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| 原接口 | 原接口类型 | 新接口 | 新接口类型 | +| --------------------------------- | --------- | ---------------------------------- | ----- | +| enterpriseDeviceManager/DeviceSettingsManager.d.ts | interface | @ohos.enterprise.dateTimeManager.d.ts | namespace | + +**适配指导** + +若原先使用的enterpriseDeviceManager/DeviceSettingsManager.d.ts的setDateTime接口。 + +```js +import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' + +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + mgr.setDateTime(wantTemp, 1526003846000, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } + }); +}); +``` + +需要import新的namespace进行适配。 + +```js +import dateTimeManager from '@ohos.enterprise.dateTimeManager' + +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}) +``` + +## cl.Customization.3 systemapi变更 + +从Opeharmonny 3.2.8.3版本开始,企业设备管理所有接口变更为systemapi。 + +**变更影响** + +所有接口只允许系统应用调用,非系统应用无法调用接口。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId?: number): Promise<**boolean**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want, callback: AsyncCallback<**EnterpriseInfo**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want): Promise<**EnterpriseInfo**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String, callback: AsyncCallback<**boolean**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String): Promise<**boolean**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | systemapi | +| @ohos.enterprise.adminManager | adminManager | **interface** EnterpriseInfo | systemapi | +| @ohos.enterprise.adminManager | adminManager | **enum** AdminType | systemapi | +| @ohos.enterprise.adminManager | adminManager | **enum** ManagedEvent | systemapi | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | systemapi | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | systemapi | + +## cl.Customization.4 接口权限变更 + +从Opeharmonny 3.2.8.3版本开始,部分接口新增权限校验。 + +**变更影响** + +在Opeharmonny 3.2.8.3之前版本已开发的应用,需要持有相应权限,否则无法正常调用接口。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 新增权限 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | ohos.permission.SET_ENTERPRISE_INFO | +| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | ohos.permission.SET_ENTERPRISE_INFO | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SET_DATETIME | +| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | ohos.permission.ENTERPRISE_SET_DATETIME | + +**适配指导** + +调用以上接口,需要申请相应的权限才能正常调用。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md new file mode 100644 index 0000000000000000000000000000000000000000..15cf796c6820cfb09820d43fe3e4c52d7b7f15f9 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-filemanagement.md @@ -0,0 +1,90 @@ +# 文件管理子系统ChangeLog + +## cl.filemanagement.1 fileio相关接口异常处理方式变更 + +file_api部件fileio接口返回值不包含错误码error.code,现进行错误码整改,废弃原有相关接口,新增相关接口。 + +**变更影响** + +基于此前版本开发的应用,需注意废弃接口的迭代更新。新接口在接口规格上进行了微调,需注意新接口使用方法。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对fileio相关接口进行废弃,并新增对应接口,原接口位于@ohos.fileio,新接口位于@ohos.file.fs。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致,参数上有微调。 + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------------------------------------------------ | -------- | +| @ohos.fileio | **function** open(path: string, flags?: number, mode?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** openSync(path: string, flags?: number, mode?: number): number; | 废弃 | +| @ohos.file.fs | **function** open(path: string, mode?: number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** openSync(path: string, mode?: number): File; | 新增 | +| @ohos.fileio | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number; | 废弃 | +| @ohos.file.fs | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number; | 新增 | +| @ohos.fileio | **function** stat(path: string, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** statSync(path: string): Stat; | 废弃 | +| @ohos.fileio | **function** fstat(fd: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** fstatSync(fd: number): Stat; | 废弃 | +| @ohos.file.fs | **function** stat(file: string \| number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** statSync(file: string \| number): Stat; | 新增 | +| @ohos.fileio | **function** truncate(path: string, len?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** truncateSync(path: string, len?: number): void; | 废弃 | +| @ohos.fileio | **function** ftruncate(fd: number, len?: number, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** ftruncateSync(fd: number, len?: number): void; | 废弃 | +| @ohos.file.fs | **function** truncate(file: string \| number, len?: number, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** truncateSync(file: string \| number, len?: number): void; | 新增 | +| @ohos.fileio | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback): void \| Promise; | 废弃 | +| @ohos.fileio | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number; | 废弃 | +| @ohos.file.fs | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback): void \| Promise; | 新增 | +| @ohos.file.fs | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number; | 新增 | + +**适配指导** + +原接口使用的是@ohos.fileio,以以下方式import: + +```js +import fileio from '@ohos.fileio'; +``` + +现新接口使用的是@ohos.file.fs,以以下方式import: + +```js +import fs from '@ohos.file.fs'; +``` + +此外还需要适配异常处理,同步接口异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + let file = fs.openSync(path, fs.OpenMode.READ_ONLY); +} catch (err) { + console.error("openSync errCode:" + err.code + ", errMessage:" + err.message); +} +``` +异步接口promise方法异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + let file = await fs.open(path, fs.OpenMode.READ_ONLY); +} catch (err) { + console.error("open promise errCode:" + err.code + ", errMessage:" + err.message); +} +``` + +异步接口callback方法异常处理示例代码: +```js +import fs from '@ohos.file.fs' + +try { + fs.open(path, fs.OpenMode.READ_ONLY, function(e, file){ //异步线程的错误(如系统调用等)在回调中获取 + if (e) { + console.error("open in async errCode:" + e.code + ", errMessage:" + e.message); + } + }); +} catch (err) { //主线程的错误(如非法参数等)通过try catch获取 + console.error("open callback errCode:" + err.code + ", errMessage:" + err.message); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..0831c78d7b4c0688e87bea0294806f43ccb74640 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-geolocation.md @@ -0,0 +1,116 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 系统API和API9接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,而API9和systemApi都需要支持抛出错误码,为了支持该功能,把@ohos.geolocation.d.ts中systemApi和API9所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的系统API和API9接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +仅对系统API和API9所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务的系统API和API9接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +对于其他接口无影响。 + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| namespace | declare namespacegeolocation| API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface ReverseGeocodingMockInfo | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface LocationMockConfig | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | interface | export interface CountryCode | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation | enum | export enum CountryCodeType | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoAddress | field | isFromMock?: Boolean; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.Location | field | isFromMock?: Boolean; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoLocationErrorCode | field | NOT_SUPPORTED = 100 | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation.GeoLocationErrorCode | field | QUERY_COUNTRY_CODE_ERROR | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCountryCode(callback: AsyncCallback<CountryCode>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCountryCode(): Promise<CountryCode>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | API9接口变更,该接口删除。 | +|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario): Promise<void>; | API9接口变更,该接口删除。 | +|geolocation| method | function enableLocationMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | API9接口变更,该接口删除。 | +|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario): Promise<void>; | API9接口变更,该接口删除。 | +|geolocation| method | function disableLocationMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise<boolean>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<boolean>): void; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts,callback返回值改为void。 | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<boolean>; | API9接口变更,迁移到@ohos.geoLocationManager.d.ts,promise返回值改为void。 | + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` + +## cl.location.2 位置服务权限变更 + +从API9开始,增加ohos.permission.APPROXIMATELY_LOCATION,表示模糊位置权限。 + +如果应用开发者使用的API版本大于等于9,则需要同时申请ohos.permission.LOCATION和ohos.permission.APPROXIMATELY_LOCATION,单独申请ohos.permission.LOCATION会失败。 + +**变更影响** + +如果是存量应用(使用的API版本小于9),则无影响。如果使用的API版本大于等于9,位置服务权限申请方式有变更,详情如下: + +应用在使用系统能力前,需要检查是否已经获取用户授权访问设备位置信息。如未获得授权,可以向用户申请需要的位置权限,申请方式请参考下文。 + +系统提供的定位权限有: + +- ohos.permission.LOCATION + +- ohos.permission.APPROXIMATELY_LOCATION + +- ohos.permission.LOCATION_IN_BACKGROUND + +访问设备的位置信息,必须申请权限,并且获得用户授权。 + +API9之前的版本,申请ohos.permission.LOCATION即可。 + +API9及之后的版本,需要申请ohos.permission.APPROXIMATELY_LOCATION或者同时申请ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION;无法单独申请ohos.permission.LOCATION。 + +| 使用的API版本 | 申请位置权限 | 申请结果 | 位置的精确度 | +| -------- | -------- | -------- | -------- | +| 小于9 | ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 | +| 大于等于9 | ohos.permission.LOCATION | 失败 | 无法获取位置。 | +| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION | 成功 | 获取到模糊位置,精确度为5公里。 | +| 大于等于9 | ohos.permission.APPROXIMATELY_LOCATION和ohos.permission.LOCATION | 成功 | 获取到精准位置,精准度在米级别。 | + +如果应用在后台运行时也需要访问设备位置,除需要将应用声明为允许后台运行外,还必须申请ohos.permission.LOCATION_IN_BACKGROUND权限,这样应用在切入后台之后,系统可以继续上报位置信息。 + +开发者可以在应用配置文件中声明所需要的权限,具体可参考[授权申请指导](../../../application-dev/security/accesstoken-guidelines.md)。 + +**关键的接口/组件变更** + +如果是存量应用(使用的API版本小于9),则无影响。 + +如果使用的API版本大于等于9,则在使用@ohos.geolocation和@ohos.geoLocationManager中需要ohos.permission.LOCATION权限的接口时,都需要按照上文所述方式申请对应权限。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md new file mode 100644 index 0000000000000000000000000000000000000000..43a763edc7a96ede06965ce6a1d432ddecf823d4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-global.md @@ -0,0 +1,57 @@ +# 全球化子系统ChangeLog + +## cl.global.1 国际化模块接口支持错误码 + +全球化子系统国际化组件在如下场景中提供的接口修改为支持错误码。从API9开始作以下变更: + - 获取国家、语言的本地化显示 + - 获取系统支持的语言列表、语言支持的地区列表 + - 判断语言与地区是否匹配 + - 获取、设置系统语言、系统国家或地区、系统区域 + - 获取、设置系统24小时制 + - 获取、添加、移除系统偏好语言 + - 获取、设置本地化数字 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +上述接口修改为System类的静态方法,调用时需要在模块名后加上类名。 +设置类接口,返回值由boolean类型修改为void类型。例如,setSystemLanguage接口。 +接口调用失败时会根据失败原因抛出相应的错误码。例如,当应用未正确配置权限时,抛出201错误码。 + +**关键的接口/组件变更** + + - 涉及接口 + - getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + - getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + - getSystemLanguages(): Array; + - getSystemCountries(language: string): Array; + - isSuggested(language: string, region?: string): boolean; + - getSystemLanguage(): string; + - setSystemLanguage(language: string): void; + - getSystemRegion(): string; + - setSystemRegion(region: string): void; + - getSystemLocale(): string; + - setSystemLocale(locale: string): void; + - is24HourClock(): boolean; + - set24HourClock(option: boolean): void; + - addPreferredLanguage(language: string, index?: number): void; + - removePreferredLanguage(index: number): void; + - getPreferredLanguageList(): Array; + - getFirstPreferredLanguage(): string; + - getAppPreferredLanguage(): string; + - setUsingLocalDigit(flag: boolean): void; + - getUsingLocalDigit(): boolean; + +**适配指导** + +使用try-catch块捕获接口抛出的日常。 +``` +import I18n from '@ohos.i18n' + +try { + I18n.System.setSystemLanguage('zh'); +} catch(error) { + console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`) +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md new file mode 100644 index 0000000000000000000000000000000000000000..2f2096bfbc50c7558cc65e95d22d93fae5b0eaf7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-inputmethod-framworks.md @@ -0,0 +1,196 @@ +# 输入法框架changeLog + +## cl.inputmethod_frameworks.1 API错误信息返回方式变更 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + + - 输入法框架模块:系统接口,@ohos.inputmethod.d.ts + + - 输入法服务模块:系统接口,@ohos.inputmethodengine.d.ts + + - 输入法ExtentionAbility模块:系统接口,@ohos.inputmethodextensionability.d.ts + + - 输入法ExtentionContext模块:系统接口,@ohos.inputmethodextensioncontext.d.ts + + - 输入法子类型模块:系统接口,@ohos.inputMethodSubtype.d.ts + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +在以下接口增加错误码处理: + - getSetting(): InputMethodSetting; + - getController(): InputMethodController; + - switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void; + - switchInputMethod(target: InputMethodProperty): Promise; + - switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void; + - switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise; + - switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void; + - switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise; + - listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void; + - listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>; + - listCurrentInputMethodSubtype(callback: AsyncCallback>): void; + - listCurrentInputMethodSubtype(): Promise>; + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - showOptionalInputMethods(callback: AsyncCallback): void; + - showOptionalInputMethods(): Promise; + - stopInputSession(callback: AsyncCallback): void; + - stopInputSession(): Promise; + - showSoftKeyboard(callback: AsyncCallback): void; + - showSoftKeyboard():Promise; + - hideSoftKeyboard(callback: AsyncCallback): void; + - hideSoftKeyboard():Promise; + - hide(callback: AsyncCallback): void; + - hide(): Promise; + - onCreate(want: Want): void; + - onDestroy(): void; + InputClient 接口下: + - sendKeyFunction(action: number, callback: AsyncCallback): void; + - sendKeyFunction(action: number): Promise; + - deleteForward(length: number, callback: AsyncCallback): void; + - deleteForward(length: number): Promise; + - deleteBackward(length: number, callback: AsyncCallback): void; + - deleteBackward(length: number): Promise; + - insertText(text: string, callback: AsyncCallback): void; + - insertText(text: string): Promise; + - getForward(length: number, callback: AsyncCallback): void; + - getForward(length: number): Promise; + - getBackward(length: number, callback: AsyncCallback): void; + - getBackward(length: number): Promise; + - getEditorAttribute(callback: AsyncCallback): void; + - getEditorAttribute(): Promise; + - moveCursor(direction: number, callback: AsyncCallback): void; + - moveCursor(direction: number): Promise; + InputMethodExtensionAbility 类下: + - onCreate(want: Want): void; + - onDestroy(): void; + +**适配指导** + +异步接口以showOptionalInputMethods为例,示例代码如下: + +callback回调: + +```js +import inputMethod from '@ohos.inputmethod'; +let inputMethodSetting = inputMethod.getSetting(); +try { + inputMethodSetting.showOptionalInputMethods((err, data) => { + if (err !== undefined) { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing optionalInputMethods.'); + }); +} catch (err) { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); +} +``` + +Promise回调: + +```js +import inputMethod from '@ohos.inputmethod'; +let inputMethodSetting = inputMethod.getSetting(); +inputMethodSetting.showOptionalInputMethods().then((data) => { + console.info('Succeeded in showing optionalInputMethods.'); +}).catch((err) => { + console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err)); +}) +``` + +## cl.inputmethod_frameworks.2 API部分接口废弃 + +以下接口标记废除: + - getInputMethodSetting(): InputMethodSetting; + - getInputMethodController(): InputMethodController; + - listInputMethod(callback: AsyncCallback>): void; + - listInputMethod(): Promise>; + - displayOptionalInputMethod(callback: AsyncCallback): void; + - displayOptionalInputMethod(): Promise; + - stopInput(callback: AsyncCallback): void; + - stopInput(): Promise; + interface InputMethodProperty: + - readonly packageName: string; + - readonly methodId: string; + - getInputMethodEngine(): InputMethodEngine; + - createKeyboardDelegate(): KeyboardDelegate; + - hideKeyboard(callback: AsyncCallback): void; + - hideKeyboard(): Promise; + +替代接口如下: + - getSetting(): InputMethodSetting; + - getController(): InputMethodController; + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - showOptionalInputMethods(callback: AsyncCallback): void; + - showOptionalInputMethods(): Promise; + - stopInputSession(callback: AsyncCallback): void; + - stopInputSession(): Promise; + interface InputMethodProperty: + - readonly name: string; + - readonly id: string; + - getInputMethodAbility(): InputMethodAbility; + - getKeyboardDelegate(): KeyboardDelegate; + - hide(callback: AsyncCallback): void; + - hide(): Promise; + +**特别注意:** + 使用getInputMethodAbility()接口获取到InputMethodAbility对象,代替使用getInputMethodEngine()接口获取InputMethodEngine对象。 + 使用InputMethodAbility中的方法,不要再使用InputMethodEngine中的方法。 + 使用InputMethodAbility中的on('inputStart')方法,获取到KeyboardController实例与InputClient实例,不要再使用InputMethodEngine中的on('inputStart')方法去获取TextInputClient实例。 +之前: + +```js +inputMethodEngine.getInputMethodEngine().on('inputStart', (kbController, textClient) => { + let keyboardController = kbController; + let textInputClient = textClient; // 获取到TextInputClient实例 +}); +``` + +之后: +```js +inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, client) => { + let keyboardController = kbController; + let inputClient = client; // // 获取到InputClient实例 +}); +``` + +## cl.inputmethod_frameworks.3 API部分接口变更 + +变更前: + - listInputMethod(enable: boolean, callback: AsyncCallback>): void; + - listInputMethod(enable: boolean): Promise>; + - terminateSelf(callback: AsyncCallback): void; + - terminateSelf(): Promise; + +变更后: + - getInputMethods(enable: boolean, callback: AsyncCallback>): void; + - getInputMethods(enable: boolean): Promise>; + - destroy(callback: AsyncCallback): void; + - destroy(): Promise; + +删除API9接口: + - startAbility(want: Want, callback: AsyncCallback): void; + - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + - startAbility(want: Want, options?: StartOptions): Promise; + +其他新增接口: + - on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + - off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + - interface InputMethodProperty: + - readonly label?: string; + - readonly icon?: string; + - readonly iconId?: number; + - extra: object; + + - interface InputMethodAbility: + - on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void; + - off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..9d85704839aa1e97c7f24dda8349d678c08ce1cc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimedia.md @@ -0,0 +1,262 @@ +# 多媒体子系统ChangeLog + +## cl.multimedia.audio.001 getRoutingManager()调用方式变更 + +getRoutingManager()接口的调用方法由异步变为同步。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getRoutingManager(callback: AsyncCallback): void; +getRoutingManager(): Promise; +``` +变更后 +```js +getRoutingManager(): AudioRoutingManager; +``` + + +## cl.multimedia.audio.002 getStreamManager()调用方式变更 + +getStreamManager()接口的调用方法由异步变为同步。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getStreamManager(callback: AsyncCallback): void; +getStreamManager(): Promise; +``` +变更后 +```js +getStreamManager(): AudioStreamManager; +``` + + +## cl.multimedia.audio.003 原AudioRoutingManager中micStateChange监听注册方式变更 + +原AudioRoutingManager中,on()函数的micStateChange监听注册方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 + +```js +interface AudioRoutingManager { + on(type: 'micStateChange', callback: Callback): void; +} +``` +变更后 +```js +interface AudioVolumeGroupManager { + on(type: 'micStateChange', callback: Callback): void; +} +``` + + +## cl.multimedia.audio.004 getVolumeGroups()调用方式变更 + +getVolumeGroups()接口的调用方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getVolumeGroups(networkId: string, callback:AsyncCallback): void; +getVolumeGroups(networkId: string): Promise; +``` +变更后 +```js +getVolumeManager(): AudioVolumeManager; +interface AudioVolumeManager{ + getVolumeGroupInfos(networkId: string, callback: AsyncCallback): void; + getVolumeGroupInfos(networkId: string): Promise; +} +``` + + +## cl.multimedia.audio.005 getGroupManager()调用方式变更 + +getGroupManager()接口的调用方式变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +getGroupManager(groupId: number, callback: AsyncCallback): void; +getGroupManager(groupId: number): Promise; +``` +变更后 +```js +getVolumeManager(): AudioVolumeManager; +interface AudioVolumeManager{ + getVolumeGroupManager(groupId: number, callback: AsyncCallback): void; + getVolumeGroupManager(groupId: number): Promise; +} +``` + + +## cl.multimedia.audio.006 枚举FocusType成员名变更 + +枚举FocusType中,成员FOCUS_TYPE_RECORDING重命名为FOCUS_TYPE_DEFAULT。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +enum FocusType { + FOCUS_TYPE_RECORDING = 0, +} +``` +变更后 +```js +enum InterruptRequestType { + INTERRUPT_REQUEST_TYPE_DEFAULT = 0, +} +``` + + +## cl.multimedia.audio.007 AudioRenderer中interrupt监听注册名称变更 + +AudioRenderer中on()函数的interrupt监听注册名称变更。 + +**变更影响** + +如不符合上述调用规则,将会在编译执行时出错。 + +**关键的接口/组件变更** + +变更前 +```js +interface AudioRenderer { + on(type: 'interrupt', callback: Callback): void; +} +``` +变更后 +```js +interface AudioRenderer { + on(type: 'audioInterrupt', callback: Callback): void; +} +``` + + +## cl.multimedia.media.001 VideoRecorder相关接口变更为systemapi + +录制在MR版本会提供正式的AVRecorder(音视频合一)的接口给外部用户使用。 +VideoRecorder相关的api9接口变更为systemapi,当前只提供给系统用户使用,未来等内部用户都切换为AVRecorder之后,废弃VideoRecorder相关接口。 + +**变更影响** + +如果VideoRecorder的调用者非系统用户,会调用失败。 +涉及接口以及枚举如下: +function createVideoRecorder(callback: AsyncCallback): void; +function createVideoRecorder(): Promise; +type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; +interface VideoRecorder{ + prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; + prepare(config: VideoRecorderConfig): Promise; + getInputSurface(callback: AsyncCallback): void; + getInputSurface(): Promise; + start(callback: AsyncCallback): void; + start(): Promise; + pause(callback: AsyncCallback): void; + pause(): Promise; + resume(callback: AsyncCallback): void; + resume(): Promise; + stop(callback: AsyncCallback): void; + stop(): Promise; + release(callback: AsyncCallback): void; + release(): Promise; + reset(callback: AsyncCallback): void; + reset(): Promise; + on(type: 'error', callback: ErrorCallback): void; + readonly state: VideoRecordState; +} +interface VideoRecorderProfile { + readonly audioBitrate: number; + readonly audioChannels: number; + readonly audioCodec: CodecMimeType; + readonly audioSampleRate: number; + readonly fileFormat: ContainerFormatType; + readonly videoBitrate: number; + readonly videoCodec: CodecMimeType; + readonly videoFrameWidth: number; + readonly videoFrameHeight: number; + readonly videoFrameRate: number; +} +enum AudioSourceType { + AUDIO_SOURCE_TYPE_DEFAULT = 0, + AUDIO_SOURCE_TYPE_MIC = 1, +} +enum VideoSourceType { + VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, + VIDEO_SOURCE_TYPE_SURFACE_ES = 1, +} +enum VideoRecorderConfig { + audioSourceType?: AudioSourceType; + videoSourceType: VideoSourceType; + profile: VideoRecorderProfile; + url: string; + rotation?: number; + location?: Location; +} + +## cl.multimedia.media.002 VideoPlayer中不对外提供多码率选择接口 + +VideoPlayer在API9中不对外提供多码率选择相关接口,相关接口会在MR版本中由AvPlayer提供。 + +**变更影响** + +VideoPlayer多码率场景无法进行码率选择,相关功能由AVPlayer提供 + +**关键的接口/组件变更** + +删除如下接口 +interface VideoPlayer { + selectBitrate(bitrate: number): Promise; + selectBitrate(bitrate: number, callback: AsyncCallback): void; + on(type: 'availableBitratesCollect', callback: (bitrates: Array) => void): void; +} + +## cl.multimedia.media.003 VideoRecorder错误信息变更 + +VideoRecorder原有错误码与整体错误码规则不一致,变更错误码适配规则。 + +**变更影响** + +VideoRecorder返回的错误码发生变更。 + +**关键的接口/组件变更** + +VideoRecorder接口未发生变更,返回的错误码发生变更。 + +**适配指导** + +异常处理具体参考接口文档。 +https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-media.md +https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-media.md diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md new file mode 100644 index 0000000000000000000000000000000000000000..faeaff15fcb8a66785cbaf89affa8ab14c9831bd --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-multimodalinput.md @@ -0,0 +1,104 @@ +# 多模输入changeLog + +## cl.multimodalinput.1 API错误信息返回方式变更 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + - 输入设备管理模块:三方接口,@ohos.multimodalInput.inputDevice.d.ts + + - 组合按键订阅模块:系统接口,@ohos.multimodalInput.inputConsumer.d.ts + + - 键鼠穿越功能模块:系统接口,@ohos.multimodalInput.inputDeviceCooperate.d.ts + + - 按键注入模块:系统接口,@ohos.multimodalInput.inputEventClient.d.ts + + - 输入监听模块:系统接口,@ohos.multimodalInput.inputMonitor.d.ts + + - 鼠标指针管理模块:系统接口和三方接口,@ohos.multimodalInput.pointer.d.ts + +以上模块中的异步接口变更为参数检查错误同步抛出,业务逻辑错误通过AsyncCallback或Promise的error对象抛出,同步接口不作变更。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; + - supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; + - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; > + - getKeyboardType(deviceId: number): Promise<KeyboardType>; + - setPointerSpeed(speed: number, callback: AsyncCallback<void>): void; + - setPointerSpeed(speed: number): Promise<void>; + - getPointerSpeed(callback: AsyncCallback<number>): void; + - getPointerSpeed(): Promise<number>; + - setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void; + - setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void>; + - getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void; + - getPointerStyle(windowId: number): Promise<PointerStyle>; + - setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void; + - setPointerVisible(visible: boolean): Promise<void>; + - isPointerVisible(callback: AsyncCallback<boolean>): void; + - isPointerVisible(): Promise<boolean>; + - on(type:"touch", receiver:TouchEventReceiver):void; + - on(type:"mouse", receiver:Callback<MouseEvent>):void; + - off(type:"touch", receiver?:TouchEventReceiver):void; + - off(type:"mouse", receiver?:Callback<MouseEvent>):void; + - injectEvent({KeyEvent: KeyEvent}): void; + - enable(enable: boolean, callback: AsyncCallback<void>): void; + - enable(enable: boolean): Promise<void>; + - start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback<void>): void; + - start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise<void>; + - stop(callback: AsyncCallback<void>): void; + - stop(): Promise<void>; + - getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void; + - getState(deviceDescriptor: string): Promise<{ state: boolean }>; + - on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void; + - off(type: 'cooperation', callback?: AsyncCallback<void>): void; + - on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void; + - off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; + +以下接口标记废除: + - getDeviceIds(callback: AsyncCallback<Array<number>>): void; + - getDeviceIds(): Promise<Array<number>>; + - getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; + - getDevice(deviceId: number): Promise<InputDeviceData>; + +替代接口如下: + - getDeviceList(callback: AsyncCallback<Array<number>>): void; + - getDeviceList(): Promise<Array<number>>; + - getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; + - getDeviceInfo(deviceId: number): Promise<InputDeviceData>; + +以下接口发生变更 + +变更前: + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void; + - getKeyboardType(deviceId: number, callback: Callback<KeyboardType>): void; + +变更后: + - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; + - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; + +**适配指导** + +以setPointerVisible为例,示例代码如下: + +```ts +import pointer from '@ohos.multimodalInput.pointer'; +pointer.setPointerVisible(true, (error) => { + console.log(`Set pointer visible success`); + }); + +try { + pointer.setPointerVisible(true, (error) => { + if (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set pointer visible success`); + }); +} catch (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..ae3a495b47b7f50535802f4f64323bee8e5bda8d --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-notification.md @@ -0,0 +1,64 @@ +# 事件通知子系统ChangeLog + +## cl.notification.1 API异常处理方式变更 + +事件通知部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。 + +**变更影响** + +基于此前版本开发的应用,需适配变更接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对事件通知相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 原接口 | 新接口 | +| ----------------------- | -------------------------------- | +| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.commonEvent + +```js +import commonEvent from '@ohos.commonEvent'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import commonEvent from '@ohos.commonEventManager'; +``` + +@ohos.notification拆分成了两个namespace,需要根据接口情况选择需要的新namespace进行适配。 + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.notification.2 接口变更 + +对事件通知部分接口名进行了变更。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean): Promise<**void**>; | 新增 | +| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 废弃 | +| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 废弃 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | 新增 | +| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | 新增 | \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md new file mode 100644 index 0000000000000000000000000000000000000000..f981146225f2d667916415d5670f050f57e15b0e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-power.md @@ -0,0 +1,68 @@ +# 电源子系统ChangeLog + +## cl.powermgr.1 API错误信息返回方式变更 + +下列API使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9进行变更。 + +- 耗电统计:[@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md) + - 屏幕亮度:[@ohos.brightness](../../../application-dev/reference/apis/js-apis-brightness.md) + - 系统电源管理:[@ohos.power](../../../application-dev/reference/apis/js-apis-power.md) + - Runninglock锁:[@ohos.runningLock](../../../application-dev/reference/apis/js-apis-runninglock.md) + - 热管理:[@ohos.thermal](../../../application-dev/reference/apis/js-apis-thermal.md) + +异步接口:通过AsyncCallback或Promise的error对象返回错误信息。 + +同步接口:通过抛出异常的方式返回错误信息。 + +#### 变更影响 + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +#### 关键的接口/组件变更 + +在以下接口增加错误码处理: + - getBatteryStats(callback: AsyncCallback): void + - getAppPowerValue(uid: number): number + - getAppPowerPercent(uid: number): number + - getHardwareUnitPowerValue(type: ConsumptionType): number + - getHardwareUnitPowerPercent(type: ConsumptionType): number + - setValue(value: number): void + - shutdown(reason: string): void; + - isActive(): boolean + - wakeup(detail: string): void + - suspend(): void + - getPowerMode(): DevicePowerMode + - setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void + - setPowerMode(mode: DevicePowerMode): Promise<void> + - hold(timeout: number): void + - isHolding(): boolean + - unhold(): void + - isSupported(type: RunningLockType): boolean + - isSupported(type: RunningLockType): boolean + - create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void + - create(name: string, type: RunningLockType): Promise<RunningLock> + - registerThermalLevelCallback(callback: Callback<ThermalLevel>): void + - unregisterThermalLevelCallback(callback?: Callback<void>): void + - getLevel(): ThermalLevel + +#### 适配指导 + +请参考各接口的API参考。 +## cl.powermgr.2 系统接口变更 + +#### 变更影响 + +基于此前版本开发的应用,需适配新接口名和错误信息返回方式,否则会影响原有业务逻辑。 + +#### 关键的接口/组件变更 + +| 包名 | 旧接口 | 新接口 | +| ----------- | ------------------------------------ | ------------------------------ | +| @ohos.power | shutdownDevice(reason: string): void | shutdown(reason: string): void | +| @ohos.power | rebootDevice(reason: string): void | reboot(reason: string): void | +| @ohos.power | wakeupDevice(detail: string): void | wakeup(detail: string): void | +| @ohos.power | suspendDevice(): void | suspend(): void | + +#### 适配指导 + +请参考系统电源管理[@ohos.power](../../../application-dev/reference/apis/js-apis-power.md)的API参考。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md new file mode 100644 index 0000000000000000000000000000000000000000..7156bc1a5f85b4094cca72779b5e8917ce5382d4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-request.md @@ -0,0 +1,106 @@ +# 上传下载子系统ChangeLog + +## cl.request.1 错误码定义及API部分接口名称变更 + +- 新增上传下载接口的[错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-request.md)处理。 +- 错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。 +- API部分接口需要用新的接口替换,参数不变。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +|--------------|--------------|-----------------------------------------------------------------------------------------------------------------------|-----------| +| ohos.request | request | EXCEPTION_PERMISSION | 新增 | +| ohos.request | request | EXCEPTION_PARAMCHECK | 新增 | +| ohos.request | request | EXCEPTION_UNSUPPORTED | 新增 | +| ohos.request | request | EXCEPTION_FILEIO | 新增 | +| ohos.request | request | EXCEPTION_FILEPATH | 新增 | +| ohos.request | request | EXCEPTION_SERVICE | 新增 | +| ohos.request | request | EXCEPTION_OTHERS | 新增 | +| ohos.request | request | ERROR_OFFLINE | 新增 | +| ohos.request | request | ERROR_UNSUPPORTED_NETWORK_TYPE | 新增 | +| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 新增 | +| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 新增 | +| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 新增 | +| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 新增 | +| ohos.request | DownloadTask | delete(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | delete(): Promise; | 新增 | +| ohos.request | DownloadTask | suspend(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | suspend(): Promise; | 新增 | +| ohos.request | DownloadTask | restore(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | restore(): Promise; | 新增 | +| ohos.request | DownloadTask | getTaskInfo(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | getTaskInfo(): Promise; | 新增 | +| ohos.request | DownloadTask | getTaskMimeType(callback: AsyncCallback): void; | 新增 | +| ohos.request | DownloadTask | getTaskMimeType(): Promise; | 新增 | +| ohos.request | UploadTask | delete(callback: AsyncCallback): void; | 新增 | +| ohos.request | UploadTask | delete(): Promise; | 新增 | +| ohos.request | request | function download(config: DownloadConfig, callback: AsyncCallback): void;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function download(config: DownloadConfig): Promise;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 废弃 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise;
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise; | 废弃 | +| ohos.request | request | function upload(config: UploadConfig, callback: AsyncCallback): void;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function upload(config: UploadConfig): Promise;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 废弃 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 废弃 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise;
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise; | 废弃 | +| ohos.request | DownloadTask | remove(callback: AsyncCallback): void;
代替接口:delete(callback: AsyncCallback): void | 废弃 | +| ohos.request | DownloadTask | remove(): Promise;
代替接口:delete(): Promise; | 废弃 | +| ohos.request | DownloadTask | pause(callback: AsyncCallback): void;
代替接口:suspend(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | pause(): Promise;
代替接口:suspend(): Promise; | 废弃 | +| ohos.request | DownloadTask | resume(callback: AsyncCallback): void;
代替接口:restore(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | resume(): Promise;
代替接口:restore(): Promise; | 废弃 | +| ohos.request | DownloadTask | query(callback: AsyncCallback): void;
代替接口:getTaskInfo(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | query(): Promise;
代替接口:getTaskInfo(): Promise; | 废弃 | +| ohos.request | DownloadTask | queryMimeType(callback: AsyncCallback): void;
代替接口:getTaskMimeType(callback: AsyncCallback): void; | 废弃 | +| ohos.request | DownloadTask | queryMimeType(): Promise;
代替接口:getTaskMimeType(): Promise; | 废弃 | +| ohos.request | UploadTask | remove(callback: AsyncCallback): void;
代替接口:delete(callback: AsyncCallback): void; | 废弃 | +| ohos.request | UploadTask | remove(): Promise;
代替接口:delete(): Promise; | 废弃 | +| system.request | UploadResponse | code | 废弃 | +| system.request | UploadResponse | data | 废弃 | +| system.request | UploadResponse | headers | 废弃 | +| system.request | DownloadResponse | token | 废弃 | +| system.request | OnDownloadCompleteResponse | uri | 废弃 | +| system.request | RequestFile | filename | 废弃 | +| system.request | RequestFile | name | 废弃 | +| system.request | RequestFile | uri | 废弃 | +| system.request | RequestFile | type | 废弃 | +| system.request | RequestData | name | 废弃 | +| system.request | RequestData | value | 废弃 | +| system.request | UploadRequestOptions | url | 废弃 | +| system.request | UploadRequestOptions | data | 废弃 | +| system.request | UploadRequestOptions | files | 废弃 | +| system.request | UploadRequestOptions | header | 废弃 | +| system.request | UploadRequestOptions | description | 废弃 | +| system.request | UploadRequestOptions | success | 废弃 | +| system.request | UploadRequestOptions | fail | 废弃 | +| system.request | UploadRequestOptions | complete | 废弃 | +| system.request | OnDownloadCompleteOptions | token | 废弃 | +| system.request | OnDownloadCompleteOptions | success | 废弃 | +| system.request | OnDownloadCompleteOptions | fail | 废弃 | +| system.request | OnDownloadCompleteOptions | complete | 废弃 | +| system.request | Request | static upload(options: UploadRequestOptions): void; | 废弃 | +| system.request | Request | static download(options: DownloadRequestOptions): void; | 废弃 | +| system.request | Request | static onDownloadComplete(options: OnDownloadCompleteOptions): void; | 废弃 | + + +**适配指导** + +以downloadFile为例,在新版本上需要使用如下方式进行调用: + +```ts +try { + request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', + filePath: 'xxx/xxxxx.hap'}, (err, data) => { + if (err) { + console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); + return; + } + }); +} catch (err) { + console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..304f2b27682745110b7f0b355fbf6cbff78487e7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resource-manager.md @@ -0,0 +1,66 @@ +# 资源管理changeLog + +## cl.resourceManager.1 资源API9部分多工程接口命名变更 + +资源管理从API9开始提供接口的错误码和错误信息返回,涉及API9提供的部分多工程接口需要适配。从API9开始作以下变更: + +资源API部分多工程接口需要用新的接口替换,参数不变。 + +**变更影响** + +基于此前版本开发的应用,涉及下面多工程接口的JS接口需要替换为新的接口。 + +**关键接口/组件变更** + +| **涉及接口** | **对应替换接口** | +| ---------------- | ------------ | +| getString(resource: Resource,
callback: AsyncCallback\): void; | getStringValue(resource: Resource,
callback: AsyncCallback\): void; | +| getString(resource: Resource): Promise\; | getStringValue(resource: Resource): Promise\; | +| getStringArray(resource: Resource,
callback: AsyncCallback\>): void; | getStringArrayValue(resource: Resource,
callback: AsyncCallback\>): void; | +| getStringArray(resource: Resource): Promise\>; | getStringArrayValue(resource: Resource): Promise\>; | +| getMedia(resource: Resource,
callback: AsyncCallback\): void; | getMediaContent(resource: Resource,
callback: AsyncCallback\): void; | +| getMedia(resource: Resource): Promise\; | getMediaContent(resource: Resource): Promise\; | +| getMediaBase64(resource: Resource,
callback: AsyncCallback\): void; | getMediaContentBase64(resource: Resource,
callback: AsyncCallback\): void; | +| getMediaBase64(resource: Resource): Promise\; | getMediaContentBase64(resource: Resource): Promise\; | +| getPluralString(resource: Resource, num: number,
callback: AsyncCallback): void; | getPluralStringValue(resource: Resource, num: number,
callback: AsyncCallback\): void; | +| getPluralString(resource: Resource, num: number): Promise\; | getPluralStringValue(resource: Resource, num: number): Promise\; | + +**适配指导** + +以getMedia修改为getMediaContent的callback调用为例,其promise方式类似,只需修改函数名,且增加错误码和错误信息返回,其它不变。示例代码如下: + +- 变更前:getMedia(resource: Resource, callback: AsyncCallback): void; +```ts +let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.test').id +}; +this.context.resourceManager.getMedia(resource, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let media = value; + } +}); +``` + +- 变更后:getMediaContent(resource: Resource, callback: AsyncCallback): void; +```ts +let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.test').id +}; +try { + this.context.resourceManager.getMediaContent(resource, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let media = value; + } + }); +} catch (error) { + console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`) +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..2434d2d22974e3b4264b13565b5316a608227e02 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-resourceschedule.md @@ -0,0 +1,316 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.backgroundTaskManager +对资源调度子系统backgroundTaskManager仓原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。废弃@ohos.backgroundTaskManager.d.ts文件,新增@ohos.resourceschedule.backgroundTaskManager.d.ts文件,将相关接口变更至对应的文件。 + +| 类名 | 接口类型 | 接口声明 | 说明 | +| -- | -- | -- | -- | +| backgroundTaskManager | namespace | declare namespace backgroundTaskManager | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function resetAllEfficiencyResources(): void; | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function applyEfficiencyResources(request: EfficiencyResourcesRequest): bool; | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts,修改为function applyEfficiencyResources(request: EfficiencyResourcesRequest): void; | +| backgroundTaskManager | method | function stopBackgroundRunning(context: Context): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function getRemainingDelayTime(requestId: number): Promise; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function cancelSuspendDelay(requestId: number): void; | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | export enum BackgroundMode | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | DATA_TRANSFER = 1 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | AUDIO_PLAYBACK = 2 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | AUDIO_RECORDING = 3 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | LOCATION = 4 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | BLUETOOTH_INTERACTION = 5 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | MULTI_DEVICE_CONNECTION = 6 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | WIFI_INTERACTION = 7 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | VOIP = 8 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.BackgroundMode | enum | TASK_KEEPING = 9 | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | interface | interface DelaySuspendInfo | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | field | requestId: number | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.DelaySuspendInfo | field | actualDelayTime: number | 接口从API9开始废弃,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | export enum ResourceType | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | CPU = 1 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | COMMON_EVENT = 1 << 1 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | TIMER = 1 << 2 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | WORK_SCHEDULER = 1 << 3 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | BLUETOOTH = 1 << 4 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | GPS = 1 << 5 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | AUDIO = 1 << 6 | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | interface | export interface EfficiencyResourcesRequest | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | reason: string | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isProcess?: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isPersist?: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | timeOut: number | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isApply: bool | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | resourceTypes: number | 接口API9变更,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | + + +**适配指导**
+ +导入backgroundTaskManager模块。 +``` +import bundle form '@ohos.resourceschedule.backgroundTaskManager' +``` +此外还需要适配异常处理,具体参考[backgroundTaskManager接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md)。 + +## c2.resourceschedule.usageStatistics +对资源调度子系统deviceUsageStatistics仓原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更,废弃@ohos.bundleState.d.ts文件,新增@ohos.resourceschedule.usageStatistics.d.ts文件,类名也将从bundleState变更为usageStatistics。 + +| 类名 | 接口类型 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| bundleState | method | function isIdleState(bundleName: string, callback: AsyncCallback): void; | 废弃,移动到usageStatistics.isIdleState | +| bundleState | method | function isIdleState(bundleName: string): Promise; | 废弃,移动到usageStatistics.isIdleState | +| bundleState | method | function queryAppUsagePriorityGroup(callback: AsyncCallback): void; | 废弃,修改为function queryAppGroup(callback: AsyncCallback): void; | +| bundleState | method | function queryAppUsagePriorityGroup(): Promise; | 废弃,修改为function queryAppGroup(): Promise; | +| bundleState | method | function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback): void; | 废弃,修改为function queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback): void; | +| bundleState | method | function queryBundleStateInfos(begin: number, end: number): Promise; | 废弃, 修改为function queryBundleStatsInfos(begin: number, end: number): Promise; | +| bundleState | method | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; | 废弃,修改为function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; | +| bundleState | method | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryBundleActiveStates(begin: number, end: number): Promise>; | 废弃,修改为function queryBundleEvents(begin: number, end: number): Promise>; | +| bundleState | method | function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryCurrentBundleActiveStates(begin: number, end: number): Promise>; | 废弃,修改为function queryCurrentBundleEvents(begin: number, end: number): Promise>; | +| bundleState | method | function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; | 废弃,修改为function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function getRecentlyUsedModules(maxNum?: number): Promise>; | 废弃,修改为两个接口function QueryModuleUsageRecords(maxNum: number): Promise>; function QueryModuleUsageRecords(): Promise>; | +| bundleState | method | function getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback>): void; | 废弃,修改为两个接口function QueryModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; function QueryModuleUsageRecords(callback: AsyncCallback>): void; | +| bundleState | method | function queryAppUsagePriorityGroup(bundleName? : string): Promise; | 废弃,修改为function queryAppGroup(bundleName: string): Promise; | +| bundleState | method | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback): void; | 废弃,修改为function queryAppGroup(bundleName: string, callback: AsyncCallback): void; | +| bundleState | method | function setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; | 废弃,修改为function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; | +| bundleState | method | function setBundleGroup(bundleName: string, newGroup: GroupType): Promise; | 废弃,修改为function setAppGroup(bundleName: string, newGroup: GroupType): Promise; | +| bundleState | method | function registerGroupCallBack(callback: Callback, callback: AsyncCallback): void; | 废弃,修改为function registerAppGroupCallBack(callback: Callback, callback: AsyncCallback): void; | +| bundleState | method | function registerGroupCallBack(callback: Callback): Promise; | 废弃,修改为function registerAppGroupCallBack(callback: Callback): Promise; | +| bundleState | method | function unRegisterGroupCallBack(callback: AsyncCallback): void; | 变更,修改为function unregisterAppGroupCallBack(): Promise; | +| bundleState | method | function unRegisterGroupCallBack(): Promise; | 变更,修改为function unregisterAppGroupCallBack(): Promise; | +| bundleState | method | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback>): void; | 变更,修改为function queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryBundleActiveEventStates(begin: number, end: number): Promise>; | 接口从API9变更,修改为function queryDeviceEventStats(begin: number, end: number): Promise>; | +| bundleState | method | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback>): void; | 接口从API9变更,修改为function queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback>): void; | +| bundleState | method | function queryAppNotificationNumber(begin: number, end: number): Promise>; | 接口从API9变更,修改为function queryNotificationEventStats(begin: number, end: number): Promise>; | +| bundleState.BundleActiveGroupCallbackInfo | interface | interface BundleActiveGroupCallbackInfo | 变更,修改为usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | bundleName: string | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | changeReason: number | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | userId: number | 变更,移动到usageStatistics.AppGroupCallbackInfo | +| bundleState.BundleActiveGroupCallbackInfo | field | appUsageNewGroup: number | 废弃,修改为appNewGroup | +| bundleState.BundleActiveGroupCallbackInfo | field | appUsageOldGroup: number | 废弃,修改为appOldGroup | +| bundleState.BundleActiveEventState | interface | interface BundleActiveEventState | 废弃,修改为usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | count: number | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | eventId: number | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveEventState | field | name: string | 变更,移动到usageStatistics.DeviceEventStats | +| bundleState.BundleActiveModuleInfo | interface | interface BundleActiveModuleInfo | 接口从API9变更,修改为usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | formRecords: Array | 变更,修改为formRecords: Array | +| bundleState.BundleActiveModuleInfo | field | lastModuleUsedTime: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | launchedCount: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityIconId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityDescriptionId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityLableId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | descriptionId?: number; | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | labelId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | appLabelId?: number | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | abilityName?: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | moduleName: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | bundleName: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.BundleActiveModuleInfo | field | deviceId?: string | 变更,移动到usageStatistics.HapModuleInfo | +| bundleState.GroupType | enum | enum GroupType | 变更,移动到usageStatistics.GroupType | +| bundleState.GroupType | enum | ACTIVE_GROUP_ALIVE | 废弃,修改为ALIVE_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_DAILY | 废弃,修改为DAILY_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_FIXED | 废弃,修改为FIXED_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_RARE | 废弃,修改为RARE_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_LIMIT | 废弃,修改为LIMITED_GROUP | +| bundleState.GroupType | enum | ACTIVE_GROUP_NEVER | 废弃,修改为NEVER_GROUP | +| bundleState.IntervalType | enum | enum IntervalType | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_OPTIMIZED | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_DAILY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_WEEKLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_MONTHLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.IntervalType | enum | BY_ANNUALLY | 废弃,移动到usageStatistics.IntervalType | +| bundleState.BundleActiveInfoResponse | interface | interface BundleActiveInfoResponse | 废弃,修改为usageStatistics.BundleStatsMap | +| bundleState.BundleActiveState | interface | interface BundleActiveState | 废弃,修改为usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | stateType?: number | 废弃,修改为eventId | +| bundleState.BundleActiveState | field | stateOccurredTime?: number | 废弃,修改为eventOccurredTime | +| bundleState.BundleActiveState | field | nameOfClass?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | indexOfLink?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | bundleName?: string | 废弃,移动到usageStatistics.BundleEvents | +| bundleState.BundleActiveState | field | appUsagePriorityGroup?: number | 废弃,修改为appGroup | +| bundleState.BundleStateInfo | interface | interface BundleStateInfo | 废弃,修改为usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | method | merge(toMerge: BundleStateInfo): void | 废弃 | +| bundleState.BundleStateInfo | field | infosEndTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | infosBeginTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | fgAbilityPrevAccessTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | fgAbilityAccessTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | bundleName?: string | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilitySeenTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityPrevSeenTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityPrevAccessTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | abilityInFgTotalTime?: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState.BundleStateInfo | field | id: number | 废弃,移动到usageStatistics.BundleStatsInfo | +| bundleState | namespace | declare namespace bundleState | 废弃,修改为usageStatistics,移植到ohos.resourceschedule.usageStatistics.d.ts | + + +**适配指导**
+ +导入usageStatistics模块。 +``` +import bundle form '@ohos.resourceschedule.usageStatistics' +``` +此外还需要适配异常处理,具体参考[usageStatistics接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md)。 + + +## c3.resourceschedule.workScheduler +对资源调度子系统workScheduler仓原有接口进行整改,原有API9接口变更为新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。废弃@ohos.workScheduler.d.ts文件,新增@ohos.resourceschedule.workScheduler.d.ts文件,将相关接口变更至对应的文件中。 + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| workScheduler | namespace | declare namespace workScheduler | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | interface | export interface WorkInfo | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | idleWaitTime?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isDeepIdle?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCount?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isRepeat?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCycleTime?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | storageRequest?: StorageRequest | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryStatus?: BatteryStatus | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryLevel?: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | chargerType?: ChargingType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isCharging?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | networkType?: NetworkType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isPersisted?: boolean | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | abilityName: string | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | bundleName: string | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | workId: number | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number): Promise; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopAndClearWorks(): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopAndClearWorks(): boolean; | +| workScheduler | method | function obtainAllWorks(): Promise>; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function obtainAllWorks(callback: AsyncCallback): Array; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number): Promise; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number, callback: AsyncCallback): void; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopWork(work: WorkInfo, needCancel?: boolean): void; | +| workScheduler | method | function startWork(work: WorkInfo): boolean; | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function startWork(work: WorkInfo): void; | +| workScheduler.NetworkType | enum | export enum NetworkType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ANY = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_MOBILE | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_BLUETOOTH | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI_P2P | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ETHERNET | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | export enum ChargingType | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_ANY = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_AC | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_USB | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_WIRELESS | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | export enum BatteryStatus | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW_OR_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.StorageRequest | enum | export enum StorageRequest | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW = 0 | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW_OR_OKAY | 接口API9变更,移植到ohos.resourceschedule.workScheduler.d.ts | + + +**适配指导**
+ +导入workScheduler模块。 +``` +import bundle form '@ohos.resourceschedule.workScheduler' +``` +此外还需要适配异常处理,具体参考[workScheduler接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md)。 + + +## c4.resourceschedule.reminderAgent +对资源调度子系统提醒代理原有接口进行整改,原有API8及之前的接口全部废弃,原有API9接口删除,需要使用新的API9接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.8.2及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更,废弃@ohos.reminderAgent.d.ts文件,新增@ohos.reminderAgentManager.d.ts文件,类名也将从reminderAgent变更为reminderAgentManager。 + +| 类名 | 接口类型 | 方法/属性/枚举/常量 | 变更类型 | +| --------------------- | ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| reminderAgent | method | publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | publishReminder(reminderReq: ReminderRequest): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelReminder(reminderId: number, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelReminder(reminderId: number): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | getValidReminders(callback: AsyncCallback>): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | getValidReminders(): Promise>; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelAllReminders(callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | cancelAllReminders(): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | addNotificationSlot(slot: NotificationSlot): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void; | 废弃,移动到reminderAgentManager | +| reminderAgent | method | removeNotificationSlot(slotType: notification.SlotType): Promise; | 废弃,移动到reminderAgentManager | +| reminderAgent.ActionButtonType | enum | ACTION_BUTTON_TYPE_CLOSE | 废弃,移动到reminderAgentManager.ActionButtonType | +| reminderAgent.ActionButtonType | enum | ACTION_BUTTON_TYPE_SNOOZE | 废弃,移动到reminderAgentManager.ActionButtonType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_TIMER | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_CALENDAR | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ReminderType | enum | REMINDER_TYPE_CALENDAR | 废弃,移动到reminderAgentManager.ReminderType | +| reminderAgent.ActionButton | field | title:string | 废弃,移动到reminderAgentManager.ActionButton | +| reminderAgent.ActionButton | field | type:ActionButtonType | 废弃,移动到reminderAgentManager.ActionButton | +| reminderAgent.WantAgent | field | pkgName:string | 废弃,移动到reminderAgentManager.WantAgent | +| reminderAgent.WantAgent | field | abilityName:string | 废弃,移动到reminderAgentManager.WantAgent | +| reminderAgent.MaxScreenWantAgent | field | pkgName:string | 废弃,移动到reminderAgentManager.MaxScreenWantAgent | +| reminderAgent.MaxScreenWantAgent | field | abilityName:string | 废弃,移动到reminderAgentManager.MaxScreenWantAgent | +| reminderAgent.ReminderRequest | field | reminderType:ReminderType | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | actionButton?:ActionButton | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | wantAgent?:WantAgent | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | maxScreenWantAgent?:MaxScreenWantAgent | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | ringDuration?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | snoozeTimes?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | timeInterval?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | title?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | content?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | expiredContent?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | snoozeContent?:string | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | notificationId?:number | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequest | field | slotType?: notification.SlotType | 废弃,移动到reminderAgentManager.ReminderRequest | +| reminderAgent.ReminderRequestCalendar | field | dateTime:LocalDateTime | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestCalendar | field | repeatMonths?:Array | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestCalendar | field | repeatDays?:Array | 废弃,移动到reminderAgentManager.ReminderRequestCalendar | +| reminderAgent.ReminderRequestAlarm | field | hour:number | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestAlarm | field | minute:number | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestAlarm | field | daysOfWeek?:Array | 废弃,移动到reminderAgentManager.ReminderRequestAlarm | +| reminderAgent.ReminderRequestTimer | field | triggerTimeInSeconds:number | 废弃,移动到reminderAgentManager.ReminderRequestTimer | +| reminderAgent.LocalDateTime | field | year:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | month:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | day:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | hour:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | minute:number | 废弃,移动到reminderAgentManager.LocalDateTime | +| reminderAgent.LocalDateTime | field | second?:number | 废弃,移动到reminderAgentManager.LocalDateTime | + + +**适配指导**
+ +导入reminderAgentManager模块。 +``` +import bundle form '@ohos.reminderAgentManager' +``` +此外还需要适配异常处理,具体参考[reminderAgentManager接口文档](../../../application-dev/reference/apis/js-apis-reminderAgentManager.md)。 + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..88b25f832e020276df920a43b3fa5543af6bf5b3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-telephony.md @@ -0,0 +1,65 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 sms模块SystemAPI接口入参变更 + +已发布的部分电话子系统sms短信模块SystemAPI传入参数发生变化,不符合OpenHarmony接口规范。从API9开始做出以下变更: + +isImsSmsSupported接口新增一个传入参数slotId,表示卡槽号。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口的入参,否则会影响原有功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + isImsSmsSupported(callback: AsyncCallback): void; + isImsSmsSupported(): Promise; + +- 变更前: + +```js +function isImsSmsSupported(callback: AsyncCallback): void; +function isImsSmsSupported(): Promise; +``` + +- 变更后: + +```js +function isImsSmsSupported(slotId: number, callback: AsyncCallback): void; +function isImsSmsSupported(slotId: number): Promise; +``` + + + +**适配指导** + +新增一个入参,示例代码如下: + +callback方式 + +```js +let slotId = 0; +sms.isImsSmsSupported(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +promise方式 + +```js +let slotId = 0; +let promise = sms.isImsSmsSupported(slotId); +promise.then(data => { + console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); +}); +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md new file mode 100644 index 0000000000000000000000000000000000000000..b7f1aed3d06ebb4001b5157064eafc3298e4b6a3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-testfwk_arkxtest.md @@ -0,0 +1,41 @@ +# 测试子系统ChangeLog + +## cl.testfwk_arkxtest.1 On、Driver、Component类接口新增支持异常处理 + +API8原有接口废弃,API9新增替代接口,API9接口支持异常处理,需使用try catch捕获接口抛出的异常。 + +## 变更影响 + +此变更影响@ohos.uitest提供的api9-JS接口。用户此前在测试用例开发中使用了@ohos.uitest-api9接口的,需要进行适配才可以在新版本SDK环境正常编译通过。 + +## 关键的接口/组件变更 + +- 废弃API8原有的`By`类,在API9中使用`On`类代替,`On`类接口新增支持异常处理机制;类内接口名称保持不变,**例外**:`By#key`接口替换为`On.id`。 +- 废弃API8原有的`BY`对象,在API9中使用`ON`对象代替。 +- 废弃API8原有的`UiDriver`类,在API9中使用`Driver`类代替,`Driver`类接口新增支持异常处理机制;类内接口名称保持不变。 +- 废弃API8原有的`UiComponent`类,在API9中使用`Component`类代替,`Component`类接口新增支持异常处理机制;类内接口名称保持不变。 + +## 适配指导 + +### 1.适配接口名称变更 + +可按照如下规则做类名替换: + +- `By-->On` +- `BY-->ON` +- `UiDriver-->Driver` +- `UiComponent-->Component` + +### 2.捕获处理异常 + +使用try-catch处理接口捕获可能抛出的异常,例如: + +```typescript +import {Driver,ON,Component} from '@ohos.uitest' + +try { + let driver = Driver.create(); +} catch (error) { + // error handle; error.code为错误码 +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md new file mode 100644 index 0000000000000000000000000000000000000000..81e0950c0ee16d4a3cd434020e65522e7051879f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-theme.md @@ -0,0 +1,148 @@ +# 主题框架changeLog + +## cl.theme.1 API9接口支持异常处理 + +下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。 + - 壁纸管理服务:@ohos.wallpaper.d.ts + + - 锁屏管理服务:@ohos.screenLock.d.ts + +以上模块中的接口变更为: +同步接口:通过抛出异常的方式返回错误信息。 +异步接口:参数检查错误同步抛出,业务逻辑错误通过AsyncCallback或Promise的error对象抛出。 + +**变更影响** + +基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下标记为壁纸管理服务接口废除: + - getColors(wallpaperType: WallpaperType, callback: AsyncCallback>): void; + - getColors(wallpaperType: WallpaperType): Promise>; + - getId(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getId(wallpaperType: WallpaperType): Promise; + - getMinHeight(callback: AsyncCallback): void; + - getMinHeight(): Promise; + - getMinWidth(callback: AsyncCallback): void; + - getMinWidth(): Promise; + - isChangePermitted(callback: AsyncCallback): void; + - isChangePermitted(): Promise; + - isOperationAllowed(callback: AsyncCallback): void; + - isOperationAllowed(): Promise; + - reset(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - reset(wallpaperType: WallpaperType): Promise; + - setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + - setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; + - getFile(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getFile(wallpaperType: WallpaperType): Promise; + - getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getPixelMap(wallpaperType: WallpaperType): Promise; + +壁纸管理服务替代接口如下: + - getColorsSync(wallpaperType: WallpaperType): Array; + - getIdSync(wallpaperType: WallpaperType): number; + - getMinHeightSync(): number; + - getMinWidthSync(): number; + - isChangeAllowed(): boolean; + - isUserChangeAllowed(): boolean; + - restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - restore(wallpaperType: WallpaperType): Promise; + - setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + - setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; + - getFileSync(wallpaperType: WallpaperType): number; + - getImage(wallpaperType: WallpaperType, callback: AsyncCallback): void; + - getImage(wallpaperType: WallpaperType): Promise; + +以下标记为壁纸管理服务接口变更: + - on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void + - off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void + +以下标记为锁屏管理服务接口废除: + - isScreenLocked(callback: AsyncCallback): void; + - isScreenLocked(): Promise; + - isSecureMode(callback: AsyncCallback): void; + - isSecureMode(): Promise; + - unlockScreen(callback: AsyncCallback): void; + - unlockScreen(): Promise; + +锁屏管理服务替代接口如下: + - isLocked(): boolean; + - isSecure(): boolean; + - unlock(callback: AsyncCallback): void; + - unlock():Promise; + +以下标记为锁屏管理服务接口删除: + - lockScreen(callback: AsyncCallback): void; + - lockScreen(): Promise; + +以下标记为锁屏管理服务接口新增: + - lock(callback: AsyncCallback): void; + - lock():Promise; + +以下标记为锁屏管理服务接口变更: + - onSystemEvent(callback: Callback): boolean; + - sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback): void; + - sendScreenLockEvent(event: String, parameter: number): Promise; + +**壁纸管理服务适配指导** + +异步接口以getImage为例,示例代码如下: + +```ts +import pointer from '@ohos.wallpaper'; +try { + wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { + console.log(`success to getImage: ${JSON.stringify(data)}`); + }).catch((error) => { + console.error(`failed to getImage because: ${JSON.stringify(error)}`); + }); +} catch (err) { + console.error(`failed to getImage because: ${JSON.stringify(err)}`); +} + +``` + +同步接口以getFileSync为例,示例代码如下: + +```ts +import pointer from '@ohos.wallpaper'; +try { + let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); +} catch (err) { + console.error(`failed to getFileSync because: ${err.message}`); +} +``` + +**锁屏管理服务适配指导** + +异步接口以lock为例,示例代码如下: + +```ts +import screenLock from '@ohos.screenlock'; +try { + screenLock.lock((err, data) => { + if (err) { + console.error(`Failed to lock the screen, because: ${err.message}`); + return; + } + console.info(`lock the screen successfully. result: ${data}`); + }); +} catch (err) { + console.error(`Failed to lock the screen, because: ${err.message}`); +} + +``` + +同步接口以onSystemEvent为例,示例代码如下: + +```ts +import screenLock from '@ohos.screenlock'; +try { + let isSuccess = screenLock.onSystemEvent((event) => { + console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) + }); +} catch (err) { + console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..3272693029f4b787c8e1d3560f2a4fa00a49854b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-useriam.md @@ -0,0 +1,74 @@ +# 用户IAM子系统Changelog + +## cl.useriam.1 API异常处理方式变更 + +用户IAM部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更: + +接口通过抛出异常的方式返回错误信息。 + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需适配变更接口的错误信息返回方式,否则会影响业务逻辑。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对用户IAM相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。 + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ---------------------- | ------------------- | ------------------------- | ------------------------ | +| ohos.userIAM.userAuth | UserAuth | constructor() | 废弃 | +| ohos.userIAM.userAuth | UserAuth | getVersion() : number | 废弃 | +| ohos.userIAM.userAuth | UserAuth | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number | 废弃 | +| ohos.userIAM.userAuth | UserAuth | auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array | 废弃 | +| ohos.userIAM.userAuth | UserAuth | cancelAuth(contextID : Uint8Array) : number | 废弃 | +| ohos.userIAM.userAuth | IUserAuthCallback | onResult: (result : number, extraInfo : AuthResult) => void | 废弃 | +| ohos.userIAM.userAuth | IUserAuthCallback | onAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void | 废弃 | +| ohos.userIAM.userAuth | AuthResult | AuthResult {
token ?: Uint8Array;
remainTimes ?: number;
freezingTime ?: number;} | 废弃 | +| ohos.userIAM.userAuth | 枚举 | ResultCode {
SUCCESS = 0,
FAIL = 1,
GENERAL_ERROR = 2,
CANCELED = 3,
TIMEOUT = 4,
TYPE_NOT_SUPPORT = 5,
TRUST_LEVEL_NOT_SUPPORT = 6,
BUSY = 7,
INVALID_PARAMETERS = 8,
LOCKED = 9,
NOT_ENROLLED = 10,} | 废弃 | +| ohos.userIAM.userAuth | type | AuthEventKey = "result" | 新增 | +| ohos.userIAM.userAuth | type | EventInfo = AuthResultInfo | 新增 | +| ohos.userIAM.userAuth | AuthResultInfo | AuthResultInfo {
result : number;
token ?: Uint8Array;
remainAttempts ?: number;
lockoutDuration ?: number;} | 新增 | +| ohos.userIAM.userAuth | TipInfo | TipInfo {
module : number;
tip : number;} | 新增 | +| ohos.userIAM.userAuth | AuthInstance | AuthInstance {
on: (name: AuthEventKey, callback: AuthEvent) => void;
off: (name: AuthEventKey) => void;
start: () => void;
cancel: () => void;} | 新增 | +| ohos.userIAM.userAuth | 枚举 | ResultCodeV9 {
SUCCESS = 12500000,
FAIL = 12500001,
GENERAL_ERROR = 12500002,
CANCELED = 12500003,
TIMEOUT = 12500004,
TYPE_NOT_SUPPORT = 12500005,
TRUST_LEVEL_NOT_SUPPORT = 12500006,
BUSY = 12500007,
LOCKED = 12500009,
NOT_ENROLLED = 12500010,} | 新增 | +| ohos.userIAM.userAuth | function | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel) : AuthInstance | 新增 | +| ohos.userIAM.userAuth | function | getVersion() : number | 新增 | +| ohos.userIAM.userAuth | function | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : void | 新增 | +| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId : string) : ResultCode | 删除 | +| ohos.userIAM.faceAuth | 枚举 | ResultCode {
SUCCESS = 0,
FAIL = 1,} | 删除 | +| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId: string) : void | 新增 | + +**适配指导** + +以getVersion接口为例,示例代码如下: + +```js +import userIAM_userAuth from '@ohos.userIAM.userAuth'; + +try { + let version = userIAM_userAuth.getVersion(); + console.info("auth version = " + version); +} catch (error) { + console.info("get version failed, error = " + error); +} +``` + +更多接口的示例代码可参考[用户认证API文档](../../../application-dev/reference/apis/js-apis-useriam-userauth.md)和[人脸认证API文档](../../../application-dev/reference/apis/js-apis-useriam-faceauth.md)。 + +## cl.useriam.2 接口调用权限变更 + +用户IAM部分接口只允许被系统应用调起,需要做系统应用运行时鉴权。从API9开始作以下变更: + +人脸认证模块的setSurfaceId接口增加判别是否为系统应用的逻辑,非系统应用无法调用该接口。 + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需要持有相应权限,否则无法正常调用接口。 + +**关键接口/组件变更** + +setSurfaceId接口的实现中增加系统应用鉴权处理,非系统应用调用将返回202错误码。 + +**适配指导** + +需要修改[应用签名](https://gitee.com/openharmony/developtools_hapsigner/tree/master/dist)相关文件UnsgnedReleasedProfileTemplate.json,其中的app-feature字段要改为"hos_system_app",才可保证签名所得到的应用是系统应用。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md new file mode 100644 index 0000000000000000000000000000000000000000..44840f55cc2493dad2d9c8ec669d533da1ba8491 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wantAgent.md @@ -0,0 +1,88 @@ +# wantAgent的JS API变更Changelog + +## cl.url.1.trigger类接口变更 +trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; + +因部分功能未实现,已对其进行删除,应用可调用下面接口进行替代: + + trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void + + **变更影响** + +影响已发布的JS接口,应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| OpenHarmony 3.2.8.1版本接口 | OpenHarmony 3.2.9.1 sp8版本接口 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void | + +**适配指导** + +应用中调用替代的trigger接口可参考下列代码 + +示例: + +```ts +import WantAgent from '@ohos.app.ability.wantAgent'; +//wantAgent对象 +var wantAgent; +// triggerInfo +var triggerInfo = { + code: 0 + } +//WantAgentInfo对象 +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +//getWantAgent回调 +function getWantAgentCallback(err, data) { + if (err == undefined) { + wantAgent = data; + } else { + console.info('getWantAgent failed' + JSON.stringify(wantAgent)); + } + //getUid回调 + function triggerCallback(err, data) { + if(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } else { + console.info('getUid ok!' + JSON.stringify(data)); + } + } + try { + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); + } catch(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } +} +try{ + WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +} catch(err){ + console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md new file mode 100644 index 0000000000000000000000000000000000000000..b065436d1d61f79f3ce80fd7ff8858d3dcc778ee --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-web.md @@ -0,0 +1,126 @@ +# web子系统ChangeLog + +## cl.web.1 删除无用错误码 + +web子系统webviewController接口存在变更: + + - 去除forward,backward和backOrForward接口的@throws { BusinessError } 17100007 - Invalid back or forward operation. + - 去除zoom,zoomIn和zoomOut接口的@throws { BusinessError } 17100009 - Cannot zoom in or zoom out. + +开发者需要根据以下说明对应用进行适配。 + + +**变更影响** + +影响已发布的JS接口,应用无需进行适配即可在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +涉及接口: forward, backward, backOrForward, zoom, zoomIn, zoomOut; +涉及组件: web; + +**适配指导** + +无需适配 + +## cl.web.2 setWebController入参修改 + +已发布的部分web子系统controller迁移至webviewController,老的webController做废弃处理。从API9开始做出以下变更: +setWebController入参由老controller替换为新的webviewController + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口的入参,否则会影响原有功能。 + +**关键的接口/组件变更** + +- 涉及接口 + + setWebController(controller: WebviewController): void; + +- 变更前: + +```js +setWebController(controller: WebController): void; +``` + +- 变更后: + +```js +setWebController(controller: WebviewController): void; +``` + +**适配指导** + +示例代码如下: +变更前: +```js +// xxx.ets +@Entry +@Component +struct WebComponent { + controller:WebController = new WebController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .multiWindowAccess(true) + .onWindowNew((event) => { + console.log("onWindowNew...") + var popController: WebController = new WebController() + event.handler.setWebController(popController) + }) + } + } +} +``` + +变更后: +```js +// xxx.ets +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .multiWindowAccess(true) + .onWindowNew((event) => { + console.log("onWindowNew...") + var popController: web_webview.WebviewController = new web_webview.WebviewController() + event.handler.setWebController(popController) + }) + } + } +} +``` + +## cl.web.3 getUnfilterendLinkUrl接口名修改 + +getUnfilterendLinkUrl接口拼写错误,应改为getUnfilteredLinkUrl + +**变更影响** + +基于此前版本开发的应用,需适配变更js接口名,否则会影响原有功能。 + +**关键的接口/组件变更** + +- 涉及接口 + + getUnfilteredLinkUrl(): string; + +- 变更前: + +```js +getUnfilterendLinkUrl(): string; +``` + +- 变更后: + +```js +getUnfilteredLinkUrl(): string; +``` + +**适配指导** + +基于此前版本开发的应用,需适配变更js接口名,使用新的接口名替换旧的接口名,否则会影响原有功能。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md new file mode 100644 index 0000000000000000000000000000000000000000..1f84833ca57af98d069eeba6c13c993f31cd1e8a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta4/changelogs-wifi.md @@ -0,0 +1,115 @@ +# 基础通信WIFI子系统ChangeLog + + +## cl.wifi.1 系统API和API9接口迁移到新增的@ohos.wifiManager.d.ts +@ohos.wifi.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifi.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManager.d.ts当中,并添加错误码描述。 + +后续需要import @ohos.wifiManager.d.ts才能够使用wifi的系统API以及API9接口: + +import wifiManager from '@ohos.wifiManager'; + + +**变更影响** + +仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManager才能使用wifi的系统API和API9接口 + +import wifiManager from '@ohos.wifiManager'; + +对于其他接口无影响 + + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| wifi | namespace | declare namespace wifi | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function enableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function disableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function scan(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void | +| wifi | method | function getScanResults(): Promise<Array<WifiScanInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults | +| wifi | method | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults | +| wifi | method | function getScanResultsSync():  Array<[WifiScanInfo]> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise<number> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function removeCandidateConfig(networkId: number): Promise<void> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 | +| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 | +| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 | +| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 | +| wifi | method | function getCandidateConfigs():  Array<[WifiDeviceConfig]> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function connectToCandidateConfig(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function connectToNetwork(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function reassociate(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function reconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disableNetwork(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeAllNetwork(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeDevice(id: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function enableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function disableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function setHotspotConfig(config: HotspotConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function getP2pLocalDevice(): Promise<WifiP2pDevice> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | method | function createGroup(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function removeGroup(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function p2pConnect(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function p2pCancelConnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function startDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function stopDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function deletePersistentGroup(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | method | function setDeviceName(devName: string): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void | +| wifi | interface | export interface WifiEapConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum EapMethod | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum Phase2Method | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | interface | export interface WifiDeviceConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加eapConfig参数 | +| wifi | interface | export interface IpConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加prefixLength参数 | +| wifi | interface | export interface WifiInfoElem | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | enum | export enum WifiChannelWidth | API9接口变更,迁移到@ohos.wifiManager.d.ts | +| wifi | interface | export interface WifiScanInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加centerFrequency0、centerFrequency1、infoElems三个参数 | +| wifi | enum | export enum WifiSecurityType | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加4种加密类型 | +| wifi | interface | export interface WifiLinkedInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加MacType参数 | + + +**适配指导(可选,不涉及则可以删除)** + +以getLinkedInfo为例,在新版本中需要使用如下方式进行调用: + +``` +import wifiManager from '@ohos.wifiManager' + +wifiManager.getLinkedInfo((err, data) => { + if (err) { + console.error("get linked info error"); + return; + } + console.info("get linked info: " + JSON.stringify(data)); +}); + +wifiManager.getLinkedInfo().then(data => { + console.info("get linked info: " + JSON.stringify(data)); +}).catch(error => { + console.info("get linked info error"); +}); + +``` + +## cl.wifiext.1 系统API和API9接口迁移到新增的@ohos.wifiManagerExt.d.ts + +@ohos.wifiext.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifiext.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManagerExt.d.ts当中,并添加错误码描述 + +后续需要import @ohos.wifiManagerExt.d.ts才能够使用wifi的系统API以及API9接口: + +import wifiManagerExt from '@ohos.wifiManagerExt'; + + +**变更影响** + +仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManagerExt才能使用wifi的系统API和API9接口,与wifiManager配套使用 + +import wifiManagerExt from '@ohos.wifiManagerExt'; + +对于其他接口无影响 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md b/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..638940eef70649c6c6ba17d3581b3ef6432b3aa7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/Readme.md @@ -0,0 +1,26 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [帐号](changelogs-account_os_account.md) +- [ArkUI](changelogs-arkui.md) +- [多媒体-相机](changelogs-camera-sync.md) +- [公共基础类库-容器](changelogs-container.md) +- [分布式数据管理](changelogs-distributeddatamgr.md) +- [文件管理](changelogs-filemanagement.md) +- [输入法框架](changelogs-inputmethod-framworks.md) +- [文件管理-媒体库](changelogs-mediaLibrary.md) +- [多媒体](changelogs-multimedia.md) +- [基础通信-NFC](changelogs-nfc.md) +- [事件通知](changelogs-notification.md) +- 位置服务 + - [ohos.geoLocationManager](changelogs-ohos-geoLocationManager.md) + - [ohos.geoLocation](changelogs-ohos-geoLocation.md) + - [system.geolocation](changelogs-system-geolocation.md) +- [上传下载](changelogs-request.md) +- [资源调度](changelogs-resourceschedule.md) +- [安全](changelogs-security.md) +- [电话服务](changelogs-telephony.md) +- [时间服务](changelogs-time.md) +- [公共基础类库-URL](changelogs-url.md) +- [用户IAM](changelogs-useriam.md) +- [窗口](changelogs-window.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md new file mode 100644 index 0000000000000000000000000000000000000000..b20dbfc1fc13ba0dc94a8044119ac0ae2473cfb7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelog-x-x.md @@ -0,0 +1,31 @@ +# xxx子系统ChangeLog + +相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 + +## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) + +每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。 +以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。 +如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。 + +**变更影响** + +是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。 +是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +列举此功能变更涉及的接口/组件变更。 + +**适配指导(可选,不涉及则可以删除)** + +提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。 +例: +在xxx文件中将xxx参数修改为xxx。 + +``` +sample code +``` + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..a75004fb8d6eeb5eebdd44c5192a204b0d061df3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ability.md @@ -0,0 +1,175 @@ +# 元能力子系统JS API变更Changelog + +## cl.ability.1 接口迁移 +ability子系统UIAbilityContext的接口requestPermissionsFromUser迁移到security子系统: + +之前权限弹窗应用是基于UIAbility实现的,需要借助于UIAbilityContext的startAbilityForResult接口把授权结果带回给调用方,故把requestPermissionsFromUser接口暂时放在UIAbilityContext中。现在权限弹窗应用切换为基于ServiceExtensionAbility实现,不再需要借助UIAbilityContext的startAbilityForResult接口,因此把requestPermissionsFromUser接口迁移到security子系统。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; | 删除 | +| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array): Promise; | 删除 | +| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array, requestCallback: AsyncCallback) : void; | 新增 | +| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array) : Promise; | 新增 | + + +**适配指导** + +应用中调用requestPermissionsFromUser拉起权限弹窗应用可参考下列代码 + +Stage模型下的示例: + +```ts +import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; +//UIAbility的onWindowStageCreate生命周期 +onWindowStageCreate() { + let AtManager = abilityAccessCtrl.createAtManager(); + //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 + AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => { + console.log("data type:" + typeof(data)); + console.log("data:" + data); + console.log("data permissions:" + data.permissions); + console.log("data result:" + data.authResults); + }).catch((err) => { + console.error('Failed to start ability', err.code); + }) +} +``` + + + +## cl.ability.2 删除标记为废弃的API9接口 + +[元能力异常处理整改](../OpenHarmony_3.2.8.3/changelogs-ability.md)将部分API9接口标记为了废弃,根据OpenHarmony接口规范,需要删除标记为废弃的API9接口。 + +**变更影响** + +基于此前版本开发的应用,需要将被删除的接口替换为新接口,否则会影响应用编译。 + +**关键接口/组件变更** + +接口文件被删除: + +| 被删除接口 | 新接口 | +| ----------------------------------------------- | ----------------------------------------------- | +| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts | +| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts | +| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts | +| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts | +| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts | +| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts | +| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts | +| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts | +| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts | +| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts | +| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts | + +接口、属性被删除: + +- @ohos.application.Configuration.d.ts + - Configuration 的 direction、screenDensity、displayId、hasPointerDevice 被删除。可以使用 @ohos.app.ability.Configuration.d.ts 的 Configuration替换。 +- @ohos.application.ConfigurationConstant.d.ts + - 枚举 Direction 和 ScreenDensity 被删除。可以使用 @ohos.app.ability.ConfigurationConstant.d.ts 的枚举 Direction 和 ScreenDensity 替换。 +- @ohos.application.abilityManager.d.ts + - 方法 getExtensionRunningInfos 和 getTopAbility 被删除。可以使用 @ohos.app.ability.abilityManager.d.ts 的同名方法替换。 +- @ohos.application.appManager.d.ts + - 枚举 ApplicationState 和 ProcessState 被删除。可以使用 @ohos.app.ability.appManager.d.ts 的枚举 ApplicationState 和 ProcessState 替换。 + - 方法 registerApplicationStateObserver 和 getProcessRunningInformation被删除。可以使用 @ohos.app.ability.appManager.d.ts 的同名方法替换。 +- @ohos.application.formHost.d.ts + - 方法 shareForm 和 notifyFormsPrivacyProtected 被删除。可以使用 @ohos.app.form.formHost.d.ts 的同名方法替换。 +- @ohos.application.formInfo.d.ts + - 枚举 FormType 的 eTS 被删除,可以使用 @ohos.app.form.formInfo.d.ts 的 FormType 中的 eTS 替换。 + - 枚举 FormParam 的 IDENTITY_KEY、BUNDLE_NAME_KEY、ABILITY_NAME_KEY、DEVICE_ID_KEY 被删除,可以使用 @ohos.app.form.formInfo.d.ts 的 FormParam 中的同名枚举替换。 + - 接口 FormInfoFilter 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 FormInfoFilter 替换。 + - 枚举 FormDimension 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 FormDimension 替换。 + - 枚举 VisibilityType 被删除。可以使用 @ohos.app.form.formInfo.d.ts 的 VisibilityType 替换。 +- @ohos.wantAgent.d.ts + - 方法 trigger 和 getOperationType 被删除。可以使用 @ohos.app.ability.wantAgent.d.ts 的同名方法替换。 +- application/ApplicationContext.d.ts + - 方法 registerAbilityLifecycleCallback、unregisterAbilityLifecycleCallback、registerEnvironmentCallback、unregisterEnvironmentCallback 被删除。可以使用 on、off 替换。 +- application/ServiceExtensionContext.d.ts + - 方法 connectAbility、connectAbilityWithAccount、disconnectAbility 被删除。可以使用 connectServiceExtensionAbility、connectServiceExtensionAbilityWithAccount、disconnectServiceExtensionAbility 替换。 +- @ohos.application.FormExtension.d.ts + - 生命周期onCreate、onCastToNormal、onUpdate、onVisibilityChange、onEvent、onDestroy、onAcquireFormState、onShare 被删除。可以使用@ohos.app.form.FormExtensionAbility.d.ts的onAddForm、onCastToNormalForm、onUpdateForm、onChangeFormVisibility、onFormEvent、onRemoveForm、onAcquireFormState、onShareForm +- @ohos.application.abilityDelegatorRegistry.d.ts + - 导出类 AbilityDelegator、AbilityDelegatorArgs、AbilityMonitor、ShellCmdResult 被删除。可以使用@ohos.app.ability.abilityDelegatorRegistry.d.ts中的同名导出类替换。 +- @ohos.application.abilityManager.d.ts + - 导出类 AbilityRunningInfo、ExtensionRunningInfo 被删除。可以使用@ohos.app.ability.abilityManager.d.ts中的同名导出类替换。 +- @ohos.application.appManager.d.ts + - 导出类 AbilityStateData、AppStateData、ApplicationStateObserver、ProcessRunningInfo、ProcessRunningInformation 被删除。可以使用@ohos.app.ability.appManager.d.ts中的同名导出类替换。 +- @ohos.application.missionManager.d.ts + - 导出类 MissionInfo、MissionListener、MissionSnapshot 被删除。可以使用@ohos.app.ability.missionManager.d.ts中的同名导出类替换。 +- @ohos.wantAgent.d.ts + - 导出类 TriggerInfo、WantAgentInfo 被删除。可以使用@ohos.app.ability.wantAgent.d.ts中的同名导出类替换。 + + + + + +**适配指导** + +如上所述,仅少数接口修改了接口名的如注册回调函数(registerAbilityLifecycleCallback、unregisterAbilityLifecycleCallback、registerEnvironmentCallback、unregisterEnvironmentCallback)和连接断开 ServiceExtensionAbility(connectAbility、connectAbilityWithAccount、disconnectAbility),卡片生命周期等需要替换成新的接口名。 + +绝大多数接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.application.Ability + +```js +import Ability from '@ohos.application.Ability'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import Ability from '@ohos.app.ability.UIAbility'; +``` + +此外还需要适配异常处理,具体参考新接口的接口文档。 + +## cl.ability.2 appRecovery接口中RestartFlag属性名称变更,删除了未支持的属性 + +appRecovery接口中RestartFlag枚举命名从特定故障发生后**不重启**改成了特定故障发生后**重启**。 +删除了CPP_CRASH_NO_RESTART。 + +**变更影响** + +3.2.10.6版本之前使用CPP_CRASH_NO_RESTART/JS_CRASH_NO_RESTART/APP_FREEZE_NO_RESTART类型开发的应用,在3.2.10.6版本之后行为会发生变化。 + +**关键接口/组件变更** + +**RestartFlag** 9+ + +变更前: + +| 名称 | 值 | 说明 | +| --------------------- | ------ | -------------------------------- | +| ALWAYS_RESTART | 0 | 总是重启应用。 | +| CPP_CRASH_NO_RESTART | 0x0001 | 发生CPP_CRASH时**不重启**应用。 | +| JS_CRASH_NO_RESTART | 0x0002 | 发生JS_CRASH时**不重启**应用。 | +| APP_FREEZE_NO_RESTART | 0x0004 | 发生APP_FREEZE时**不重启**应用。 | +| NO_RESTART | 0xFFFF | 总是不重启应用。 | + +变更后: + +| 名称 | 值 | 说明 | +| ----------------------- | ------ | ------------------------------ | +| ALWAYS_RESTART | 0 | 总是重启应用。 | +| CPP_CRASH_NO_RESTART | NA | **删除**,不支持该场景的重启。 | +| RESTART_WHEN_JS_CRASH | 0x0001 | 发生JS_CRASH时**重启**应用。 | +| RESTART_WHEN_APP_FREEZE | 0x0002 | 发生APP_FREEZE时**重启**应用。 | +| NO_RESTART | 0xFFFF | 总是不重启应用。 | + +**适配指导** + +按新的语义进行适配。 + + + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..8b8cad7dbf026cb17c1599e61ebdbae510073a30 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-account_os_account.md @@ -0,0 +1,96 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 createOsAccountForDomain错误码变更 + +使用createOsAccountForDomain重复创建域帐号时,变更前返回的错误码为12300001,变更后返回的错误码为12300004。 +错误信息由通用系统报错细化为帐号已存在报错。 + +**变更影响** + +基于此前版本开发的应用,需适配变更后的错误码,否则会影响原有业务逻辑。 + +**关键接口/组件变更** +- AccountManager + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>); + - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>; + +**适配指导** + +重复创建域帐号的示例代码如下: + +```ts +import account_osAccount from "@ohos.account.osAccount" + +let accountMgr = account_osAccount.getAccountManager(); +let domainInfo = { + accountName: "zhangsan", + domain: "china.example.com" +}; +try { + await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); + await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); +} catch (err) { + console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004; +} +``` + +## cl.account_os_account.2 应用帐号getAllAccounts接口权限场景变更 + +应用使用getAllAccounts接口查询自己可访问的帐号列表时,不需要申请权限ohos.permission.GET_ALL_APP_ACCOUNTS。 + +**变更影响** + +基于此后版本开发的应用,查询自己可访问的帐号列表时,无需申请权限。 + +**关键接口/组件变更** +- AccountManager + - getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void; + - getAllAccounts(): Promise<Array<AppAccountInfo>>; + +**适配指导** + +应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询自己可访问的帐号列表示例代码如下: + +```ts +import account_appAccount from "@ohos.account.appAccount" + +let accountMgr = account_appAccount.createAppAccountManager(); +try { + await accountMgr.addAccount("accessibleAccount_promise_nopermission"); + var data = await accountMgr.getAllAccounts(); + if (data[0].name == "accessibleAccount_promise_nopermission") { + console.log("getAllAccounts successfully"); + } +} catch (err) { + console.log("getAllAccounts err: " + JSON.stringify(err)); +} +``` + +## cl.account_os_account.3 应用帐号getAccountsByOwner接口权限场景变更 + +应用使用getAccountsByOwner接口查询可访问的指定应用的帐号列表时,不需要申请权限ohos.permission.GET_ALL_APP_ACCOUNTS。 + +**变更影响** + +基于此后版本开发的应用,查询指定应用可访问的帐号列表时,无需申请权限。 + +**关键接口/组件变更** +- AccountManager + - getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void; + - getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>; + +**适配指导** + +应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询指定应用可访问的帐号列表示例代码如下: + +```ts +import account_appAccount from "@ohos.account.appAccount" + +let accountMgr = account_appAccount.createAppAccountManager(); +try { + var ownerName = "com.example.owner"; + var data = await accountMgr.getAllAccounts(ownerName); +} catch (err) { + console.log("getAllAccounts err: " + JSON.stringify(err)); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..d77b0d5199966674cbbd0db22be3fa7b37038519 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-arkui.md @@ -0,0 +1,332 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 状态变量数据类型声明使用限制 + +1. 所有的状态装饰器变量需要显式声明变量类型,不允许声明any,不支持Date数据类型。 + + 示例: + + ```ts + // xxx.ets + @Entry + @Component + struct DatePickerExample { + // 错误写法: @State isLunar: any = false + @State isLunar: boolean = false + // 错误写法: @State selectedDate: Date = new Date('2021-08-08') + private selectedDate: Date = new Date('2021-08-08') + + build() { + Column() { + Button('切换公历农历') + .margin({ top: 30 }) + .onClick(() => { + this.isLunar = !this.isLunar + }) + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + .lunar(this.isLunar) + .onChange((value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info('select current date is: ' + JSON.stringify(value)) + }) + + }.width('100%') + } + } + ``` + + ![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif) + +2. @State、@Provide、 @Link和@Consume四种状态变量的数据类型声明只能由简单数据类型或引用数据类型的其中一种构成。 + + 类型定义中的Length、ResourceStr、ResourceColor三个类型是简单数据类型或引用数据类型的组合,所以不能被以上四种状态装饰器变量使用。 + Length、ResourceStr、ResourceColor的定义请看文档[arkui-ts类型定义](../../../application-dev/reference/arkui-ts/ts-types.md)。 + + 示例: + + ```ts + // xxx.ets + @Entry + @Component + struct IndexPage { + // 错误写法: @State message: string | Resource = 'Hello World' + @State message: string = 'Hello World' + // 错误写法: @State message: ResourceStr = $r('app.string.hello') + @State resourceStr: Resource = $r('app.string.hello') + + build() { + Row() { + Column() { + Text(`${this.message}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } + } + ``` + + ![hello](../../../application-dev/quick-start/figures/hello.PNG) + +**变更影响** + +1. 如果状态装饰器变量没有显式声明变量类型,声明any,编译拦截报错; + ```ts + // ArkTS:ERROR Please define an explicit type, not any. + @State isLunar: any = false + ``` +2. 状态装饰器变量声明变量类型为Date,编译拦截报错; + ```ts + // ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object. + @State selectedDate: Date = new Date('2021-08-08') + ``` +3. @State、@Provide、 @Link和@Consume四种状态变量使用框架提供的Length、ResourceStr、ResourceColor, + 编译拦截报错。 + ```ts + /* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type, + which are not allowed to be defined for state variable of a struct.*/ + @State message: ResourceStr = $r('app.string.hello') + ``` + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +1. 状态装饰器变量声明具体的变量类型替代any; +2. 使用Date对象的状态装饰器变量,修改为不加状态装饰器修饰的常规变量; +3. 因为Length(string|number|Resource), ResourceStr(string|Resource), ResourceColor(string|number|Color|Resource) + 的三个类型是简单数据类型或引用数据类型的组合,使用@State、@Provide、 @Link和@Consume四种状态变量场景参考以下修改: + ```ts + // 错误写法: + @State message: ResourceStr = $r('app.string.hello') + // 修正后的写法: + @State resourceStr: Resource = $r('app.string.hello') + ``` + + +## cl.arkui.2 自定义组件成员变量初始化的规则与约束 + +通过构造函数方法初始化成员变量,需要遵循如下规则: + +| **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | +|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| +| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | + +| **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | +|------------------|------------------|------------------|-----------------------|------------------------| +| **regular** | 支持 | 不支持 | 不支持 | 不支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | + +> **说明** +> +> **支持(1)**:必须使用`$`, 例如 `this.$varA`。 +> **regular**:未加修饰的常规变量。 + +不允许从父组件初始化`@StorageLink`, `@StorageProp`, `@LocalStorageLink`, `@LocalStorageProp`修饰的变量。 + +**变更影响** + +1. 不允许从父组件初始化`@LocalStorageLink`, `@LocalStorageProp`修饰的变量。 + ```ts + @Entry + @Component + struct LocalStorageComponent { + build() { + Column() { + Child({ + /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + simpleVarName: 1, + /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + objectName: new ClassA("x") + }) + } + } + } + @Component + struct Child { + @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0; + @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x"); + build() {} + } + ``` +2. 子组件的@ObjectLink变量不支持父组件装饰器变量的直接赋值,其父组件的源必须是数组的项或对象的属性,该数组或对象必现用`@State`、`@Link`、`@Provide`、`@Consume`或`@ObjectLink`装饰器修饰。 + ```ts + let NextID : number = 0; + + @Observed class ClassA { + public id : number; + public c: number; + constructor(c: number) { + this.id = NextID++; + this.c = c; + } + } + + @Component + struct Child { + @ObjectLink varA : ClassA; + build() { + Row() { + Text('ViewA-' + this.varA.id) + } + } + } + + @Component + struct Parent { + @Link linkValue: ClassA + build() { + Column() { + /* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to + the @ObjectLink property 'varA'.*/ + Child({ varA: this.linkValue }) + } + } + } + ``` + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** +1. 构造子组件时,不对子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量进行。 +如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 +2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md)。 + + +## cl.arkui.LocalStorage.1 get接口返回类型变更 + +**变更影响** + +返回类型从get(propName: string): T变更为get(propName: string): T | undefined +应用不需要进行适配。 + +## cl.arkui.LocalStorage.2 setOrCreate参数newValue变成必选 +**变更影响** + +原接口声明: +```js +setOrCreate(propName: string, newValue?: T): boolean +``` +现接口声明: +```js +setOrCreate(propName: string, newValue: T): boolean +``` +第二个参数newValue变为必选。 +如果应用调用这个接口没有指定newValue参数,在替换新的sdk后会编译不过,需要手动指定newValue。 + +**适配指导** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('propA', 'hello'); +``` +## cl.arkui.LocalStorage.3 link参数和返回类型变更 +**变更影响** + +原接口声明: +```js +link(propName: string, linkUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +link(propName: string): SubscribedAbstractProperty +``` +1. link第二三个参数为框架内部调用,不应对外开发,所以将接口变更为一个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let linA = storage.link("PropA"); +linA.set(50); +``` + +## cl.arkui.LocalStorage.4 setAndLink参数和返回类型变更 +**变更影响** + +原接口声明: +```js +setAndLink(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty +``` +1. setAndLink第三四个参数为框架内部调用,不应对外开发,所以将接口变更为2个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let linA = storage.setAndLink("PropA", "48") +linA.set(50); +``` + +## cl.arkui.LocalStorage.5 prop参数和返回类型变更 +**变更影响** + +原接口声明: +```js +prop(propName: string, propUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +prop(propName: string): SubscribedAbstractProperty +``` +1. prop第二三个参数为框架内部调用,不应对外开发,所以将接口变更为1个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let propA = storage.prop("PropA"); +propA.set(51); // one-way sync +``` + +## cl.arkui.LocalStorage.6 setAndProp参数和返回类型变更 +**变更影响** + +原接口声明: +```js +setAndProp(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T +``` +现接口声明: +```js +setAndProp(propName: string, defaultValue: S): SubscribedAbstractProperty +``` +1. setAndProp第三四个参数为框架内部调用,不应对外开发,所以将接口变更为2个参数; +2. 返回类型T变更为SubscribedAbstractProperty; + +**适配指导** + +```js +let storage = new LocalStorage({"PropA": "47"}); +let propA = storage.setAndProp("PropA", "48"); +propA.set(51); // one-way sync +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md new file mode 100644 index 0000000000000000000000000000000000000000..3f5cd56d576151dc37ab56f50301a4d4443a271a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-camera-sync.md @@ -0,0 +1,520 @@ +# 媒体子系统 JS API 变更 Changelog + +## cl.subsystemname.1 camera 接口变更 +1. camera 部件在 API9 版本全量改为 SystemAPI +2. 基于以下原因新增部分功能接口以及废弃部分接口: + +提升开发者使用相机接口的便利。 +帮助开发者快速掌握相机开发接口,快速投入到开发当中。 +易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。 + +具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +影响 API9 版本的 JS 接口,应用需要进行适配才可以在新版本 SDK 环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 是否为 SystemApi | 变更类型 | +| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | 是 | 新增 | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback): void;
function getCameraManager(context: Context): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,
OPERATION_NOT_ALLOWED = 7400102,
SESSION_NOT_CONFIG = 7400103,
SESSION_NOT_RUNNING = 7400104,
SESSION_CONFIG_LOCKED = 7400105,
DEVICE_SETTING_LOCKED = 7400106,
CONFILICT_CAMERA = 7400107,
DEVICE_DISABLED = 7400108,
SERVICE_FATAL_ERROR = 7400201 | 是 | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array;
getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
createCameraInput(camera: CameraDevice): CameraInput;
createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
createMetadataOutput(metadataObjectTypes: Array): MetadataOutput;
createCaptureSession(): CaptureSession; | 是 | 新增 | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>;
getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise;
createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise;
createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void;
createCameraInput(position: CameraPosition, type: CameraType): Promise;
createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise;
createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise;
createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise;
createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise;
createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | 是 | 新增 | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | 是 | 废弃 | +| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback): void;
release(): Promise;
on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1
ERROR_NO_PERMISSION = 0
ERROR_DEVICE_PREEMPTED = 1
ERROR_DEVICE_DISCONNECTED = 2
ERROR_DEVICE_IN_USE = 3
ERROR_DRIVER_ERROR = 4 | 是 | 废弃 | +| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSession | beginConfig(): void;
addInput(cameraInput: CameraInput): void;
removeInput(cameraInput: CameraInput): void;
addOutput(cameraOutput: CameraOutput): void;
removeOutput(cameraOutput: CameraOutput): void;
hasFlash(): boolean;
isFlashModeSupported(flashMode: FlashMode): boolean;
getFlashMode(): FlashMode;
setFlashMode(flashMode: FlashMode): void;
isExposureModeSupported(aeMode: ExposureMode): boolean;
getExposureMode(): ExposureMode;
setExposureMode(aeMode: ExposureMode): void;
getMeteringPoint(): Point;
setMeteringPoint(point: Point): void;
getExposureBiasRange(): Array;
setExposureBias(exposureBias: number): void;
getExposureValue(): number;
isFocusModeSupported(afMode: FocusMode): boolean;
getFocusMode(): FocusMode;
setFocusMode(afMode: FocusMode): void;
setFocusPoint(point: Point): void;
getFocusPoint(): Point;
getFocalLength(): number;
getZoomRatioRange(): Array;
getZoomRatio(): number;
setZoomRatio(zoomRatio: number): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
getActiveVideoStabilizationMode(): VideoStabilizationMode;
setVideoStabilizationMode(mode: VideoStabilizationMode): void;
on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback): void;
beginConfig(): Promise;
addInput(cameraInput: CameraInput, callback: AsyncCallback): void;
addInput(cameraInput: CameraInput): Promise;
removeInput(cameraInput: CameraInput, callback: AsyncCallback): void;
removeInput(cameraInput: CameraInput): Promise;
addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise;
removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise;
hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise;
getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise;
setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise;
on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0
ERROR_TIMEOUT = 1 | 是 | 废弃 | +| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | 是 | 废弃 | +| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutput | capture(): Promise;
isMirrorSupported(): boolean;
on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback): void;
isMirrorSupported(): Promise;
on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0
ERROR_INSUFFICIENT_RESOURCES = 1
ERROR_TIMEOUT = 2 | 是 | 废弃 | +| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0 | 是 | 废弃 | +| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | 是 | 废弃 | +| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;
readonly timestamp: number; | 是 | 新增 | +| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback): void;
getType(): Promise;
getTimestamp(callback: AsyncCallback): void;
getTimestamp(): Promise;
getBoundingBox(callback: AsyncCallback): void;
getBoundingBox(): Promise; | 是 | 废弃 | +| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | 是 | 新增 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 新增 | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | 是 | 废弃 | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0 | 是 | 废弃 | +| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | 是 | 废弃 | + +**适配指导** + +除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配: + +从 Beta4 版本开始,对以下接口进行调整: + +**新增接口** + +1. CameraErrorCode 枚举 + + 枚举值名称:INVALID_ARGUMENT, 值:7400101; + + 枚举值名称:OPERATION_NOT_ALLOWED, 值:7400102; + + 枚举值名称:SESSION_NOT_CONFIG, 值:7400103; + + 枚举值名称:SESSION_NOT_RUNNING, 值:7400104; + + 枚举值名称:SESSION_CONFIG_LOCKED, 值:7400105; + + 枚举值名称:DEVICE_SETTING_LOCKED, 值:7400106; + + 枚举值名称:CONFILICT_CAMERA, 值:7400107; + + 枚举值名称:DEVICE_DISABLED, 值:7400108; + + 枚举值名称:SERVICE_FATAL_ERROR, 值:7400201; + +2. PhotoOutput 接口新增 capture(): Promise; + +3. MetadataObject 接口中新增 readonly type: MetadataObjectType; + +4. MetadataObject 接口中新增 readonly timestamp: number; + +5. MetadataObject 接口中新增 readonly boundingBox: Rect; + +**废弃接口** + +1. CameraInput 中废弃接口 release(callback: AsyncCallback): void; 以及 release(): Promise; + +2. 废弃枚举 CameraInputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_NO_PERMISSION = 0,ERROR_DEVICE_PREEMPTED = 1,ERROR_DEVICE_DISCONNECTED = 2,ERROR_DEVICE_IN_USE = 3,ERROR_DRIVER_ERROR = 4); + +3. 废弃接口 CameraInputError 以及接口属性 code:CameraInputErrorCode; + +4. 废弃枚举 CaptureSessionErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0,ERROR_TIMEOUT = 1); + +5. 废弃接口 CaptureSessionError 以及接口属性 code: CaptureSessionErrorCode; + +6. 废弃枚举 PreviewOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1); + +7. 废弃接口 PreviewOutputError 以及接口属性 code: PreviewOutputErrorCode; + +8. 废弃枚举 PhotoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0,ERROR_INSUFFICIENT_RESOURCES = 1,ERROR_TIMEOUT = 2); + +9. 废弃接口 PhotoOutputError 以及接口属性 code:PhotoOutputErrorCode; + +10. 废弃枚举 VideoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0); + +11. 废弃接口 VideoOutputError 以及接口属性 code:VideoOutputErrorCode; + +12. 废弃接口 MetadataObject 中 getType(callback: AsyncCallback): void; + +13. 废弃接口 MetadataObject 中 getType(): Promise; + +14. 废弃接口 MetadataObject 中 getTimestamp(callback: AsyncCallback): void; + +15. 废弃接口 MetadataObject 中 getTimestamp(): Promise; + +16. 废弃接口 MetadataObject 中 getBoundingBox(callback: AsyncCallback): void; + +17. 废弃接口 MetadataObject 中 getBoundingBox(): Promise; + +18. 废弃枚举 MetadataOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0); + +19. 废弃接口 MetadataOutputError 以及接口属性 code:MetadataOutputErrorCode; + +**接口变更** + +1. camera 模块中接口 getCameraManager 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getCameraManager(context: Context, callback: AsyncCallback): void; 以及 getCameraManager(context: Context): Promise; 变更为 getCameraManager(context: Context): CameraManager; + + 参考代码如下: + + ``` + let cameraManager = camera.getCameraManager(context); + ``` + +2. CameraManager 中接口 getSupportedCameras 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedCameras(callback: AsyncCallback>): void; 以及 getSupportedCameras(): Promise>; 变更为 getSupportedCameras(): Array; + + 参考代码如下: + + ``` + let cameras = cameraManager.getSupportedCameras(); + ``` + +3. CameraManager 中接口 getSupportedOutputCapability 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void; 以及 getSupportedOutputCapability(camera: CameraDevice): Promise; 变更为 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice); + ``` + +4. CameraManager 中接口 createCameraInput(camera: CameraDevice) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(camera: CameraDevice, callback: AsyncCallback): void; 以及 createCameraInput(camera: CameraDevice): Promise; 变更为 createCameraInput(camera: CameraDevice): CameraInput; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let cameraInput = cameraManager.createCameraInput(cameraDevice); + ``` + +5. CameraManager 中接口 createCameraInput(position: CameraPosition, type: CameraType) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void; 以及 createCameraInput(position: CameraPosition, type: CameraType): Promise; 变更为 createCameraInput(position: CameraPosition, type: CameraType): CameraInput; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + let position = cameraDevice.cameraPosition; + let type = cameraDevice.cameraType; + let cameraInput = cameraManager.createCameraInput(position, type); + ``` + +6. CameraManager 中接口 createPreviewOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; 以及 createPreviewOutput(profile: Profile, surfaceId: string): Promise; 变更为 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId); + ``` + +7. CameraManager 中接口 createPhotoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; 以及 createPhotoOutput(profile: Profile, surfaceId: string): Promise; 变更为 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId); + ``` + +8. CameraManager 中接口 createVideoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void; 以及 createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; 变更为 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; + + 参考代码如下: + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + let videoOutput = cameraManager.createVideoOutput(profile, surfaceId); + ``` + +9. CameraManager 中接口 createMetadataOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void; 以及 createMetadataOutput(metadataObjectTypes: Array): Promise; 变更为 createMetadataOutput(metadataObjectTypes: Array): MetadataOutput; + + 参考代码如下: + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); + ``` + +10. CameraManager 中接口 createCaptureSession 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCaptureSession(callback: AsyncCallback): void; 以及 createCaptureSession(): Promise; 变更为 createCaptureSession(): CaptureSession; + + 参考代码如下: + + ``` + let captureSession = cameraManager.createCaptureSession(); + ``` + +11. 枚举 CameraType 中,枚举值名称 CAMERA_TYPE_UNSPECIFIED 变更为 CAMERA_TYPE_DEFAULT。 + +12. CameraInput 中,on 接口返回值类型由 CameraInputError 变更为 BusinessError,因此旧接口 on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; 变更为 on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + + 参考代码如下: + + ``` + let cameraDevice = cameras[0]; + cameraInput.on('error', cameraDevice, (BusinessError) => { + + }) + ``` + +13. CaptureSession 中接口 beginConfig 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 beginConfig(callback: AsyncCallback): void; 以及 beginConfig(): Promise; 变更为 beginConfig(): void; + + 参考代码如下: + + ``` + captureSession.beginConfig(); + ``` + +14. CaptureSession 中接口 addInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addInput(cameraInput: CameraInput, callback: AsyncCallback): void; 以及 addInput(cameraInput: CameraInput): Promise; 变更为 addInput(cameraInput: CameraInput): void; + + 参考代码如下: + + ``` + captureSession.addInput(cameraInput); + ``` + +15. CaptureSession 中接口 removeInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeInput(cameraInput: CameraInput, callback: AsyncCallback): void; 以及 removeInput(cameraInput: CameraInput): Promise; 变更为 removeInput(cameraInput: CameraInput): void; + + 参考代码如下: + + ``` + captureSession.removeInput(cameraInput); + ``` + +16. CaptureSession 中接口 addOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; 以及 addOutput(cameraOutput: CameraOutput): Promise; 变更为 addOutput(cameraOutput: CameraOutput): void; + + 参考代码如下: + + ``` + captureSession.addOutput(previewOutput); + ``` + +17. CaptureSession 中接口 removeOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; 以及 removeOutput(cameraOutput: CameraOutput): Promise; 变更为 removeOutput(cameraOutput: CameraOutput): void; + + 参考代码如下: + + ``` + captureSession.removeOutput(previewOutput); + ``` + +18. CaptureSession 中接口 hasFlash 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 hasFlash(callback: AsyncCallback): void; 以及 hasFlash(): Promise; 变更为 hasFlash(): boolean; + + 参考代码如下: + + ``` + let status = captureSession.hasFlash(); + ``` + +19. CaptureSession 中接口 isFlashModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; 以及 isFlashModeSupported(flashMode: FlashMode): Promise; 变更为 isFlashModeSupported(flashMode: FlashMode): boolean; + + 参考代码如下: + + ``` + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); + ``` + +20. CaptureSession 中接口 getFlashMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFlashMode(callback: AsyncCallback): void; 以及 getFlashMode(): Promise; 变更为 getFlashMode(): FlashMode; + + 参考代码如下: + + ``` + let flashMode = captureSession.getFlashMode(); + ``` + +21. CaptureSession 中接口 isExposureModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void; 以及 isExposureModeSupported(aeMode: ExposureMode): Promise; 变更为 isExposureModeSupported(aeMode: ExposureMode): boolean; + + 参考代码如下: + + ``` + let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +22. CaptureSession 中接口 getExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureMode(callback: AsyncCallback): void; 以及 getExposureMode(): Promise; 变更为 getExposureMode(): ExposureMode; + + 参考代码如下: + + ``` + let exposureMode = captureSession.getExposureMode(); + ``` + +23. CaptureSession 中接口 setExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void; 以及 setExposureMode(aeMode: ExposureMode): Promise; 变更为 setExposureMode(aeMode: ExposureMode): void; + + 参考代码如下: + + ``` + captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +24. CaptureSession 中接口 getMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getMeteringPoint(callback: AsyncCallback): void; 以及 getMeteringPoint(): Promise; 变更为 getMeteringPoint(): Point; + + 参考代码如下: + + ``` + let exposurePoint = captureSession.getMeteringPoint(); + ``` + +25. CaptureSession 中接口 setMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setMeteringPoint(point: Point, callback: AsyncCallback): void; 以及 setMeteringPoint(point: Point): Promise; 变更为 setMeteringPoint(point: Point): void; + + 参考代码如下: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setMeteringPoint(Point2); + ``` + +26. CaptureSession 中接口 getExposureBiasRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureBiasRange(callback: AsyncCallback>): void; 以及 getExposureBiasRange(): Promise>; 变更为 getExposureBiasRange(): Array; + + 参考代码如下: + + ``` + let biasRangeArray = captureSession.getExposureBiasRange(); + ``` + +27. CaptureSession 中接口 setExposureBias 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureBias(exposureBias: number, callback: AsyncCallback): void; 以及 setExposureBias(exposureBias: number): Promise; 变更为 setExposureBias(exposureBias: number): void; + + 参考代码如下: + + ``` + let exposureBias = biasRangeArray[0]; + captureSession.setExposureBias(exposureBias); + ``` + +28. CaptureSession 中接口 getExposureValue 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureValue(callback: AsyncCallback): void; 以及 getExposureValue(): Promise; 变更为 getExposureValue(): number; + + 参考代码如下: + + ``` + let exposureValue = captureSession.getExposureValue(); + ``` + +29. CaptureSession 中接口 isFocusModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; 以及 isFocusModeSupported(afMode: FocusMode): Promise; 变更为 isFocusModeSupported(afMode: FocusMode): boolean; + + 参考代码如下: + + ``` + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +30. CaptureSession 中接口 getFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusMode(callback: AsyncCallback): void; 以及 getFocusMode(): Promise; 变更为 getFocusMode(): FocusMode; + + 参考代码如下: + + ``` + let afMode = captureSession.getFocusMode(); + ``` + +31. CaptureSession 中接口 setFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; 以及 setFocusMode(afMode: FocusMode): Promise; 变更为 setFocusMode(afMode: FocusMode): void; + + 参考代码如下: + + ``` + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +32. CaptureSession 中接口 setFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusPoint(point: Point, callback: AsyncCallback): void; 以及 setFocusPoint(point: Point): Promise; 变更为 setFocusPoint(point: Point): void; + + 参考代码如下: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setFocusPoint(Point2); + ``` + +33. CaptureSession 中接口 getFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusPoint(callback: AsyncCallback): void; 以及 getFocusPoint(): Promise; 变更为 getFocusPoint(): Point; + + 参考代码如下: + + ``` + let point = captureSession.getFocusPoint(); + ``` + +34. CaptureSession 中接口 getFocalLength 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocalLength(callback: AsyncCallback): void; 以及 getFocalLength(): Promise; 变更为 getFocalLength(): number; + + 参考代码如下: + + ``` + let focalLength = captureSession.getFocalLength(); + ``` + +35. CaptureSession 中接口 getZoomRatioRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatioRange(callback: AsyncCallback>): void; 以及 getZoomRatioRange(): Promise>; 变更为 getZoomRatioRange(): Array; + + 参考代码如下: + + ``` + let zoomRatioRange = captureSession.getZoomRatioRange(); + ``` + +36. CaptureSession 中接口 getZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatio(callback: AsyncCallback): void; 以及 getZoomRatio(): Promise; 变更为 getZoomRatio(): number; + + 参考代码如下: + + ``` + let zoomRatio = captureSession.getZoomRatio(); + ``` + +37. CaptureSession 中接口 setZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; 以及 setZoomRatio(zoomRatio: number): Promise; 变更为 setZoomRatio(zoomRatio: number): void; + + 参考代码如下: + + ``` + let zoomRatio = zoomRatioRange[0]; + captureSession.setZoomRatio(zoomRatio); + ``` + +38. CaptureSession 中接口 isVideoStabilizationModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void; 以及 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise; 变更为 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + + 参考代码如下: + + ``` + let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); + ``` + +39. CaptureSession 中接口 getActiveVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getActiveVideoStabilizationMode(callback: AsyncCallback): void; 以及 getActiveVideoStabilizationMode(): Promise; 变更为 getActiveVideoStabilizationMode(): VideoStabilizationMode; + + 参考代码如下: + + ``` + let vsMode = captureSession.getActiveVideoStabilizationMode(); + ``` + +40. CaptureSession 中接口 setVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void; 以及 setVideoStabilizationMode(mode: VideoStabilizationMode): Promise; 变更为 setVideoStabilizationMode(mode: VideoStabilizationMode): void; + + 参考代码如下: + + ``` + captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); + ``` + +41. CaptureSession 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + captureSession.on('error', (BusinessError) => { + + }) + ``` + +42. PreviewOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + previewOutput.on('error', (BusinessError) => { + + }) + ``` + +43. PhotoOutput 中接口 isMirrorSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isMirrorSupported(callback: AsyncCallback): void; 以及 isMirrorSupported(): Promise; 变更为 isMirrorSupported(): boolean; + + 参考代码如下: + + ``` + let isSupported = photoOutput.isMirrorSupported(); + ``` + +44. PhotoOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + PhotoOutput.on('error', (BusinessError) => { + + }) + ``` + +45. VideoOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + VideoOutput.on('error', (BusinessError) => { + + }) + ``` + +46. MetadataOutput 中,on(type: 'error') callback 类型由 ErrorCallback 变更为 ErrorCallback,因此旧接口 on(type: 'error', callback: ErrorCallback): void; 变更为 on(type: 'error', callback: ErrorCallback): void; + + 参考代码如下: + + ``` + MetadataOutput.on('error', (BusinessError) => { + + }) + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md new file mode 100644 index 0000000000000000000000000000000000000000..8ba5a4809bb3b6fee51165a615a1bded4be9421e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-container.md @@ -0,0 +1,21 @@ +# 公共基础类库子系统JS API变更Changelog + +## cl.公共基础类库子系统.1 错误码及信息变更 +公共基础类库子系统子系统中ArrayList、List、LinkedList、Stack、Queue、Deque、PlainArray、LightWeightMap、LightWeightSet、HashMap、HashSet、TreeMap、TreeSet类的接口抛出的错误码及信息变更: + +变更后的错误码详细介绍请参见[语言基础类库错误码](../../../application-dev/reference/errorcodes/errorcode-utils.md)。 + +已使用相关接口开发的应用无需重新适配。 + +**关键的接口/组件变更** +各个类中的接口重新定义了错误码抛出的信息,并在对应模块的`*.d.ts`声明文件中通过'@throws'标签进行标示。 +示例如下: +ArrayList类变更前: +constructor(); +ArrayList类变更后: +@throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked. +constructor(); + +**变更影响** + +暂无影响。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md new file mode 100644 index 0000000000000000000000000000000000000000..1bf0d3ff6bd3161271a8a79a0302f981aa670947 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-distributeddatamgr.md @@ -0,0 +1,158 @@ +# 分布式数据管理子系统JS API变更Changelog + +## cl.distributeddatamgr.1 接口变更 +distributeddatamgr子系统kv_store组件接口存在变更: + +由于执行时间固定且耗时短,不需要异步等待执行结果,createKVManager方法需要改为同步接口。因此旧的接口function createKVManager(config: KVManagerConfig): Promise\; 与 function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; 改为 function createKVManager(config: KVManagerConfig): KVManager; + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\; | 删除 | +| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | 变更 | + + +**适配指导** + +应用中调用createKVManager创建KVManager对象实例可参考下列代码 + +Stage模型下的示例: + +```ts +import AbilityStage from '@ohos.application.Ability' +let kvManager; +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + let context = this.context + const kvManagerConfig = { + context: context, + bundleName: 'com.example.datamanagertest', + } + try { + kvManager = distributedKVStore.createKVManager(kvManagerConfig); + } catch (e) { + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); + } + } +} +``` + +FA模型下的示例: + +```ts +import featureAbility from '@ohos.ability.featureAbility' +let kvManager; +let context = featureAbility.getContext() +const kvManagerConfig = { + context: context, + bundleName: 'com.example.datamanagertest', +} +try { + kvManager = distributedKVStore.createKVManager(kvManagerConfig); +} catch (e) { + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); +} +``` + +## cl.distributeddatamgr.2 function getRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +如下接口: +```ts +function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void; +function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise; +``` +从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts: +``` +function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void; +function getRdbStore(context: Context, config: StoreConfig): Promise; +``` + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的方法名称即可。 + +## cl.distributeddatamgr.3 function deleteRdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +如下接口: +```ts +function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; +function deleteRdbStoreV9(context: Context, name: string): Promise; +``` +从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts: +``` +function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; +function deleteRdbStoreV9(context: Context, name: string): Promise; +``` + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的方法名称即可。 + +## cl.distributeddatamgr.4 interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface StoreConfigV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface StoreConfig。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.5 enum SecurityLevel 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +enum SecurityLevel 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.6 interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface RdbStoreV9 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbStore。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.7 class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +class RdbPredicatesV9 从ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface RdbPredicates。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * 按上述接口变更对齐修改所调用的接口名称即可。 + +## cl.distributeddatamgr.8 interface ResultSetV9 从api/@ohos.data.relationalStore.d.ts 迁移至@ohos.data.relationalStore.d.ts +**变更影响** +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface ResultSetV9 从api/data/rdb/resultSet.d.ts 迁移至@ohos.data.relationalStore.d.ts 改名为interface ResultSet。 + +**适配指导** + * `import rdb from "@ohos.data.rdb"` 改为 `import rdb from "@ohos.data.relationalStore"`; + * ResultSetV9实例仅通过getRdbStoreV9方法获取,参考cl.distributeddatamgr.2变更后,代码可自动适配ResultSet。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md new file mode 100644 index 0000000000000000000000000000000000000000..d43b4523b78ba1d648e14ddde092b0f2a5557d98 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md @@ -0,0 +1,145 @@ +# 文件管理子系统ChangeLog + +## cl.filemanagement.1 environment模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。environment模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现environment模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原environment使用的是@ohos.environment,以以下方式import: + +```js +import environment from '@ohos.environment'; +``` + +现environment使用的是@ohos.file.environment,以以下方式import: + +```js +import environment from '@ohos.file.environment'; +``` + +## cl.filemanagement.2 securityLabel模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。securityLabel模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现securityLabel模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原securityLabel使用的是@ohos.securityLabel,以以下方式import: + +```js +import securityLabel from '@ohos.securityLabel'; +``` + +现securityLabel使用的是@ohos.file.securityLabel,以以下方式import: + +```js +import securityLabel from '@ohos.file.securityLabel'; +``` + +## cl.filemanagement.3 fs模块变更 + +fs模块下Stat接口ino属性类型变更。 + +**变更影响** + +fs模块下Stat接口ino属性类型变更,由number变更为bigint,以适配文件系统下所有类型文件的inode范围。 + +**关键接口/组件变更** + +原Stat接口ino属性类型为number,现变更为bigint。 + +## cl.filemanagement.4 fileAccess模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileAccess模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileAccess模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原fileAccess使用的是@ohos.data.fileAccess,以以下方式import: + +```js +import fileAccess from '@ohos.data.fileAccess'; +``` + +现fileAccess使用的是@ohos.file.fileAccess,以以下方式import: + +```js +import fileAccess from '@ohos.file.fileAccess'; +``` + +## cl.filemanagement.5 fileExtensionInfo模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileExtensionInfo模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原fileExtensionInfo使用的是@ohos.fileExtensionInfo,以以下方式import: + +```js +import fileExtensionInfo from '@ohos.fileExtensionInfo'; +``` + +现fileExtensionInfo使用的是@ohos.file.fileExtensionInfo,以以下方式import: + +```js +import fileExtensionInfo from '@ohos.file.fileExtensionInfo'; +``` + +## cl.filemanagement.6 storageStatistics模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现storageStatistics模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原storageStatistics使用的是@ohos.storageStatistics,以以下方式import: + +```js +import storageStatistics from '@ohos.storageStatistics'; +``` + +现storageStatistics使用的是@ohos.file.storageStatistics,以以下方式import: + +```js +import storageStatistics from '@ohos.file.storageStatistics'; +``` + +## cl.filemanagement.7 volumeManager模块变更 + +文件管理子系统d.ts归档整改,现统一整改到file一层目录下。fileExtensionInfo模块支持错误码处理。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现volumeManager模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md) + +**关键接口/组件变更** + +原volumeManager使用的是@ohos.volumeManager,以以下方式import: + +```js +import volumeManager from '@ohos.volumeManager'; +``` + +现volumeManager使用的是@ohos.file.volumeManager,以以下方式import: + +```js +import volumeManager from '@ohos.file.volumeManager'; +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md new file mode 100644 index 0000000000000000000000000000000000000000..ba3fbf1df4e369ec72a031df204a0cb6cbb7ff47 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-inputmethod-framworks.md @@ -0,0 +1,30 @@ +# 输入法框架changeLog + +## cl.inputmethod_frameworks.1 API文件名变更 + +下列模块不符合OpenHarmony接口文件名命名规范。在API9进行变更。 + + **变更影响** + + 修改后的SDK与先前已发布版本不兼容,影响在此前版本已开发的应用,应用需要进行适配改动才可以在新版本SDK环境正常编译通过。 + + **关键的接口/组件变更** + +| 模块 | 变更前文件名 | 变更后文件名 | +|------|--------------|--------------| +| 输入法框架模块 | @ohos.inputmethod.d.ts |@ohos.inputMethod.d.ts | +| 输入法服务模块 |@ohos.inputmethodengine.d.ts | @ohos.inputMethodEngine.d.ts | +| 输入法ExtentionAbility模块 | @ohos.inputmethodextensionability.d.ts | @ohos.InputMethodExtensionAbility.d.ts | +| 输入法ExtentionContext模块 |@ohos.inputmethodextensioncontext.d.ts | @ohos.InputMethodExtensionContext.d.ts | +| 输入法子类型模块 | @ohos.inputMethodSubtype.d.ts | @ohos.InputMethodSubtype.d.ts | + + **适配指导** + + 应用中对输入法框架d.ts文件的import后的文件名要写为变更后文件名,即小驼峰/大驼峰命名格式。 + 如: + +```js +import inputMethodEngine from '@ohos.inputMethodEngine'; +``` + + \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md new file mode 100644 index 0000000000000000000000000000000000000000..8b4a3fb8bec467cf18acf76cfbdd8deadb1d9d10 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-mediaLibrary.md @@ -0,0 +1,116 @@ +# 文件子系统ChangeLog + +## cl.file.1 mediaLibrary相关接口变更 + +multimedia 部件 medialibrary 接口废弃原有相关接口,使用 FilePicker 替代。 + +**变更影响** + +基于此前版本开发的应用,需注意废弃接口的迭代更新。替代的 FilePicker 应用是OpenHarmony中预置的系统应用,为用户提供文件选择及保存功能。 + +**关键接口/组件变更** + +medialibrary 相关接口废弃,原接口位于 @ohos.multimedia.medialibrary;替代应用为 FilePicker,位于[@ohos.file.picker](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.file.picker.d.ts) + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------------------------------------------------ | -------- | +| medialibrary | **function** getMediaLibrary(): MediaLibrary; | 废弃 | +| medialibrary | **function** getMediaLibrary(context: Context): MediaLibrary; | 废弃 | +| medialibrary | **function** getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getFileAssets(options: MediaFetchOptions): Promise\ | 废弃 | +| medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void | 废弃 | +| medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void | 废弃 | +| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\ | 废弃 | +| medialibrary | **function** deleteAsset(uri: string): Promise\ | 废弃 | +| medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getPublicDirectory(type: DirectoryType, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** getPublicDirectory(type: DirectoryType): Promise\ | 废弃 | +| medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\\> | 废弃 | +| medialibrary | **function** release(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** release(): Promise\ | 废弃 | +| medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\ | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, index: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** startImagePreview(images: Array\, index?: number): Promise\ | 废弃 | +| medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\\> | 废弃 | +| medialibrary | **function** getActivePeers(): Promise\\>; | 废弃 | +| medialibrary | **function** getActivePeers(callback: AsyncCallback\\>): void; | 废弃 | +| medialibrary | **function** getAllPeers(): Promise\\>; | 废弃 | +| medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isDirectory():Promise\ | 废弃 | +| medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.commitModify(): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.open(mode: string, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.open(mode: string): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.close(fd: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.close(fd: number): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isFavorite():Promise\ | 废弃 | +| medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\ | 废弃 | +| medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FileAsset.isTrash():Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getCount(): number | 废弃 | +| medialibrary | **function** FetchFileResult.isAfterLast(): boolean | 废弃 | +| medialibrary | **function** FetchFileResult.close(): void | 废弃 | +| medialibrary | **function** FetchFileResult.getFirstObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getFirstObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getNextObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getNextObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getLastObject(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getLastObject(): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getPositionObject(index: number, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** FetchFileResult.getPositionObject(index: number): Promise\ | 废弃 | +| medialibrary | **function** FetchFileResult.getAllObject(callback: AsyncCallback\\>): void | 废弃 | +| medialibrary | **function** FetchFileResult.getAllObject(): Promise\\> | 废弃 | +| medialibrary | **function** Album.commitModify(callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** Album.commitModify(): Promise\ | 废弃 | +| medialibrary | **function** Album.getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | 废弃 | +| medialibrary | **function** Album.getFileAssets(options?: MediaFetchOptions): Promise\ | 废弃 | +| medialibrary | **enum** DeviceType | 废弃 | +| medialibrary | **enum** FileKey | 废弃 | +| medialibrary | **enum** DirectoryType | 废弃 | +| medialibrary | **enum** MediaType | 废弃 | +| medialibrary | **interface** PeerInfo | 废弃 | +| medialibrary | **interface** Size | 废弃 | +| medialibrary | **interface** MediaFetchOptions | 废弃 | +| medialibrary | **interface** MediaAssetOption | 废弃 | +| medialibrary | **interface** MediaSelectOption | 废弃 | +| medialibrary | **interface** FileAsset | 废弃 | + +**适配指导** + +以选取一张图片为例,在替代应用中如下方式进行调用: + +```js +import picker from '@ohos.file.picker'; + +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 1; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { + if (PhotoSelectResult !== undefined) { + console.info("PhotoViewPicker.select pass, PhotoSelectResult uri: " + JSON.stringify(PhotoSelectResult)); + } else { + console.error("PhotoViewPicker.select PhotoSelectResult is undefined"); + } + }).catch((err) => { + console.error("PhotoViewPicker.select fail, err: " + err); + }); + } catch (err) { + console.error("PhotoViewPicker fail, err: " + err); + } +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..45249cf9851984f3119e534f732d694eacf1e31f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-multimedia.md @@ -0,0 +1,53 @@ +## cl.multimedia.av_session.001 av_session所有接口更换为系统接口 + +所有av_session的接口变更为SystemApi。 + +**变更影响** + +非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。 + +**关键的接口/组件变更** + +所有接口均变更为SystemApi,接口明细如下: + +| 接口、枚举或变量名 | 类型 | 是否为SystemApi | +| -------- | -------- | ------- | +| SessionToken | interface | 是 | +| AVMetadata | interface | 是 | +| AVPlaybackState | interface | 是 | +| PlaybackPosition | interface | 是 | +| OutputDeviceInfo | interface | 是 | +| AVSessionDescriptor | interface | 是 | +| AVSessionController | interface | 是 | +| AVControlCommand | interface | 是 | +| createAVSession | function | 是 | +| getAllSessionDescriptors | function | 是 | +| createController | function | 是 | +| castAudio | function | 是 | +| on | function | 是 | +| off | function | 是 | +| sendSystemAVKeyEvent | function | 是 | +| sendSystemControlCommand | function | 是 | +| sessionId | variable | 是 | +| setAVMetadata | function | 是 | +| setAVPlaybackState | function | 是 | +| setLaunchAbility | function | 是 | +| getController | function | 是 | +| getOutputDevice | function | 是 | +| activate | function | 是 | +| deactivate | function | 是 | +| destroy | function | 是 | +| getAVPlaybackState | function | 是 | +| getAVMetadata | function | 是 | +| getOutputDevice | function | 是 | +| sendAVKeyEvent | function | 是 | +| getLaunchAbility | function | 是 | +| getRealPlaybackPositionSync | function | 是 | +| isActive | function | 是 | +| getValidCommands | function | 是 | +| sendControlCommand | function | 是 | +| AVSessionType | type | 是 | +| AVControlCommandType | type | 是 | +| LoopMode | enum | 是 | +| PlaybackState | enum | 是 | +| AVSessionErrorCode | enum | 是 | diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md similarity index 97% rename from zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md rename to zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md index 506de8014aa3d4ea26c6a36c63e51eaa133e1499..21caa2f21e1b8f4d93cadb1e1d6dc4947ab5e4a4 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-nfc.md @@ -1,7 +1,5 @@ # 公共通信子系统NFC JS API变更Changelog -OpenHarmony 3.2.10.2(Mr)版本相较于OpenHarmony 3.2.beta4版本,分布式数据管理子系统的API变更如下 - ## cl.nfc.1 接口变更 NFC部分API6到API8部分JS接口不支持抛出错误码,需要删除废弃,然后使用新的API9替换。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..7877ff8ae51a74460187fcd3460070bf12919813 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-notification.md @@ -0,0 +1,48 @@ +# 事件通知子系统ChangeLog + +## cl.notification.1 删除标记为废弃的API9接口 + +[事件通知异常处理整改](../OpenHarmony_3.2.8.3/changelogs-notification.md)将部分API9接口标记为了废弃,根据OpenHarmony接口规范,需要删除标记为废弃的API9接口。 + +**变更影响** + +基于此前版本开发的应用,需要将被删除的接口替换为新接口,否则会影响应用编译。 + +**关键接口/组件变更** + +原接口中标记为废弃的API9接口将被删除,可以使用新接口中的同名接口替换。 + +| 原接口 | 新接口 | +| ----------------------- | -------------------------------- | +| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | +| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | + +接口、属性被删除: + +- @ohos.notification.d.ts + - 接口 publishAsBundle、cancelAsBundle、isNotificationSlotEnabled、setSyncNotificationEnabledWithoutApp、getSyncNotificationEnabledWithoutApp 被删除。可以使用 api/@ohos.notificationManager.d.ts 的同名接口替换。 + - 接口 enableNotificationSlot 被删除。可以使用 api/@ohos.notificationManager.d.ts 的接口 setNotificationEnableSlot 替换。 + - 导出类 NotificationActionButton、NotificationBasicContent、NotificationContent、NotificationLongTextContent、NotificationMultiLineContent、NotificationPictureContent、NotificationFlags、NotificationFlagStatus、NotificationRequest、DistributedOptions、NotificationSlot、NotificationSorting、NotificationTemplate、NotificationUserInput 被删除。可以使用 api/@ohos.notificationManager.d.ts 的同名导出类替换。 + - 导出类 NotificationSubscribeInfo、NotificationSubscriber、SubscribeCallbackData、EnabledNotificationCallbackData 被删除。可以使用 api/@ohos.notificationSubscribe.d.ts 的同名导出类替换。 + +**适配指导** + +如上所述,仅将老接口平移到了新的namespace中,所以可以通过修改import来解决适配问题: + +如原先接口使用了@ohos.commonEvent + +```js +import commonEvent from '@ohos.commonEvent'; +``` + +可以通过直接修改import,来切换到新的namespace上: + +```js +import commonEvent from '@ohos.commonEventManager'; +``` + +@ohos.notification拆分成了两个namespace,需要根据接口情况选择需要的新namespace进行适配。 + +此外还需要适配异常处理,具体参考新接口的接口文档。 + diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md new file mode 100644 index 0000000000000000000000000000000000000000..a509d856204ff61c962b99fef71642eafaab930b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geoLocationManager.md @@ -0,0 +1,107 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @ohos.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@ohos.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'locationServiceState', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'locationServiceState'更改为type: 'locationEnabledChange' | +|geolocation| method | function off(type: 'locationServiceState', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'locationServiceState'更改为type: 'locationEnabledChange' | +|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'cachedGnssLocationsReporting'更改为type: 'cachedGnssLocationsChange' | +|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'cachedGnssLocationsReporting'更改为type: 'cachedGnssLocationsChange' | +|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'gnssStatusChange'更改为type: 'satelliteStatusChange' | +|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'gnssStatusChange'更改为type: 'satelliteStatusChange' | +|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'nmeaMessageChange'更改为type: 'nmeaMessage' | +|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'nmeaMessageChange'更改为type: 'nmeaMessage' | +|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'fenceStatusChange'更改为type: 'gnssFenceStatusChange' | +|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts,type: 'fenceStatusChange'更改为type: 'gnssFenceStatusChange' | +|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function getLastLocation(): Location; | +|geolocation| method | function getLastLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function getLastLocation(): Location; | +|geolocation| method | function isLocationEnabled(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationEnabled(): boolean; | +|geolocation| method | function isLocationEnabled(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationEnabled(): boolean; | +|geolocation| method | function requestEnableLocation(callback: AsyncCallback): void; | 接口删除 | +|geolocation| method | function requestEnableLocation(): Promise; | 接口删除 | +|geolocation| method | function enableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocation(): void; | +|geolocation| method | function disableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocation(): void; | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isGeocoderAvailable(): boolean; | +|geolocation| method | function isGeoServiceAvailable(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isGeocoderAvailable(): boolean; | +|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocationMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableLocationMock(): void; | +|geolocation| method | function enableLocationMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableLocationMock(): void; | +|geolocation| method | function disableLocationMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocationMock(): void; | +|geolocation| method | function disableLocationMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableLocationMock(): void; | +|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setMockedLocations(config: LocationMockConfig): void; | +|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setMockedLocations(config: LocationMockConfig): void; | +|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableReverseGeocodingMock(): void; | +|geolocation| method | function enableReverseGeocodingMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function enableReverseGeocodingMock(): void; | +|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableReverseGeocodingMock(): void; | +|geolocation| method | function disableReverseGeocodingMock(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function disableReverseGeocodingMock(): void; | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setReverseGeocodingMockInfo(mockInfos: Array): void; | +|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setReverseGeocodingMockInfo(mockInfos: Array): void; | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; | +|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; | +|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts,更改为function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; | +|geolocation| interface | SatelliteStatusInfo | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CachedGnssLocationsRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeofenceRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Geofence | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | ReverseGeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoAddress | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | LocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CurrentLocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Location | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestPriority | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestScenario | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | GeoLocationErrorCode | 接口废弃 | +|geolocation| enum | LocationPrivacyType | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationCommand | 接口迁移到@ohos.geoLocationManager.d.ts | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..5d127ca0d13961d29741afdbd713275a3f6c8033 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-ohos-geolocation.md @@ -0,0 +1,92 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @ohos.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@ohos.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@ohos.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|geolocation| namespace | declare namespace geolocation| 迁移到@ohos.geoLocationManager.d.ts,使用namespace geoLocationManager代替 | +|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'locationServiceState', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'locationServiceState', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getLastLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationEnabled(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isLocationEnabled(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function requestEnableLocation(callback: AsyncCallback): void; | 接口删除 | +|geolocation| method | function requestEnableLocation(): Promise; | 接口删除 | +|geolocation| method | function enableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function enableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function disableLocation(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function isGeoServiceAvailable(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function getCachedGnssLocationsSize(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function flushCachedGnssLocations(): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback): void; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| method | function sendCommand(command: LocationCommand): Promise; | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | SatelliteStatusInfo | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CachedGnssLocationsRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeofenceRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Geofence | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | ReverseGeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoCodeRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | GeoAddress | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | LocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | CurrentLocationRequest | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| interface | Location | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestPriority | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationRequestScenario | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | GeoLocationErrorCode | 接口废弃 | +|geolocation| enum | LocationPrivacyType | 接口迁移到@ohos.geoLocationManager.d.ts | +|geolocation| enum | LocationCommand | 接口迁移到@ohos.geoLocationManager.d.ts | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md new file mode 100644 index 0000000000000000000000000000000000000000..6d7bc0e05cd183ff46328bbbbbe8722287961c70 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-request.md @@ -0,0 +1,42 @@ +# 上传下载子系统ChangeLog + + +## cl.request.2 request上传下载接口变更 + +- 删除API9-beta接口: +1. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; +2. function download(context: BaseContext, config: DownloadConfig): Promise; +3. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; +4. function upload(context: BaseContext, config: UploadConfig): Promise; + +**变更影响** + +基于此前版本使用Stage模式开发的应用,需适配变更后的接口,否则会影响原有业务逻辑。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +|--------------|--------------|-------------------------------------------------------------------------------------------------------------------|------| +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; | 删除 | +| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise; | 删除 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; | 删除 | +| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise; | 删除 | + + +**适配指导** + +以download为例,在新版本上需要使用downloadFile, 如下方式进行调用: + +```ts +try { + request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', + filePath: 'xxx/xxxxx.hap'}, (err, data) => { + if (err) { + console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); + return; + } + }); +} catch (err) { + console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); +} +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..a7c431a2365444a6275d3fc3be61f785dcaa4b4f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-resourceschedule.md @@ -0,0 +1,111 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.backgroundTaskManager +对资源调度子系统backgroundTaskManager仓原有接口进行整改,原有@ohos.backgroundTaskManager.d.ts中的API9接口删除,需要使用@ohos.resourceschedule.backgroundTaskManager.d.ts中的API9新接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.10.5及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。@ohos.backgroundTaskManager.d.ts文件中的接口移植到@ohos.resourceschedule.backgroundTaskManager.d.ts文件。 + +| 类名 | 接口类型 | 接口声明 | 说明 | +| -- | -- | -- | -- | +| backgroundTaskManager | method | function resetAllEfficiencyResources(): void; | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager | method | function applyEfficiencyResources(request: EfficiencyResourcesRequest): bool; | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts,修改为function applyEfficiencyResources(request: EfficiencyResourcesRequest): void; | +| backgroundTaskManager.ResourceType | enum | export enum ResourceType | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | CPU = 1 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | COMMON_EVENT = 1 << 1 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | TIMER = 1 << 2 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | WORK_SCHEDULER = 1 << 3 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | BLUETOOTH = 1 << 4 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | GPS = 1 << 5 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.ResourceType | enum | AUDIO = 1 << 6 | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | interface | export interface EfficiencyResourcesRequest | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | reason: string | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isProcess?: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isPersist?: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | timeOut: number | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | isApply: bool | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | +| backgroundTaskManager.EfficiencyResourcesRequest | field | resourceTypes: number | 接口API9删除,移植到ohos.resourceschedule.backgroundTaskManager.d.ts | + + +**适配指导**
+ +导入backgroundTaskManager模块。 +``` +import bundle form '@ohos.resourceschedule.backgroundTaskManager' +``` +此外还需要适配异常处理,具体参考[backgroundTaskManager接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md)。 + +## c2.resourceschedule.workScheduler +对资源调度子系统workScheduler仓原有接口进行整改,原有@ohos.workScheduler.d.ts中的API9接口删除,需要使用@ohos.resourceschedule.workScheduler.d.ts中的API9新接口。新的API9接口符合错误码规范。 + +**变更影响** + +基于OpenHarmony3.2.10.5及之后的SDK版本开发的应用,需适配API9的模块和接口,以及的API异常处理返回方式,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +以下方法、属性、枚举和常量均从API9变更。删除@ohos.workScheduler.d.ts文件,相关接口变更至@ohos.resourceschedule.workScheduler.d.ts文件中。 + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +| workScheduler | namespace | declare namespace workScheduler | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | interface | export interface WorkInfo | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | idleWaitTime?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isDeepIdle?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCount?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isRepeat?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | repeatCycleTime?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | storageRequest?: StorageRequest | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryStatus?: BatteryStatus | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | batteryLevel?: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | chargerType?: ChargingType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isCharging?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | networkType?: NetworkType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | isPersisted?: boolean | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | abilityName: string | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | bundleName: string | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.WorkInfo | field | workId: number | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number): Promise; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopAndClearWorks(): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopAndClearWorks(): boolean; | +| workScheduler | method | function obtainAllWorks(): Promise>; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function obtainAllWorks(callback: AsyncCallback): Array; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number): Promise; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function getWorkStatus(workId: number, callback: AsyncCallback): void; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler | method | function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 接口API8变更,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function stopWork(work: WorkInfo, needCancel?: boolean): void; | +| workScheduler | method | function startWork(work: WorkInfo): boolean; | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts,修改为function startWork(work: WorkInfo): void; | +| workScheduler.NetworkType | enum | export enum NetworkType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ANY = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_MOBILE | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_BLUETOOTH | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI_P2P | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.NetworkType | enum | NETWORK_TYPE_ETHERNET | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | export enum ChargingType | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_ANY = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_AC | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_USB | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.ChargingType | enum | CHARGING_PLUGGED_WIRELESS | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | export enum BatteryStatus | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW_OR_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.StorageRequest | enum | export enum StorageRequest | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW = 0 | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | +| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW_OR_OKAY | 接口API9删除,移植到ohos.resourceschedule.workScheduler.d.ts | + + +**适配指导**
+ +导入workScheduler模块。 +``` +import bundle form '@ohos.resourceschedule.workScheduler' +``` +此外还需要适配异常处理,具体参考[workScheduler接口文档](../../../application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md)。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md new file mode 100644 index 0000000000000000000000000000000000000000..3f3a7acf0bbdee1aa1b640f511c91e3f65d2333e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-security.md @@ -0,0 +1,475 @@ +# security子系统ChangeLog + +## cl.security.1 Random的setSeed功能变更,由异步接口改为同步接口 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +setSeed(seed : DataBlob, callback : AsyncCallback\) : void; +setSeed(seed : DataBlob) : Promise\; +修改后的接口原型: +setSeed(seed : DataBlob) : void; + +**适配指导** +查看API参考中setSeed对应的接口适配指南: +[加解密算法库框架-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md) + + +## cl.security.2 interface DataArray 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface DataArray从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.3 interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface EncodingFormat从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.4 interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface EncodingBlob 从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.5 interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface CertChainData从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.6 interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.7 function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createX509Cert从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.8 interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509CrlEntry从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.9 interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface X509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.10 function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createX509Crl从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.11 interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +interface CertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.12 function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +function createCertChainValidator从@ohos.security.cryptoFramework.d.ts 迁移至@ohos.security.cert.d.ts + +**适配指导** +重新import并使用对应的.d.ts文件: +import cryptoCert from '@ohos.security.cert'; +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.13 X509Cert 的getPublicKey功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getPublicKey(callback : AsyncCallback\) : void; +getPublicKey() : Promise\; +修改后的接口原型: +getPublicKey() : cryptoFramework.PubKey; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.14 X509Cert 的checkValidityWithDate功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +checkValidityWithDate(date: string, callback : AsyncCallback\) : void; +checkValidityWithDate(date: string) : Promise\; +修改后的接口原型: +checkValidityWithDate(date: string) : void; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.15 X509CrlEntry 的getCertIssuer功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getCertIssuer(callback : AsyncCallback\) : void; +getCertIssuer() : Promise\; + +修改后的接口原型: +getCertIssuer() : DataBlob; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.16 X509CrlEntry 的getRevocationDate功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevocationDate(callback : AsyncCallback\) : void; +getRevocationDate() : Promise\; + +修改后的接口原型: +getRevocationDate() : string; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.17 X509Crl 的isRevoked功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +isRevoked(cert : X509Cert, callback : AsyncCallback\) : void; +isRevoked(cert : X509Cert) : Promise\; + +修改后的接口原型: +isRevoked(cert : X509Cert) : boolean; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.18 X509Crl 的getRevokedCert功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevokedCert(serialNumber : number, callback : AsyncCallback\) : void; +getRevokedCert(serialNumber : number) : Promise\; + +修改后的接口原型: +getRevokedCert(serialNumber : number) : X509CrlEntry; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.19 X509Crl 的getRevokedCertWithCert功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\) : void; +getRevokedCertWithCert(cert : X509Cert) : Promise\; + +修改后的接口原型: +getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + + +## cl.security.20 X509Crl 的getTbsInfo功能变更,由异步接口改为同步接口 +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** +修改前的接口原型: +getTbsInfo(callback : AsyncCallback\) : void; +getTbsInfo() : Promise\; + +修改后的接口原型: +getTbsInfo() : DataBlob; + +**适配指导** +查看API参考中对应的接口适配指南: +[证书-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md) + +## cl.security.21 HUKS支持No-Hash的签名模式 + +变更之前,应用传递huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE,HUKS默认使用huks.HuksKeyDigest.HUKS_DIGEST_SHA256进行处理;变更之后,应用传递huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE时,HUKS默认不进行摘要处理,需要业务先对原始数据进行hash操作,再将hash后的摘要传入huks进行签名/验签处理。 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 +应用需要进行适配,才可以使得变更前后的签名/验签结果通过。 + +**关键的接口/组件变更** + +发布的JS接口不变, 传入接口的参数集合发生变更。 + +业务使用No-Hash的签名模式,需要先对原始数据进行hash处理,再将hash后的摘要传入huks签名/验签接口。同时huks.HuksTag.HUKS_TAG_DIGEST参数设置为huks.HuksKeyDigest.HUKS_DIGEST_NONE。 + +**适配指导** + +以签名为例,示例代码如下: + +```js +import huks from '@ohos.security.huks'; + +let keyAlias = 'rsa_Key'; +/* sha256之后的摘要值 */ +let inDataAfterSha256 = new Uint8Array( + 0x4B, 0x1E, 0x22, 0x64, 0xA9, 0x89, 0x60, 0x1D, 0xEC, 0x78, 0xC0, 0x5D, 0xBE, 0x46, 0xAD, 0xCF, + 0x1C, 0x35, 0x16, 0x11, 0x34, 0x01, 0x4E, 0x9B, 0x7C, 0x00, 0x66, 0x0E, 0xCA, 0x09, 0xC0, 0xF3, +); +/* 签名参数 */ +let signProperties = new Array(); +signProperties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_RSA, +} +signProperties[1] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN +} +signProperties[2] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048, +} +signProperties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_NONE, // 设置 digest-none +} +let signOptions = { + properties: signProperties, + inData: inDataAfterSha256 // 设置HASH后的值 +} + +huks.initSession(keyAlias, signOptions); +``` + +更多接口的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)和[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)。 + +## cl.security.22 HUKS支持在密钥使用时指定密钥运算参数 + +变更之前,业务在生成密钥的时候,必须指定密钥运算的全部参数;变更之后,在生成密钥时,只需要包含必选参数即可,在密钥使用阶段再传入其他参数。业务使用会更加灵活。 + +**变更影响** + +影响已发布的JS接口,接口行为发生变更。 + +允许应用在生成密钥阶段传入的参数中包含必选参数即可,在密钥使用阶段再传入其他可选参数。 + +**关键的接口/组件变更** + +发布的JS接口不变, 传入接口的参数集合发生变更,将参数分为必选参数和可选参数,具体可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md),涉及的接口有: + +huks.generateKeyItem + +huks.importKeyItem + +huks.importWrappedKeyItem + +huks.initSession + +huks.updateSession + +huks.finishSession + +**适配指导** + +以生成密钥为例,示例代码如下: + +```js +let keyAlias = 'keyAlias'; +let properties = new Array(); +//必选参数 +properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_RSA +}; +//必选参数 +properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048 +}; +//必选参数 +properties[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY +}; +//可选参数,如果在生成密钥阶段没有传入,则在使用密钥阶段必须传入。 +properties[3] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 +}; +let options = { + properties: properties +}; +try { + huks.generateKeyItem(keyAlias, options, function (error, data) { + if (error) { + console.error(`callback: generateKeyItem failed, code: ${error.code}, msg: ${error.message}`); + } else { + console.info(`callback: generateKeyItem key success`); + } + }); +} catch (error) { + console.error(`callback: generateKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); +} +``` + +更多接口的示例代码可参考[HUKS-guidelines](../../../application-dev/security/huks-guidelines.md)和[HUKS API](../../../application-dev/reference/apis/js-apis-huks.md)。 diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..4494940d23cfa519f2c7b0e3ac7f3c1a3b1cfa8c --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-system-geolocation.md @@ -0,0 +1,50 @@ +# 位置服务子系统ChangeLog + +## cl.location.1 @system.geolocation.d.ts接口迁移到新增的@ohos.geoLocationManager.d.ts + +@system.geolocation.d.ts接口不支持抛出错误码,为了支持错误码功能,把@system.geolocation.d.ts中所有接口,迁移到新增的@ohos.geoLocationManager.d.ts中,并增加错误码描述。 + +后续需要import @ohos.geoLocationManager才能使用位置服务的接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + + +**变更影响** + +对位置服务所有接口的使用有影响,需要import @ohos.geoLocationManager才能使用位置服务接口: + +import geoLocationManager from '@ohos.geoLocationManager'; + +**关键的接口/组件变更** + +| 类名 | 接口类型 | 接口声明 | 变更类型 | +| -- | -- | -- | -- | +|Geolocation| class | Geolocation | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager代替 | +|Geolocation| interface | static getLocation(options?: GetLocationOption): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.getCurrentLocation代替 | +|Geolocation| interface | static getLocationType(options?: GetLocationTypeOption): void; | 接口废弃 | +|Geolocation| interface | static subscribe(options: SubscribeLocationOption): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.on#event:locationChange代替 | +|Geolocation| interface | static unsubscribe(): void; | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.off#event:locationChange代替 | +|Geolocation| interface | static getSupportedCoordTypes(): Array; | 接口废弃 | +|| interface | GeolocationResponse| 迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.Location代替 | +|| interface | GetLocationOption | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest代替 | +|| interface | GetLocationTypeResponse | 接口废弃 | +|| interface | GetLocationTypeOption | 接口废弃 | +|| interface | SubscribeLocationOption | 接口迁移到@ohos.geoLocationManager.d.ts,使用ohos.geoLocationManager/geoLocationManager.LocationRequest代替 | + + +**适配指导(可选,不涉及则可以删除)** + +以enableLocation为例,在新版本上需要使用如下方式进行调用: + + ```ts + import geoLocationManager from '@ohos.geoLocationManager'; + try { + geoLocationManager.enableLocation((err, data) => { + if (err) { + console.log('enableLocation: err=' + JSON.stringify(err)); + } + }); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..9096ff88cbc71e971fa3bd2d631684a161c175e2 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-telephony.md @@ -0,0 +1,59 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 radio模块接口变更 + + +### 电话子系统radio模块 `isNrSupported` 接口存在变更: + +NR是专有名词,需要全部大写。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + isNrSupported(): boolean; + isNrSupported(slotId: number): boolean; + +- 变更前: + +```js +function isNrSupported(): boolean; +function isNrSupported(slotId: number): boolean; +``` + +- 变更后: + +```js +function isNRSupported(): boolean; +function isNRSupported(slotId: number): boolean; +``` + + + +**适配指导** + +使用变更后的接口,示例代码如下: + +```js +let result = radio.isNrSupported(); +console.log("Result: "+ result); +``` + + +```js +let slotId = 0; +let result = radio.isNRSupported(slotId); +console.log("Result: "+ result); +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md new file mode 100644 index 0000000000000000000000000000000000000000..1f6aa755b94e4acbcec7900011f563478e1793fc --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-time.md @@ -0,0 +1,336 @@ +# 时间时区子系统ChangeLog + +## cl.time.1 接口异常抛出变更 + +时间时区子系统定时器接口异常抛出:202非系统应用异常和401参数无效异常。 + +**变更影响** + +该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的异常处理,原有功能不受影响。 + +**关键接口/组件变更** + +变更前: + - 接口异常抛出message,无错误码。 + +变更后: + - 接口异常抛出message和code,包括202非系统应用异常和401参数无效异常。 + + | 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | + | ----------------- | ----------- | ------------------------------------------------------------ | -------- | + | @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise | 变更 | + | @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback): void | 变更 | + | @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise | 变更 | + + +**适配指导** + +应用中调用systemTimer所有接口可参考下列代码进行异常捕获 + +createTimer callback形式调用: + +**示例:** + +```js +export default { + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options, (error, timerId) => { + if (error) { + //捕获权限否定异常 + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + } + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }); + } catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +createTimer promise形式调用: + +**示例:** + +```js +export default { + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options).then((timerId) => { + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +startTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +startTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in startting timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +stopTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } +}git +``` + +stopTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in stop timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +destroyTimer callback形式调用: + +**示例:** + +```js +export default { + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, triggerTime, (error) => { + if (error) { + //捕获权限否定异常 + console.error(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + } + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +destroyTimer promise形式调用: + +**示例:** + +```js +export default { + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, triggerTime).then((data) => { + console.log(`Succeeded in destroy timer. Data:` + data); + }).catch((error) => { + //捕获权限否定异常 + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + }); + } catch (e) { + //捕获参数校验失败异常 + console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`); + } + } +} +``` + +## cl.time.2 接口异常抛出变更 + +时间时区子系统时间相关接口异常抛出:201权限否定异常、202非系统应用异常和401参数无效异常。 + +**变更影响** + +基于此前版本开发的应用,继续使用无影响,使用新接口需要捕获并处理抛出的新异常。 + +**关键接口/组件变更** + +变更前: + - 接口异常抛出message,错误码-1。 + +变更后: + - 接口异常抛出message和code,包括201权限否定异常、202非系统应用异常和401参数无效异常。 + +原接口中标记为废弃的接口,可以使用新接口中的同名接口替换 + +| 原接口 | 新接口 | +| ---------------- | -------------------- | +| @ohos.systemTime | @ohos.systemDateTime | + +**适配指导** + +应用中调用systemTime所有接口可参考下列代码进行异常捕获,以setTime接口为例,其他接口适配方法相同。 + +callback形式调用: + +**示例:** + +```js +import systemDateTime from @ohos.systemDateTime +// time对应的时间为2021-01-20 02:36:25 +let time = 1611081385000; +try { + systemDateTime.setTime(time, (error) => { + //捕获权限否定异常和非系统应用异常 + if (error) { + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting time.`); + }) +} catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); +} +``` + +promise形式调用: + +**示例:** + +```js +import systemDateTime from @ohos.systemDateTime +// time对应的时间为2021-01-20 02:36:25 +let time = 1611081385000; +try { + systemDateTime.setTime(time).then(() => { + console.info(`Succeeded in setting time.`); + }).catch((error) => { + //捕获权限否定异常和非系统应用异常 + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + }); +} catch(e) { + //捕获参数校验失败异常 + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); +} +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md new file mode 100644 index 0000000000000000000000000000000000000000..34da098e0a10b2e03811bbc534e8599c759bac6f --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-url.md @@ -0,0 +1,68 @@ +# 公共基础类库子系统JS API变更Changelog + +## cl.commonlibrary.1.URLParams类接口变更 +公共基础类库子系统url模块URLParams类构造函数存在变更: + +constructor(init?: string[][] | Record | string | URLSearchParams) 改为 constructor(init?: string[][] | Record | string | URLParams);参数类型为原来的URLSearchParams类改为URLParams类。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLSearchParams) | 删除 | +| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLParams)| 变更 + +**适配指导** + +应用中创建URLParams对象实例可参考下列代码 + +示例: + +```ts +import url from '@ohos.url' +try { + let params1 = new Url.URLParams('?user=abc&query=xyz') + let params2 = new Url.URLParams(params1) + var result= params2.toString() + console.log(result) //"user=abc&query=xyz" +} catch (err) { + console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`); +} +``` +## cl.commonlibrary.2.URL类属性变更url子系统URLParams类构造函数存在变更: +公共基础类库子系统url模块URL类属性存在变更: + +废弃searchParams: URLSearchParams属性,新增params: URLParams属性 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.url | URL | searchParams: URLSearchParams; |废弃版本:9
| +| @ohos.url | URL | params: URLParams; | 新增 | + +**适配指导** + +应用中创建URLParams对象实例可参考下列代码 + +示例: + +```ts +import url from '@ohos.url' +let that = new Url.URL('http://username:password@host:8080/directory/file?你好=china#qwer=da') +let params = that.URLParams +var result = params.toString() +console.log(result) //%E4%BD%A0%E5%A5%BD=china +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..0444bab5234087b1f865eda378e680c95fc1abb4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-useriam.md @@ -0,0 +1,17 @@ +# 用户IAM子系统Changelog + +## cl.useriam.1 API9返回值命名变更 + +用户IAM API9的返回值枚举类类名发生变更,从 ResultCodeV9 更名为 UserAuthResultCode + +**变更影响** + +基于此版本以前开发的应用不受影响,以后的需适配错误码的类名,否则会影响业务逻辑。 + +**关键接口/组件变更** + +无接口/组件变更 + +**适配指导** + +需要修改返回值调用类名从 ResultCodeV9 改为 UserAuthResultCode \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md new file mode 100644 index 0000000000000000000000000000000000000000..697060fe9cf6a50e0958bc566bd495e9220fa1c4 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-beta5/changelogs-window.md @@ -0,0 +1,63 @@ +# 窗口子系统ChangeLog + +## cl.window.1 WindowStage生命周期监听类型名称变更 + +WindowStage生命周期的监听类型枚举定义自3.2.10.5版本起进行了变更。 + +**变更影响** + +3.2.10.5版本之前使用FOREGROUND/BACKGROUND类型开发的应用生命周期监听,在3.2.10.5版本之后失效。 + +**关键接口/组件变更** + +## WindowStageEventType9+ + +变更前: + +| 名称 | 值 | 说明 | +| ---------- | ---- | ---------- | +| FOREGROUND | 1 | 切到前台。 | +| BACKGROUND | 4 | 切到后台。 | + +变更后: +| 名称 | 值 | 说明 | +| ------ | ---- | ---------- | +| SHOWN | 1 | 切到前台。 | +| HIDDEN | 4 | 切到后台。 | + +**适配指导** + +在注册生命周期监听回调时,将前后台事件类型改为SHOWN/HIDDEN: + +``` +import Ability from '@ohos.application.Ability'; + +class myAbility extends Ability { + onWindowStageCreate(windowStage) { + console.log('onWindowStageCreate'); + try { + windowStage.on('windowStageEvent', (stageEventType) => { + switch (stageEventType) { + case window.WindowStageEventType.SHOWN: + console.log("windowStage shown"); + break; + case window.WindowStageEventType.ACTIVE: + console.log("windowStage active"); + break; + case window.WindowStageEventType.INACTIVE: + console.log("windowStage inActive"); + break; + case window.WindowStageEventType.HIDDEN: + console.log("windowStage hidden"); + break; + default: + break; + } + } ) + } catch (exception) { + console.error('Failed to enable the listener for window stage event changes. Cause:' + + JSON.stringify(exception)); + }; + } +}; +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-release/Readme.md b/zh-cn/release-notes/changelogs/v3.2-release/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..90bbd7a5fbf68123d02056315d5de25b313202e7 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/Readme.md @@ -0,0 +1,12 @@ +# Readme + +- [元能力](changelogs-ability.md) +- [ArkUI](changelogs-arkui.md) +- [包管理](changelogs-bundlemanager.md) +- [输入法框架](changelogs-imf.md) +- [全局资源调度](changelogs-resourceschedule.md) +- [主题框架-锁屏](changelogs-screenlock.md) +- [电话服务](changelogs-telephony.md) +- [util](changelogs-util.md) +- [主题框架-壁纸](changelogs-wallpaper.md) +- [web组件](changelogs-web.md) diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..b5289610acebcfd24695f527efc2ae51f2198da1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-ability.md @@ -0,0 +1,291 @@ +# 元能力子系统JS API变更Changelog + +## cl.ability.1 AreaMode接口变更 +AreaMode接口有多个重复,删除掉重复的AreaMode。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.common.d.ts | common.AreaMode | | 删除 | +| application/Context.d.ts | AreaMode | | 删除 | + + +**适配指导** + +使用@ohos.app.ability.contextConstant.d.ts中的AreaMode + +```ts +import contextConstant from '@ohos.app.ability.contextConstant'; +let area: contextConstant.AreaMode = contextConstant.AreaMode.EL1; +``` + + + +## cl.ability.2 killProcessesBySelf接口变更 + +killProcessesBySelf接口命名不合理,修改为killAllProcesses。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------------ | ------------------ | ----------------------------------------------------- | -------- | +| application/ApplicationContext | ApplicationContext | killProcessesBySelf(): Promise\; | 删除 | +| application/ApplicationContext | ApplicationContext | killProcessesBySelf(callback: AsyncCallback\); | 删除 | +| application/ApplicationContext | ApplicationContext | killAllProcesses(): Promise\; | 新增 | +| application/ApplicationContext | ApplicationContext | killAllProcesses(callback: AsyncCallback\); | 新增 | + + +**适配指导** + +应用中调用killProcessesBySelf可参考下列代码 + +变更前代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.killProcessesBySelf() +``` + +变更后代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.killAllProcesses() +``` + + + +## cl.ability.3 getProcessRunningInformation接口变更 + +getProcessRunningInformation接口命名不合理,修改为getRunningProcessInformation。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------- | ------------------ | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(): Promise\\>; | 删除 | +| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(callback: AsyncCallback\\>): void; | 删除 | +| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(): Promise\\>; | 新增 | +| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(callback: AsyncCallback\\>): void; | 新增 | +| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(): Promise\\>; | 删除 | +| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(callback: AsyncCallback\\>): void; | 删除 | +| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(): Promise\\>; | 新增 | +| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(callback: AsyncCallback\\>): void; | 新增 | + +**适配指导** + +应用中调用getProcessRunningInformation可参考下列代码 + +变更前代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.getProcessRunningInformation() +``` + +变更后代码: + +```ts +let context: common.UIAbilityContext = globalThis.abilityContext; +let appContext = context.getApplicationContext(); +appContext.getRunningProcessInformation() +``` + + + +## cl.ability.4 WantConstant.Flags接口变更 +WantConstant.Flags接口有多个无效Flag定义,删除掉无效的Flag。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORWARD_RESULT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_NOT_OHOS_COMPONENT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORM_ENABLED | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PREFIX_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITYSLICE_MULTI_DEVICE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_START_FOREGROUND_ABILITY | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_INSTALL_WITH_BACKGROUND_MODE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CLEAR_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_NEW_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_MISSION_TOP | 删除 | + + + +## cl.ability.5 WantConstant.Action接口变更 +WantConstant.Action接口有多个无效Action定义,删除掉无效的Action。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_APP_ACCOUNT_AUTH | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_DOWNLOAD | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_CROWDTEST | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_SANDBOX | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_BUNDLE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_MODULE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_ABILITY_NAME | 删除 | + + + +## cl.ability.6 Caller相关接口变更 +Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用RPC在API9提供的Parcelable和MessageSequence对象替代。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | 变更,修改为 (indata: rpc.MessageSequence): rpc.Parcelable; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise; | 变更,修改为 call(method: string, data: rpc.Parcelable): Promise; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise; | 变更,修改为 callWithResult(method: string, data: rpc.Parcelable): Promise; | + +**适配指导** + +应用中调用Caller相关接口可参考下列代码 + +变更前代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readSequenceable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); + } + } + } +``` + +变更后代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readParcelable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + 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/v3.2-release/changelogs-arkui.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..23d453b41ef6811d484f1c62796676f6a2f1013b --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-arkui.md @@ -0,0 +1,306 @@ +# arkui子系统ChangeLog + +## cl.arkui.1 getInspectorTree接口返回值从string修改为Object。 + +**变更影响** + +3.2.10.7之前使用getInspectorTree接口的代码需要适配 + +**关键的接口/组件变更** + +getInspectorTree接口返回值从string修改为Object + +**适配指导** + +将getInspectorTree返回值作为string使用的代码需要修改,比如以下示例代码: + +```typescript +console.info(getInspectorTree()) +``` + +需要修改成 + +```typescript +console.info(JSON.stringify(getInspectorTree())) +``` + +## cl.arkui.2 废弃GridItem的forceRebuild属性 + +**变更影响** + +无,该属性无作用 + +**关键的接口/组件变更** + +GridItem的forceRebuild属性废弃 + +**适配指导** + +如有使用可以直接删除,不影响GridItem功能 + +## cl.arkui.3 Plugin模块接口变更 + + +### 1. arkui子系统Plugin模块 `PluginComponentTemplate` 接口存在变更: + +ability命名无法准确表达对应参数的语义,修改为bundleName。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更接口,变更前的接口已经不能正常使用,会在编译过程中报错。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + interface PluginComponentTemplate { + source: string; + bundleName: string; + } + + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; +} + +- 变更前: + +```js + interface PluginComponentTemplate { source: string; ability: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +- 变更后: + +```js + interface PluginComponentTemplate { source: string; bundleName: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +**适配指导** + +使用变更后的接口,示例代码如下: + +- 变更前: +```js +PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +- 变更后: +```js +PluginComponent({ + template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +### 2. arkui子系统Plugin模块 `pluginComponentManager` 接口存在变更: + +want命名无法准确表达对应参数的语义,修改为target。 + +开发者需要根据以下说明对应用进行适配。 + + + +**变更影响** + +基于此前版本开发的应用,需适配变更接口。变更前的接口会出现告警,虽然可以通过编译,但是已经不能正常使用其功能。 + + + +**关键的接口/组件变更** + +- 涉及接口 + + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; + +- 变更前: + +```js + interface PushParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +- 变更后: + +```js + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +**适配指导** + +使用变更后的接口,示例代码如下: + +- 变更前: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` + +- 变更后: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md new file mode 100644 index 0000000000000000000000000000000000000000..f175165703f3b7929833790238251b5d0b6fa901 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md @@ -0,0 +1,298 @@ +# 包管理子系统ChangeLog + +## cl.bundlemanager.1 包管理删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口,可以使用@ohos.resourceManager.d.ts中的getMediaContent替换。 + +包管理删除[@ohos.bundle.bundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)中的getAbilityIcon接口,可以使用[@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts)中的getMediaContent替换。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了getAbilityIcon接口的,需要改为使用getMediaContent接口。 + +**关键的接口/组件变更**
+删除@ohos.bundle.bundleManager.d.ts中的getAbilityIcon接口。 + +**适配指导**
+使用@ohos.bundle.bundleManager.d.ts下面的getAbilityIcon,需要修改为@ohos.resourceManager.d.ts中的getMediaContent。需要提前获取到图标的资源ID值,可参考该接口的[使用指导](../../../application-dev/reference/apis/js-apis-resource-manager.md#getmediacontent9)。 + +## cl.bundlemanager.2 包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。 + +仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。包管理在解析HAP时,仅支持解析资源HAP(包名为:ohos.global.systemres)的配置文件中的definePermissions字段,该字段用来定义权限。其它HAP中配置的definePermissions字段将不会解析。 +如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)。 + + +**变更影响**
+升级新版本镜像后,应用自定义的权限将不会生效,使用方在申请该权限时,会授权失败。 + +**关键的接口/组件变更**
+包管理底层能力变更,仅支持系统资源HAP自定义权限,其它HAP均不支持自定义权限。 + +**适配指导**
+如果有应用需要自定义权限,可以在资源HAP的[配置文件](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json)中definePermissions字段下面新增定义权限。格式可参考[定义权限](../../../application-dev/quick-start/module-structure.md#definepermissions对象内部结构)。 + +## cl.bundlemanager.3 包管理二级模块文件名称变更,修改为文件内对应的接口名称 + +包管理二级模块文件名称变更,修改为文件内对应的接口名称,变更文件如下: + +| 原文件名称 |变更后文件名称 | +|----|----| +| bundleManager/abilityInfo.d.ts | bundleManager/AbilityInfo.d.ts | +| bundleManager/applicationInfo.d.ts | bundleManager/ApplicationInfo.d.ts | +| bundleManager/bundleInfo.d.ts | bundleManager/BundleInfo.d.ts | +| bundleManager/dispatchInfo.d.ts | bundleManager/DispatchInfo.d.ts | +| bundleManager/elementName.d.ts | bundleManager/ElementName.d.ts | +| bundleManager/extensionAbilityInfo.d.ts | bundleManager/ExtensionAbilityInfo.d.ts | +| bundleManager/hapModuleInfo.d.ts | bundleManager/HapModuleInfo.d.ts | +| bundleManager/launcherAbilityInfo.d.ts | bundleManager/LauncherAbilityInfo.d.ts | +| bundleManager/metadata.d.ts | bundleManager/Metadata.d.ts | +| bundleManager/packInfo.d.ts | bundleManager/BundlePackInfo.d.ts | +| bundleManager/permissionDef.d.ts | bundleManager/PermissionDef.d.ts | +| bundleManager/remoteAbilityInfo.d.ts | bundleManager/RemoteAbilityInfo.d.ts | +| bundleManager/shortcutInfo.d.ts | bundleManager/ShortcutInfo.d.ts | + +除了免安装相关的BundlePackInfo文件名称增加了Bundle,其余文件名称均是修改为大写开头。 + +**变更影响**
+仅修改二级模块文件名称,不会影响一级模块的使用。在使用之前已发布的API 9各beta版本时,如果在ts文件中直接导入了bundleManager下面二级模块接口的,IDE中编译报错的话,需要修改导入的文件名称。 + +**关键的接口/组件变更**
+变更bundleManager文件夹下面的d.ts名称,修改为文件中的接口名称。 + +**适配指导**
+使用新的sdk后,正常情况下应用无需适配该变更。如果在应用中直接导入了bundleManager文件夹下面的文件,则需要修改导入的文件名称。可以按照如下的修改方式: + +**修改前:** +```ts +import {AbilityInfo} from 'bundleManger/abilityInfo'; +import {ExtensionAbilityInfo} from 'bundleManger/extensionAbilityInfo'; +import {BundlePackInfo} from 'bundleManger/packInfo'; +``` +**修改后:** +```ts +import {AbilityInfo} from 'bundleManger/AbilityInfo'; +import {ExtensionAbilityInfo} from 'bundleManger/ExtensionAbilityInfo'; +import {BundlePackInfo} from 'bundleManger/BundlePackInfo'; +``` + +## cl.bundlemanager.4 包管理LaunchType枚举类型名称变更,由STANDARD修改为MULTITON,枚举值不变。 + +包管理[LaunchType](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts)枚举类型变更,由STANDARD修改为MULTITON,枚举值不变,表示多实例类型。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了LaunchType.STANDARD的,需要改为使用LaunchType.MULTITON接口。 + +**关键的接口/组件变更**
+LaunchType枚举类型名称变更,由LaunchType.STANDARD修改为LaunchType.MULTITON。 + +**适配指导**
+由LaunchType.STANDARD修改为LaunchType.MULTITON。 + +## cl.bundlemanager.5 包管理AbilityInfo结构体中isVisible字段修改为exported,类型不变。 + +包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。 + +**适配指导**
+由isVisible修改为exported。 + +## cl.bundlemanager.6 包管理ExtensionAbilityInfo结构体中isVisible字段修改为exported,类型不变。 + +包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了isVisible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts)结构体中isVisible字段修改为exported,类型不变。 + +**适配指导**
+由isVisible修改为exported。 + +## cl.bundlemanager.7 包管理ModuleAbilityInfo结构体中visible字段修改为exported,类型不变。 + +包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变,表示当前ability是否支持导出,被其他的ability使用。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了visible的,需要改为使用exported。 + +**关键的接口/组件变更**
+包管理[ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts)结构体中visible字段修改为exported,类型不变。 + +**适配指导**
+由visible修改为exported。 + +## cl.bundlemanager.8 app.json配置文件删除distributedNotificationEnabled标签 +删除配置文件app.json中[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.9 app.json配置文件删除entityType标签 +删除配置文件app.json中[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[entityType](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.10 app.json配置文件删除keepAlive标签 +删除配置文件app.json中[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[keepAlive](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.11 app.json配置文件删除removable标签 +删除配置文件app.json中[removable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[removable](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[removable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.12 app.json配置文件删除singleton标签 +删除配置文件app.json中[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[singleton](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.13 app.json配置文件删除userDataClearable标签 +删除配置文件app.json中[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +**变更影响**
+删除配置文件app.json中[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除[userDataClearable](../../../application-dev/quick-start/app-configuration-file.md)标签 + +## cl.bundlemanager.14 module.json配置文件中module的name标签不再支持配置中文 +module.json配置文件中的module的[name](../../../application-dev/quick-start/module-configuration-file.md)不再支持配置中文 + +**变更影响**
+删除配置文件module.json中module的[name](../../../application-dev/quick-start/module-configuration-file.md)标签不再支持配置中文,IDE中配置该标签为中文,会导致IDE编译报错 + +**适配指导**
+使用英文语言配置module.json中module的[name](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.15 module.json配置文件中ability的name标签不再支持配置中文 +module.json配置文件中的ability的[name](../../../application-dev/quick-start/module-configuration-file.md)不再支持配置中文 + +**变更影响**
+删除配置文件module.json中ability的[name](../../../application-dev/quick-start/module-configuration-file.md)标签不再支持配置中文,IDE中配置该标签为中文,会导致IDE编译报错 + +**适配指导**
+使用英文语言配置module.json中ability的[name](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.16 module.json配置文件删除uiSyntax标签 +删除配置文件module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签 + +**变更影响**
+删除配置文件module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[uiSyntax](../../../application-dev/quick-start/module-configuration-file.md)标签 + +## cl.bundlemanager.17 module.json配置文件中module及ability中的srcEntrance标签修改为srcEntry +配置文件module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签修改为srcEntry + +**变更影响**
+删除配置文件module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[srcEntrance](../../../application-dev/quick-start/module-configuration-file.md)标签,使用srcEntry替代 + +## cl.bundlemanager.18 删除module.json配置文件中distroFilter的apiVersion标签 +删除配置文件module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签 + +**变更影响**
+删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)的apiVersion标签 + +## cl.bundlemanager.19 module.json配置文件中distroFilter修改为distributionFilter +配置文件module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签修改为distributionFilter + +**变更影响**
+删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,使用distributionFilter替代 + +## cl.bundlemanager.20 module.json配置文件中launchTypede标签standard模式修改为multiton +删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式修改为multiton + +**适配指导**
+删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式,使用multiton替代 + +## cl.bundlemanager.21 app.json配置文件删除atomicService标签 +删除配置文件app.json中atomicService标签 + +**变更影响**
+删除配置文件app.json中atomicService标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**
+删除atomicService标签 + +## cl.bundlemanager.22 app.json配置文件新增bundleType标签 +配置文件app.json中新增bundleType标签 + +**变更影响**
+现存的元服务([installationFree](../../../application-dev/quick-start/module-configuration-file.md)为true),必须在app.json中指定bundleType为atomicService,否则打包失败。 + +**适配指导**
+新增[bundleType](../../../application-dev/quick-start/app-configuration-file.md)标签。该标签为可缺省(缺省值为app)。该标签需要和module.json中[installationFree](../../../application-dev/quick-start/module-configuration-file.md)字段保持一一对应,其相应规则为: +- 当bundleType为app时,installationFree必须为false。 +- 当bundleType为atomicService时,installationFree必须为true。 + +## cl.bundlemanager.23 包管理ApplicationInfo结构体中删除split字段。 + +包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了split的,会编译失败。 + +**关键的接口/组件变更**
+包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**适配指导**
+删除ApplicationInfo结构体中的split字段。目前元服务中stage模型强制分包,不支持不分包。 + +## cl.bundlemanager.24 包管理HapModuleInfo结构体中删除atomicServiceModuleType字段。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**
+包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**
+删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 + +## cl.bundlemanager.25 包管理删除AtomicServiceModuleType枚举值。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**
+使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**
+包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**
+删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md new file mode 100644 index 0000000000000000000000000000000000000000..a6cdab6b8d7e7fc6a97698ce9b2e2a84ba32076a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-imf.md @@ -0,0 +1,21 @@ +# 输入法框架子系统-输入法框架服务ChangeLog + + +## @ohos.InputMethodSubtype 中输入法子类型中name、label、id属性值变更 +从API9开始,变更如上三个属性值 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +此三个属性的取值发生变化,需要开发者进行适配更新 + +| 名称 | 变更前 | 变更后 | +| -------- | -------- | -------- | +| label | (1)取值:输入法子类型的id。| (1)取值:输入法子类型的标签。| +| name | (1)说明:输入法子类型的名字;(2)取值:输入法子类型的标签。| (1)说明:输入法应用的包名;(2)取值:输入法应用的包名。| +| id | (1)取值:输入法应用的包名。| (1)取值:输入法子类型的id。| + +**适配指导** + +请按上述取值变更结果适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..8042bb2241aa42c2c43aedc691c8b1113e93bf8a --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md @@ -0,0 +1,21 @@ +# 资源调度子系统ChangeLog + +## cl.resourceschedule.workScheduler +修改parameters属性值的数据类型,不允许使用any类型,支持number、string、boolean三种类型。 + +**变更影响** + +基于OpenHarmony3.2.10.7及之后的SDK版本开发的应用,parameters属性值的数据类型不允许使用any类型,仅支持number、string、boolean三种类型,否则将编译报错。 + +**关键接口/组件变更** + +@ohos.resourceschedule.workScheduler.d.ts中的parameters属性变更。 + +| 类名 | 接口类型 | 变更前声明 | 变更后声明 | +| -- | -- | -- | -- | +| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | parameters?: {[key: string]: number | string | boolean} | + + +**适配指导**
+ +parameters属性使用{[key: string]: number | string | boolean}数据类型。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..8e5a2fab3671eb32db8accb72d764a1194f26ff1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-screenlock.md @@ -0,0 +1,155 @@ +# 主题框架子系统-锁屏管理服务ChangeLog + + +## cl.screenlock.1 isLocked、unlock接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback): void; + function unlock():Promise; +``` + +- 变更前: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock():Promise; +``` + +- 变更后: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock():Promise; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let ret = screenLock.isLocked(); + console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`); + } catch (error) { + console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`); + } +``` + +```js + screenlock.unlock((err, data) => { + if (err) { + console.error(`Failed to unlock the screen, because: ${err.message}`); + return; + } + console.info(`unlock the screen successfully. result: ${data}`); + }); +``` + +```js + screenlock.unlock().then((data) => { + console.info(`unlock the screen successfully. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, because: ${err.message}`); + }); +``` + + +## cl.screenlock.2 isSecure接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function isSecure(): boolean; +``` + +- 变更前: + +```js + function isSecure(): boolean; +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..cd74291d37afa9e4aee941a0e813824ede5af546 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-telephony.md @@ -0,0 +1,223 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 call模块reject接口变更 +从API9开始,废弃此接口,改为使用rejectCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口rejectCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId?: number, options?: RejectMessageOptions): Promise; + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function rejectCall(callId: number, callback: AsyncCallback): void; + function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function rejectCall(callId?: number, options?: RejectMessageOptions): Promise; + function rejectCall(callback: AsyncCallback): void; + function rejectCall(options: RejectMessageOptions, callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口rejectCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.rejectCall("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.rejectCall(1, rejectMessageOptions); +promise.then(data => { + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.rejectCall(1, rejectMessageOptions); +promise.then(data => { + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.rejectCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.rejectCall(rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## cl.telephony.2 call模块answer接口变更 +从API9开始,废弃此接口,改为使answerCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口answerCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId?: number): Promise; + function answer(callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function answerCall(callId: number, callback: AsyncCallback): void; + function answerCall(callId?: number): Promise; + function answerCall(callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口answerCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.answerCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let promise = call.answerCall(1); +promise.then(data => { + console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.answerCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## cl.telephony.1 call模块hangup接口变更 +从API9开始,废弃此接口,改为使用hangUpCall接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用新增的接口hangUpCall替换,否则会影响原有功能。 + +- 涉及接口 + +```js + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- 变更前: + +```js + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId?: number): Promise; + function hangup(callback: AsyncCallback): void; +``` + +- 变更后: + +```js + function hangUpCall(callId: number, callback: AsyncCallback): void; + function hangUpCall(callId?: number): Promise; + function hangUpCall(callback: AsyncCallback): void; +``` + + +**适配指导** + +该接口删除无法再使用,请使用新增的接口hangUpCall替换。 +使用变更后的接口,示例代码如下: + +```js +call.hangUpCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +```js +let promise = call.hangUpCall(1); +promise.then(data => { + console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + + +```js +call.hangUpCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md new file mode 100644 index 0000000000000000000000000000000000000000..3455ff99e6f1a2e885acd1865b59f166d99a8c3e --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-util.md @@ -0,0 +1,99 @@ +# util系统JS API变更Changelog + +OpenHarmony 3.2.10.7(Mr)版本相较于OpenHarmony 3.2.beta4版本,util子系统的API变更如下 + +## cl.util.1.randomUUID接口名变更 +util子系统randomUUID函数名存在变更: + +function randomUUID(entropyCache?: boolean): string 改为 function generateRandomUUID(entropyCache?: boolean): string 函数名由原来的randomUUID改为generateRandomUUID。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| :---------- | ------------------- | ------- | +| @ohos.util | function randomUUID(entropyCache?: boolean): string | 删除 | +| @ohos.util | function generateRandomUUID(entropyCache?: boolean): string| 变更 | + +**适配指导** + +应用中使用generateRandomUUID可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let uuid = util.generateRandomUUID(true); +console.log("RFC 4122 Version 4 UUID:" + uuid); +// 输出: +// RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045 +``` + +## cl.util.2.randomBinaryUUID接口名变更 +util子系统randomBinaryUUID函数名存在变更: + +function randomBinaryUUID(entropyCache?: boolean): Uint8Array 改为 function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array 函数名由原来的randomBinaryUUID改为generateRandomBinaryUUID。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| :---------- | ------------------- | ------- | +| @ohos.util | function randomBinaryUUID(entropyCache?: boolean): Uint8Array; | 删除 | +| @ohos.util | function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array| 变更 | + +**适配指导** + +应用中使用generateRandomBinaryUUID可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let uuid = util.generateRandomBinaryUUID(true); +console.log(JSON.stringify(uuid)); +// 输出: +// 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150 +``` + +## cl.util.3.LRUCache类contains接口参数类型变更 +util子系统LRUCache类contains接口参数类型变更: + +contains(key: object): boolean 改为 contains(key: K): boolean 参数类型由原来的object改为K。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| :-------- | ---------| -------------------------------- | -------- | +| @ohos.util | LRUCache | contains(key: object): boolean | 删除 | +| @ohos.util | LRUCache | contains(key: K): boolean | 变更 | + +**适配指导** + +应用中使用contains函数可参考下列代码 + +示例: + +```ts +import util from '@ohos.util' +let pro = new util.LRUCache(); +pro.put(2,10); +let obj = {1:"key"}; +let result = pro.contains(obj); +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..13baab45851959398ccf4689543f91c5e1aa1d68 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-wallpaper.md @@ -0,0 +1,304 @@ +# 主题框架子系统-壁纸管理服务ChangeLog + + +## cl.wallpaper.1 getColorsSync、getMinHeightSync、getMinWidthSync、restore、setImage接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function getColorsSync(wallpaperType: WallpaperType): Array; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + function restore(wallpaperType: WallpaperType): Promise; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- 变更前: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- 变更后: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); + console.log(`success to getColorsSync: ${JSON.stringify(colors)}`); + } catch (error) { + console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`); + } +``` + +```js + let minHeight = wallpaper.getMinHeightSync(); +``` + +```js + let minWidth = wallpaper.getMinWidthSync(); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to restore.`); + }); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to restore.`); + }).catch((error) => { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to setImage.`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to setImage.`); + }).catch((error) => { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + }); +``` + + +## cl.wallpaper.2 getIdSync、getFileSync、isChangeAllowed、isUserChangeAllowed、on、off、RgbaColor接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更前: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md new file mode 100644 index 0000000000000000000000000000000000000000..1fd92a86421021c0ac26639f04c56c4e5c0f01f6 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-release/changelogs-web.md @@ -0,0 +1,467 @@ +# web子系统ChangeLog + +OpenHarmony 3.2.10.7 版本相较于OpenHarmony 之前的版本,web的API变更如下。 + +## cl.web.1 HitTestTypeV9命名变更 + +枚举类HitTestTypeV9由于命名规范问题,名称变更为WebHitTestType。 + +**变更影响** + +枚举类HitTestTypeV9,以及使用HitTestTypeV9作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + enum HitTestTypeV9 + +- 变更前: + + ```ts + enum HitTestTypeV9 + ``` + +- 变更后: + + ```ts + enum WebHitTestType + ``` + +**适配指导** + +请使用WebHitTestType替换HitTestTypeV9。 + +## cl.web.2 HeaderV9命名变更 + +结构体HeaderV9由于命名规范问题,名称变更为WebHeader。 + +**变更影响** + +结构体HeaderV9,以及使用HeaderV9作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + interface HeaderV9 + +- 变更前: + + ```ts + interface HeaderV9 + ``` + +- 变更后: + + ```ts + interface WebHeader + ``` + +**适配指导** + +请使用WebHeader替换HeaderV9。 + +## cl.web.3 HitTestValue结构体成员类型变更 + +结构体HitTestValue中的成员变量HitTestTypeV9由于命名规范问题,名称变更为WebHitTestType。 + +**变更影响** + +结构体HitTestValue,以及使用HitTestValue作为参数或返回值的接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + interface HitTestValue + +- 变更前: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: HitTestTypeV9; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +- 变更后: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: WebHitTestType; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +**适配指导** + +请使用WebHitTestType替换HitTestTypeV9。 + +## cl.web.4 loadUrl参数类型变更 + +loadUrl接口中的参数headers,由于其类型的命名规范问题,类型变更为WebHeader。 + +**变更影响** + +loadUrl接口若使用了headers参数,则在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + loadUrl(url: string | Resource, headers?: Array): void + +- 变更前: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +- 变更后: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +**适配指导** + +在loadUrl中设置headers参数时,请使用WebHeader类型替换HeaderV9类型。 + +## cl.web.5 getHitTest返回值类型变更 + +getHitTest接口中的返回值,由于其类型的命名规范问题,变更为WebHitTest。 + +**变更影响** + +getHitTest接口,在3.2.10.7版本及后续版本中无法继续正常使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + getHitTest(): HitTestTypeV9 + +- 变更前: + + ```ts + getHitTest(): HitTestTypeV9 + ``` + +- 变更后: + + ```ts + getHitTest(): WebHitTestType + ``` + +**适配指导** + +在使用getHitTest接口的返回值时,请使用WebHitTestType类型替换HitTestTypeV9类型。 + +## cl.web.6 WebMessagePort类迁移 + +WebMessagePort类迁移至@ohos.web.webview.d.ts,并新增错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + +- 变更前: + + ```ts + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + ``` + +- 变更后: + + ```ts + postMessageEvent(message: WebMessage): void; + onMessageEvent(callback: (result: WebMessage) => void): void; + ``` + +**适配指导** + +原WebMessagePort类不需要import,现WebMessagePort类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.7 HitTestValue类迁移 + +HitTestValue类迁移至@ohos.web.webview.d.ts,HitTestValue类变更为接口,getType,getExtra变更为属性。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。 + +**关键的接口/组件变更** + +- 涉及接口 + + getType(): HitTestType; + getExtra(): string; + +- 变更前: + + ```ts + getType(): HitTestType; + getExtra(): string; + ``` + +- 变更后: + + ```ts + type: WebHitTestType; + extra: string; + ``` + +**适配指导** + +原HitTestValue类不需要import,现HitTestValue类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.8 WebCookie类下api9接口迁移 + +WebCookie类下api9接口迁移,WebCookie类下api9接口迁移到web.webview.webview.WebCookieManager。 +并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 +该类方法变为静态方法。 + +**关键的接口/组件变更** + +- 涉及接口 + + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + +- 变更前: + + ```ts + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + ``` + +- 变更后: + + ```ts + static isCookieAllowed(): boolean; + static isThirdPartyCookieAllowed(): boolean; + static putAcceptCookieEnabled(accept: boolean): void; + static putAcceptThirdPartyCookieEnabled(accept: boolean): void; + static setCookie(url: string, value: string): void; + static saveCookieAsync(): Promise; + static saveCookieAsync(callback: AsyncCallback): void; + static getCookie(url: string): string; + static existCookie(): boolean; + static deleteEntireCookie(): void; + static deleteSessionCookie(): void; + ``` + +**适配指导** + +原WebCookie类不需要import,现WebCookieManager使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.9 WebController类下api9接口迁移 + +WebController类下api9接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现该类下接口支持错误码处理,需注意错误码处理的使用。 +getDefaultUserAgent接口更名为getUserAgent。 + +**关键的接口/组件变更** + +- 涉及接口 + + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + +- 变更前: + + ```ts + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +- 变更后: + + ```ts + zoomIn(): void; + zoomOut(): void; + createWebMessagePorts(): Array; + postMessage(name: string, ports: Array, uri: string): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +**适配指导** + +原WebController类不需要import,现WebviewController类使用的是@ohos.web.webview,以下方式import: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.10 WebAsyncController类迁移 + +WebAsyncController类下接口迁移至web.webview.webview.WebviewController,并新增接口错误码抛出。 + +**变更影响** + +基于此前版本开发的应用,需注意错误码处理的使用。 + +**关键的接口/组件变更** + +- 涉及接口 + + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + +- 变更前: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +- 变更后: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +**适配指导** + +使用示例: + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('saveWebArchive') + .onClick(() => { + try { + this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => { + if (error) { + console.info(`save web archive error: ` + JSON.stringify(error)) + return; + } + if (filename != null) { + console.info(`save web archive success: ${filename}`) + } + }); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` \ No newline at end of file diff --git a/zh-cn/release-notes/release-definitions/Release-version-definitions.md b/zh-cn/release-notes/release-definitions/Release-version-definitions.md index 6308d04fb2adcfe78e600c631cb0965dd276b220..0b33014c71cc7aaa59abec15fa6a6b33a5f2dde8 100644 --- a/zh-cn/release-notes/release-definitions/Release-version-definitions.md +++ b/zh-cn/release-notes/release-definitions/Release-version-definitions.md @@ -4,7 +4,6 @@ 为了保障OpenHarmony社区版本的平滑演进和历史发布版本的持续稳定可靠,会定期从Master主干拉出LTS/Release/Beta等类型分支,并按照OpenHarmony生命周期定义对其进行管理。 -![1.png](figures/1.png) ### Master (主干分支) diff --git a/zh-cn/third-party-components/npm-third-party-guide.md b/zh-cn/third-party-components/npm-third-party-guide.md deleted file mode 100644 index 60222a480c852f19216688d99dda1dd9822005cc..0000000000000000000000000000000000000000 --- a/zh-cn/third-party-components/npm-third-party-guide.md +++ /dev/null @@ -1,51 +0,0 @@ -# OpenHarmony JS和TS三方组件使用指导 -## OpenHarmony JS和TS三方组件介绍 - -OpenHarmony JS和TS三方组件是以OpenHarmony npm包的形式,在传统的npm三方组件的基础上,定义了OpenHarmony npm共享包特定的工程结构和配置文件,支持OpenHarmony页面组件相关API、资源的调用。通过OpenHarmony npm包,可以实现多个模块或者多个工程共享OpenHarmony页面、资源等相关代码。前往[npm官方文档](https://docs.npmjs.com/about-npm),可以了解和掌握npm的基础功能和机制。 - - - -## 查找OpenHarmony JS和TS三方组件 - -1. 关注Gitee官网OpenHarmony-TPC[三方组件资源汇总](https://gitee.com/openharmony-tpc/tpc_resource)项目,根据目录索引即可找到对应分类下的具体组件。 - - - -2. 访问[OpenHarmony官网](https://www.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 - ![official-website.png](official-website.png) - - - -## 安装并使用OpenHarmony JS和TS语言的三方组件 - -在应用开发的过程中,JS和TS语言的三方组件,通常以源码或OpenHarmony npm包的方式被引入使用。按照以下步骤即可将OpenHarmony npm包引入应用并使用,源码的具体引入及使用请参考各三方组件README.md指导介绍。 - -1. 配置OpenHarmony npm环境,详情请参考安装教程 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md)。 - -2. 在Terminal项目终端中,进入entry目录,并执行目标组件命令进行安装。具体的下载命令详见OpenHarmony官网该三方组件的“下载安装“模块。 - - 以安装[vcard三方组件](https://growing.openharmony.cn/mainPlay/libraryMaps/vcard_595)为例,找到“下载安装”模块获取其安装命令,并执行该命令安装: - - ![npm-usage1.png](npm-usage1.png) - - ![npm-usage2.png](npm-usage2.png) - -3. 下载完成后在项目文件下自动生成node_modules文件,下载的三方库即node_modules目录下的@ohos\VCard。 - - ![npm-usage3.png](npm-usage3.png) - -4. 在package.json中会自动添加如下依赖: - - ``` - "dependencies": { - "@ohos/vcard": "^2.0.5" - } - ``` - -5. 在需要使用该组件的文件中导入组件。 - - ![npm-usage4.png](npm-usage4.png) - -6. 导入组件后直接使用方法即可。 - - ![npm-usage5.png](npm-usage5.png) \ No newline at end of file diff --git a/zh-cn/third-party-components/npm-usage1.png b/zh-cn/third-party-components/npm-usage1.png deleted file mode 100644 index 9dc9a72717182136e77d620c90e45669c4059043..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage1.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage2.png b/zh-cn/third-party-components/npm-usage2.png deleted file mode 100644 index ce9e34ec18125ff473ad48667808081adc1a95d7..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage2.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage3.png b/zh-cn/third-party-components/npm-usage3.png deleted file mode 100644 index 66b6a14069cec3caaa42c0007f7b12ff09773f6f..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage3.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage4.png b/zh-cn/third-party-components/npm-usage4.png deleted file mode 100644 index 8cd881a7ddf90aed5570411c943794829c2fa24d..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage4.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage5.png b/zh-cn/third-party-components/npm-usage5.png deleted file mode 100644 index ec7f772f86dad4deb5f061f6e7cf6ac41748a225..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage5.png and /dev/null differ diff --git a/zh-cn/third-party-components/ohpm-third-party-guide.md b/zh-cn/third-party-components/ohpm-third-party-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..310aaf4dbb4f8f99112c77da0501549e65e66de9 --- /dev/null +++ b/zh-cn/third-party-components/ohpm-third-party-guide.md @@ -0,0 +1,174 @@ +# OpenHarmony JS和TS三方组件使用指导 +## OpenHarmony JS和TS三方组件介绍 + +OpenHarmony JS和TS三方组件使用的是OpenHarmony静态共享包,即HAR(Harmony Archive),可以包含js/ts代码、c++库、资源和配置文件。通过HAR,可以实现多个模块或者多个工程共享ArkUI组件、资源等相关代码。HAR不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 + + + +## 查找OpenHarmony JS和TS三方组件 + +1. 关注Gitee官网OpenHarmony-TPC[三方组件资源汇总](https://gitee.com/openharmony-tpc/tpc_resource)项目,根据目录索引即可找到对应分类下的具体组件。 + + + +2. 访问[OpenHarmony官网](https://growing.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 + ![official-website.png](official-website.png) + + + +## 安装并使用OpenHarmony JS和TS语言的三方组件 + +引用三方HAR,包括从仓库进行安装和从本地库模块中进行安装两种方式。 + +**引用仓库安装的HAR** + +引用ohpm仓中的HAR,首先需要设置三方HAR的仓库信息,DevEco Studio默认仓库地址是"https://repo.harmonyos.com/ohpm/",如果您想设置自定义仓库,请在DevEco Studio的Terminal窗口执行如下命令进行设置(执行命令前,请确保将DevEco Studio中ohpm安装地址配置在“环境变量-系统变量-PATH”中): +``` +ohpm config set registry=your_registry1,your_registry2 +``` +说明:ohpm支持多个仓库地址,采用英文逗号分隔。 +然后通过如下两种方式设置三方包依赖信息: + - 方式一:在Terminal窗口中,执行如下命令安装三方包,DevEco Studio会自动在工程的oh-package.json5中自动添加三方包依赖。 +``` +ohpm install @ohos/lottie +``` + - 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: +``` +"dependencies": { "@ohos/lottie": "^2.0.0"} +``` +依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 +``` +ohpm install +``` + +**引用本地库模块的文件和资源** + +- 方式一:在Terminal窗口中,执行如下命令进行安装,并会在oh-package5.json中自动添加依赖。 +``` +ohpm install ../library +``` +- 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: +``` +"dependencies": { + "@ohos/library": "file:../library" +} +``` +依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 +``` +ohpm install +``` + +> **说明:** +> +> 在引用OpenHarmony HAR时,请注意以下事项 +>- 当前只支持在模块和工程下的oh-package.json5文件中声明dependencies依赖,才会被当做OpenHarmony依赖使用,并在编译构建过程中进行相应的处理。 +>- 引用的模块的compileSdkVersion不能低于其依赖的OpenHarmony ohpm三方包(可在oh_modules目录下,找到引用的ohpm包的src > main > module.json5 中查看)。 + + + +### 引用OpenHarmony HAR hml页面 +在JS工程范式中,组件功能由hml承载,开发者可以在JS工程的hml页面通过标签来引入OpenHarmony HAR中的共享hml页面,示例如下: +``` + +``` +其中,@ohos/library为OpenHarmony HAR的包名,hml页面的路径为OpenHarmony HAR中的相对路径。 +随后便可以通过设置的name来使用该element元素,以引用OpenHarmony HAR中的hml页面,示例如下: +```typescript + + +
+ + + {{ $t('strings.hello') }} {{ title }} + +
+``` +### 引用OpenHarmony HAR ArkTS页面 +ArkTS是TypeScript的扩展,因此导出和引入的语法与TypeScript一致。在OpenHarmony ohpm模块中,可以通过export导出ArkTS页面,示例如下: +```typescript +// library/src/main/ets/components/MainPage/MainPage.ets +@Entry +@Component +export struct MainPage { + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } .height('100%') + } +} +``` +然后在其它模块中通过import引入导出的ArkTS页面,示例如下所示: +```typescript +// entry/MainAbility/pages/index.ets + +import { MainPage } from "@ohos/library" +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Column() { + MainPage() + Row() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('10%') + } +} +``` +引用OpenHarmony HAR内ts/js方法ts/js方法的导出和引用,与ArkTS页面的引用相同,即在OpenHarmony ohpm模块中,可以通过export导出ts/js方法,示例如下所示: +```typescript +// library/index.js +export function func() { + return "[ohpm] func1"; +} +``` +然后在其它的ts/js页面中,通过import引入导出的ts/js方法,示例如下所示: +```typescript +// entry/src/main/js/MainAbility/pages/index/index.js +import {func} from "@ohos/library" +export default { + data: { + title: "" + }, + onInit() { + this.title = func(); + } +} +``` +引用OpenHarmony HAR内资源支持在OpenHarmony ohpm模块和依赖OpenHarmony ohpm的模块中引用OpenHarmony ohpm模块内的资源。例如在OpenHarmony ohpm模块的scr/main/resources里添加字符串资源(在string.json中定义,name:hello_ohpm)和图片资源(icon_ohpm.png)。然后在Entry模块中引用该字符串资源和图片资源的示例如下: +当前暂不支持类Web范式引用i18n文件中的国际化资源。 +```typescript +// entry/src/main/ets/MainAbility/pages/index.ets +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Column() { + Row() { + Text($r("app.string.hello_ohpm")) // 字符串资源 + .fontSize(40) + .fontWeight(FontWeight.Bold) + } + .width('50%') + Image($r("app.media.icon_ohpm")) // 图片资源 + } + .height('100%') + } +} +``` +在编译构建HAP中,DevEco Studio会从HAP模块及依赖的模块中收集资源文件,如果不同模块的相同限定词目录下的资源文件出现重名冲突时,DevEco Studio会按照以下优先级进行覆盖(优先级由高到低): +- AppScope(仅API 9的Stage模型支持) +- HAP包自身模块 +- 依赖的OpenHarmonyHarmony ohpm模块 \ No newline at end of file diff --git a/zh-cn/third-party-components/third-party-components-introduction.md b/zh-cn/third-party-components/third-party-components-introduction.md index 31f1ab1bfd795ff7b8154455a16d59ca234cd494..aaa89c4fac1bb47e7689a963c46e8c62cc81e18a 100644 --- a/zh-cn/third-party-components/third-party-components-introduction.md +++ b/zh-cn/third-party-components/third-party-components-introduction.md @@ -1,6 +1,6 @@ # OpenHarmony三方组件 -OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony npm包的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 +OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony HAR的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 diff --git a/zh-cn/website.md b/zh-cn/website.md index 04498ecb4e5a3b69f5d22cde59701cf15d530daf..2d5d2a13a01484308e8a6c42a72321646b7de543 100644 --- a/zh-cn/website.md +++ b/zh-cn/website.md @@ -74,7 +74,7 @@ - [用户IAM](release-notes/api-change/v3.2-Release/js-apidiff-user-iam.md) - [Web](release-notes/api-change/v3.2-Release/js-apidiff-web.md) - [窗口](release-notes/api-change/v3.2-Release/js-apidiff-window.md) - - OpenHarmony 3.2 Release (相比3.1 Beta5) + - OpenHarmony 3.2 Release (相比3.2 Beta5) - JS API差异报告 - [元能力](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-ability.md) - [帐号](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-account.md) @@ -84,7 +84,6 @@ - [包管理](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-bundle.md) - [网络及通信](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-communication.md) - [语言编译器运行时](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-compiler-and-runtime.md) - - [定制](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-customization.md) - [DFX](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-dfx.md) - [分布式数据](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-distributed-data.md) - [文件管理](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-file-management.md) @@ -102,6 +101,17 @@ - [用户IAM](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-user-iam.md) - [Web](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-web.md) - [窗口](release-notes/api-change/Beta5%20to%20v3.2-Release/js-apidiff-window.md) + - 变更说明 + - [元能力](release-notes/changelogs/v3.2-release/changelogs-ability.md) + - [ArkUI](release-notes/changelogs/v3.2-release/changelogs-arkui.md) + - [包管理](release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md) + - [输入法框架](release-notes/changelogs/v3.2-release/changelogs-imf.md) + - [全局资源调度](release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md) + - [主题框架-锁屏](release-notes/changelogs/v3.2-release/changelogs-screenlock.md) + - [电话服务](release-notes/changelogs/v3.2-release/changelogs-telephony.md) + - [util](release-notes/changelogs/v3.2-release/changelogs-util.md) + - [主题框架-壁纸](release-notes/changelogs/v3.2-release/changelogs-wallpaper.md) + - [web组件](release-notes/changelogs/v3.2-release/changelogs-web.md) - OpenHarmony 3.2 Beta5 - JS API差异报告 - [元能力](release-notes/api-change/v3.2-beta5/js-apidiff-ability.md) @@ -352,7 +362,7 @@ - OpenHarmony三方组件 - [OpenHarmony三方组件简介](third-party-components/third-party-components-introduction.md) - - [OpenHarmony JS/TS三方组件使用指导](third-party-components/npm-third-party-guide.md) + - [OpenHarmony JS/TS三方组件使用指导](third-party-components/ohpm-third-party-guide.md) - 贡献 - [参与贡献](contribute/参与贡献.md)