提交 e6e8496f 编写于 作者: G Gloria

Update docs against master issues

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 89884dbd
......@@ -162,7 +162,7 @@ Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder n
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 Beta3](../../release-notes/OpenHarmony-v3.2-beta3.md) as an example.
For details about how to replace the SDK package, see [Full SDK Compilation Guide](../quick-start/full-sdk-compile-guide.md).
For details about how to replace the SDK package, see [Full SDK Compilation Guide](../faqs/full-sdk-compile-guide.md).
After obtaining the executable file, perform subsequent development steps based on your scenario.
......
......@@ -2,9 +2,9 @@
- [Full SDK Compilation](full-sdk-compile-guide.md)
- [Switching to Full SDK](full-sdk-switch-guide.md)
- [Ability Development](faqs-ability.md)
- [ArkUI Development](faqs-arkui.md)
- [ArkUI Development (ArkTS Syntax)](faqs-arkui-arkts.md)
- [Application Model Development](faqs-ability.md)
- ArkUI Framework Development (ArkTS)
- [ArkUI Development (ArkTS Syntax)](faqs-arkui-arkts.md)
- [Web Development](faqs-arkui-web.md)
- [Bundle Management Development](faqs-bundle-management.md)
- [Resource Manager Development](faqs-globalization.md)
......
# Ability Development
# Application Model Development
## How do I obtain a notification when the device orientation changes?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -14,7 +14,7 @@ Use the **UIAbility.onConfigurationUpdate\(\)** callback to subscribe to system
## How do I redirect a user to a specified page after they touch a service widget?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -42,7 +42,7 @@ Create a background task to provide the background service.
## Can I create a UIAbility and specify the process to run the UIAbility in the FA and Stage models?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -59,7 +59,7 @@ Yes.
## What are the differences between the stage model and the FA model in intra-process object sharing?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -72,7 +72,7 @@ Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
## How do I use the lifecycle functions of AbilityStage?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -85,7 +85,7 @@ Add the field **"srcEntry": "./ets/myabilitystage/MyAbilityStage.ts"** under **m
## How do I delete the mission snapshot in Recents after terminateself is called in the multiton scenario?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -93,7 +93,7 @@ You can set **removeMissionAfterTerminate** to **true** in the **module.json5**
## Why can't I start a UIAbility instance by using startAbility\(\)?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -102,7 +102,7 @@ Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
## How do I prevent "this" in a method from changing to "undefined" when the method is called?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -112,7 +112,7 @@ Method 2: Use the arrow function.
## What should I do when the error message "must have required property 'startWindowIcon'" is displayed during the UIAbility startup?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -135,11 +135,11 @@ Configure the **startWindowIcon** attribute under **abilities** in the **module.
**Reference**
[module.json5 Configuration File](../quick-start/module-configuration-file.md)
[module.json5 File](../quick-start/module-configuration-file.md)
## Can I obtain the context through globalThis in the stage model?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
Do not use **globalThis** to obtain the context in the stage model.
......@@ -151,7 +151,7 @@ This is because all the processes of an application share a JS VM instance in th
## What should I do when an error indicating too large size is reported during HAP deployment?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Symptom**
......@@ -165,11 +165,11 @@ You can split the HAP into multiple HAPs.
## How is data returned when startAbilityForResult is called?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
The target UIAbilities uses **AbilityContext.terminateSelfWithResult** to terminate itselef and pass the result to **startAbilityForResult**.
The target UIAbilities uses **AbilityContext.terminateSelfWithResult** to terminate itself and pass the result to **startAbilityForResult**.
**Reference**
......@@ -178,7 +178,7 @@ The target UIAbilities uses **AbilityContext.terminateSelfWithResult** to termin
## How do I obtain the system timestamp?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -209,7 +209,7 @@ Use the **@ohos.systemDateTime** API as follows:
## How do I obtain the cache directory of the current application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -221,7 +221,7 @@ Use **Context.cacheDir** to obtain the cache directory of the application.
## In which JS file is the service widget lifecycle callback invoked?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -233,7 +233,7 @@ When a widget is created, a **FormAblity.ts** file is generated, which contains
## What should I do when the compilation on DevEco Studio fails while ServiceExtensionAbility and DataShareExtensionAbility APIs are used?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Symptom**
......@@ -250,7 +250,7 @@ The SDK downloaded using DevEco Studio is the public SDK.
**Solution**
Third-party application cannot use **ServiceExtensionAbility** and **DataShareExtensionAbility**. To develop a system application, first [download the full SDK](../quick-start/full-sdk-switch-guide.md).
Third-party application cannot use **ServiceExtensionAbility** and **DataShareExtensionAbility**. To develop a system application, first [download the full SDK](../faqs/full-sdk-switch-guide.md).
## How do I obtain the temp and files paths at the application level?
......@@ -264,18 +264,99 @@ Obtain them from the application context. Specifically, use **this.context.getAp
[Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path)
## Why the application is not deleted from the background mission list after it calls terminateSelf?
Applicable to: OpenHarmony 3.2 Beta5
**Solution**
This is because the **removeMissionAfterTerminate** field under **abilities** in the **module.json5** file of the UIAbility is set to **false** (default value). To enable the application snapshot to be automatically deleted when the application is destroyed, set this field to **true**.
**Reference**
[module.json5 File](../quick-start/module-configuration-file.md)
## How does an application developed in the stage model start an application developed in the FA model?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Refer to the code snippet below:
```
let want = {
deviceId: "", // An empty deviceId indicates the local device.
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
moduleName: "Module1", // moduleName is optional.
parameters: { // Custom information.
},
}
// context is the AbilityContext of the FA model to be started.
context.startAbility(want).then(() => {
...
}).catch((err) => {
...
})
```
## Can atomic services be implemented using JavaScript code only?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Currently, the directory structure of new widgets is css+hml+json. This means that the widgets cannot be implemented by using JavaScript code only. Event triggering and parameter transfer can be processed in JSON files.
## Can the lifecycle callback of a released FA widget be triggered when the widget is displayed in the service center so that the user login information can be obtained without opening the FA application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
After a widget is added, the **onCreate()** lifecycle is triggered so that related user information (silent login) can be displayed even when the application is not started. However, users must manually add the widget after the application is installed.
After a widget is added, the **onCreate\(\)** lifecycle is triggered so that related user information (silent login) can be displayed even when the application is not started. However, users must manually add the widget after the application is installed.
## What should I do when the error message "\[c4d4d3492eb8531, 0, 0\] ContextDeal::startAbility fetchAbilities failed" is displayed during switching to another application?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Symptom**
The **startAbility** API reports an error during redirection.
**Solution**
Use **startAbility** for implementation as follows:
```
import featureAbility from '@ohos.ability.featureAbility'
function onStartRemoteAbility() {
console.info('onStartRemoteAbility begin');
let params;
let wantValue = {
bundleName: 'ohos.samples.etsDemo',
abilityName: 'ohos.samples.etsDemo.RemoteAbility',
deviceId: getRemoteDeviceId(),
parameters: params
};
console.info('onStartRemoteAbility want=' + JSON.stringify(wantValue));
featureAbility.startAbility({
want: wantValue
}).then((data) => {
console.info('onStartRemoteAbility finished, ' + JSON.stringify(data));
});
console.info('onStartRemoteAbility end');
}
```
**Reference**
See [Starting a Local PageAbility] (../application-models/start-local-pageability.md).
## How do I implement service login by touching a widget?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -299,7 +380,7 @@ To create a service widget in the FA model, perform the following steps:
## How do I redirect to the application details page in Settings?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -324,30 +405,28 @@ You can use **UIAbility.Context** to obtain the context.
**Example**
```
import UIAbility from '@ohos.app.ability.UIAbility';
import common from '@ohos.app.ability.common';
let UIAbilityContext = UIAbility.context;
let ApplicationContext = UIAbility.context.getApplicationContext();
@Entry
@Component
struct AbilityContextTest {
// abilityContext
@State UIabilityInfo: string = 'Obtaining abilityInfo'
UIabilityContext: UIAbilityContext
@State UIAbilityInfo: string = 'Obtaining abilityInfo'
UIAbilityContext: common.UIAbilityContext
aboutToAppear() {
// Use getContext to obtain the context and convert it to abilityContext.
this.UIabilityContext = getContext(this) as UIAbilityContext
this.UIAbilityContext = getContext(this) as common.UIAbilityContext
}
build() {
Row() {
Column({ space: 20 }) {
Text(this.abilityInfo)
Text(this.UIAbilityInfo)
.fontSize(20)
.onClick(()=>{
this.UIabilityInfo = JSON.stringify(this.UIabilityContext.UIabilityInfo)
console.log(`ContextDemo abilityInfo= ${this.UIabilityInfo}`)
.onClick(() => {
this.UIAbilityInfo = JSON.stringify(this.UIAbilityContext.abilityInfo)
console.log(`ContextDemo abilityInfo = ${this.UIAbilityInfo}`)
})
}
.width('100%')
......@@ -356,3 +435,51 @@ struct AbilityContextTest {
}
}
```
## What should I do when starting a continuous task fails?
Applicable to: OpenHarmony 3.2 Release (API version 9)
**Symptom**
A ServiceAbility is started by calling **featureAbility.startAbility\(\)**. When the ServiceAbility attempts to start a continuous task, the error message \{"code":201,"message":"BussinessError 201: Permission denied."\} is reported.
**Solution**
To start a continuous task in the background, you must configure the permission **ohos.permission.KEEP\_BACKGROUND\_RUNNING** in the **module.json5** file and declare the background mode for the ability that needs to use the continuous task.
```
"module": {
"abilities": [
{
"backgroundModes": [
"dataTransfer",
"location"
], // Background mode
}
],
"requestPermissions": [
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission
}
]
}
```
**Reference**
[ServiceAbility Configuration Items - backgroundModes](../application-models/serviceability-configuration.md)
[Continuous Task Permission](../security/permission-list.md#ohospermissionkeep_background_running)
[Continuous Task Development](../task-management/continuous-task-dev-guide.md#development-in-the-stage-model)
## How do FA widgets exchange data?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
The widget interacts with the widget provider through the **postCardAction** API, and the provider updates data through the **updateForm** API.
**Reference**
[Widget Development in the FA Model](../application-models/widget-development-fa.md)
......@@ -2,7 +2,7 @@
## How do I determine whether an application is a system application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -14,7 +14,7 @@ Use **bundleManager.getApplicationInfo** (available only for system applications
## How do I obtain the version code and version name of an application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -96,7 +96,7 @@ Applicable to: OpenHarmony 3.2 Beta5
## How do I obtain the source file path of the current application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -121,6 +121,81 @@ Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
## Can I obtain the HAP information of other applications from the current application?
Applicable to: OpenHarmony 3.2 (API version 9)
**Solution**
Currently, only system applications can call the API to query information about other applications.
- To query information about an application in the system, you must obtain the normal-level permission **ohos.permission.GET\_BUNDLE\_INFO** and call the **bundleManager.getApplicationInfo\(\)** API.
- To query information about all applications in the system, you must obtain the system\_basic-level permission **ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED** and call the **bundleManager.getAllApplicationInfo\(\)** API.
**Reference**
[@ohos.bundle.bundleManager \(bundleManager\)](../reference/apis/js-apis-bundleManager.md)
## How do I query the PID of a process?
Applicable to: OpenHarmony 3.2 Beta (API version 9)
**Solution**
You can obtain the PID through the **@ohos.process** interface.
**Example**
```
import process from '@ohos.process';
private pid = process.pid;
```
**Reference**
[@ohos.process \ (Obtaining Process Information\)](../reference/apis/js-apis-process.md)
## How do I disable the maximize button?
Applicable to: OpenHarmony 3.2 Beta (API version 9)
According to the OpenHarmony security design specifications, the SDK does not provide APIs for third-party applications to obtain bundle information (including but not limited to the application name and version number) of other applications.
**Solution**
You can use the **supportWindowModes** field to specify whether to display the maximize button.
- **full\_screen** means that a window in full-screen mode is supported.
- **split** means that a window in split-screen mode is supported.
- **floating** means that a floating window is supported.
**Example**
```
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"supportWindowMode": ["split", "floating"],
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
```
**Reference**
[supportWindowModes](../reference/apis/js-apis-bundleManager-abilityInfo.md)
......@@ -23,7 +23,7 @@ try {
## How do I hide the status bar to get the immersive effect?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -59,7 +59,7 @@ Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
## How do I obtain the window width and height?
Applicable to: OpenHarmony SDK 3.2 Beta5 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
**Solution**
......@@ -90,3 +90,32 @@ try {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
}
```
## How do I perform Gaussian blurring on images?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Import the **@ohos.multimedia.image** and **@ohos.effectKit** modules to process the image and add the blur effect.
**Example**
```
import image from "@ohos.multimedia.image";
import effectKit from "@ohos.effectKit";
const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } };
image.createPixelMap(color, opts).then((pixelMap) => {
let radius = 5;
let headFilter = effectKit.createEffect(pixelMap);
if (headFilter != null) {
headFilter.blur(radius);
}
})
```
**Reference**
[blur](../reference/apis/js-apis-effectKit.md#blur)
......@@ -2,7 +2,7 @@
## How do I obtain the frame data of a camera when using the XComponent to display the preview output stream of the camera?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Symptom**
......@@ -35,7 +35,7 @@ Create a dual-channel preview to obtain the frame data.
## How do I obtain the preview image of the front camera?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Solution**
......@@ -76,7 +76,7 @@ Applicable to: OpenHarmony 3.2 (API version 9, stage model)
## How do I set the camera focal length?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Solution**
......@@ -86,7 +86,7 @@ Applicable to: OpenHarmony 3.2 (API version 9, stage model)
## How do I play music in the background?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Symptom**
......@@ -105,7 +105,7 @@ Music cannot be played in the background.
## What should I do when multiple video components cannot be used for playback?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Symptom**
......@@ -115,10 +115,9 @@ A large number of video components are created. They cannot play media normally
A maximum of 13 media player instances can be created.
## How do I invoke the image library directly?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
Applicable to: OpenHarmony 3.2 (API version 9)
**Solution**
......@@ -133,3 +132,69 @@ let want = {
let context = getContext(this) as common.UIAbilityContext;
context.startAbility(want);
```
## How do I apply for the media read/write permission on a device?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
**Solution**
1. Configure the permissions **ohos.permission.READ\_MEDIA** and **ohos.permission.WRITE\_MEDIA** in the **module.json5** file.
Example:
```
{
"module" : {
"requestPermissions":[
{
"name" : "ohos.permission.READ_MEDIA",
"reason": "$string:reason"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason": "$string:reason"
}
]
}
}
```
2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user\_grant**.
```
let context = getContext(this) as common.UIAbilityContext;
let atManager = abilityAccessCtrl.createAtManager();
let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA']
atManager.requestPermissionsFromUser(context, permissions)
.then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => {
console.log("Failed to request permission from user with error: " + JSON.stringify(error))
})
```
## How do I obtain the camera status?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
**Solution**
The **cameraManager** class provides a listener to subscribe to the camera status.
```
cameraManager.on('cameraStatus', (cameraStatusInfo) => {
console.log(`camera : ${cameraStatusInfo.camera.cameraId}`);
console.log(`status: ${cameraStatusInfo.status}`);
})
```
CameraStatus: Enumerates the camera statuses.
- **CAMERA_STATUS_APPEAR** (0): A camera appears.
- **CAMERA_STATUS_DISAPPEAR** (1): The camera disappears.
- **CAMERA_STATUS_AVAILABLE** (2): The camera is available.
- **CAMERA_STATUS_UNAVAILABLE** (3): The camera is unavailable.
**Reference**
[CameraStatus](../reference/apis/js-apis-camera.md#oncamerastatus)
\ No newline at end of file
......@@ -2,6 +2,24 @@
## Are the APIs used for obtaining PPG and ECG sensor data open to individual developers?
Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.1 Beta5 (API version 9)
Data collected by the PPG and ECG sensors of wearable devices is personal privacy data. Therefore, relative APIs are not open to individual developers.
## What should I do when error code 201 is reported during the calling of a vibrator API?
Applicable to: OpenHarmony 3.2 (API version 9, stage model)
**Symptom**
The following error message (error code 201) is reported when an API of the vibrator module is called:
vibrate fail, error.code: 201error.message: NaN
**Solution**
Permission verification failed. You must apply for the **ohos.permission.VIBRATE** permission.
**Reference**
[Applying for Permissions](../security/accesstoken-guidelines.md)
\ No newline at end of file
......@@ -2,19 +2,19 @@
## How do I obtain available third-party libraries?
Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.1 Beta5 (API version 9)
The three-party and four-party libraries that can be obtained through ohpm are summarized in the [OpenHarmony-TPC/tpc_resource repository](https://gitee.com/openharmony-tpc/tpc_resource). You can access this repository, and find the desired component based on the directory index.
## Which third-party libraries are related to network requests?
Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.1 Beta5 (API version 9)
The following third-party libraries are related to network requests: [Axios](https://gitee.com/openharmony-sig/axios), httpclient, and okdownload. For details, see the [OpenHarmony-TPC/tpc_resource repository](https://gitee.com/openharmony-tpc/tpc_resource).
## How do I use ohpm to import third- and fourth-party libraries?
Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.1 Beta5 (API version 9)
**Solution**
......
......@@ -2,7 +2,7 @@
## How do I obtain the height of the status bar and navigation bar?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -44,7 +44,7 @@ export default class MainAbility extends Ability {
## How do I hide the status bar on the top of an application?
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
......@@ -62,3 +62,101 @@ onWindowStageCreate(windowStage){
**Reference**
[Window](../reference/apis/js-apis-window.md)
## How do I lock the window in portrait mode so that it does not rotate with the device?
Applicable to: OpenHarmony SDK 3.2 Beta5 (API version 9, stage model)
**Solution**
To lock the window in portrait mode, call **setPreferredOrientation** of the window module, with **orientation** set to **window.Orientation.PORTRAIT**.
**Example**
```
import window from "@ohos.window";
// 1. Obtain a Window instance. Specifically, you can call createWindow to create a window or findWindow to obtain an existing window.
let windowClass = null;
let config = {name: "alertWindow", windowType: window.WindowType.TYPE_SYSTEM_ALERT, ctx: this.context};
try {
let promise = window.createWindow(config);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
}).catch((err)=>{
console.error('Failed to create the Window. Cause:' + JSON.stringify(err));
});} catch (exception) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(exception));
}
// 2. Call setPreferredOrientation to set the window orientation. The value PROTRAIT indicates that the window is displayed in portrait mode.
let orientation = window.Orientation.PORTRAIT;
if (windowClass) {
windowClass.setPreferredOrientation(orientation, (err) => {
if (err.code) {
console.error('Failed to set window orientation. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting window orientation.');
}
```
**Reference**
[window.Orientation](../reference/apis/js-apis-window.md#orientation9)
## Why do the isStatusBarLightIcon and isNavigationBarLightIcon attributes set by calling setWindowSystemBarProperties not take effect?
Applicable to: OpenHarmony SDK 3.2 Beta5 (API version 9, stage model)
**Solution**
In effect, the **isStatusBarLightIcon** and **isNavigationBarLightIcon** attributes turn the font white when set to **true**. If **statusBarContentColor** is also set in **setWindowSystemBarProperties**, the **isStatusBarLightIcon** attribute does not take effect. Similarly, if **navigationBarContentColor** is set, the **isNavigationBarLightIcon** attribute does not take effect.
**Reference**
[window.SystemBarProperties](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-window.md#systembarproperties)
## How do I keep the screen always on?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Obtain a **Window** instance, and call [setWindowKeepScreenOn](../reference/apis/js-apis-window.md#setwindowkeepscreenon9) to keep the screen always on.
```
let isKeepScreenOn = true;
try {
windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err) => {
if (err.code) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the screen to be always on.');
});
} catch (exception) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
}
```
## How do I listen for window size changes?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Obtain a **Window** instance, and call **on\('windowSizeChange'\)** to listen for window size changes.
```
try {
windowClass.on('windowSizeChange', (data) => {
console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data));
});
} catch (exception) {
console.error('Failed to enable the listener for window size changes. Cause: ' + JSON.stringify(exception));
}
```
**Reference**
[window.on\("windowSizeChange"\)](../reference/apis/js-apis-window.md#onwindowsizechange7)
# Native APIs
Native APIs are a set of native development interfaces and tools provided by the OHOS SDK. It enables the use of C or C++ code to implement key application functionalities. Native APIs provide part of basic underlying capabilities of OHOS, such as libc, graphics library, window system, multimedia, and compression library. They do not provide complete OHOS platform capabilities as JS APIs do. Native APIs are compiled into a dynamic library before being packed into the application.
## Native API Composition
### Native API Directory Structure
Native APIs are stored in the **$(SDK_ROOT)/native** directory of the SDK. They consist of the following parts:
|Directory|Description|
|--|--|
|build|Used to build the toolchain.cmake script of the dynamic library in the application. The **ohos.toolchain.cmake** file in this directory defines OHOS cross compilation options.|
|build-tools|Stores build tools, such as CMake.|
|docs|Stores Native API reference documents, which is extracted from the header files using Doxgen.|
|llvm|Stores LLVM, a cross compiler that supports OHOS ABIs.|
|sysroot|Stores dependent files of build links, including header files and dynamic libraries.|
### Native APIs
|Category|Function|Introduced In|
|--|--|--|
|C standard library|C standard library interfaces based on musl. Currently, more than 1500 interfaces are provided.|API version 8|
|C++ standard library|C++ runtime library libc++_shared. This library must be packed or statically linked to the application during packing.|API version 8|
|Log|HiLog interfaces for printing logs to the system|API version 8|
|napi|A group of Node-APIs provided by ArkUI to facilitate access to the JS application environment during application development. Node-APIs are part of native APIs.|API version 8|
|XComponent|Provides surface and touchscreen event interfaces for developing high-performance graphics applications.|API version 8|
|libuv|Third-party asynchronous I/O library integrated by ArkUI.|API version 8|
|libz|zlib library that provides basic compression and decompression interfaces.|API version 8|
|Drawing|2D graphics library that can be used for drawing on the surface.|API version 8|
|OpenGL|OpenGL 3.0 interfaces.|API version 8|
|Rawfile|Application resource access interfaces that can be used to read various resources packed in the application.|API version 8|
|OpenSLES|Interface library used for 2D and 3D audio acceleration.|API version 8|
|Mindspore|AI model interface library.|API version 9|
|Bundle management|Bundle service interfaces that can be used to query bundle information of the application.|API version 8|
Some native APIs use open source standards. For details, see [Native Standard Libraries Supported by OpenHarmony](https://docs.openharmony.cn/pages/v3.1/en/application-dev/reference/native-lib/third_party_libc/musl.md/) and [Node_API](https://docs.openharmony.cn/pages/v3.1/en/application-dev/reference/native-lib/third_party_napi/napi.md/).
## Usage Guidelines
### Scenarios Where Native APIs Are Recommended
You can use native APIs when you want to:
1. Develop performance-sensitive code in computing-intensive scenarios such as gaming and physical simulation.
2. Reuse the existing C or C++ library.
3. Customize libraries related to CPU features, such as neon acceleration.
### Scenarios Where Native APIs Are Not Recommended
You do not need to use native APIs when you want to:
1. Write a native OHOS application.
2. Develop an application compatible on as many OHOS devices as possible.
# Native API References
- [Native API hello world]()
This sample shows how to develop a hello native API library, which can display strings obtained from the hello library on the TS page.
- [Using Native APIs in Application Projects](napi-guidelines.md)
This document describes how to use native APIs to interact with modules, interfaces, and asynchronous tasks in JS.
- [Introduction to Native APIs](introduction.md)
- [Using N-APIs in Application Projects](napi-guidelines.md)
- [Drawing Development](drawing-guidelines.md)
- [Raw File Development](rawfile-guidelines.md)
- [Native Window Development](native-window-guidelines.md)
......
# Introduction to Native APIs
Native APIs are a set of native development interfaces and tools provided by the OHOS SDK. It enables the use of C or C++ code to implement key application functionalities. Native APIs provide part of basic underlying capabilities of OHOS, such as libc, graphics library, window system, multimedia, and compression library. They do not provide complete OHOS platform capabilities as JS APIs do. Native APIs are compiled into a dynamic library before being packed into the application.
## Native API Composition
### Native API Directory Structure
Native APIs are stored in the **$(SDK_ROOT)/native** directory of the SDK. They consist of the following parts:
|Directory|Description|
|--|--|
|build|Used to build the toolchain.cmake script of the dynamic library in the application. The **ohos.toolchain.cmake** file in this directory defines OHOS cross compilation options.|
|build-tools|Stores build tools, such as CMake.|
|docs|Stores Native API reference documents, which is extracted from the header files using Doxgen.|
|llvm|Stores LLVM, a cross compiler that supports OHOS ABIs.|
|sysroot|Stores dependent files of build links, including header files and dynamic libraries.|
### Native APIs
|Category|Function|Introduced In|
|--|--|--|
|C standard library|C standard library interfaces based on musl. Currently, more than 1500 interfaces are provided.|API version 8|
|C++ standard library|C++ runtime library libc++_shared. This library must be packed or statically linked to the application during packing.|API version 8|
|Log|HiLog interfaces for printing logs to the system|API version 8|
|napi|A group of Node-APIs provided by ArkUI to facilitate access to the JS application environment during application development. Node-APIs are part of native APIs.|API version 8|
|XComponent|Provides surface and touchscreen event interfaces for developing high-performance graphics applications.|API version 8|
|libuv|Third-party asynchronous I/O library integrated by ArkUI.|API version 8|
|libz|zlib library that provides basic compression and decompression interfaces.|API version 8|
|Drawing|2D graphics library that can be used for drawing on the surface.|API version 8|
|OpenGL|OpenGL 3.0 interfaces.|API version 8|
|Rawfile|Application resource access interfaces that can be used to read various resources packed in the application.|API version 8|
|OpenSLES|Interface library used for 2D and 3D audio acceleration.|API version 8|
|Mindspore|AI model interface library.|API version 9|
|Bundle management|Bundle service interfaces that can be used to query bundle information of the application.|API version 8|
Some native APIs use open-source standards. For details, see [Native Standard Libraries Supported by OpenHarmony](../reference/native-lib/third_party_libc/musl.md) and [Node-API](../reference/native-lib/third_party_napi/napi.md).
## Usage Guidelines
### Scenarios Where Native APIs Are Recommended
You can use native APIs when you want to:
1. Develop performance-sensitive code in computing-intensive scenarios such as gaming and physical simulation.
2. Reuse the existing C or C++ library.
3. Customize libraries related to CPU features, such as neon acceleration.
### Scenarios Where Native APIs Are Not Recommended<br>You do not need to use native APIs when you want to:
1. Write a native OHOS application.
2. Develop an application compatible on as many OHOS devices as possible.
......@@ -29,14 +29,14 @@ A description regarding system APIs will be provided in the document.
A common application is an application whose application type is **hos_normal_app** in the HarmonyAppProvision configuration file. **hos_normal_app** is the default value for project creation.
The public SDK, which does not include system APIs, is provided as standard in DevEco Studio. To use the system APIs, you must:
- Switch the public SDK to the full SDK by following the instructions provided in [Guide to Switching to Full SDK](../../faqs/full-sdk-switch-guide.md).
- Change the value of **app-feature** in the HarmonyAppProvision configuration file to **hos_system_app**. For details, see [HarmonyAppProvision Configuration File](../../security/app-provision-structure.md).
- Switch the public SDK to the full SDK by following the instructions provided in [Switching to Full SDK](../../faqs/full-sdk-switch-guide.md).
- Change the value of **app-feature** in the HarmonyAppProvision configuration file to **hos_system_app** (indicating a system application). For details, see [HarmonyAppProvision Configuration File](../../security/app-provision-structure.md).
## Permission Description
By default, applications can access limited system resources. However, in some cases, an application needs to access excess data (including personal data) and functions of the system or another application to implement extended functions. For details, see [Access Control (Permission) Overview](../../security/accesstoken-overview.md).
By default, applications can access limited system resources. However, in some cases, an application needs to access excess data (including personal data) and functions of the system or another application to implement extended functions. For details, see [Access Control Overview](../../security/accesstoken-overview.md).
To call APIs to access these resources, you must apply for the corresponding permissions by following the instructions provided in [Applying for Permissions](../../security/accesstoken-guidelines.md).
To call APIs to access these resources, you must apply for the corresponding permissions by following the instructions provided in [Access Control Development](../../security/accesstoken-guidelines.md).
- If an application can call an API only after it has obtained a specific permission, the following description is provided for the API: "**Required permissions**: ohos.permission.xxxx"
- If an application can call an API without any permission, no special description is provided.
......
# @ohos.application.EnvironmentCallback (EnvironmentCallback)
The **EnvironmentCallback** module provides APIs, such as **onConfigurationUpdated** and **onMemoryLevel**, for the application context to listen for system environment changes.
> **NOTE**
>
> The APIs of this module are supported since API version 9 and are deprecated in versions later than API version 9. You are advised to use [@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import EnvironmentCallback from '@ohos.application.EnvironmentCallback';
```
## EnvironmentCallback.onConfigurationUpdated
onConfigurationUpdated(config: Configuration): void;
Called when the system environment changes.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-application-configuration.md) | Yes| **Configuration** object after the change.|
## EnvironmentCallback.onMemoryLevel
onMemoryLevel(level: number): void;
Called when the system memory level changes.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| level | [MemoryLevel](js-apis-app-ability-abilityConstant.md#abilityconstantmemorylevel) | Yes| New memory level.|
**Example**
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
let callbackId;
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
globalThis.applicationContext = this.context.getApplicationContext();
let environmentCallback = {
onConfigurationUpdated(config){
console.log('onConfigurationUpdated config: ${JSON.stringify(config)}');
},
onMemoryLevel(level){
console.log('onMemoryLevel level: ${level}');
}
};
// 1. Obtain an applicationContext object.
let applicationContext = globalThis.applicationContext;
// 2. Register a listener for the environment changes through the applicationContext object.
callbackId = applicationContext.registerEnvironmentCallback(environmentCallback);
console.log('registerEnvironmentCallback number: ${JSON.stringify(callbackId)}');
}
onDestroy() {
let applicationContext = globalThis.applicationContext;
applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
if (error && error.code !== 0) {
console.error('unregisterEnvironmentCallback fail, error: ${JSON.stringify(error)}');
} else {
console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}');
}
});
}
}
```
## PacMap
[key: string]: number | string | boolean | Array\<string | number | boolean> | null;
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name| Type| Mandatory| Description|
| ------ | ------ | ------ | ------ |
| [key: string] | number \| string \| boolean \| Array\<string \| number \| boolean\> \| null | Yes| Data stored in key-value pairs.|
......@@ -1559,3 +1559,84 @@ try {
console.error(`startRecentAbility failed, code is ${err.code}, message is ${err.message}`);
}
```
## ServiceExtensionContext.startAbilityByCallWithAccount<sup>10+</sup>
startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller&gt;;
Starts an ability with the account ID specified and obtains the caller object for communicating with the ability.
Observe the following when using this API:
- If an application needs to call this API to start an ability that belongs to another user, it must have the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** and **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permissions.
- If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
- If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
- The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-want.md) | Yes| Information about the ability to start, including **abilityName**, **moduleName**, **bundleName**, **deviceId** (optional), and **parameters** (optional). If **deviceId** is left blank or null, the local ability is started. If **parameters** is left blank or null, the ability is started in the background.|
| accountId | number | Yes| ID of a system account. The value **-1** indicates the current user. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Caller&gt; | Promise used to return the caller object to communicate with.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------------------------------- |
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Visibility verification failed. |
| 16000005 | Static permission denied. The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | Crowdtest App Expiration. |
| 16000011 | The context does not exist. |
| 16000050 | Internal Error. |
| 16200001 | The caller has been released. |
**Example**
```ts
let caller;
// ID of a system account. The value -1 indicates the current user.
let accountId = -1;
// Specify the ability to start.
let want = {
bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry',
abilityName: 'EntryAbility'
deviceId: ''
parameters: {
// If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background.
'ohos.aafwk.param.callAbilityToForeground': true
}
};
try {
this.context.startAbilityByCallWithAccount(want, accountId)
.then((obj) => {
// Carry out normal service processing.
caller = obj;
console.log('startAbilityByCallWithAccount succeed');
}).catch((error) => {
// Process service logic errors.
console.error('startAbilityByCallWithAccount failed, error.code: ${error.code}, error.message: ${error.message}');
});
} catch (paramError) {
// Process input parameter errors.
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
```
......@@ -2519,3 +2519,84 @@ try {
console.error(`startRecentAbility failed, code is ${err.code}, message is ${err.message}`);
}
```
## UIAbilityContext.startAbilityByCallWithAccount
startAbilityByCallWithAccount(want: Want, accountId: number): Promise&lt;Caller&gt;;
Starts an ability with the account ID specified and obtains the caller object for communicating with the ability.
Observe the following when using this API:
- If an application needs to call this API to start an ability that belongs to another user, it must have the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** and **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permissions.
- If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
- If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
- The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-want.md) | Yes| Information about the ability to start, including **abilityName**, **moduleName**, **bundleName**, **deviceId** (optional), and **parameters** (optional). If **deviceId** is left blank or null, the local ability is started. If **parameters** is left blank or null, the ability is started in the background.|
| accountId | number | Yes| ID of a system account. The value **-1** indicates the current user. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Caller&gt; | Promise used to return the caller object to communicate with.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Visibility verification failed. |
| 16000005 | Static permission denied. The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | Crowdtest App Expiration. |
| 16000011 | The context does not exist. |
| 16000050 | Internal Error. |
| 16200001 | The caller has been released. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
let caller;
// ID of a system account. The value -1 indicates the current user.
let accountId = -1;
// Specify the ability to start.
let want = {
bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry',
abilityName: 'EntryAbility'
deviceId: ''
parameters: {
// If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background.
'ohos.aafwk.param.callAbilityToForeground': true
}
};
try {
this.context.startAbilityByCallWithAccount(want, accountId)
.then((obj) => {
// Carry out normal service processing.
caller = obj;
console.log('startAbilityByCallWithAccount succeed');
}).catch((error) => {
// Process service logic errors.
console.error('startAbilityByCallWithAccount failed, error.code: ${error.code}, error.message: ${error.message}');
});
} catch (paramError) {
// Process input parameter errors.
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
```
......@@ -67,6 +67,7 @@
- [Application Event Logging Error Codes](errorcode-hiappevent.md)
- [HiSysEvent Error Codes](errorcode-hisysevent.md)
- [HiDebug Error Codes](errorcode-hiviewdfx-hidebug.md)
- [Log Library Error Codes](errorcode-loglibrary.md)
- [Input Method Framework Error Codes](errorcode-inputmethod-framework.md)
- [Pasteboard Error Codes](errorcode-pasteboard.md)
- [Screen Lock Management Error Codes](errorcode-screenlock.md)
......@@ -82,7 +83,8 @@
- [Thermal Manager Error Codes](errorcode-thermal.md)
- [Device Management Error Codes](errorcode-device-manager.md)
- [Location Subsystem Error Codes](errorcode-geoLocationManager.md)
- [Screen Hopping Error Codes](errorcode-multimodalinput.md)
- [Screen Hopping Error Codes](errorcode-devicestatus.md)
- [Screen Hopping Error Codes (to Be Deprecated)](errorcode-multimodalinput.md)
- [Sensor Error Codes](errorcode-sensor.md)
- [Vibrator Error Codes](errorcode-vibrator.md)
- [System Parameter Error Codes](errorcode-system-parameterV9.md)
......
# NativeWindow
## Overview
Provides the native window capability for connection to the EGL.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Since:**
**Since**
8
......@@ -16,58 +18,61 @@ Provides the native window capability for connection to the EGL.
### Files
| Name | Description |
| Name| Description|
| -------- | -------- |
| [external_window.h](external__window_8h.md) | Defines the functions for obtaining and using a native window. <br>File to Include: <native_window/external_window.h> |
| [external_window.h](external__window_8h.md) | Defines the functions for obtaining and using a native window.<br>File to include: <native_window/external_window.h>|
### Structs
| Name | Description |
| Name| Description|
| -------- | -------- |
| [Region](_region.md) | Defines the rectangle (dirty region) where the content is to be updated in the local native window. |
| [OHHDRMetaData](_o_h_h_d_r_meta_data.md) | Defines the HDR metadata. |
| [OHExtDataHandle](_o_h_ext_data_handle.md) | Defines the extended data handle. |
| [Region](_region.md) | Defines the rectangle (dirty region) where the content is to be updated in the local native window.|
| [OHHDRMetaData<sup>(deprecated)](_o_h_h_d_r_meta_data.md) | Defines the HDR metadata. This struct is deprecated since API version 9 and is expected to be deleted from API version 14.|
| [OHExtDataHandle<sup>(deprecated)](_o_h_ext_data_handle.md) | Defines the extended data handle. This struct is deprecated since API version 9 and is expected to be deleted from API version 14.|
### Types
| Name | Description |
| Name| Description|
| -------- | -------- |
| OHNativeWindow | Provides the function of accessing the **NativeWindow**. |
| OHNativeWindowBuffer | Provides the function of accessing the **NativeWindowBuffer**. |
| Region | Defines the rectangle (dirty region) where the content is to be updated in the local native window. |
| OHNativeWindow | Provides the function of accessing the **NativeWindow**.|
| OHNativeWindowBuffer | Provides the function of accessing the **NativeWindow**.|
| Region | Defines the rectangle (dirty region) where the content is to be updated in the local native window.|
### Enums
| Name | Description |
| Name| Description|
| -------- | -------- |
| [NativeWindowOperation](#nativewindowoperation) {<br/>SET_BUFFER_GEOMETRY, GET_BUFFER_GEOMETRY, GET_FORMAT, SET_FORMAT,<br/>GET_USAGE, SET_USAGE, SET_STRIDE, GET_STRIDE,<br/>SET_SWAP_INTERVAL, GET_SWAP_INTERVAL, SET_TIMEOUT, GET_TIMEOUT,<br/>SET_COLOR_GAMUT, GET_COLOR_GAMUT, SET_TRANSFORM, GET_TRANSFORM,<br/>SET_UI_TIMESTAMP<br/>} | Enumerates the operation codes in the **OH_NativeWindow_NativeWindowHandleOpt** function. |
| [OHScalingMode](#ohscalingmode) { OH_SCALING_MODE_FREEZE = 0, OH_SCALING_MODE_SCALE_TO_WINDOW, OH_SCALING_MODE_SCALE_CROP, OH_SCALING_MODE_NO_SCALE_CROP } | Enumerates the scaling modes. |
| [OHHDRMetadataKey](#ohhdrmetadatakey) {<br/>OH_METAKEY_RED_PRIMARY_X = 0, OH_METAKEY_RED_PRIMARY_Y = 1, OH_METAKEY_GREEN_PRIMARY_X = 2, OH_METAKEY_GREEN_PRIMARY_Y = 3,<br/>OH_METAKEY_BLUE_PRIMARY_X = 4, OH_METAKEY_BLUE_PRIMARY_Y = 5, OH_METAKEY_WHITE_PRIMARY_X = 6, OH_METAKEY_WHITE_PRIMARY_Y = 7,<br/>OH_METAKEY_MAX_LUMINANCE = 8, OH_METAKEY_MIN_LUMINANCE = 9, OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,<br/>OH_METAKEY_HDR10_PLUS = 12, OH_METAKEY_HDR_VIVID = 13<br/>} | Enumerates the HDR metadata keys. |
| [NativeWindowOperation](#nativewindowoperation) { SET_BUFFER_GEOMETRY, GET_BUFFER_GEOMETRY, GET_FORMAT, SET_FORMAT, GET_USAGE, SET_USAGE, SET_STRIDE, GET_STRIDE, SET_SWAP_INTERVAL, GET_SWAP_INTERVAL, SET_TIMEOUT, GET_TIMEOUT, SET_COLOR_GAMUT, GET_COLOR_GAMUT, SET_TRANSFORM, GET_TRANSFORM, SET_UI_TIMESTAMP } | Enumerates the operation codes in the **OH_NativeWindow_NativeWindowHandleOpt** function.|
| [OHScalingMode<sup>(deprecated)](#ohscalingmode) { OH_SCALING_MODE_FREEZE = 0, OH_SCALING_MODE_SCALE_TO_WINDOW, OH_SCALING_MODE_SCALE_CROP, OH_SCALING_MODE_NO_SCALE_CROP } | Enumerates the scaling modes. This enum is deprecated since API version 9 and is expected to be deleted from API version 14.|
| [OHHDRMetadataKey<sup>(deprecated)](#ohhdrmetadatakey) { OH_METAKEY_RED_PRIMARY_X = 0, OH_METAKEY_RED_PRIMARY_Y = 1, OH_METAKEY_GREEN_PRIMARY_X = 2, OH_METAKEY_GREEN_PRIMARY_Y = 3, OH_METAKEY_BLUE_PRIMARY_X = 4, OH_METAKEY_BLUE_PRIMARY_Y = 5, OH_METAKEY_WHITE_PRIMARY_X = 6, OH_METAKEY_WHITE_PRIMARY_Y = 7, OH_METAKEY_MAX_LUMINANCE = 8, OH_METAKEY_MIN_LUMINANCE = 9, OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, OH_METAKEY_HDR10_PLUS = 12, OH_METAKEY_HDR_VIVID = 13 } | Enumerates the HDR metadata keys. This enum is deprecated since API version 9 and is expected to be deleted from API version 14.|
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| [OH_NativeWindow_CreateNativeWindow](#oh_nativewindow_createnativewindow) (void \*pSurface) | Creates a **NativeWindow** instance. A new **NativeWindow** instance is created each time this function is called. |
| [OH_NativeWindow_DestroyNativeWindow](#oh_nativewindow_destroynativewindow) (OHNativeWindow \*window) | Decreases the reference count of a **NativeWindow** instance by 1 and when the reference count reaches 0, destroys the instance. |
| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](#oh_nativewindow_createnativewindowbufferfromsurfacebuffer) (void \*pSurfaceBuffer) | Creates a **NativeWindowBuffer** instance. A new **NativeWindowBuffer** instance is created each time this function is called. |
| [OH_NativeWindow_DestroyNativeWindowBuffer](#oh_nativewindow_destroynativewindowbuffer) (OHNativeWindowBuffer \*buffer) | Decreases the reference count of a **NativeWindowBuffer** instance by 1 and when the reference count reaches 0, destroys the instance. |
| [OH_NativeWindow_NativeWindowRequestBuffer](#oh_nativewindow_nativewindowrequestbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests a **NativeWindowBuffer** through a **NativeWindow** instance for content production. |
| [OH_NativeWindow_NativeWindowFlushBuffer](#oh_nativewindow_nativewindowflushbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, [Region](_region.md) region) | Flushes the **NativeWindowBuffer** filled with the content to the buffer queue through a **NativeWindow** instance for content consumption. |
| [OH_NativeWindow_NativeWindowAbortBuffer](#oh_nativewindow_nativewindowabortbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer) | Returns the **NativeWindowBuffer** to the buffer queue through a **NativeWindow** instance, without filling in any content. The **NativeWindowBuffer** can be used for another request. |
| [OH_NativeWindow_NativeWindowHandleOpt](#oh_nativewindow_nativewindowhandleopt) (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of a native window, including the width, height, and content format. |
| [OH_NativeWindow_GetBufferHandleFromNative](#oh_nativewindow_getbufferhandlefromnative) (OHNativeWindowBuffer \*buffer) | Obtains the pointer to a **BufferHandle** of a **NativeWindowBuffer** instance. |
| [OH_NativeWindow_NativeObjectReference](#oh_nativewindow_nativeobjectreference) (void \*obj) | Adds the reference count of a native object. |
| [OH_NativeWindow_NativeObjectUnreference](#oh_nativewindow_nativeobjectunreference) (void \*obj) | Decreases the reference count of a native object and when the reference count reaches 0, destroys this object. |
| [OH_NativeWindow_GetNativeObjectMagic](#oh_nativewindow_getnativeobjectmagic) (void \*obj) | Obtains the magic ID of a native object. |
| [OH_NativeWindow_NativeWindowSetScalingMode](#oh_nativewindow_nativewindowsetscalingmode) (OHNativeWindow \*window, uint32_t sequence, [OHScalingMode](#ohscalingmode) scalingMode) | Sets the scaling mode for a native window. |
| [OH_NativeWindow_NativeWindowSetMetaData](#oh_nativewindow_nativewindowsetmetadata) (OHNativeWindow \*window, uint32_t sequence, int32_t size, const [OHHDRMetaData](_o_h_h_d_r_meta_data.md) \*metaData) | Sets the metadata for a native window. |
| [OH_NativeWindow_NativeWindowSetMetaDataSet](#oh_nativewindow_nativewindowsetmetadataset) (OHNativeWindow \*window, uint32_t sequence, [OHHDRMetadataKey](#ohhdrmetadatakey) key, int32_t size, const uint8_t \*metaData) | Sets the metadata set for a native window. |
| [OH_NativeWindow_NativeWindowSetTunnelHandle](#oh_nativewindow_nativewindowsettunnelhandle) (OHNativeWindow \*window, const [OHExtDataHandle](_o_h_ext_data_handle.md) \*handle) | Sets a tunnel handle for a native window. |
| [OH_NativeWindow_CreateNativeWindow](#oh_nativewindow_createnativewindow) (void \*pSurface) | Creates a **NativeWindow** instance. A new **NativeWindow** instance is created each time this function is called.|
| [OH_NativeWindow_DestroyNativeWindow](#oh_nativewindow_destroynativewindow) (OHNativeWindow \*window) | Decreases the reference count of a **NativeWindow** instance by 1 and when the reference count reaches 0, destroys the instance.|
| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](#oh_nativewindow_createnativewindowbufferfromsurfacebuffer) (void \*pSurfaceBuffer) | Creates a **NativeWindowBuffer** instance. A new **NativeWindowBuffer** instance is created each time this function is called.|
| [OH_NativeWindow_DestroyNativeWindowBuffer](#oh_nativewindow_destroynativewindowbuffer) (OHNativeWindowBuffer \*buffer) | Decreases the reference count of a **NativeWindowBuffer** instance by 1 and when the reference count reaches 0, destroys the instance.|
| [OH_NativeWindow_NativeWindowRequestBuffer](#oh_nativewindow_nativewindowrequestbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests a **NativeWindowBuffer** through a **NativeWindow** instance for content production.|
| [OH_NativeWindow_NativeWindowFlushBuffer](#oh_nativewindow_nativewindowflushbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, [Region](_region.md) region) | Flushes the **NativeWindowBuffer** filled with the content to the buffer queue through a **NativeWindow** instance for content consumption.|
| [OH_NativeWindow_NativeWindowAbortBuffer](#oh_nativewindow_nativewindowabortbuffer) (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer) | Returns the **NativeWindowBuffer** to the buffer queue through a **NativeWindow** instance, without filling in any content. The **NativeWindowBuffer** can be used for another request.|
| [OH_NativeWindow_NativeWindowHandleOpt](#oh_nativewindow_nativewindowhandleopt) (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of a native window, including the width, height, and content format.|
| [OH_NativeWindow_GetBufferHandleFromNative](#oh_nativewindow_getbufferhandlefromnative) (OHNativeWindowBuffer \*buffer) | Obtains the pointer to a **BufferHandle** of a **NativeWindowBuffer** instance.|
| [OH_NativeWindow_NativeObjectReference](#oh_nativewindow_nativeobjectreference) (void \*obj) | Adds the reference count of a native object.|
| [OH_NativeWindow_NativeObjectUnreference](#oh_nativewindow_nativeobjectunreference) (void \*obj) | Decreases the reference count of a native object and when the reference count reaches 0, destroys this object.|
| [OH_NativeWindow_GetNativeObjectMagic](#oh_nativewindow_getnativeobjectmagic) (void \*obj) | Obtains the magic ID of a native object.|
| [OH_NativeWindow_NativeWindowSetScalingMode<sup>(deprecated)](#oh_nativewindow_nativewindowsetscalingmode) (OHNativeWindow \*window, uint32_t sequence, [OHScalingMode](#ohscalingmode) scalingMode) | Sets the scaling mode for a native window. This function is deprecated since API version 9 and is expected to be deleted from API version 14.|
| [OH_NativeWindow_NativeWindowSetMetaData<sup>(deprecated)](#oh_nativewindow_nativewindowsetmetadata) (OHNativeWindow \*window, uint32_t sequence, int32_t size, const [OHHDRMetaData](_o_h_h_d_r_meta_data.md) \*metaData) | Sets the metadata for a native window. This function is deprecated since API version 9 and is expected to be deleted from API version 14.|
| [OH_NativeWindow_NativeWindowSetMetaDataSet<sup>(deprecated)](#oh_nativewindow_nativewindowsetmetadataset) (OHNativeWindow \*window, uint32_t sequence, [OHHDRMetadataKey](#ohhdrmetadatakey) key, int32_t size, const uint8_t \*metaData) | Sets the metadata set for a native window. This function is deprecated since API version 9 and is expected to be deleted from API version 14.|
| [OH_NativeWindow_NativeWindowSetTunnelHandle<sup>(deprecated)](#oh_nativewindow_nativewindowsettunnelhandle) (OHNativeWindow \*window, const [OHExtDataHandle](_o_h_ext_data_handle.md) \*handle) | Sets a tunnel handle for a native window. This function is deprecated since API version 9 and is expected to be deleted from API version 14.|
## Detailed Description
## Enum Description
......@@ -79,72 +84,78 @@ Provides the native window capability for connection to the EGL.
```
enum NativeWindowOperation
```
**Description**<br>
**Description**
Enumerates the operation codes in the **OH_NativeWindow_NativeWindowHandleOpt** function.
| Name | Description |
| Value| Description|
| -------- | -------- |
| SET_BUFFER_GEOMETRY | Setting the geometry for the local window buffer. Variable arguments in the function: [Input] int32_t height and [Input] int32_t width. |
| GET_BUFFER_GEOMETRY | Obtaining the geometry of the local window buffer. Variable arguments in the function: [Output] int32_t \*height and [Output] int32_t \*width. |
| GET_FORMAT | Obtaining the format of the local window buffer. Variable argument in the function: [Output] int32_t \*format. |
| SET_FORMAT | Setting the format for the local window buffer. Variable argument in the function: [Input] int32_t format. |
| GET_USAGE | Obtaining the usage mode of the local window buffer. Variable argument in the function: [Output] int32_t \*usage. |
| SET_USAGE | Setting the usage mode for the local window buffer. Variable argument in the function: [Input] int32_t usage. |
| SET_STRIDE | Setting the stride for the local window buffer. Variable argument in the function: [Input] int32_t stride. |
| GET_STRIDE | Obtaining the stride of the local window buffer. Variable argument in the function: [Output] int32_t \*stride. |
| SET_SWAP_INTERVAL | Setting the swap interval for the local window buffer. Variable argument in the function: [Input] int32_t interval. |
| GET_SWAP_INTERVAL | Obtaining the swap interval of the local window buffer. Variable argument in the function: [Output] int32_t \*interval. |
| SET_TIMEOUT | Setting the timeout duration for requesting the local window buffer. Variable argument in the function: [Input] int32_t timeout. |
| GET_TIMEOUT | Obtaining the timeout duration for requesting the local window buffer. Variable argument in the function: [Output] int32_t \*timeout. |
| SET_COLOR_GAMUT | Setting the color gamut for the local window buffer. Variable argument in the function: [Input] int32_t colorGamut. |
| GET_COLOR_GAMUT | Obtaining the color gamut of the local window buffer. Variable argument in the function: [out int32_t \*colorGamut]. |
| SET_TRANSFORM | Setting the transform for the local window buffer. Variable argument in the function: [Input] int32_t transform. |
| GET_TRANSFORM | Obtaining the transform of the local window buffer. Variable argument in the function: [Output] int32_t \*transform. |
| SET_UI_TIMESTAMP | Setting the UI timestamp for the local window buffer. Variable argument in the function: [Input] uint64_t uiTimestamp. |
| SET_BUFFER_GEOMETRY | Setting the geometry for the local window buffer.<br>Variable arguments in the function: [Input] int32_t height and [Input] int32_t width.|
| GET_BUFFER_GEOMETRY | Obtaining the geometry of the local window buffer.<br>Variable arguments in the function: [Output] int32_t *height and [Output] int32_t *width.|
| GET_FORMAT | Obtaining the format of the local window buffer.<br>Variable argument in the function: [Output] int32_t *format.|
| SET_FORMAT | Setting the format for the local window buffer.<br>Variable argument in the function: [Input] int32_t format.|
| GET_USAGE | Obtaining the usage mode of the local window buffer.<br>Variable argument in the function: [Output] int32_t *usage.|
| SET_USAGE | Setting the usage mode of the local window buffer.<br>Variable argument in the function: [Input] int32_t usage.|
| SET_STRIDE | Setting the stride for the local window buffer.<br>Variable argument in the function: [Input] int32_t stride.|
| GET_STRIDE | Obtaining the stride of the local window buffer.<br>Variable argument in the function: [Output] int32_t *stride.|
| SET_SWAP_INTERVAL | Setting the swap interval for the local window buffer.<br>Variable argument in the function: [Input] int32_t interval.|
| GET_SWAP_INTERVAL | Obtaining the swap interval of the local window buffer.<br>Variable argument in the function: [Output] int32_t *interval.|
| SET_TIMEOUT | Setting the timeout duration for requesting the local window buffer.<br>Variable argument in the function: [Input] int32_t timeout.|
| GET_TIMEOUT | Obtaining the timeout duration for requesting the local window buffer.<br>Variable argument in the function: [Output] int32_t *timeout.|
| SET_COLOR_GAMUT | Setting the color gamut for the local window buffer.<br>Variable argument in the function: [Input] int32_t colorGamut.|
| GET_COLOR_GAMUT | Obtaining the color gamut of the local window buffer.<br>Variable argument in the function: [Output] int32_t *colorGamut.|
| SET_TRANSFORM | Setting the transform for the local window buffer.<br>Variable argument in the function: [Input] int32_t transform.|
| GET_TRANSFORM | Obtaining the transform of the local window buffer.<br>Variable argument in the function: [Output] int32_t *transform.|
| SET_UI_TIMESTAMP | Setting the UI timestamp for the local window buffer.<br>Variable argument in the function: [Input] uint64_t uiTimestamp.|
### OHHDRMetadataKey
### OHHDRMetadataKey<sup>(deprecated)
```
enum OHHDRMetadataKey
```
**Description**<br>
Enumerates the HDR metadata keys.
| Name | Description |
**Description**
Enumerates the HDR metadata keys. This enum is deprecated since API version 9 and is expected to be deleted from API version 14.
| Value| Description|
| -------- | -------- |
| OH_METAKEY_RED_PRIMARY_X | X coordinate of the red primary color. |
| OH_METAKEY_RED_PRIMARY_Y | Y coordinate of the red primary color. |
| OH_METAKEY_GREEN_PRIMARY_X | X coordinate of the green primary color. |
| OH_METAKEY_GREEN_PRIMARY_Y | Y coordinate of the green primary color. |
| OH_METAKEY_BLUE_PRIMARY_X | X coordinate of the blue primary color. |
| OH_METAKEY_BLUE_PRIMARY_Y | Y coordinate of the blue primary color. |
| OH_METAKEY_WHITE_PRIMARY_X | X coordinate of the white point. |
| OH_METAKEY_WHITE_PRIMARY_Y | Y coordinate of the white point. |
| OH_METAKEY_MAX_LUMINANCE | Maximum luminance. |
| OH_METAKEY_MIN_LUMINANCE | Minimum luminance. |
| OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL | Maximum content light level (MaxCLL). |
| OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL | Maximum frame average light level (MaxFALLL). |
| OH_METAKEY_HDR10_PLUS | HDR10+. |
| OH_METAKEY_HDR_VIVID | Vivid. |
| OH_METAKEY_RED_PRIMARY_X | X coordinate of the red primary color.|
| OH_METAKEY_RED_PRIMARY_Y | Y coordinate of the red primary color.|
| OH_METAKEY_GREEN_PRIMARY_X | X coordinate of the green primary color.|
| OH_METAKEY_GREEN_PRIMARY_Y | Y coordinate of the green primary color.|
| OH_METAKEY_BLUE_PRIMARY_X | X coordinate of the blue primary color.|
| OH_METAKEY_BLUE_PRIMARY_Y | Y coordinate of the blue primary color.|
| OH_METAKEY_WHITE_PRIMARY_X | X coordinate of the white point.|
| OH_METAKEY_WHITE_PRIMARY_Y | Y coordinate of the white point.|
| OH_METAKEY_MAX_LUMINANCE | Maximum luminance.|
| OH_METAKEY_MIN_LUMINANCE | Minimum luminance.|
| OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL | Maximum content light level (MaxCLL).|
| OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL | Maximum frame average light level (MaxFALLL).|
| OH_METAKEY_HDR10_PLUS | HDR10 Plus |
| OH_METAKEY_HDR_VIVID | Vivid |
### OHScalingMode
### OHScalingMode<sup>(deprecated)
```
enum OHScalingMode
```
**Description**<br>
Enumerates the scaling modes.
| Name | Description |
**Description**
Enumerates the scaling modes. This enum is deprecated since API version 9 and is expected to be deleted from API version 14.
| Value| Description|
| -------- | -------- |
| OH_SCALING_MODE_FREEZE | The window content cannot be updated before the buffer of the window size is received. |
| OH_SCALING_MODE_SCALE_TO_WINDOW | The buffer is scaled in two dimensions to match the window size. |
| OH_SCALING_MODE_SCALE_CROP | The buffer is scaled uniformly so that its smaller size can match the window size. |
| OH_SCALING_MODE_NO_SCALE_CROP | The window is cropped to the size of the buffer's cropping rectangle. Pixels outside the cropping rectangle are considered completely transparent. |
| OH_SCALING_MODE_FREEZE | The window content cannot be updated before the buffer of the window size is received.|
| OH_SCALING_MODE_SCALE_TO_WINDOW | The buffer is scaled in two dimensions to match the window size.|
| OH_SCALING_MODE_SCALE_CROP | The buffer is scaled uniformly so that its smaller size can match the window size.|
| OH_SCALING_MODE_NO_SCALE_CROP | The window is cropped to the size of the buffer's cropping rectangle. Pixels outside the cropping rectangle are considered completely transparent.|
## Function Description
......@@ -156,21 +167,27 @@ Enumerates the scaling modes.
```
OHNativeWindow* OH_NativeWindow_CreateNativeWindow (void * pSurface)
```
**Description**<br>
**Description**
Creates a **NativeWindow** instance. A new **NativeWindow** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| pSurface | Indicates the pointer to a **ProduceSurface**. The type is **sptr&lt;OHOS::Surface&gt;**. |
| pSurface | Indicates the pointer to a **ProduceSurface**. The type is **sptr&lt;OHOS::Surface&gt;**.|
**Returns**
Returns the pointer to the **NativeWindow** instance created.
**Since**
8
### OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer()
......@@ -178,21 +195,27 @@ Returns the pointer to the **NativeWindow** instance created.
```
OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void * pSurfaceBuffer)
```
**Description**<br>
**Description**
Creates a **NativeWindowBuffer** instance. A new **NativeWindowBuffer** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| pSurfaceBuffer | Indicates the pointer to a produce buffer. The type is **sptr&lt;OHOS::SurfaceBuffer&gt;**. |
| pSurfaceBuffer | Indicates the pointer to a **ProduceSurface**. The type is **sptr&lt;OHOS::SurfaceBuffer&gt;**.|
**Returns**
Returns the pointer to the **NativeWindowBuffer** instance created.
**Since**
8
### OH_NativeWindow_DestroyNativeWindow()
......@@ -200,16 +223,22 @@ Returns the pointer to the **NativeWindowBuffer** instance created.
```
void OH_NativeWindow_DestroyNativeWindow (OHNativeWindow * window)
```
**Description**<br>
**Description**
Decreases the reference count of a **NativeWindow** instance by 1 and when the reference count reaches 0, destroys the instance.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| window | Indicates the pointer to a **NativeWindow** instance.|
**Since**
8
### OH_NativeWindow_DestroyNativeWindowBuffer()
......@@ -218,16 +247,22 @@ Decreases the reference count of a **NativeWindow** instance by 1 and when the r
```
void OH_NativeWindow_DestroyNativeWindowBuffer (OHNativeWindowBuffer * buffer)
```
**Description**<br>
**Description**
Decreases the reference count of a **NativeWindowBuffer** instance by 1 and when the reference count reaches 0, destroys the instance.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance. |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance.|
**Since**
8
### OH_NativeWindow_GetBufferHandleFromNative()
......@@ -236,21 +271,27 @@ Decreases the reference count of a **NativeWindowBuffer** instance by 1 and when
```
BufferHandle* OH_NativeWindow_GetBufferHandleFromNative (OHNativeWindowBuffer * buffer)
```
**Description**<br>
**Description**
Obtains the pointer to a **BufferHandle** of a **NativeWindowBuffer** instance.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance. |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance.|
**Returns**
Returns the pointer to the **BufferHandle** instance obtained.
**Since**
8
### OH_NativeWindow_GetNativeObjectMagic()
......@@ -258,21 +299,27 @@ Returns the pointer to the **BufferHandle** instance obtained.
```
int32_t OH_NativeWindow_GetNativeObjectMagic (void * obj)
```
**Description**<br>
**Description**
Obtains the magic ID of a native object.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance. |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance.|
**Returns**
Returns the magic ID, which is unique for each native object.
**Since**
8
### OH_NativeWindow_NativeObjectReference()
......@@ -280,21 +327,27 @@ Returns the magic ID, which is unique for each native object.
```
int32_t OH_NativeWindow_NativeObjectReference (void * obj)
```
**Description**<br>
**Description**
Adds the reference count of a native object.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance. |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeObjectUnreference()
......@@ -302,21 +355,27 @@ Returns an error code defined in **GSError**.
```
int32_t OH_NativeWindow_NativeObjectUnreference (void * obj)
```
**Description**<br>
**Description**
Decreases the reference count of a native object and when the reference count reaches 0, destroys this object.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance. |
| obj | Indicates the pointer to a **NativeWindow** or **NativeWindowBuffer** instance.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeWindowAbortBuffer()
......@@ -324,22 +383,28 @@ Returns an error code defined in **GSError**.
```
int32_t OH_NativeWindow_NativeWindowAbortBuffer (OHNativeWindow * window, OHNativeWindowBuffer * buffer )
```
**Description**<br>
**Description**
Returns the **NativeWindowBuffer** to the buffer queue through a **NativeWindow** instance, without filling in any content. The **NativeWindowBuffer** can be used for another request.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeWindowFlushBuffer()
......@@ -347,24 +412,30 @@ Returns an error code defined in **GSError**.
```
int32_t OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow * window, OHNativeWindowBuffer * buffer, int fenceFd, Region region )
```
**Description**<br>
**Description**
Flushes the **NativeWindowBuffer** filled with the content to the buffer queue through a **NativeWindow** instance for content consumption.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance. |
| fenceFd | Indicates a file descriptor handle, which is used for timing synchronization. |
| region | Indicates a dirty region where content is updated. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| buffer | Indicates the pointer to a **NativeWindowBuffer** instance.|
| fenceFd | Indicates a file descriptor handle, which is used for timing synchronization.|
| region | Indicates a dirty region where content is updated.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeWindowHandleOpt()
......@@ -372,23 +443,29 @@ Returns an error code defined in **GSError**.
```
int32_t OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow * window, int code, ... )
```
**Description**<br>
**Description**
Sets or obtains the attributes of a native window, including the width, height, and content format.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| code | Indicates the operation code. For details, see [NativeWindowOperation](#nativewindowoperation). |
| ... | Indicates the variable argument, which must correspond to the operation code. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| code | Indicates the operation code. For details, see [NativeWindowOperation](#nativewindowoperation).|
| ... | Indicates the variable argument, which must correspond to the operation code.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeWindowRequestBuffer()
......@@ -396,117 +473,151 @@ Returns an error code defined in **GSError**.
```
int32_t OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow * window, OHNativeWindowBuffer ** buffer, int * fenceFd )
```
**Description**<br>
**Description**
Requests a **NativeWindowBuffer** through a **NativeWindow** instance for content production.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| buffer | Indicates the double pointer to a **NativeWindowBuffer** instance. |
| fenceFd | Indicates the pointer to a file descriptor handle. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| buffer | Indicates the double pointer to a **NativeWindowBuffer** instance.|
| fenceFd | Indicates the pointer to a file descriptor handle.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
8
### OH_NativeWindow_NativeWindowSetMetaData()
### OH_NativeWindow_NativeWindowSetMetaData()<sup>(deprecated)
```
int32_t OH_NativeWindow_NativeWindowSetMetaData (OHNativeWindow * window, uint32_t sequence, int32_t size, const OHHDRMetaData * metaData )
```
**Description**<br>
**Description**
Sets the metadata for a native window.
This function is deprecated since API version 9 and is expected to be deleted from API version 14.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| sequence | Indicates the sequence of the producer buffer. |
| size | Indicates the size of the **[OHHDRMetaData](_o_h_h_d_r_meta_data.md)** array. |
| metaData | Indicates the pointer to the **[OHHDRMetaData](_o_h_h_d_r_meta_data.md)** array. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| sequence | Indicates the sequence of the producer buffer.|
| size | Indicates the size of the **OHHDRMetaData** array.|
| metaData| Indicates the pointer to the **OHHDRMetaData** array.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
9
### OH_NativeWindow_NativeWindowSetMetaDataSet()
### OH_NativeWindow_NativeWindowSetMetaDataSet()<sup>(deprecated)
```
int32_t OH_NativeWindow_NativeWindowSetMetaDataSet (OHNativeWindow * window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t * metaData )
```
**Description**<br>
**Description**
Sets the metadata set for a native window.
This function is deprecated since API version 9 and is expected to be deleted from API version 14.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| sequence | Indicates the sequence of the producer buffer. |
| key | Indicates a metadata key. For details, see **OHHDRMetadataKey**. |
| size | Indicates the size of the uint8_t vector. |
| metaData | Indicates the pointer to the uint8_t vector. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| sequence | Indicates the sequence of the producer buffer.|
| key | Indicates a metadata key. For details, see [OHHDRMetadataKey](#ohhdrmetadatakey).|
| size | Indicates the size of the uint8_t vector.|
| metaData| Indicates the pointer to the uint8_t vector.|
**Returns**
Returns an error code defined in **GSError**.
**Since**
### OH_NativeWindow_NativeWindowSetScalingMode()
9
### OH_NativeWindow_NativeWindowSetScalingMode()<sup>(deprecated)
```
int32_t OH_NativeWindow_NativeWindowSetScalingMode (OHNativeWindow * window, uint32_t sequence, OHScalingMode scalingMode )
```
**Description**<br>
**Description**
Sets the scaling mode for a native window.
This function is deprecated since API version 9 and is expected to be deleted from API version 14.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| sequence | Indicates the sequence of the producer buffer. |
| scalingMode | Indicates the scaling mode to set. For details, see **OHScalingMode**. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| sequence | Indicates the sequence of the producer buffer.|
| scalingMode | Indicates the scaling mode to set. For details, see [OHScalingMode](#ohscalingmode).|
**Returns**
Returns an error code defined in **GSError**.
**Since**
9
### OH_NativeWindow_NativeWindowSetTunnelHandle()
### OH_NativeWindow_NativeWindowSetTunnelHandle()<sup>(deprecated)
```
int32_t OH_NativeWindow_NativeWindowSetTunnelHandle (OHNativeWindow * window, const OHExtDataHandle * handle )
```
**Description**<br>
**Description**
Sets a tunnel handle for a native window.
This function is deprecated since API version 9 and is expected to be deleted from API version 14.
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| window | Indicates the pointer to a **NativeWindow** instance. |
| handle | Indicates the pointer to an **[OHExtDataHandle](_o_h_ext_data_handle.md)**. |
| window | Indicates the pointer to a **NativeWindow** instance.|
| handle | Indicates the pointer to an [OHExtDataHandle](_o_h_ext_data_handle.md).|
**Returns**
Returns an error code defined in **GSError**.
**Since**
9
......@@ -19,7 +19,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| Name| Description|
| -------- | -------- |
| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include:: <multimedia/image_framework/image_pixel_map_napi.h>|
| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include: <multimedia/image_framework/image_pixel_map_napi.h> |
### Structs
......
# Packaging Tool
# Packing and Unpacking Tools
## Overview
The packing tool packs compiled files for installation and release. The packing tool supports the generation of application packages (HAP), application sets (APP) to launch to the application market, quick fix packages (HQF), quick fix packages (APPQF) to launch to the application market, static shared libraries (HAR), and dynamic shared libraries (HSP). The unpacking tool is used to unpack the HAP, APP, HQF, APPQF, HAR, and HSP files and parse the HAP, HSP, APP, and APPQF files. Generally, the packing process is automatically carried out in DevEco Studio. However, you can also use the JAR package of the packing tool to pack files. The JAR package is stored in the **toolchains** directory in the SDK path.
The packaging tool is a commissioning tool provided by OpenHarmony. It can generate HAP files in command line mode, pack multiple HAP files into an App Pack, or pack multiple HAP files and App Packs into an App Pack. App Pack is the application package format required for releasing an application on AppGallery.
## Packing Commands
### Packing Commands for HAP Files
The **app_packing_tool.jar** package can be found in the OpenHarmony SDK downloaded locally.
You can use the JAR package of the packing tool to generate an HAP file by importing packing options and file paths.
#### Example
- Packing folders into an HAP file
- A packing command example in the stage model:
The command in the stage model is as follows:
```
java -jar app_packing_tool.jar --mode hap --json-path <option> --resources-path <option> --ets-path <option> --index-path <option> --pack-info-path <option> --out-path path\out\srcEntrance.hap --force true
```
```bash
java -jar app_packing_tool.jar --mode <option> --json-path <option> --resources-path <option> --ets-path <option> --index-path <option> --pack-info-path <option> --out-path <option> --force <option>
- A packing command example in the FA model:
```
java -jar app_packing_tool.jar --mode hap --json-path <option> --maple-so-path [option] --profile-path [option] --maple-so-dir [option] --dex-path [option] --lib-path [option] --resources-path [option] --index-path [option] --out-path <option> --force [option]
```
#### Parameters
| Name | Mandatory| Option | Description | Remarks |
|------------------|-------|----------------------|-----------------------------------------------------------|------------|
| --mode | Yes | hap | Packing mode. | NA |
| --json-path | Yes | NA | Path of the JSON file. The file name must be **config.json** in the FA model and **module.json** in the stage model.| NA |
| --profile-path | No | NA | Path of the **CAPABILITY.profile** file. | NA |
| --maple-so-path | No | NA | Path of the Maple SO file. The file name extension must be .so. If there are multiple SO files, separate them with commas (,). | NA |
| --maple-so-dir | No | NA | Path of the maple SO directory. | NA |
| --dex-path | No | NA | Path of the DEX file. The file name extension must be .dex. If there are multiple DEX files, separate them with commas (,).<br>The value can also be the directory (folder) where the DEX file is stored.| NA |
| --lib-path | No | NA | Path of the library file. | NA |
| --resources-path | No | NA | Path of the resource file. | NA |
| --index-path | No | NA | Path of the INDEX file. The file name must be **resources.index**. | NA |
| --pack-info-path | No | NA | Path of the **pack.info** file. The file name must be **pack.info**. | NA |
| --rpcid-path | No | NA | Path of the **rpcid.sc** file. The file name must be **rpcid.sc**. | NA |
| --js-path | No | NA | Path of the JS file. | This parameter is valid only in the stage model.|
| --ets-path | No | NA | Path of the ETS file. | This parameter is valid only in the stage model.|
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hap. | NA |
| --force | No | true or false | The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. | NA |
| --an-path | No | NA | Path of the AN file. | This parameter is valid only in the stage model.|
| --ap-path | No | NA | Path of the AP file. | This parameter is valid only in the stage model.|
| --dir-list | No | NA | List of directories (folders) to be packed into the HAP file. | NA |
### Packing Commands for HAR Files
You can use the JAR package of the packing tool to generate an HAR file by importing packing options and file paths.
#### Example
```
java -jar app_packing_tool.jar --mode har --json-path [option] --jar-path [option]--lib-path [option] --resources-path [option] --out-path [option] --force [option]
```
#### Parameters
| Name | Mandatory| Option | Description |
|-----------------|-------|-------------|-----------------------------------------------------------|
| --mode | Yes | har | Packing mode. |
| --json-path | Yes | NA | Path of the JSON file. The file name must be **config.json** in the FA model and **module.json** in the stage model.|
| --jar-path | No | NA | Path of the JAR file. The file name extension must be .jar. If there are multiple JAR files, separate them with commas (,).<br>The value can also be the directory (folder) where the JAR file is stored.|
| --lib-path | No | NA | Path of the library file. |
| --resource-path | Yes | NA | Path of the resource file. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .har. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
### Packing Commands for APP Files
You can use the JAR package of the packing tool to generate an APP file by importing packing options and file paths. The APP file is used to release the application to the application market.
#### Example
```
java -jar app_packing_tool.jar --mode app --hap-path <option> --hsp-path <option> --out-path [option] --signature-path [option] --certificate-path [option] --pack-info [option]--force [option]
```
#### Parameters
| Name | Mandatory| Option | Description |
|--------------------|-------|-------------|--------------------------------------------------------------|
| --mode | Yes | app | Packing mode. Each HAP file to pack into the APP file must pass the validity check. |
| --hap-path | Yes | NA | Path of the HAP file. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored.|
| --hsp-path | No | NA | Path of the HSP file. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored.|
| --pack-info-path | Yes | NA | Path of the **pack.info** file. The file name must be **pack.info**. |
| --out-path | No | NA | Path of the target file. The file name extension must be .app. |
| --signature-path | No | NA | Path of the signature file. |
| --certificate-path | No | NA | Path of the certificate file. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
#### HAP Validity Check During APP Packing
When packing the HAP files in a project to generate an APP file, ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** configured in each JSON file of the HAP are the same, and the value of **moduleName** is unique in all the JSON files. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
### Multi-project Packing
If multiple teams develop the same application but it is inconvenient to share code, you can use multi-project packing, which packs the packed HAP, HSP, and APP files into a final APP file and releases it to the application market.
#### Example
```
java -jar app_packing_tool.jar --mode multiApp --hap-list 1.hap,2.hap --app-list 1.app,2.app --out-path final.app
```
#### Parameters
| Name | Mandatory| Option | Description |
|------------|-------|-----------|-----------------------------------------------------------------------------------------------------|
| --mode | Yes | multiApp | Packing mode. Each HAP file to pack into the APP file must pass the validity check. |
| --hap-list | No | Path of the HAP files | Path of the HAP files. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored. |
| --hsp-list | No | Path of the HSP files | Path of the HSP files. The file name extension must be .hsp. If there are multiple HSP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HSP file is stored. |
| --app-list | No | Path of the APP files | Path of the APP files. The file name extension must be .app. If there are multiple APP files, separate them with commas (,).<br>The value can also be the directory (folder) where the APP file is stored.<br>You must specify **--hap-list**, **--hsp-list**, or **--app-list**, or any of their combinations.|
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
#### HAP Validity Check During Multi-project Packing
Ensure that the values of **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** configured in each JSON file of the HAP are the same, the value of **moduleName** is unique in all the JSON files, and the value of **entry** is unique for the same device. For the FA model, you must also ensure that the value of **package** is unique in all the JSON files.
### Packing Commands for HQF Files
If you find detects in the application and want to rectify the defects quickly, you can use HQF files. You can use the JAR package of the packing tool to generate an HQF file by importing packing options and file paths.
#### Example
```
java -jar app_packing_tool.jar --mode hqf --json-path <option> ---lib-path <option> --ets-path <option> --out-path <option>
```
#### Parameters
| Name | Mandatory| Option | Description |
|-------------|-------|-------------|------------------------------------|
| --mode | Yes | hqf | Packing mode. |
| --json-path | Yes | NA | Path of the JSON file. The file name must be **patch.json**. |
| --lib-path | No | NA | Path of the library file. |
| --ets-path | No | NA | Path of the ETS file. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hqf. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
### Packing Commands for APPQF Files
An APPQF file consists of one or more HQF files. These HQF files are split from an APPQF file in the application market and then distributed to specific devices. You can use the JAR package of the packing tool to generate an APPQF file by importing packing options and file paths.
#### Example
```
java -jar app_packing_tool.jar --mode appqf --hqf-list <option> --out-path <option>
```
#### Parameters
| Name | Mandatory| Option | Description |
|------------|-------|-------------|------------------------------------|
| --mode | Yes | appqf | Packing mode. |
| --hqf-list | Yes | NA | Path of the HQF files. If there are multiple HQF files, separate them with commas (,). |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .appqf. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
### Packing Commands for HSP Files
HSP files enable multiple HAPs to share files. You can use the JAR package of the packing tool to generate an HSP file by importing packing options and file paths.
#### Example
```
java -jar path\app_packing_tool.jar --mode hsp --json-path <option> --resources-path <option> --ets-path <option> --index-path <option> --pack-info-path <option> --out-path path\out\library.hsp --force true
```
#### Parameters
| Name | Mandatory| Option | Description |
|------------------|-------|-------------|-----------------------------------------------------------|
| --mode | Yes | hsp | Packing mode. |
| --json-path | Yes | NA | Path of the JSON file. The file name must be **module.json**. |
| --profile-path | No | NA | Path of the **CAPABILITY.profile** file. |
| --dex-path | No | NA | Path of the DEX file. The file name extension must be .dex. If there are multiple DEX files, separate them with commas (,).<br>The value can also be the directory (folder) where the DEX file is stored.|
| --lib-path | No | NA | Path of the library file. |
| --resources-path | No | NA | Path of the resource file. |
| --index-path | No | NA | Path of the INDEX file. The file name must be **resources.index**. |
| --pack-info-path | No | NA | Path of the **pack.info** file. The file name must be **pack.info**. |
| --js-path | No | NA | Path of the JS file. |
| --ets-path | No | NA | Path of the ETS file. |
| --out-path | Yes | NA | Path of the target file. The file name extension must be .hsp. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing. |
## Unpacking Commands
### Unpacking Commands for HAP Files
You can use the JAR package of the unpacking tool to unpack an HAP file by importing unpacking options and file paths.
#### Example
```
java -jar app_unpacking_tool.jar --mode <option> --hap-path <options> --out-path [option] --force [option]
```
#### Parameters
| Name | Mandatory| Option | Description |
| ---------- | ---------- | ------------- | ------------------------------------------------------------ |
| --mode | Yes | hap | Unpacking mode. |
| --hap-path | Yes | NA | Path of the HAP file. |
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
### Unpacking Commands for HAR Files
You can use the JAR package of the unpacking tool to unpack an HAR file by importing unpacking options and file paths.
#### Example
```
java -jar app_unpacking_tool.jar --mode <options> --har-path <option> --out-path [option] --force [option]
```
#### Parameters
| Name | Mandatory| Option | Description |
| ---------- | ---------- |-------------| ----------------------------------------------------------- |
| --mode | Yes | har | Unpacking mode. |
| --har-path | Yes | NA | Path of the HAR file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Unpacking Commands for APP Files
You can use the JAR package of the unpacking tool to unpack an APP file by importing unpacking options and file paths.
#### Example
```
java -jar app_unpacking_tool.jar --mode <options> --app-path <option> --out-path [option] --force [option]
```
The command in the FA model is as follows:
#### Parameters
| Name | Mandatory| Option | Description |
| ---------- | ---------- |-------------| ----------------------------------------------------------- |
| --mode | Yes | app | Unpacking mode. |
| --app-path | Yes | NA | Path of the APP file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
### Obtaining the rpcid File from the HAP File
You can use the JAR package of the unpacking tool to unpack an HAP file to obtain the rpcid file by importing unpacking options and file paths.
```bash
java -jar app_packing_tool.jar --mode <option> --json-path <option> --maple-so-path <option> --profile-path <option> --maple-so-dir <option> --dex-path <option> --lib-path <option> --resources-path <option> --index-path <option> --out-path <option> --force <option>
#### Example
```
java -jar app_unpacking_tool.jar --mode hap --rpcid true --hap-path <option> --out-path <option> --force true
```
The table below describes the command parameters.
#### Parameters
| Name| Mandatory| Description|
| -------- | -------- | -------- |
| --mode | Yes| Packing mode. In this scenario, set this parameter to **hap**.|
| --json-path | Yes| Path of the .json file. The file name must be **config.json** in the FA model and **module.json5** in the stage model.|
| --profile-path | No| Path of the **CAPABILITY.profile** file.|
| --maple-so-path | No| Path of the maple .so file. The file name extension must be .so. If there are multiple .so files, separate them with commas (,).|
| --maple-so-dir | No| Path of the maple .so directory.|
| --dex-path | No| Path of the .dex file. The file name extension must be .dex. If there are multiple .dex files, separate them with commas (,).<br>The value can also be the directory (folder) where the .dex file is stored.|
| --lib-path | No| Path of the library file.|
| --resources-path | No| Path of the resource file.|
| --index-path | No| Path of the .index file. The file name must be **resources.index**.|
| --pack-info-path | No| Path of the **pack.info** file. The file name must be **pack.info**.|
| --rpcid-path | No| Path of the **rpcid.sc** file. The file name must be **rpcid.sc**.|
| --js-path | No| Path of the .js file. This parameter is valid only for the stage model.|
| --ets-path | No| Path of the .ets file. This parameter is valid only for the stage model.|
| --out-path | Yes| Path of the target file. The file name extension must be .hap.|
| --force | No| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
| Name | Mandatory| Option | Description |
| ---------- | ---------- | ------------- | ------------------------------------------------------------ |
| --mode | Yes | hap | Unpacking mode. |
| --rpcid | No | true or false| Whether to extract the rpcid file from the HAP file to a specified directory. If the value is **true**, only the rpcid file is extracted and the HAP file is not unpacked.|
| --hap-path | Yes | NA | Path of the HAP file. |
| --out-path | Yes | NA | Path of the target rpcid file. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking. |
- Packing multiple HAP files into an App Pack
### Unpacking Commands for HSP Files
The command is as follows:
You can use the JAR package of the unpacking tool to unpack an HSP file by importing unpacking options and file paths.
#### Example
```bash
java -jar app_packing_tool.jar --mode <option> --hap-path <option> --out-path <option> --signature-path <option> --certificate-path <option> --pack-info-path <option> --force <option>
```
java -jar app_unpacking_tool.jar --mode <option> --hsp-path <options> --out-path [option] --force [option]
```
The table below describes the command parameters.
#### Parameters
| Name| Mandatory| Description|
| -------- | -------- | -------- |
| --mode | Yes| Packing mode. In this scenario, set this parameter to **app**. Each HAP file to pack must have the same settings for **versionCode** and **versionName**.|
| --hap-path | Yes| Path of the HAP file. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored.|
| --pack-info-path | Yes| The file name must be **pack.info**.|
| --out-path | Yes| Path of the target file. The file name extension must be .app.|
| --signature-path | No| Signature path.|
| --certificate-path | No| Certificate path. For details, see [Signature Guide](../security/hapsigntool-guidelines.md).|
| --force | No| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
| Name | Mandatory| Option | Description |
|------------| ---------- | ------------- |------------------------------------|
| --mode | Yes | hsp | Unpacking mode. |
| --hsp-path | Yes | NA | Path of the HSP file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
- Packing multiple HAP files and App Packs into an App Pack
### Unpacking Commands for APPQF Files
The command is as follows:
You can use the JAR package of the unpacking tool to unpack an APPQF file by importing unpacking options and file paths.
#### Example
```bash
java -jar app_packing_tool.jar --mode <option> --hap-list <option> --app-list <option> --out-path <option>
```
java -jar app_unpacking_tool.jar --mode <option> --appqf-path <options> --out-path [option] --force [option]
```
#### Parameters
| Name | Mandatory| Option | Description |
|--------------| ---------- |-------------|------------------------------------|
| --mode | Yes | appqf | Unpacking mode. |
| --appqf-path | Yes | NA | Path of the APPQF file. |
| --out-path | Yes | NA | Path of the target files. |
| --force | No | true or false| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during unpacking.|
## Package Parsing APIs
The package parsing APIs are used to parse an HAP file and obtain information such as the configuration file.
### Available APIs
| Class | Prototype | Type | Description |
| ------------------ | ------------------------------------------------------------ | -------- |-------------------------------------------------------------------|
| UncompressEntrance | UncomperssResult parseApp(String appPath,String parseMode,String deviceType,String hapName) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **appPath**, which specifies the path of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseApp(InputStream input,String parseMode,String deviceType,String hapName,String outPath) | Java| Function: Parses **pack.info** in the APP file.<br>Input parameters: **input**, which specifies the stream of the APP file.<br>Return value: **UncomperssResult**.|
| UncompressEntrance | UncomperssResult parseHap(String hapPath) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **hapPath**, which specifies the path of the HAP file.<br>Return value: **UncomperssResult**. |
| UncompressEntrance | UncomperssResult parseHap(InputStream input) | Java| Function: Parses the JSON file in the APP file.<br>Input parameters: **input**, which specifies the stream of the HAP file.<br>Return value: **UncomperssResult**. |
## Fields of the Unpacking Tool
### UncomperssResult (Bundle Information) Struct
| Field | Type | Description | Remarks|
| ------------ | ------------------ |----------------------------------------| ---- |
| result | boolean | Whether the parsing is successful. | NA |
| message | String | Failure cause returned if the parsing fails. | NA |
| packInfos | List\<PackInfo> | Information about **packages** in the **pack.info** file of the bundle. | NA |
| profileInfos | List\<profileInfo> | Configuration information of the application. | NA |
| icon | String | Path of the icon of the entry component. If there is no entry component, the icon path of the first component is returned.| NA |
| label | String | Label of the entry component. If there is no entry component, the label of the first component is returned.| NA |
### PackInfo Struct
| Field | Type | Description | Remarks|
| ------------------- | ------------- | --------------------------------------- | ---- |
| name | String | Bundle name. | NA |
| moduleName | String | HAP (module) name. | NA |
| moduleType | String | Module type. | NA |
| deviceType | List\<String> | Device type supported by the current HAP. | NA |
| deliveryWithInstall | boolean | Whether the HAP is installed when the user installs the application.| NA |
### ProfileInfo Struct
| Field | Type | Description | Remarks |
| ------------ | ------------------------------ | ------------------------------------------ | ------------------------------------------------------------ |
| hapName | String | Name of the HAP file that is being parsed. | NA |
| appInfo | AppInfo struct (see **AppInfo Struct** below)| Struct of the application information. For details, see **AppInfo Struct** below. | NA |
| deviceConfig | Map\<String,DeviceConfig> | Device information. | The storage type is Map\<String,String>, which indicates the device type name and device type value, respectively. In the stage model, this field is stored in the **app** struct.|
| hapInfo | HapInfo struct (see **HapInfo Struct** below)| Module information in the HAP file. For details, see **HapInfo Struct** below.| NA |
### AppInfo Struct
| Field | Type | Description | Remarks |
|--------------------------------|---------|-----------------------------------------------------------------------------|-----------|
| bundleName | String | Bundle name of the application. | NA |
| bundleType | String | Bundle type.<br>- **app**: The bundle is used for a common application.<br>- **atomicService**: The bundle is used for an atomic service.<br>- **shared**: The bundle is used for a shared library.| NA |
| vendor | String | Vendor of the application. | NA |
| releatedBundleName | String | Related bundle name of the application. | NA |
| versionName | String | Version name of the application. | NA |
| versionCode | String | Version code of the application. | NA |
| targetApiVersion | int | Target API version required for running the application. | NA |
| compatibleApiVersion | int | API version compatible with the application. | NA |
| appName | String | Label of the ability displayed on the home screen. | NA |
| releaseType | String | Release type of the target API version required for running the application. | NA |
| shellVersionCode | String | API version in HarmonyOS. | NA |
| shellVersionName | String | API version name in HarmonyOS. | NA |
| multiFrameworkBundle | String | Bundle name of the application in the dual-framework scenario. | NA |
| debug | boolean | Whether the application can be debugged. | NA |
| icon | String | Path of the application icon. | NA |
| label | String | Label of the application. | NA |
| description | String | Description of the application. | This field is newly added to the stage model.|
| minCompatibleVersionCode | int | Earliest compatible version of the application. | NA |
| distributedNotificationEnabled | boolean | Whether the distributed notification feature is enabled for the application. | This field is newly added to the stage model.|
| jointUserid | String | Shared user ID. | This field is unique to the FA model. |
| process | String | Process name of the application. | This field is unique to the FA model. |
| directLaunch | String | Whether the application can be started when the screen is locked. | NA |
| distributedNotificationEnabled | boolean | Whether the distributed notification feature is enabled for the application. | This field is unique to the stage model.|
### HapInfo Struct
| Field | Type | Description | Remarks |
| ------------------ |------------------------------------------------|--------------------------------| ------------------------------------------------------- |
| packageStr | String | Package information about the application. | This field is unique to the FA model. |
| name | String | Name of the module. | NA |
| description | String | Description of the HAP file. | This field is unique to the FA model. |
| supporteModes | List\<String> | Mode supported by the HAP file. | NA |
| abilities | Array of AbilityInfo | Ability information of the HAP file. | NA |
| distro | Distro Struct | Distro description of the HAP file. | NA |
| deviceType | List\<String> | Type of devices on which the HAP can run. | This field corresponds to **deviceTypes** in the stage model. |
| metadata | metaData struct (see **metaData Struct** below) | Custom metadata of the HAP. | NA |
| isJs | boolean | Whether the application is a JS application. | This field is unique to the FA model. |
| reqPermissions | ReqPermission struct array (see **ReqPermission** below) | Permissions requested by the application. | This field corresponds to **requestPermissions** in the stage model. |
| commonEvents | CommonEvent struct (see **CommonEvent Struct** below) | Static event. | NA |
| shortcuts | Shortcut struct array (see **Shortcut** below) | Shortcuts information of the application. | NA |
| distrofilter | DistroFilter struct | Information distributed by the application market by device form. | NA |
| srcEntrance | String | Entry code path of the application. | This field is newly added to the stage model. |
| process | String | Process name of the HAP. | This field is newly added to the stage model. |
| mainElement | String | Entry ability name or ExtensionAbility name of the HAP file.| This field is newly added to the stage model. In the FA model , the value of **mainAbility** is automatically assigned to **mainElement**.|
| unSyntax | String | Syntax type of a JS component. | This field is newly added to the stage model. |
| pages | List\<String> | Information about each page in a JS component. | This field is newly added to the stage model. |
| extensionAbilities | List\<ExtensionAbilityInfo> | ExtensionAbility information. | This field is newly added to the stage model. |
| abilityFormInfos | List\<AbilityFormInfo> | Widget information. | NA |
| moduleAtomicService| ModuleAtomicService struct (see **ModuleAtomicService Struct** below)| Atomic service information of the HAP. | NA |
### AbilityInfo Struct
| Field | Type | Description | Remarks |
|-------------------|--------------------------| ------------------------------------------------- | ------------------------------- |
| name | String | Logical name of the ability. | NA |
| description | String | Description of the ability. | NA |
| icon | String | Icon of the ability. | NA |
| label | String | Ability name visible to users. | NA |
| type | String | Ability type. | In the stage model, the value is directly assigned to the **page** field.|
| uri | String | URI of the ability. | This field is supported only in the FA model. |
| launchType | String | Launcher type of the ability. | NA |
### Distro Struct
| Field | Type | Description | Remarks |
| ------------------- |---------| ------------------------------------------------------------ | ------------------------------------------------------------ |
| moduleName | String | Name of the module. | This field corresponds to the **moduleName** field under the **module** struct in the stage model. |
| moduleType | String | Type of the module. | This field corresponds to the **moduleType** field under the **module** struct in the stage model. |
| deliveryWithInstall | boolean | Whether the HAP is installed when the user installs the application. | This field corresponds to the **deliveryWithInstall** field under the **module** struct in the stage model. |
| installationFree | int | Whether the HAP supports the installation-free feature. | This parameter corresponds to the **installationFree** field under the **module** struct in the stage model. In the JSON file, if this parameter is set to **true**, **1** is returned; if this parameter is set to **false**, **0** is returned; if this parameter is not set, **2** is returned.|
| virtualMachine | String | Type of the target virtual machine (VM) where the HAP is running. It is used for cloud distribution, such as the application market and distribution center.| This field corresponds to the **virtualMachine** field under the **module** struct in the stage model. |
### Metadata Struct
| Field | Type | Description | Remarks |
| -------------- |---------------------| -------------------------------- | ------------------------- |
| parameters | List\<MetadataInfo> | Metadata information. | This field is unique to the FA model. It is deprecated in the stage model.|
| results | List\<MetadataInfo> | Result information of the metadata. | This field is unique to the FA model. It is deprecated in the stage model.|
| customizeDatas | List\<CustomizeData> | Custom data of the metadata.| NA |
### MetadataInfo Struct
| Field | Type | Description | Remarks |
| ----------- | ------ | --------------------------------- | ------------------------- |
| name | String | Name of the **MetadataInfo** struct. | This field is unique to the FA model. It is deprecated in the stage model.|
| description | String | Description of the **MetadataInfo** struct.| This field is unique to the FA model. It is deprecated in the stage model.|
| type | String | Type of the **MetadataInfo** struct. | This field is unique to the FA model. It is deprecated in the stage model.|
### CustomizeData Struct
| Field | Type | Description | Remarks |
| ----- | ------ | ---------------------------- | ----------------------- |
| name | String | Name of the **CustomizeData** struct. | This field corresponds to **metadata** in the stage model.|
| value | String | Value of the **CustomizeData** struct.| This field corresponds to **metadata** in the stage model.|
| extra | String | Extra information of the **CustomizeData** struct.| This field corresponds to **metadata** in the stage model.|
### ReqPermission Struct
| Field | Type | Description | Remarks|
| --------- | ---------------------------------- |----------------------------------------------------| ---- |
| name | String | Name of the **ReqPermission** struct. | NA |
| reason | String | Reason for requesting the permission. This field is mandatory for a user_grant permission. | NA |
| usedScene | UsedScene struct (see **UsedScene Struct** below)| Application scenario of the permission. The value can be **ability** or **when**. Multiple abilities can be configured.| NA |
### UsedScene Struct
| Field | Type | Description | Remarks|
| ------- | ------------- | ------------------------------------------------------------ | ---- |
| ability | List\<String> | Abilities that use the permission. The value is an array. | NA |
| when | String | Time when the permission is used. The value can be **inuse** (the permission can be used only in the foreground) or **always** (the permission can be used in foreground and background).| NA |
### ShortCut Struct
| Field | Type | Description | Remarks|
| ---------- | ---------------------- | :----------------------------------------------------------- | ---- |
| shortcutId | String | ID of the **ShortCut** struct. | NA |
| label | String | Label of the **ShortCut** struct. | NA |
| icon | String | Icon of the **ShortCut** struct. | NA |
| intents | List of IntentInfo structs| Intents to which the shortcut points. The attribute consists of the **targetClass** and **targetBundle** sub-attributes.| NA |
### IntentInfo Struct
| Field | Type | Description | Remarks|
| ------------ | ------ | ---------------- | ---- |
| targetClass | String | Class name for the target ability of the shortcut.| NA |
| targetBundle | String | Target bundle name of the shortcut.| NA |
### DistroFilter Struct
| Field | Type | Description | Remarks|
| ------------- | ------------------- | ------------------------------------- | ---- |
| apiVersion | ApiVersion struct | API version of the **DistroFilter** struct. | NA |
| screenShape | ScreenShape struct | Screen shape of the **DistroFilter** struct. | NA |
| screenDensity | ScreenDensity struct| Screen density of the **DistroFilter** struct.| NA |
| screenWindow | ScreenWindow struct | Screen window of the **DistroFilter** struct. | NA |
| countryCode | CountryCode struct | Country code of the **DistroFilter** struct. | NA |
### ApiVersion Struct
| Field | Type | Description | Remarks|
| ------ | ------------- | ------------------------ | ---- |
| policy | String | Policy information in the struct.| NA |
| value | List\<String> | Value information in the struct. | NA |
### ScreenShape Struct
| Field | Type | Description | Remarks|
| ------ | ------------- | ------------------------ | ---- |
| policy | String | Policy information in the struct.| NA |
| value | List\<String> | Value information in the struct. | NA |
### ScreenDensity Struct
| Field | Type | Description | Remarks|
| ------ | ------------- | ------------------------ | ---- |
| policy | String | Policy information in the struct.| NA |
| value | List\<String> | Value information in the struct. | NA |
### ScreenWindow Struct
| Field | Type | Description | Remarks|
| ------ | ------------- | ------------------------ | ---- |
| policy | String | Policy information in the struct.| NA |
| value | List\<String> | Value information in the struct. | NA |
### CountryCode Struct
| Field | Type | Description | Remarks|
| ------ | ------------- | ------------------------ | ---- |
| policy | String | Policy information in the struct.| NA |
| value | List\<String> | Value information in the struct. | NA |
### ExtensionAbilityInfo Struct
| Field | Type | Description | Remarks |
| --------------- | ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| name | String | Logical name of the ExtensionAbility. | This field is supported only in the stage model. |
| srcEntrance | String | JS code path of the ExtensionAbility. | This field is supported only in the stage model. |
| icon | String | Icon ID of the ExtensionAbility. | This field is supported only in the stage model. |
| label | String | ExtensionAbility name visible to users. | This field is supported only in the stage model. |
| description | String | Description of the ExtensionAbility. | This field is supported only in the stage model. |
| type | String | Type of the ExtensionAbility, which can be **form**, **workScheduler**, **inputMethod**, **service**, **accessibility**, **dataShare**, **fileShare**, **wallpaper**, or **backup**.| This field is supported only in the stage model. Currently, only **form** and **staticSubscriber** information is parsed. The information of other types is not parsed.|
| permissions | List\<String> | Permissions required when the ExtensionAbility is called by the ability of another application. | This field is supported only in the stage model. |
| readPermission | String | Permission required for reading data in the ExtensionAbility. | This field is supported only in the stage model. |
| writePermission | String | Permission required for writing data to the ExtensionAbility. | This field is supported only in the stage model. |
| visible | boolean | Whether the ExtensionAbility can be called by other applications. | This field is supported only in the stage model. |
| skills | SkillInfo array | Skills of the Want that the extensionAbility can receive. | This field is supported only in the stage model. |
| metadata | CustomizeData information| Metadata of the ExtensionAbility. | The information in **metadata** is assigned to **CustomizeData**. |
| uri | String | URI of the data provided by the ExtensionAbility. | This field is supported only in the stage model. |
### SkillInfo Struct
| Field | Type | Description | Remarks|
| -------- | ------------------- |----------------------| ---- |
| actions | List\<String> | Actions of the Want that the ExtensionAbility can receive.| NA |
| entities | List\<String> | Entities of the Want that the ExtensionAbility can receive. | NA |
| uriInfos | List\<String> | URIs of the Want. | NA |
### UriInfo Struct
| Field | Type | Description | Remarks|
| ------------- | ------ |------------------------| ---- |
| schema | String | Schema information of the **ModuleUriInfo** struct. | NA |
| host | String | Host of the **ModuleUriInfo** struct. | NA |
| port | String | Port of the **ModuleUriInfo** struct. | NA |
| pathStartWith | String | Path prefix of the **ModuleUriInfo** struct. | NA |
| pathRegex | String | Path regular expression of the **ModuleUriInfo** struct.| NA |
| path | String | Path information of the **ModuleUriInfo** struct. | NA |
| type | String | Type of the **ModuleUriInfo** struct. | NA |
### AbilityFormInfo Struct
| Field | Type | Description | Remarks |
| ------------------- | ------------- | ------------------------------------------------------------ |-----------|
| name | String | Name of the widget. | NA |
| description | String | Description of the widget. | This field is newly added to the stage model.|
| type | String | Type of the widget. | NA |
| src | String | JS code of the widget. | NA |
| isDefault | boolean | Whether the widget is a default one. Each HAP has only one default widget. | NA |
| colorMode | String | Color mode of the widget, which can be **auto**, **dark**, or **light**. | NA |
| updateEnabled | boolean | Whether the widget supports scheduled refresh. | NA |
| scheduledUpdateTime | String | Scheduled time to update the widget. The value is in 24-hour format and accurate to the minute. | NA |
| updateDuration | int | Interval to update the widget. The unit is 30 minutes. The value is a multiple of 30. | NA |
| supportDimensions | List\<String> | Dimensions supported by the widget, which can be **1 * 2**, **2 * 2**, **2 * 4**, or **4 * 4**. | NA |
| defaultDimension | String | Default dimensions of the widget. The value must be available in the **supportDimensions** array of the widget.| NA |
| formConfigAbility | String | Ability name for widget adjustment. | NA |
| formVisibleNotify | String | Whether the widget is allowed to use the visibility notification. | NA |
| MetaData | MetaData | Custom data of the widget. | NA |
| providerAbility | String | Ability or ExtensionAbility name of the widget.<br>1. FA model: If the widget is configured in an ability of the Service type, set **providerAbility** to **mainAbility**.<br>2. FA model: If the widget is configured in an ability of the Page type, set **providerAbility** to the current ability.<br>3. FA model: If **mainAbility** is not configured, set **providerAbility** to the ability that preferentially uses **system.home** in the current HAP. Otherwise, set **providerAbility** to the ability of the first page.<br>4. Stage model: Set **providerAbility** to **mainElement**.| NA |
### CommonEvent Struct
| Field | Type | Description | Remarks |
| ---------- | ------------- | -------------------------------------- | ------------------------------------------------ |
| name | String | Name of the class corresponding to the current static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| permission | String | Permissions required to implement the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| data | List\<String> | Additional data array to be carried in the static common event.| In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| type | List\<String> | Type array for configuring the static common event. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
| events | List\<String> | Events of the Want that the ExtensionAbility can receive. | In the stage model, the value is obtained from the StaticSubscriberExtensionAbility.|
### DependencyItem Struct
| Field | Type | Description | Remarks|
|--------------| ------ |--------------| ---- |
| bundleName | String | Bundle name of the shared package.| NA |
| moduleName | String | Module name of the shared package.| NA |
| versionCode | String | Version number of the shared bundle. | NA |
The table below describes the command parameters.
### ModuleAtomicService Struct
| Name| Mandatory| Description|
| -------- | -------- | -------- |
| --mode | Yes| Packing mode. In this scenario, set this parameter to **multiApp**. Each HAP file to pack must meet the validity check rules.|
| --hap-list | No| Path of the HAP file. The file name extension must be .hap. If there are multiple HAP files, separate them with commas (,).<br>The value can also be the directory (folder) where the HAP file is stored.|
| --app-list | No| Path of the App Pack. The file name extension must be .app. If there are multiple App Packs, separate them with commas (,).<br>The value can also be the directory (folder) where the App Pack is stored.<br>You must specify either **--hap-list** or **--app-list**, or both.|
| --out-path | Yes| Path of the target file. The file name extension must be .app.|
| --force | No| The default value is **false**. If the value is **true**, an existing target file will be forcibly deleted during packing.|
| Field | Type | Description | Remarks|
|--------------|----------------------------------------|----------------| ---- |
| preloadItems | PreloadItem object array| Preloaded objects. | NA |
Rules for checking the validity of HAP files to be packed into an App Pack:
### PreloadItem Struct
- Each HAP file must have the same settings for the **bundleName**, **versionCode**, **versionName**, **minCompatibleVersionCode**, **minAPIVersion**, **targetAPIVersion**, and **apiReleaseType** fields in the configuration file. For details, see [Application- or Component-Level Configuration (FA Model)](../application-models/application-component-configuration-fa.md) or [Application- or Component-Level Configuration (Stage Model)](../application-models/application-component-configuration-stage.md).
- Each HAP file must have a unique **moduleName** and a unique HAP of the Entry type for the same device.
- For the FA model, the **package** field configured in the JSON file must be unique.
| Field | Type | Description | Remarks|
|--------------|-----|---------| ---- |
| moduleName | String| Name of the preloaded module.| NA |
......@@ -115,6 +115,7 @@
- Widget Event Development
- [Widget Event Capability Overview](application-models/arkts-ui-widget-event-overview.md)
- [Redirecting to a Specified Page Through the Router Event](application-models/arkts-ui-widget-event-router.md)
- [Launching a UIAbility in the Background Through the call Event](application-models/arkts-ui-widget-event-call.md)
- [Updating Widget Content Through FormExtensionAbility](application-models/arkts-ui-widget-event-formextensionability.md)
- [Updating Widget Content Through UIAbility](application-models/arkts-ui-widget-event-uiability.md)
- Widget Data Interaction
......@@ -602,6 +603,7 @@
- [wukong User Guide](application-test/wukong-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
- Native APIs
- [Introduction to Native APIs](napi/introduction.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
- [Drawing Development](napi/drawing-guidelines.md)
- [Raw File Development](napi/rawfile-guidelines.md)
......@@ -693,7 +695,7 @@
- [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md)
- [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md)
- [Divider](reference/arkui-ts/ts-basic-components-divider.md)
- [Formcomponent](reference/arkui-ts/ts-basic-components-formcomponent.md)
- [FormComponent](reference/arkui-ts/ts-basic-components-formcomponent.md)
- [Gauge](reference/arkui-ts/ts-basic-components-gauge.md)
- [Image](reference/arkui-ts/ts-basic-components-image.md)
- [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md)
......@@ -1289,7 +1291,7 @@
- [@ohos.systemTimer (System Timer)](reference/apis/js-apis-system-timer.md)
- [@ohos.wallpaper (Wallpaper)](reference/apis/js-apis-wallpaper.md)
- [@ohos.web.webview (Webview)](reference/apis/js-apis-webview.md)
- [Console](reference/apis/js-apis-logs.md)
- [console (Log)](reference/apis/js-apis-logs.md)
- [Timer](reference/apis/js-apis-timer.md)
- application
- [AccessibilityExtensionContext](reference/apis/js-apis-inner-application-accessibilityExtensionContext.md)
......@@ -1332,6 +1334,7 @@
- [@ohos.configPolicy (Configuration Policy)](reference/apis/js-apis-configPolicy.md)
- [@ohos.enterprise.accountManager (Account Management)](reference/apis/js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](reference/apis/js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (Application Management)](reference/apis/js-apis-enterprise-applicationManager.md)
- [@ohos.enterprise.bundleManager (Bundle Management)](reference/apis/js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (System Time Management)](reference/apis/js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (Device Control Management)](reference/apis/js-apis-enterprise-deviceControl.md)
......
......@@ -293,7 +293,7 @@ A floating window is created based on an existing task. It is always displayed i
> **NOTE**
>
> If the task for creating the floating window is reclaimed by the system, the floating window will no longer be displayed. If you want the floating window to be displayed in such a case, apply for a [continuous task](../task-management/background-task-overview.md).
> If the task for creating the floating window is reclaimed by the system, the floating window will no longer be displayed. If you want the floating window to be displayed in such a case, apply for a [continuous task](../task-management/continuous-task-dev-guide.md).
```json
{
......
......@@ -12,7 +12,7 @@ However, you can customize an animation to be played during the display or hidin
> **NOTE**
>
> This document involves the use of system APIs. Use the full SDK for development. For details, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md).
> This document involves the use of system APIs. Use the full SDK for development. For details, see [Guide to Switching to Full SDK](../faqs/full-sdk-switch-guide.md).
## Available APIs
......
......@@ -36,7 +36,7 @@ The Contacts application allows third-party applications to invoke the system ca
| -------- | -------- | -------- |
| OpenHarmony | 3.1.1 Release | NA |
| Public SDK | Ohos_sdk_public 3.1.6.6 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.<br>The public SDK of API version 8 was released on July 6, 2022.|
| Full SDK | Ohos_sdk_full&nbsp;3.1.6.5 (API Version 8 Release) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.6.5 (API Version 8 Release) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| (Optional) HUAWEI DevEco Studio| 3.0 Beta3 for OpenHarmony | This tool is recommended for developing OpenHarmony applications.|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | This tool is recommended for developing OpenHarmony smart devices.|
......
......@@ -21,7 +21,7 @@ Fixed known SDK defects, and released the latest SDK version.
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.2 Release| N/A|
| Full SDK | Ohos_sdk_full&nbsp;3.1.7.7&nbsp;(API&nbsp;Version&nbsp;8&nbsp;Relese)<br>Ohos_sdk_full&nbsp;3.1.7.5&nbsp;(API&nbsp;Version&nbsp;8&nbsp;Relese) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](https://gitee.com/openharmony/docs/blob/master/en/application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.7.7 (API Version 8 Relese)<br>Ohos_sdk_full 3.1.7.5 (API Version 8 Relese) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public&nbsp;3.1.7.7&nbsp;(API&nbsp;Version&nbsp;8&nbsp;Release)<br>Ohos_sdk_public 3.1.7.5 (API Version 8 Release) | This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.0 Beta4 for OpenHarmony | Recommended for developing OpenHarmony applications.|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | Recommended for developing OpenHarmony devices.|
......@@ -36,7 +36,7 @@ Fixed known SDK defects, and released the latest SDK version.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure user information.
3. Install the [Git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```
git config --global user.name "yourname"
......@@ -117,7 +117,7 @@ This version does not involve API updates.
### Chip and Development Board Adaptation
For details about the adaptation status, see [SIG_DevBoard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard.md).
For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard.md).
## Resolved Issues
......
......@@ -13,7 +13,7 @@ OpenHarmony 3.1.3 Release provides enhanced system security over OpenHarmony 3.1
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.3 Release | NA |
| Full SDK| Ohos_sdk_full 3.1.7.7 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md). |
| Full SDK| Ohos_sdk_full 3.1.7.7 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md). |
| Public SDK| Ohos_sdk_public 3.1.7.7 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.0 Release for OpenHarmony| Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony smart devices|
......
......@@ -13,7 +13,7 @@ OpenHarmony 3.1.4 Release provides enhanced system security over OpenHarmony 3.1
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.4 Release| NA |
| Full SDK | Ohos_sdk_full&nbsp;3.1.9.7&nbsp;(API&nbsp;Version&nbsp;8&nbsp;Relese) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.9.7 (API Version 8 Relese) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public 3.1.9.7 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.1 Preview for OpenHarmony| Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony smart devices|
......
......@@ -13,7 +13,7 @@ OpenHarmony 3.1.5 Release provides enhanced system security over OpenHarmony 3.1
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.5 Release| NA |
| Full SDK | Ohos_sdk_full 3.1.11.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.11.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public 3.1.11.5 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.1 Preview for OpenHarmony| Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony smart devices|
......
......@@ -13,7 +13,7 @@ OpenHarmony 3.1.6 Release provides enhanced system security over OpenHarmony 3.1
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.1.6 Release | NA |
| Full SDK | Ohos_sdk_full 3.1.12.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.12.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public 3.1.12.5 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio| 3.1 Preview for OpenHarmony| Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony smart devices|
......
......@@ -12,7 +12,7 @@ OpenHarmony 3.1.7 Release provides enhanced system security over OpenHarmony 3.1
| Software/Tool | Version | Remarks |
| ------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| OpenHarmony | 3.1.7 Release | NA |
| Full SDK | Ohos_sdk_full 3.1.13.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.1.13.5 (API Version 8 Release)| This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| Public SDK | Ohos_sdk_public 3.1.13.5 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio 3.0 Beta4 or later.|
| (Optional) HUAWEI DevEco Studio | 3.1 Preview for OpenHarmony | Recommended for developing OpenHarmony applications |
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | Recommended for developing OpenHarmony smart devices |
......
......@@ -36,7 +36,7 @@ Added samples such as Gobang, QR code generation and parsing, widget usage, mult
| -------- | -------- | -------- |
| OpenHarmony | 3.2 Beta2 | NA |
| Public SDK | Ohos_sdk_public 3.2.5.5 (API Version 9 Beta2)<br>Ohos_sdk_public 3.2.5.6 (API Version 9 Beta2) | This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio.|
| Full SDK | Ohos_sdk_full 3.2.5.5 (API Version 9 Beta2)<br>Ohos_sdk_full 3.2.5.6 (API Version 9 Beta2) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.2.5.5 (API Version 9 Beta2)<br>Ohos_sdk_full 3.2.5.6 (API Version 9 Beta2) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| (Optional) HUAWEI DevEco Studio| 3.0 Beta4 | This tool is recommended for developing OpenHarmony applications.|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | This tool is recommended for developing OpenHarmony smart devices.|
......@@ -132,7 +132,7 @@ This version has the following updates to OpenHarmony 3.2 Beta1.
### SDK Updates
From this version onwards, both the Public SDK and Full SDK are provided. The Public SDK is provided as standard in DevEco Studio.
If an application developed using the SDK of an earlier version calls system APIs, you must manually switch to the Full SDK by following the instructions provided in [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md) after the version upgrade. This operation ensures successful build of your application project.
If an application developed using the SDK of an earlier version calls system APIs, you must manually switch to the Full SDK by following the instructions provided in [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md) after the version upgrade. This operation ensures successful build of your application project.
### Feature Updates
......
......@@ -54,7 +54,7 @@ The distributed database supports cross-device and cross-application sharing. Th
| -------- | -------- | -------- |
| OpenHarmony | 3.2 Beta3| NA |
| Public SDK | Ohos_sdk_public 3.2.7.5 (API Version 9 Beta3)<br>Ohos_sdk_public&nbsp;3.2.7.6&nbsp;(API&nbsp;Version&nbsp;9&nbsp;Beta3) | This toolkit is intended for application developers and does not contain system APIs that require system permissions.<br>It is provided as standard in DevEco Studio.|
| Full SDK | Ohos_sdk_full 3.2.7.5 (API Version 9 Beta3)<br>Ohos_sdk_full&nbsp;3.2.7.6&nbsp;(API&nbsp;Version&nbsp;9&nbsp;Beta3) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.2.7.5 (API Version 9 Beta3)<br>Ohos_sdk_full&nbsp;3.2.7.6&nbsp;(API&nbsp;Version&nbsp;9&nbsp;Beta3) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.<br>To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| (Optional) HUAWEI DevEco Studio| 3.0 Release| Recommended for developing OpenHarmony applications.|
| (Optional) HUAWEI DevEco Device Tool| 3.0 Release| Recommended for developing OpenHarmony devices.|
......
......@@ -46,7 +46,7 @@ The distributed hardware supports the request and import of credential parameter
| -------- | -------- | -------- |
| OpenHarmony | 3.2 Beta4 | NA |
| Public SDK | Ohos_sdk_public 3.2.9.2 (API Version 9 Beta4) | This toolkit is intended for application developers and does not contain system APIs that require system permissions. It is provided as standard in DevEco Studio.|
| Full SDK | Ohos_sdk_full 3.2.9.2 (API Version 9 Beta4) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions. To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).|
| Full SDK | Ohos_sdk_full 3.2.9.2 (API Version 9 Beta4) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions. To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/faqs/full-sdk-switch-guide.md).|
| (Optional) HUAWEI DevEco Studio| 3.1 Canary1 | Recommended for developing OpenHarmony applications|
| (Optional) HUAWEI DevEco Device Tool| 3.1 Beta1 | Recommended for developing OpenHarmony smart devices|
......
......@@ -495,7 +495,7 @@ For details, see [DevEco Studio Version Change History](https://developer.harmon
| OpenHarmony | 3.2 Release | NA |
| Public SDK | Ohos_sdk_public 3.2.11.9 (API Version 9 Release) | This toolkit is intended for application developers and does not contain system APIs that require system permissions. It is provided as standard in DevEco Studio.|
| (Optional) HUAWEI DevEco Studio| 3.1 Beta2 | Recommended for developing OpenHarmony applications How to obtain:<br>[Windows(64-bit)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/f3/v3/uJyuq3syQ2ak4hE1QZmAug/devecostudio-windows-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013335Z&HW-CC-Expire=315360000&HW-CC-Sign=96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70)<br>[Mac(X86)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b7/v3/4z3mLQPCQR-g5KlC56SC1w/devecostudio-mac-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013430Z&HW-CC-Expire=315360000&HW-CC-Sign=93E83FD1F1CE504EF8F098E08955A938FDA4E4926A2555CF1E02DC8D57210D76)<br>[Mac(ARM)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/2e/v3/Fl9IY6PiQxqc3tnI2cftiw/devecostudio-mac-arm-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013540Z&HW-CC-Expire=315360000&HW-CC-Sign=0906243123734033AAD34A7A005ED7671F00CAA693B6E674F81A094A0159ECCE) |
| (Optional) HUAWEI DevEco Device Tool| 3.1 Release | Recommended for developing OpenHarmony smart devices<br>[Click here](https://device.harmonyos.com/cn/develop/ide/).|
| (Optional) HUAWEI DevEco Device Tool| 3.1 Release | Recommended for developing OpenHarmony smart devices<br>[Click here](https://device.harmonyos.com/en/develop/ide/). |
## Source Code Acquisition
......
# OpenHarmony 3.2.1 Release
## Version Description
OpenHarmony 3.2.1 Release provides the following enhancements over OpenHarmony 3.2 Release:
According to security compliance requirements, UUIDs are used only for system applications and SAs, no longer for common applications. New UUIDs (sha256(appId_uuid)) that can be used by common applications are used in distributed data management.
## Version Mapping
**Table 1** Version mapping of software and tools
| Software/Tool| Version| Remarks|
| -------- | -------- | -------- |
| OpenHarmony | 3.2.1 Release | NA |
| Public SDK | Ohos_sdk_public 3.2.12.5 (API Version 9 Release) | This toolkit is intended for application developers and does not contain system APIs that require system permissions. It is provided as standard in DevEco Studio.|
| (Optional) HUAWEI DevEco Studio| 3.1 Release | Recommended for developing OpenHarmony applications<br>[Click here](https://developer.harmonyos.com/en/develop/deveco-studio#download)|
| (Optional) HUAWEI DevEco Device Tool| 3.1 Release | Recommended for developing OpenHarmony smart devices<br>[Click here](https://device.harmonyos.com/en/develop/ide/).|
## Source Code Acquisition
### Prerequisites
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the permission, download the tool to another directory and configure it as an environment variable by running the chmod a+x /usr/local/bin/repo command.
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### Acquiring Source Code Using the repo Tool
**Method 1 (recommended)**
Use the **repo** tool to download the source code over SSH. (You must have an SSH public key for access to Gitee.)
```
repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.2.1-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
**Method 2**
Use the **repo** tool to download the source code over HTTPS.
Obtain the source code from the version tag, which is the same as that released with the version.
```
repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v3.2.1-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
### Acquiring Source Code from Mirrors
**Table 2** Mirrors for acquiring source code
| Source Code | Version| Mirror | SHA-256 Checksum | Software Package Size|
| --------------------------------------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- |
| Full code base (for mini, small, and standard systems) | 3.2.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/code-v3.2.1-Release.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/code-v3.2.1-Release.tar.gz.sha256)| 21.8 GB |
| Hi3861 solution (binary) | 3.2.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_pegasus.tar.gz.sha256)| 22.9 MB |
| Hi3516 solution-LiteOS (binary)| 3.2.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_taurus_LiteOS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_taurus_LiteOS.tar.gz.sha256)| 293.3 MB |
| Hi3516 solution-Linux (binary) | 3.2.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/hispark_taurus_Linux.tar.gz.sha256)| 174.6 MB |
| RK3568 standard system solution (binary) | 3.2.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/dayu200_standard_arm32.tar.gz.sha256)| 3.9 GB |
| Public SDK package for the standard system (macOS) | 3.2.12.5 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/ohos-sdk-mac-public.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/ohos-sdk-mac-public.tar.gz.sha256)| 664.5 MB |
| Public SDK package for the standard system (macOS-M1) | 3.2.12.5 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/L2-SDK-MAC-M1-PUBLIC.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/L2-SDK-MAC-M1-PUBLIC.tar.gz.sha256)| 623.3 MB |
| Public SDK package for the standard system (Windows\Linux) | 3.2.12.5 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/ohos-sdk-windows_linux-public.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2.1/ohos-sdk-windows_linux-public.tar.gz.sha256)| 1.6 GB |
## What's New
### API
This version does not involve API updates.
### Chip and Development Board Adaptation
For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard.md).
## Resolved Issues
**Table 3** Resolved issues
| Issue No.| Description|
| -------- | -------- |
| I6U1H9 | The **gridColOffset** attribute of the **\<GridCol>** component cannot be previewed in the previewer of DevEco Studio.|
| I6TMP3 | When a user holds an application to access image preview, swipes backwards about 150 widgets, and touches to add a widget, the widget may not be displayed on the home screen.|
| I6RJTP | A user touches a Bluetooth headset on the Bluetooth screen of the device for connection. When the status is Connecting, the user cannot disable the Bluetooth feature. The screen does not respond or even crashes.|
| I6TFXF | [Pressure test] [Low probability] The sysevent_service thread in the /system/bin/hiview process causes a crash in libjsoncpp.z.so. This problem occurs once.|
| I6TS20 | [Pressure test] [Low probability] The Chrome_IOThread thread in the com.ohos.note process causes a C++ crash in libweb_engine.so. This problem occurs twice.|
| I6TS25 | [Pressure test] [Low probability] The com.ohos.note thread in the com.ohos.note process causes a C++ crash in libweb_engine.so. This problem occurs once.|
| I6A80S | The Weibo pages loaded by the **\<Web>** component are abnormal.|
| I6VRJ8 | [High probability] [Wukong] The Chrome_IOThread thread in the com.ohos.note process causes a C++ crash in libweb_engine.so. This problem occurs eight times. |
| I6YJHC | [High probability] [Wukong] The com.ohos.note thread in the com.ohos.note process causes a C++ crash in ld-musl-arm.so.1. This problem occurs nine times.|
| I6YT0V | [High probability] [Wukong] The RSRenderThread thread in the com.ohos.note process causes a C++ crash in libeventhandler.z.so. This problem occurs six times. |
| I6YSP4 | [Low probability 1/10] [Wukong] The com.ohos.note thread in the com.ohos.note process causes a crash in librender_service_base.z.so. This problem occurs once.|
| I6Z5XW | [High probability 8/10] When more than 10 drafts are created and then deleted one by one, memory leakage occurs in com.ohos.mms.|
| I6YZGA | [Low probability 1/10] [Wukong] The RSRenderThread thread in the com.ohos.note process causes a C++ crash in libskia_ohos.z.so. This problem occurs four times.|
| I64726<br>I641A2 | When the **bluetooth.pairDevice** API is called, no prompt indicating successful pairing is displayed. The device is paired in silent mode, and the device can be controlled using the Bluetooth keyboard and mouse.|
| I6TRY1 | [Low probability] [Wukong] The com.ohos.note thread in the com.ohos.note process causes a C++ crash in libace.z.so. This problem occurs once.|
| I6TS3O | [Low probability] [Wukong] App freezing occurs in the libace.z.so stack of the com.ohos.contacts process. This problem occurs three times.|
| I6TFT1 | [Low probability] A JS crash occurs in the anonymous/AssertException stack of the com.example.actsgetcurrenttopabilitystageatest process. This problem occurs twice.|
| I6TFUX | [Low probability] [Wukong] The events_emitter thread in the com.open.harmony.acetestfour process causes a crash in libemitter.z.so. This problem occurs once.|
| I6TFXY | [Low probability] A JS crash occurs in the AssertException stack of the com.example.abilitymultiinstance process, and a JS crash occurs in the AssertException stack of the com.example.startabilityforresult process. This problem occurs three times.|
| I6TGJ2 | [Low probability] The usage_event_rep thread in the /system/bin/hiview process causes a crash in libhiviewbase.z.so. This problem occurs twice.|
| I6TR29 | [Low probability] [Wukong] The com.ohos.smartp thread in the com.ohos.smartperf process causes a crash in libace.z.so. This problem occurs once.|
| I6TS0D | [Low probability] The Chrome_IOThread thread in the com.ohos.note process causes a C++ crash in libace.z.so. This problem occurs once.|
| I6TS20 | [Low probability] The Chrome_IOThread thread in the com.ohos.note process causes a C++ crash in libweb_engine.so. This problem occurs twice.|
| I6TS25 | [Low probability] The com.ohos.note thread in the com.ohos.note process causes a C++ crash in libweb_engine.so. This problem occurs once.|
| I6TUR9 | [Pressure test] [High probability] App freezing occurs in the com.ohos.mms process. This problem occurs 10 times.|
| I6TVCX | [Pressure test] [High probability] Memory leakage occurs on the SystemUI and the memory usage increases.|
| I6T09Y | [Pressure test] [Low probability] The com.ohos.camera thread in the com.ohos.camera process causes a crash in libpluginmanager.z.so. This problem occurs once.|
| I6T0EO | [Pressure test] [Low probability] A JS crash occurs twice in the com.ohos.mms process.|
| I6TKQP | [Low probability] [Wukong] The com.ohos.note thread in the com.ohos.note process causes a crash in libace.z.so. This problem occurs once.|
| I6TNY9 | When the call log is full, the dialer cannot be hidden if a user swipes up.|
| I6TRW7<br>I6TRRX<br>I6TRHA<br>I6TRH3<br>I6TRGZ<br>I6TRGO<br>I6TRGJ<br>I6TRGG<br>I6TRGD<br>I6TRG9<br>I6TRG6<br>I6TIFP<br>I6TBIR<br>I6RQLV<br>I6RQLT<br>I6QYZS<br>I6QYZR<br>I6QYZI<br>I6QYZG<br>I6QYZF<br>I6QYZ9<br>I6QYZ7<br>I6TRHE<br>I6TRH7<br>I6TRGV<br>I6TRGS<br>I6TRG2 | [Vulnerability] [OpenHarmony-3.2-Release] lj-oss-fuzz-132<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1652<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1815<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1823<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1817<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1819<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1822<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1816<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1821<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1813<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1814<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-28464<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2022-48434<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-0466<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-0465<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27535<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27533<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27536<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27538<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27537<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-27534<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-0464<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1812<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1818<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1811<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1820<br>[Vulnerability] [OpenHarmony-3.2-Release] CVE-2023-1810|
## Known Issues
**Table 4** Known issues
| Issue No.| Description| Impact| To Be Resolved By|
| -------- | -------- | -------- | -------- |
| I6B4U3 | There is a low probability (3/10) that app freezing occurs in the com.ohos.launcher process.| When a large number of applications are installed (more than 40 applications) and the memory is small, there is a low probability that app freezing occurs. However, the home screen functions are normal and the overall functions and usage are not affected.| 2023-06-15|
| I6SXBI | There is a low probability that libdistributeddata.z.so in the ohos.samples.distributedcalc process causes a C++ crash.| When a user exits the Calculator application within 1 second after opening it, the JS object is destructed before it is successfully read from the database. An error is recorded in the log, but the user is unaware of the error. The impact is controllable.| 2023-07-15|
| I6TRE6 | There is a low probability that libdatashare_consumer.z.so crashes due to the com.ohos.contacts thread in the com.ohos.contacts process.| When a user exits the Contacts application within 600 ms after opening it, there is a low probability that the contacts process crashes. The contacts process will be automatically restarted after the crash. The impact is controllable.| 2023-07-15|
| I6SMQA | When a user uses a browser application to open a WeiBo page and swipes the screen quickly, jitter occurs during swiping.| The content is not loaded during swiping but will be loaded quickly. User experience is affected.| 2023-06-15|
| I72P5E | Memory leakage occurs in libace.z.so when a user touches an image in Gallery to maximize it and then exits repeatedly.| Each time the user touches an image in Gallery to maximize it and then exits, 10 KB memory of the ArkUI module leaks. When the user touches Back on the application, the leak issue disappears. The impact is controllable.| 2023-07-15|
| I72P5I | Memory leakage occurs in libace.z.so when a user touches an image folder in Gallery to browse images in grid form and then exits repeatedly.| Each time the user touches an image folder in Gallery to browse images in grid form and then exits, 19 KB memory of the ArkUI module leaks. When the user touches Back on the application, the leak issue disappears. The impact is controllable.| 2023-07-15|
| I76N0Y | Memory leakage occurs in libace.z.so when applications are repeatedly added to or removed from the dock bar.| Each time a widget is moved to a valid area, 99 KB memory of the ArkUI module leaks. This operation scenario is uncommon, and the leak issue disappears after the application is restarted. The impact is controllable.| 2023-07-15|
| I6XHE7 | Memory leakage occurs on the NAPIRemoteObject module.| When the JS application calls the IPC, the NAPIRemoteObject process needs to be created, and 1.2 KB memory occurs during the creation. However, the process can be used repeatedly once created, and the memory is released when the application process exits.| 2023-07-15|
......@@ -2,6 +2,7 @@
## OpenHarmony 3.x Releases
- [OpenHarmony v3.2 Release (2023-04-09)](OpenHarmony-v3.2-release.md)
- [OpenHarmony v3.2.1 Release (2023-05-22)](OpenHarmony-v3.2.1-release.md)
- [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md)
- [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md)
- [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md)
......
......@@ -2,63 +2,32 @@
## cl.file.1 mediaLibrary APIs Changed
The **MediaLibrary** class of the multimedia component is replaced by the **FilePicker** class.
All APIs provided by the mediaLibrary module of the multimedia subsystem are deprecated.
**Change Impact**
For applications developed based on earlier versions, pay attention to the changes of APIs. **FilePicker** is a system application preset in OpenHarmony. You can use it to select and save files.
All APIs described in [mediaLibrary](../../../application-dev/reference/apis/js-apis-medialibrary.md) are deprecated. Third-party applications can only select and save files in the public directory by calling the APIs of [FilePicker](../../../application-dev/reference/apis/js-apis-file-picker.md).
For applications developed based on earlier versions, pay attention to the changes of APIs.
**Key API/Component Changes**
The APIs of **MediaLibrary**, located in **@ohos.multimedia.medialibrary**, are deprecated. The **FilePicker** class, located in [@ohos.file.picker](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.file.picker.d.ts) is used.
The table below lists the **mediaLibrary** APIs that can be substituted by the **FilePicker** APIs.
| Module | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------------------------------------------------ | -------- |
| medialibrary | **function** getMediaLibrary(): MediaLibrary; | Deprecated |
| medialibrary | **function** getMediaLibrary(context: Context): MediaLibrary; | Deprecated |
| medialibrary | **function** getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult\>): void | Deprecated |
| medialibrary | **function** getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult\> | Deprecated |
| medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void\>): void | Deprecated |
| medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void\>): void | Deprecated |
| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** deleteAsset(uri: string): Promise\<void\> | Deprecated |
| medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string\>): void | Deprecated |
| medialibrary | **function** getPublicDirectory(type: DirectoryType): Promise\<string\> | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album\>\>): void | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\<Array\<Album\>\> | Deprecated |
| medialibrary | **function** release(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** release(): Promise\<void\> | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\<string\>): void | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\<string\> | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index: number, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index?: number): Promise\<void\> | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\<Array\<string\>\>): void | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\<Array\<string\>\> | Deprecated |
| medialibrary | **function** getActivePeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** getActivePeers(callback: AsyncCallback\<Array\<PeerInfo\>\>): void; | Deprecated |
| medialibrary | **function** getAllPeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isDirectory():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.open(mode: string, callback: AsyncCallback\<number\>): void | Deprecated |
| medialibrary | **function** FileAsset.open(mode: string): Promise\<number\> | Deprecated |
| medialibrary | **function** FileAsset.close(fd: number, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.close(fd: number): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\<image.PixelMap\> | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isFavorite():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isTrash():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FetchFileResult.getCount(): number | Deprecated |
| medialibrary | **function** FetchFileResult.isAfterLast(): boolean | Deprecated |
| medialibrary | **function** FetchFileResult.close(): void | Deprecated |
......@@ -72,45 +41,232 @@ The APIs of **MediaLibrary**, located in **@ohos.multimedia.medialibrary**, are
| medialibrary | **function** FetchFileResult.getPositionObject(index: number): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** FetchFileResult.getAllObject(callback: AsyncCallback\<Array\<FileAsset\>\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getAllObject(): Promise\<Array\<FileAsset\>\> | Deprecated |
| medialibrary | **function** Album.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** Album.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **function** Album.getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult\>): void | Deprecated |
| medialibrary | **function** Album.getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult\> | Deprecated |
| medialibrary | **enum** DeviceType | Deprecated |
| medialibrary | **enum** FileKey | Deprecated |
| medialibrary | **enum** DirectoryType | Deprecated |
| medialibrary | **enum** MediaType | Deprecated |
| medialibrary | **interface** PeerInfo | Deprecated |
| medialibrary | **interface** Size | Deprecated |
| medialibrary | **interface** MediaFetchOptions | Deprecated |
| medialibrary | **interface** MediaAssetOption | Deprecated |
| medialibrary | **interface** MediaSelectOption | Deprecated |
| medialibrary | **interface** FileAsset | Deprecated |
**Adaptation Guide**
For example, refer to the code snippet below to call an API to select an image:
**The following example shows how to use the mediaLibrary APIs to edit a file in the public directory:**
1. Call **getMediaLibrary** to obtain a **mediaLibrary** instance.
2. Create a **MediaFetchOptions** object, and call **getFileAssets** to obtain files in the public directory.
3. Call the **FetchFileResult** APIs to obtain the file asset of the target file.
4. Call **fileAsset.open** to open the file and obtain the FD.
5. Call [fs.writeSync](../../../application-dev/reference/apis/js-apis-file-fs.md#writesync) to edit the file through the FD.
6. After the edit, call **fileAsset.close** to close the FD of the file.
7. Call **fetchFileResult.close** to release the resources occupied by **getFileAssets**.
8. Call **release** to release the **mediaLibrary** instance.
**Example**
```js
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fs from '@ohos.file.fs';
async function example() {
try {
let context = getContext(this);
let media = mediaLibrary.getMediaLibrary(context);
let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: fileKeyObj.DATE_ADDED + ' DESC',
};
const fetchFileResult = await media.getFileAssets(getImageOp);
const fileAsset = await fetchFileResult.getFirstObject();
console.info('mediaLibrary fileAsset displayName: ' + fileAsset.displayName);
let fd = await fileAsset.open('rw');
console.info('mediaLibrary fileAsset open fd: ' + fd);
let writeLen = fs.writeSync(fd, 'hello, world');
console.info('write data to file succeed and size is: ' + writeLen);
fileAsset.close(fd);
fetchFileResult.close();
media.release();
} catch (err) {
console.error('mediaLibrary fail, err: ' + err);
}
}
```
**The following example shows how to use the FilePicker APIs to edit a file in the public directory:**
1. Obtain a **DocumentViewPicker** object.
2. Call **DocumentViewPicker.select** to select a file.
3. After a file is selected, a file URI is returned.
4. After the UI is returned from DocumentViewPicker, call [fs.openSync](../../../application-dev/reference/apis/js-apis-file-fs.md#fsopensync) to open the file based on the URI and obtain the FD.
5. Call [fs.writeSync](../../../application-dev/reference/apis/js-apis-file-fs.md#writesync) to edit the file through the FD.
6. After the edit, call [fs.closeSync](../../../application-dev/reference/apis/js-apis-file-fs.md#closesync) to close the FD.
**Example**
```js
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import picker from '@ohos.file.picker';
import fs from '@ohos.file.fs';
let uri;
async function example() {
try {
let DocumentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult) => {
console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult));
uri = DocumentSelectResult[0];
}).catch((err) => {
console.error('DocumentViewPicker.select failed with err: ' + err);
});
} catch (err) {
console.error('DocumentViewPicker failed with err: ' + err);
}
}
async function writeFile() {
try {
let file = fs.openSync(uri, fs.OpenMode.READ_WRITE);
console.info('DocumentViewPicker file fd: ' + file.fd);
let writeLen = fs.writeSync(file.fd, 'hello, world');
console.info('write data to file succeed and size is: ' + writeLen);
fs.closeSync(file);
} catch (err) {
console.error('DocumentViewPicker fail, err: ' + err);
}
}
```
**The following example shows how to use the mediaLibrary APIs to create a file in the public directory:**
1. Call **getMediaLibrary** to obtain a **mediaLibrary** instance.
2. Call **getPublicDirectory** to obtain the path of the public directory.
3. Call **createAsset** to create a file and obtain the file asset.
4. Call **fileAsset.open** to open the file and obtain the FD.
5. Call **fs.write** to edit the file through the FD.
6. After the edit, call **fileAsset.close** to close the FD.
7. Call **release** to release the **mediaLibrary** instance.
**Example**
```js
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fs from '@ohos.file.fs';
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");
let context = getContext(this);
let media = mediaLibrary.getMediaLibrary(context);
let mediaType = mediaLibrary.MediaType.FILE;
let DIR_DOWNLOAD = mediaLibrary.DirectoryType.DIR_DOWNLOAD;
const path = await media.getPublicDirectory(DIR_DOWNLOAD);
const fileAsset = await media.createAsset(mediaType, 'test.txt', path);
console.info('mediaLibrary fileAsset displayName: ' + fileAsset.displayName);
let fd = await fileAsset.open('rw');
console.info('mediaLibrary fileAsset open fd: ' + fd);
let writeLen = fs.writeSync(fd, 'hello, world');
console.info('write data to file succeed and size is: ' + writeLen);
fileAsset.close(fd);
media.release();
} catch (err) {
console.error('mediaLibrary fail, err: ' + err);
}
}
```
**The following example shows how to use the FilePicker APIs to create a file in the public directory:**
1. Obtain a **DocumentViewPicker** object.
2. Call **DocumentViewPicker.save** to create and save an empty file.
3. After the file is saved, a file URI is returned.
4. After the UI is returned from DocumentViewPicker, call [fs.openSync](../../../application-dev/reference/apis/js-apis-file-fs.md#fsopensync) to open the file based on the URI and obtain the FD.
5. Call [fs.writeSync](../../../application-dev/reference/apis/js-apis-file-fs.md#writesync) to edit the file through the FD.
6. After the edit, call [fs.closeSync](../../../application-dev/reference/apis/js-apis-file-fs.md#closesync) to close the FD.
**Example**
```js
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import picker from '@ohos.file.picker';
import fs from '@ohos.file.fs';
let uri;
async function example() {
try {
let DocumentSaveOptions = new picker.DocumentSaveOptions();
DocumentSaveOptions.newFileNames = ['DocumentViewPicker01.txt'];
let documentPicker = new picker.DocumentViewPicker();
documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult) => {
console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult));
uri = DocumentSaveResult[0];
}).catch((err) => {
console.error("PhotoViewPicker.select fail, err: " + err);
console.error('DocumentViewPicker.save failed with err: ' + err);
});
} catch (err) {
console.error("PhotoViewPicker fail, err: " + err);
console.error('DocumentViewPicker failed with err: ' + err);
}
}
async function writeFile() {
try {
let file = fs.openSync(uri, fs.OpenMode.READ_WRITE);
console.info('DocumentViewPicker file fd: ' + file.fd);
let writeLen = fs.writeSync(file.fd, 'hello, world');
console.info('write data to file succeed and size is: ' + writeLen);
fs.closeSync(file);
} catch (err) {
console.error('DocumentViewPicker fail, err: ' + err);
}
}
```
**Key API/Component Changes**
The table below lists the mediaLibrary APIs that are not open to third-party applications due to function control. There are no substitute APIs for them.
| Module | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------------------------------------------------ | -------- |
| medialibrary | **function** getMediaLibrary(): MediaLibrary; | Deprecated |
| medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void\>): void | Deprecated |
| medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void\>): void | Deprecated |
| medialibrary | **function** deleteAsset(uri: string): Promise\<void\> | Deprecated |
| medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\<string\>): void | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\<string\> | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index: number, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index?: number): Promise\<void\> | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\<Array\<string\>\>): void | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\<Array\<string\>\> | Deprecated |
| medialibrary | **function** getActivePeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** getActivePeers(callback: AsyncCallback\<Array\<PeerInfo\>\>): void; | Deprecated |
| medialibrary | **function** getAllPeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isDirectory():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\<image.PixelMap\> | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isFavorite():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isTrash():Promise\<boolean\> | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album\>\>): void | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\<Array\<Album\>\> | Deprecated |
| medialibrary | **function** Album.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** Album.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **enum** DeviceType | Deprecated |
| medialibrary | **interface** PeerInfo | Deprecated |
| medialibrary | **interface** Size | Deprecated |
| medialibrary | **interface** MediaAssetOption | Deprecated |
| medialibrary | **interface** MediaSelectOption | Deprecated |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册