diff --git a/docker/CHANGELOG.md b/docker/CHANGELOG.md
old mode 100644
new mode 100755
index c293b830db2a72958e65485bffa18a06396cca15..ab06f14091985eed7a30233c18eb2df2cecaa03c
--- a/docker/CHANGELOG.md
+++ b/docker/CHANGELOG.md
@@ -1,3 +1,9 @@
+### 1.0.0 (2022/03/09)
+
+合并轻设备和富设备系统docker编译环境。
+
+
+
### 0.0.7 (2022/02/16)
增加安装doxygen工具。
diff --git a/docker/CHANGELOG_en.md b/docker/CHANGELOG_en.md
old mode 100644
new mode 100755
index 1dac4c8e523bf0c6adf63e1c93d289e5a158254e..94189f8d74234167006312d822bad65006ee40a9
--- a/docker/CHANGELOG_en.md
+++ b/docker/CHANGELOG_en.md
@@ -1,10 +1,16 @@
+### 1.0.0 (2022/03/09)
+
+Combine the docker build environment of Mini-System Devices (reference memory ≥ 128 KB), Small-System Devices (reference memory ≥ 1 MB) and Standard-System Devices (reference memory ≥ 128 MB).
+
+
+
### 0.0.7 (2022/02/16)
Added the installation of doxygen.
-### 0.0.6(2022/02/10)
+### 0.0.6 (2022/02/10)
1\. Updated hb.
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9e5371eae3bdb34a3cc2e0238bf7e47f65c36e55..70560a93c1dd890bf8b6ff1d9f03d2e778adbfe0 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -12,80 +12,71 @@
# limitations under the License.
-FROM ubuntu:20.04
-MAINTAINER dongjinguang@huawei.com
+FROM ubuntu:18.04
WORKDIR /home/openharmony
-RUN apt-get update -y \
- && apt-get install curl wget -y \
- && apt-get install vim -y \
- && apt-get install ssh -y \
- && apt-get install git -y \
- && apt-get install python3.8 -y \
- && apt-get install python3-pip -y \
- && apt-get install dosfstools -y \
- && apt-get install mtools -y \
- && apt-get install scons -y \
- && apt-get install make -y \
- && apt-get install libffi-dev -y \
- && apt-get install zip -y \
- && apt-get install python3-distutils -y \
- && apt-get install binutils -y \
- && apt-get install mtd-utils -y \
- && apt-get install libc6-dev-x32 -y \
- && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get -y install tzdata \
- && apt-get install default-jre -y \
- && apt-get install default-jdk -y \
- && apt-get install bison -y \
- && apt-get install flex -y \
- && apt-get install bc -y \
- && apt-get install doxygen -y \
- && apt-get install u-boot-tools -y \
- && apt-get install gcc-arm-linux-gnueabi -y \
- && apt-get install build-essential \
- && apt-get install locales \
- && apt-get install ruby -y \
+RUN sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
+ && sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
+ && apt-get update -y \
+ && apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.8 python3-pip git zip unzip curl wget gcc g++ ruby=1:2.5.1 dosfstools mtools default-jre default-jdk scons python3.8-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev \
+ && apt-get install -y grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5 libncurses5-dev libncursesw5 libstdc++6 python2.7 gcc-arm-none-eabi \
+ && apt-get install -y vim ssh locales \
+ && apt-get install -y doxygen \
&& locale-gen "en_US.UTF-8" \
- && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 \
+ && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 /usr/bin/python3m \
&& ln -s /bin/bash /bin/sh \
&& ln -s /usr/bin/python3.8 /usr/bin/python3 \
+ && ln -s /usr/bin/python3.8 /usr/bin/python3m \
&& ln -s /usr/bin/python3.8 /usr/bin/python \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple setuptools \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple kconfiglib \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple pycryptodome \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple ecdsa \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple ohos-build \
+ && curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/bin/repo \
+ && chmod +x /usr/bin/repo \
+ && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple requests setuptools pymongo kconfiglib pycryptodome ecdsa ohos-build pyyaml prompt_toolkit==1.0.14 redis json2html yagmail python-jenkins \
+ && pip3 install esdk-obs-python --trusted-host pypi.org \
+ && pip3 install six --upgrade --ignore-installed six \
&& mkdir -p /home/tools \
+ && mkdir -p /home/tools/gn \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz \
- && wget -P /home/tools https://mirrors.huaweicloud.com/nodejs/v12.20.0/node-v12.20.0-linux-x64.tar.gz \
- && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar \
- && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar \
- && tar xvf /home/tools/llvm.tar.gz -C /home/tools \
- && tar xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \
- && tar xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \
- && tar xvf /home/tools/ninja.1.9.0.tar -C /home/tools \
- && tar xvf /home/tools/gn-linux-x86-1717.tar.gz -C /home/tools \
- && tar xvf /home/tools/node-v12.20.0-linux-x64.tar.gz -C /home/tools \
+ && wget -P /home/tools https://mirrors.huaweicloud.com/nodejs/v14.15.4/node-v14.15.4-linux-x64.tar.xz \
+ && wget -P /home/tools https://hm-verify.obs.cn-north-4.myhuaweicloud.com/qemu-5.2.0.tar.xz \
+ && tar -xvf /home/tools/llvm.tar.gz -C /home/tools \
+ && tar -xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \
+ && tar -xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \
+ && tar -xvf /home/tools/ninja.1.9.0.tar -C /home/tools \
+ && tar -xvf /home/tools/gn-linux-x86-1717.tar.gz -C /home/tools/gn \
+ && tar -xJf /home/tools/node-v14.15.4-linux-x64.tar.xz -C /home/tools \
+ && cp /home/tools/node-v14.15.4-linux-x64/bin/node /usr/local/bin \
+ && ln -s /home/tools/node-v14.15.4-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
+ && ln -s /home/tools/node-v14.15.4-linux-x64/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
+ && tar -xJf /home/tools/qemu-5.2.0.tar.xz -C /home/tools \
&& sed -i '$aexport PATH=/home/tools/llvm/bin:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/hc-gen:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/gcc_riscv32/bin:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/ninja:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH=/home/tools:$PATH' /root/.bashrc \
+ && sed -i '$aexport PATH=/home/tools/node-v14.15.4-linux-x64/bin:$PATH' /root/.bashrc \
+ && sed -i '$aexport PATH=/home/tools/gn:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/root/.local/bin:$PATH' /root/.bashrc \
&& export PATH=/home/tools/llvm/bin:$PATH \
&& export PATH=/home/tools/hc-gen:$PATH \
&& export PATH=/home/tools/gcc_riscv32/bin:$PATH \
&& export PATH=/home/tools/ninja:$PATH \
&& export PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH \
- && export PATH=/home/tools:$PATH \
+ && export PATH=/home/tools/gn:$PATH \
&& export PATH=/root/.local/bin:$PATH \
+ && cd /home/tools/qemu-5.2.0 \
+ && mkdir build \
+ && cd build \
+ && ../configure --target-list=arm-softmmu \
+ && make -j \
+ && make install \
+ && cd /home/openharmony \
&& rm -rf /home/tools/*.tar \
&& rm -rf /home/tools/*.gz \
+ && rm -rf /home/tools/*.xz \
+ && rm -rf /home/tools/qemu-5.2.0 \
&& npm install -g @ohos/hpm-cli --registry https://mirrors.huaweicloud.com/repository/npm/
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
diff --git a/docker/README.md b/docker/README.md
index 6f536192dcc4a7ea2254aab53b7ea6049ce558dd..d38a6f295c20e79da128ae47d1debdc48b4004e7 100755
--- a/docker/README.md
+++ b/docker/README.md
@@ -2,30 +2,29 @@
### Docker镜像简介
-本文为小型和轻量系统类设备Docker使用指导,[点此查看](https://gitee.com/openharmony/docs/blob/master/docker/standard/Readme.md)标准系统类设备使用指导。
+本文为OpenHarmony的Docker编译环境使用指导。
OpenHarmony的Docker镜像托管在**HuaweiCloud SWR**上,开发者可以通过该镜像在很大程度上简化编译前的环境配置。 目前容器化构建选项支持情况如下:
-| Docker镜像仓库 | 标签 | 说明 |
-| :----------------------------------------------------------- | :------ | :----------------------------------------------------------- |
-| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `0.0.7` | 已经预安装OpenHarmony版本的编译环境,支持轻量系统类设备(参考内存≥128KB)和小型系统类设备(参考内存≥1MB)的版本构建。 |
+| Docker镜像仓库 | 标签 | 说明 |
+| :----------------------------------------------------------- | :------ | :------------------------------------ |
+| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `1.0.0` | 已经预安装OpenHarmony版本的编译环境。 |
### 使用方式及步骤
- 开发者在配置好开发环境后,可以通过以下步骤来使用我们提供的Docker环境。详情请参见[Docker编译环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md)。
+ 开发者在下载好源码后,可以通过以下步骤来使用我们提供的Docker环境。详情请参见[Docker编译环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md)。
1. 获取Docker镜像
```
- docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境
```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
3. 通过如下命令启动不同平台的编译
```
- hb set #设置工作目录。
- . #输入源码所在目录,点(.)表示当前目录。
- 在显示的页面中通过键盘上下键选择需要编译的平台,通过回车确定选择。
+ hb set #在显示的页面中通过键盘上下键选择需要编译的平台,通过回车确定选择。
hb build -f #执行编译。
```
+
diff --git a/docker/README_en.md b/docker/README_en.md
old mode 100644
new mode 100755
index c41dab5a571836e7fc860fc60cef2423daa165f0..9853079a565ee82d2a752ec134b6c29acc7ab43b
--- a/docker/README_en.md
+++ b/docker/README_en.md
@@ -2,30 +2,28 @@
### Docker Image
-This document provides guidance on building the Docker image for mini- and small-system devices. For details about how to build the Docker image for standard-system devices, see [OpenHarmony Docker Image](https://gitee.com/openharmony/docs/blob/master/docker/standard/Readme-en.md)
+This document provides guidance on building the Docker image for mini- and small-system devices.
The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.huaweicloud.com/authui/login.html?service=https%3A%2F%2Fconsole.huaweicloud.com%2Fswr%2F%3Fregion%3Dcn-south-1%26cloud_route_state%3D%2Fapp%2Fwarehouse%2FwarehouseMangeDetail%2Fgoldensir%2Fopenharmony-docker%2Fopenharmony-docker%3Ftype%3DownImage&locale=en-us#/login). Using the Docker image will help simplify environment configurations needed for the building. The following table lists container-based options needed for building in the standalone Docker environment.
-| Docker Image Repository | Tag | Description |
-| :----------------------------------------------------------- | :------ | :----------------------------------------------------------- |
-| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `0.0.7` | The OpenHarmony build environment has been pre-installed. This repository applies to Mini-System Devices (reference memory ≥ 128 KB) and Small-System Devices (reference memory ≥ 1 MB). |
+| Docker Image Repository | Tag | Description |
+| :----------------------------------------------------------- | :------ | :-------------------------------------------------------- |
+| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `1.0.0` | The OpenHarmony build environment has been pre-installed. |
### Usage
- After configuring the development environments, perform the steps below to access the Docker environment.
+ After downloading the OpenHarmony code, perform the steps below to access the Docker environment.
1. Obtain the Docker image.
```
- docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
3. Run the following script to start building for different platforms.
```
- hb set # Set the working directory.
- . # Enter the directory where the source code is stored. If the code is stored in the current directory, enter a period (.).
- Press the Up or Down key to select the platform to build on, then press Enter.
+ hb set # Press the Up or Down key to select the platform to build on, then press Enter.
hb build -f # Start building.
```
diff --git a/docker/build.sh b/docker/build.sh
index 0c8b1fc8b366bf308a245a0e0d2de01be4986ba9..e1a7618251929cd060b0e33c4763e4bb5e5f9057 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-docker build -t openharmony-docker:0.0.7 .
+docker build -t openharmony-docker:1.0.0 .
diff --git a/docker/standard/CHANGELOG.md b/docker/standard/CHANGELOG.md
deleted file mode 100644
index c37b6bc9eefa502a81f7a28c37063a16ca665504..0000000000000000000000000000000000000000
--- a/docker/standard/CHANGELOG.md
+++ /dev/null
@@ -1,36 +0,0 @@
- ### 0.0.8(2022/01/16)
-
-新增安装doxygen。
-
- ### 0.0.7(2022/01/11)
-
-新增安装genext2fs和liblz4-tool。
-
- ### 0.0.6(2022/01/04)
-
-新增安装hb。
-
- ### 0.0.5(2021/10/28)
-
-新增安装tar、binutils、git-lfs、gnutls-bin、python3.8、python3-pip、cpio。
-
- ### 0.0.4(2021/09/18)
-
-1、删除编译依赖的工具预装。
-
-2、增加安装ruby。
-
- ### 0.0.3(2021/08/30)
-
-1、更新llvm版本从10.0.1-62608更新到10.0.1-69957。
-
-2、增加安装gcc_aarch64。
-
- ### 0.0.2(2021/08/11)
-
-新增安装llvm-10.0.1-62608和restool工具。
-
- ### 0.0.1(2021/06/02)
-
-提供OpenHarmony 2.0版本docker编译环境,预装编译依赖工具。
-
diff --git a/docker/standard/CHANGELOG_en.md b/docker/standard/CHANGELOG_en.md
deleted file mode 100644
index ce1cceda1cc1fab4f061a0b3dd3db106a88ad27c..0000000000000000000000000000000000000000
--- a/docker/standard/CHANGELOG_en.md
+++ /dev/null
@@ -1,35 +0,0 @@
- ### 0.0.8 (2022/01/16)
-
-Added the installation of doxygen.
-
- ### 0.0.7 (2022/01/11)
-
-Added the installation of genext2fs and liblz4-tool.
-
- ### 0.0.6 (2022/01/04)
-
-Added the installation of hb.
-
- ### 0.0.5 (2021/10/28)
-
-Added the installation of tar, binutils, git-lfs, gnutls-bin, python3.8, python3-pip, and cpio.
-
- ### 0.0.4 (2021/09/18)
-
-1\. Removed pre-installed build dependency tools.
-
-2\. Added the Ruby installation.
-
- ### 0.0.3 (2021/08/30)
-
-1\. Updated LLVM from 10.0.1-62608 to 10.0.1-69957.
-
-2\. Added the installation of gcc_aarch64.
-
- ### 0.0.2 (2021/08/11)
-
-Added the installation of llvm-10.0.1-62608 and restool.
-
- ### 0.0.1 (2021/06/02)
-
-Provided a Docker build environment for OpenHarmony 2.0 and pre-installed build dependency tools.
\ No newline at end of file
diff --git a/docker/standard/Readme-en.md b/docker/standard/Readme-en.md
deleted file mode 100755
index cdfc3cc4a00bccf3d43cfbd20716d7b7979f3258..0000000000000000000000000000000000000000
--- a/docker/standard/Readme-en.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## Standalone Docker Environment
-
-This document provides guidance on building the Docker image for standard-system devices. For details about how to build the Docker image for mini- and small-system devices, see [OpenHarmony Docker Image](https://gitee.com/openharmony/docs/blob/master/docker/README_en.md)
-
-The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.huaweicloud.com/authui/login.html?service=https%3A%2F%2Fconsole.huaweicloud.com%2Fswr%2F%3Fregion%3Dcn-south-1%26cloud_route_state%3D%2Fapp%2Fwarehouse%2FwarehouseMangeDetail%2Fgoldensir%2Fopenharmony-docker%2Fopenharmony-docker%3Ftype%3DownImage&locale=en-us#/login). Using the Docker image will help simplify environment configurations needed for the building. After configuring the development environments, perform the steps below to access the Docker environment. The following steps use Ubuntu as an example (Windows is also supported).
-
-### Setting Up the Docker Environment for Standard-System Devices (reference memory ≥ 128 MB)
-
-1. Obtain the Docker image.
-```
-docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
-```
-docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-
-### Building for Standard-System Devices (reference memory ≥ 128 MB)
-Run the following script to start building for Standard-System Devices (reference memory ≥ 128 MB)
-
-```
-./build.sh --product-name {product_name} --ccache
-```
-**{product_name}** indicates the platform supported by the current distribution, for example, Hi3516DV300, rk3568.
-Files generated during compilation are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
-
-
-
-**Note**
-
-You can exit Docker by simply running the **exit** command.
\ No newline at end of file
diff --git a/docker/standard/Readme.md b/docker/standard/Readme.md
deleted file mode 100755
index 5997c8b0ade534df555b6c10dda852c26470c1fe..0000000000000000000000000000000000000000
--- a/docker/standard/Readme.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## 独立Docker环境
-
-本文为标准系统类设备Docker使用指导,[点此查看](https://gitee.com/openharmony/docs/blob/master/docker/README.md)小型和轻量系统类设备使用指导。
-
-OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。开发者在配置好开发环境后,通过以下步骤来使用Docker环境。
-
-### 搭建Docker环境-标准系统类设备(参考内存≥128MB)
-
-1. 获取Docker镜像。
-```
-docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。
-```
-docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-
-### 编译源码-标准系统类设备(参考内存≥128MB)
-通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。
-
-```
-./build.sh --product-name {product_name} --ccache
-```
-{product_name}为当前版本支持的平台。比如:Hi3516DV300、rk3568等。
-编译所生成的文件都归档在out/{device_name}/目录下,结果镜像输出在 out/{device_name}/packages/phone/images/ 目录下。
-
-
-
-**说明**
-
- 退出Docker执行exit命令即可。
\ No newline at end of file
diff --git a/docker/standard/build.sh b/docker/standard/build.sh
deleted file mode 100755
index d51927c8ef85f25177137361ea5e22fa0c3da081..0000000000000000000000000000000000000000
--- a/docker/standard/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-docker build -t openharmony-docker-standard:0.0.8 .
diff --git a/docker/standard/dockerfile b/docker/standard/dockerfile
deleted file mode 100755
index 5451542fc8a01443781d940093001760ad4bfc5b..0000000000000000000000000000000000000000
--- a/docker/standard/dockerfile
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM ubuntu:18.04
-WORKDIR /home/openharmony
-
-ARG DEBIAN_FRONTEND=noninteractive
-ARG PREBUILTS_DIR=/home/prebuilts
-ARG HOME_TOOLS=/home/tools
-
-RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
-
-COPY sources.list /etc/apt
-
-RUN apt-get update \
- && apt-get install -y \
- apt-utils \
- vim \
- tar \
- binutils \
- software-properties-common \
- openssh-server \
- iputils-ping \
- curl \
- net-tools \
- bsdmainutils \
- kmod \
- bc \
- rsync \
- gawk \
- ssh \
- ccache \
- zip \
- python-dev \
- make \
- m4 \
- gcc-multilib \
- ca-certificates-java \
- unzip \
- python3-yaml \
- perl \
- openssl \
- libssl1.1 \
- gnupg \
- xsltproc \
- x11proto-core-dev \
- tcl \
- python3-crypto \
- python-yaml \
- python-crypto \
- libxml2-utils \
- libxml2-dev \
- libx11-dev \
- libssl-dev \
- libgl1-mesa-dev \
- lib32z1-dev \
- lib32ncurses5-dev \
- g++-multilib \
- flex \
- bison \
- doxygen \
- git \
- git-lfs \
- subversion \
- tofrodos \
- pigz \
- expect \
- python3-xlrd \
- python-xlrd \
- wget \
- git-core \
- gperf \
- build-essential \
- zlib1g-dev \
- libc6-dev-i386 \
- lib32z-dev \
- openjdk-8-jdk \
- ruby \
- gnutls-bin \
- python3.8 \
- python3-pip \
- cpio \
- genext2fs \
- doxygen \
- liblz4-tool \
- && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 \
- && ln -s /bin/bash /bin/sh \
- && ln -s /usr/bin/python3.8 /usr/bin/python3 \
- && ln -s /usr/bin/python3.8 /usr/bin/python \
- && python3 -m pip install --user ohos-build \
- && mkdir -p $PREBUILTS_DIR/prebuilts $HOME_TOOLS
-
-RUN wget -P $HOME_TOOLS https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz \
- && wget -P $HOME_TOOLS https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12.18.4-darwin-x64.tar.gz \
- && tar xvf $HOME_TOOLS/node-v12.18.4-linux-x64.tar.gz -C $PREBUILTS_DIR/prebuilts \
- && tar xvf $HOME_TOOLS/node-v12.18.4-darwin-x64.tar.gz -C $PREBUILTS_DIR/prebuilts \
- && sed -i '$aexport PATH='"$PREBUILTS_DIR"'/prebuilts/node-v12.18.4-linux-x64/bin:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH='"$PREBUILTS_DIR"'/prebuilts/hc-gen:$PATH' /root/.bashrc \
- && export PATH=$PATH:$PREBUILTS_DIR/prebuilts/node-v12.18.4-linux-x64/bin \
- && export PATH=$PATH:$PREBUILTS_DIR/prebuilts/hc-gen \
- && rm -rf $HOME_TOOLS \
- && npm install -g @ohos/hpm-cli --registry https://registry.npm.taobao.org
diff --git a/docker/standard/sources.list b/docker/standard/sources.list
deleted file mode 100755
index 78030974c6f1729f8d290a59aa3c83f30cc4c472..0000000000000000000000000000000000000000
--- a/docker/standard/sources.list
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main multiverse restricted universe
\ No newline at end of file
diff --git a/en/application-dev/ability/service-ability.md b/en/application-dev/ability/service-ability.md
index 6b1556354adf1f55e937559831fe359072292345..64522a6375f4ccf0f564c56a561bdbb592fa0b7f 100644
--- a/en/application-dev/ability/service-ability.md
+++ b/en/application-dev/ability/service-ability.md
@@ -29,19 +29,19 @@
```javascript
export default {
onStart(want) {
- console.log('SerivceAbility onStart');
+ console.log('ServiceAbility onStart');
},
onCommand(want, restart, startId) {
- console.log('SerivceAbility onCommand');
+ console.log('ServiceAbility onCommand');
},
onConnect(want) {
- console.log('SerivceAbility OnConnect');
+ console.log('ServiceAbility OnConnect');
},
onDisconnect() {
- console.log('SerivceAbility OnDisConnect');
+ console.log('ServiceAbility OnDisConnect');
},
onStop() {
- console.log('SerivceAbility onStop');
+ console.log('ServiceAbility onStop');
},
}
```
@@ -170,17 +170,17 @@ export default {
mMyStub = new MyStub("ServiceAbility-test");
},
onCommand(want, restart, startId) {
- console.log('SerivceAbility onCommand');
+ console.log('ServiceAbility onCommand');
},
onConnect(want) {
- console.log('SerivceAbility OnConnect');
+ console.log('ServiceAbility OnConnect');
return mMyStub;
},
onDisconnect() {
- console.log('SerivceAbility OnDisConnect');
+ console.log('ServiceAbility OnDisConnect');
},
onStop() {
- console.log('SerivceAbility onStop');
+ console.log('ServiceAbility onStop');
},
}
```
@@ -252,17 +252,17 @@ export default {
mMyStub = new MyStub("ServiceAbility-test");
},
onCommand(want, restart, startId) {
- console.log('SerivceAbility onCommand');
+ console.log('ServiceAbility onCommand');
},
onConnect(want) {
- console.log('SerivceAbility OnConnect');
+ console.log('ServiceAbility OnConnect');
return mMyStub;
},
onDisconnect() {
- console.log('SerivceAbility OnDisConnect');
+ console.log('ServiceAbility OnDisConnect');
},
onStop() {
- console.log('SerivceAbility onStop');
+ console.log('ServiceAbility onStop');
},
}
```
diff --git a/en/application-dev/media/audio-overview.md b/en/application-dev/media/audio-overview.md
index 5aac5895bc5d0fc7db7ae0351095b1acf265f8e0..c313e9315eb46c440efb116e318148a666d44012 100755
--- a/en/application-dev/media/audio-overview.md
+++ b/en/application-dev/media/audio-overview.md
@@ -1,8 +1,8 @@
# Audio Overview
-OpenHarmony provides the audio module for your application to implement audio-related features, including audio playback and volume management.
+You can use APIs provided by the audio module to implement audio-related features, including audio playback and volume management.
->![](../public_sys-resources/icon-note.gif) **NOTE:**
+>![](../public_sys-resources/icon-note.gif) **NOTE**
>Due to permission issues, the above features are temporarily unavailable for the standard system.
## Basic Concepts
diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md
index c3fa3085f88b515ef084d2517807a6155787f083..8fc52e97652cd9755d7f2e3a2094913301cd5709 100644
--- a/en/application-dev/reference/apis/js-apis-Bundle.md
+++ b/en/application-dev/reference/apis/js-apis-Bundle.md
@@ -12,7 +12,11 @@ SystemCapability.BundleManager.BundleFramework
## Required Permissions
-None
+| Required Permissions| Permission Level| Description|
+|-------| --------- | ---- |
+| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current application.|
+| ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED| system_basic | Permission to query information about all applications.|
+| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications.|
## bundle.getApplicationInfo
@@ -20,62 +24,35 @@ getApplicationInfo(bundleName: string, bundleFlags: number, userId: number): Pro
Obtains the application information of the specified user based on a given bundle name in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name of the application.|
-| bundleFlags | number | Yes| Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
-| userId | number | Yes| User ID.|
+| bundleName | string | Yes | Bundle name of the application. |
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
-| Type| Description|
+| Type | Description|
| ----------- | -------- |
| Promise\ | Promise used to return the application information.|
**Example**
```js
-bundle.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
- console.info("name: for begin");
- console.info("name:" + data.name);
- console.info("bundleName:" + data.bundleName);
- console.info("description:" + data.description);
- console.info("descriptionId:" + data.descriptionId);
- console.info("iconPath:" + data.iconPath);
- console.info("iconId:" + data.iconId);
- console.info("label:" + data.label);
- console.info("labelId:" + data.labelId);
- console.info("deviceId:" + data.deviceId);
- console.info("signatureKey:" + data.signatureKey);
- console.info("process:" + data.process);
- console.info("isSystemApp:" + data.isSystemApp);
- console.info("isLauncherApp:" + data.isLauncherApp);
- console.info("supportedModes:" + data.supportedModes);
-
- console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
- for (var j = 0; j < data.moduleSourceDirs.length; j++) {
- console.info("moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
- }
- console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
- for (var j = 0; j < data.moduleInfos.length; j++) {
- console.info("moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
- console.info("moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
- }
- console.info("entryDir:" + data.entryDir);
- console.info("codePath:" + data.codePath);
- console.info("dataDir:" + data.dataDir);
- console.info("dataBaseDir:" + data.dataBaseDir);
- console.info("cacheDir:" + data.cacheDir);
+let bundleName = "com.example.myapplication";
+let bundleFlags = 0;
+let userId = 100;
+bundle.getApplicationInfo(bundleName, bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -87,152 +64,69 @@ getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, call
Obtains the application information of the specified user based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name of the application.|
-| bundleFlags | number | Yes| Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
-| userId | number | Yes| User ID.|
-| callback | AsyncCallback\ | Yes| Callback used to return the application information.|
+| bundleName | string | Yes | Bundle name of the application. |
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
+| callback | AsyncCallback\ | Yes | Callback used to return the application information. |
**Example**
```js
-bundle.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name: for begin");
- console.info("name:" + data.name);
- console.info("bundleName:" + data.bundleName);
- console.info("description:" + data.description);
- console.info("descriptionId:" + data.descriptionId);
- console.info("iconPath:" + data.iconPath);
- console.info("iconId:" + data.iconId);
- console.info("label:" + data.label);
- console.info("labelId:" + data.labelId);
- console.info("deviceId:" + data.deviceId);
- console.info("signatureKey:" + data.signatureKey);
- console.info("process:" + data.process);
- console.info("isSystemApp:" + data.isSystemApp);
- console.info("isLauncherApp:" + data.isLauncherApp);
- console.info("supportedModes:" + data.supportedModes);
-
- console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
- for (var j = 0; j < data.moduleSourceDirs.length; j++) {
- console.info("moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
- }
- console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
- for (var j = 0; j < data.moduleInfos.length; j++) {
- console.info("moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
- console.info("moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
- }
- console.info("entryDir:" + data.entryDir);
- console.info("codePath:" + data.codePath);
- console.info("dataDir:" + data.dataDir);
- console.info("dataBaseDir:" + data.dataBaseDir);
- console.info("cacheDir:" + data.cacheDir);
-}
+let bundleName = "com.example.myapplication";
+let bundleFlags = 0;
+let userId = 100;
+bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
```
## bundle.getAllBundleInfo
-getAllBundleInfo(bundleFlag: BundleFlag): Promise>
+getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise>
Obtains the information of all available bundles in the system in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ---------- | ---- | ----------------------------------------------------------- |
-| bundleFlag | BundleFlag | Yes| Type of information that will be returned.
**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
+| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------------- | ----------------------------------- |
| Promise> | Promise used to return the information of all available bundles.|
**Example**
```js
-bundle.getAllBundleInfo(0).then((data) => {
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].vendor:" + data[i].vendor);
- console.info("index[" + i + "].versionCode:" + data[i].versionCode);
- console.info("index[" + i + "].versionName:" + data[i].versionName);
- console.info("index[" + i + "].jointUserId:" + data[i].jointUserId);
- console.info("index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
- console.info("index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
- console.info("index[" + i + "].mainEntry:" + data[i].mainEntry);
- console.info("index[" + i + "].cpuAbi:" + data[i].cpuAbi);
- console.info("index[" + i + "].appId:" + data[i].appId);
- console.info("index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
- console.info("index[" + i + "].targetVersion:" + data[i].targetVersion);
- console.info("index[" + i + "].releaseType:" + data[i].releaseType);
- console.info("index[" + i + "].uid:" + data[i].uid);
- console.info("index[" + i + "].gid:" + data[i].gid);
- console.info("index[" + i + "].seInfo:" + data[i].seInfo);
- console.info("index[" + i + "].entryModuleName:" + data[i].entryModuleName);
- console.info("index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
- console.info("index[" + i + "].isNativeApp:" + data[i].isNativeApp);
- console.info("index[" + i + "].installTime:" + data[i].installTime);
- console.info("index[" + i + "].updateTime:" + data[i].updateTime);
- console.info("index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
- console.info("index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
- console.info('getAllBundleInfo reqPermissions length [' + data[i].reqPermissions.length + ']');
- for (var j = 0; j < data[i].reqPermissions.length; j++) {
- console.info("index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
- }
- console.info('getAllBundleInfo defPermissions length [' + data[i].defPermissions.length + ']');
- for (var j = 0; j < data[i].defPermissions.length; j++) {
- console.info("index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
- }
-
- console.info('getAllBundleInfo hapModuleNames length [' + data[i].hapModuleNames.length + ']');
- for (var j = 0; j < data[i].hapModuleNames.length; j++) {
- console.info("index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
- }
- console.info('getAllBundleInfo moduleNames length [' + data[i].moduleNames.length + ']');
- for (var j = 0; j < data[i].moduleNames.length; j++) {
- console.info("index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
- }
- console.info('getAllBundleInfo modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
- for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
- console.info("index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
- }
- console.info('getAllBundleInfo moduleDirs length [' + data[i].moduleDirs.length + ']');
- for (var j = 0; j < data[i].moduleDirs.length; j++) {
- console.info("index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
- }
- console.info('getAllBundleInfo moduleResPaths length [' + data[i].moduleResPaths.length + ']');
- for (var j = 0; j < data[i].moduleResPaths.length; j++) {
- console.info("index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
- }
- console.info('getAllBundleInfo abilityInfo length [' + data[i].abilityInfos.length + ']');
- for (var j = 0; j < data[i].abilityInfos.length; j++) {
- console.info("index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
- console.info("index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
- }
- }
+let bundleFlag = 0;
+let userId = 100;
+bundle.getAllBundleInfo(bundleFlag, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -244,177 +138,103 @@ getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback> | Yes| Callback used to return the information of all available bundles.|
+| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| callback | AsyncCallback> | Yes | Callback used to return the information of all available bundles. |
**Example**
```js
-bundle.getAllBundleInfo(0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info('xxx getAllBundleInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].vendor:" + data[i].vendor);
- console.info("index[" + i + "].versionCode:" + data[i].versionCode);
- console.info("index[" + i + "].versionName:" + data[i].versionName);
- console.info("index[" + i + "].jointUserId:" + data[i].jointUserId);
- console.info("index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
- console.info("index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
- console.info("index[" + i + "].mainEntry:" + data[i].mainEntry);
- console.info("index[" + i + "].cpuAbi:" + data[i].cpuAbi);
- console.info("index[" + i + "].appId:" + data[i].appId);
- console.info("index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
- console.info("index[" + i + "].targetVersion:" + data[i].targetVersion);
- console.info("index[" + i + "].releaseType:" + data[i].releaseType);
- console.info("index[" + i + "].uid:" + data[i].uid);
- console.info("index[" + i + "].gid:" + data[i].gid);
- console.info("index[" + i + "].seInfo:" + data[i].seInfo);
- console.info("index[" + i + "].entryModuleName:" + data[i].entryModuleName);
- console.info("index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
- console.info("index[" + i + "].isNativeApp:" + data[i].isNativeApp);
- console.info("index[" + i + "].installTime:" + data[i].installTime);
- console.info("index[" + i + "].updateTime:" + data[i].updateTime);
- console.info("index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
- console.info("index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
- console.info('getAllBundleInfo reqPermissions length [' + data[i].reqPermissions.length + ']');
- for (var j = 0; j < data[i].reqPermissions.length; j++) {
- console.info("index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
- }
- console.info('getAllBundleInfo defPermissions length [' + data[i].defPermissions.length + ']');
- for (var j = 0; j < data[i].defPermissions.length; j++) {
- console.info("index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
- }
+let bundleFlag = 0;
+bundle.getAllBundleInfo(bundleFlag, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
+```
- console.info('getAllBundleInfo hapModuleNames length [' + data[i].hapModuleNames.length + ']');
- for (var j = 0; j < data[i].hapModuleNames.length; j++) {
- console.info("index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
- }
- console.info('getAllBundleInfo moduleNames length [' + data[i].moduleNames.length + ']');
- for (var j = 0; j < data[i].moduleNames.length; j++) {
- console.info("index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
- }
- console.info('getAllBundleInfo modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
- for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
- console.info("index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
- }
- console.info('getAllBundleInfo moduleDirs length [' + data[i].moduleDirs.length + ']');
- for (var j = 0; j < data[i].moduleDirs.length; j++) {
- console.info("index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
- }
- console.info('getAllBundleInfo moduleResPaths length [' + data[i].moduleResPaths.length + ']');
- for (var j = 0; j < data[i].moduleResPaths.length; j++) {
- console.info("index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
- }
- console.info('getAllBundleInfo abilityInfo length [' + data[i].abilityInfos.length + ']');
- for (var j = 0; j < data[i].abilityInfos.length; j++) {
- console.info("index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
- console.info("index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
- }
- }
-}
+
+## bundle.getAllBundleInfo
+
+getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void
+
+Obtains the information of all available bundles in the system in asynchronous mode. This method uses a callback to return the result.
+
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
+| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
+| callback | AsyncCallback> | Yes | Callback used to return the information of all available bundles. |
+
+**Example**
+
+```js
+let bundleFlag = 0;
+let userId = 100;
+bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
```
## bundle.getBundleInfo
-getBundleInfo(bundleName: string, bundleFlags: number): Promise\
+getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\
Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
+| bundleName | string | Yes | Bundle name. |
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| options | BundleOptions | No | Includes **userId** and **networkId**. |
**Return value**
-| Type| Description|
+| Type | Description |
| -------------------- | ------------------------------------------ |
| Promise\ | Promise used to return the bundle information.|
**Example**
```js
-bundle.getBundleInfo('com.example.myapplicationInstall', 1).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
-
- console.info('getBundleInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+let options = {
+ "userId" : 100,
+ "networkId" : null
+};
+bundle.getBundleInfo(bundleName, bundleFlags, options)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -426,87 +246,70 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<
Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle information.|
+| bundleName | string | Yes | Bundle name. |
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle information. |
**Example**
```js
-bundle.getBundleInfo('com.example.myapplicationInstall', 1, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
-
- console.info('getBundleInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
-}
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
+## bundle.getBundleInfo
+
+getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\): void
+
+Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
+
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
+| bundleName | string | Yes | Bundle name. |
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| options | BundleOptions | Yes | Includes **userId** and **networkId**. |
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle information. |
+
+**Example**
+
+```js
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+let options = {
+ "userId" : 100,
+ "networkId" : null
+};
+bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
+```
+
## bundle.getAllApplicationInfo
@@ -514,64 +317,33 @@ getAllApplicationInfo(bundleFlags: number, userId: number): Promise**0**: The default application information will be returned.
**8**: The application information containing the permission information will be returned.|
-| userId | number | Yes| User ID.|
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
-| Type| Description|
+| Type | Description |
| -------------------------------- | ------------------------------------------------ |
| Promise> | Promise used to return the application information.|
**Example**
```js
-bundle.getAllApplicationInfo(8, 0).then((data) => {
- console.info('xxx getAllApplicationInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].bundleName:" + data[i].bundleName);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].descriptionId:" + data[i].descriptionId);
- console.info("index[" + i + "].iconPath:" + data[i].iconPath);
- console.info("index[" + i + "].iconId:" + data[i].iconId);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].labelId:" + data[i].labelId);
- console.info("index[" + i + "].deviceId:" + data[i].deviceId);
- console.info("index[" + i + "].signatureKey:" + data[i].signatureKey);
- console.info("index[" + i + "].process:" + data[i].process);
- console.info("index[" + i + "].isSystemApp:" + data[i].isSystemApp);
- console.info("index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
- console.info("index[" + i + "].supportedModes:" + data[i].supportedModes);
-
- console.info('getAllApplicationInfo Async permissions length [' + data[i].permissions.length + ']');
- for (var j = 0; j < data[i].permissions.length; j++) {
- console.info("index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
- }
- console.info('getAllApplicationInfo Async moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
- for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
- console.info("index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
- }
- console.info('getAllApplicationInfo Async moduleInfos length [' + data[i].moduleInfos.length + ']');
- for (var j = 0; j < data[i].moduleInfos.length; j++) {
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
- }
- console.info("index[" + i + "].entryDir:" + data[i].entryDir);
- console.info("index[" + i + "].codePath:" + data[i].codePath);
- console.info("index[" + i + "].dataDir:" + data[i].dataDir);
- console.info("index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
- console.info("index[" + i + "].cacheDir:" + data[i].cacheDir);
- }
+let bundleFlags = 8;
+let userId = 100;
+bundle.getAllApplicationInfo(bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -583,62 +355,30 @@ getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallba
Obtains the information about all installed applications of the specified user. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
-ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default application information will be returned.
**8**: The application information containing the permission information will be returned.|
-| userId | number | Yes| User ID.|
-| callback | AsyncCallback> | Yes| Callback used to return the application information.|
+| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
+| callback | AsyncCallback> | Yes | Callback used to return the application information. |
**Example**
```js
-bundle.getAllApplicationInfo(8, 0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info('xxx getAllApplicationInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].bundleName:" + data[i].bundleName);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].descriptionId:" + data[i].descriptionId);
- console.info("index[" + i + "].iconPath:" + data[i].iconPath);
- console.info("index[" + i + "].iconId:" + data[i].iconId);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].labelId:" + data[i].labelId);
- console.info("index[" + i + "].deviceId:" + data[i].deviceId);
- console.info("index[" + i + "].signatureKey:" + data[i].signatureKey);
- console.info("index[" + i + "].process:" + data[i].process);
- console.info("index[" + i + "].isSystemApp:" + data[i].isSystemApp);
- console.info("index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
- console.info("index[" + i + "].supportedModes:" + data[i].supportedModes);
-
- console.info('getAllApplicationInfo Async permissions length [' + data[i].permissions.length + ']');
- for (var j = 0; j < data[i].permissions.length; j++) {
- console.info("index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
- }
- console.info('getAllApplicationInfo Async moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
- for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
- console.info("index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
- }
- console.info('getAllApplicationInfo Async moduleInfos length [' + data[i].moduleInfos.length + ']');
- for (var j = 0; j < data[i].moduleInfos.length; j++) {
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
- }
- console.info("index[" + i + "].entryDir:" + data[i].entryDir);
- console.info("index[" + i + "].codePath:" + data[i].codePath);
- console.info("index[" + i + "].dataDir:" + data[i].dataDir);
- console.info("index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
- console.info("index[" + i + "].cacheDir:" + data[i].cacheDir);
- }
-}
+let bundleFlags = 8;
+let userId = 100;
+bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
@@ -649,101 +389,38 @@ queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise**0**: The default ability information will be returned.
**2**: The ability information containing the permission information will be returned.
**4**: The ability information containing the application information will be returned.|
-| userId | number | No| User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------------------- | ---------------------------- |
| Promise\>| Promise used to return the ability information.|
**Example**
```js
-bundle.queryAbilityByWant({
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
-}, 1, 0,
-}).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-
+let bundleFlags = 0;
+let userId = 100;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -757,93 +434,29 @@ Obtains the ability information of the specified user based on a given want. Thi
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| want | Want | Yes| Want that contains the bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default ability information will be returned.
**2**: The ability information containing the permission information will be returned.
**4**: The ability information containing the application information will be returned.|
-| userId | number | Yes| User ID.|
-| callback | AsyncCallback> | Yes| Callback used to return the ability information.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
+| callback | AsyncCallback> | Yes | Callback used to return the ability information. |
**Example**
```js
-bundle.queryAbilityByWant(
- {
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
- }, 1, 0,
- }, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-}
+let bundleFlags = 0;
+let userId = 100;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
## bundle.queryAbilityByWant
@@ -854,288 +467,65 @@ Obtains the ability information based on a given want. This method uses an async
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| want | Want | Yes| Want that contains the bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default ability information will be returned.
**2**: The ability information containing the permission information will be returned.
**4**: The ability information containing the application information will be returned.|
-| callback | AsyncCallback> | Yes| Callback used to return the ability information.|
-
-**Example**
-
-```js
-bundle.queryAbilityByWant(
- {
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
- }, 1,
- }, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-}
-```
-
-## bundle.getBundleArchiveInfo
-
-getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise\
-
-Obtains the bundle information from a given HAP file in asynchronous mode. This method uses a promise to return the result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| hapFilePath | string | Yes| Path of the HAP file.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
-
-**Return value**
-
-| Type| Description|
-| -------------------- | ------------------------------------------ |
-| Promise\ | Promise used to return the bundle information.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| callback | AsyncCallback> | Yes | Callback used to return the ability information. |
**Example**
```js
-bundle.getBundleArchiveInfo('/data/test.hap', 1).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleArchiveInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleArchiveInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
- console.info('getBundleArchiveInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleArchiveInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleArchiveInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleArchiveInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
+let bundleFlags = 0;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
-## bundle.getBundleArchiveInfo
-
-getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\): void
-
-Obtains the bundle information from a given HAP file in asynchronous mode. This method uses a callback to return the result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ----------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| hapFilePath | string | Yes| Path of the HAP file.|
-| bundleFlags | number | Yes| Type of information that will be returned.
**0**: The default bundle information will be returned.
**1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback | Yes| Callback used to return the bundle information.|
-
-**Example**
-
-```js
-bundle.getBundleArchiveInfo('/data/test.hap', 1, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleArchiveInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleArchiveInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
- console.info('getBundleArchiveInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleArchiveInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleArchiveInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleArchiveInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
-}
-```
-
## bundle.getBundleInstaller
getBundleInstaller(): Promise
Obtains the bundle installer in asynchronous mode. This method uses a promise to return the result.
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------------ | --------------------------------------------------- |
| Promise | Promise used to return the bundle installer.|
**Example**
```js
-bundle.getBundleInstaller().then((data) => {
- data.install(['/data/test.hap'], {
- param: {
- userId: 0,
- installFlag: 1,
- isKeepData: false
- }
- }, OnReceiveinstallEvent);
-
- function OnReceiveinstallEvent(err, data) {
- console.info("name: for begin");
- console.info("install result code:" + data.status);
- console.info("install result msg:" + data.statusMessage);
- }
+let bundleFilePaths = ['/data/test.hap'];
+let param = {
+ userId : 100,
+ installFlag : 1,
+ isKeepData : false
+};
+bundle.getBundleInstaller()
+.then((installerObject) => {
+ console.info('Operation successful. ');
+ installerObject.install(bundleFilePaths, param)
+ .then((data) => {
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ })
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -1145,141 +535,401 @@ getBundleInstaller(callback: AsyncCallback): void;
Obtains the bundle installer in asynchronous mode. This method uses a callback to return the result.
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ------------------------------------------------- |
-| callback | AsyncCallback | Yes| Callback used to return the bundle installer.|
+| callback | AsyncCallback | Yes | Callback used to return the bundle installer.|
**Example**
```js
-bundle.getBundleInstaller((err, data)=>{
- data.uninstall('com.example.myapplication', {
- userId: 0,
- installFlag: 1,
- isKeepData: false
- }, OnReceiveinstallEvent);
-
- function OnReceiveinstallEvent(err, data) {
- console.info("name: for begin");
- console.info("uninstall result code:" + data.status);
- console.info("uninstall result msg:" + data.statusMessage);
- }
+let bundleFilePaths = ['/data/test.hap'];
+let param = {
+ userId : 100,
+ installFlag : 1,
+ isKeepData : false
+};
+bundle.getBundleInstaller((err, installerObject) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(installerObject));
+ installerObject.install(bundleFilePaths, param, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
})
```
-## bundle.getAllShortcutInfo
-getAllShortcutInfo(bundleName: string): Promise>
+## bundle.getLaunchWantForBundle
+
+getLaunchWantForBundle(bundleName: string): Promise\
+
+Obtains the **Want** object that launches the specified application in asynchronous mode. This method uses a promise to return the result.
-Obtains the shortcut information of the specified bundle in asynchronous mode. This method uses a promise to return the result.
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
-| bundleName | string | Yes| Bundle name.|
+| bundleName | string | Yes | Bundle name of the application.|
**Return value**
-| Type| Description|
-| ----------------------------- | ---------------------------------------------------- |
-| Promise\> | Promise used to return the shortcut information.|
+| Type | Description |
+| --------------------- | ------------------------------------------------------------ |
+| Promise\ | Promise used to return the **Want** object.|
**Example**
```js
-bundle.getAllShortcutInfo('com.example.third1').then((data) => {
- console.log("getAllShortcutInfo data:" + data);
-});
+let bundleName = "com.example.myapplication";
+bundle.getLaunchWantForBundle(bundleName)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+})
```
+## bundle.getLaunchWantForBundle
+getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void;
-## bundle.getAllShortcutInfo
+Obtains the **Want** object that launches the specified application in asynchronous mode. This method uses a callback to return the result.
-getAllShortcutInfo(bundleName: string, callback: AsyncCallback>): void
+**Required permissions**
-Obtains the shortcut information of the specified bundle in asynchronous mode. This method uses a callback to return the result.
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
-| ---------- | ------------------------------------ | ---- | -------------------------------------------------- |
-| bundleName | string | Yes| Bundle name.|
-| callback | AsyncCallback<> | Yes| Callback used to return the shortcut information.|
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | -------- |
+| bundleName | string | Yes | Bundle name of the application.|
+| callback | AsyncCallback\ | Yes | Callback used to return the **Want** object.|
**Example**
```js
-bundle.getAllShortcutInfo('com.example.third1', OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.log("getAllShortcutInfo data:" + data);
-}
+let bundleName = "com.example.myapplication";
+bundle.getLaunchWantForBundle(bundleName, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
-## bundle.checkPermission
-checkPermission(bundleName: string, permission: string): Promise\
+## bundle.getNameForUid
+
+getNameForUid(uid: number): Promise\
-Checks whether a bundle has the specified permission in asynchronous mode. This method uses a promise to return the result.
+Obtains the bundle name based on a UID in asynchronous mode. This method uses a promise to return the result.
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
-| bundleName | string | Yes| Bundle name.|
-| permission | string | Yes| Permission name.|
+| uid | number | Yes | UID based on which the bundle name is to obtain.|
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the verification result.
**-1**: The bundle does not have the specified permission.
**0**: The bundle has the specified permission.|
+| Promise\ | Promise used to return the bundle name.|
**Example**
```js
-bundle.checkPermission('com.example.actsbmscheckpermissiontest', 'com.permission.CAMERA').then((data) => {
- console.log("checkPermission data:" + data);
-});
+let uid = 20010005;
+bundle.getNameForUid(uid)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+})
```
-## bundle.checkPermission
+## bundle.getNameForUid
-checkPermission(bundleName: string, permission: string, callback: AsyncCallback\): void
+getNameForUid(uid: number, callback: AsyncCallback): void;
-Checks whether a bundle has the specified permission in asynchronous mode. This method uses a callback to return the result.
+Obtains the bundle name based on a UID in asynchronous mode. This method uses a callback to return the result.
**Parameters**
-| Name| Type| Mandatory| Description|
-| ---------- | --------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| permission | string | Yes| Permission name.|
-| callback | AsyncCallback\ | Yes| Callback used to return the verification result.
**-1**: The bundle does not have the specified permission.
**0**: The bundle has the specified permission.|
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | -------- |
+| uid | number | Yes | UID based on which the bundle name is to obtain.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
```js
-bundle.checkPermission('com.example.actsbmscheckpermissiontest', 'com.permission.CAMERA', OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.log("checkPermission data:" + data);
-}
+let uid = 20010005;
+bundle.getNameForUid(uid, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
+
## ElementName
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ |
-| deviceId | Read-only| string | No| ID of the device that runs the ability.|
-| bundleName | Read-only| string | Yes| Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
-| abilityName | Read-only| string | Yes| Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| deviceId | Read-only | string | No | ID of the device that runs the ability. |
+| bundleName | Read-only | string | Yes | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| abilityName | Read-only | string | Yes | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| uri | Read-only | string | No | Resource ID.|
+| shortName | Read-only | string | No | Short name of the **ElementName**.|
## InstallStatus
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ------------- | -------- | ---------------- | ---- | ------------------------------------------------------------ |
-| status | Read-only| InstallErrorCode | Yes| Installation result code.
SUCCESS = 0
STATUS_INSTALL_FAILURE = 1
STATUS_INSTALL_FAILURE_ABORTED = 2
STATUS_INSTALL_FAILURE_INVALID = 3
STATUS_INSTALL_FAILURE_CONFLICT = 4
STATUS_INSTALL_FAILURE_STORAGE = 5
STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6
STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B
STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C
STATUS_ABILITY_NOT_FOUND = 0x40
STATUS_BMS_SERVICE_ERROR = 0x41 |
-| statusMessage | Read-only| string | Yes| Message indicating the installation result.|
+| status | Read-only | InstallErrorCode | Yes | Installation result code.
SUCCESS = 0
STATUS_INSTALL_FAILURE = 1
STATUS_INSTALL_FAILURE_ABORTED = 2,
STATUS_INSTALL_FAILURE_INVALID = 3
STATUS_INSTALL_FAILURE_CONFLICT = 4
STATUS_INSTALL_FAILURE_STORAGE = 5
STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6
STATUS_UNINSTALL_FAILURE = 7
STATUS_UNINSTALL_FAILURE_BLOCKED = 8
STATUS_UNINSTALL_FAILURE_ABORTED = 9
STATUS_UNINSTALL_FAILURE_CONFLICT = 10
STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B
STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C
STATUS_RECOVER_FAILURE_INVALID = 0x0D
STATUS_ABILITY_NOT_FOUND = 0x40
STATUS_BMS_SERVICE_ERROR = 0x41
STATUS_FAILED_NO_SPACE_LEFT = 0x42
STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43
STATUS_INSTALL_PERMISSION_DENIED = 0x44
STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 |
+
+## BundleFlag
+
+Enumerates the bundle flags.
+
+| Name | Default Value| Description |
+| ------ | ------ | ------ |
+| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information.|
+| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information.|
+| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information.|
+| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information.|
+| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information.|
+| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions.|
+| GET_ABILITY_INFO_WITH_METADATA | 0x00000020 | Obtains the ability metadata information.|
+| GET_APPLICATION_INFO_WITH_METADATA | 0x00000040 | Obtains the application metadata information.|
+| GET_ABILITY_INFO_SYSTEMAPP_ONLY | 0x00000080 | Obtains only the ability information with information about system applications.|
+| GET_ABILITY_INFO_WITH_DISABLE | 0x00000100 | Obtains information about disabled abilities.|
+| GET_APPLICATION_INFO_WITH_DISABLE | 0x00000200 | Obtains information about disabled applications.|
+| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information.|
+
+## BundleOptions
+
+Describes the bundle options.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| userId | number | Yes| Yes| User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
+| networkId | string | Yes| Yes| Network ID. The default value is **null**.|
+
+## BundleInfo
+
+Describes the application bundle information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | No | Bundle name. |
+| type | string | Yes | No | Bundle type. |
+| appId | string | Yes | No | ID of the application to which the bundle belongs. |
+| uid | number | Yes | No | UID of the application to which the bundle belongs. |
+| installTime | number | Yes | No | Time when the HAP file is installed. |
+| updateTime | number | Yes | No | Time when the HAP file is updated. |
+| appInfo | ApplicationInfo | Yes | No | Application configuration information. |
+| abilityInfo | Array | Yes | No | Ability configuration information. |
+| reqPermissions | Array | Yes | No | Array of the permissions to request from the system. |
+| reqPermissionDetails | Array | Yes | No | Detailed information of the permissions to request from the system.|
+| vendor | string | Yes | No | Vendor of the bundle. |
+| versionCode | number | Yes | No | Version number of the bundle. |
+| versionName | string | Yes | No | Version description of the bundle. |
+| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
+| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
+| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
+| hapModuleInfo | Array | Yes | No | Module configuration information. |
+| entryModuleName | string | Yes | No | Name of the entry module. |
+| cpuAbi | string | Yes | No | cpuAbi information of the bundle. |
+| isSilentInstallation | string | Yes | No | Whether to install the bundle in silent mode. |
+| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
+| entryInstallationFree | boolean | Yes| No| Whether installation-free is supported for the entry.|
+| reqPermissionStates | Array | Yes| No| Permission grant state.|
+
+## ApplicationInfo
+
+Describes the application information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | No | Application name. |
+| description | string | Yes | No | Application description. |
+| descriptionId | number | Yes | No | Application description ID. |
+| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
+| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
+| label | string | Yes | No | Application label. |
+| labelId | string | Yes | No | Application label ID. |
+| icon | string | Yes | No | Application icon. |
+| iconId | string | Yes | No | Application icon ID. |
+| process | string | Yes | No | Process in which this application runs. If this parameter is not set, the bundle name is used by default.|
+| supportedModes | number | Yes | No | Running modes supported by the application. |
+| moduleSourceDirs | Array | Yes | No | Relative paths for storing application resources. |
+| permissions | Array | Yes | No | Permissions required for accessing the application. |
+| moduleInfos | Array | Yes | No | Application module information. |
+| entryDir | string | Yes | No | Path for storing application files. |
+| customizeData | Map> | Yes | Yes | Custom data of the application. |
+| codePath | string | Yes| No| Installation directory of the application.|
+| metaData | Map> | Yes| No| Custom metadata of the application.|
+| removable | boolean | Yes| No| Whether the application is removable.|
+| accessTokenId | number | Yes| No| Access token ID of the application.|
+| uid | number | Yes| No| UID of the application.|
+
+## ModuleInfo
+
+Describes the application module information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| moduleName | string | Yes | No | Module name.|
+| moduleSourceDir | string | Yes | No | Installation directory.|
+
+## CustomizeData
+
+Describes the custom metadata.
+
+| Name | Type | Readable| Writable| Description |
+| ----- | ------ | ---- | ---- | ---------------- |
+| name | string | Yes | Yes | Custom metadata name.|
+| value | string | Yes | Yes | Custom metadata value. |
+| extra | string | Yes | Yes | Custom resources. |
+
+
+## HapModuleInfo
+
+Describes the HAP module information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | No | Module name. |
+| description | string | Yes | No | Module description. |
+| descriptionId | number | Yes | No | Module description ID. |
+| icon | string | Yes | No | Module icon. |
+| label | string | Yes | No | Module label. |
+| labelId | number | Yes | No | Module label ID. |
+| iconId | number | Yes | No | Module icon ID. |
+| backgroundImg | string | Yes | No | Module background image. |
+| supportedModes | number | Yes | No | Modes supported by the module. |
+| reqCapabilities | Array | Yes | No | Capabilities required for module running.|
+| deviceTypes | Array | Yes | No | An array of supported device types.|
+| abilityInfo | Array | Yes | No | Ability information. |
+| moduleName | string | Yes | No | Module name. |
+| mainAbilityName | string | Yes | No | Name of the entry ability. |
+| installationFree | boolean | Yes | No | Whether installation-free is supported. |
+| mainElementName | string | Yes| No| Information about the entry ability.|
+
+## ReqPermissionDetail
+
+Describes the detailed information of the permissions to request from the system.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | Yes | Name of the permission to request. |
+| reason | string | Yes | Yes | Reason for requesting the permission. |
+| usedScene | UsedScene | Yes| Yes| Application scenario and timing for using the permission.|
+
+## UsedScene
+
+Describes the application scenario and timing for using the permission.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| abilities | Array | Yes | Yes | Abilities that use the permission.|
+| when | string | Yes | Yes | Time when the permission is used. |
+
+
+## AbilityInfo
+
+Describes ability information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| bundleName | string | Yes | No | Application bundle name. |
+| name | string | Yes | No | Ability name. |
+| label | string | Yes | No | Ability name visible to users. |
+| description | string | Yes | No | Ability description. |
+| icon | string | Yes | No | Index of the ability icon resource file. |
+| descriptionId | number | Yes | No | Ability description ID. |
+| iconId | number | Yes | No | Ability icon ID. |
+| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
+| process | string | Yes | No | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.|
+| targetAbility | string | Yes | No | Target ability that this ability alias points to. |
+| backgroundModes | number | Yes | No | Background service mode of the ability. |
+| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. |
+| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. |
+| type | AbilityType | Yes | No | Ability type. |
+| orientation | DisplayOrientation | Yes | No | Ability display orientation. |
+| launchMode | LaunchMode | Yes | No | Ability launch mode. |
+| permissions | Array | Yes | No | Permissions required for other applications to call the ability.|
+| deviceTypes | Array | Yes | No | Device types supported by the ability. |
+| deviceCapabilities | Array | Yes | No | Device capabilities required for the ability. |
+| readPermission | string | Yes | No | Permission required for reading the ability data. |
+| writePermission | string | Yes | No | Permission required for writing data to the ability. |
+| applicationInfo | ApplicationInfo | Yes | No | Application configuration information. |
+| formEntity | number | Yes | No | Area where the ability form can be displayed. |
+| minFormHeight | number | Yes | No | Minimum height of the ability form. |
+| defaultFormHeight | number | Yes | No | Default height of the ability form. |
+| minFormWidth | number | Yes | No | Minimum width of the ability form. |
+| defaultFormWidth | number | Yes | No | Default width of the ability form. |
+| uri | string | Yes | No | URI of the ability. |
+| customizeData | Map> | Yes | Yes | Custom data of the ability. |
+| labelId | number | Yes | No | Ability label ID. |
+| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability. |
+| metaData | Array | Yes| No| Custom metadata of the ability.|
+| enabled | boolean | Yes| No| Whether the ability is enabled.|
+
+## AbilityType
+
+Describes the ability type.
+
+| Name | Type| Description |
+| ------- | ---- | --------------------------- |
+| UNKNOWN | None | Unknown ability type. |
+| PAGE | None | Ability that has a UI. |
+| SERVICE | None | Ability that does not have a UI. |
+| DATA | None | Ability that is used to provide data access services.|
+
+## DisplayOrientation
+
+Describes the display orientation.
+
+| Name | Type| Description |
+| ------------- | ---- | ------------------------ |
+| UNSPECIFIED | None | The system automatically determines the display orientation. |
+| LANDSCAPE | None | Landscape orientation. |
+| PORTRAIT | None | Portrait orientation. |
+| FOLLOW_RECENT | None | The page ability orientation is the same as that of the nearest ability in the stack.|
+
+## LaunchMode
+
+Describes the launch mode.
+
+| Name | Type| Description |
+| ----------- | ---- | ------------------- |
+| UNSPECIFIED | 0 | The ability has only one instance.|
+| STANDARD | 1 | The ability can have multiple instances. |
+
+## AbilitySubType
+
+Describes the ability subtype.
+
+| Name | Type| Description |
+| ----------- | ---- | ----------------------------- |
+| UNSPECIFIED | 0 | Undefined ability subtype. |
+| CA | 1 | Ability that has a UI.|
diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md
index 57a9f803f3fa4a5929e43eb01db6e651bff3b1f4..ea7efb523f253f83fec2133b7a9acb37ddd5727d 100644
--- a/en/application-dev/reference/apis/js-apis-Context.md
+++ b/en/application-dev/reference/apis/js-apis-Context.md
@@ -25,12 +25,16 @@ Obtains the local root directory of the application. This method uses a callback
If this method is called for the first time, a root directory is created.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the local root directory of the application.|
+| callback | AsyncCallback\ | Yes | Callback used to return the local root directory of the application.|
**Example**
@@ -52,9 +56,13 @@ Obtains the local root directory of the application. This method uses a promise
If this method is called for the first time, a root directory is created.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ---------------------- |
| Promise\ | Promise used to return the local root directory of the application.|
@@ -76,14 +84,18 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async
Verifies whether a specific PID and UID have the given permission. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ------------------------------------- |
-| permission | string | Yes| Name of the permission to verify.|
-| options | [PermissionOptions](#permissionoptions) | Yes| Permission options.|
-| callback | AsyncCallback\ | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
+| permission | string | Yes | Name of the permission to verify. |
+| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. |
+| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
**Example**
@@ -107,10 +119,10 @@ Verifies whether the current PID and UID have the given permission. This method
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ---------------------- | ---- | ------------------------------------- |
-| permission | string | Yes| Name of the permission to verify.|
-| callback | AsyncCallback\ | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
+| permission | string | Yes | Name of the permission to verify. |
+| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
**Example**
@@ -126,17 +138,21 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\ | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
@@ -160,14 +176,18 @@ requestPermissionsFromUser(permissions: Array\, requestCode: number, res
Requests certain permissions from the system. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- |
-| permissions | Array\ | Yes| Permissions to request. This parameter cannot be **null**.|
-| requestCode | number | Yes| Request code to be passed to **PermissionRequestResult**.|
-| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes| Permission request result.|
+| permissions | Array\ | Yes | Permissions to request. This parameter cannot be **null**. |
+| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
+| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. |
**Example**
```js
@@ -194,11 +214,15 @@ getApplicationInfo(callback: AsyncCallback\)
Obtains information about the current application. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------ |
-| callback | AsyncCallback\ | Yes| Callback used to return the application information.|
+| callback | AsyncCallback\ | Yes | Callback used to return the application information.|
**Example**
@@ -216,9 +240,13 @@ getApplicationInfo(): Promise\
Obtains information about the current application. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------------- | ------------------ |
| Promise\ | Promise used to return the application information.|
@@ -241,11 +269,15 @@ getBundleName(callback: AsyncCallback\): void
Obtains the bundle name of the current ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ----------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
@@ -263,9 +295,13 @@ getBundleName(): Promise\
Obtains the bundle name of the current ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ------------------------- |
| Promise\ | Promise used to return the bundle name.|
@@ -288,11 +324,15 @@ getProcessInfo(callback: AsyncCallback\)
Obtains information about the current process, including the PID and process name. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the process information.|
+| callback | AsyncCallback\ | Yes | Callback used to return the process information.|
**Example**
@@ -310,9 +350,13 @@ getProcessInfo(): Promise\
Obtains information about the current process, including the PID and process name. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | -------------- |
| Promise\ | Promise used to return the process information.|
@@ -337,11 +381,15 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the **ohos.bundle.ElementName** object.|
+| callback | AsyncCallback\ | Yes | Callback used to return the **ohos.bundle.ElementName** object.|
**Example**
@@ -361,9 +409,13 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | ------------------------------------------ |
| Promise\ | Promise used to return the **ohos.bundle.ElementName** object.|
@@ -384,9 +436,13 @@ getProcessName(callback: AsyncCallback\): void
Obtains the name of the current process. This method uses a callback to return the result.
-| Name| Type| Mandatory| Description|
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the process name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the process name.|
**Example**
@@ -404,9 +460,13 @@ getProcessName(): Promise\
Obtains the name of the current process. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | -------------------- |
| Promise\ | Promise used to return the process name.|
@@ -429,11 +489,15 @@ getCallingBundle(callback: AsyncCallback\): void
Obtains the bundle name of the calling ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
@@ -451,9 +515,13 @@ getCallingBundle(): Promise\
Obtains the bundle name of the calling ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------- | ------------------------- |
| Promise\ | Promise used to return the bundle name.|
@@ -470,15 +538,15 @@ context.getCallingBundle().then((data) => {
## PermissionOptions
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name| Readable/Writable| Type | Mandatory| Description |
| ---- | -------- | ------ | ---- | ------ |
-| pid | Read-only| number | No| PID.|
-| uid | Read-only| number | No| UID.|
+| pid | Read-only | number | No | PID.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
+| uid | Read-only | number | No | UID.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
## PermissionRequestResult
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------- | ---- | ------------------ |
-| requestCode | Read-only| number | Yes| Request code passed.|
-| permissions | Read-only| Array\ | Yes| Permissions passed.|
-| authResults | Read-only| Array\ | Yes| Permission request result.|
+| requestCode | Read-only | number | Yes | Request code passed.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
+| permissions | Read-only | Array\ | Yes | Permissions passed.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
+| authResults | Read-only | Array\ | Yes | Permission request result.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md
index 5d85731dc2ee337581c5fa38d7d52d60170675d4..7652774178a2357e7a8cb5928545f80348d1c2d2 100644
--- a/en/application-dev/reference/apis/js-apis-ability-context.md
+++ b/en/application-dev/reference/apis/js-apis-ability-context.md
@@ -1,12 +1,29 @@
# AbilityContext
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
-> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Implements the ability context. This module is inherited from **Context**.
+## Usage
+
+
+Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**.
+
+
+
+```
+import Ability from '@ohos.application.Ability'
+class MainAbility extends Ability {
+ onWindowStageCreate(windowStage) {
+ let context = this.context;
+ }
+}
+```
+
+
## Attributes
| Name| Type| Readable| Writable| Description|
@@ -21,6 +38,10 @@ startAbility(want: Want, callback: AsyncCallback<void>): void
Starts an ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
@@ -42,14 +63,53 @@ Starts an ability. This method uses a callback to return the result.
## startAbility
-startAbility(want: Want): Promise<void>;
+startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void
+
+Starts an ability. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
+
+- Example
+
+ ```
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "com.extreme.test.MainAbility"
+ };
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbility(want, options, (error) => {
+ console.log("error.code = " + error.code)
+ })
+ ```
+
+
+## startAbility
+
+startAbility(want: Want, options: StartOptions): Promise<void>;
Starts an ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
- Return value
| Type| Description|
@@ -63,7 +123,10 @@ Starts an ability. This method uses a promise to return the result.
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
- this.context.startAbility(want)
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbility(want, options)
.then((data) => {
console.log('Operation successful.')
}).catch((error) => {
@@ -78,11 +141,15 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
- | callback | Callback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
+ | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
- Example
@@ -96,17 +163,55 @@ Starts an ability. This method uses a callback to return the execution result wh
);
```
+## startAbilityForResult
+
+startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
+
+Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+ | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
+
+
+- Example
+ ```
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResult(
+ {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options,
+ (error, result) => {
+ console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code)
+ console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode)
+ }
+ );
+ ```
+
## startAbilityForResult
-startAbilityForResult(want: Want): Promise<AbilityResult>;
+startAbilityForResult(want: Want, options: StartOptions): Promise<AbilityResult>;
Starts an ability. This method uses a promise to return the execution result when the ability is terminated.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+
- Return value
| Type| Description|
@@ -115,7 +220,10 @@ Starts an ability. This method uses a promise to return the execution result whe
- Example
```
- this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => {
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options).then((result) => {
console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode)
}, (error) => {
console.log("startAbilityForResult Promise.Reject is called, error.code = " + error.code)
@@ -129,16 +237,20 @@ terminateSelf(callback: AsyncCallback<void>): void;
Terminates this ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.terminateSelf((err) => {
- console.log('terminateSelf result:' + JSON.stringfy(err);
- }
+ console.log('terminateSelf result:' + JSON.stringfy(err));
+ });
```
@@ -148,6 +260,10 @@ terminateSelf(): Promise<void>;
Terminates this ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Return value
| Type| Description|
| -------- | -------- |
@@ -157,7 +273,7 @@ Terminates this ability. This method uses a promise to return the result.
```
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
- )).catch((error) => {
+ }).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
@@ -169,11 +285,15 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi
Terminates this ability. This method uses a callback to return the information to the caller of **startAbilityForResult**.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
- | callback | Callback<void> | No| Callback used to return the information.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
- Example
```
@@ -194,6 +314,10 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
Terminates this ability. This method uses a promise to return information to the caller of **startAbilityForResult**.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
@@ -215,3 +339,157 @@ Terminates this ability. This method uses a promise to return information to the
}
)
```
+
+
+## startAbilityByCall
+
+startAbilityByCall(want: Want): Promise<Caller>;
+
+Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<> | Promise used to return the caller object to communicate with.|
+
+- Example
+
+ ```
+ import Ability from '@ohos.application.Ability';
+ var caller;
+ export default class MainAbility extends Ability {
+ onWindowStageCreate(windowStage) {
+ this.context.startAbilityByCall({
+ bundleName: "com.example.myservice",
+ abilityName: "com.example.myservice.MainAbility",
+ deviceId: ""
+ }).then((obj) => {
+ caller = obj;
+ console.log('Caller GetCaller Get ' + call);
+ }).catch((e) => {
+ console.log('Caller GetCaller error ' + e);
+ });
+ }
+ }
+ ```
+
+
+## requestPermissionsFromUser
+
+requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void;
+
+Requests permissions from the user by displaying a pop-up window. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | permissions | Array<string> | Yes| Permissions to request.|
+ | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.requestPermissionsFromUser(permissions,(result) => {
+ console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
+ });
+ ```
+
+
+## requestPermissionsFromUser
+
+requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>;
+
+Requests permissions from the user by displaying a pop-up window. This method uses a promise to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | permissions | Array<string> | Yes| Permissions to request.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.requestPermissionsFromUser(permissions).then((data) => {
+ console.log('success:' + JSON.stringfy(data));
+ }).catch((error) => {
+ console.log('failed:' + JSON.stringfy(error));
+ });
+ ```
+
+
+## setMissionLabel
+
+setMissionLabel(label: string, callback:AsyncCallback<void>): void;
+
+Sets the label of the ability displayed in the task. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | label | string | Yes| Label of the ability to set.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.setMissionLabel("test",(result) => {
+ console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
+ });
+ ```
+
+
+## setMissionLabel
+
+setMissionLabel(label: string): Promise<void>
+
+Sets the label of the ability displayed in the task. This method uses a promise to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | label | string | Yes| Label of the ability to set.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<void> | Promise used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.setMissionLabel("test").then((data) => {
+ console.log('success:' + JSON.stringfy(data));
+ }).catch((error) => {
+ console.log('failed:' + JSON.stringfy(error));
+ });
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-arraylist.md b/en/application-dev/reference/apis/js-apis-arraylist.md
new file mode 100644
index 0000000000000000000000000000000000000000..e3ba42ce0955682922d7d36766a8a4544d111b83
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-arraylist.md
@@ -0,0 +1,576 @@
+# Linear Container ArrayList
+
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Modules to Import
+
+```
+import ArrayList from '@ohos.util.ArrayList'
+```
+
+## System Capabilities
+
+SystemCapability.Utils.Lang
+
+## ArrayList
+
+### Attributes
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | Yes| No| Number of entries in an array list (called container later).|
+
+
+### constructor
+
+constructor()
+
+A constructor used to create an **ArrayList** instance.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+```
+
+
+### add
+
+add(element: T): boolean
+
+Adds an entry at the end of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to add.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the entry is added successfully; returns **false** otherwise.|
+
+**Example**
+
+ ```
+ let arrayList = new ArrayList();
+ let result = arrayList.add("a");
+ let result1 = arrayList.add(1);
+ let b = [1, 2, 3];
+ let result2 = arrayList.add(b);
+ let c = {name: "lala", age: "13"};
+ let result3 = arrayList.add(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void
+
+Inserts an entry at the specified position in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to insert.|
+| index | number | Yes| Index of the position where the entry is to be inserted.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.insert("A", 0);
+arrayList.insert(0, 1);
+arrayList.insert(true, 2);
+```
+
+### has
+
+has(element: T): boolean
+
+Checks whether this container has the specified entry.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to check.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the specified entry is contained; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+let result = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+arrayList.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result1 = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+```
+
+### getIndexOf
+
+getIndexOf(element: T): number
+
+Obtains the index of the first occurrence of the specified entry in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to query.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Returns the position index if obtained; returns **-1** if the specified entry is not found.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(1);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.getIndexOf(2);
+```
+
+### getLastIndexOf
+
+getLastIndexOf(element: T): number
+
+Obtains the index of the last occurrence of the specified entry in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to query.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Returns the position index if obtained; returns **-1** if the specified entry is not found.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(1);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.getLastIndexOf(2);
+```
+
+### removeByIndex
+
+removeByIndex(index: number): T
+
+Removes an entry with the specified position from this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| index | number | Yes| Position index of the entry to remove.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry removed.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.removeByIndex(2);
+```
+
+### remove
+
+remove(element: T): boolean
+
+Removes the first occurrence of the specified entry from this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to remove.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the entry is removed successfully; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.remove(2);
+```
+
+### removeByRange
+
+removeByRange(fromIndex: number, toIndex: number): void
+
+Removes from this container all of the entries within a range, including the entry at the start position but not that at the end position.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| fromIndex | number | Yes| Index of the start position.|
+| toIndex | number | Yes| Index of the end position.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.removeByRange(2, 4);
+arrayList.removeByRange(4, 3);
+arrayList.removeByRange(2, 6);
+```
+
+### replaceAllElements
+replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList<T>) => T,
+thisArg?: Object): void
+
+Replaces all entries in this container with new entries, and returns the new ones.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callbackfn | function | Yes| Callback invoked for the replacement.|
+| thisArg | Object | No| Value to use when the callback is invoked.|
+
+callbackfn
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| value | T | Yes| Value of the entry that is currently traversed.|
+| index | number | No| Position index of the entry that is currently traversed.|
+| arrlist | ArrayList<T> | No| Instance that invokes the **replaceAllElements** method.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.replaceAllElements((value, index) => {
+ return value = 2 * value;
+});
+arrayList.replaceAllElements((value, index) => {
+ return value = value - 2;
+});
+```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList<T>) => void,
+thisArg?: Object): void
+
+Uses a callback to traverse the entries in this container and obtain their position indexes.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callbackfn | function | Yes| Callback invoked to traverse the entries in the container.|
+| thisArg | Object | No| Value to use when the callback is invoked.|
+
+callbackfn
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| value | T | Yes| Value of the entry that is currently traversed.|
+| index | number | No| Position index of the entry that is currently traversed.|
+| arrlist | ArrayList<T> | No| Instance that invokes the **forEach** method.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.forEach((value, index) => {
+ console.log(value, index);
+});
+```
+
+### sort
+sort(comparator?: (firstValue: T, secondValue: T) => number): void
+
+Sorts entries in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| comparator | function | No| Callback invoked for sorting.|
+
+comparator
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| firstValue | T | Yes| Previous entry.|
+| secondValue | T | Yes| Next entry.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.sort(a, (b => a - b));
+arrayList.sort(a, (b => b - a));
+arrayList.sort();
+```
+
+### subArrayList
+subArrayList(fromIndex: number, toIndex: number): ArrayList<T>
+
+Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **ArrayList** instance.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| fromIndex | number | Yes| Index of the start position.|
+| toIndex | number | Yes| Index of the end position.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| ArrayList<T> | New **ArrayList** instance obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result1 = arrayList.subArrayList(2, 4);
+let result2 = arrayList.subArrayList(4, 3);
+let result3 = arrayList.subArrayList(2, 6);
+```
+
+### clear
+clear(): void
+
+Clears this container and sets its length to **0**.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.clear();
+```
+
+### clone
+clone(): ArrayList<T>
+
+Clones this container and returns a copy. The modification to the copy does not affect the original instance.
+
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| ArrayList<T> | New **ArrayList** instance obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.clone();
+```
+
+### getCapacity
+getCapacity(): number
+
+Obtains the capacity of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Capacity obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.getCapacity();
+```
+
+### convertToArray
+convertToArray(): Array<T>
+
+Converts this container into an array.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Array<T> | Array obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.convertToArray();
+```
+
+### isEmpty
+isEmpty(): boolean
+
+Checks whether this container is empty (contains no entry).
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the container is empty; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.isEmpty();
+```
+
+### increaseCapacityTo
+increaseCapacityTo(newCapacity: number): void
+
+Increases the capacity of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| newCapacity | number | Yes| New capacity.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.increaseCapacityTo(2);
+arrayList.increaseCapacityTo(8);
+```
+
+### trimToCurrentLength
+trimToCurrentLength(): void
+
+Trims the capacity of this container to its current length.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.trimToCurrentLength();
+```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>
+
+Obtains an iterator, each item of which is a JavaScript object.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| IterableIterator<T> | Iterator obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+
+// Method 1:
+for (let item of arrayList) {
+ console.log(item);
+}
+
+// Method 2:
+let iter = arrayList[Symbol.iterator]();
+let temp = iter.next().value;
+while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md
index 80ac13c01931162680670633ac374864c8a24101..85d2dc6b01ebe7dc2dc97e3965985ae1a61efb52 100644
--- a/en/application-dev/reference/apis/js-apis-audio.md
+++ b/en/application-dev/reference/apis/js-apis-audio.md
@@ -1,6 +1,7 @@
# Audio
-This module provides the following functions: audio management, audio rendering and system sound management.
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -284,8 +285,18 @@ Enumerates audio device types.
+## ActiveDeviceType
-## AudioRingMode7+
+Enumerates the active device types.
+
+| Name | Default Value | Default Value |
+| ------------- | ------ | ------------------------------------------------------------ |
+| SPEAKER | 2 | Speaker.
**System capabilities:** SystemCapability.Multimedia.Audio.Device |
+| BLUETOOTH_SCO | 7 | Bluetooth device using the SCO link.
**System capabilities:** SystemCapability.Multimedia.Audio.Device |
+
+
+
+## AudioRingMode
Enumerates ringer modes.
@@ -1028,7 +1039,7 @@ audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=>
## audioManager.mute
-mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+
+mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void
Mutes a stream. This method uses an asynchronous callback to return the result.
@@ -1096,7 +1107,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
## audioManager.mute
-mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+
+mute\(volumeType: AudioVolumeType, mute: boolean\): Promise
Mutes a stream. This method uses a promise to return the result.
@@ -1164,7 +1175,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
## audioManager.isMute
-isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+
+isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void
Checks whether a stream is muted. This method uses an asynchronous callback to return the query result.
@@ -1223,7 +1234,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
## audioManager.isMute
-isMute\(volumeType: AudioVolumeType\): Promise7+
+isMute\(volumeType: AudioVolumeType\): Promise
Checks whether a stream is muted. This method uses a promise to return the result.
@@ -1282,7 +1293,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
## audioManager.isActive
-isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+
+isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\)
Checks whether a stream is active. This method uses an asynchronous callback to return the query result.
@@ -1341,7 +1352,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
## audioManager.isActive
-isActive\(volumeType: AudioVolumeType\): Promise7+
+isActive\(volumeType: AudioVolumeType\): Promise
Checks whether a stream is active. This method uses a promise to return the query result.
@@ -1400,7 +1411,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
## audioManager.setRingerMode
-setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+
+setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void
Sets the ringer mode. This method uses an asynchronous callback to return the result.
@@ -1459,7 +1470,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
## audioManager.setRingerMode
-setRingerMode\(mode: AudioRingMode\): Promise7+
+setRingerMode\(mode: AudioRingMode\): Promise
Sets the ringer mode. This method uses a promise to return the result.
@@ -1518,7 +1529,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
## audioManager.getRingerMode
-getRingerMode\(callback: AsyncCallback\): void7+
+getRingerMode\(callback: AsyncCallback\): void
Obtains the ringer mode. This method uses an asynchronous callback to return the query result.
@@ -1568,7 +1579,7 @@ audioManager.getRingerMode((err, value) => {
## audioManager.getRingerMode
-getRingerMode\(\): Promise7+
+getRingerMode\(\): Promise
Obtains the ringer mode. This method uses a promise to return the query result.
@@ -1606,7 +1617,7 @@ audioManager.getRingerMode().then((value) =>
## audioManager.setAudioParameter
-setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+
+setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void
Sets an audio parameter. This method uses an asynchronous callback to return the result.
@@ -1674,7 +1685,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => {
## audioManager.setAudioParameter
-setAudioParameter\(key: string, value: string\): Promise7+
+setAudioParameter\(key: string, value: string\): Promise
Sets an audio parameter. This method uses a promise to return the result.
@@ -1742,7 +1753,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
## audioManager.getAudioParameter
-getAudioParameter\(key: string, callback: AsyncCallback\): void7+
+getAudioParameter\(key: string, callback: AsyncCallback\)
Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result.
@@ -1801,7 +1812,7 @@ audioManager.getAudioParameter('PBits per sample', (err, value) => {
## audioManager.getAudioParameter
-getAudioParameter\(key: string\): Promise7+
+getAudioParameter\(key: string\): Promise
Obtains the value of an audio parameter. This method uses a promise to return the query result.
@@ -1979,7 +1990,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
## audioManager.setDeviceActive
-setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+
+setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void
Sets a device to the active state. This method uses an asynchronous callback to return the result.
@@ -2048,7 +2059,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
## audioManager.setDeviceActive
-setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+
+setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise
Sets a device to the active state. This method uses a promise to return the result.
@@ -2116,7 +2127,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
## audioManager.isDeviceActive
-isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+
+isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void
Checks whether a device is active. This method uses an asynchronous callback to return the query result.
@@ -2175,7 +2186,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
## audioManager.isDeviceActive
-isDeviceActive\(deviceType: DeviceType\): Promise7+
+isDeviceActive\(deviceType: DeviceType\): Promise
Checks whether a device is active. This method uses a promise to return the query result.
@@ -2234,7 +2245,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) =>
## audioManager.setMicrophoneMute
-setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+
+setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void
Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result.
@@ -2293,7 +2304,7 @@ audioManager.setMicrophoneMute(true, (err) => {
## audioManager.setMicrophoneMute
-setMicrophoneMute\(mute: boolean\): Promise7+
+setMicrophoneMute\(mute: boolean\): Promise
Mutes or unmutes the microphone. This method uses a promise to return the result.
@@ -2352,7 +2363,7 @@ audioManager.setMicrophoneMute(true).then(() =>
## audioManager.isMicrophoneMute
-isMicrophoneMute\(callback: AsyncCallback\): void7+
+isMicrophoneMute\(callback: AsyncCallback\): void
Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result.
@@ -2402,7 +2413,7 @@ audioManager.isMicrophoneMute((err, value) => {
## audioManager.isMicrophoneMute
-isMicrophoneMute\(\): Promise7+
+isMicrophoneMute\(\): Promise
Checks whether the microphone is muted. This method uses a promise to return the query result.
@@ -4121,3 +4132,20 @@ None
```
await ringtonePlayer.release();
```
+
+
+## AudioDeviceDescriptor
+
+Describes an audio device.
+
+| Name | Type | Readable | Writable | Description |
+| -------- | -------- | -------- | -------- | -------- |
+| deviceRole | [DeviceRole](#devicerole) | Yes | No | Device role.
**System capabilities:** SystemCapability.Multimedia.Audio.Device |
+| deviceType | [DeviceType](#devicetype) | Yes | No | Device type.
**System capabilities:** SystemCapability.Multimedia.Audio.Device |
+
+
+## AudioDeviceDescriptors
+
+| Name | Description |
+| -------- | -------- |
+| AudioDeviceDescriptors | Array of **AudioDeviceDescriptor** objects. It is read-only.
**System capabilities:** SystemCapability.Multimedia.Audio.Device |
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index cb8927953871984a8f7784697f61071d96715b94..dc54b14b351dc85a09abd394681bd1dd2d182568 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -17,7 +17,9 @@ dial\(phoneNumber: string, callback: AsyncCallback\): void
Initiates a call. This function uses an asynchronous callback to return the execution result.
-Before using this API, you must declare the **ohos.permission.PLACE\_CALL** permission (a system permission).
+**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
+
+**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
@@ -41,7 +43,9 @@ dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback
Initiates a call. You can set call options as needed. This function uses a promise to return the execution result.
-Before using this API, you must declare the **ohos.permission.PLACE\_CALL** permission (a system permission).
+**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
+
+**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
@@ -102,6 +108,8 @@ hasCall\(callback: AsyncCallback\): void
Checks whether a call is in progress. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -123,6 +131,8 @@ hasCall\(\): Promise
Checks whether a call is in progress. This function uses a promise to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Return value**
| Type| Description|
@@ -147,6 +157,8 @@ getCallState\(callback: AsyncCallback\): void
Obtains the call status. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -168,6 +180,8 @@ getCallState\(\): Promise
Obtains the call status. This function uses a promise to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Return value**
| Type| Description|
@@ -191,6 +205,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\)
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -213,6 +229,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -236,6 +254,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\):
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses a promise to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -266,6 +286,8 @@ formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void
Formats a phone number based on the specified ISO country code. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -288,6 +310,8 @@ formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback:
Formats a phone number based on specified formatting options. This function uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -313,6 +337,8 @@ formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise
Formats a phone number based on specified formatting options. This function uses a promise to return the result.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -349,6 +375,8 @@ The phone number must match the specified country code. For example, for a China
All country codes are supported.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -378,6 +406,8 @@ The phone number must match the specified country code. For example, for a China
All country codes are supported.
+**System capability**: SystemCapability.Telephony.CallManager
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -407,30 +437,40 @@ promise.then(data => {
## DialOptions
Provides an option for determining whether a call is a video call.
-| Parameter| Type| Mandatory| Description|
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name| Type| Mandatory| Description|
| ------ | ------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No| Indication of a video call. The options are as follows:
- **true**: video call
- **false**: voice call|
## CallState
Enumerates call states.
+
| Variable| Value| Description|
| ------------------ | ---- | ------------------------------------------------------------ |
-| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.|
-| CALL_STATE_IDLE | 0 | No call is in progress.|
-| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.|
-| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.|
+| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.
**System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_IDLE | 0 | No call is in progress.
**System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.
**System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.
**System capability**: SystemCapability.Telephony.CallManager|
## EmergencyNumberOptions7+
Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot.
-| Parameter| Type| Mandatory| Description|
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ------------------------------------------ |
| slotId | number | No| SIM card slot ID.
- **0**: slot 1
- **1**: slot 2|
## NumberFormatOptions7+
Provides an option for number formatting.
-| Parameter| Type| Mandatory| Description|
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name| Type| Mandatory| Description|
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No| Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.|
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 92aef3bc743bc5a1e0466fecbbefa94a274f5af3..c076a882942d2145b641555efd8ac2bd5a504fd4 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -1,5 +1,8 @@
# Camera
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
## Modules to Import
```
diff --git a/en/application-dev/reference/apis/js-apis-commonEvent.md b/en/application-dev/reference/apis/js-apis-commonEvent.md
index 655c8682e35e4fe583806a9c9d9c152b0b895abf..32045b0f0c9ed3b12b105e154611456ced48c46b 100644
--- a/en/application-dev/reference/apis/js-apis-commonEvent.md
+++ b/en/application-dev/reference/apis/js-apis-commonEvent.md
@@ -169,9 +169,9 @@ Publishes a common event with given attributes. This method uses a callback to r
```js
// Attributes of a common event.
var options = {
- code: 0; // Result code of the common event
- data: "initial data";// Result data of the common event
- isOrdered: true; // The common event is an ordered one.
+ code: 0, // Result code of the common event
+ data: "initial data",// Result data of the common event
+ isOrdered: true // The common event is an ordered one.
}
// Callback for common event publication
function PublishCallBack(err) {
diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
index 75adfb3f60a650fce157a9fb56ac8c645e395480..49e61156a499d926620ecd0aa7bb6455c4aec9c7 100644
--- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
+++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
@@ -16,13 +16,17 @@ openFile(uri: string, mode: string, callback: AsyncCallback\): void
Opens a file with a specified URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ---------------------------------- |
-| uri | string | Yes| URI of the file to open.|
-| mode | string | Yes| Mode for opening the file. The value can be **rwt**.|
-| callback | AsyncCallback\ | Yes| Callback used to return the file descriptor.|
+| uri | string | Yes | URI of the file to open. |
+| mode | string | Yes | Mode for opening the file. The value can be **rwt**. |
+| callback | AsyncCallback\ | Yes | Callback used to return the file descriptor.|
**Example**
@@ -46,15 +50,19 @@ openFile(uri: string, mode: string): Promise\
Opens a file with a specified URI. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------------ |
-| uri | string | Yes| URI of the file to open.|
-| mode | string | Yes| Mode for opening the file. The value can be **rwt**.|
+| uri | string | Yes | URI of the file to open.|
+| mode | string | Yes | Mode for opening the file. The value can be **rwt**. |
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ---------------- |
| Promise\ | Promise used to return the file descriptor.|
@@ -79,13 +87,17 @@ on(type: 'dataChange', uri: string, callback: AsyncCallback\): void
Registers an observer to observe data specified by a given URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
-| type | string | Yes| Type of the event to observe. The value is **dataChange**.|
-| uri | string | Yes| URI of the data.|
-| callback | AsyncCallback\ | Yes| Callback invoked when the data is changed.|
+| type | string | Yes | Type of the event to observe. The value is **dataChange**. |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | Yes | Callback invoked when the data is changed. |
**Example**
@@ -110,13 +122,17 @@ off(type: 'dataChange', uri: string, callback?: AsyncCallback\): void
Unregisters the observer used to observe data specified by a given URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
-| type | string | Yes| Type of the event to observe. The value is **dataChange**.|
-| uri | string | Yes| URI of the data.|
-| callback | AsyncCallback\ | No| Callback used to return the result.|
+| type | string | Yes | Type of the event to observe. The value is **dataChange**. |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | No | Callback used to return the result. |
**Example**
@@ -145,12 +161,16 @@ getType(uri: string, callback: AsyncCallback\): void
Obtains the MIME type of the data specified by a given URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | --------------------------------------------- |
-| uri | string | Yes| URI of the data.|
-| callback | AsyncCallback\ | Yes| Callback used to return the MIME type.|
+| uri | string | Yes | URI of the data. |
+| callback | AsyncCallback\ | Yes | Callback used to return the MIME type.|
**Example**
@@ -172,14 +192,18 @@ getType(uri: string): Promise\
Obtains the MIME type of the data specified by a given URI. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------------ |
-| uri | string | Yes| URI of the data.|
+| uri | string | Yes | URI of the data.|
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ----------------------------------- |
| Promise\ | Promise used to return the MIME type.|
@@ -203,13 +227,17 @@ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback> | Yes| Callback used to return the supported MIME types.|
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME type of the file. |
+| callback | AsyncCallback\> | Yes | Callback used to return the supported MIME types.|
**Example**
@@ -234,15 +262,19 @@ getFileTypes(uri: string, mimeTypeFilter: string): Promise\>
Obtains the supported MIME types of a specified file. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ---------------------------- |
-| uri | string | Yes| URI of the file.|
-| mimeTypeFilter | string | Yes| MIME type of the file.|
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME type of the file.|
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------------ | ------------------------ |
| Promise\> | Promise used to return the supported MIME types.|
@@ -267,12 +299,16 @@ normalizeUri(uri: string, callback: AsyncCallback\): void
Converts the URI that refers to a Data ability into a normalized URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
-| uri | string | Yes| URI object to normalize.|
-| callback | AsyncCallback\ | Yes| Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
+| uri | string | Yes | URI object to normalize. |
+| callback | AsyncCallback\ | Yes | Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
**Example**
@@ -294,14 +330,18 @@ normalizeUri(uri: string): Promise\
Converts the URI that refers to a Data ability into a normalized URI. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ----------------------- |
-| uri | string | Yes| URI object to normalize.|
+| uri | string | Yes | URI object to normalize.|
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ------------------------------------------------------ |
| Promise\ | Promise used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
@@ -325,12 +365,16 @@ denormalizeUri(uri: string, callback: AsyncCallback\): void
Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string, callback: AsyncCallback\)** to a denormalized one. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | --------------------------------------------------- |
-| uri | string | Yes| URI object to normalize.|
-| callback | AsyncCallback\ | Yes| Callback used to return the denormalized URI object.|
+| uri | string | Yes | URI object to normalize. |
+| callback | AsyncCallback\ | Yes | Callback used to return the denormalized URI object.|
**Example**
@@ -354,14 +398,18 @@ denormalizeUri(uri: string): Promise\
Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string)** to a denormalized one. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ----------------------- |
-| uri | string | Yes| URI object to normalize.|
+| uri | string | Yes | URI object to normalize.|
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ----------------------------------------- |
| Promise\ | Promise used to return the denormalized URI object.|
@@ -385,12 +433,16 @@ notifyChange(uri: string, callback: AsyncCallback\): void
Notifies the registered observer of a change to the data specified by the URI. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
-| uri | string | Yes| URI of the data.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
**Example**
@@ -412,14 +464,18 @@ notifyChange(uri: string): Promise\
Notifies the registered observer of a change to the data specified by the URI. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------------ |
-| uri | string | Yes| URI of the data.|
+| uri | string | Yes | URI of the data.|
**Return value**
-| Type| Description|
+| Type | Description |
| -------------- | --------------------- |
| Promise\ | Promise used to return the result.|
@@ -443,13 +499,17 @@ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback\ | Yes| Callback used to return the index of the inserted data record.|
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.|
+| callback | AsyncCallback\ | Yes | Callback used to return the index of the inserted data record. |
**Example**
@@ -478,15 +538,19 @@ insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise\
Inserts a single data record into the database. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------------ | ---------------- | ---- | ------------------------------------------------------ |
-| uri | string | Yes| URI of the data to insert.|
-| valuesBucket | rdb.ValuesBucket | Yes| Data record to insert. If this parameter is **null**, a blank row will be inserted.|
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.|
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ------------------------ |
| Promise\ | Promise used to return the index of the inserted data record.|
@@ -517,13 +581,17 @@ batchInsert(uri: string, valuesBuckets: Array, callback: Async
Inserts multiple data records into the database. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------------ | ----------------------- | ---- | -------------------------------- |
-| uri | string | Yes| URI of the data to insert.|
-| valuesBucket | Array | Yes| Data records to insert.|
-| callback | AsyncCallback\ | Yes| Callback used to return the number of inserted data records.|
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | Array | Yes | Data records to insert. |
+| callback | AsyncCallback\ | Yes | Callback used to return the number of inserted data records.|
**Example**
@@ -549,15 +617,19 @@ batchInsert(uri: string, valuesBuckets: Array): Promise\ | Yes| Data record to insert.|
+| uri | string | Yes | URI of the data to insert.|
+| valuesBucket | Array | Yes | Data record to insert. |
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ---------------------- |
| Promise\ | Promise used to return the number of inserted data records.|
@@ -585,13 +657,17 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: Asy
Deletes one or more data records from the database. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
-| uri | string | Yes| URI of the data to delete.|
-| valuesBucket | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
-| callback | AsyncCallback\ | Yes| Callback used to return the number of deleted data records.|
+| uri | string | Yes | URI of the data to delete. |
+| valuesBucket | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\ | Yes | Callback used to return the number of deleted data records. |
**Example**
@@ -616,15 +692,19 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\ | Promise used to return the number of deleted data records.|
@@ -650,14 +730,18 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data
Updates data records in the database. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
-| uri | string | Yes| URI of the data to update.|
-| valuesBucket | rdb.ValuesBucket | Yes| New values.|
-| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
-| callback | AsyncCallback\ | Yes| Callback used to return the number of updated data records.|
+| uri | string | Yes | URI of the data to update. |
+| valuesBucket | rdb.ValuesBucket | Yes | New values. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\ | Yes | Callback used to return the number of updated data records. |
**Example**
@@ -689,16 +773,20 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data
Updates data records in the database. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
-| uri | string | Yes| URI of the data to update.|
-| valuesBucket | rdb.ValuesBucket | Yes| New values.|
-| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
+| uri | string | Yes | URI of the data to update. |
+| valuesBucket | rdb.ValuesBucket | Yes | New values. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | -------------------------------------------- |
| Promise\ | Promise used to return the number of updated data records.|
@@ -732,14 +820,18 @@ query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityP
Queries data in the database. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | --------------------------------- | ---- | ------------------------------------------------ |
-| uri | string | Yes| URI of the data to query.|
-| columns | rdb.ValuesBucket | Yes| Columns to query. If this parameter is **null**, all columns will be queried.|
-| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
-| callback | AsyncCallback\ | Yes| Callback used to return the data queried.|
+| uri | string | Yes | URI of the data to query. |
+| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\ | Yes | Callback used to return the data queried. |
**Example**
@@ -768,16 +860,20 @@ query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityP
Queries data in the database. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | --------------------------------- | ---- | ------------------------------------------------ |
-| uri | string | Yes| URI of the data to query.|
-| columns | rdb.ValuesBucket | Yes| Columns to query. If this parameter is **null**, all columns will be queried.|
-| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
+| uri | string | Yes | URI of the data to query. |
+| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------- | -------------- |
| Promise\ | Promise used to return the data queried.|
diff --git a/en/application-dev/reference/apis/js-apis-deque.md b/en/application-dev/reference/apis/js-apis-deque.md
new file mode 100644
index 0000000000000000000000000000000000000000..1d94bd6b83d3707b566165ebfd1d0e2cb6f78afe
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-deque.md
@@ -0,0 +1,274 @@
+# Linear Container Deque
+
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+## Modules to Import
+
+```
+import Deque from '@ohos.util.Deque'
+```
+
+## System Capabilities
+
+SystemCapability.Utils.Lang
+
+## Deque
+
+### Attributes
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | Yes| No| Number of entries in a double-ended queue (deque, called container later).|
+
+### constructor
+
+constructor()
+
+A constructor used to create a **Deque** instance.
+
+**Example**
+
+```
+let deque = new Deque();
+```
+
+### insertFront
+
+insertFront(element: T): void
+
+Inserts an entry at the front of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to insert.|
+
+**Example**
+
+```
+let deque = new Deque;
+deque.insertFront("a");
+deque.insertFront(1);
+let b = [1, 2, 3];
+deque.insertFront(b);
+let c = {name : "lala", age : "13"};
+deque.insertFront(false);
+```
+
+### insertEnd
+
+insertEnd(element: T): void
+
+Inserts an entry at the end of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to insert.|
+
+**Example**
+
+```
+let deque = new Deque;
+deque.insertEnd("a");
+deque.insertEnd(1);
+let b = [1, 2, 3];
+deque.insertEnd(b);
+let c = {name : "lala", age : "13"};
+deque.insertEnd(false);
+```
+
+### has
+
+has(element: T): boolean
+
+Checks whether this container has the specified entry.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to check.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the specified entry is contained; returns **false** otherwise.|
+
+**Example**
+
+```
+let deque = new Deque();
+let result = deque.has("Ahfbrgrbgnutfodgorrogorg");
+deque.insertFront("Ahfbrgrbgnutfodgorrogorg");
+let result1 = deque.has("Ahfbrgrbgnutfodgorrogorg");
+```
+
+### popFirst
+
+popFirst(): T
+
+Removes the first entry of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry removed.|
+
+**Example**
+
+```
+let deque = new Deque();
+deque.insertFront(2);
+deque.insertFront(4);
+deque.insertEnd(5);
+deque.insertFront(2);
+deque.insertFront(4);
+let result = deque.popFirst();
+```
+
+### popLast
+
+popLast(): T
+
+Removes the last entry of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry removed.|
+
+**Example**
+
+```
+let deque = new Deque();
+deque.insertFront(2);
+deque.insertEnd(4);
+deque.insertFront(5);
+deque.insertFront(2);
+deque.insertFront(4);
+deque.popLast();
+let result = deque.popLast();
+```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, deque?: Deque<T>) => void,
+thisArg?: Object): void
+
+Uses a callback to traverse the entries in this container and obtain their position indexes.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callbackfn | function | Yes| Callback invoked to traverse the entries in the container.|
+| thisArg | Object | No| Value to use when the callback is invoked.|
+
+callbackfn
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| value | T | Yes| Value of the element that is currently traversed.|
+| index | number | No| Position index of the entry that is currently traversed.|
+| deque | Deque<T> | No| Instance that invokes the **forEach** method.|
+
+**Example**
+
+```
+let deque = new Deque();
+deque.insertFront(2);
+deque.insertEnd(4);
+deque.insertFront(5);
+deque.insertEnd(4);
+deque.forEach((value, index) => {
+ console.log(value, index);
+});
+```
+
+### getFirst
+
+getFirst(): T;
+
+Obtains the first entry of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry obtained.|
+
+**Example**
+
+```
+let deque = new Deque();
+deque.insertEnd(2);
+deque.insertEnd(4);
+deque.insertFront(5);
+deque.insertFront(4);
+let result = deque.getFirst();
+```
+
+### getLast
+
+getLast(): T
+
+Obtains the last entry of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry obtained.|
+
+**Example**
+
+```
+let deque = new Deque();
+deque.insertFront(2);
+deque.insertFront(4);
+deque.insertFront(5);
+deque.insertFront(4);
+let result = deque.getLast();
+```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>
+
+
+Obtains an iterator, each item of which is a JavaScript object.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| IterableIterator<T> | Iterator obtained.|
+
+**Example**
+```
+let deque = new Deque();
+deque.insertFront(2);
+deque.insertFront(4);
+deque.insertFront(5);
+deque.insertFront(4);
+
+// Method 1:
+for (let item of deque) {
+ console.log(item);
+}
+
+// Method 2:
+let iter = deque[Symbol.iterator]();
+let temp = iter.next().value;
+while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-distributed-data.md b/en/application-dev/reference/apis/js-apis-distributed-data.md
index ed190a2e4e52c1bd771db9dc8448904d15f58031..eb9d6b4f5933cb441dbd7f91324927ade936013e 100644
--- a/en/application-dev/reference/apis/js-apis-distributed-data.md
+++ b/en/application-dev/reference/apis/js-apis-distributed-data.md
@@ -591,7 +591,7 @@ Defines the KV store constants.
## Schema8+ ##
-Defines a database schema. When creating or opening a KV store, you can create **Schema** objects and put them into **Options**.
+Defines a database schema. When creating or opening a KV store, you can create a **Schema** object and put it into **Options**.
### toJsonString8+ ###
@@ -1096,13 +1096,13 @@ Checks whether the data read position is after the last row.
getEntry(): Entry;
-Obtains KV pairs.
+Obtains a KV pair.
- Return value
| Type| Description|
| ------ | ------- |
-| Entry |KV pairs obtained.|
+| Entry |KV pair obtained.|
- Example
@@ -2387,7 +2387,7 @@ Deletes KV pairs in batches from this KV store. This method uses a promise to re
startTransaction(callback: AsyncCallback<void>): void;
-Starts transactions in this KV store. This method uses an asynchronous callback to return the result.
+Starts the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters
@@ -2437,7 +2437,7 @@ Starts transactions in this KV store. This method uses an asynchronous callback
startTransaction(): Promise<void>;
-Starts transactions in this KV store. This method uses a promise to return the result.
+Starts the transaction in this KV store. This method uses a promise to return the result.
- Return value
@@ -2470,7 +2470,7 @@ Starts transactions in this KV store. This method uses a promise to return the r
commit(callback: AsyncCallback<void>): void;
-Commits transactions in this KV store. This method uses an asynchronous callback to return the result.
+Commits the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters
@@ -2500,7 +2500,7 @@ Commits transactions in this KV store. This method uses an asynchronous callback
commit(): Promise<void>;
-Commits transactions in this KV store. This method uses a promise to return the result.
+Commits the transaction in this KV store. This method uses a promise to return the result.
- Return value
@@ -2528,7 +2528,7 @@ Commits transactions in this KV store. This method uses a promise to return the
rollback(callback: AsyncCallback<void>): void;
-Rolls back transactions in this KV store. This method uses an asynchronous callback to return the result.
+Rolls back the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters
@@ -2558,7 +2558,7 @@ Rolls back transactions in this KV store. This method uses an asynchronous callb
rollback(): Promise<void>;
-Rolls back transactions in this KV store. This method uses a promise to return the result.
+Rolls back the transaction in this KV store. This method uses a promise to return the result.
- Return value
diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md
index be430dce1a7275fd27d7c387199c0d353b8e8d02..08f53266f7a09ada42632df73fb0f58e6966a070 100644
--- a/en/application-dev/reference/apis/js-apis-extension-context.md
+++ b/en/application-dev/reference/apis/js-apis-extension-context.md
@@ -11,4 +11,4 @@ Implements the extension context. This module is inherited from **Context**.
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.|
+| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
diff --git a/en/application-dev/reference/apis/js-apis-featureAbility.md b/en/application-dev/reference/apis/js-apis-featureAbility.md
index 49119078246995104a0e2d3fd5a401c7c93371d4..505e8cee17663326854d0e2c903a3bc682e9a2b1 100644
--- a/en/application-dev/reference/apis/js-apis-featureAbility.md
+++ b/en/application-dev/reference/apis/js-apis-featureAbility.md
@@ -16,12 +16,16 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\)
Starts an ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | --------------------- | ---- | ------------------- |
-| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
**Example**
@@ -53,11 +57,15 @@ startAbility(parameter: StartAbilityParameter): Promise\
Starts an ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | --------------------- |
-| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
+| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
**Example**
@@ -89,15 +97,19 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper
Obtains a **dataAbilityHelper** object.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------------ |
-| uri | string | Yes| URI of the file to open.|
+| uri | string | Yes | URI of the file to open.|
**Return value**
-| Type| Description|
+| Type | Description |
| ----------------- | -------------------------------------------- |
| DataAbilityHelper | A utility class used to help other abilities access the Data ability.|
@@ -116,12 +128,16 @@ startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\
Starts an ability. This method uses a callback to return the execution result when the ability is destroyed.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | --------------------- |
-| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
-| callback | AsyncCallback\<[AbilityResult](#abilityresult)> | Yes| Callback used to return the result.|
+| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
+| callback | AsyncCallback\<[AbilityResult](#abilityresult)> | Yes | Callback used to return the result. |
**Example**
@@ -151,14 +167,18 @@ startAbilityForResult(parameter: StartAbilityParameter): Promise\
Starts an ability. This method uses a promise to return the execution result when the ability is destroyed.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | ------------------- |
-| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
+| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
**Return value**
-| Type| Description|
+| Type | Description |
| ----------------------------------------- | -------------- |
| Promise\<[AbilityResult](#abilityresult)> | Promised returned with the execution result.|
@@ -204,12 +224,16 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\
Destroys this Page ability, with the result code and data sent to the caller. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | ------------- | ---- | ------------------- |
-| parameter | [AbilityResult](#abilityresult) | Yes| Ability to start.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
**Example**
@@ -250,14 +274,18 @@ terminateSelfWithResult(parameter: AbilityResult): Promise\
Destroys this Page ability, with the result code and data sent to the caller. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| --------- | ------------------------------- | ---- | ------------------- |
-| parameter | [AbilityResult](#abilityresult) | Yes| Ability to start.|
+| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.|
**Return value**
-| Type| Description|
+| Type | Description |
| -------------- | ----------------------- |
| Promise\ | Promise used to return the result.|
@@ -304,11 +332,15 @@ hasWindowFocus(callback: AsyncCallback\): void
Checks whether the main window of this ability has the focus. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback\ | Yes| Callback used to return the result.
Returns **true** if the main window of this ability has the focus; returns **false** otherwise.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.
Returns **true** if the main window of this ability has the focus; returns **false** otherwise.|
**Example**
@@ -325,9 +357,13 @@ hasWindowFocus(): Promise\
Checks whether the main window of this ability has the focus. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Return value**
-| Type| Description|
+| Type | Description |
| ----------------- | ---------------------------------------------------------- |
| Promise\ | Returns **true** if the main window of this ability has the focus; returns **false** otherwise.|
@@ -348,11 +384,15 @@ getWant(callback: AsyncCallback\): void
Obtains the **Want** object sent from this ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------------ |
-| callback | AsyncCallback\<[Want](#want)> | Yes| Callback used to return the result.|
+| callback | AsyncCallback\<[Want](#want)> | Yes | Callback used to return the result.|
**Example**
@@ -369,8 +409,12 @@ getWant(): Promise\
Obtains the **Want** object sent from this ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Return value**
-| Type| Description|
+| Type | Description |
| ----------------------- | ------------------------- |
| Promise\<[Want](#want)> | Promise used to return the result.|
@@ -389,8 +433,12 @@ getContext(): Context
Obtains the application context.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Return value**
-| Type| Description|
+| Type | Description |
| ------- | -------------------- |
| Context | Application context returned.|
@@ -410,11 +458,15 @@ terminateSelf(callback: AsyncCallback\): void
Destroys this Page ability, with the result code and data sent to the caller. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
@@ -431,8 +483,12 @@ terminateSelf(): Promise\
Destroys this Page ability, with the result code and data sent to the caller. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Return value**
-| Type| Description|
+| Type | Description |
| -------------- | ------------------------- |
| Promise\ | Promise used to return the result.|
@@ -450,31 +506,35 @@ connectAbility(request: Want, options:ConnectOptions): number
Connects this ability to a specific Service ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ------- | -------------- | ---- | ---------------------------- |
-| request | [Want](#want) | Yes| Service ability to connect.|
-| options | ConnectOptions | Yes| Callback used to return the result.|
+| request | [Want](#want) | Yes | Service ability to connect.|
+| options | ConnectOptions | Yes | Callback used to return the result. |
Want
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable | Type | Mandatory| Description |
| ------------ | -------- | -------- | ---- | ---------------------------------- |
-| deviceId | Read-only| string | No| Device ID of the Service ability to connect. The default value is the local device ID.|
-| bundleName | Read-only| string | Yes| Bundle name of the Service ability to connect.|
-| abilityName | Read-only| string | Yes| Class name of the Service ability to connect.|
+| deviceId | Read-only | string | No | Device ID of the Service ability to connect. The default value is the local device ID.
System capabilities: SystemCapability.Ability.AbilityBase|
+| bundleName | Read-only | string | Yes | Bundle name of the Service ability to connect.
System capabilities: SystemCapability.Ability.AbilityBase |
+| abilityName | Read-only | string | Yes | Class name of the Service ability to connect.
System capabilities: SystemCapability.Ability.AbilityBase |
ConnectOptions
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ------------ | -------- | -------- | ---- | ---------------------------------- |
-| onConnect | Read-only| function | Yes| Callback invoked when the connection is successful.|
-| onDisconnect | Read-only| function | Yes| Callback invoked when the connection fails.|
-| onFailed | Read-only| function | Yes| Callback invoked when **connectAbility** fails to be called.|
+| onConnect | Read-only | function | Yes | Callback invoked when the connection is successful.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
+| onDisconnect | Read-only | function | Yes | Callback invoked when the connection fails.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
+| onFailed | Read-only | function | Yes | Callback invoked when **connectAbility** fails to be called.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------------------------ |
| number | Returns the ID of the Service ability connected.|
@@ -512,12 +572,16 @@ disconnectAbility(connection: number, callback:AsyncCallback\): void
Disconnects this ability from a specific Service ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------------- | ---- | ------------------------------ |
-| connection | number | Yes| ID of the Service ability to disconnect.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| connection | number | Yes | ID of the Service ability to disconnect.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
**Example**
@@ -557,14 +621,18 @@ disconnectAbility(connection: number): Promise\
Disconnects this ability from a specific Service ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.FAModel
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------------ |
-| connection | number | Yes| ID of the Service ability to disconnect.|
+| connection | number | Yes | ID of the Service ability to disconnect.|
**Return value**
-| Type| Description|
+| Type | Description |
| -------------- | ----------------------- |
| Promise\ | Promise used to return the result.|
@@ -596,226 +664,51 @@ var connId = featureAbility.connectAbility(
var result = await featureAbility.disconnectAbility(connId);
```
-## featureAbility.continueAbility
-
-continueAbility(options: ContinueAbilityOptions, callback: AsyncCallback\): void
-
-Migrates an ability to another device. This method uses a callback to return the execution result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| -------- | ---------------------- | ---- | ------------------- |
-| options | ContinueAbilityOptions | Yes| Ability to migrate.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
-
-ContinueAbilityOptions
-
-| Name| Readable/Writable| Type| Mandatory| Description|
-| ---------- | -------- | ------- | ---- | ------------------------------------------------------------ |
-| deviceId | Read-only| string | Yes| Information about the ability to migrate.|
-| reversible | Read-only| boolean | Yes| Whether migration back is supported. Currently, this feature is not supported. This parameter is reserved and can be set to **false**.|
-
-**Example**
-
-```javascript
-import device from '@system.device'
-import ability from '@ohos.ability.featureability'
-
-var DEVICE_LIST_LOCALHOST
-export default {
- data: {
- title: "",
- deviceId: '',
- deviceList: [],
- remoteDeviceModel : new RemoteDeviceModel()
- },
- onInit() {
- DEVICE_LIST_LOCALHOST = {
- id: 'localhost',
- };
- this.deviceList = [DEVICE_LIST_LOCALHOST];
- },
- onShow() {
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- const reportExtend = new ReportExtend(file)
- core.addService('expect', expectExtend)
- core.addService('report', reportExtend)
- core.init()
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- core.execute()
- },
- onReady() {
- },
- GetNetWorkId(){
- let self = this;
- this.remoteDeviceModel.registerDeviceListCallback(() => {
- var list = [];
- list[0] = DEVICE_LIST_LOCALHOST;
- var deviceList = self.remoteDeviceModel.deviceList;
- for (var i = 0; i < deviceList.length; i++) {
- list[i] = {
- id: deviceList[i].deviceId,
- };
- }
- self.deviceList = list;
- });
- },
- ShowNetWorkId(){
- this.deviceId = this.deviceList[0].id;
- },
-
- async ContinueAbility(){
- function ContinueAbilityCallback(err) {
- console.info("=============>ContinueAbilityCallback============>");
- }
- var continueAbilityOptions = {
- reversible: false,
- deviceId: this.deviceId,
- }
- //continueAbility callback
- await ability.continueAbility(continueAbilityOptions, ContinueAbilityCallback);
- },
-}
-```
-
-## featureAbility.continueAbility
-
-continueAbility(options: ContinueAbilityOptions): Promise\;
-
-Migrates an ability to another device. This method uses a promise to return the execution result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------- | ---------------------- | ---- | ------------------- |
-| options | ContinueAbilityOptions | Yes| Ability to migrate.|
-
-ContinueAbilityOptions
-
-| Name| Readable/Writable| Type| Mandatory| Description|
-| ---------- | -------- | ------- | ---- | ------------------------------------------------------------ |
-| deviceId | Read-only| string | Yes| Information about the ability to migrate.|
-| reversible | Read-only| boolean | Yes| Whether migration back is supported. Currently, this feature is not supported. This parameter is reserved and can be set to **false**.|
-
-**Example**
-
-```javascript
-import device from '@system.device'
-import ability from '@ohos.ability.featureability'
-
-var DEVICE_LIST_LOCALHOST
-export default {
- data: {
- title: "",
- deviceId: '',
- deviceList: [],
- remoteDeviceModel : new RemoteDeviceModel()
- },
- onInit() {
- DEVICE_LIST_LOCALHOST = {
- id: 'localhost',
- };
- this.deviceList = [DEVICE_LIST_LOCALHOST];
- },
- onShow() {
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- const reportExtend = new ReportExtend(file)
- core.addService('expect', expectExtend)
- core.addService('report', reportExtend)
- core.init()
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- core.execute()
- },
- onReady() {
- },
- GetNetWorkId(){
- let self = this;
- this.remoteDeviceModel.registerDeviceListCallback(() => {
- var list = [];
- list[0] = DEVICE_LIST_LOCALHOST;
- var deviceList = self.remoteDeviceModel.deviceList;
- for (var i = 0; i < deviceList.length; i++) {
- list[i] = {
- id: deviceList[i].deviceId,
- };
- }
- self.deviceList = list;
- });
- },
- ShowNetWorkId(){
- this.deviceId = this.deviceList[0].id;
- },
-
- async ContinueAbility(){
- function ContinueAbilityCallback(err) {
- console.info("=============>ContinueAbilityCallback============>");
- }
- var continueAbilityOptions = {
- reversible: false,
- deviceId: this.deviceId,
- }
- //continueAbility promise
- await ability.continueAbility(continueAbilityOptions).then(() => {
- console.info("=======>continueAbilityCallback=========>");
- });
- },
-}
-```
-
## AbilityResult
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
-| resultCode | Read-only| number | Yes| Result code returned after the ability is destroyed. The feature for defining error-specific result codes is coming soon.|
-| want | Read-only| [Want](#want) | No| Data returned after the ability is destroyed. You can define the data to be returned. This parameter can be **null**.|
+| resultCode | Read-only | number | Yes | Result code returned after the ability is destroyed. The feature for defining error-specific result codes is coming soon.