You need to sign in or sign up before continuing.
提交 ee8ad91d 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 127655ad
...@@ -421,7 +421,6 @@ ...@@ -421,7 +421,6 @@
- Account Management - Account Management
- [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md) - [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md)
- [@ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md) - [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md) - [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md)
......
# @ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)
The **AuthorizationExtensionAbility** module provides APIs for implementing authorization to app accounts based on the ExtensionAbility framework.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import AuthorizationExtensionAbility, { AuthorizationRequest, AuthorizationCallback } from '@ohos.account.appAccount.AuthorizationExtensionAbility';
```
## AuthorizationRequest
Defines the app account authorization request.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.AppAccount
| Name | Type | Readable| Writable| Description |
| --------- | ------------------------------- | ---- | ---- | ------------------------------------ |
| callerUid | number | Yes | No | UID of the caller.|
| parameters | [appAccount.AccountCapabilityRequest](js-apis-appAccount.md#accountcapabilityrequest10) | Yes | No | Service parameters.|
## AuthorizationCallback
Provides callbacks to be invoked during the app account authorization.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.AppAccount
| Name | Type | Readable| Writable| Description |
| --------- | ------------------------------- | ---- | ---- | ------------------------------------ |
| onResult | AsyncCallback<[appAccount.AccountCapabilityResponse](js-apis-appAccount.md#accountcapabilityresponse10), { [key: string]: object }> | Yes | No | Callback invoked to return the authorization result.|
## AuthorizationExtensionAbility.onStartAuthorization
onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallback): void
Called when an authorization request is received.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------- |
| request | [AuthorizationRequest](#authorizationrequest) | Yes | Authorization request information.|
| callback | [AuthorizationCallback](#authorizationcallback) | Yes | Authorization callback object.|
**Example**
```ts
class MyAuthorizationExtensionAbility extends AuthorizationExtensionAbility {
onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallback) {
console.log('onStartAuthorization, callerUid: ' + request.callerUid + ', parameters: ' + request.parameters);
let response = {
name: 'xxxx',
scopes: ['xxx', 'xxx']
};
callback.onResult(null, response);
}
};
```
...@@ -2687,7 +2687,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c ...@@ -2687,7 +2687,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------------------- | | ------ | ------ | ---- | ---- | ---------------------------------------- |
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| | | ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>- **0o400**: The owner has the read permission on a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the read permission on a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or read a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| | mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>**NOTE**<br>The following values are in octal format. The returned values are in decimal format. You need to convert the values.<br>- **0o400**: The owner has the permission to read a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the permission to read a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| uid | number | Yes | No | ID of the file owner.| | uid | number | Yes | No | ID of the file owner.|
| gid | number | Yes | No | ID of the user group of the file.| | gid | number | Yes | No | ID of the user group of the file.|
| size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. | | size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
......
...@@ -23,20 +23,18 @@ Before developing applications related to tag read and write, you must declare N ...@@ -23,20 +23,18 @@ Before developing applications related to tag read and write, you must declare N
// Add the nfc tag action. // Add the nfc tag action.
"ohos.nfc.tag.action.TAG_FOUND" "ohos.nfc.tag.action.TAG_FOUND"
],
"uris": [
{
"type":"tag-tech/NfcA"
},
{
"type":"tag-tech/IsoDep"
}
// Add other technology if neccessary,
// such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
] ]
} }
],
"metadata": [
{
"name": "tag-tech",
"value": "NfcA"
},
{
"name": "tag-tech",
"value": "IsoDep"
}
// Add other technologies,
// such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
] ]
} }
], ],
...@@ -49,13 +47,11 @@ Before developing applications related to tag read and write, you must declare N ...@@ -49,13 +47,11 @@ Before developing applications related to tag read and write, you must declare N
} }
} }
``` ```
> **CAUTION**<br> > **CAUTION**
> >
> - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed. > - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed.
> - The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed. > - The **type** field under **uris** must start with **tag-tech/**, followed by NfcA, NfcB, NfcF, NfcV, IsoDep, Ndef, MifareClassic, MifareUL, or NdefFormatable. If there are multiple types, enter them in different lines. Incorrect settings of this field will cause a parsing failure.
> - The **value** field under **metadata** is mandatory. It can be **NfcA**, **NfcB**, **NfcF**, **NfcV**, **IsoDep**, **Ndef**, **MifareClassic**, **MifareUL**, **NdefFormatable** or any of their combinations. Incorrect settings of this field will cause a parsing failure.
> - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed. > - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
## **Modules to Import** ## **Modules to Import**
```js ```js
...@@ -528,8 +524,16 @@ import tag from '@ohos.nfc.tag'; ...@@ -528,8 +524,16 @@ import tag from '@ohos.nfc.tag';
let elementName = null; let elementName = null;
let discTech = [tag.NFC_A, tag.NFC_B]; // replace with the tech(s) that is needed by foreground ability let discTech = [tag.NFC_A, tag.NFC_B]; // replace with the tech(s) that is needed by foreground ability
function foregroundCb(tagInfo: any) {
console.log("foreground callback: tag found tagInfo = ", JSON.stringify(tagInfo)); function foregroundCb(err, taginfo) {
if (!err) {
console.log("foreground callback: tag found tagInfo = ", JSON.stringify(tagInfo));
} else {
console.log("foreground callback err: " + err.message);
return;
}
// other Operations of taginfo
} }
export default class MainAbility extends UIAbility { export default class MainAbility extends UIAbility {
...@@ -885,7 +889,7 @@ Enumerates the tag technology types. ...@@ -885,7 +889,7 @@ Enumerates the tag technology types.
| **Name** | **Value**| **Description** | | **Name** | **Value**| **Description** |
| ---------------------------- | ------ | --------------------------- | | ---------------------------- | ------ | --------------------------- |
| NFC_A | 1 | NFC-A (ISO 14443-3A). | | NFC_A | 1 | NFC-A (ISO 14443-3A). |
| NFC_B | 2 | NFC-B (ISO 14443-3B).| | NFC_B | 2 | NFC-B (ISO 14443-3B). |
| ISO_DEP | 3 | ISO-DEP (ISO 14443-4).| | ISO_DEP | 3 | ISO-DEP (ISO 14443-4).|
| NFC_F | 4 | NFC-F (JIS 6319-4). | | NFC_F | 4 | NFC-F (JIS 6319-4). |
| NFC_V | 5 | NFC-V (ISO 15693). | | NFC_V | 5 | NFC-V (ISO 15693). |
......
...@@ -1275,6 +1275,151 @@ async function example() { ...@@ -1275,6 +1275,151 @@ async function example() {
} }
``` ```
### getPhotoIndex
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback&lt;number&gt;): void
Obtains the index of an image or video in an album. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| AsyncCallback&lt;number&gt;| Promise used to return the index obtained.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
console.info('getPhotoIndexDemo');
let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
let fetchOp = {
fetchColumns: [],
predicates: predicatesForGetAsset
};
//Obtain the uri of the album
let albumFetchResult = await helper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
let album = await albumFetchResult.getFirstObject();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.orderByAsc("add_modified");
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let photoFetchResult = await album.getAssets(fetchOptions);
let expectIndex = 1;
//Obtain the uri of the second file
let photoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
photoAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions, (err, index) => {
try {
if (err == undefined) {
console.info(`getPhotoIndex successfully and index is : ${index}`);
} else {
console.info(`getPhotoIndex failed;`);
}
} catch (error) {
console.info(`getPhotoIndex failed; error: ${error}`);
}
}
}
```
### getPhotoIndex
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise&lt;number&gt;
Obtains the index of an image or video in an album. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| Promise&lt;number&gt;| Promise used to return the index obtained.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
console.info('getPhotoIndexDemo');
let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
let fetchOp = {
fetchColumns: [],
predicates: predicatesForGetAsset
};
//Obtain the uri of the album
let albumFetchResult = await helper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
let album = await albumFetchResult.getFirstObject();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.orderByAsc("add_modified");
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let photoFetchResult = await album.getAssets(fetchOptions);
let expectIndex = 1;
//Obtain the uri of the second file
let photoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
photoAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions)
.then((index) => {
console.info(`getPhotoIndex successfully and index is : ${index}`);
}).catch((err) => {
console.info(`getPhotoIndex failed; error: ${err}`);
})
}
```
### release ### release
release(callback: AsyncCallback&lt;void&gt;): void release(callback: AsyncCallback&lt;void&gt;): void
...@@ -1360,7 +1505,7 @@ Provides APIs for encapsulating file asset attributes. ...@@ -1360,7 +1505,7 @@ Provides APIs for encapsulating file asset attributes.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ | | ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. | | uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| photoType | [PhotoType](#phototype) | Yes | No | Type of the file. | | photoType | [PhotoType](#phototype) | Yes | No | Type of the file. |
| displayName | string | Yes | No | File name, including the file name extension, to display. | | displayName | string | Yes | No | File name, including the file name extension, to display. |
...@@ -2243,6 +2388,282 @@ async function example() { ...@@ -2243,6 +2388,282 @@ async function example() {
} }
``` ```
### getExif<sup>10+</sup>
getExif(): Promise&lt;string&gt;
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses a promise to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **js-apis-photoAccessHelper.md**. These two fields must be passed in via **fetchColumns**.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| Promise&lt;string&gt; | Callback invoked to return the JSON string obtained.|
**Supported EXIF tags**
For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
| Key Value | Description |
| --------------------------------------- | ----------------- |
| BitsPerSample | Number of bits per pixel.|
| Orientation | Image orientation.|
| ImageLength | Image length.|
| ImageWidth | Image width.|
| GPSLatitude | GPS latitude of the image.|
| GPSLongitude | GPS longitude of the image.|
| GPSLatitudeRef | Longitude reference, for example, W or E.|
| GPSLongitudeRef | Latitude reference, for example, N or S.|
| DateTimeOriginal | Shooting time.|
| ExposureTime | Exposure time.|
| SceneType | Shooting scene type.|
| ISOSpeedRatings | ISO sensitivity or speed.|
| FNumber | f-number.|
| DateTime | Date and time when the image was last modified.|
| GPSTimeStamp | GPS timestamp.|
| GPSDateStamp | GPS date stamp.|
| ImageDescription | Image description.|
| Make | Camera vendor.|
| Model | Model.|
| PhotoMode | Photo mode.|
| SensitivityType | Sensitivity type.|
| StandardOutputSensitivity | Standard output sensitivity.|
| RecommendedExposureIndex | Recommended exposure index.|
| ApertureValue | Aperture value.|
| MeteringMode | Metering mode.|
| LightSource | Light source.|
| Flash | Flash status.|
| FocalLength | Focal length.|
| UserComment | User comment.|
| PixelXDimension | Pixel X dimension.|
| PixelYDimension | Pixel Y dimension.|
| WhiteBalance | White balance.|
| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
| ExposureBiasValue | Exposure compensation.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('getExifDemo');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [ 'all_exif', photoKeys.USER_COMMENT],
predicates: predicates
};
let fetchResult = await phAccessHelper.getAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let exifMessage = await fileAsset.getExif();
let userCommentKey = 'UserComment';
let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
fetchResult.close();
} catch (err) {
console.error('getExifDemoCallback failed with error: ' + err);
}
}
```
### getExif<sup>10+</sup>
getExif(callback: AsyncCallback&lt;string&gt;): void
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the JSON string obtained.|
**Supported EXIF tags**
For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
| Key Value | Description |
| --------------------------------------- | ----------------- |
| BitsPerSample | Number of bits per pixel.|
| Orientation | Image orientation.|
| ImageLength | Image length.|
| ImageWidth | Image width.|
| GPSLatitude | GPS latitude of the image.|
| GPSLongitude | GPS longitude of the image.|
| GPSLatitudeRef | Longitude reference, for example, W or E.|
| GPSLongitudeRef | Latitude reference, for example, N or S.|
| DateTimeOriginal | Shooting time.|
| ExposureTime | Exposure time.|
| SceneType | Shooting scene type.|
| ISOSpeedRatings | ISO sensitivity or speed.|
| FNumber | f-number.|
| DateTime | Date and time when the image was last modified.|
| GPSTimeStamp | GPS timestamp.|
| GPSDateStamp | GPS date stamp.|
| ImageDescription | Image description.|
| Make | Camera vendor.|
| Model | Model.|
| PhotoMode | Photo mode.|
| SensitivityType | Sensitivity type.|
| StandardOutputSensitivity | Standard output sensitivity.|
| RecommendedExposureIndex | Recommended exposure index.|
| ApertureValue | Aperture value.|
| MeteringMode | Metering mode.|
| LightSource | Light source.|
| Flash | Flash status.|
| FocalLength | Focal length.|
| UserComment | User comment.|
| PixelXDimension | Pixel X dimension.|
| PixelYDimension | Pixel Y dimension.|
| WhiteBalance | White balance.|
| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
| ExposureBiasValue | Exposure compensation.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('getExifDemo');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [ 'all_exif', photoKeys.USER_COMMENT],
predicates: predicates
};
let fetchResult = await phAccessHelper.getAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userCommentKey = 'UserComment';
fileAsset.getExif((err, exifMessage) => {
if (exifMessage != undefined) {
let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
} else {
console.error('getExif failed, message = ', err);
}
});
fetchResult.close();
} catch (err) {
console.error('getExifDemoCallback failed with error: ' + err);
}
}
```
### setUserComment<sup>10+</sup>
setUserComment(userComment: string): Promise&lt;void&gt;
Sets user comment information of an image or video. This API uses a promise to return the result.
**NOTE**<br>This API can be used to modify the comment information of only images or videos.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
|Promise&lt;void&gt; | Promise that returns no value.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setUserCommentDemo')
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let fetchResult = await phAccessHelper.getAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userComment = 'test_set_user_comment';
await fileAsset.setUserComment(userComment);
} catch (err) {
console.error('setUserCommentDemoCallback failed with error: ' + err);
}
}
```
### setUserComment<sup>10+</sup>
setUserComment(userComment: string, callback: AsyncCallback&lt;void&gt;): void
Sets user comment information of an image or video. This API uses an asynchronous callback to return the result.
**NOTE**<br>This API can be used to modify the comment information of only images or videos.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setUserCommentDemo')
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let fetchResult = await phAccessHelper.getAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userComment = 'test_set_user_comment';
fileAsset.setUserComment(userComment, (err) => {
if (err === undefined) {
console.info('setUserComment successfully');
} else {
console.error('setUserComment failed with error: ' + err);
}
});
} catch (err) {
console.error('setUserCommentDemoCallback failed with error: ' + err);
}
}
```
## FetchResult ## FetchResult
Provides APIs to manage the file retrieval result. Provides APIs to manage the file retrieval result.
...@@ -3726,6 +4147,7 @@ Defines the key information about an image or video file. ...@@ -3726,6 +4147,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. | | DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. |
| HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. | | HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. |
| CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. | | CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. |
| USER_COMMENT<sup>10+</sup> | 'user_comment' | User comment information. **System API**: This is a system API. |
## AlbumKeys ## AlbumKeys
......
...@@ -66,7 +66,7 @@ try { ...@@ -66,7 +66,7 @@ try {
if (state == secureElement.ServiceState.DISCONNECTED) { if (state == secureElement.ServiceState.DISCONNECTED) {
console.log("Service state is Disconnected"); console.log("Service state is Disconnected");
} else { } else {
console.log.("Service state is Connected"); console.log("Service state is Connected");
} }
}); });
} catch (e) { } catch (e) {
...@@ -114,7 +114,6 @@ try { ...@@ -114,7 +114,6 @@ try {
try { try {
nfcOmaReaderList = nfcSEService.getReaders(); nfcOmaReaderList = nfcSEService.getReaders();
if (nfcOmaReaderList != null && nfcOmaReaderList.length > 0) { if (nfcOmaReaderList != null && nfcOmaReaderList.length > 0) {
nfcOmaReader = this.nfcOmaReaderList[0];
console.log("get reader successfully"); console.log("get reader successfully");
} else { } else {
console.log("get reader failed"); console.log("get reader failed");
...@@ -205,7 +204,6 @@ import secureElement from '@ohos.secureElement'; ...@@ -205,7 +204,6 @@ import secureElement from '@ohos.secureElement';
let nfcSEService = null; let nfcSEService = null;
this.result = "version: "
try { try {
// refer to newSEService for this.nfcSEService // refer to newSEService for this.nfcSEService
console.log("version: " + nfcSEService.getVersion()); console.log("version: " + nfcSEService.getVersion());
...@@ -349,7 +347,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m ...@@ -349,7 +347,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m
```js ```js
import secureElement from '@ohos.secureElement'; import secureElement from '@ohos.secureElement';
nfcOmaReader = null; let nfcOmaReader = null;
try { try {
// refer to SEService.getReaders for this.nfcOmaReader // refer to SEService.getReaders for this.nfcOmaReader
...@@ -584,10 +582,11 @@ import secureElement from '@ohos.secureElement'; ...@@ -584,10 +582,11 @@ import secureElement from '@ohos.secureElement';
let nfcOmaSession = null; let nfcOmaSession = null;
let nfcOmaChannel = null; let nfcOmaChannel = null;
let aidArray = [720, 1080];
try { try {
// See Reader.openSession for this.nfcOmaSession. // See Reader.openSession for this.nfcOmaSession.
let getPromise = nfcOmaSession.openBasicChannel(this.aidArray); let getPromise = nfcOmaSession.openBasicChannel(aidArray);
getPromise.then((channel) => { getPromise.then((channel) => {
nfcOmaChannel = channel; nfcOmaChannel = channel;
console.log("openBasicChannel1 get channel successfully"); console.log("openBasicChannel1 get channel successfully");
...@@ -737,7 +736,6 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m ...@@ -737,7 +736,6 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m
```js ```js
import secureElement from '@ohos.secureElement'; import secureElement from '@ohos.secureElement';
let nfcOmaSession = null; let nfcOmaSession = null;
let nfcOmaChannel = null; let nfcOmaChannel = null;
let aidArray = [720, 1080]; let aidArray = [720, 1080];
...@@ -915,8 +913,9 @@ if (nfcOmaSession) { ...@@ -915,8 +913,9 @@ if (nfcOmaSession) {
}).catch ((err) => { }).catch ((err) => {
console.log("openLogicChannel3 exception"); console.log("openLogicChannel3 exception");
}) })
} catch (e) { } catch (e) {
console.log("openLogicChannel3 exception:" + e.message); console.log("openLogicChannel3 exception:" + e.message);
}
} }
``` ```
......
...@@ -1393,6 +1393,151 @@ async function example() { ...@@ -1393,6 +1393,151 @@ async function example() {
} }
``` ```
### getPhotoIndex<sup>10+</sup>
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback&lt;number&gt;): void
Obtains the index of an image or video in an album. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| AsyncCallback&lt;number&gt;| Callback invoked to return the index obtained.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
console.info('getPhotoIndexDemo');
let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
let fetchOp = {
fetchColumns: [],
predicates: predicatesForGetAsset
};
//Obtain the uri of the album
let albumFetchResult = await mgr.getAlbums(userFileManager.AlbumType.SYSTEM, userFileManager.AlbumSubtype.FAVORITE, fetchOp);
let album = await albumFetchResult.getFirstObject();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.orderByAsc("add_modified");
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let photoFetchResult = await album.getPhotoAssets(fetchOptions);
let expectIndex = 1;
//Obtain the uri of the second file
let photoAsset = await photoFetchResult.getPositionObject(expectIndex);
mgr.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions, (err, index) => {
try {
if (err == undefined) {
console.info(`getPhotoIndex successfully and index is : ${index}`);
} else {
console.info(`getPhotoIndex failed;`);
}
} catch (error) {
console.info(`getPhotoIndex failed; error: ${error}`);
}
}
}
```
### getPhotoIndex<sup>10+</sup>
getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise&lt;number&gt;
Obtains the index of an image or video in an album. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| Promise&lt;number&gt;| Promise used to return the index obtained.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
console.info('getPhotoIndexDemo');
let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
let fetchOp = {
fetchColumns: [],
predicates: predicatesForGetAsset
};
//Obtain the uri of the album
let albumFetchResult = await mgr.getAlbums(userFileManager.AlbumType.SYSTEM, userFileManager.AlbumSubtype.FAVORITE, fetchOp);
let album = await albumFetchResult.getFirstObject();
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.orderByAsc("add_modified");
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let photoFetchResult = await album.getPhotoAssets(fetchOptions);
let expectIndex = 1;
//Obtain the uri of the second file
let photoAsset = await photoFetchResult.getPositionObject(expectIndex);
mgr.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions)
.then((index) => {
console.info(`getPhotoIndex successfully and index is : ${index}`);
}).catch((err) => {
console.info(`getPhotoIndex failed; error: ${err}`);
})
}
```
### release ### release
release(callback: AsyncCallback&lt;void&gt;): void release(callback: AsyncCallback&lt;void&gt;): void
...@@ -1684,7 +1829,7 @@ Provides APIs for encapsulating file asset attributes. ...@@ -1684,7 +1829,7 @@ Provides APIs for encapsulating file asset attributes.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ | | ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. | | uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| fileType | [FileType](#filetype) | Yes | No | Type of the file. | | fileType | [FileType](#filetype) | Yes | No | Type of the file. |
| displayName | string | Yes | Yes | File name, including the file name extension, to display. | | displayName | string | Yes | Yes | File name, including the file name extension, to display. |
...@@ -2350,6 +2495,282 @@ async function example() { ...@@ -2350,6 +2495,282 @@ async function example() {
} }
``` ```
### getExif<sup>10+</sup>
getExif(): Promise&lt;string&gt;
Obtains a JSON string consisting of the exchangeable image file format (EXIF) tags of this JPG image. This API uses a promise to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
| Promise&lt;string&gt; | Promise used to return the JSON string obtained.|
**Supported EXIF tags**
For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
| Key Value | Description |
| --------------------------------------- | ----------------- |
| BitsPerSample | Number of bits per pixel.|
| Orientation | Image orientation.|
| ImageLength | Image length.|
| ImageWidth | Image width.|
| GPSLatitude | GPS latitude of the image.|
| GPSLongitude | GPS longitude of the image.|
| GPSLatitudeRef | Longitude reference, for example, W or E.|
| GPSLongitudeRef | Latitude reference, for example, N or S.|
| DateTimeOriginal | Shooting time.|
| ExposureTime | Exposure time.|
| SceneType | Shooting scene type.|
| ISOSpeedRatings | ISO sensitivity or speed.|
| FNumber | f-number.|
| DateTime | Date and time when the image was last modified.|
| GPSTimeStamp | GPS timestamp.|
| GPSDateStamp | GPS date stamp.|
| ImageDescription | Image description.|
| Make | Camera vendor.|
| Model | Model.|
| PhotoMode | Photo mode.|
| SensitivityType | Sensitivity type.|
| StandardOutputSensitivity | Standard output sensitivity.|
| RecommendedExposureIndex | Recommended exposure index.|
| ApertureValue | Aperture value.|
| MeteringMode | Metering mode.|
| LightSource | Light source.|
| Flash | Flash status.|
| FocalLength | Focal length.|
| UserComment | User comment.|
| PixelXDimension | Pixel X dimension.|
| PixelYDimension | Pixel Y dimension.|
| WhiteBalance | White balance.|
| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
| ExposureBiasValue | Exposure compensation.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('getExifDemo');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [ 'all_exif', ImageVideoKey.USER_COMMENT],
predicates: predicates
};
let fetchResult = await mgr.getPhotoAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let exifMessage = await fileAsset.getExif();
let userCommentKey = 'UserComment';
let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
fetchResult.close();
} catch (err) {
console.error('getExifDemoCallback failed with error: ' + err);
}
}
```
### getExif<sup>10+</sup>
getExif(callback: AsyncCallback&lt;string&gt;): void
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
**System API**: This is a system API.
**Required permissions**: ohos.permission.READ_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the JSON string obtained.|
**Supported EXIF tags**
For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
| Key Value | Description |
| --------------------------------------- | ----------------- |
| BitsPerSample | Number of bits per pixel.|
| Orientation | Image orientation.|
| ImageLength | Image length.|
| ImageWidth | Image width.|
| GPSLatitude | GPS latitude of the image.|
| GPSLongitude | GPS longitude of the image.|
| GPSLatitudeRef | Longitude reference, for example, W or E.|
| GPSLongitudeRef | Latitude reference, for example, N or S.|
| DateTimeOriginal | Shooting time.|
| ExposureTime | Exposure time.|
| SceneType | Shooting scene type.|
| ISOSpeedRatings | ISO sensitivity or speed.|
| FNumber | f-number.|
| DateTime | Date and time when the image was last modified.|
| GPSTimeStamp | GPS timestamp.|
| GPSDateStamp | GPS date stamp.|
| ImageDescription | Image description.|
| Make | Camera vendor.|
| Model | Model.|
| PhotoMode | Photo mode.|
| SensitivityType | Sensitivity type.|
| StandardOutputSensitivity | Standard output sensitivity.|
| RecommendedExposureIndex | Recommended exposure index.|
| ApertureValue | Aperture value.|
| MeteringMode | Metering mode.|
| LightSource | Light source.|
| Flash | Flash status.|
| FocalLength | Focal length.|
| UserComment | User comment.|
| PixelXDimension | Pixel X dimension.|
| PixelYDimension | Pixel Y dimension.|
| WhiteBalance | White balance.|
| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
| ExposureBiasValue | Exposure compensation.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('getExifDemo');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [ 'all_exif', ImageVideoKey.USER_COMMENT],
predicates: predicates
};
let fetchResult = await mgr.getPhotoAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userCommentKey = 'UserComment';
fileAsset.getExif((err, exifMessage) => {
if (exifMessage != undefined) {
let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
} else {
console.error('getExif failed, message = ', err);
}
});
fetchResult.close();
} catch (err) {
console.error('getExifDemoCallback failed with error: ' + err);
}
}
```
### setUserComment<sup>10+</sup>
setUserComment(userComment: string): Promise&lt;void&gt;
Sets user comment information of an image or video. This API uses a promise to return the result.
**NOTE**<br>This API can be used to modify the comment information of only images or videos.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
|Promise&lt;void&gt; | Promise that returns no value.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setUserCommentDemo')
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let fetchResult = await mgr.getPhotoAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userComment = 'test_set_user_comment';
await fileAsset.setUserComment(userComment);
} catch (err) {
console.error('setUserCommentDemoCallback failed with error: ' + err);
}
}
```
### setUserComment<sup>10+</sup>
setUserComment(userComment: string, callback: AsyncCallback&lt;void&gt;): void
Sets user comment information of an image or video. This API uses an asynchronous callback to return the result.
**NOTE**<br>This API can be used to modify the comment information of only images or videos.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.UserFileManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setUserCommentDemo')
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions = {
fetchColumns: [],
predicates: predicates
};
let fetchResult = await mgr.getPhotoAssets(fetchOptions);
let fileAsset = await fetchResult.getFirstObject();
let userComment = 'test_set_user_comment';
fileAsset.setUserComment(userComment, (err) => {
if (err === undefined) {
console.info('setUserComment successfully');
} else {
console.error('setUserComment failed with error: ' + err);
}
});
} catch (err) {
console.error('setUserCommentDemoCallback failed with error: ' + err);
}
}
```
## FetchResult ## FetchResult
Provides APIs to manage the file retrieval result. Provides APIs to manage the file retrieval result.
...@@ -3962,6 +4383,7 @@ Defines the key information about an image or video file. ...@@ -3962,6 +4383,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED<sup>10+</sup> | date_trashed | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. | | DATE_TRASHED<sup>10+</sup> | date_trashed | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. |
| HIDDEN<sup>10+</sup> | hidden | Whether the file is hidden. | | HIDDEN<sup>10+</sup> | hidden | Whether the file is hidden. |
| CAMERA_SHOT_KEY<sup>10+</sup> | camera_shot_key | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) | | CAMERA_SHOT_KEY<sup>10+</sup> | camera_shot_key | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) |
| USER_COMMENT<sup>10+</sup> | user_comment | User comment information. |
## AlbumKey ## AlbumKey
......
...@@ -1054,7 +1054,7 @@ Checks whether the specified authentication capability is supported. ...@@ -1054,7 +1054,7 @@ Checks whether the specified authentication capability is supported.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | -------------------------- | | -------------- | ---------------------------------- | ---- | -------------------------- |
| authType | [UserAuthType](#userauthtype8) | Yes | Authentication type. Only **FACE** is supported.| | authType | [UserAuthType](#userauthtype8) | Yes | Authentication type.|
| authTrustLevel | [AuthTrustLevel](#authtrustlevel8) | Yes | Authentication trust level. | | authTrustLevel | [AuthTrustLevel](#authtrustlevel8) | Yes | Authentication trust level. |
**Error codes** **Error codes**
......
# Account Subsystem Changelog
## cl.account_os_account.1 Deletion of App Account Authorization Interfaces
**Change Impact**
Apps developed based on earlier versions cannot use the account authorization capability.
**Key API/Component Changes**
Involved interfaces:
interface/sdk-js/api/@ohos.account.appAccount.d.ts:
```js
enum AccountCapabilityType
```
```js
class AccountCapabilityProvider
```
```js
class AuthorizationProvider extends AccountCapabilityProvider
```
```js
interface AuthorizationProviderInfo
```
```js
class AccountCapabilityRequest
```
```js
class AccountCapabilityResponse
```
```js
class AccountCapabilityScheduler
```
interface/sdk-js/api/@ohos.account.appAccount.AuthorizationExtensionAbility.d.ts:
```js
export default class AuthorizationExtensionAbility extends ExtensionAbility
```
```js
declare interface AuthorizationRequest
```
```js
declare interface AuthorizationCallback
```
After change:
All the involved interfaces are deleted.
**Adaptation Guide**
The deleted interfaces cannot be used any longer. Delete the corresponding functions accordingly.
...@@ -6,11 +6,11 @@ Deprecated **X509Cert.getSerialNumber()** and replaced it with **X509Cert.getCer ...@@ -6,11 +6,11 @@ Deprecated **X509Cert.getSerialNumber()** and replaced it with **X509Cert.getCer
**Change Impact** **Change Impact**
**X509Cert.getSerialNumber()** is deprecated since API version 10. **X509Cert.getCertSerialNumber()** should be used to replace **X509Cert.getSerialNumber()** in application development. The API function remains unchanged. Since API version 10, use **X509Cert.getCertSerialNumber()** instead of **X509Cert.getSerialNumber()** in application development. The API function remains unchanged.
**Key API/Component Changes** **Key API/Component Changes**
API before change: Before change:
```js ```js
interface X509Cert { interface X509Cert {
...@@ -20,7 +20,7 @@ interface X509Cert { ...@@ -20,7 +20,7 @@ interface X509Cert {
} }
``` ```
API after change: After change:
```js ```js
interface X509Cert { interface X509Cert {
......
# Wi-Fi Subsystem Changelog
## 1 Permission Change
1. The location permission is not required if a random MAC is returned.
1. The GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned.
| API| Permission|
| -------- | ---------------------------- |
|**function** getCandidateConfigs(): Array<WifiDeviceConfig>; | 1. The location permission is not required.|
|**function** getDeviceConfigs(): Array<WifiDeviceConfig>; | 1. The location permission is not required.|
|**function** getStations(): Array<StationInfo>; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** getCurrentP2pGroup(): Promise<WifiP2pGroupInfo>; | 1. The location permission is not required.|
| **function** getCurrentP2pGroup(callback: AsyncCallback<WifiP2pGroupInfo>): **void**; | 1. The location permission is not required.|
| **function** getP2pPeerDevices(): Promise<WifiP2pDevice[]>; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** p2pConnect(config: WifiP2PConfig): **void**; | 1. The location permission is not required.|
| **function** startDiscoverDevices(): **void**; | 1. The location permission is not required.|
| **function** getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>; | 1. The location permission is not required.|
| **function** getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): **void**; | 1. The location permission is not required.|
| **function** on(**type**: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** off(**type**: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** on(**type**: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** off(**type**: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
## 2 Added APIs
| API| Description|
|------|---------|
| **function** startScan(): **void**; | Starts a scan.|
| **function** getScanInfoList(): Array<WifiScanInfo>; | Obtains the scan list. |
| **function** setScanAlwaysAllowed(isScanAlwaysAllowed: boolean): **void**; | Sets whether to always allow Wi-Fi scanning. |
| **function** getScanAlwaysAllowed(): boolean; | Obtains the Wi-Fi scan settings on the background. |
| **function** getIpv6Info(): Ipv6Info; | Obtains IPv6 address information. |
| **function** isBandTypeSupported(bandType: WifiBandType): boolean; | Checks whether BandType is supported.|
| **function** get5GChannelList(): Array<**number**>; | Obtains the 5G channel list. |
| **function** getDisconnectedReason(): DisconnectedReason; | Obtains the reason for network disconnection. |
## 3 Deprecated APIs
| API |Description |
| ------------- |-------------------------------------------------------- |
| **function** scan(): **void**; | Use **startScan** instead.|
| **function** getScanResults(): Promise<Array<WifiScanInfo>>; | Use **getScanInfoList** instead.|
| **function** getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): **void**; | Use **getScanInfoList** instead.|
| **function** getScanResultsSync(): Array<WifiScanInfo>; | Use **getScanInfoList** instead.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册