diff --git a/docker/standard/CHANGELOG.md b/docker/standard/CHANGELOG.md index c6089a6645b5682d01ed582d7803e545f47614e3..42434adbdc1478b14f0e8c85a795053489ecb52f 100644 --- a/docker/standard/CHANGELOG.md +++ b/docker/standard/CHANGELOG.md @@ -1,3 +1,9 @@ + ### 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。 diff --git a/docker/standard/CHANGELOG_en.md b/docker/standard/CHANGELOG_en.md index fa141e90b6fee53f53ea3df510b8e2ea7fda7143..c14f7da669e47373428efeb2af817289c852c2e9 100644 --- a/docker/standard/CHANGELOG_en.md +++ b/docker/standard/CHANGELOG_en.md @@ -1,4 +1,10 @@ - ### 0.0.2(2021/08/11) + ### 0.0.4(2021/09/18) + +1\. dropped pre-installed build dependency tools. + +2\. Added the installation of ruby. + + ### 0.0.3(2021/08/30) 1\. Updated LLVM from 10.0.1-62608 to 10.0.1-69957. diff --git a/docker/standard/Readme-en.md b/docker/standard/Readme-en.md index 43c04b716bec16e4c86c932c25eca0a6b79ca815..679d8e054a1926763fa4f7eaed21efecaefef09f 100755 --- a/docker/standard/Readme-en.md +++ b/docker/standard/Readme-en.md @@ -10,11 +10,11 @@ The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.hua 1. Obtain the Docker image. ``` -docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 +docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 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.3 +docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` ##### **Method 2: Using the Dockerfile to Build a Local Docker Image** @@ -30,15 +30,12 @@ cd docs/docker/standard ``` 3. 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 openharmony-docker-standard:0.0.3 +docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.4 ``` ### Building for Standard-System Devices (reference memory ≥ 128 MB) -1. Run the preprocessing script in the root directory of the source code. -``` -../scripts/prepare.sh -``` -2. Run the following script to start 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} ``` diff --git a/docker/standard/Readme.md b/docker/standard/Readme.md index a68037a0ad106a804583d29eb72195c05278f8fb..81e6c8a965663531a31d37c64144e3f705839b77 100755 --- a/docker/standard/Readme.md +++ b/docker/standard/Readme.md @@ -10,11 +10,11 @@ OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该 1. 获取Docker镜像。 ``` -docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 +docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。 ``` -docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 +docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` ##### 方式二:通过Dockerfile 构建本地Docker镜像进行构建 @@ -30,15 +30,12 @@ cd docs/docker/standard ``` 3. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。 ``` -docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.3 +docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.4 ``` ### 编译源码-标准系统类设备(参考内存≥128MB) -1. 在源码的根目录执行预处理脚本。 -``` -../scripts/prepare.sh -``` -2. 通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 +通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 + ``` ./build.sh --product-name {product_name} ``` diff --git a/docker/standard/build.sh b/docker/standard/build.sh index 5371886ecb6afd1545d52c897fffe9674f095b85..7627d6123d56c009722ed946a9175818827a28e0 100755 --- a/docker/standard/build.sh +++ b/docker/standard/build.sh @@ -13,4 +13,4 @@ #!/bin/sh -docker build -t openharmony-docker-standard:0.0.3 . +docker build -t openharmony-docker-standard:0.0.4 . diff --git a/docker/standard/dockerfile b/docker/standard/dockerfile index 9f17b6c9c2bbd47baef5a992544c5412df05959f..6e4ef8c3f48a7053efbd268d7c7419200cf512b8 100755 --- a/docker/standard/dockerfile +++ b/docker/standard/dockerfile @@ -17,14 +17,11 @@ WORKDIR /home/openharmony ARG DEBIAN_FRONTEND=noninteractive ARG PREBUILTS_DIR=/home/prebuilts ARG HOME_TOOLS=/home/tools -ARG HOME_SCRIPTS=/home/scripts RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak COPY sources.list /etc/apt -COPY prebuilts_download.sh prepare.sh $HOME_SCRIPTS/ - RUN apt-get update \ && apt-get install -y \ apt-utils \ @@ -85,9 +82,10 @@ RUN apt-get update \ libc6-dev-i386 \ lib32z-dev \ openjdk-8-jdk \ + ruby \ && rm -rf /bin/sh \ && ln -s /bin/bash /bin/sh \ - && mkdir -p $PREBUILTS_DIR/prebuilts $HOME_TOOLS $HOME_SCRIPTS + && 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 \ @@ -98,7 +96,4 @@ RUN wget -P $HOME_TOOLS https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12 && 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 \ - && chmod -R 777 $HOME_SCRIPTS/*.sh \ - && $HOME_SCRIPTS/prebuilts_download.sh \ - && rm -rf /tmp/prebuilts \ && npm install -g @ohos/hpm-cli --registry https://registry.npm.taobao.org diff --git a/docker/standard/prebuilts_download.sh b/docker/standard/prebuilts_download.sh deleted file mode 100755 index 307b7069210cef4592477adb384fa97f7fa4ba5b..0000000000000000000000000000000000000000 --- a/docker/standard/prebuilts_download.sh +++ /dev/null @@ -1,67 +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. - -#!/bin/bash -# 代码下载目录 -code_dir=/home/prebuilts -# 二进制所在目录,用于临时存放二进制,二进制整个大小约10G,请确保有足够的空间 -bin_dir=/tmp/prebuilts -# 二进制关系 -copy_config=""" -prebuilts/cmake,https://repo.huaweicloud.com/harmonyos/compiler/cmake/3.16.5/darwin/cmake-darwin-x86-3.16.5.tar.gz -prebuilts/cmake,https://repo.huaweicloud.com/harmonyos/compiler/cmake/3.16.5/linux/cmake-linux-x86-3.16.5.tar.gz -prebuilts/cmake,https://repo.huaweicloud.com/harmonyos/compiler/cmake/3.16.5/windows/cmake-windows-x86-3.16.5.tar.gz -prebuilts/build-tools/darwin-x86/bin,https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/darwin/gn-darwin-x86-1717.tar.gz -prebuilts/build-tools/linux-x86/bin,https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz -prebuilts/build-tools/darwin-x86/bin,https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.10.1/darwin/ninja-darwin-x86-1.10.1.tar.gz -prebuilts/build-tools/linux-x86/bin,https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.10.1/linux/ninja-linux-x86-1.10.1.tar.gz -prebuilts/python,https://repo.huaweicloud.com/harmonyos/compiler/python/3.8.5/darwin/python-darwin-x86-3.8.5.tar.gz -prebuilts/python,https://repo.huaweicloud.com/harmonyos/compiler/python/3.8.5/linux/python-linux-x86-3.8.5.tar.gz -prebuilts/mingw-w64/ohos/linux-x86_64,https://repo.huaweicloud.com/harmonyos/compiler/mingw-w64/7.0.0/clang-mingw.tar.gz -prebuilts,https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar -prebuilts/gcc/linux-x86/arm,https://repo.huaweicloud.com/harmonyos/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi.tar.gz -prebuilts/gcc/linux-x86/aarch64,https://repo.huaweicloud.com/harmonyos/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/gcc-linaro-7.5.0-2019.12-x86_64-aarch64-linux-gnu.tar.xz -prebuilts/sdk/js-loader/build-tools,https://repo.huaweicloud.com/harmonyos/compiler/ace-loader/1.0/ace-loader.tar.gz -prebuilts/clang/ohos/linux-x86_64,https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-69957/linux/clang-69957-linux-x86_64.tar.bz2 -prebuilts/build-tools/common,https://repo.huaweicloud.com/harmonyos/compiler/restool/1.023-c/restool.tar.gz -""" -if [ ! -d "${bin_dir}" ];then - mkdir -p "${bin_dir}" -fi - -for i in `echo ${copy_config}` -do - unzip_dir=`echo $i|awk -F ',' '{print $1}'` - huaweicloud_url=`echo $i|awk -F ',' '{print $2}'` - md5_huaweicloud_url=`echo ${huaweicloud_url}|md5sum|awk '{print $1}'` - bin_file=`basename ${huaweicloud_url}` - bin_file_suffix=${bin_file#*.} - #huaweicloud_file_name=`echo ${huaweicloud_url}|awk -F '/' '{print $NF}'` - - if [ ! -d "${code_dir}/${unzip_dir}" ];then - mkdir -p "${code_dir}/${unzip_dir}" - fi - if [ ! -f "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" ];then - # 代理不需要鉴权: wget -P ${bin_dir} -e "https_proxy=http://domain.com:port" ${huaweicloud_url} - # 代理需要鉴权(账号密码特殊字符均需要URL转义): wget -P ${bin_dir} -e "https_proxy=http://username:password@domain.com:port" ${huaweicloud_url} - # 不需要代理 - wget -O ${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix} ${huaweicloud_url} - fi - if [ "X${bin_file_suffix:0-3}" = "Xzip" ];then - unzip "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -d "${code_dir}/${unzip_dir}/" - elif [ "X${bin_file_suffix:0-6}" = "Xtar.gz" ];then - tar -xvzf "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -C "${code_dir}/${unzip_dir}" - else - tar -xvf "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -C "${code_dir}/${unzip_dir}" - fi -done diff --git a/docker/standard/prepare.sh b/docker/standard/prepare.sh deleted file mode 100755 index d3e3a1f65a764ec920ebac5cdc5201a48b22a0b4..0000000000000000000000000000000000000000 --- a/docker/standard/prepare.sh +++ /dev/null @@ -1,86 +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. - -#!/bin/bash - -WORKDIR=/home/openharmony -TOOLSDIR=/home/prebuilts/prebuilts - -rm -rf /usr/bin/python -ln -s /usr/bin/python2.7 /usr/bin/python - -if [[ -d $WORKDIR/third_party/jsframework ]]; then - echo copy jsframework node_modules - cd $WORKDIR/third_party/jsframework - npm install --registry https://registry.npm.taobao.org -fi - -if [[ -d $TOOLSDIR/build-tools/common/js-framework ]]; then - rm -rf $TOOLSDIR/build-tools/common/js-framework -fi -mkdir -p $TOOLSDIR/build-tools/common/js-framework -cp -r $WORKDIR/third_party/jsframework/node_modules $TOOLSDIR/build-tools/common/js-framework - -if [[ -d $TOOLSDIR/build-tools/common/nodejs ]]; then - rm -rf $TOOLSDIR/build-tools/common/nodejs -fi - -mkdir -p $TOOLSDIR/build-tools/common/nodejs -cp -r $TOOLSDIR/node-v12.18.4-linux-x64 $TOOLSDIR/build-tools/common/nodejs -cp -r $TOOLSDIR/node-v12.18.4-darwin-x64 $TOOLSDIR/build-tools/common/nodejs - -if [[ -h $WORKDIR/prebuilts/cmake ]]; then - rm $WORKDIR/prebuilts/cmake -fi -echo link cmake -ln -s $TOOLSDIR/cmake $WORKDIR/prebuilts/cmake - -if [[ -h $WORKDIR/prebuilts/build-tools ]]; then - rm $WORKDIR/prebuilts/build-tools -fi -echo link build-tools -ln -s $TOOLSDIR/build-tools $WORKDIR/prebuilts/build-tools - -if [[ -h $WORKDIR/prebuilts/python ]]; then - rm $WORKDIR/prebuilts/python -fi -echo link python -ln -s $TOOLSDIR/python $WORKDIR/prebuilts/python - -if [[ -h $WORKDIR/prebuilts/mingw-w64 ]]; then - rm $WORKDIR/prebuilts/mingw-w64 -fi -echo link mingw-w64 -ln -s $TOOLSDIR/mingw-w64 $WORKDIR/prebuilts/mingw-w64 - -mv $TOOLSDIR/clang/ohos/linux-x86_64/clang-69957 $TOOLSDIR/clang/ohos/linux-x86_64/llvm -if [[ -h $WORKDIR/prebuilts/clang ]]; then - rm $WORKDIR/prebuilts/clang -fi -echo link clang -ln -snf 10.0.1 $TOOLSDIR/clang/ohos/linux-x86_64/llvm/lib/clang/current -ln -s $TOOLSDIR/clang $WORKDIR/prebuilts/clang - -mv $TOOLSDIR/gcc/linux-x86/arm/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi $TOOLSDIR/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi -if [[ -h $WORKDIR/prebuilts/gcc ]]; then - rm $WORKDIR/prebuilts/gcc -fi -echo link gcc -ln -s $TOOLSDIR/gcc $WORKDIR/prebuilts/gcc - -if [[ -h $WORKDIR/prebuilts/sdk ]]; then - rm $WORKDIR/prebuilts/sdk -fi -echo link sdk -ln -s $TOOLSDIR/sdk $WORKDIR/prebuilts/sdk - diff --git a/en/application-dev/js-reference/audio-management.md b/en/application-dev/js-reference/audio-management.md index e538c610ff6fc68f2f31dc88bf8ad8b7e6b3be18..195effeb78b4309a7ed7a36a980dae2d5b20bc9c 100644 --- a/en/application-dev/js-reference/audio-management.md +++ b/en/application-dev/js-reference/audio-management.md @@ -1,63 +1,63 @@ # Audio Management -- [Modules to Import](#s56d19203690d4782bfc74069abb6bd71) -- [Required Permissions](#section11257113618419) -- [getAudioManager\(\): AudioManager](#section84581011418) -- [AudioVolumeType](#section92261857172218) -- [DeviceFlag](#section11285183164210) -- [DeviceRole](#section380038142619) -- [DeviceType](#section11727420122710) -- [AudioRingMode7+](#section14948916131018) -- [AudioManager](#section8265143814015) - - [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void](#section189141826104616) - - [setVolume\(volumeType: AudioVolumeType, volume: number\): Promise](#section102021249114612) - - [getVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#section4387320194714) - - [getVolume\(volumeType: AudioVolumeType\): Promise](#section04121965119) - - [getMinVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#section188714283511) - - [getMinVolume\(volumeType: AudioVolumeType\): Promise](#section41556389511) - - [getMaxVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#section690395418516) - - [getMaxVolume\(volumeType: AudioVolumeType\): Promise](#section155151345217) - - [mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+](#section13516136134613) - - [mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+](#section7519036144616) - - [isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+](#section10684183819585) - - [isMute\(volumeType: AudioVolumeType\): Promise7+](#section6920211145610) - - [isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+](#section380012544121) - - [isActive\(volumeType: AudioVolumeType\): Promise7+](#section1880315481216) - - [setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+](#section18572131483613) - - [setRingerMode\(mode: AudioRingMode\): Promise7+](#section55741914143615) - - [getRingerMode\(callback: AsyncCallback\): void7+](#section149044108162) - - [getRingerMode\(\): Promise7+](#section13908210101620) - - [setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+](#section1691957174818) - - [setAudioParameter\(key: string, value: string\): Promise7+](#section18121057174820) - - [getAudioParameter\(key: string, callback: AsyncCallback\): void7+](#section1415145714812) - - [getAudioParameter\(key: string\): Promise7+](#section3185577485) - - [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void](#section11536182020523) - - [getDevices\(deviceFlag: DeviceFlag\): Promise](#section181733125210) - - [setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+](#section103558400222) - - [setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+](#section1235914401228) - - [isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+](#section12363240122219) - - [isDeviceActive\(deviceType: DeviceType\): Promise7+](#section18366184012213) - - [setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+](#section14703163618122) - - [setMicrophoneMute\(mute: boolean\): Promise7+](#section56287111791) - - [isMicrophoneMute\(callback: AsyncCallback\): void7+](#section6632141119912) - - [isMicrophoneMute\(\): Promise7+](#section196363111918) - -- [AudioDeviceDescriptor](#section164657411927) - - [Attributes](#section4947115405) - -- [AudioDeviceDescriptors](#section5181155710523) - -## Modules to Import + - [Modules to Import](#modules-to-import) + - [Required Permissions](#required-permissions) + - [getAudioManager\(\): AudioManager](#getaudiomanager-audiomanager) + - [AudioVolumeType](#audiovolumetype) + - [DeviceFlag](#deviceflag) + - [DeviceRole](#devicerole) + - [DeviceType](#devicetype) + - [ActiveDeviceType7+](#activedevicetype) + - [AudioRingMode7+](#audioringmode) + - [AudioManager](#audiomanager) + - [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void](#setvolume-asynccallback) + - [setVolume\(volumeType: AudioVolumeType, volume: number\): Promise](#setvolume-promise) + - [getVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#getvolume-asynccallback) + - [getVolume\(volumeType: AudioVolumeType\): Promise](#getvolume-promise) + - [getMinVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#getminvolume-asynccallback) + - [getMinVolume\(volumeType: AudioVolumeType\): Promise](#getminvolume-promise) + - [getMaxVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void](#getmaxvolume-asynccallback) + - [getMaxVolume\(volumeType: AudioVolumeType\): Promise](#getmaxvolume-promise) + - [mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+](#mute-asynccallback) + - [mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+](#mute-promise) + - [isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+](#ismute-asynccallback) + - [isMute\(volumeType: AudioVolumeType\): Promise7+](#ismute-promise) + - [isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+](#isactive-asynccallback) + - [isActive\(volumeType: AudioVolumeType\): Promise7+](#isactive-promise) + - [setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+](#setringermode-asynccallback) + - [setRingerMode\(mode: AudioRingMode\): Promise7+](#setringermode-promise) + - [getRingerMode\(callback: AsyncCallback\): void7+](#getringermode-asynccallback) + - [getRingerMode\(\): Promise7+](#getringermode-promise) + - [setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+](#setaudioparameter-asynccallback) + - [setAudioParameter\(key: string, value: string\): Promise7+](#setaudioparameter-promise) + - [getAudioParameter\(key: string, callback: AsyncCallback\): void7+](#getaudioparameter-asynccallback) + - [getAudioParameter\(key: string\): Promise7+](#getaudioparameter-promise) + - [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void](#getdevices-asynccallback) + - [getDevices\(deviceFlag: DeviceFlag\): Promise](#getdevices-promise) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+](#setdeviceactive-asynccallback) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+](#setdeviceactive-promise) + - [isDeviceActive\(deviceType: ActiveDeviceType, callback: AsyncCallback\): void7+](#isdeviceactive-asynccallback) + - [isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+](#isdeviceactive-promise) + - [setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+](#setmicrophonemute-asynccallback) + - [setMicrophoneMute\(mute: boolean\): Promise7+](#setmicrophonemute-promise) + - [isMicrophoneMute\(callback: AsyncCallback\): void7+](#ismicrophonemute-asynccallback) + - [isMicrophoneMute\(\): Promise7+](#ismicrophonemute-promise) + - [AudioDeviceDescriptor](#audiodevicedescriptor) + - [Attributes](#attributes) + - [AudioDeviceDescriptors](#audiodevicedescriptors) + + +## Modules to Import ``` import audio from '@ohos.multimedia.audio'; ``` -## Required Permissions +## Required Permissions None -## getAudioManager\(\): AudioManager +## getAudioManager\(\): AudioManager Obtains an **AudioManager** instance. @@ -78,13 +78,14 @@ Obtains an **AudioManager** instance. + **Example** ``` var audioManager = audio.getAudioManager(); ``` -## AudioVolumeType +## AudioVolumeType Enumerates audio stream types. @@ -114,7 +115,7 @@ Enumerates audio stream types. -## DeviceFlag +## DeviceFlag Enumerates audio device flags. @@ -151,7 +152,7 @@ Enumerates audio device flags. -## DeviceRole +## DeviceRole Enumerates audio device roles. @@ -181,65 +182,31 @@ Enumerates audio device roles. -## DeviceType +## DeviceType Enumerates audio device types. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Default Value

-

Description

-

INVALID

-

0

-

Invalid device

-

SPEAKER

-

1

-

Speaker

-

WIRED_HEADSET

-

2

-

Wired headset

-

BLUETOOTH_SCO

-

3

-

Bluetooth device using the synchronous connection oriented (SCO) link

-

BLUETOOTH_A2DP

-

4

-

Bluetooth device using the advanced audio distribution profile (A2DP)

-

MIC

-

5

-

Microphone

-
+| Name | Default Value | Description | +| -------------- | ------------- | --------------------------------------------------------------------- | +| INVALID | 0 | Invalid device | +| EARPIECE | 1 | Earpiece | +| SPEAKER | 2 | Speaker | +| WIRED_HEADSET | 3 | Wired headset | +| BLUETOOTH_SCO | 7 | Bluetooth device using the synchronous connection oriented (SCO) link | +| BLUETOOTH_A2DP | 8 | Bluetooth device using the advanced audio distribution profile (A2DP) | +| MIC | 15 | Microphone | + + +## ActiveDeviceType7+ + +Enumerates active device types. + +| Name | Default Value | Description | +| ------------- | ------------- | --------------------------------------------------------------------- | +| SPEAKER | 2 | Speaker | +| BLUETOOTH_SCO | 7 | Bluetooth device using the synchronous connection oriented (SCO) link | -## AudioRingMode7+ +## AudioRingMode7+ Enumerates ringer modes. @@ -280,7 +247,7 @@ Enumerates ringer modes. Implements audio volume and audio device management. -### setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void +### setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void Sets the volume for a stream. This method uses an asynchronous callback to return the execution result. @@ -343,7 +310,7 @@ audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err)=>{ }) ``` -### setVolume\(volumeType: AudioVolumeType, volume: number\): Promise +### setVolume\(volumeType: AudioVolumeType, volume: number\): Promise Sets the volume for a stream. This method uses a promise to return the execution result. @@ -406,7 +373,7 @@ audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()=> ) ``` -### getVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void +### getVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. @@ -460,7 +427,7 @@ audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { }) ``` -### getVolume\(volumeType: AudioVolumeType\): Promise +### getVolume\(volumeType: AudioVolumeType\): Promise Obtains the volume of a stream. This method uses a promise to return the query result. @@ -514,7 +481,7 @@ audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => ) ``` -### getMinVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void +### getMinVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. @@ -568,7 +535,7 @@ audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => { }) ``` -### getMinVolume\(volumeType: AudioVolumeType\): Promise +### getMinVolume\(volumeType: AudioVolumeType\): Promise Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. @@ -622,7 +589,7 @@ audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => ) ``` -### getMaxVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void +### getMaxVolume\(volumeType: AudioVolumeType, callback: AsyncCallback\): void Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. @@ -676,7 +643,7 @@ audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => { }) ``` -### getMaxVolume\(volumeType: AudioVolumeType\): Promise +### getMaxVolume\(volumeType: AudioVolumeType\): Promise Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. @@ -730,7 +697,7 @@ audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=> ) ``` -### mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+ +### mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+ Mutes a stream. This method uses an asynchronous callback to return the execution result. @@ -793,7 +760,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => { }) ``` -### mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+ +### mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+ Mutes a stream. This method uses a promise to return the execution result. @@ -856,7 +823,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() => ) ``` -### isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+ +### isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+ Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. @@ -910,7 +877,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => { }) ``` -### isMute\(volumeType: AudioVolumeType\): Promise7+ +### isMute\(volumeType: AudioVolumeType\): Promise7+ Checks whether a stream is muted. This method uses a promise to return the execution result. @@ -964,7 +931,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) => ) ``` -### isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+ +### isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+ Checks whether a stream is active. This method uses an asynchronous callback to return the query result. @@ -1018,7 +985,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => { }) ``` -### isActive\(volumeType: AudioVolumeType\): Promise7+ +### isActive\(volumeType: AudioVolumeType\): Promise7+ Checks whether a stream is active. This method uses a promise to return the query result. @@ -1072,7 +1039,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) => ) ``` -### setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+ +### setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+ Sets the ringer mode. This method uses an asynchronous callback to return the execution result. @@ -1126,7 +1093,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => { }) ``` -### setRingerMode\(mode: AudioRingMode\): Promise7+ +### setRingerMode\(mode: AudioRingMode\): Promise7+ Sets the ringer mode. This method uses a promise to return the execution result. @@ -1180,7 +1147,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() => ) ``` -### getRingerMode\(callback: AsyncCallback\): void7+ +### getRingerMode\(callback: AsyncCallback\): void7+ Obtains the ringer mode. This method uses an asynchronous callback to return the query result. @@ -1225,7 +1192,7 @@ audioManager.getRingerMode((err, value) => { }) ``` -### getRingerMode\(\): Promise7+ +### getRingerMode\(\): Promise7+ Obtains the ringer mode. This method uses a promise to return the query result. @@ -1258,7 +1225,7 @@ audioManager.getRingerMode().then((value) => ) ``` -### setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+ +### setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+ Sets an audio parameter. This method uses an asynchronous callback to return the execution result. @@ -1321,7 +1288,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => { }) ``` -### setAudioParameter\(key: string, value: string\): Promise7+ +### setAudioParameter\(key: string, value: string\): Promise7+ Sets an audio parameter. This method uses a promise to return the execution result. @@ -1384,7 +1351,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit').then(() => ) ``` -### getAudioParameter\(key: string, callback: AsyncCallback\): void7+ +### getAudioParameter\(key: string, callback: AsyncCallback\): void7+ Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. @@ -1438,7 +1405,7 @@ audioManager.getAudioParameter('PBits per sample', (err, value) => { }) ``` -### getAudioParameter\(key: string\): Promise7+ +### getAudioParameter\(key: string\): Promise7+ Obtains the value of an audio parameter. This method uses a promise to return the query result. @@ -1492,7 +1459,7 @@ audioManager.getAudioParameter('PBits per sample').then((value) => ) ``` -### getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void +### getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. @@ -1546,7 +1513,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{ }) ``` -### getDevices\(deviceFlag: DeviceFlag\): Promise +### getDevices\(deviceFlag: DeviceFlag\): Promise Obtains the audio devices with a specific flag. This method uses a promise to return the query result. @@ -1600,7 +1567,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+ Sets a device to the active state. This method uses an asynchronous callback to return the execution result. @@ -1619,7 +1586,7 @@ Sets a device to the active state. This method uses an asynchronous callback to

deviceType

-

DeviceType

+

ActiveDeviceType

Yes

@@ -1654,7 +1621,7 @@ None **Example** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err)=> { if (err) { console.error('Failed to set the active status of the device. ${err.message}'); return; @@ -1663,7 +1630,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { }) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+ Sets a device to the active state. This method uses a promise to return the execution result. @@ -1682,7 +1649,7 @@ Sets a device to the active state. This method uses a promise to return the exec

deviceType

-

DeviceType

+

ActiveDeviceType

Yes

@@ -1721,12 +1688,12 @@ Sets a device to the active state. This method uses a promise to return the exec **Example** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(()=> console.log('Promise returned to indicate that the device is set to the active status.'); ) ``` -### isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+ +### isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+ Checks whether a device is active. This method uses an asynchronous callback to return the query result. @@ -1745,7 +1712,7 @@ Checks whether a device is active. This method uses an asynchronous callback to

deviceType

-

DeviceType

+

ActiveDeviceType

Yes

@@ -1771,7 +1738,7 @@ None **Example** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { if (err) { console.error('Failed to obtain the active status of the device. ${err.message}'); return; @@ -1780,7 +1747,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { }) ``` -### isDeviceActive\(deviceType: DeviceType\): Promise7+ +### isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+ Checks whether a device is active. This method uses a promise to return the query result. @@ -1799,7 +1766,7 @@ Checks whether a device is active. This method uses a promise to return the quer

deviceType

-

DeviceType

+

ActiveDeviceType

Yes

@@ -1829,12 +1796,12 @@ Checks whether a device is active. This method uses a promise to return the quer **Example** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) => +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then((value) => console.log('Promise returned to indicate that the active status of the device is obtained.' + value); ) ``` -### setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+ +### setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+ Mutes or unmutes the microphone. This method uses an asynchronous callback to return the execution result. @@ -1888,7 +1855,7 @@ audioManager.setMicrophoneMute(true, (err) => { }) ``` -### setMicrophoneMute\(mute: boolean\): Promise7+ +### setMicrophoneMute\(mute: boolean\): Promise7+ Mutes or unmutes the microphone. This method uses a promise to return the execution result. @@ -1942,7 +1909,7 @@ audioManager.setMicrophoneMute(true).then(() => ) ``` -### isMicrophoneMute\(callback: AsyncCallback\): void7+ +### isMicrophoneMute\(callback: AsyncCallback\): void7+ Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. @@ -1987,7 +1954,7 @@ audioManager.isMicrophoneMute((err, value) => { }) ``` -### isMicrophoneMute\(\): Promise7+ +### isMicrophoneMute\(\): Promise7+ Checks whether the microphone is muted. This method uses a promise to return the query result. @@ -2020,11 +1987,11 @@ audioManager.isMicrophoneMute().then((value) => ) ``` -## AudioDeviceDescriptor +## AudioDeviceDescriptor Describes an audio device. -### Attributes +### Attributes

Name

@@ -2064,7 +2031,7 @@ Describes an audio device.
-## AudioDeviceDescriptors +## AudioDeviceDescriptors -

Name

diff --git a/en/device-dev/get-code/gettools-acquire.md b/en/device-dev/get-code/gettools-acquire.md index 854a055a1950ec8e1c879732950c66095f10a970..1762f52d9ffe96af4eb306fece1d1a334f10ffe2 100644 --- a/en/device-dev/get-code/gettools-acquire.md +++ b/en/device-dev/get-code/gettools-acquire.md @@ -52,7 +52,7 @@ OpenHarmony provides the following two types of Docker environments for you to q

swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard

0.0.3

+

0.0.4

HPM-based Docker environment

@@ -69,6 +69,7 @@ OpenHarmony provides the following two types of Docker environments for you to q
+ ## Preparations Before using the Docker environment, perform the following operations: @@ -178,7 +179,7 @@ hb set 1. Obtain the Docker image. ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment: @@ -212,21 +213,15 @@ hb set ### Building for Standard-System Devices \(reference memory ≥ 128 MB\) -1. Run the preprocessing script in the root directory of the source code. - - ``` - ../scripts/prepare.sh - ``` - -2. Run the following script to start 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} - ``` +``` +./build.sh --product-name {product_name} +``` - **product\_name** indicates the platform supported by the current distribution, for example, Hi3516D V300. +**product\_name** indicates the platform supported by the current distribution, for example, Hi3516D V300. - Files generated during building are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. +Files generated during building are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. >![](../public_sys-resources/icon-note.gif) **NOTE:** @@ -307,4 +302,3 @@ Start building. Docker can be automatically installed only in Ubuntu. If you are hpm run distWithDocker solution={product} ``` - diff --git a/en/device-dev/quick-start/quickstart-standard-docker-environment.md b/en/device-dev/quick-start/quickstart-standard-docker-environment.md index a40bf48c7621032c00d566caf749dcd8d0392204..61ce7a9c1aeadd8a2a9d7e7a70bf69ef6d550fb3 100644 --- a/en/device-dev/quick-start/quickstart-standard-docker-environment.md +++ b/en/device-dev/quick-start/quickstart-standard-docker-environment.md @@ -44,6 +44,7 @@ Method 1 \(recommended\): Use the **repo** tool to download the source code ov repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull' +bash build/prebuilts_download.sh ``` Method 2: Use the **repo** tool to download the source code over HTTPS. @@ -52,6 +53,7 @@ Method 2: Use the **repo** tool to download the source code over HTTPS. repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull' +bash build/prebuilts_download.sh ``` ## Obtaining the Docker Environment @@ -61,13 +63,13 @@ repo forall -c 'git lfs pull' 1. Obtain the Docker image. ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 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.3 + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` @@ -89,27 +91,21 @@ repo forall -c 'git lfs pull' 3. 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 openharmony-docker-standard:0.0.3 + docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.4 ``` ## Building Source Code -1. Run the preprocessing script in the root directory of the source code. +1. Run the following script to start building for Standard-System Devices \(reference memory ≥ 128 MB\): - ``` - ../scripts/prepare.sh - ``` - -2. Run the following script to start building for Standard-System Devices \(reference memory ≥ 128 MB\): - - ``` - ./build.sh --product-name {product_name} - ``` + ``` + ./build.sh --product-name {product_name} + ``` - **product\_name** indicates the product supported by the current distribution, for example, **Hi3516DV300**. + **product\_name** indicates the product supported by the current distribution, for example, **Hi3516DV300**. - Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. + Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. 3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md). diff --git a/zh-cn/application-dev/js-reference/figures/subsystem_architecture_zh.png b/zh-cn/application-dev/js-reference/figures/subsystem_architecture_zh.png new file mode 100644 index 0000000000000000000000000000000000000000..49a5f627bb52581262718c18d90290db247c012b Binary files /dev/null and b/zh-cn/application-dev/js-reference/figures/subsystem_architecture_zh.png differ diff --git "a/zh-cn/application-dev/js-reference/\345\256\232\346\227\266\346\234\215\345\212\241.md" "b/zh-cn/application-dev/js-reference/\345\256\232\346\227\266\346\234\215\345\212\241.md" new file mode 100644 index 0000000000000000000000000000000000000000..1fe45e7ca70a7ecec4a35f77a24ead9d2dd69e90 --- /dev/null +++ "b/zh-cn/application-dev/js-reference/\345\256\232\346\227\266\346\234\215\345\212\241.md" @@ -0,0 +1,245 @@ +# 时间组件 + +- [简介](#section11660541593) +- [目录](#section161941989596) +- [说明](#section38521239153117) + - [js接口说明](#section11908203714422) + - [js接口使用说明](#section9938411124317) + +- [相关仓](#section1371113476307) + +## 简介 + +时间组件提供管理系统时间时区和定时的能力。 + +**图 1** 子系统架构图 +![](figures/subsystem_architecture_zh.png "子系统架构图") + +## 目录 + +``` +/base/miscservices/time +├── etc # 组件包含的进程的配置文件 +├── figures # 构架图 +├── interfaces # 组件对外提供的接口代码 +│ └── innerkits # 服务间接口 +│ └── kits # 对应用提供的接口 +├── profile # 组件包含的系统服务的配置文件 +└── services # 时间服务实现 +``` + +## 说明 + +### js接口说明 + +**表 1** js组件systemTime开放的主要方法 + + + + + + + + + + + + + + + + + + + + + + + + + +

接口名

+

描述

+

function setTime(time : number) : Promise<boolean>

+

设置系统时间(1970-01-01至今毫秒数),Promise方式

+

function setTime(time : number, callback : AsyncCallback<boolean>) : void

+

设置系统时间(1970-01-01至今毫秒数),callback方式

+

function setDate(date: Date, callback: AsyncCallback<boolean>): void;

+

设置系统时间(Date格式),Promise方式

+

function setDate(date: Date): Promise<boolean>

+

设置系统时间(Date格式),callback方式

+

function setTimezone(timezone: string, callback: AsyncCallback<boolean>): void

+

设置系统时区,callback方式

+

function setTimezone(timezone: string): Promise<boolean>

+

设置系统时区,Promise方式

+
+ + +**表 2** js组件systemTimer开放的主要方法 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

接口名

+

描述

+

function createTimer(options: TimerOptions, callback: AsyncCallback<number>): void

+

创建定时器,callback方式

+

function createTimer(options: TimerOptions): Promise<number>

+

创建定时器,promise方式

+

function startTimer(timer: number, triggerTime: number, callback: AsyncCallback<boolean>): void

+

开启定时器,callback方式

+

function startTimer(timer: number, triggerTime: number): Promise<boolean>

+

开启定时器,promise方式

+

function stopTimer(timer: number, callback: AsyncCallback<boolean>): void

+

停止定时器,callback方式

+

function stopTimer(timer: number): Promise<boolean>

+

停止定时器,promise方式

+

function destroyTimer(timer: number, callback: AsyncCallback<boolean>): void

+

销毁定时器,callback方式

+

function destroyTimer(timer: number): Promise<boolean>

+

摧毁定时器,promise方式

+
+ +**表 3** systemTimer组件参数TimerOptions说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

名称

+

类型

+

说明

+

type

+

number

+

TIMER_TYPE_REALTIME: 设置为系统启动时间定时器,否则为walltime定时器; + TIMER_TYPE_WAKEUP: 设置为唤醒定时器,否则为非唤醒; + const TIMER_TYPE_EXACT: 设置为精准定时器,否则为非精准定时器; + const TIMER_TYPE_IDLE: 设置为IDLE模式定时器,否则为非IDLE模式定时器(暂不支持) +

+

repeat

+

boolean

+

true 为循环定时器,false为单次定时器

+

interval

+

number

+

如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0

+

wantAgent

+

wantAgent

+

设置通知的wantagent,定时器到期后通知

+

callback

+

=> void

+

设置回调函数,定时器到期后触发

+
+### js接口使用说明 + +systemTime模块使用示例: + +``` +// 导入模块 +import systemTime from '@ohos.systemTime'; + +// Promise方式的异步方法设置时间 +var time = 1611081385000; +systemTime.setTime(time) + .then((value) => { + console.log(`success to systemTime.setTime: ${value}`); + }).catch((err) => { + console.error(`failed to systemTime.setTime because ${err.message}`) + }); + + +// callback方式的异步方法设置时间 + +var time = 1611081385000; +systemTime.setTime(time, (err, value) => { + if (err) { + console.error(`failed to systemTime.setTime because ${err.message}`); + return; + } + console.log(`success to systemTime.setTime: ${value}`); + }); + +``` + +systemTimer模块使用示例: + +``` +// 导入模块 +import systemTimer from '@ohos.systemTimer'; + +console.log("start") +var options:TimerOptions{ + type:TIMER_TYPE_REALTIME, + repeat:false, + interval:Number.MAX_VALUE/2, + persistent:false +} + +console.log("create timer") +let timerId = systemTimer.Timer(options) +console.log("start timer") +let startTimerRes = systemTimer.startTimer(timerId, 100000) +console.log("stop timer") +let stopTimerRes = systemTimer.stopTimer(timerId) +console.log("destroy timer") +let destroyTimerRes = systemTimer.destroyTimer(timerId) +console.log('end'); + + +``` + +## 相关仓 + +**Misc软件服务子系统** + +miscservices\_time + diff --git "a/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" "b/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" index d84cf90dfaeb99cec36facd83a0005c9cd3f39cf..8fa663e5f71eeb552b7f8642e82b4e6492d2592c 100644 --- "a/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" +++ "b/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" @@ -6,7 +6,8 @@ - [AudioVolumeType](#section92261857172218) - [DeviceFlag](#section11285183164210) - [DeviceRole](#section380038142619) -- [DeviceType](#section11727420122710) +- [DeviceType](#devicetype) + - [ActiveDeviceType7+](#activedevicetype) - [AudioRingMode7+](#section14948916131018) - [AudioManager](#section8265143814015) - [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void](#section189141826104616) @@ -33,10 +34,10 @@ - [getAudioParameter\(key: string\): Promise7+](#section3185577485) - [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void](#section11536182020523) - [getDevices\(deviceFlag: DeviceFlag\): Promise](#section181733125210) - - [setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+](#section103558400222) - - [setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+](#section1235914401228) - - [isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+](#section12363240122219) - - [isDeviceActive\(deviceType: DeviceType\): Promise7+](#section18366184012213) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+](#section103558400222) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+](#section1235914401228) + - [isDeviceActive\(deviceType: ActiveDeviceType, callback: AsyncCallback\): void7+](#section12363240122219) + - [isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+](#section18366184012213) - [setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+](#section14703163618122) - [setMicrophoneMute\(mute: boolean\): Promise7+](#section56287111791) - [isMicrophoneMute\(callback: AsyncCallback\): void7+](#section6632141119912) @@ -181,63 +182,29 @@ var audioManager = audio.getAudioManager(); -## DeviceType +## DeviceType 枚举,设备类型。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

名称

-

默认值

-

描述

-

INVALID

-

0

-

无效设备。

-

SPEAKER

-

1

-

扬声器。

-

WIRED_HEADSET

-

2

-

有线耳机。

-

BLUETOOTH_SCO

-

3

-

SCO(Synchronous Connection Oriented Link)蓝牙设备。

-

BLUETOOTH_A2DP

-

4

-

A2DP(Advanced Audio Distribution Profile )蓝牙设备。

-

MIC

-

5

-

麦克风。

-
+| 名称 | 默认值 | 描述 | +| -------------- | ------------- | ------------------------------------------------------- | +| INVALID | 0 | 无效设备。 | +| EARPIECE | 1 | 听筒。 | +| SPEAKER | 2 | 扬声器。 | +| WIRED_HEADSET | 3 | 有线耳机。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 | +| BLUETOOTH_A2DP | 8 | 蓝牙设备A2DP连接(Advanced Audio Distribution Profile)。 | +| MIC | 15 | 麦克风。 | + + +## ActiveDeviceType7+ + +Enumerates active device types. + +| 名称 | 默认值 | 描述 | +| ------------- | ------------- | -------------------------------------------------------- | +| SPEAKER | 2 | 扬声器。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 | ## AudioRingMode7+ @@ -1596,7 +1563,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+ 设置设备激活状态,使用callback方式返回异步结果。 @@ -1615,7 +1582,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1650,7 +1617,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> **示例:** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err)=> { if (err) { console.error('Failed to set the active status of the device. ${err.message}'); return; @@ -1659,7 +1626,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { }) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+ 设置设备激活状态,使用promise方式返回异步结果。 @@ -1678,7 +1645,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1717,7 +1684,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { **示例:** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(()=> console.log('Promise returned to indicate that the device is set to the active status.'); ) ``` @@ -1741,7 +1708,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1767,7 +1734,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> **示例:** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { if (err) { console.error('Failed to obtain the active status of the device. ${err.message}'); return; @@ -1776,7 +1743,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { }) ``` -### isDeviceActive\(deviceType: DeviceType\): Promise7+ +### isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+ 获取指定设备激活状态,使用promise方式返回异步结果。 @@ -1795,7 +1762,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1825,7 +1792,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { **示例:** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) => +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then((value) => console.log('Promise returned to indicate that the active status of the device is obtained.' + value); ) ``` diff --git a/zh-cn/device-dev/get-code/gettools-acquire.md b/zh-cn/device-dev/get-code/gettools-acquire.md index a2c790b11886e1eb01b9249e97729de5562a70a5..8455c3195d25dfe7a4312fec6ca195c774f91f87 100644 --- a/zh-cn/device-dev/get-code/gettools-acquire.md +++ b/zh-cn/device-dev/get-code/gettools-acquire.md @@ -52,7 +52,7 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完

swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard

-

0.0.3

+

0.0.4

HPM Docker环境

@@ -69,6 +69,7 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完 + ## 环境准备 在使用docker环境前需要先完成以下操作: @@ -178,13 +179,13 @@ hb set 1. 获取Docker镜像。 ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。 ``` - docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` @@ -212,21 +213,15 @@ hb set ### 编译源码-标准系统类设备(参考内存≥128MB) -1. 在源码的根目录执行预处理脚本。 - - ``` - ../scripts/prepare.sh - ``` - -2. 通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 +通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 - ``` - ./build.sh --product-name {product_name} - ``` +``` +./build.sh --product-name {product_name} +``` - \{product\_name\}为当前版本支持的平台。比如:Hi3516DV300等。 +\{product\_name\}为当前版本支持的平台。比如:Hi3516DV300等。 - 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 +编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 >![](../public_sys-resources/icon-note.gif) **说明:** @@ -307,4 +302,3 @@ docker\_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件 hpm run distWithDocker solution={product} ``` - diff --git a/zh-cn/device-dev/kernel/kernel-standard-build.md b/zh-cn/device-dev/kernel/kernel-standard-build.md index 1b52ac7b1f6ef75cb9c1e29e611e54ab24831d79..f83572008eed2348a75140036feb7cc24f67adcb 100644 --- a/zh-cn/device-dev/kernel/kernel-standard-build.md +++ b/zh-cn/device-dev/kernel/kernel-standard-build.md @@ -1,47 +1,12 @@ # Linux内核编译与构建指导 -- [开发示例1](#section19369206113115) - - [场景1:版本级编译原生方式](#section1025111193220) - - [场景2:单独编译修改后的内核](#section17446652173211) - - -## 开发示例1 - -以hi3516dv300开源开发板+ubuntu x86主机开发环境为例。 - -### 场景1:版本级编译原生方式 +以hi3516dv300开源开发板+ubuntu x86主机开发环境为例 使用工程的全量编译命令,编译生成uImage内核镜像 ``` -./build.sh --product-name Hi3516DV300 # 编译hi3516dv300的uImage内核镜像 +./build.sh --product-name Hi3516DV300 # 编译hi3516dv300镜像 + --build-target build_kernel # 编译hi3516dv300的uImage内核镜像 + --gn-args linux_kernel_version=\"linux-5.10\" # 编译指定内核版本 ``` -### 场景2:单独编译修改后的内核 - -1. 准备工作 - - 1. 按[开发板Patch使用指导](kernel-standard-patch.md)打入所需补丁。 - 2. 准备编译环境,可以使用开源arm clang/gcc编译器。 - - 进入工程主目录配置环境变量: - - ``` - export PATH=`pwd`/prebuilts/clang/host/linux-x86/clang-r353983c/bin:`pwd`/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/:$PATH # 配置编译环境 - MAKE_OPTIONES="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang" # 使用工程项目自带的clang环境 - ``` - -2. 修改内核代码或内核config (OpenHarmony提供对应平台的defconfig供参考)。 -3. 创建编译目录及生成内核.config。 - - ``` - make ${MAKE_OPTIONES} hi3516dv300_emmc_smp_hos_l2_defconfig # 使用自带的默认config 构建内核 - ``` - -4. 编译生成对应的内核Image。 - - ``` - make ${MAKE_OPTIONES} -j32 uImage # 编译uImage内核镜像 - ``` - - diff --git a/zh-cn/device-dev/kernel/kernel-standard-overview.md b/zh-cn/device-dev/kernel/kernel-standard-overview.md index 0727fa97264a4d471c7bf550dee2da94267e900a..c60169d1584ec22906b125c6edc471e3a63b06a4 100644 --- a/zh-cn/device-dev/kernel/kernel-standard-overview.md +++ b/zh-cn/device-dev/kernel/kernel-standard-overview.md @@ -15,7 +15,4 @@ LTS为长期支持版本,“长期支持”体现在对该版本内核的长 ## OpenHarmony内核版本选择 -OpenHarmony中的Linux内核从LTS版本中选择合适的版本作为内核基础版本,目前较多设备使用的4.19内核。4.4\~4.14LTS内核较旧,对新特性支持不足,且按计划在2023年左右会陆续不再维护,可使用周期较短,不适合作为首发版本。5.4LTS版本在已发产品中未广泛使用,4.19更为大家熟悉也可减少适配内核的周期,更新版本内核也会持续发布。 - -OpenHarmony 中的Linux内核推荐参考内存≥128MB的设备选用。 - +OpenHarmony中Linux内核从LTS版本中选择合适的版本作为内核的基础版本,目前已完成对Linux-4.19及Linux-5.10完成适配及支持。 diff --git a/zh-cn/device-dev/kernel/kernel-standard-patch.md b/zh-cn/device-dev/kernel/kernel-standard-patch.md index 87b3fea376cbb44d0f082ffdc2bc87c59fbda1d3..4ec8244dcb68f309b785069746cbeee1abb36483 100644 --- a/zh-cn/device-dev/kernel/kernel-standard-patch.md +++ b/zh-cn/device-dev/kernel/kernel-standard-patch.md @@ -1,17 +1,35 @@ # OpenHarmony开发板Patch使用指导 -Patch文件位于工程项目源码路径:kernel/linux/patches/linux-4.19,存放特定芯片架构驱动补丁。 +1. 合入HDF补丁 -如需使用特定芯片平台驱动的Patch,需要在内核仓代码完成对芯片平台驱动补丁合入。 + 在kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁: + + ``` + $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + ``` -合入芯片平台驱动补丁,针对不同芯片平台合入对应的patch: +2. 合入芯片平台驱动补丁 -以Hi3516dv300为例: + 以Hi3516DV300为例: + + 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件patch放到对应路径下: + + ``` + DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch + DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch + ``` -``` -patch -p1 < device/hisilicon/hi3516dv300/sdk_linux/open_source/linux/hisi_linux-4.19_hos_l2.patch -``` +3. 修改自己所需要编译的config ->![](../public_sys-resources/icon-notice.gif) **须知:** ->由于OpenHarmony的编译构建流程中会拷贝kernel/linux-4.19的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux-4.19保持原代码环境。 + 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件config放到对应路径下: + + ``` + KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION} + DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig + ``` + > **须知:** + > + >由于OpenHarmony工程的编译构建流程中会拷贝kernel/linux/linux-\*\.\*的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux/linux-\*\.\*原代码环境。 + > + >根据不同系统工程,编译完成后会在out目录下的kernel目录中生成对应实际编译的内核,基于此目录的内核,进行对应的config修改,将最后生成的\.config文件cp到config仓对应的路径文件里,即可生效。 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md b/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md index 7169920a1984a3e9ee1d9b85f397ec6d6e5f6efa..9fb450cd3257b228137aa7aa8f4a7a381d252b60 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md @@ -44,6 +44,7 @@ OpenHarmony标准系统为开发者提供的Docker环境已经将对应的编译 repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull' +bash build/prebuilts_download.sh ``` 方式二:通过repo + https 下载。 @@ -52,6 +53,7 @@ repo forall -c 'git lfs pull' repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull' +bash build/prebuilts_download.sh ``` ## 获取Docker环境 @@ -61,13 +63,13 @@ repo forall -c 'git lfs pull' 1. 获取Docker镜像。 ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` 2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。 ``` - docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.3 + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 ``` @@ -89,27 +91,21 @@ repo forall -c 'git lfs pull' 3. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。 ``` - docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.3 + docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.4 ``` ## 编译 -1. 在源码的根目录执行预处理脚本。 +1. 通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 - ``` - ../scripts/prepare.sh - ``` - -2. 通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 - - ``` - ./build.sh --product-name {product_name} - ``` + ``` + ./build.sh --product-name {product_name} + ``` - \{product\_name\}为当前版本支持的平台,比如:Hi3516DV300 + \{product\_name\}为当前版本支持的平台,比如:Hi3516DV300 - 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 + 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 3. 编译源码完成,请进行镜像烧录,具体请参见[镜像烧录](quickstart-standard-burn.md)。 diff --git a/zh-cn/readme/figures/dms-architecture_zh.png b/zh-cn/readme/figures/dms-architecture_zh.png new file mode 100644 index 0000000000000000000000000000000000000000..588c33751dff097e9a8bb9b21d731a1ca1633ffd Binary files /dev/null and b/zh-cn/readme/figures/dms-architecture_zh.png differ diff --git "a/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" index bf9da1b65ffc0245beb1a3942b745d02e9f32532..1c1f5ae1fffebd3069fefc2eb6203b69e5b28e6b 100755 --- "a/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237.md" @@ -9,17 +9,12 @@ - [LiteOS使用说明](#section118811457303) - [linux使用说明](#section1352114469620) -- [以hi3516dv300开源开发板+ubuntu x86主机开发环境为例](#section19369206113115) - - [场景1:版本级编译原生方式](#section1025111193220) - - [场景2:单独编译修改后的内核](#section17446652173211) - +- [构建说明](#section19369206113115) - [相关仓](#section27639463106) ## 简介 -OpenHarmony针对不同量级的系统,分别使用了不同形态的内核,分别为LiteOS和Linux。在轻量系统、小型系统和标准系统上,可以选用LiteOS;在标准系统上,可以选用Linux。 - -**表 1** +OpenHarmony针对不同量级的系统,分别使用了不同形态的内核,分别为LiteOS和Linux。在轻量系统、小型系统和标准系统上,可以选用LiteOS;在小型系统和标准系统上,可以选用Linux。 - - + @@ -64,37 +59,51 @@ OpenHarmonyLiteOS内核的源代码分为 kernel\_liteos\_a 和 kernel\_liteos\_ ## Linux -OpenHarmony的Linux内核基于开源Linux内核LTS 4.19.y分支演进,为满足不同的内核场景诉求,以内核 + patch的形式开展,其中内核在LTS 4.19内核的基础上合入CVE补丁 + OpenHarmony特性作为Common内核基线,针对性打上vendor厂商提供的板级芯片驱动补丁从而构成完整的内核。 - -Linux社区LTS 4.19.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-4.19.y)。 - -内核组成模块,以开源Linux内核为基线, 合入了公共补丁:CVE补丁/OpenHarmony特性,在编译构建流程中针对具体芯片平台合入对应的架构驱动代码进行编译对应的内核镜像。所有补丁来源均遵守GPL-2.0协议。 - -1. CVE补丁 - - 补丁所涉及的CVE\(Common Vulnerabilities and Exposures\)安全漏洞是通过NVD \([https://nvd.nist.gov](内核子系统.md)/\)官方机构收集,且补丁已经进入LTS 4.19.y分支或主线,主要涉及存储\(btrfs/scsi/\)、网络\(net/bpf/mwifiex\) 、驱动\(xen/nfc\),对应CVE列表参考commit信息中CVE字段信息。 - - -1. OpenHarmony特性 - - HDF驱动、binder ipc转发功能等特性支持。 - -2. 特定芯片架构驱动补丁(比如Hi3516DV300) +OpenHarmony的Linux内核基于开源Linux内核LTS **4.19.y / 5.10.y** 分支演进,在此基线基础上,回合CVE补丁及OpenHarmony特性,作为OpenHarmony Common Kernel基线。针对不同的芯片,各厂商合入对应的板级驱动补丁,完成对OpenHarmony的基线适配。 - vendor厂商提供的特定芯片架构驱动代码: +Linux社区LTS 4.19.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-4.19.y); - hisi\_linux-4.19\_hos\_l2.patch: 在Hi3516DV300芯片上支持arm架构的内核启动(DTS等)及对应的drm/mmc等驱动的支持。 +Linux社区LTS 5.10.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.10.y)。 +内核的Patch组成模块,在编译构建流程中,针对具体芯片平台,合入对应的架构驱动代码,进行编译对应的内核镜像。所有补丁来源均遵守GPL-2.0协议。 ## 目录 ``` kernel/ -├── linux-4.19 # 4.19内核基线代码 -├── linux/config/linux-4.19 # 内核config -│ └── standard_common_defconfig # 标准系统的内核的common defconfig -│ └── hi3516dv300_emmc_smp_hos_l2_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300标准系统的defconfig -├── linux/patches/linux-4.19 # 内核patch及编译脚本 +├── linux +│ ├── linux-4.19 # OpenHarmony linux-4.19 Common kernel +│ ├── linux-5.10 # OpenHarmony linux-5.10 Common kernel +│ ├── build +│ │ ├── BUILD.gn # 编译框架GN文件 +│ │ ├── kernel.mk # 内核编译文件 +│ │ └── ohos.build # 内核编译组件文件 +│ ├── patches +│ │ ├── linux-4.19 # linux-4.19 相关patch +│ │ │   └── hi3516dv300_patch +│ │ │   ├── hi3516dv300.patch # linux-4.19 hi3516dv300 SOC patch +│ │ │   └── hdf.patch # linux-4.19 hi3516dv300 hdf patch +│ │ └── linux-5.10 +│ │    └── hi3516dv300_patch +│ │    ├── hi3516dv300.patch # linux-5.10 hi3516dv300 SOC patch +│ │    └── hdf.patch # linux-5.10 hi3516dv300 hdf patch +│ └── config +│ ├── linux-4.19 +│ │   └── arch +│ │   └── arm +│ │   └── configs +│ │   ├── hi3516dv300_small_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300小型系统的defconfig +│ │   ├── hi3516dv300_standard_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300标准系统的defconfig +│ │   ├── small_common_defconfig # 小型系统的内核的common defconfig +│ │   └── standard_common_defconfig # 标准系统的内核的common defconfig +│ └── linux-5.10 +│ └── arch +│ └── arm +│ └── configs +│    ├── hi3516dv300_small_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300小型系统的defconfig +│    ├── hi3516dv300_standard_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300标准系统的defconfig +│    ├── small_common_defconfig # 小型系统的内核的common defconfig +│    └── standard_common_defconfig # 标准系统的内核的common defconfig └── liteos_a # liteos内核基线代码 ├── apps # 用户态的init和shell应用程序 ├── arch # 体系架构的目录,如arm等 @@ -148,57 +157,52 @@ Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用FAT文件系 ### linux使用说明 -如需使用上述patch,需要在内核代码完成对应芯片平台驱动补丁进行合入。 +1. 合入HDF补丁 -1. 合入芯片平台驱动补丁 + 在kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁: + + ``` + $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) + ``` - 针对不同芯片平台合入对应的patch,以上述Hi3516DV300为例: +2. 合入芯片平台驱动补丁 - ``` - patch -p1 < device/hisilicon/hi3516dv300/sdk_linux/open_source/linux/hisi_linux-4.19_hos_l2.patch - ``` + 以Hi3516DV300为例: + + 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件patch放到对应路径下: + + ``` + DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch + DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch + ``` - >![](public_sys-resources/icon-notice.gif) **须知:** - >由于OpenHarmony工程的编译构建流程中会拷贝kernel/linux-4.19的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux-4.19保持原代码环境。 +3. 修改自己所需要编译的config + 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件config放到对应路径下: + + ``` + KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION} + DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig + ``` -## 以hi3516dv300开源开发板+ubuntu x86主机开发环境为例 + > **须知:** + > + >由于OpenHarmony工程的编译构建流程中会拷贝kernel/linux/linux-\*\.\*的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux/linux-\*\.\*原代码环境。 + > + >根据不同系统工程,编译完成后会在out目录下的kernel目录中生成对应实际编译的内核,基于此目录的内核,进行对应的config修改,将最后生成的\.config文件cp到config仓对应的路径文件里,即可生效。 -### 场景1:版本级编译原生方式 +## 构建说明 + +以hi3516dv300开源开发板+ubuntu x86主机开发环境为例 使用工程的全量编译命令,编译生成uImage内核镜像 ``` -./build.sh --product-name Hi3516DV300 # 编译hi3516dv300的uImage内核镜像 +./build.sh --product-name Hi3516DV300 # 编译hi3516dv300镜像 + --build-target build_kernel # 编译hi3516dv300的uImage内核镜像 + --gn-args linux_kernel_version=\"linux-5.10\" # 编译指定内核版本 ``` -### 场景2:单独编译修改后的内核 - -1. 准备工作 - - 准备编译环境,可以使用开源arm clang/gcc编译器,或者使用工程自带编译器。 - - 进入工程主目录配置环境变量: - - ``` - export PATH=`pwd`/prebuilts/clang/host/linux-x86/clang-r353983c/bin:`pwd`/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/:$PATH # 配置编译环境 - MAKE_OPTIONES="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang" # 使用工程项目自带的clang环境 - ``` - -2. 修改内核代码或内核config (OpenHarmony提供对应平台的defconfig供参考)。 -3. 创建编译目录及生成内核.config。 - - ``` - make ${MAKE_OPTIONES} hi3516dv300_emmc_smp_hos_l2_defconfig # 使用自带的默认config 构建内核 - ``` - -4. 编译生成对应的内核Image。 - - ``` - make ${MAKE_OPTIONES} -j32 uImage # 编译uImage内核镜像 - ``` - - ## 相关仓 **内核子系统** @@ -217,11 +221,12 @@ LiteOS: Linux: -kernel\_linux\_patches +[kernel\_linux\_patches](https://gitee.com/openharmony/kernel_linux_patches/blob/master/README_zh.md) -device\_hisilicon\_hi3516dv300 +[kernel\_linux\_config](https://gitee.com/openharmony/kernel_linux_config/blob/master/README_zh.md) -kernel\_linux\_config +[kernel\_linux\_build](https://gitee.com/openharmony/kernel_linux_build/blob/master/README_zh.md) -kernel\_linux-4.19 +[kernel\_linux\_4.19](https://gitee.com/openharmony/kernel_linux_4.19/blob/master/README) +[kernel\_linux\_5.10](https://gitee.com/openharmony/kernel_linux_5.10/blob/master/README) \ No newline at end of file diff --git "a/zh-cn/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237.md" index 7d345245448078020e282a11fecb9e065cc80d94..aef735a67b5b5b6663ad70ab77c64cdb352b46e2 100755 --- "a/zh-cn/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237.md" @@ -1,17 +1,25 @@ # 分布式任务调度子系统 - [简介](#section11660541593) +- [系统架构](#section13587185873516) - [目录](#section161941989596) - [相关仓](#section1371113476307) ## 简介 -在OpenHarmony系统中,分布式任务调度平台提供系统服务启动、注册、查询等功能。 +分布式任务调度模块负责跨设备组件管理,提供访问和控制远程组件的能力,支持分布式场景下的应用协同。主要功能如下: + +- 远程启动元能力:跨设备拉起远端设备上的指定元能力。 +- 远程迁移元能力:将元能力跨设备迁移到远端设备。 +- 远程绑定元能力:跨设备绑定远端设备上的指定元能力。 +- 系统服务管理:提供系统服务的本地启动、注册、查询等功能;提供系统服务的跨设备查询功能。 + +## 系统架构 **图 1** 子系统架构图 -![](figures/zh-cn_image_0000001162500331.png) +![](figures/dms-architecture_zh.png) ## 目录 @@ -39,5 +47,4 @@ distributedschedule\_safwk\_lite hdistributedschedule\_samgr\_lite -distributedschedule\_dms\_fwk\_lite - +distributedschedule\_dms\_fwk\_lite \ No newline at end of file

系统级别

@@ -43,8 +38,8 @@ OpenHarmony针对不同量级的系统,分别使用了不同形态的内核,

Linux

    

×

+