提交 58a1deef 编写于 作者: X xieqiongyang 提交者: Gitee

Merge branch 'OpenHarmony-4.0-Beta2' of gitee.com:openharmony/docs into weekly

Signed-off-by: Nxieqiongyang <xieqiongyang@huawei.com>
# 设置原子化服务支持分享
## 原子化服务分享
# Setting Atomic Services to Support Sharing
## How to Develop
1. UIAbility组件提供了[UIAbility.onShare()](../reference/apis/js-apis-app-ability-uiAbility.md#onshare)生命周期方法,应用可通过此方法设置要分享的数据。其中,ohos.extra.param.key.contentTitle表示分享框中对分享内容title的描述,ohos.extra.param.key.shareAbstract表示分享框中对携带内容的摘要描述,ohos.extra.param.key.shareUrl表示服务的在线地址。以上三项分享数据均是开发者填充,且为Object对象,对象的key分别为title,abstract,url。
1. An application calls [UIAbility.onShare()](../reference/apis/js-apis-app-ability-uiAbility.md#onshare), a lifecycle callback provided by the UIAbility component, to set the data to share. In this lifecycle callback, **ohos.extra.param.key.contentTitle** indicates the title of the content to share in the sharing box, **ohos.extra.param.key.shareAbstract** provides an abstract description of the content, and **ohos.extra.param.key.shareUrl** indicates the online address of the service. You need to set these three items as objects, with the key set to **title**, **abstract**, and **url**, respectively.
```ts
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
......@@ -15,7 +15,7 @@
}
```
2. 系统弹框调用[abilityManager.acquireShareData()](../reference/apis/js-apis-app-ability-abilityManager.md#acquiresharedata)接口发起原子化服务共享,根据missionId找到对应的UIAbility,调用其OnShare生命周期,收到共享数据。
2. A system dialog box calls [abilityManager.acquireShareData()](../reference/apis/js-apis-app-ability-abilityManager.md#acquiresharedata) to obtain data shared through atomic service sharing. Specifically, the system finds the UIAbility based on the mission ID and calls the **OnShare()** lifecycle of the UIAbility to obtain the shared data.
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
......
......@@ -44,14 +44,14 @@ The APIs provided by **Vector** are deprecated since API version 9. You are advi
| Accessing elements| Use **vec\[index]** to obtain the value at a given position (specified by **index**).|
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getLastElement()** to obtain the last element in this container.|
| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, Vector?: Vector&lt;T&gt;) =&gt; void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **vec\[index]=xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
| Modifying elements| Use **setLength(newSize: number)** to set the size of this container.|
| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
| Deleting elements| Use **removeByRange(fromIndex: number, toIndex: number)** to remove all of the elements within a range.|
......@@ -74,14 +74,14 @@ You are advised to use **List** for frequent insertion and removal operations.
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getFirst()** to obtain the first element in this container.|
| Accessing elements| Use **getLast()** to obtain the last element in this container.|
| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackfn: (value: T, index?: number, list?: List&lt;T&gt;)=&gt; void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **list\[index] = xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
| Modifying elements| Use **replaceAllElements(callbackFn:(value: T,index?: number,list?: List&lt;T&gt;)=&gt;T,thisArg?: Object)** to replace all elements in this container with new elements.|
| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
......@@ -105,13 +105,13 @@ You are advised to use **LinkedList** for frequent insertion and removal operati
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getFirst()** to obtain the first element in this container.|
| Accessing elements| Use **getLast()** to obtain the last element in this container.|
| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, list?: LinkedList&lt;T&gt;) =&gt; void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **list\[index]=xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
......
......@@ -12,7 +12,7 @@ Due to the memory isolation feature of the actor model, cross-thread serializati
## Data Transfer Objects
Data objects that can be transferred are classified into three types: [common objects](#common-objects), [transferable objects](#transferable-objects), and [shared objects](#shared-objects).
Data objects that can be transferred are classified into the following types: [common objects](#common-objects), [transferable objects](#transferable-objects), [shared objects](#shared-objects), and [native binding objects](#native-binding-objects).
### Common Objects
......@@ -24,7 +24,7 @@ The following object types are supported: basic types except Symbol, Date, Strin
### Transferable Objects
Transferable objects are serialized through address transfer. It transfers the ownership of an object of the ArrayBuffer type object, rather than the content in it. After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.
Transferable objects are serialized through address transfer. It transfers the ownership of an object of the ArrayBuffer type, rather than the content in it. After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.
```js
......@@ -47,6 +47,15 @@ If multiple operations are simultaneously performed to modify data stored in an
let sharedBuffer = new SharedArrayBuffer(1024);
```
### Native Binding Objects
Native binding objects are provided by the system. They are bound to underlying system services and enables direct access to these services.
Currently, native bound objects that support serialization include [Context](../application-models/application-context-stage.md) and [RemoteObject](../reference/apis/js-apis-rpc.md#remoteobject).
The **Context** object provides the context information about an application component. It provides a way to access system services and resources so that the application component can interact with the system. For details about how to obtain context information, see [Context (Stage Model)](../application-models/application-context-stage.md).
The **RemoteObject** object implements remote communication. It transfers the reference of an object between processes so that these processes can share the status and methods of the object. The service provider must inherit this class. For details about how to create a **RemoteObject** object, see [RemoteObject](../reference/apis/js-apis-rpc.md#remoteobject).
## TaskPool and Worker
......
......@@ -52,9 +52,9 @@ You are advised to use **HashSet** when you need a set that has only unique elem
| Adding elements| Use **add(value: T)** to add a value to this container.|
| Accessing elements| Use **values()** to return an iterator that contains all the values in this container.|
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet\<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet<T>) => void, thisArg?: Object)** to change a value in this container.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet\<T>) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(value: T)** to remove a value.|
| Deleting elements| Use **clear()** to clear this container.|
......@@ -109,9 +109,9 @@ You are advised to use **TreeSet** when you need to store data in sorted order.
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
| Accessing elements| Use **getFirstValue()** to obtain the first value in this container.|
| Accessing elements| Use **getLastValue()** to obtain the last value in this container.|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet\<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet<T>) => void, thisArg?: Object)** to change a value in this container.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet\<T>) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(value: T)** to remove a value.|
| Deleting elements| Use **clear()** to clear this container.|
......@@ -169,9 +169,9 @@ You are advised to use **LightWeightSet** when you need a set that has only uniq
| Accessing elements| Use **values()** to return an iterator that contains all the values in this container.|
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
| Accessing elements| Use **getValueAt(index: number)** to obtain the value of an element at a given position (specified by **index**).|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet\<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;T&gt;** for data access.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet<T>) => void, thisArg?: Object)** to change a value in this container.|
| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet\<T>) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(key: K)** to remove an element with the specified key.|
| Deleting elements| Use **removeAt(index: number)** to remove an element at a given position (specified by **index**).|
| Deleting elements| Use **clear()** to clear this container.|
......@@ -197,10 +197,10 @@ You are advised to use PlainArray when you need to store KV pairs whose keys are
| Accessing elements| Use **getIndexOfValue(value: T)** to obtain the index of the specified value.|
| Accessing elements| Use **getKeyAt(index: number)** to obtain the key of an element at a given position (specified by **index**).|
| Accessing elements| Use **getValueAt(index: number)** to obtain the value of an element at a given position (specified by **index**).|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray\<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator&lt;[number, T]&gt;** for data access.|
| Modifying elements| Use **setValueAt(index:number, value: T)** to change the value of an element at a given position (specified by **index**).|
| Modifying elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray<T>) => void, thisArg?: Object)** to modify an element in this container.|
| Modifying elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray\<T>) => void, thisArg?: Object)** to modify an element in this container.|
| Deleting elements| Use **remove(key: number)** to remove an element with the specified key.|
| Deleting elements| Use **removeAt(index: number)** to remove an element at a given position (specified by **index**).|
| Deleting elements| Use **removeRangeFrom(index: number, size: number)** to remove elements in a specified range.|
......
......@@ -4,7 +4,7 @@
Data transferred in XML format must be parsed in actual use. Generally, three types of elements need to be parsed, as described in [Parsing XML Tags and Tag Values](#parsing-xml-tags-and-tag-values), [Parsing XML Attributes and Attribute Values](#parsing-xml-attributes-and-attribute-values), and [Parsing XML Event Types and Element Depths](#parsing-xml-event-types-and-element-depths).
The **xml** module provides the **XmlPullParser** class to parse XML files. The input is an object of the ArrayBufffer or DataView type containing XML text, and the output is the parsed information.
The **xml** module provides the **XmlPullParser** class to parse XML files. The input is an object of the ArrayBuffer or DataView type containing XML text, and the output is the parsed information.
**Table 1** XML parsing options
......
......@@ -38,8 +38,9 @@ Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
**Solution**
- Add **focusable\(true\)** to the list item to enable it to obtain focus.
Use either of the following:
- Add **focusable\(true\)** to the list item to enable it to obtain focus.
- Nest a focusable component, for example, **\<Button>**, at the outer layer of each item.
## Why is the click event not triggered for the focused component upon the press of the Enter key after keyboard navigation?
......@@ -139,6 +140,8 @@ Currently, the menu is displayed when the bound component is clicked or long pre
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Solution**
Set the **focusable** attribute of the **\<TextInput>** component to **false**. In this way, the component is not focusable and therefore will not bring up the keyboard.
## How do I implement the slide up and slide down effect for page transition?
......@@ -199,7 +202,7 @@ Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Symptom**
Custom components A and B need to deliver the following effects: When custom component A, displayed at the bottom of the screen by default, is touched, it is hidden, and custom component B slides in from the bottom. When custom component B is touched, it is hidden, and custom component A slides in from the bottom.
Custom components A and B need to deliver the following effects: When custom component A, displayed at the bottom of the screen by default, is touched, it is hidden, and custom component B slides in from the bottom; when custom component B is touched, it is hidden, and custom component A slides in from the bottom.
**Solution**
......@@ -266,4 +269,4 @@ struct ComponentChild2 {
**Reference**
[Transition Animation Within the Component](../ui/arkts-enter-exit-transition.md)
[Enter/Exit Transition](../ui/arkts-enter-exit-transition.md)
......@@ -26,6 +26,13 @@ For details about the APIs, see [native_buffer](../reference/native-apis/_o_h___
The following describes how to use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space.
**Adding Dynamic Link Libraries**
Add the following library to **CMakeLists.txt**:
```txt
libnative_buffer.so
```
**Header File**
```c++
#include <native_buffer/native_buffer.h>
......@@ -52,7 +59,7 @@ The following describes how to use the native APIs provided by **NativeBuffer**
std::cout << "OH_NativeBuffer_Map Failed" << std::endl;
}
// Unmap the ION memory from the process address space when it is no longer needed.
// Unmap the ION memory from the process address space when it is no longer needed.
ret = OH_NativeBuffer_Unmap(buffer);
if (ret != 0) {
std::cout << "OH_NativeBuffer_Unmap Failed" << std::endl;
......
......@@ -27,6 +27,17 @@ For details about the APIs, see [native_image](../reference/native-apis/_o_h___n
The following steps describe how to use the native APIs provided by **NativeImage** to create an **OH_NativeImage** instance as the consumer and update the data to a OpenGL external texture.
**Adding Dynamic Link Libraries**
Add the following libraries to **CMakeLists.txt**:
```txt
libEGL.so
libGLESv3.so
libnative_image.so
libnative_window.so
libnative_buffer.so
```
**Header File**
```c++
#include <EGL/egl.h>
......@@ -159,6 +170,7 @@ The following steps describe how to use the native APIs provided by **NativeImag
4. Write the produced content to a **NativeWindowBuffer** instance.
1. Obtain a NativeWindowBuffer instance from the NativeWindow instance.
```c++
OHNativeWindowBuffer* buffer = nullptr;
int fenceFd;
......@@ -171,7 +183,9 @@ The following steps describe how to use the native APIs provided by **NativeImag
int32_t height = 0x100;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
```
3. Write the produced content to the **NativeWindowBuffer** instance.
2. Write the produced content to the **NativeWindowBuffer** instance.
```c++
static uint32_t value = 0x00;
value++;
......@@ -182,14 +196,18 @@ The following steps describe how to use the native APIs provided by **NativeImag
}
}
```
4. Flush the **NativeWindowBuffer** to the **NativeWindow**.
3. Flush the **NativeWindowBuffer** to the **NativeWindow**.
```c++
// Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed.
Region region{nullptr, 0};
// Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
```
5. Destroy the **NativeWindow** instance when it is no longer needed.
4. Destroy the **NativeWindow** instance when it is no longer needed.
```c++
OH_NativeWindow_DestroyNativeWindow(nativeWindow);
```
......
......@@ -6,11 +6,11 @@ The **NativeVSync** module is used to obtain virtual synchronization (VSync) sig
## Available APIs
| API| Description:|
| API| Description|
| -------- | -------- |
| OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function. |
| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function.|
| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
For details about the APIs, see [native_vsync](../reference/native-apis/_native_vsync.md).
......@@ -19,6 +19,13 @@ For details about the APIs, see [native_vsync](../reference/native-apis/_native_
The following steps describe how to use the native APIs provided by **NativeVSync** to create and destroy an **OH_NativeVSync** instance and set the VSync callback function.
**Adding Dynamic Link Libraries**
Add the following library to **CMakeLists.txt**:
```txt
libnative_vsync.so
```
**Header File**
```c++
#include <native_vsync/native_vsync.h>
......
......@@ -159,5 +159,3 @@ libnative_window.so
// munmap failed
}
```
<!--no_check-->
\ No newline at end of file
......@@ -18,6 +18,15 @@ For details about the APIs, see [Vulkan](../reference/native-lib/third_party_vul
The following steps illustrate how to create a **VkSurfaceKHR** instance.
**Adding Dynamic Link Libraries**
Add the following libraries to **CMakeLists.txt**:
```txt
libace_ndk.z.so
libnative_window.so
libvulkan.so
```
**Header File**
```c++
#include <ace/xcomponent/native_interface_xcomponent.h>
......
......@@ -5,7 +5,7 @@
>
> To use ArkTS, your DevEco Studio must be V3.0.0.900 Beta3 or later.
>
> In this document, DevEco Studio 4.0 Beta1 is used. You can download it [here](../../release-notes/OpenHarmony-v4.0-beta1.md#version-mapping).
> In this document, DevEco Studio 4.0 Beta2 is used. You can download it [here](../../release-notes/OpenHarmony-v4.0-beta2.md#version-mapping).
## Creating an ArkTS Project
......@@ -21,7 +21,9 @@ The following describes how to create the OpenHarmony projects of API 10 and API
![createProject](figures/createProject.png)
3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9** and retain the default values for other parameters.
3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9)** and retain the default values for other parameters.
The **Node** parameter sets the Node.js version to use for the project. You can use an existing version or download a new one.
![chooseStageModel](figures/chooseStageModel.png)
......@@ -43,12 +45,13 @@ The following describes how to create the OpenHarmony projects of API 10 and API
![targetSdkVersion](figures/targetSdkVersion.png)
7. Delete the **runtimeOS** configuration from the **targets** field in all module-level **build-profile.json5** files.
7. Delete the **runtimeOS** configuration from the **targets** field in the module-level **build-profile.json5** files.
![deleteRuntimeOS](figures/deleteRuntimeOS.png)
8. Click **Sync Now** and wait until the synchronization is complete. A project of API version 10 is now created.
### Creating a Project of API Version 9
1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar.
......@@ -57,7 +60,9 @@ The following describes how to create the OpenHarmony projects of API 10 and API
![createProject](figures/createProject.png)
3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9** and retain the default values for other parameters.
3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9)** and retain the default values for other parameters.
The **Node** parameter sets the Node.js version to use for the project. You can use an existing version or download a new one.
![chooseStageModel](figures/chooseStageModel.png)
......@@ -78,11 +83,11 @@ The following describes how to create the OpenHarmony projects of API 10 and API
## ArkTS Project Directory Structure (Stage Model, API Version 10)
![en-us_image_0000001364054489](figures/en-us_image_0000001364054489.png)
![project](figures/project.png)
- **AppScope > app.json5**: application-level configuration information.
- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
- **entry**: OpenHarmony project module, which can be built into an ability package (HAP).
- **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > entryability**: entry to your application/service.
......@@ -99,17 +104,18 @@ The following describes how to create the OpenHarmony projects of API 10 and API
- **oh_modules**: third-party library dependency information. For details about how to adapt a historical npm project to ohpm, see [Manually Migrating Historical Projects](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/project_overview-0000001053822398-V3#section108143331212).
- **build-profile.json5**: application-level configuration options, including **signingConfigs** and **products**. The **runtimeOS** field in **products** indicates the runtime OS. Its default value is **HarmonyOS**. If you are developing an OpenHarmony application, change the value to **OpenHarmony**.
- **build-profile.json5**: application-level configuration information, including the **signingConfigs** and **products** configuration. The **runtimeOS** field in **products** indicates the runtime OS. Its default value is **HarmonyOS**. If you are developing an OpenHarmony application, change the value to **OpenHarmony**.
- **hvigorfile.ts**: application-level build script.
## ArkTS Project Directory Structure (Stage Model, API Version 9)
![en-us_image_0000001364054489](figures/en-us_image_0000001364054489.png)
![project](figures/project.png)
- **AppScope > app.json5**: application-level configuration information.
- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
- **entry**: OpenHarmony project module, which can be built into an ability package (HAP).
- **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > entryability**: entry to your application/service.
......@@ -267,7 +273,7 @@ You can implement page redirection through the [page router](../reference/apis/j
1. Implement redirection from the first page to the second page.
In the **index.ets** file of the first page, bind the **onClick** event to the **Next** button so that clicking the button redirects the user to the second page. The sample code in the **Index.ets** file is shown below:
In the **Index.ets** file of the first page, bind the **onClick** event to the **Next** button so that clicking the button redirects the user to the second page. The sample code in the **Index.ets** file is shown below:
```ts
// Index.ets
......
......@@ -16,6 +16,8 @@
- [@ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-app-ability-serviceExtensionAbility.md)
- [@ohos.app.ability.StartOptions (StartOptions)](js-apis-app-ability-startOptions.md)
- [@ohos.app.ability.UIAbility (UIAbility)](js-apis-app-ability-uiAbility.md)
- [@ohos.app.ability.UIExtensionAbility (Base Class for ExtensionAbilities with UI)](js-apis-app-ability-uiExtensionAbility.md)
- [@ohos.app.ability.UIExtensionContentSession (UI Operation Class for ExtensionAbilities with UI)](js-apis-app-ability-uiExtensionContentSession.md)
- [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](js-apis-app-form-formExtensionAbility.md)
- [@ohos.application.DataShareExtensionAbility (DataShareExtensionAbility)](js-apis-application-dataShareExtensionAbility.md)
- [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md)
......@@ -106,6 +108,7 @@
- [ProcessInformation](js-apis-inner-application-processInformation.md)
- [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)
- [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md)
- [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md)
- [shellCmdResult](js-apis-inner-application-shellCmdResult.md)
- [WindowExtensionContext](js-apis-inner-application-windowExtensionContext.md)
- wantAgent
......@@ -205,12 +208,13 @@
- [@ohos.curves (Interpolation Calculation)](js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md)
- [@ohos.measure (Text Measurement)](js-apis-measure.md)
- [@ohos.mediaquery (Media Query)](js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md)
- [@ohos.promptAction (Prompt)](js-apis-promptAction.md)
- [@ohos.router (Page Routing)](js-apis-router.md)
- [@ohos.measure (Text Measurement)](js-apis-measure.md)
- [@ohos.uiAppearance (UI Appearance)](js-apis-uiappearance.md)
- Graphics
- [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](js-apis-application-windowExtensionAbility.md)
......@@ -225,12 +229,15 @@
- [WebGL2](js-apis-webgl2.md)
- Multimedia
- [@ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)](js-apis-app-ability-MediaControlExtensionAbility.md)
- [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md)
- [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](js-apis-image.md)
- [@ohos.multimedia.media (Media)](js-apis-media.md)
- [@ohos.multimedia.systemSoundManager (System Sound Management)](js-apis-systemSoundManager.md)
- application
- [MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)](js-apis-inner-application-MediaControlExtensionContext.md)
- multimedia
- [ringtonePlayer (Ringtone Player)](js-apis-inner-multimedia-ringtonePlayer.md)
......
# @ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)
The **MediaControlExtensionAbility** module, inherited from [UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md), provides ExtensionAbilities for media playback control. No APIs are added. During actual development, you need to implement the APIs in the parent class to use the lifecycle and capabilities of UIExtensionAbilities. You cannot directly call the base class.
**System capability**: SystemCapability.Multimedia.AVSession.Core
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
> - The APIs provided by this module are system APIs.
## Modules to Import
```js
import MediaControlExtensionAbility from @ohos.app.ability.MediaControlExtensionAbility;
```
......@@ -2687,7 +2687,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------------------- |
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>- **0o400**: The owner has the read permission on a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the read permission on a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or read a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>**NOTE**<br>The following values are in octal format. The returned values are in decimal format. You need to convert the values.<br>- **0o400**: The owner has the permission to read a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the permission to read a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| uid | number | Yes | No | ID of the file owner.|
| gid | number | Yes | No | ID of the user group of the file.|
| size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
......
......@@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want';
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. |
| moduleName<sup>10+</sup> | string | No | Module to which the ability belongs.|
**Example**
......
# MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)
**MediaControlExtensionContext**, inherited from [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md), provides the context environment for [MediaControlExtensionAbility](js-apis-app-ability-MediaControlExtensionAbility.md). It provides MediaControlExtensionAbility-related configuration and APIs for operating the MediaControlExtensionAbility. For example, you can use the APIs to start a MediaControlExtensionAbility.
**System capability**: SystemCapability.Multimedia.AVSession.Core
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
> - The APIs provided by this module are system APIs.
......@@ -286,6 +286,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) =&gt; vo
Subscribes to upload progress events. This API uses a callback to return the result synchronously.
> **NOTE**
>
> To maintain a balance between power consumption and performance, this API cannot be called when the application is running in the background.
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.MiscServices.Upload
......@@ -863,6 +867,10 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
Subscribes to download progress events. This API uses a callback to return the result synchronously.
> **NOTE**
>
> To maintain a balance between power consumption and performance, this API cannot be called when the application is running in the background.
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.MiscServices.Download
......
# ColumnSplit
The **\<ColumnSplit>** component lays out child components vertically and inserts a horizontal divider between components.
The **\<ColumnSplit>** component lays out child components vertically and inserts a horizontal divider between every two child components.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Child Components
Supported
## APIs
ColumnSplit()
......@@ -20,17 +17,24 @@ ColumnSplit()
## Attributes
| Name| Type| Description|
| -------- | -------- | -------- |
| Name | Type | Description |
|-----------------------|-------------------------------------------------------------------|---------------------------------|
| resizeable | boolean | Whether the divider can be dragged.<br/>Default value: **false** |
| divider<sup>10+</sup> | [ColumnSplitDividerStyle](#columnsplitdividerstyle10) \| null | Margin of the divider.<br>- **DividerStyle**: distance between the divider and the child component above or below it.<br>- Default value: **null**, indicating that the top and bottom margins of the divider are 0.|
## ColumnSplitDividerStyle<sup>10+</sup>
| Name | Type | Mandatory| Description |
| ----------- | ------------- | ---- |--------------------------|
| startMargin | [Dimension](ts-types.md#dimension10) | No | Distance between the divider and the child component above it.<br>Default value: **0**|
| endMargin | [Dimension](ts-types.md#dimension10) | No | Distance between the divider and the child component below it.<br>Default value: **0**|
> **NOTE**
>
> Similar to **\<RowSplit>**, the divider of **\<ColumnSplit>** can be dragged to a position that just fully holds a component.
>
> Dragging is not supported in the Previewer. Check the drag effect on a real device.
> Similar to **\<RowSplit>**, the divider of **\<ColumnSplit>** can change the height of the upper and lower child components, but only to the extent that the resultant height falls within the maximum and minimum heights of the child components.
>
> The universal attributes **clip** and **margin** are not supported.
> Universal attributes such as **clip** and **margin** are supported. If **clip** is not set, the default value **true** is used.
## Example
......
# RowSplit
The **\<RowSplit>** lays out child components horizontally and inserts a vertical divider between child components.
The **\<RowSplit>** lays out child components horizontally and inserts a vertical divider between every two child components.
> **NOTE**
>
......@@ -19,15 +19,13 @@ RowSplit()
| Name| Type| Description|
| -------- | -------- | -------- |
| resizeable | boolean | Whether the divider can be dragged.<br>Default value: **false** |
| resizeable | boolean | Whether the divider can be dragged.<br/>Default value: **false** |
> **NOTE**
>
> Similar to **\<RowSplit>**, the divider of **\<RowSplit>** can be dragged to a position that just fully holds a component.
> The divider of **\<RowSplit>** can change the width of the left and right child components, but only to the extent that the resultant width falls within the maximum and minimum widths of the child components.
>
> Dragging is not supported in the Previewer. Check the drag effect on a real device.
>
> The universal attributes **clip** and **margin** are not supported.
> Universal attributes such as **clip** and **margin** are supported. If **clip** is not set, the default value **true** is used.
## Example
......@@ -54,4 +52,4 @@ struct RowSplitExample {
}
```
![en-us_image_0000001212058482](figures/en-us_image_0000001212058482.gif)
![en-us_image_0000001219982729](figures/en-us_image_0000001219982729.gif)
......@@ -24,7 +24,8 @@
- [Audio Error Codes](errorcode-audio.md)
- [Media Error Codes](errorcode-media.md)
- [AVSession Management Error Codes](errorcode-avsession.md)
- Resource Manager
- [Camera Error Codes](errorcode-camera.md)
- Resource Management
- [I18N Error Codes](errorcode-i18n.md)
- [Resource Manager Error Codes](errorcode-resource-manager.md)
- Background Task
......@@ -55,6 +56,7 @@
- [Network Connection Management Error Codes](errorcode-net-connection.md)
- [Ethernet Connection Error Codes](errorcode-net-ethernet.md)
- [Network Sharing Error Codes](errorcode-net-sharing.md)
- [Policy Management Error Codes](errorcode-net-policy.md)
- [mDNS Error Codes](errorcode-net-mdns.md)
- [Traffic Management Error Codes](errorcode-net-statistics.md)
- Connectivity
......@@ -86,7 +88,7 @@
- [Device Management Error Codes](errorcode-device-manager.md)
- [Location Subsystem Error Codes](errorcode-geoLocationManager.md)
- [Screen Hopping Error Codes](errorcode-devicestatus.md)
- [Screen Hopping Error Codes (to Be Deprecated)](errorcode-multimodalinput.md)
- [Screen Hopping Error Codes (To Be Deprecated Soon)](errorcode-multimodalinput.md)
- [Sensor Error Codes](errorcode-sensor.md)
- [Vibrator Error Codes](errorcode-vibrator.md)
- [System Parameter Error Codes](errorcode-system-parameterV9.md)
......@@ -94,7 +96,7 @@
- [Update Error Codes](errorcode-update.md)
- Customization
- [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md)
- Common Library Library
- Common Library
- [Common Library Error Codes](errorcode-utils.md)
- Test
- [UiTest Error Codes](errorcode-uitest.md)
......@@ -76,7 +76,7 @@ Visibility verification fails.
**Solution**
Check whether the application meets the visibility restriction of the started application.
Check whether **exported** under the **Ability** field in the **module.json5** file of the application is set to **true**. If this parameter is set to **true**, the ability can be invoked by other applications. If this parameter is set to **false**, the ability cannot be invoked by other applications.
## 16000006 Cross-User Operation Is Not Allowed
......
# Camera Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 7400101 Invalid Parameter
**Error Message**
Parameter missing or parameter type incorrect.
**Error Description**
A parameter passed in the API is invalid.
**Possible Cause**
The parameter is invalid. For example, the parameter value is not within the range supported.
**Solution**
Pass the correct parameters in the API.
## 7400102 Invalid Operation
**Error Message**
Operation not allowed.
**Error Description**
The operation is not performed in the specified mode.
**Possible Cause**
The API execution sequence is incorrect. For example, the **commitConfig** API is called in prior to **beginConfig**.
**Solution**
Perform operations according to the API reference and guide.
## 7400103 Session Not Configured
**Error Message**
Session not config.
**Error Description**
An operation that requires session configuration is performed before the session is configured.
**Possible Cause**
For example, the **start()** API is called before the session is configured.
**Solution**
Configure the session first.
## 7400104 Session Not Running
**Error Message**
Session not running.
**Error Description**
An operation that requires a running session is performed before the session runs.
**Possible Cause**
For example, the **capture()** API is called before the session runs.
**Solution**
Perform the operation to run the session first.
## 7400105 Session Configuration Locked
**Error Message**
Session config locked.
**Error Description**
The session configuration is locked.
**Possible Cause**
Another thread has locked the session configuration.
**Solution**
Wait until the session configuration is unlocked.
## 7400106 Device Configuration Locked
**Error Message**
Device setting locked.
**Error Description**
The device configuration is locked.
**Possible Cause**
Another thread has locked the device configuration.
**Solution**
Wait until the device configuration is unlocked.
## 7400107 Camera Conflict
**Error Message**
Can not use camera cause of conflict.
**Error Description**
The camera cannot be used due to a conflict.
**Possible Cause**
The opened camera conflicts with the local camera to be used.
**Solution**
Wait until the conflicting camera is released.
## 7400108 Camera Disabled Due to Security Reasons
**Error Message**
Camera disabled cause of security reason.
**Error Description**
The camera cannot be used due to security policies.
**Possible Cause**
The application running in the background attempts to open the camera.
**Solution**
Switch the application to the foreground first.
## 7400109 Camera Preempted
**Error Message**
Can not use camera cause of preempted.
**Error Description**
The camera cannot be used because it is preempted.
**Possible Cause**
Two applications attempt to open the same camera simultaneously.
**Solution**
N/A
## 7400201 Camera Service Error
**Error Message**
Camera service fatal error.
**Error Description**
The camera service is abnormal.
**Possible Cause**
For example, the camera service is restarted or cross-process invoking is abnormal.
**Solution**
Create the service again.
......@@ -44,7 +44,7 @@ BusinessError 401: Parameter error. The type of "${parameterName}" must be ${val
**Description**
This error code is reported when a parameter error occurs.
This error code is reported when a parameter error occurs. Regardless of whether the API is synchronous or asynchronous, this type of error is generally thrown in synchronous mode.
**Possible Causes**
......
......@@ -110,11 +110,11 @@ You can use either the ArtTS or native API to determine whether an API is availa
- Method 2: Import a module using the **import** API. If the current device does not support the module, the import result is **undefined**. Before using an API, you must make sure the API is available.
```ts
import geolocation from '@ohos.geolocation';
import geolocationManager from '@ohos.geoLocationManager';
if (geolocation) {
geolocation.getCurrentLocation((location) => {
console.log(location.latitude, location.longitude);
if (geolocationManager) {
geolocationManager.getCurrentLocation((location) => {
console.log('current location: ' + JSON.stringify(location));
});
} else {
console.log('This device does not support location information.');
......
......@@ -13,6 +13,10 @@ When you return to the home screen, lock the screen, or switch to another applic
To ensure the normal use of features such as music playback and calendar reminders in the background, the system provides constrained background tasks to extend the running time of applications in the background.
## Resource Usage Constraints
The system provides resource quotas for running processes, including the memory usage and CPU usage in a continuous period of time, as well as disk write I/O volume in 24 hours. When the quota is reached, the system generates a warning-level log if the process is running in the foreground, and terminates the process if it is running in the background.
## Background Task Types
For standard-system devices, OpenHarmony provides the following types of constrained background tasks: transient tasks, continuous tasks, deferred tasks, agent-powered reminders, and efficiency resources.
......@@ -29,12 +33,13 @@ You can select a proper background task type to ensure that your application can
For system applications that provide basic capabilities, the system provides an API for [requesting energy resources](efficiency-resource-request.md). After an application calls the API, the system exempts the application from management.
**Figure 1** Selecting a type of background task
**Figure 1** Selecting a type of background task
![bgtask_choice](figures/bgtask_choice.png)
> **NOTE**
>
> 1. The system supports only constrained background tasks. If an application does not use a constrained background task or selects an inappropriate type of background task after switching to the background, its process will be suspended or terminated.
> - The system supports only constrained background tasks. If an application does not use a constrained background task or selects an inappropriate type of background task after switching to the background, its process will be suspended or terminated.
>
> 2. For an application that requests a constrained background task, only the priority of reclaiming the application process is increased. If system resources are severely insufficient, the application process may still be terminated.
> - For an application that requests a constrained background task, only the priority of reclaiming the application process is increased. If system resources are severely insufficient, the application process may still be terminated.
......@@ -40,6 +40,7 @@ The table below lists the main APIs used for efficient resources. For details ab
| reason | string | Yes| Reason for requesting the resource.|
**Table 3** Efficiency resource types
| Name| Value| Description|
| -------- | -------- | -------- |
| CPU | 1 | CPU resource. Such type of resource prevents an application from being suspended.|
......@@ -49,7 +50,8 @@ The table below lists the main APIs used for efficient resources. For details ab
| BLUETOOTH | 16 | Bluetooth resource. Such type of resource ensures that an application in the suspended state can be woken up by Bluetooth-related events.|
| GPS | 32 | GPS resource. Such type of resource ensures that an application in the suspended state can be woken up by GPS-related events.|
| AUDIO | 64 | Audio resource. Such type of resource prevents an application from being suspended when the application has an audio being played.|
| RUNNING_LOCK<sup>10+</sup> | 128 | RUNNING_LOCK resource. Such type of resources prevents locks running in the background from being temporarily released when the application is suspended.|
| SENSOR<sup>10+</sup> | 256 | Sensor resource. Such type of resources prevents sensor callbacks from being intercepted.|
## How to Develop
......
......@@ -144,9 +144,10 @@
- [Component Startup Rules (Stage Model)](application-models/component-startup-rules.md)
- Inter-Device Application Component Interaction (Continuation)
- [Continuation Overview](application-models/inter-device-interaction-hop-overview.md)
- [Cross-Device Migration (for System Applications Only)](application-models/hop-cross-device-migration.md)
- [Cross-Device Migration](application-models/hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](application-models/hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](application-models/subscribe-system-environment-variable-changes.md)
- [Setting Atomic Services to Support Sharing](application-models/atomic-services-support-sharing.md)
- Process Model
- [Process Model Overview](application-models/process-model-stage.md)
- Common Events
......@@ -478,6 +479,7 @@
- [Developing Audio Call](media/audio-call-development.md)
- [Video Playback](media/video-playback.md)
- [Video Recording](media/video-recording.md)
- [Screen Capture](media/avscreen-capture.md)
- Audio and Video Codecs
- [Obtaining Supported Codecs](media/obtain-supported-codecs.md)
- [Audio Encoding](media/audio-encoding.md)
......@@ -544,9 +546,9 @@
- [hapsigner Guide](security/hapsigntool-guidelines.md)
- [HarmonyAppProvision Configuration File](security/app-provision-structure.md)
- AI
- [AI Development](./ai/ai-overview.md)
- [Using MindSpore Lite JavaScript APIs to Develop AI Applications](./ai/mindspore-guidelines-based-js.md)
- [Using MindSpore Lite Native APIs to Develop AI Applications](./ai/mindspore-guidelines-based-native.md)
- [AI Development](ai/ai-overview.md)
- [Using MindSpore Lite JavaScript APIs to Develop AI Applications](ai/mindspore-guidelines-based-js.md)
- [Using MindSpore Lite Native APIs to Develop AI Applications](ai/mindspore-guidelines-based-native.md)
- Connectivity
- Network Management
- [Network Management Overview](connectivity/net-mgmt-overview.md)
......@@ -680,6 +682,7 @@
- Native APIs
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
- Graphics
- [XComponent Development](napi/xcomponent-guidelines.md)
- [Drawing Development](napi/drawing-guidelines.md)
- [NativeBuffer Development](napi/native-buffer-guidelines.md)
- [NativeImage Development](napi/native-image-guidelines.md)
......@@ -730,6 +733,8 @@
- [@ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)](reference/apis/js-apis-app-ability-serviceExtensionAbility.md)
- [@ohos.app.ability.StartOptions (StartOptions)](reference/apis/js-apis-app-ability-startOptions.md)
- [@ohos.app.ability.UIAbility (UIAbility)](reference/apis/js-apis-app-ability-uiAbility.md)
- [@ohos.app.ability.UIExtensionAbility (Base Class for ExtensionAbilities with UI)](reference/apis/js-apis-app-ability-uiExtensionAbility.md)
- [@ohos.app.ability.UIExtensionContentSession (UI Operation Class for ExtensionAbilities with UI)](reference/apis/js-apis-app-ability-uiExtensionContentSession.md)
- [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](reference/apis/js-apis-app-form-formExtensionAbility.md)
- [@ohos.application.DataShareExtensionAbility (DataShareExtensionAbility)](reference/apis/js-apis-application-dataShareExtensionAbility.md)
- [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](reference/apis/js-apis-application-staticSubscriberExtensionAbility.md)
......@@ -820,6 +825,7 @@
- [ProcessInformation](reference/apis/js-apis-inner-application-processInformation.md)
- [ServiceExtensionContext](reference/apis/js-apis-inner-application-serviceExtensionContext.md)
- [UIAbilityContext](reference/apis/js-apis-inner-application-uiAbilityContext.md)
- [UIExtensionContext](reference/apis/js-apis-inner-application-uiExtensionContext.md)
- [shellCmdResult](reference/apis/js-apis-inner-application-shellCmdResult.md)
- [WindowExtensionContext](reference/apis/js-apis-inner-application-windowExtensionContext.md)
- wantAgent
......@@ -935,12 +941,15 @@
- [WebGL](reference/apis/js-apis-webgl.md)
- [WebGL2](reference/apis/js-apis-webgl2.md)
- Multimedia
- [@ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)](reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md)
- [@ohos.multimedia.audio (Audio Management)](reference/apis/js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](reference/apis/js-apis-avsession.md)
- [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md)
- [@ohos.multimedia.systemSoundManager (System Sound Management)](reference/apis/js-apis-systemSoundManager.md)
- application
- [MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)](reference/apis/js-apis-inner-application-MediaControlExtensionContext.md)
- multimedia
- [ringtonePlayer (Ringtone Player)](reference/apis/js-apis-inner-multimedia-ringtonePlayer.md)
- Resource Management
......@@ -1336,6 +1345,7 @@
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
- [Hyperlink](reference/arkui-ts/ts-container-hyperlink.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
......@@ -1351,6 +1361,7 @@
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [UIExtensionComponent](reference/arkui-ts/ts-container-ui-extension-component.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- Media Components
- [Video](reference/arkui-ts/ts-media-components-video.md)
......@@ -1603,6 +1614,7 @@
- [Audio Error Codes](reference/errorcodes/errorcode-audio.md)
- [Media Error Codes](reference/errorcodes/errorcode-media.md)
- [AVSession Management Error Codes](reference/errorcodes/errorcode-avsession.md)
- [Camera Error Codes](reference/errorcodes/errorcode-camera.md)
- Resource Management
- [I18N Error Codes](reference/errorcodes/errorcode-i18n.md)
- [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md)
......@@ -1622,7 +1634,7 @@
- [DataShare Error Codes](reference/errorcodes/errorcode-datashare.md)
- [Distributed Data Object Error Codes](reference/errorcodes/errorcode-distributed-dataObject.md)
- [Distributed KV Store Error Codes](reference/errorcodes/errorcode-distributedKVStore.md)
- [Preferences Error Codes](reference/errorcodes/errorcode-preferences.md)
- [User Preference Error Codes](reference/errorcodes/errorcode-preferences.md)
- File Management
- [File Management Error Codes](reference/errorcodes/errorcode-filemanagement.md)
- Telephony Service
......@@ -1656,7 +1668,7 @@
- [Time and Time Zone Service Error Codes](reference/errorcodes/errorcode-time.md)
- [Webview Error Codes](reference/errorcodes/errorcode-webview.md)
- Account Management
- [Account Error Codes](reference/errorcodes/errorcode-account.md)
- [Account Management Error Codes](reference/errorcodes/errorcode-account.md)
- Device Management
- [Power Consumption Statistics Error Codes](reference/errorcodes/errorcode-batteryStatistics.md)
- [Brightness Error Codes](reference/errorcodes/errorcode-brightness.md)
......
......@@ -9,13 +9,13 @@
| | Item | Writing Instruction |
| ---- | --------------------------------- | ------------------------------------------------------------ |
| 1 | Customer-oriented mindset | **Stand in the shoes of developers and provide the use cases, parameter selection principles, recommendations/tips, sample code, and anything else that a developer will need to develop the API.**|
| 2 | Upload path | Upload markdown files to **docs/en/application-dev/reference/apis**.<br>Upload images to **docs/en/application-dev/reference/apis/figures**. In addition, reference the image path in the markdown file as follows: **![](figures/exampleImage.jpg)**, **![](figures/exampleImage.png)**, or **![](figures/exampleImage.gif)**.|
| 2 | Upload path | Upload markdown files to **docs/en/application-dev/reference/apis**.<br>Upload images to **docs/en/application-dev/reference/apis/figures**. In addition, reference the image path in the markdown file as follows: **\![]\(figures/exampleImage.jpg)**, **\![]\(figures/exampleImage.png)**, or **\![]\(figures/exampleImage.gif)**.|
| 3 | File name | Provide one JS API reference document for each d.ts file. Name the file in the format of **js-apis-exampleModule.md**, where **exampleModule** is a variable and must be the same as the actual module name.<br>Examples:<br>For @ohos.multimedia.audio in the Multimedia subsystem, the JS API file name is **js-apis-audio.md**.<br>For @ohos.telephony.sms in the Telephony subsystem, the JS API file name is **js-apis-sms.md**.|
| 4 | Directory update | After uploading an API reference document, update the **Readme-EN.md** file in **docs/en/application-dev/reference/apis**.<br>The directories are automatically arranged in alphabetical order.|
| 5 | Document structure | - Module description<br>- Initial version description<br>- Modules to Import/Usage description<br>- API description (attributes, constants, methods, enums, and custom types)<br> The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the API reference document.|
| 6 | Initial version description | 1. Use the greater-than sign (**>**) followed by a space to indent the description about the initial version of the module. Unless otherwise marked, all APIs in the module have the same initial version.<br>2. When introducing an API to an existing module, use the **<sup>** tag to mark its earliest version. The format is **<sup>versionNumber+</sup>**, for example, **<sup>7+</sup>**.<br>If an attribute is added to an existing module, suffix the **<sup>** tag to the new attribute name, for example, **newAttribute<sup>7+</sup>**.<br>If a method is added to an existing module, suffix the **<sup>** tag to the method name, for example, **sim.getSimIccId<sup>7+</sup>**. The same rule applies to new interfaces, classes, and enums.|
| 7 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix **deprecated** as a superscript to the content, and use the greater-than sign (**>**) to introduce the initial version and deprecated version.<br>Example: abandonmentMethod<sup>(deprecated)</sup><br>> This API is supported since API version 4 and deprecated since API version 7. You are advised to use [newMethod]\(#newmethod) instead.|
| 8 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute.<br> 1. If only one permission is required for using the API, use the following format:<br>**Required permissions**: ohos.permission.examplePermission<br>2. If multiple permissions are required for using the API, provide the permissions with **and** or **or** in the following format:<br>**Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br> **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB |
| 8 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute.<br> 1. If only one permission is required for using the API, use the following format:<br>**Required permissions**: ohos.permission.examplePermission<br>2. If multiple permissions are required for using the API, provide the permissions with **and** or **or** in the following format:<br>**Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br> **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB|
| 9 | @syscap | 1. Provide a description for every API in the following format, wherein *A.B* indicates a specific system capability.<br> **System capability**: SystemCapability.*A.B*<br>2. There are two cases for adding system capability information to a table (of attributes, enums, constants, or variables).<br> 1) If all the items in a table require the same system capability, add the following information to the front of the table:<br> **System capability**: SystemCapability.*A.B*<br> 2) If the items in a table require different system capabilities, list the system capability for each item in the table.|
| 10 | @system api | 1. If all APIs of the module are system APIs, add the following sentence to the next line of the initial version description:<br>The APIs provided by this module are system APIs.<br>2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description:<br>**System API**: This is a system API.|
| 11 | @FAModelOnly<br>@StageModelOnly | 1. If a module is implemented only for a specific ability model, add the following sentence to the next line of the initial version description:<br>The APIs of this module can be used only in the FA model.<br>Or<br>The APIs of this module can be used only in the stage model.<br>2. If an API is implemented only for a specific ability model, add the following sentence to the API description:<br>**Model restriction**: This API can be used only in the FA model.<br/>Or<br/>**Model restriction**: This API can be used only in the stage model.|
......
......@@ -9,14 +9,14 @@
| | Item | Writing Instruction |
| ---- | ----------- | ---------------------------------------- |
| 1 | Customer-oriented mindset | **Stand in the shoes of developers and provide the use cases, parameter selection principles, recommendations/tips, sample code, and anything else that a developer will need to develop the component.**|
| 2 | Upload path | Upload markdown files to `docs/en/application-dev/reference/arkui-ts`.<br>Upload images to `docs/en/application-dev/reference/arkui-ts/figures`. In addition, reference the image path in the markdown file as follows: `![](figures/exampleImage.jpg)`, `![](figures/exampleImage.png)`, or `![](figures/exampleImage.gif)`.|
| 3 | File name | Provide one TS component reference document for each .d.ts file. Name the file in the format of `ts-componentClassName-componentName.md`.<br>Examples:<br>For the basic component **\<text>**, the reference file name is `ts-basic-component-text.md`.<br>For the container component **\<list>**, the reference file name is `js-container-component-list.md`. |
| 4 | Directory update | After uploading a TS component reference document, update the `Readme-EN.md` file in `docs/en/application-dev/reference/arkui-ts`. |
| 5 | Document structure | - Component description<br>- Initial version description<br>- Modules to import/Usage description<br>- Permission description<br>- APIs, attributes, events, objects, enums, and custom types<br>The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the document. |
| 6 | Initial version description | 1. Use the greater-than sign (`>`) followed by a space to indent the description about the initial version of the component. Unless otherwise marked, all APIs in the component have the same initial version.<br>2. When introducing an API to an existing component, use the `<sup>` tag to mark its initial version. The format is `<sup>versionNumber+</sup>`, for example, `<sup>7+</sup>`.<br>When introducing an attribute to an existing API, use the `<sup>` tag to mark its initial version. The format is `newAttribute<sup>versionNumber+</sup>`, for example, `newAttribute<sup>7+</sup>`. |
| 2 | Upload path | Upload markdown files to `docs/en/application-dev/reference/arkui-ts`.<br>Upload images to **docs/en/application-dev/reference/arkui-ts/figures**. In addition, reference the image path in the markdown file as follows: **\![]\(figures/exampleImage.jpg)**, **\![]\(figures/exampleImage.png)**, or **\![]\(figures/exampleImage.gif)**.|
| 3 | File name | Provide one TS component reference document for each .d.ts file. Name the file in the format of `ts-componentClassName-componentName.md`.<br>Examples:<br>For the basic component **\<text>**, the reference file name is `ts-basic-component-text.md`.<br>For the container component **\<list>**, the reference file name is `js-container-component-list.md`.|
| 4 | Directory update | After uploading a TS component reference document, update the `Readme-EN.md` file in `docs/en/application-dev/reference/arkui-ts`.|
| 5 | Document structure | - Component description<br>- Initial version description<br>- Modules to import/Usage description<br>- Permission description<br>- APIs, attributes, events, objects, enums, and custom types<br>The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the document.|
| 6 | Initial version description | 1. Use the greater-than sign (`>`) followed by a space to indent the description about the initial version of the component. Unless otherwise marked, all APIs in the component have the same initial version.<br>2. When introducing an API to an existing component, use the `<sup>` tag to mark its initial version. The format is `<sup>versionNumber+</sup>`, for example, `<sup>7+</sup>`.<br>When introducing an attribute to an existing API, use the `<sup>` tag to mark its initial version. The format is `newAttribute<sup>versionNumber+</sup>`, for example, `newAttribute<sup>7+</sup>`.|
| 7 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix `deprecated` as a superscript to the content, and use the greater-than sign (`>`) to introduce the substitute API plus a link to the API description.<br>Example: abandonmentMethod<sup>(deprecated)</sup><br>> This API is no longer maintained since API version 7. You are advised to use [newMethod]\(#newmethod) instead.|
| 8 | Permission description | Use "Required Permissions" as a level-2 heading.<br>1. If a specific permission required for using the component can be requested only by system applications, provide the description in the following format:<br>ohos.permission.examplePermission (available only to system applications)<br>2. If a specific permission required for using the component can be requested by all applications, provide the description in the following format:<br>ohos.permission.examplePermission<br>3. If multiple permissions are required for using the component, provide the permissions with `and` or `or` in the following format:<br>ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br>ohos.permission.examplePermissionA or ohos.permission.examplePermissionB |
| 9 | @system api | 1. If all APIs of the component are system APIs, add the following sentence to the next line of the initial version description:<br>The APIs provided by this component are system APIs.<br>2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description:<br>**System API**: This is a system API. |
| 8 | Permission description | Use "Required Permissions" as a level-2 heading.<br>1. If a specific permission required for using the component can be requested only by system applications, provide the description in the following format:<br>ohos.permission.examplePermission (available only to system applications)<br>2. If a specific permission required for using the component can be requested by all applications, provide the description in the following format:<br>ohos.permission.examplePermission<br>3. If multiple permissions are required for using the component, provide the permissions with `and` or `or` in the following format:<br>ohos.permission.examplePermissionA and ohos.permission.examplePermissionB<br>ohos.permission.examplePermissionA or ohos.permission.examplePermissionB|
| 9 | @system api | 1. If all APIs of the component are system APIs, add the following sentence to the next line of the initial version description:<br>The APIs provided by this component are system APIs.<br>2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description:<br>**System API**: This is a system API.|
| 10 | Sample code programming language | Use code blocks to provide sample code, and mark the programming language ts by adding `// xxx.ets` at the beginning of every sample code block.|
| 11 | Link | Link format: [Link text]\(Link content)<br>Cross-folder link format: [markdown file name]\(\.\./../xxx/xxx.md). One `./` indicates one upper-level folder.<br>Intra-topic link format: [Interface A<sup>7+</sup>]\(#xxxa7). The text in the intra-topic link must be the same as the title to be linked. In the link, all letters must be in lowercase, and no special character (except the hyphen) or tag is included.|
......
......@@ -3,7 +3,7 @@
- [Ability framework](js-apidiff-ability.md)
- [Account subsystem](js-apidiff-account.md)
- [AI subsystem](js-apidiff-ai.md)
- [System Applications](js-apidiff-application.md)
- [System applications](js-apidiff-application.md)
- [ArkUI development framework](js-apidiff-arkui.md)
- [Power management subsystem](js-apidiff-battery.md)
- [Bundle management framework](js-apidiff-bundle.md)
......
......@@ -39,7 +39,6 @@
}
```
![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif)
2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types.
......
此差异已折叠。
......@@ -64,7 +64,6 @@
- [跨端迁移](hop-cross-device-migration.md)
- [多端协同(仅对系统应用开放)](hop-multi-device-collaboration.md)
- [订阅系统环境变量的变化](subscribe-system-environment-variable-changes.md)
- [原子化服务支持分享](atomic-services-support-sharing.md)
- 了解进程模型
- [进程模型概述](process-model-stage.md)
- 公共事件
......
......@@ -12,7 +12,7 @@
| 接口名 | 接口描述 |
| -------- | -------- |
| createSubscriber(subscribeInfo:&nbsp;[CommonEventSubscribeInfo](../reference/apis/js-apis-commonEventManager.md#commoneventsubscribeinfo),&nbsp;callback:&nbsp;AsyncCallback&lt;[CommonEventData](../reference/apis/js-apis-commonEventManager.md#commoneventdata)&gt;):&nbsp;void | 创建订阅者对象(callback) |
| createSubscriber(subscribeInfo:&nbsp;[CommonEventSubscribeInfo](../reference/apis/js-apis-commonEventManager.md#commoneventsubscribeinfo),&nbsp;callback:&nbsp;AsyncCallback&lt;[CommonEventSubscriber](../reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md#使用说明)&gt;):&nbsp;void | 创建订阅者对象(callback) |
| createSubscriber(subscribeInfo:&nbsp;CommonEventSubscribeInfo):&nbsp;Promise&lt;CommonEventSubscriber&gt; | 创建订阅者对象(promise) |
| subscribe(subscriber:&nbsp;CommonEventSubscriber,&nbsp;callback:&nbsp;AsyncCallback):&nbsp;void | 订阅公共事件 |
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册