提交 268bb6d8 编写于 作者: L limeng 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into swiper

Signed-off-by: Nlimeng <limeng208@huawei.com>
......@@ -415,7 +415,7 @@ zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @Buda-Liu @ning
zh-cn/application-dev/reference/apis/js-apis-router.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy
zh-cn/application-dev/reference/apis/js-apis-rpc.md @xuepianpian @RayShih @zhaopeng_gitee @vagrant_world
zh-cn/application-dev/reference/apis/js-apis-runninglock.md @aqxyjay @zengyawen @aqxyjay @alien0208
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @feng-aiwen @ningningW @wangzhangjun @murphy1984
zh-cn/application-dev/reference/apis/js-apis-screen.md @zhangqiang183 @ge-yafang @zhouyaoying @zxg-gitee
zh-cn/application-dev/reference/apis/js-apis-screenshot.md @zhangqiang183 @ge-yafang @zhouyaoying @zxg-gitee
zh-cn/application-dev/reference/apis/js-apis-securityLabel.md @panqinxu @zengyawen @bubble_mao @jinhaihw
......@@ -531,6 +531,7 @@ zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md @shuaytao @Ray
zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md @liuzuming @ningningW @yangqing3
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md @liuzuming @ningningW @yangqing3
......
......@@ -130,8 +130,6 @@ You can set a USB device as the USB host to connect to other USB devices for dat
usb.bulkTransfer(pipe, inEndpoint, dataUint8Array, 15000).then(dataLength => {
if (dataLength >= 0) {
console.info("usb readData result Length : " + dataLength);
let resultStr = this.ab2str(dataUint8Array); // Convert uint8 data into a string.
console.info("usb readData buffer : " + resultStr);
} else {
console.info("usb readData failed : " + dataLength);
}
......
......@@ -268,7 +268,7 @@
- [@ohos.request (Upload and Download)](js-apis-request.md)
- Connectivity
- [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md)
- [@ohos.bluetoothManager (Bluetooth)(js-apis-bluetoothManager.md)
- [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (Standard NFC)](js-apis-nfcController.md)
......@@ -392,6 +392,7 @@
- APIs No Longer Maintained
- [@ohos.backgroundTaskManager (Background Task Management)](js-apis-backgroundTaskManager.md)
- [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md)
- [@ohos.bundle (Bundle)](js-apis-Bundle.md)
- [@ohos.bundle.innerBundleManager (innerBundleManager)](js-apis-Bundle-InnerBundleManager.md)
- [@ohos.bundleState (Device Usage Statistics)](js-apis-deviceUsageStatistics.md)
......
......@@ -22,7 +22,6 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
**Table 1** StartBLEScanOptions
| Name| Type| Mandatory| Description|
......@@ -57,7 +56,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
**Table 2** StopBLEScanOptions
| Name| Type| Mandatory| Description|
......
......@@ -27,8 +27,8 @@ AlphabetIndexer(value: {arrayValue: Array&lt;string&gt;, selected: number})
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description |
| ----------------------- | --------------- | ----------------------------------------------------------- |
| Name | Type | Description |
| ----------------------- | --------------------| ------------------------------------------------------------------|
| color | [ResourceColor](ts-types.md#resourcecolor) | Font color.<br>Default value: **0x99000000** |
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Font color of the selected text.<br>Default value: **0xFF254FF7** |
| popupColor | [ResourceColor](ts-types.md#resourcecolor) | Font color of the pop-up text.<br>Default value: **0xFF254FF7** |
......@@ -39,9 +39,13 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| popupFont | [Font](ts-types.md#font) | Font style of the pop-up text.<br>Default value:<br>{<br>size:10,<br> style:FontStyle.Normal,<br> weight:FontWeight.Normal,<br> family:'HarmonyOS Sans'<br>} |
| font | [Font](ts-types.md#font) | Default font style of the alphabetic index bar.<br>Default value:<br>{<br>size:10,<br> style:FontStyle.Normal,<br> weight:FontWeight.Normal,<br> family:'HarmonyOS Sans'<br>} |
| itemSize | string \| number | Size of an item in the alphabetic index bar. The item is a square, and the side length needs to be set. This attribute cannot be set to a percentage.<br>Default value: **24.0** |
| alignStyle | IndexerAlign | Alignment style of the alphabetic index bar. Left alignment and right alignment are supported.<br>Default value: **IndexerAlign.Right**|
| alignStyle | value: [IndexerAlign](#indexeralign),<br>offset<sup>10+</sup>?: [Length](ts-types.md#length) | Alignment style of the alphabetic index bar.<br>**value**: alignment of the alphabetic index bar with the pop-up window, which can be left-aligned or right-aligned.<br>Default value: **IndexerAlign.Right**<br>**offset**: spacing between the pop-up window and the alphabetic index bar. A value greater than or equal to 0 is valid. If this attribute is set to a value less than 0 or is not set, the spacing is the same as **popupPosition.x**.|
| selected | number | Index of the selected item.<br>Default value: **0**|
| popupPosition | [Position](ts-types.md#position8) | Position of the pop-up window relative to the center of the indexer bar's top border.<br>Default value: **{x:96.0, y:48.0}**|
| popupSelectedColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected text excluding the initial letter in the pop-up window.<br>Default value: **#FF182431**|
| popupUnselectedColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Color of the unselected text in the pop-up window.<br>Default value: **#FF182431**|
| popupItemFont<sup>10+</sup> | [Font](ts-types.md#font) | Font of the text excluding the initial letter in the pop-up window.<br>Default value:<br>{<br>size:24,<br>style:FontStyle.Medium<br>}|
| popupItemBackgroundColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Background color of the portion excluding the initial letter in the pop-up window.<br>Default value: **#FFFFFF**|
## IndexerAlign
......
......@@ -57,10 +57,11 @@
- [Network Sharing Error Codes](errorcode-net-sharing.md)
- [Policy Management Error Codes](errorcode-net-policy.md)
- Connectivity
- [Wi-Fi Error Codes](errorcode-wifi.md)
- [Bluetooth Error Codes](errorcode-bluetoothManager.md)
- [Wi-Fi Error Codes](errorcode-wifi.md)
- [NFC Error Codes](errorcode-nfc.md)
- [RPC Error Codes](errorcode-rpc.md)
- Basic Features
- Basic Features
- [Accessibility Error Codes](errorcode-accessibility.md)
- [FaultLogger Error Codes](errorcode-faultlogger.md)
- [Application Event Logging Error Codes](errorcode-hiappevent.md)
......
# Bluetooth Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 2900001
**Error Message**
Service stopped.
**Description**
The Bluetooth service is stopped, and the APIs related to the Bluetooth service cannot be called.
**Possible Causes**
The Bluetooth service fails to start.
**Solution**
Start the Bluetooth service.
## 2900003
**Error Message**
Bluetooth switch is off.
**Description**
Bluetooth is disabled.
**Possible Causes**
Bluetooth is disabled.
**Solution**
Enable Bluetooth.
## 2900004
**Error Message**
Profile is not supported.
**Description**
The profile is not supported.
**Possible Causes**
The profile is not supported by the device.
**Solution**
Check whether the device supports the profile. Use a profile supported by the device.
## 2900099
**Error Message**
Operation failed.
**Description**
The operation failed.
**Possible Causes**
The profile is not supported by the device.
**Solution**
Perform this operation again.
## 2901000
**Error Message**
Read forbidden.
**Description**
The read operation is not allowed.
**Possible Causes**
The caller does not have the read permission.
**Solution**
Check whether the caller has the read permission.
## 2901001
**Error Message**
Write forbidden.
**Description**
The write operation is not allowed.
**Possible Causes**
The caller does not have the write permission.
**Solution**
Check whether the caller has the write permission.
## 2901054
**Error Message**
IO error.
**Description**
The I/O operation failed.
**Possible Causes**
The I/O transmission is abnormal.
**Solution**
Perform this operation again.
......@@ -4,7 +4,7 @@
在应用开发的文档中,您可以获取到如下几方面的内容:
### 入门
## 入门
[入门](quick-start/start-overview.md)可以帮助开发者了解应用开发的基本方法。
......@@ -12,7 +12,7 @@
开发的基础知识包含了OpenHarmony应用程序的包结构配置文件说明,以及资源文件的使用指导。
### 开发
## 开发
为了帮助开发者更好的理解OpenHarmony提供的能力,我们对重点功能提供了开发指导,辅助开发者完成应用的开发。
......@@ -32,28 +32,27 @@
- [网络与连接](connectivity/ipc-rpc-overview.md)
- [电话服务](telephony/telephony-overview.md)
- [数据管理](database/database-mdds-overview.md)
- [文件管理](file-management/medialibrary-overview.md)
- [任务管理](task-management/background-task-overview.md)
- [设备管理](device/usb-overview.md)
- [设备使用信息统计](device-usage-statistics/device-usage-statistics-overview.md)
- [DFX](dfx/hiappevent-guidelines.md)
- [国际化](internationalization/international-overview.md)
- [应用测试](application-test/arkxtest-guidelines.md)
- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/napi-guidelines.md)
- [文件管理](file-management/medialibrary-overview.md)
- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md)
### 工具
## 工具
DevEco Studio工具是OpenHarmony应用开发的推荐IDE工具。
[工具](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421)部分,讲解了DevEco Studio工具的详细用法,包括使用该工具进行工程创建、应用签名、应用调试、应用安装运行的指导。
### 示例教程
## 示例教程
我们提供了[Sample工程](https://gitee.com/openharmony/applications_app_samples/blob/master/README_zh.md)[Codelab](https://gitee.com/openharmony/codelabs/blob/master/README.md)这两种形式的示例教程,为开发者提供更丰富的开发参考,辅助开发者理解功能逻辑,提升开发效率。
### API参考
## API参考
API参考提供了OpenHarmony全量组件和接口的参考文档,可以帮助开发者快速查找到指定接口的详细描述和调用方法。
......@@ -63,8 +62,8 @@ API参考提供了OpenHarmony全量组件和接口的参考文档,可以帮助
- [组件参考(兼容JS的类Web开发范式-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md)
- [组件参考(兼容JS的类Web开发范式-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md)
- [JS服务卡片UI组件参考](reference/js-service-widget-ui/js-service-widget-file.md)
- [接口参考(JS及TS API)](reference/apis/js-apis-ability-dataUriUtils.md)
- [接口参考(ArkTS及JS API)](reference/apis/development-intro.md)
- 接口参考(Native API)
- [OpenHarmony Native API](reference/native-apis/_o_h___native_x_component.md)
- [Native API标准库](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [OpenHarmony Native API](reference/native-apis/_o_h___native_x_component.md)
- [Native API标准库](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
......@@ -76,22 +76,22 @@ FA模型中,可以通过featureAbility的getContext接口获取应用上下文
通过getContext获取应用上下文并获取分布式目录的示例如下:
```ts
import featureAbility from '@ohos.ability.featureAbility'
import fileIo from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility';
import fs from '@ohos.file.fs';
(async () => {
let dir: string
let dir: string;
try {
console.info('Begin to getOrCreateDistributedDir')
dir = await featureAbility.getContext().getOrCreateDistributedDir()
console.info('Begin to getOrCreateDistributedDir');
dir = await featureAbility.getContext().getOrCreateDistributedDir();
console.info('distribute dir is ' + dir)
} catch (error) {
console.error('getOrCreateDistributedDir failed with ' + error)
console.error('getOrCreateDistributedDir failed with ' + error);
}
let fd: number;
let path = dir + "/a.txt";
fd = fileIo.openSync(path, 0o2 | 0o100, 0o666);
fileIo.close(fd);
fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd;
fs.close(fd);
})()
```
......@@ -88,10 +88,6 @@
调用方传入的want参数中设置uri和type参数发起组件启动请求,系统会遍历当前系统已安装的组件列表,并逐个匹配待匹配Ability的skills配置中的uris数组,如果待匹配Ability的skills配置中的uris数组中只要有一个可以匹配调用方传入的want参数中设置的uri和type即为匹配成功。
**图3** want参数中uri和type皆不为空时的匹配规则
![want-uri-type1](figures/want-uri-type1.png)
实际应用中,uri和type共存在四种情况,下面将讲解四种情况的具体匹配规则:
- 调用方传入的want参数的uri和type都为空。
......@@ -111,6 +107,13 @@
1. 如果待匹配Ability的skills配置中的uris数组为空,匹配失败。
2. 如果待匹配Ability的skills配置中的uris数组存在一条数据[uri匹配](#uri匹配规则)[type匹配](#type匹配规则)需要均匹配成功,则匹配成功,否则匹配失败。
最左uri匹配:当配置文件待匹配Ability的skills配置中的uris数组中只配置scheme;或者只配置scheme和host;或者只配置scheme,host和port时。
传入want参数的uri的最左边依次需要和scheme;或者scheme和host;或者scheme,host,port都匹配,才满足最左uri匹配。
**图3** want参数中uri和type皆不为空时的匹配规则
![want-uri-type1](figures/want-uri-type1.png)
下图为了简化描述,称want中传入的uri为w_uri,称want中传入的type为w_type, 待匹配Ability的skills配置中uris为s_uris,其中每个元素为s_uri;按自上而下顺序匹配。
......@@ -128,7 +131,9 @@
- 如果s_uri的host为空,当w_uri和s_uri的scheme相同时匹配成功,否则匹配失败;
- 如果s_uri的path、pathStartWith和pathRegex都为空,当w_uri和s_uri完全相同时匹配成功,否则匹配失败;
- 如果s_uri的port为空,当w_uri和s_uri中的scheme和host相同时匹配成功,否则匹配失败;
- 如果s_uri的path、pathStartWith和pathRegex都为空,当w_uri和s_uri中的scheme,host和port相同时匹配成功,否则匹配失败;
- 如果s_uri的path不为空,当w_uri和s_uri**全路径表达式**相同时匹配成功,否则继续进行pathStartWith的匹配;
......@@ -144,6 +149,11 @@
> - **前缀表达式**:`scheme://host:port/pathStartWith`
>
> - **正则表达式**:`scheme://host:port/pathRegex`
>
> - **前缀uri表达式**:当配置文件只配置scheme,或者只配置scheme和host,或者只配置scheme,host和port时,参数传入以配置文件为前缀的Uri
> * `scheme://`
> * `scheme://host`
> * `scheme://host:port`
### type匹配规则
......
......@@ -264,6 +264,38 @@ DataShare即数据共享模块,提供了向其他应用共享以及管理其
console.log('dsHelper delete result: ' + data);
});
```
## 限制
为了降低DataShareExtensionAbility能力被三方应用滥用的风险,在DataShareExtensionAbility中限制以下接口的调用
- ./application/UIAbilityContext
- @ohos.ability.featureAbility.d.ts
- @ohos.ability.particleAbility.d.ts
- @ohos.account.osAccount.d.ts
- @ohos.backgroundTaskManager.d.ts
- @ohos.bluetooth.d.ts
- @ohos.bluetoothManager.d.ts
- @ohos.connectedTag.d.ts
- @ohos.continuation.continuationManage.d.ts
- @ohos.mutilmedia.audio.d.ts
- @ohos.multimedia.carema.d.ts
- @ohos.nfc.cardEmulation.d.ts
- @ohos.nfc.controller.d.ts
- @ohos.nfc.tag.d.ts
- @ohos.request.d.ts
- @ohos.resourceschedule.backgroundTaskManager.d.ts
- @ohos.telephony.call.d.ts
- @ohos.telephony.data.d.ts
- @ohos.telephony.observer.d.ts
- @ohos.telephony.radio.d.ts
- @ohos.telephony.sim.d.ts
- @ohos.telephony.sms.d.ts
- @ohos.vibrator.d.ts
- @ohos.wallpaper.d.ts
- @ohos.wifi.d.ts
- @ohos.wifiext.d.ts
- @ohos.wifiManager.d.ts
- @ohos.wifiManagerExt.d.ts
- @ohos.window.d.ts
## 相关示例
......
......@@ -27,6 +27,7 @@
- [应用间HSP开发指导(仅对系统应用开放)](cross-app-hsp.md)
- 原子化服务
- [原子化服务开发指导](atomicService.md)
- [原子化服务空间管理(仅对系统应用开放)](atomicService-aging.md)
- 应用程序包快速修复
- [快速修复概述](quickfix-principles.md)
- [快速修复调试指导](quickfix-debug.md)
......
......@@ -11,7 +11,7 @@ FA模型与Stage模型不同之处在于HAP内部文件存放位置不同,FA
- assets是HAP所有的资源文件、库文件和代码文件的集合,内部可以分为entry和js文件夹。entry文件夹中存放的是resources目录和resources.index文件。
- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)
- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)
- resources.index是资源索引表,由IDE调用SDK工具生成。
......
......@@ -21,7 +21,7 @@
- 打包后的HAP结构包括ets、libs、resources等文件夹和resources.index、module.json、pack.info等文件。
- ets目录用于存放应用代码编译后的字节码文件。
- libs目录用于存放库文件。库文件是OpenHarmony应用依赖的第三方代码(.so二进制文件)。
- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)
- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)
- resources.index是资源索引表,由IDE编译工程时生成。
- module.json是HAP的配置文件,内容由工程配置中的module.json5和app.json5组成,该文件是HAP中必不可少的文件。IDE会自动生成一部分默认配置,开发者按需修改其中的配置。详细字段请参见[应用配置文件](application-configuration-file-overview-stage.md)
- pack.info是Bundle中用于描述每个HAP属性的文件,例如app中的bundleName和versionCode信息、module中的name、type和abilities等信息,由IDE工具生成Bundle包时自动生成。
......
# 原子化服务空间管理(仅对系统应用开放)
从用户的角度,用户不感知原子化服务的安装,也不会主动的卸载原子化服务;从操作系统的角度,原子化服务使用[免安装特性](../reference/apis/js-apis-freeInstall.md),但并不是真的不安装。因此,为了减少系统空间占用,需要对原子化服务有序管理。
## 原子化服务数据目录配额管理
对原子化服务的数据沙箱目录设置存储配额上限,可通过系统参数persist.sys.bms.aging.policy.atomicservice.datasize.threshold获得,默认值1024MB,当超过该配额限制时,写入数据返回失败。
查看和设置系统参数可使用[param get/set](../../device-dev/subsystems/subsys-boot-init-plugin.md)命令
## 主动销毁原子化服务
可以通过[uninstall](../reference/apis/js-apis-installer.md#bundleinstalleruninstall)接口主动销毁原子化服务。
**示例:**
```ts
import installer from '@ohos.bundle.installer';
let bundleName = 'com.ohos.demo';
let installParam = {
userId: 100
};
try {
installer.getBundleInstaller().then(data => {
data.uninstall(bundleName, installParam, err => {
if (err) {
console.error('uninstall failed:' + err.message);
} else {
console.info('uninstall successfully.');
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## 自动销毁原子化服务
### 自动销毁时机
- 定时器触发,其间隔可通过系统参数persist.sys.bms.aging.policy.timer.interval获得,默认8小时;要求剩余电量必须大于等于系统参数persist.sys.bms.aging.policy.battery.threshold,默认10%
- 安装原子化服务时触发
- 修改原子化服务可清理标识时触发
### 销毁条件
#### 原子化服务可销毁
- 通过[isHapModuleRemovable](../reference/apis/js-apis-freeInstall.md#ishapmoduleremovable)返回true
- 非运行状态
#### 销毁开始条件
当前系统所有原子化服务占用空间(包含安装目录和数据目录)大于系统参数persist.sys.bms.aging.policy.data.size.threshold,默认500MB
#### 销毁结束条件
当前系统所有原子化服务占用空间(包含安装目录和数据目录)小于系统参数persist.sys.bms.aging.policy.data.size.threshold的80%
### 自动销毁顺序
- 将可销毁的原子化服务按照最近使用时间区分到不同时间区域内,如[0, 10), [10, 20), [20, 30), [30, ~), 可通过系统参数persist.sys.bms.aging.policy.recently.used.threshold获得时间区域单位,默认是1天;
- 对于两个可销毁的原子化服务,若处于同一时间区域内优先销毁使用频率低的原子化服务;若处于不同时间区域内优先销毁长时间未使用的原子化服务。
### 分级自动销毁
- 当满足自动销毁开始条件时,按照销毁顺序优先销毁原子化服务的cache目录,若满足销毁结束条件,则退出;
- 若不满足,则按照销毁顺序再次清理原子化服务的其他目录。
\ No newline at end of file
......@@ -204,14 +204,15 @@ deviceTypes示例:
abilities标签描述UIAbility组件的配置信息,标签值为数组类型,该标签下的配置只对当前UIAbility生效。
**OpenHarmony中不允许应用隐藏启动图标**
**OpenHarmony中不允许应用隐藏入口图标**
OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动图标,那么系统将应用app.json中的icon作为启动图标,并显示在桌面上。<br>
用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面中。<br>
如果应用想要隐藏启动图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)
OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口图标,那么系统将应用app.json中的icon作为入口图标,并显示在桌面上。<br>
用户点击该图标,将跳转到设置应用管理中对应的应用详情页面(图1)中。<br>
如果应用想要隐藏入口图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)
**场景说明:** 该功能能防止一些恶意应用,故意配置无入口图标,导致用户找不到软件所在的位置,无法操作卸载应用,在一定程度上保证用户的手机安全
**启动图标的设置:** 需要在配置文件(module.json5)中abilities配置下设置icon,label以及skills,而且skills的配置下的必须同时包含“ohos.want.action.home” 和 “entity.system.home”:
**入口图标的设置:** 需要在配置文件(module.json5)中abilities配置下设置icon,label以及skills,而且skills的配置下的必须同时包含“ohos.want.action.home” 和 “entity.system.home”:
```
{
"module":{
......@@ -233,32 +234,34 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动
}
```
**启动图标的查询**
* HAP中包含Ability
* 配置文件(module.json5)中abilities配置中设置了启动图标
**入口图标及入口标签的显示规则**
* HAP中包含UIAbility
* 配置文件(module.json5)中abilities配置中设置了入口图标
* 该应用没有隐藏图标的特权
* 返回的桌面图标为该Ability配置的图标
* 返回的桌面Label为该Ability配置的Label(如果没有配置Label,返回包名)
* 返回的组件名为该Ability的组件名
* 用户点击该桌面图标,页面跳转到该Ability首页
* 显示桌面图标为该UIAbility配置的图标
* 显示桌面Label为该UIAbility配置的Label(如果没有配置Label,返回包名)
* 显示组件名为该UIAbility的组件名
* 用户点击该桌面图标,页面跳转到该UIAbility首页
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。
* 配置文件(module.json5)中abilities配置中未设置启动图标
* 配置文件(module.json5)中abilities配置中未设置入口图标
* 该应用没有隐藏图标的特权
* 返回的桌面图标为app配置下的图标(app.json中icon为必填项)
* 返回的桌面Label为app配置下的label(app.json中label为必填项)
* 返回的组件名为应用详情页面的组件名(该组件为系统内置)
* 用户点击该桌面图标,页面跳转到该应用的详情页面
* 显示桌面图标为app配置下的图标(app.json中icon为必填项)
* 显示桌面Label为app配置下的label(app.json中label为必填项)
* 用户点击该桌面图标,页面跳转到该应用的详情页面(图1)
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。
* HAP中不包含Ability
* HAP中不包含UIAbility
* 该应用没有隐藏图标的特权
* 返回的桌面图标为app配置下的图标(app.json中icon为必填项)
* 返回的桌面Label为app配置下的label(app.json中label为必填项)
* 返回的组件名为应用详情页面的组件名(该组件为系统内置)
* 用户点击该桌面图标,页面跳转到该应用的详情页面
* 显示桌面图标为app配置下的图标(app.json中icon为必填项)
* 显示桌面Label为app配置下的label(app.json中label为必填项)
* 用户点击该桌面图标,页面跳转到该应用的详情页面(图1)
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。<br><br>
应用的详情页例图
![应用的详情页例图](figures/application_details.jpg)
**表4** **abilities标签说明**
......@@ -394,39 +397,6 @@ skills示例:
}
```
**增强隐式查询功能**
支持Uri级别的前缀匹配。
当配置文件只配置scheme,或者只配置scheme和host,或者只配置scheme,host和port时,参数传入以配置文件为前缀的Uri,配置成功。
* 查询功能增强涉及以下接口<br>
[@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)<br>
1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void;<br>
2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void;<br>
3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise<Array<AbilityInfo>>;
* 配置要求<br>
abilities -> skills -> uris对象 <br>
配置1: 只配置 scheme = 'http' <br>
配置2: 只配置 ( scheme = 'http' ) + ( host = 'example.com' ) <br>
配置3: 只配置 ( scheme = 'http' ) + ( host = 'example.com' ) + ( port = '8080' )
* 前缀匹配<br>
参数[want](../application-models/want-overview.md)下uri,调用queryAbilityInfo查询接口<br>
1. uri = 'https://' 无匹配<br>
2. uri = 'http://' 可以匹配 配置1<br>
3. uri = 'https://example.com' 无匹配<br>
4. uri = 'https://exa.com' 无匹配<br>
5. uri = 'http://exa.com' 可以匹配 配置1<br>
6. uri = 'http://example.com' 可以匹配 配置1 配置2<br>
7. uri = 'https://example.com:8080' 无匹配<br>
8. uri = 'http://exampleaa.com:8080' 可以匹配 配置1<br>
9. uri = 'http://example.com:9180' 可以匹配 配置1 配置2<br>
10. uri = 'http://example.com:8080' 可以匹配 配置1 配置2 配置3<br>
11. uri = 'https://example.com:9180/path' 无匹配<br>
12. uri = 'http://exampleap.com:8080/path' 可以匹配 配置1<br>
13. uri = 'http://example.com:9180/path' 可以匹配 配置1 配置2<br>
14. uri = 'http://example.com:8080/path' 可以匹配 配置1 配置2 配置3<br>
## extensionAbilities标签
描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbilities生效。
......
......@@ -190,14 +190,15 @@ metadata对象示例:
## abilities对象的内部结构
**OpenHarmony中不允许应用隐藏启动图标**
**OpenHarmony中不允许应用隐藏入口图标**
OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动图标,那么系统会给该应用创建一个默认的图标显示在桌面上;<br>
用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面中。<br>
如果应用想要隐藏启动图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)
OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口图标,那么系统会给该应用创建一个默认的图标显示在桌面上;<br>
用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面(图1)中。<br>
如果应用想要隐藏入口图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)
**场景说明:** 该功能能防止一些恶意应用,故意配置无入口图标,导致用户找不到软件所在的位置,无法操作卸载应用,在一定程度上保证用户的手机安全
**启动图标的设置:** 需要在配置文件(config.json)中abilities配置下设置icon,label以及skills,而且skills的配置下必须同时包含“ohos.want.action.home” 和 “entity.system.home”:
**入口图标的设置:** 需要在配置文件(config.json)中abilities配置下设置icon,label以及skills,而且skills的配置下必须同时包含“ohos.want.action.home” 和 “entity.system.home”:
```
{
"module":{
......@@ -220,34 +221,36 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动
}
```
**启动图标的查询**
* HAP中包含Page类型的Ability
* 配置文件(config.json)中abilities配置中设置了启动图标
**入口图标及入口标签的显示规则**
* HAP中包含Page类型的PageAbility
* 配置文件(config.json)中abilities配置中设置了入口图标
* 该应用没有隐藏图标的特权
* 返回的桌面图标为该Ability配置的图标
* 返回的桌面Label为该Ability配置的Label(如果没有配置Label,返回包名)
* 返回的组件名为该Ability的组件名
* 用户点击该桌面图标,页面跳转到该Ability首页
* 显示桌面图标为该PageAbility配置的图标
* 显示桌面Label为该PageAbility配置的Label(如果没有配置Label,返回包名)
* 显示组件名为该PageAbility的组件名
* 用户点击该桌面图标,页面跳转到该PageAbility首页
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。
* 配置文件(config.json)中abilities配置中未设置启动图标
* 配置文件(config.json)中abilities配置中未设置入口图标
* 该应用没有隐藏图标的特权
* 返回的桌面图标为系统默认图标
* 返回的桌面Label为该应用的包名
* 返回的组件名为应用详情页面的组件名(该组件为系统内置)
* 用户点击该桌面图标,页面跳转到该应用的详情页面
* 显示桌面图标为系统默认图标
* 显示桌面Label为该应用的包名
* 用户点击该桌面图标,页面跳转到该应用的详情页面(图1)
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。
* HAP中不包含Page类型的Ability
* HAP中不包含Page类型的PageAbility
* 该应用没有隐藏图标的特权
* 返回的桌面图标为系统默认图标
* 返回的桌面Label为该应用的包名
* 返回的组件名为应用详情页面的组件名(该组件为系统内置)
* 用户点击该桌面图标,页面跳转到该应用的详情页面
* 显示桌面图标为系统默认图标
* 显示桌面Label为该应用的包名
* 用户点击该桌面图标,页面跳转到该应用的详情页面(图1)
* 该应用具有隐藏图标的特权
* 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。
注:应用详情页面中显示的图标与label,可能与桌面上显示的不同。如果非Page类型的ability配置了入口图标和label,那么详情页中显示的即为配置的。<br><br>
注:应用详情页面(图1)中显示的label可能与桌面上显示的不同。如果非Page类型的PageAbility配置了入口图标和label,那么详情页中显示的即为配置的。<br><br>
图1
![应用的详情页例图](figures/application_details.jpg)
**表8** **abilities对象的内部结构说明**
......@@ -411,40 +414,6 @@ skills示例:
]
```
**增强隐式查询功能**
支持Uri级别的前缀匹配。
当配置文件只配置scheme,或者只配置scheme和host,或者只配置scheme,host和port时,参数传入以配置文件为前缀的Uri,配置成功。
* 查询功能增强涉及以下接口<br>
[@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)<br>
1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void;<br>
2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void;<br>
3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise<Array<AbilityInfo>>;
* 配置要求<br>
abilities -> skills -> uris对象 <br>
配置1: 只配置 scheme = 'http' <br>
配置2: 只配置 ( scheme = 'http' ) + ( host = 'www.example.com' ) <br>
配置3: 只配置 ( scheme = 'http' ) + ( host = 'www.example.com' ) + ( port = '8080' )
* 前缀匹配<br>
[want](../application-models/want-overview.md)下uri,调用queryAbilityInfo查询接口<br>
1. uri = 'https://' 无匹配<br>
2. uri = 'http://' 可以匹配 配置1<br>
3. uri = 'https://www.example.com' 无匹配<br>
4. uri = 'https://www.exa.com' 无匹配<br>
5. uri = 'http://www.exa.com' 可以匹配 配置1<br>
6. uri = 'http://www.example.com' 可以匹配 配置1 配置2<br>
7. uri = 'https://www.example.com:8080' 无匹配<br>
8. uri = 'http://www.exampleaa.com:8080' 可以匹配 配置1<br>
9. uri = 'http://www.example.com:9180' 可以匹配 配置1 配置2<br>
10. uri = 'http://www.example.com:8080' 可以匹配 配置1 配置2 配置3<br>
11. uri = 'https://www.example.com:9180/query/student/name' 无匹配<br>
12. uri = 'http://www.exampleap.com:8080/query/student/name' 可以匹配 配置1<br>
13. uri = 'http://www.example.com:9180/query/student/name' 可以匹配 配置1 配置2<br>
14. uri = 'http://www.example.com:8080/query/student/name' 可以匹配 配置1 配置2 配置3<br>
## reqPermissions权限申请
**表12** **reqPermissions权限申请字段说明**
......
......@@ -233,6 +233,7 @@
- [@ohos.data.ValuesBucket (数据集)](js-apis-data-valuesBucket.md)
- 文件管理
- [@ohos.file.cloudSyncManager (端云同步管理)](js-apis-file-cloudsyncmanager.md)
- [@ohos.file.environment (目录环境能力)](js-apis-file-environment.md)
- [@ohos.file.fileAccess (公共文件访问与管理)](js-apis-fileAccess.md)
- [@ohos.file.fileExtensionInfo (公共文件访问与管理属性信息)](js-apis-fileExtensionInfo.md)
......@@ -267,7 +268,8 @@
- [@ohos.request (上传下载)](js-apis-request.md)
- 通信与连接
- [@ohos.bluetooth (蓝牙)](js-apis-bluetooth.md)
- [@ohos.bluetooth (蓝牙)(待停用)](js-apis-bluetooth.md)
- [@ohos.bluetoothManager (蓝牙)(推荐)](js-apis-bluetoothManager.md)
- [@ohos.connectedTag (有源标签)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (标准NFC)](js-apis-nfcController.md)
......@@ -352,6 +354,7 @@
- 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-configPolicy.md)
- [@ohos.enterprise.accountManager (帐户管理)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.adminManager (企业设备管理)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.dateTimeManager (系统时间管理)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (设备控制管理)](js-apis-enterprise-deviceControl.md)
......
......@@ -158,6 +158,12 @@ saveAppState(context?: UIAbilityContext): boolean;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md)| 否 | UIAbility上下文环境。 |
**返回值:**
| 类型 | 说明 |
......@@ -182,6 +188,12 @@ setRestartWant(want: Want): void;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-want.md)| 是 | 通过设置Want中"bundleName"和"abilityName"字段来指定恢复重启的Ability。 |
**示例:**
```ts
......
......@@ -148,7 +148,7 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
## ServiceExtensionAbility.onDisconnect
onDisconnect(want: Want): void | Promise<void>;
onDisconnect(want: Want): void | Promise\<void>;
Extension的生命周期回调,客户端执行断开连接服务时回调。
......
......@@ -130,11 +130,11 @@ import Want from '@ohos.app.ability.Want';
```
* 文件描述符(FD)
```ts
import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs';
let fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd;
} catch(e) {
console.error('openSync fail: ${JSON.stringify(e)}');
}
......
......@@ -108,10 +108,10 @@ import Want from '@ohos.application.Want';
```
* 文件描述符(FD)
```ts
import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs';
let fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd;
} catch(e) {
console.error('openSync fail: ${JSON.stringify(e)}');
}
......
......@@ -441,8 +441,9 @@ castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDe
import audio from '@ohos.multimedia.audio';
let audioManager = audio.getAudioManager();
let audioRoutingManager = audioManager.getRoutingManager();
let audioDevices;
await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
audioDevices = data;
console.info('Promise returned to indicate that the device list is obtained.');
}).catch((err) => {
......@@ -493,8 +494,9 @@ castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDe
import audio from '@ohos.multimedia.audio';
let audioManager = audio.getAudioManager();
let audioRoutingManager = audioManager.getRoutingManager();
let audioDevices;
await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
audioDevices = data;
console.info('Promise returned to indicate that the device list is obtained.');
}).catch((err) => {
......
......@@ -652,6 +652,98 @@ try {
```
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode"></a>
setDevicePinCode(device: string, code: string, callback: AsyncCallback&lt;void&gt;): void
当蓝牙配对类型[PinType](#pintype10)为PIN_TYPE_ENTER_PIN_CODE或PIN_TYPE_PIN_16_DIGITS时调用此接口,请求用户输入PIN码。
**需要权限**:ohos.permission.MANAGE_BLUETOOTH
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | -------------------------------- |
| device | string | 是 | 表示远端设备MAC地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| code | string | 是 | 用户输入的PIN码。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,当设置PinCode成功,err为undefined,否则为错误对象。 |
**错误码**
以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)
| 错误码ID | 错误信息 |
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900099 | Operation failed. |
**示例:**
```js
//callback
try {
bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => {
console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data));
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode"></a>
setDevicePinCode(device: string, code: string): Promise&lt;void&gt;
当蓝牙配对类型[PinType](#pintype10)为PIN_TYPE_ENTER_PIN_CODE或PIN_TYPE_PIN_16_DIGITS时调用此接口,请求用户输入PIN码。
**需要权限**:ohos.permission.MANAGE_BLUETOOTH
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | -------------------------------- |
| device | string | 是 | 表示远端设备MAC地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| code | string | 是 | 用户输入的PIN码。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ------------- |
| Promise&lt;void&gt; | 返回promise对象。 |
**错误码**
以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)
| 错误码ID | 错误信息 |
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900099 | Operation failed. |
**示例:**
```js
//promise
try {
bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => {
console.info('setDevicePinCode');
}, error => {
console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message);
})
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.on('bluetoothDeviceFind')
on(type: "bluetoothDeviceFind", callback: Callback&lt;Array&lt;string&gt;&gt;): void
......@@ -4005,12 +4097,13 @@ try {
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 |
| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 |
| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 |
| descriptors | Array&lt;[BLEDescriptor](#bledescriptor)&gt; | 是 | 是 | 特定特征的描述符列表。 |
| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 |
| descriptors | Array&lt;[BLEDescriptor](#bledescriptor)&gt; | 是 | 是 | 特定特征的描述符列表。 |
| properties<sup>10+</sup> | [GattProperties](#gattproperties10) | 是 | 是 | 特定特征的属性描述。 |
## BLEDescriptor
......@@ -4218,6 +4311,7 @@ try {
| deviceId | string | 是 | 否 | 表示扫描到的设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
| rssi | number | 是 | 否 | 表示扫描到的设备的rssi值。 |
| data | ArrayBuffer | 是 | 否 | 表示扫描到的设备发送的广播包。 |
| deviceName<sup>10+</sup> | string | 是 | 否 | 表示扫描到的设备名称。 |
## BluetoothState
......@@ -4297,6 +4391,7 @@ try {
| -------- | ------ | ---- | ---- | ----------- |
| deviceId | string | 是 | 否 | 表示要配对的设备ID。 |
| pinCode | string | 是 | 否 | 表示要配对的密钥。 |
| pinType<sup>10+</sup> | [PinType](#pintype10) | 是 | 否 | 表示要配对的设备类型。 |
## BondStateParam<a name="BondStateParam"></a>
......@@ -4323,6 +4418,21 @@ try {
| state | [ProfileConnectionState](#profileconnectionstate) | 是 | 否 | 表示蓝牙设备的profile连接状态。 |
## GattProperties<sup>10+</sup><a name="GattProperties"></a>
描述gatt characteristic的属性。
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 类型 | 只读 | 必填 | 说明 |
| -------- | ------ | ---- | ---- | ----------- |
| write<sup>10+</sup> | boolean | 是 | 是 | 表示该特征支持写操作,需要对端设备的回复。 |
| writeNoResponse<sup>10+</sup> | boolean | 是 | 是 | 表示该特征支持写操作,无需对端设备回复。 |
| read<sup>10+</sup> | boolean | 是 | 是 | 表示该特征支持读操作。 |
| notify<sup>10+</sup> | boolean | 是 | 是 | 表示该特征可通知对端设备。 |
| indicate<sup>10+</sup> | boolean | 是 | 是 | 表示该特征可通知对端设备,需要对端设备的回复。 |
## DeviceClass<a name="DeviceClass"></a>
描述蓝牙设备的类别。
......@@ -4336,7 +4446,6 @@ try {
| classOfDevice | number | 是 | 否 | 表示设备类别。 |
## MajorClass<a name="MajorClass"></a>
枚举,蓝牙设备主要类别。
......@@ -4477,4 +4586,22 @@ try {
| PROFILE_A2DP_SOURCE | 1 | 表示A2DP profile。 |
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | 表示HFP profile。 |
| PROFILE_HID_HOST | 6 | 表示HID profile。 |
| PROFILE_PAN_NETWORK | 7 | 表示PAN profile。 |
\ No newline at end of file
| PROFILE_PAN_NETWORK | 7 | 表示PAN profile。 |
## PinType<sup>10+</sup><a name="PinType"></a>
枚举,蓝牙配对类型。
**系统能力**:SystemCapability.Communication.Bluetooth.Core。
| 名称 | 值 | 说明 |
| -------------------------------- | ------ | --------------- |
| PIN_TYPE_ENTER_PIN_CODE<sup>10+</sup> | 0 | 用户需要输入对端设备上显示的PIN码。 |
| PIN_TYPE_ENTER_PASSKEY<sup>10+</sup> | 1 | 用户需要输入对端设备上显示的PASSKEY。 |
| PIN_TYPE_CONFIRM_PASSKEY<sup>10+</sup> | 2 | 用户需要确认本地设备上显示的PASSKEY。 |
| PIN_TYPE_NO_PASSKEY_CONSENT<sup>10+</sup> | 3 | 无PASSKEY,用户需要接受或拒绝配对请求。 |
| PIN_TYPE_NOTIFY_PASSKEY<sup>10+</sup> | 4 | 本地设备显示PASSKEY,用户需要在对端设备上输入该PASSKEY。 |
| PIN_TYPE_DISPLAY_PIN_CODE<sup>10+</sup> | 5 | bluetooth 2.0设备,用户需要输入对端设备上显示的PIN码。 |
| PIN_TYPE_OOB_CONSENT<sup>10+</sup> | 6 | 用户需要接受或拒绝OOB配对请求。 |
| PIN_TYPE_PIN_16_DIGITS<sup>10+</sup> | 7 | 用户需要输入对端设备上显示的16位PIN码。 |
# BusinessAbilityInfo
> **说明:**
> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
包含基本业务路由信息。
## BusinessAbilityInfo
**系统能力**: SystemCapability.BundleManager.BundleFramework.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | -------------------- |
| bundleName | string | 是 | 否 | 表示应用程序的bundleName。 |
| moduleName | string | 是 | 否 | 表示应用程序的moduleName。 |
| name | string | 是 | 否 | 业务路由ability名。 |
| labelId | number | 是 | 否 | 模块标签的资源id。 |
| descriptionId | number | 是 | 否 | 描述信息的资源id。 |
| iconId | number | 是 | 否 | 描述ability信息的图标id。 |
| businessType | [businessAbilityRouter.BusinessType](js-apis-businessAbilityRouter.md#businesstype) | 是 | 否 | 标识枚举业务类型。 |
| applicationInfo | Array\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 否 | 应用程序的信息。 |
# @ohos.app.businessAbilityRouter (业务路由模块)
本模块用于查询当前设备上安装的各种应用程序的路由ability信息。通过业务路由提供标准的业务模板和业务管理能力,开发者可以按照指定的业务类别注册标准业务,丰富的业务形成一个庞大的超市。系统应用或者三方应用可以从业务路由中获取所需业务,并选择合适的业务使用。同时业务路由提供统一的跳转管控规则,控制应用与业务之间的合理跳转,杜绝前后台任意的跳转行为,避免三方应用通过跳转变相分发,解决安全弱、体验差的问题。
> **说明:**
>
> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
本模块接口为系统接口。
## 导入模块
``` ts
import businessAbilityRouter from '@ohos.app.businessAbilityRouter';
```
## 权限列表
| 权限 | 权限等级 | 描述 |
| ------------------------------------------ | ------------ | -------------------- |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 |
权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)
## BusinessType
此枚举值用于标识过滤条件类型。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。
**系统接口:** 此接口为系统接口。
| 名称 | 值 | 说明 |
| ----------- | ---- | ------------------------------------ |
| SHARE | 0 | 标识具有共享类型的ability信息。 |
| UNSPECIFIED | 255 | 标识未指定类型的ability信息。 |
## BusinessAbilityFilter
此过滤值用于过滤查询的ability类型。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统接口:** 此接口为系统接口。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------ | ------------ | ---- | ---- | -------------------------------------- |
| businessType | BusinessType | 是 | 否 | 标识ability信息的类型。 |
| mimeType | string | 是 | 否 | 标识支持mime类型的ability信息。 |
| uri | string | 是 | 否 | 标识ability信息支持的uri。 |
## businessAbilityRouter.queryBusinessAbilityInfo
queryBusinessAbilityInfo(filter: BusinessAbilityFilter, callback: AsyncCallback\<Array\<BusinessAbilityInfo\>\>): void;
以异步方法通过给定的过滤条件查询ability信息。使用callback异步回调。成功返回查询到的路由ability信息,失败返回对应错误信息。
**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力:** SystemCapability.BundleManager.BundleFramework.Core
**系统API:** 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | --------------------------------------- |
| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 支持按业务类型过滤的对象。 |
| callback | AsyncCallback\<Array\<[BusinessAbilityInfo](js-apis-bundleManager-businessAbilityInfo.md#businessabilityinfo)\>\> | 是 | 回调函数。返回查询到的ability信息,否则为错误对象。 |
**示例:**
```ts
import businessAbilityRouter from '@ohos.app.businessAbilityRouter';
let filter = {businessType: businessAbilityRouter.BusinessType.SHARE};
try {
businessAbilityRouter.queryBusinessAbilityInfo(filter)
.then(() => {
console.info('queryBusinessAbilityInfo success');
}).catch((error) => {
console.error('queryBusinessAbilityInfo failed ' + error.message);
});
} catch (error) {
console.error('queryBusinessAbilityInfo failed ' + error.message);
}
```
## businessAbilityRouter.queryBusinessAbilityInfo
queryBusinessAbilityInfo(filter: BusinessAbilityFilter): Promise\<Array\<BusinessAbilityInfo\>\>;
以异步方法通过给定的过滤条件查询ability信息。使用Promise异步回调,成功返回查询到的路由ability信息,失败返回对应错误信息。
**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力:** SystemCapability.BundleManager.BundleFramework.Core
**系统API:** 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 包含要查询的ability信息的筛选类型。 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------------ | ------------------------------------------- |
| Promise\<Array\<[BusinessAbilityInfo](js-apis-bundleManager-businessAbilityInfo.md#businessabilityinfo)\>\> | Promise对象,返回符合过滤条件的ability信息。 |
**示例:**
```ts
import businessAbilityRouter from '@ohos.app.businessAbilityRouter';
let filter = {businessType: businessAbilityRouter.BusinessType.SHARE};
try {
businessAbilityRouter.queryBusinessAbilityInfo(filter, (error, data) => {
if (error) {
console.error('queryBusinessAbilityInfo failed ' + error.message);
return;
}
console.info('queryBusinessAbilityInfo success');
});
} catch (error) {
console.error('queryBusinessAbilityInfo failed ' + error.message);
}
```
......@@ -291,6 +291,63 @@ try {
}
```
## display.on('privateModeChange')<sup>10+</sup>
on(type: 'privateModeChange', callback: Callback&lt;boolean&gt;): void
开启屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 |
| callback | Callback&lt;boolean&gt; | 是 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私窗口模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 |
**示例:**
```js
let callback = (data) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data));
};
try {
display.on("privateModeChange", callback);
} catch (exception) {
console.error('Failed to register callback. Code: ' + JSON.stringify(exception));
}
```
## display.off('privateModeChange')<sup>10+</sup>
off(type: 'privateModeChange', callback?: Callback&lt;boolean&gt;): void
关闭屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 |
| callback | Callback&lt;boolean&gt; | 否 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 |
**示例:**
```js
try {
display.off("privateModeChange");
} catch (exception) {
console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception));
}
```
## display.getDefaultDisplay<sup>(deprecated)</sup>
getDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void
......
......@@ -949,7 +949,7 @@ createImageSource(uri: string): ImageSource
```js
//Stage模型
const context = getContext(this);
const path = context.getCacheDir() + "/test.jpg";
const path = context.cacheDir() + "/test.jpg";
const imageSourceApi = image.createImageSource(path);
```
......
| 操作 | 旧版本 | 新版本 | d.ts文件 |
| ---- | ------ | ------ | -------- |
|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts|
|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册