• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.file.photoAccessHelper (Album Management) (System API)
2<!--Kit: Media Library Kit-->
3<!--Subsystem: Multimedia-->
4<!--Owner: @yixiaoff-->
5<!--SE: @liweilu1-->
6<!--TSE: @xchaosioda-->
7
8The module provides APIs for album management, including creating an album and accessing and modifying media data in an album.
9
10> **NOTE**
11>
12> - 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.
13> - This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper.md).
14
15## Modules to Import
16
17```ts
18import { photoAccessHelper } from '@kit.MediaLibraryKit';
19```
20## photoAccessHelper.getPhotoAccessHelper<sup>19+</sup>
21
22getPhotoAccessHelper(context: Context, userId: number): PhotoAccessHelper
23
24Obtains a PhotoAccessHelper instance for the specified user, letting you access and modify media files in an album.
25
26​**Model restriction**: This API can be used only in the stage model.
27
28**System API**: This is a system API.
29
30**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
31
32**Parameters**
33
34| Name | Type   | Mandatory| Description                      |
35| ------- | ------- | ---- | -------------------------- |
36| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
37| userId | number | Yes  | ID of the user.|
38
39**Return value**
40
41| Type                           | Description   |
42| ----------------------------- | :---- |
43| [PhotoAccessHelper](#photoaccesshelper) | PhotoAccessHelper instance obtained.|
44
45**Error codes**
46
47For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
48
49| ID| Error Message|
50| -------- | ---------------------------------------- |
51| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
52
53**Example**
54
55```ts
56// The phAccessHelper instance obtained is a global object. It is used by default in subsequent operations. If the code snippet is not added, an error will be reported indicating that phAccessHelper is not defined.
57// Obtain the context from the component and ensure that the return value of this.getUiContext().getHostContext() is UIAbilityContext.
58import { common } from '@kit.AbilityKit';
59
60@Entry
61@Component
62struct Index {
63  build() {
64    Row() {
65      Button("example").onClick(async () => {
66        let context: Context = this.getUIContext().getHostContext() as common.UIAbilityContext;
67        // 101 indicates the user ID of another user space.
68        let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context, 101);
69      }).width('100%')
70    }
71    .height('90%')
72  }
73}
74```
7576## PhotoAccessHelper
77
78### createAsset
79
80createAsset(displayName: string, callback: AsyncCallback&lt;PhotoAsset&gt;): void
81
82Creates an image or video asset with the specified file name. This API uses an asynchronous callback to return the result.
83
84The file name must comply with the following specifications:
85- The file name consists of a valid file name and an image or video file name extension.
86- The file name cannot exceed 255 characters.
87- The file name cannot contain any of the following characters:<br>API version 18 and later: \ / : * ? " < > | <br>API versions 10 to 17: . .. \ / : * ? " ' ` < > | { } [ ]
88
89**System API**: This is a system API.
90
91**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
92
93**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
94
95**Parameters**
96
97| Name  | Type                    | Mandatory| Description                     |
98| -------- | ------------------------ | ---- | ------------------------- |
99| displayName  | string        | Yes  | File name of the image or video to create.             |
100| callback |  AsyncCallback&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Callback used to return the image or video created.|
101
102**Error codes**
103
104For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
105
106If error code 14000001 is returned, refer to [PhotoKeys](#photokeys) to learn about the format and length requirements of the file name.
107
108If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
109
110| ID| Error Message|
111| -------- | ---------------------------------------- |
112| 202   |  Called by non-system application.         |
113| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
114| 13900012     | Permission denied.         |
115| 13900020     | Invalid argument.         |
116| 14000001      | Invalid display name.         |
117| 14000011       | System inner fail.         |
118
119**Example**
120
121For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
122
123```ts
124async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
125  console.info('createAssetDemo');
126  let testFileName: string = 'testFile' + Date.now() + '.jpg';
127  phAccessHelper.createAsset(testFileName, (err, photoAsset) => {
128    if (photoAsset !== undefined) {
129      console.info('createAsset file displayName' + photoAsset.displayName);
130      console.info('createAsset successfully');
131    } else {
132      console.error(`createAsset failed, error: ${err.code}, ${err.message}`);
133    }
134  });
135}
136```
137
138### createAsset
139
140createAsset(displayName: string): Promise&lt;PhotoAsset&gt;
141
142Creates an image or video asset with the specified file name. This API uses a promise to return the result.
143
144The file name must comply with the following specifications:
145- The file name consists of a valid file name and an image or video file name extension.
146- The file name cannot exceed 255 characters.
147- The file name cannot contain any of the following characters:<br>API version 18 and later: \ / : * ? " < > | <br>API versions 10 to 17: . .. \ / : * ? " ' ` < > | { } [ ]
148
149**System API**: This is a system API.
150
151**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
152
153**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
154
155**Parameters**
156
157| Name  | Type                    | Mandatory| Description                     |
158| -------- | ------------------------ | ---- | ------------------------- |
159| displayName  | string        | Yes  | File name of the image or video to create.             |
160
161**Return value**
162
163| Type                       | Description          |
164| --------------------------- | -------------- |
165| Promise&lt;[PhotoAsset](#photoasset)&gt; | Promise used to return the created image and video asset.|
166
167**Error codes**
168
169For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
170
171If error code 14000001 is returned, refer to [PhotoKeys](#photokeys) to learn about the format and length requirements of the file name.
172
173If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
174
175| ID| Error Message|
176| -------- | ---------------------------------------- |
177| 202   |  Called by non-system application.         |
178| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
179| 13900012     | Permission denied.         |
180| 13900020     | Invalid argument.         |
181| 14000001      | Invalid display name.         |
182| 14000011       | System inner fail.         |
183
184**Example**
185
186For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
187
188```ts
189async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
190  console.info('createAssetDemo');
191  try {
192    let testFileName: string = 'testFile' + Date.now() + '.jpg';
193    let photoAsset: photoAccessHelper.PhotoAsset = await phAccessHelper.createAsset(testFileName);
194    console.info('createAsset file displayName' + photoAsset.displayName);
195    console.info('createAsset successfully');
196  } catch (err) {
197    console.error(`createAsset failed, error: ${err.code}, ${err.message}`);
198  }
199}
200```
201
202### createAsset
203
204createAsset(displayName: string, options: PhotoCreateOptions, callback: AsyncCallback&lt;PhotoAsset&gt;): void
205
206Creates an image or video asset with the specified file name and options. This API uses an asynchronous callback to return the result.
207
208The file name must comply with the following specifications:
209- The file name consists of a valid file name and an image or video file name extension.
210- The file name cannot exceed 255 characters.
211- The file name cannot contain any of the following characters:<br>API version 18 and later: \ / : * ? " < > | <br>API versions 10 to 17: . .. \ / : * ? " ' ` < > | { } [ ]
212
213**System API**: This is a system API.
214
215**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
216
217**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
218
219**Parameters**
220
221| Name  | Type                    | Mandatory| Description                     |
222| -------- | ------------------------ | ---- | ------------------------- |
223| displayName  | string        | Yes  | File name of the image or video to create.             |
224| options  | [PhotoCreateOptions](#photocreateoptions)        | Yes  | Options for creating an image or video asset.             |
225| callback |  AsyncCallback&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Callback used to return the image or video created.|
226
227**Error codes**
228
229For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
230
231If error code 14000001 is returned, refer to [PhotoKeys](#photokeys) to learn about the format and length requirements of the file name.
232
233If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
234
235| ID| Error Message|
236| -------- | ---------------------------------------- |
237| 202   |  Called by non-system application.         |
238| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
239| 13900012     | Permission denied.         |
240| 13900020     | Invalid argument.         |
241| 14000001      | Invalid display name.         |
242| 14000011       | System inner fail.         |
243
244**Example**
245
246For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
247
248```ts
249async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
250  console.info('createAssetDemo');
251  let testFileName: string = 'testFile' + Date.now() + '.jpg';
252  let createOption: photoAccessHelper.PhotoCreateOptions = {
253    subtype: photoAccessHelper.PhotoSubtype.DEFAULT
254  }
255  phAccessHelper.createAsset(testFileName, createOption, (err, photoAsset) => {
256    if (photoAsset !== undefined) {
257      console.info('createAsset file displayName' + photoAsset.displayName);
258      console.info('createAsset successfully');
259    } else {
260      console.error(`createAsset failed, error: ${err.code}, ${err.message}`);
261    }
262  });
263}
264```
265
266### createAsset
267
268createAsset(displayName: string, options: PhotoCreateOptions): Promise&lt;PhotoAsset&gt;
269
270Creates an image or video asset with the specified file name and options. This API uses a promise to return the result.
271
272The file name must comply with the following specifications:
273- The file name consists of a valid file name and an image or video file name extension.
274- The file name cannot exceed 255 characters.
275- The file name cannot contain any of the following characters:<br>API version 18 and later: \ / : * ? " < > | <br>API versions 10 to 17: . .. \ / : * ? " ' ` < > | { } [ ]
276
277**System API**: This is a system API.
278
279**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
280
281**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
282
283**Parameters**
284
285| Name  | Type                    | Mandatory| Description                     |
286| -------- | ------------------------ | ---- | ------------------------- |
287| displayName  | string        | Yes  | File name of the image or video to create.             |
288| options  |  [PhotoCreateOptions](#photocreateoptions)       | Yes  | Options for creating an image or video asset.             |
289
290**Return value**
291
292| Type                       | Description          |
293| --------------------------- | -------------- |
294| Promise&lt;[PhotoAsset](#photoasset)&gt; | Promise used to return the created image and video asset.|
295
296**Error codes**
297
298For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
299
300If error code 14000001 is returned, refer to [PhotoKeys](#photokeys) to learn about the format and length requirements of the file name.
301
302If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
303
304| ID| Error Message|
305| -------- | ---------------------------------------- |
306| 202   |  Called by non-system application.         |
307| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
308| 13900012     | Permission denied.         |
309| 13900020     | Invalid argument.         |
310| 14000001      | Invalid display name.         |
311| 14000011       | System inner fail.         |
312
313**Example**
314
315For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
316
317```ts
318async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
319  console.info('createAssetDemo');
320  try {
321    let testFileName:string = 'testFile' + Date.now() + '.jpg';
322    let createOption: photoAccessHelper.PhotoCreateOptions = {
323      subtype: photoAccessHelper.PhotoSubtype.DEFAULT
324    }
325    let photoAsset: photoAccessHelper.PhotoAsset = await phAccessHelper.createAsset(testFileName, createOption);
326    console.info('createAsset file displayName' + photoAsset.displayName);
327    console.info('createAsset successfully');
328  } catch (err) {
329    console.error(`createAsset failed, error: ${err.code}, ${err.message}`);
330  }
331}
332```
333
334### createAlbum<sup>(deprecated)</sup>
335
336createAlbum(name: string, callback: AsyncCallback&lt;Album&gt;): void
337
338Creates an album. This API uses an asynchronous callback to return the result.
339
340The album name must meet the following requirements:
341- The album name cannot exceed 255 characters.
342- The album name cannot contain any of the following characters:<br> . .. \ / : * ? " ' ` < > | { } [ ]
343- Duplicate album names are not allowed.
344
345> **NOTE**
346>
347> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.createAlbumRequest](#createalbumrequest11) instead.
348
349**System API**: This is a system API.
350
351**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
352
353**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
354
355**Parameters**
356
357| Name  | Type                    | Mandatory| Description                     |
358| -------- | ------------------------ | ---- | ------------------------- |
359| name  | string         | Yes  | Name of the album to create.             |
360| callback |  AsyncCallback&lt;[Album](#album)&gt; | Yes  | Callback used to return the created album instance.|
361
362**Error codes**
363
364For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
365
366If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
367
368| ID| Error Message|
369| -------- | ---------------------------------------- |
370| 202   |  Called by non-system application.         |
371| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
372| 13900012     | Permission denied.         |
373| 13900015       |  The file name already exists.         |
374| 13900020     | Invalid argument.         |
375| 14000011       | System inner fail.         |
376
377**Example**
378
379For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
380
381```ts
382async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
383  console.info('createAlbumDemo');
384  let albumName: string = 'newAlbumName' + new Date().getTime();
385  phAccessHelper.createAlbum(albumName, (err, album) => {
386    if (err) {
387      console.error(`createAlbumCallback failed with err: ${err.code}, ${err.message}`);
388      return;
389    }
390    console.info('createAlbumCallback successfully, album: ' + album.albumName + ' album uri: ' + album.albumUri);
391  });
392}
393```
394
395### createAlbum<sup>(deprecated)</sup>
396
397createAlbum(name: string): Promise&lt;Album&gt;
398
399Creates an album. This API uses a promise to return the result.
400
401The album name must meet the following requirements:
402- The album name cannot exceed 255 characters.
403- The album name cannot contain any of the following characters:<br> . .. \ / : * ? " ' ` < > | { } [ ]
404- Duplicate album names are not allowed.
405
406> **NOTE**
407>
408> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.createAlbumRequest](#createalbumrequest11) instead.
409
410**System API**: This is a system API.
411
412**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
413
414**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
415
416**Parameters**
417
418| Name  | Type                    | Mandatory| Description                     |
419| -------- | ------------------------ | ---- | ------------------------- |
420| name  | string         | Yes  | Name of the album to create.             |
421
422**Return value**
423
424| Type                       | Description          |
425| --------------------------- | -------------- |
426| Promise&lt;[Album](#album)&gt; | Promise used to return the created album instance.|
427
428**Error codes**
429
430For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
431
432If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
433
434| ID| Error Message|
435| -------- | ---------------------------------------- |
436| 202   |  Called by non-system application.         |
437| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
438| 13900012     | Permission denied.         |
439| 13900015       |  The file name already exists.         |
440| 13900020     | Invalid argument.         |
441| 14000011       | System inner fail.         |
442
443**Example**
444
445For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
446
447```ts
448import { BusinessError } from '@kit.BasicServicesKit';
449
450async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
451  console.info('createAlbumDemo');
452  let albumName: string = 'newAlbumName' + new Date().getTime();
453  phAccessHelper.createAlbum(albumName).then((album) => {
454    console.info('createAlbumPromise successfully, album: ' + album.albumName + ' album uri: ' + album.albumUri);
455  }).catch((err: BusinessError) => {
456    console.error(`createAlbumPromise failed with err: ${err.code}, ${err.message}`);
457  });
458}
459```
460
461### deleteAlbums<sup>(deprecated)</sup>
462
463deleteAlbums(albums: Array&lt;Album&gt;, callback: AsyncCallback&lt;void&gt;): void
464
465Deletes albums. This API uses an asynchronous callback to return the result.
466
467Ensure that the albums to be deleted exist. Only user albums can be deleted.
468
469> **NOTE**
470>
471> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.deleteAlbums](#deletealbums11) instead.
472
473**System API**: This is a system API.
474
475**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
476
477**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
478
479**Parameters**
480
481| Name  | Type                    | Mandatory| Description                     |
482| -------- | ------------------------ | ---- | ------------------------- |
483| albums  | Array&lt;[Album](#album)&gt;         | Yes  | Albums to delete.             |
484| callback |  AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
485
486**Error codes**
487
488For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
489
490If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
491
492| ID| Error Message|
493| -------- | ---------------------------------------- |
494| 202   |  Called by non-system application.         |
495| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
496| 13900012     | Permission denied.         |
497| 13900020     | Invalid argument.         |
498| 14000011       | System inner fail.         |
499
500**Example**
501
502For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
503
504```ts
505import { dataSharePredicates } from '@kit.ArkData';
506
507async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
508  // Delete the album named newAlbumName.
509  console.info('deleteAlbumsDemo');
510  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
511  predicates.equalTo('album_name', 'newAlbumName');
512  let fetchOptions: photoAccessHelper.FetchOptions = {
513    fetchColumns: [],
514    predicates: predicates
515  };
516  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, fetchOptions);
517  let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
518  phAccessHelper.deleteAlbums([album], (err) => {
519    if (err) {
520      console.error(`deletePhotoAlbumsCallback failed with err: ${err.code}, ${err.message}`);
521      return;
522    }
523    console.info('deletePhotoAlbumsCallback successfully');
524  });
525  fetchResult.close();
526}
527```
528
529### deleteAlbums<sup>(deprecated)</sup>
530
531deleteAlbums(albums: Array&lt;Album&gt;): Promise&lt;void&gt;
532
533Deletes albums. This API uses a promise to return the result.
534
535Ensure that the albums to be deleted exist. Only user albums can be deleted.
536
537> **NOTE**
538>
539> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.deleteAlbums](#deletealbums11) instead.
540
541**System API**: This is a system API.
542
543**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
544
545**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
546
547**Parameters**
548
549| Name  | Type                    | Mandatory| Description                     |
550| -------- | ------------------------ | ---- | ------------------------- |
551| albums  |  Array&lt;[Album](#album)&gt;          | Yes  | Albums to delete.             |
552
553**Return value**
554
555| Type                       | Description          |
556| --------------------------- | -------------- |
557| Promise&lt;void&gt; | Promise that returns no value.|
558
559**Error codes**
560
561For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
562
563If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
564
565| ID| Error Message|
566| -------- | ---------------------------------------- |
567| 202   |  Called by non-system application.         |
568| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
569| 13900012     | Permission denied.         |
570| 13900020     | Invalid argument.         |
571| 14000011       | System inner fail.         |
572
573**Example**
574
575For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
576
577```ts
578import { dataSharePredicates } from '@kit.ArkData';
579import { BusinessError } from '@kit.BasicServicesKit';
580
581async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
582  // Delete the album named newAlbumName.
583  console.info('deleteAlbumsDemo');
584  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
585  predicates.equalTo('album_name', 'newAlbumName');
586  let fetchOptions: photoAccessHelper.FetchOptions = {
587    fetchColumns: [],
588    predicates: predicates
589  };
590  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, fetchOptions);
591  let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
592  phAccessHelper.deleteAlbums([album]).then(() => {
593    console.info('deletePhotoAlbumsPromise successfully');
594    }).catch((err: BusinessError) => {
595      console.error(`deletePhotoAlbumsPromise failed with err: ${err.code}, ${err.message}`);
596  });
597  fetchResult.close();
598}
599```
600
601### getHiddenAlbums<sup>11+</sup>
602
603getHiddenAlbums(mode: HiddenPhotosDisplayMode, options: FetchOptions, callback: AsyncCallback&lt;FetchResult&lt;Album&gt;&gt;): void
604
605Obtains hidden albums based on the specified display mode and retrieval options. This API uses an asynchronous callback to return the result.
606
607**System API**: This is a system API.
608
609**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
610
611**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
612
613**Parameters**
614
615| Name  | Type                    | Mandatory| Description                     |
616| -------- | ------------------------ | ---- | ------------------------- |
617| mode  | [HiddenPhotosDisplayMode](#hiddenphotosdisplaymode11)         | Yes  | Display mode of hidden albums. |
618| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)         | Yes  |  Retrieval options. |
619| callback |  AsyncCallback&lt;[FetchResult](arkts-apis-photoAccessHelper-FetchResult.md)&lt;[Album](#album)&gt;&gt; | Yes  |  Callback used to return the result.|
620
621**Error codes**
622
623For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
624
625| ID| Error Message|
626| -------- | ---------------------------------------- |
627| 201      |  Permission verification failed, usually the result returned by VerifyAccessToken.         |
628| 202      |  Permission verification failed, application which is not a system application uses system API.         |
629| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
630| 14000011       | System inner fail.         |
631
632**Example**
633
634For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
635
636```ts
637import { dataSharePredicates } from '@kit.ArkData';
638
639// Obtain the album newAlbumName that contains hidden files.
640async function getHiddenAlbumsView(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
641  console.info('getHiddenAlbumsViewDemo');
642  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
643  predicates.equalTo('album_name', 'newAlbumName');
644  let fetchOptions: photoAccessHelper.FetchOptions = {
645    fetchColumns: [],
646    predicates: predicates
647  };
648  phAccessHelper.getHiddenAlbums(photoAccessHelper.HiddenPhotosDisplayMode.ALBUMS_MODE, fetchOptions,
649    async (err, fetchResult) => {
650      if (err !== undefined) {
651        console.error(`getHiddenAlbumsViewCallback failed with error: ${err.code}, ${err.message}`);
652        return;
653      }
654      if (fetchResult === undefined) {
655        console.error('getHiddenAlbumsViewCallback fetchResult is undefined');
656        return;
657      }
658      let album = await fetchResult.getFirstObject();
659      if (album === undefined) {
660        console.error('getHiddenAlbumsViewCallback album is undefined');
661        fetchResult.close();
662        return;
663      }
664      console.info('getHiddenAlbumsViewCallback successfully, album name: ' + album.albumName);
665      fetchResult.close();
666  });
667}
668```
669
670### getHiddenAlbums<sup>11+</sup>
671
672getHiddenAlbums(mode: HiddenPhotosDisplayMode, callback: AsyncCallback&lt;FetchResult&lt;Album&gt;&gt;): void
673
674Obtains hidden albums based on the specified display mode. This API uses an asynchronous callback to return the result.
675
676**System API**: This is a system API.
677
678**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
679
680**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
681
682**Parameters**
683
684| Name  | Type                    | Mandatory| Description                     |
685| -------- | ------------------------ | ---- | ------------------------- |
686| mode  | [HiddenPhotosDisplayMode](#hiddenphotosdisplaymode11)         | Yes  | Display mode of hidden albums. |
687| callback |  AsyncCallback&lt;[FetchResult](arkts-apis-photoAccessHelper-FetchResult.md)&lt;[Album](#album)&gt;&gt; | Yes  | Callback used to return the result.|
688
689**Error codes**
690
691For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
692
693| ID| Error Message|
694| -------- | ---------------------------------------- |
695| 201      |  Permission verification failed, usually the result returned by VerifyAccessToken.         |
696| 202      |  Permission verification failed, application which is not a system application uses system API.         |
697| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
698| 14000011       | System inner fail.         |
699
700**Example**
701
702For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
703
704```ts
705import { dataSharePredicates } from '@kit.ArkData';
706
707// Obtain the preset hidden album.
708async function getSysHiddenAlbum(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
709  console.info('getSysHiddenAlbumDemo');
710  phAccessHelper.getHiddenAlbums(photoAccessHelper.HiddenPhotosDisplayMode.ASSETS_MODE, async (err, fetchResult) => {
711    if (fetchResult === undefined) {
712      console.error('getSysHiddenAlbumCallback fetchResult is undefined');
713      return;
714    }
715    let hiddenAlbum: photoAccessHelper.Album = await fetchResult.getFirstObject();
716    if (hiddenAlbum === undefined) {
717      console.error('getSysHiddenAlbumCallback hiddenAlbum is undefined');
718      fetchResult.close();
719      return;
720    }
721    console.info('getSysHiddenAlbumCallback successfully, albumUri: ' + hiddenAlbum.albumUri);
722    fetchResult.close();
723  });
724}
725
726// Obtain the hidden albums displayed by album, that is, the albums with hidden files. Such albums do not include the preset hidden album and the albums in the trash.
727async function getHiddenAlbumsView(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
728  console.info('getHiddenAlbumsViewDemo');
729  phAccessHelper.getHiddenAlbums(photoAccessHelper.HiddenPhotosDisplayMode.ALBUMS_MODE, async (err, fetchResult) => {
730    if (fetchResult === undefined) {
731      console.error('getHiddenAlbumsViewCallback fetchResult is undefined');
732      return;
733    }
734    let albums: Array<photoAccessHelper.Album> = await fetchResult.getAllObjects();
735    if (albums === undefined) {
736      console.error('getHiddenAlbumsViewCallback albums is undefined');
737      fetchResult.close();
738      return;
739    }
740    console.info('getHiddenAlbumsViewCallback successfully, albums size: ' + albums.length);
741
742    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
743    let fetchOption: photoAccessHelper.FetchOptions = {
744      fetchColumns: [],
745      predicates: predicates
746    };
747    for (let i = 0; i < albums.length; i++) {
748      // Obtain hidden files in the album.
749      albums[i].getAssets(fetchOption, (err, assetFetchResult) => {
750        if (assetFetchResult === undefined) {
751          console.error('getHiddenAlbumsViewCallback assetFetchResult is undefined');
752          return;
753        }
754        console.info('album get hidden assets successfully, getCount: ' + assetFetchResult.getCount());
755      });
756    }
757    fetchResult.close();
758  });
759}
760```
761
762### getHiddenAlbums<sup>11+</sup>
763
764getHiddenAlbums(mode: HiddenPhotosDisplayMode, options?: FetchOptions): Promise&lt;FetchResult&lt;Album&gt;&gt;
765
766Obtains hidden albums based on the specified display mode and retrieval options. This API uses a promise to return the result.
767
768**System API**: This is a system API.
769
770**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
771
772**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
773
774**Parameters**
775
776| Name  | Type                    | Mandatory| Description                     |
777| -------- | ------------------------ | ---- | ------------------------- |
778| mode  | [HiddenPhotosDisplayMode](#hiddenphotosdisplaymode11)         | Yes  | Display mode of hidden albums. |
779| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)         | No  |  Options for retrieving the files. If this parameter is not specified, the files are retrieved based on the display mode of hidden files.     |
780
781**Return value**
782
783| Type                       | Description          |
784| --------------------------- | -------------- |
785| Promise&lt;[FetchResult](arkts-apis-photoAccessHelper-FetchResult.md)&lt;[Album](#album)&gt;&gt; | Promise used to return the result.
786
787**Error codes**
788
789For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
790
791| ID| Error Message|
792| -------- | ---------------------------------------- |
793| 201      |  Permission verification failed, usually the result returned by VerifyAccessToken.         |
794| 202      |  Permission verification failed, application which is not a system application uses system API.         |
795| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
796| 14000011       | System inner fail.         |
797
798**Example**
799
800For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
801
802```ts
803import { dataSharePredicates } from '@kit.ArkData';
804import { BusinessError } from '@kit.BasicServicesKit';
805
806// Obtain the preset hidden album.
807async function getSysHiddenAlbum(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
808  console.info('getSysHiddenAlbumDemo');
809  phAccessHelper.getHiddenAlbums(photoAccessHelper.HiddenPhotosDisplayMode.ASSETS_MODE)
810    .then( async (fetchResult) => {
811      if (fetchResult === undefined) {
812        console.error('getSysHiddenAlbumPromise fetchResult is undefined');
813        return;
814      }
815      let hiddenAlbum: photoAccessHelper.Album = await fetchResult.getFirstObject();
816      console.info('getAlbumsPromise successfully, albumUri: ' + hiddenAlbum.albumUri);
817      fetchResult.close();
818    }).catch((err: BusinessError) => {
819      console.error(`getSysHiddenAlbumPromise failed with err: ${err.code}, ${err.message}`);
820    });
821}
822
823// Obtain the hidden albums displayed by album, that is, the albums with hidden files. Such albums do not include the preset hidden album and the albums in the trash.
824async function getHiddenAlbumsView(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
825  console.info('getHiddenAlbumsViewDemo');
826  phAccessHelper.getHiddenAlbums(photoAccessHelper.HiddenPhotosDisplayMode.ALBUMS_MODE).then( async (fetchResult) => {
827    if (fetchResult === undefined) {
828      console.error('getHiddenAlbumsViewPromise fetchResult is undefined');
829      return;
830    }
831    let albums: Array<photoAccessHelper.Album> = await fetchResult.getAllObjects();
832    console.info('getHiddenAlbumsViewPromise successfully, albums size: ' + albums.length);
833
834    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
835    let fetchOption: photoAccessHelper.FetchOptions = {
836      fetchColumns: [],
837      predicates: predicates
838    };
839    for (let i = 0; i < albums.length; i++) {
840      // Obtain hidden files in the album.
841      albums[i].getAssets(fetchOption).then((assetFetchResult) => {
842        console.info('album get hidden assets successfully, getCount: ' + assetFetchResult.getCount());
843      }).catch((err: BusinessError) => {
844        console.error(`album get hidden assets failed with error: ${err.code}, ${err.message}`);
845      });
846    }
847    fetchResult.close();
848  }).catch((err: BusinessError) => {
849    console.error(`getHiddenAlbumsViewPromise failed with err: ${err.code}, ${err.message}`);
850  });
851}
852```
853
854### deleteAssets<sup>(deprecated)</sup>
855
856deleteAssets(uriList: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
857
858Deletes media assets. This API uses an asynchronous callback to return the result. The deleted assets are moved to the trash.
859
860> **NOTE**
861>
862> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [MediaAssetChangeRequest.deleteAssets](arkts-apis-photoAccessHelper-MediaAssetChangeRequest.md#deleteassets11) instead.
863
864**System API**: This is a system API.
865
866**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
867
868**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
869
870**Parameters**
871
872| Name  | Type                     | Mandatory| Description      |
873| -------- | ------------------------- | ---- | ---------- |
874| uriList | Array&lt;string&gt; | Yes  | URIs of the media files to delete.|
875| callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
876
877**Error codes**
878
879For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
880
881If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
882
883| ID| Error Message|
884| -------- | ---------------------------------------- |
885| 202   |  Called by non-system application.         |
886| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
887| 13900012     | Permission denied.         |
888| 13900020     | Invalid argument.         |
889| 14000002 |  The uri format is incorrect or does not exist.         |
890| 14000011       | System inner fail.         |
891
892**Example**
893
894For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
895
896```ts
897import { dataSharePredicates } from '@kit.ArkData';
898
899async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
900  console.info('deleteAssetDemo');
901  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
902  let fetchOptions: photoAccessHelper.FetchOptions = {
903    fetchColumns: [],
904    predicates: predicates
905  };
906  try {
907    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
908    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
909    if (asset === undefined) {
910      console.error('asset not exist');
911      return;
912    }
913    phAccessHelper.deleteAssets([asset.uri], (err) => {
914      if (err === undefined) {
915        console.info('deleteAssets successfully');
916      } else {
917        console.error(`deleteAssets failed with error: ${err.code}, ${err.message}`);
918      }
919    });
920  } catch (err) {
921    console.error(`fetch failed, error: ${err.code}, ${err.message}`);
922  }
923}
924```
925
926### deleteAssets<sup>(deprecated)</sup>
927
928deleteAssets(uriList: Array&lt;string&gt;): Promise&lt;void&gt;
929
930Deletes media assets. This API uses a promise to return the result. The deleted assets are moved to the trash.
931
932> **NOTE**
933>
934> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [MediaAssetChangeRequest.deleteAssets](arkts-apis-photoAccessHelper-MediaAssetChangeRequest.md#deleteassets11) instead.
935
936**System API**: This is a system API.
937
938**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
939
940**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
941
942**Parameters**
943
944| Name  | Type                     | Mandatory| Description      |
945| -------- | ------------------------- | ---- | ---------- |
946| uriList | Array&lt;string&gt; | Yes  | URIs of the media files to delete.|
947
948**Return value**
949
950| Type                                   | Description             |
951| --------------------------------------- | ----------------- |
952| Promise&lt;void&gt;| Promise that returns no value.|
953
954**Error codes**
955
956For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
957
958If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
959
960| ID| Error Message|
961| -------- | ---------------------------------------- |
962| 202   |  Called by non-system application.         |
963| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
964| 13900012     | Permission denied.         |
965| 13900020     | Invalid argument.         |
966| 14000002 |  The uri format is incorrect or does not exist.         |
967| 14000011       | System inner fail.         |
968
969**Example**
970
971For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
972
973```ts
974import { dataSharePredicates } from '@kit.ArkData';
975
976async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
977  console.info('deleteDemo');
978  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
979  let fetchOptions: photoAccessHelper.FetchOptions = {
980    fetchColumns: [],
981    predicates: predicates
982  };
983  try {
984    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
985    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
986    if (asset === undefined) {
987      console.error('asset not exist');
988      return;
989    }
990    await phAccessHelper.deleteAssets([asset.uri]);
991    console.info('deleteAssets successfully');
992  } catch (err) {
993    console.error(`deleteAssets failed with error: ${err.code}, ${err.message}`);
994  }
995}
996```
997
998### getPhotoIndex
999
1000getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback&lt;number&gt;): void
1001
1002Obtains the index of an image or video in an album. This API uses an asynchronous callback to return the result.
1003
1004**System API**: This is a system API.
1005
1006**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1007
1008**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1009
1010**Parameters**
1011
1012| Name  | Type                     | Mandatory| Description      |
1013| -------- | ------------------------- | ---- | ---------- |
1014| photoUri | string | Yes  | URI of the media asset whose index is to be obtained.|
1015| 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.  |
1016| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)       | Yes  |  Retrieval options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search criteria or sorting modes are set, the API cannot be called successfully.     |
1017| callback | AsyncCallback&lt;number&gt;| Yes  | Callback used to return the index obtained.|
1018
1019**Error codes**
1020
1021For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1022
1023If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
1024
1025| ID| Error Message|
1026| -------- | ---------------------------------------- |
1027| 202     |  Called by non-system application.         |
1028| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1029| 13900012     | Permission denied.         |
1030| 13900020     | Invalid argument.         |
1031| 14000011       | System inner fail.         |
1032
1033**Example**
1034
1035For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1036
1037```ts
1038import { dataSharePredicates } from '@kit.ArkData';
1039
1040async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1041  try {
1042    console.info('getPhotoIndexDemo');
1043    let predicatesForGetAsset: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1044    let fetchOp: photoAccessHelper.FetchOptions = {
1045      fetchColumns: [],
1046      predicates: predicatesForGetAsset
1047    };
1048    // Obtain the uri of the album.
1049    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
1050    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
1051    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1052    predicates.orderByAsc(photoAccessHelper.PhotoKeys.DATE_MODIFIED);
1053    let fetchOptions: photoAccessHelper.FetchOptions = {
1054      fetchColumns: [photoAccessHelper.PhotoKeys.DATE_MODIFIED],
1055      predicates: predicates
1056    };
1057    let photoFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
1058    let expectIndex = 1;
1059    // Obtain the uri of the second file.
1060    let photoAsset: photoAccessHelper.PhotoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
1061
1062    phAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions, (err, index) => {
1063      if (err === undefined) {
1064        console.info(`getPhotoIndex successfully and index is : ${index}`);
1065      } else {
1066        console.error(`getPhotoIndex failed; error: ${err.code}, ${err.message}`);
1067      }
1068    });
1069  } catch (error) {
1070    console.error(`getPhotoIndex failed; error: ${error.code}, ${error.message}`);
1071  }
1072}
1073```
1074
1075### getPhotoIndex
1076
1077getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise&lt;number&gt;
1078
1079Obtains the index of an image or video in an album. This API uses a promise to return the result.
1080
1081**System API**: This is a system API.
1082
1083**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1084
1085**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1086
1087**Parameters**
1088
1089| Name  | Type                     | Mandatory| Description      |
1090| -------- | ------------------------- | ---- | ---------- |
1091| photoUri | string | Yes  | URI of the media asset whose index is to be obtained.|
1092| 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.  |
1093| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)       | Yes  |  Retrieval options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search criteria or sorting modes are set, the API cannot be called successfully.     |
1094
1095**Return value**
1096
1097| Type                                   | Description             |
1098| --------------------------------------- | ----------------- |
1099| Promise&lt;number&gt;| Promise used to return the index obtained.|
1100
1101**Error codes**
1102
1103For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1104
1105If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
1106
1107| ID| Error Message|
1108| -------- | ---------------------------------------- |
1109| 202     |  Called by non-system application.         |
1110| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1111| 13900012     | Permission denied.         |
1112| 13900020     | Invalid argument.         |
1113| 14000011       | System inner fail.         |
1114
1115**Example**
1116
1117For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1118
1119```ts
1120import { dataSharePredicates } from '@kit.ArkData';
1121import { BusinessError } from '@kit.BasicServicesKit';
1122
1123async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1124  try {
1125    console.info('getPhotoIndexDemo');
1126    let predicatesForGetAsset: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1127    let fetchOp: photoAccessHelper.FetchOptions = {
1128      fetchColumns: [],
1129      predicates: predicatesForGetAsset
1130    };
1131    // Obtain the uri of the album.
1132    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
1133    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
1134    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1135    predicates.orderByAsc(photoAccessHelper.PhotoKeys.DATE_MODIFIED);
1136    let fetchOptions: photoAccessHelper.FetchOptions = {
1137      fetchColumns: [photoAccessHelper.PhotoKeys.DATE_MODIFIED],
1138      predicates: predicates
1139    };
1140    let photoFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
1141    let expectIndex = 1;
1142    // Obtain the uri of the second file.
1143    let photoAsset: photoAccessHelper.PhotoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
1144    phAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions).then((index) => {
1145      console.info(`getPhotoIndex successfully and index is : ${index}`);
1146    }).catch((err: BusinessError) => {
1147      console.error(`getPhotoIndex failed; error: ${err.code}, ${err.message}`);
1148    });
1149  } catch (error) {
1150    console.error(`getPhotoIndex failed; error: ${error.code}, ${error.message}`);
1151  }
1152}
1153```
1154
1155### saveFormInfo<sup>11+</sup>
1156
1157saveFormInfo(info:FormInfo, callback: AsyncCallback&lt;void&gt;):void
1158
1159Saves a Gallery widget. This API uses an asynchronous callback to return the result.
1160
1161**System API**: This is a system API.
1162
1163**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1164
1165**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1166
1167**Parameters**
1168
1169| Name  | Type                    | Mandatory| Description                     |
1170| -------- | ------------------------ | ---- | ------------------------- |
1171| info  | [FormInfo](#forminfo11)        | Yes  | Information about the Gallery widget to save, which includes the ID of the widget and the URI of the image bound to the widget.             |
1172| callback |  AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
1173
1174**Error codes**
1175
1176For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1177
1178| ID| Error Message|
1179| -------- | ---------------------------------------- |
1180| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
1181| 202   | Permission verification failed, application which is not a system application uses system API.         |
1182| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1183| 14000011       | System inner fail.         |
1184
1185
1186**Example**
1187
1188For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1189
1190```ts
1191import { dataSharePredicates } from '@kit.ArkData';
1192import { BusinessError } from '@kit.BasicServicesKit';
1193
1194async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1195  console.info('saveFormInfoDemo');
1196  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1197  let fetchOptions: photoAccessHelper.FetchOptions = {
1198    fetchColumns: [],
1199    predicates: predicates
1200  };
1201  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
1202  let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
1203
1204  let info: photoAccessHelper.FormInfo = {
1205    // formId is a string consisting of only digits. uri indicates the URI of the image in Gallery. If there is no image in Gallery, uri must be an empty string.
1206    formId : "20230116123",
1207    uri: photoAsset.uri,
1208  }
1209
1210  phAccessHelper.saveFormInfo(info, async (err: BusinessError) => {
1211    if (err == undefined) {
1212      console.info('saveFormInfo success');
1213    } else {
1214      console.error(`saveFormInfo fail with error: ${err.code}, ${err.message}`);
1215    }
1216  });
1217}
1218```
1219
1220### saveFormInfo<sup>11+</sup>
1221
1222saveFormInfo(info:FormInfo):Promise&lt;void&gt;
1223
1224Saves a Gallery widget. This API uses a promise to return the result.
1225
1226**System API**: This is a system API.
1227
1228**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1229
1230**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1231
1232**Parameters**
1233
1234| Name  | Type                    | Mandatory| Description                     |
1235| -------- | ------------------------ | ---- | ------------------------- |
1236| info  | [FormInfo](#forminfo11)        | Yes  | Information about the Gallery widget to save, which includes the ID of the widget and the URI of the image bound to the widget.             |
1237
1238**Return value**
1239
1240| Type                                   | Description             |
1241| --------------------------------------- | ----------------- |
1242| Promise&lt;void&gt;| Promise that returns no value.|
1243
1244**Error codes**
1245
1246For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1247
1248| ID| Error Message|
1249| -------- | ---------------------------------------- |
1250| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
1251| 202   | Permission verification failed, application which is not a system application uses system API.         |
1252| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1253| 14000011       | System inner fail.         |
1254
1255**Example**
1256
1257For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1258
1259```ts
1260import { dataSharePredicates } from '@kit.ArkData';
1261import { BusinessError } from '@kit.BasicServicesKit';
1262
1263async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1264  console.info('saveFormInfoDemo');
1265  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1266  let fetchOptions: photoAccessHelper.FetchOptions = {
1267    fetchColumns: [],
1268    predicates: predicates
1269  };
1270  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
1271  let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
1272
1273  let info: photoAccessHelper.FormInfo = {
1274    // formId is a string consisting of only digits. uri indicates the URI of the image in Gallery. If there is no image in Gallery, uri must be an empty string.
1275    formId: "20230116123",
1276    uri: photoAsset.uri,
1277  }
1278
1279  phAccessHelper.saveFormInfo(info).then(() => {
1280    console.info('saveFormInfo successfully');
1281  }).catch((err: BusinessError) => {
1282    console.error(`saveFormInfo failed with error: ${err.code}, ${err.message}`);
1283  });
1284}
1285```
1286
1287### removeFormInfo<sup>11+</sup>
1288
1289removeFormInfo(info:FormInfo, callback: AsyncCallback&lt;void&gt;):void
1290
1291Removes a Gallery widget. This API uses an asynchronous callback to return the result.
1292
1293**System API**: This is a system API.
1294
1295**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1296
1297**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1298
1299**Parameters**
1300
1301| Name  | Type                    | Mandatory| Description                     |
1302| -------- | ------------------------ | ---- | ------------------------- |
1303| info  | [FormInfo](#forminfo11)        | Yes  |  Information about the Gallery widget to save, which includes the ID of the widget and the URI of the image bound to the widget.             |
1304| callback |  AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
1305
1306**Error codes**
1307
1308For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1309
1310| ID| Error Message|
1311| -------- | ---------------------------------------- |
1312| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
1313| 202   | Permission verification failed, application which is not a system application uses system API.         |
1314| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1315| 14000011       | System inner fail.         |
1316
1317**Example**
1318
1319For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1320
1321```ts
1322import { BusinessError } from '@kit.BasicServicesKit';
1323
1324async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1325  console.info('removeFormInfoDemo');
1326  let info: photoAccessHelper.FormInfo = {
1327    // formId is a string consisting of only digits. When removing a widget, leave uri empty.
1328    formId: "20230116123",
1329    uri: "",
1330  }
1331
1332  phAccessHelper.removeFormInfo(info, async (err: BusinessError) => {
1333    if (err == undefined) {
1334      console.info('removeFormInfo success');
1335    } else {
1336      console.error(`removeFormInfo fail with error: ${err.code}, ${err.message}`);
1337    }
1338  });
1339}
1340```
1341
1342### removeFormInfo<sup>11+</sup>
1343
1344removeFormInfo(info:FormInfo):Promise&lt;void&gt;
1345
1346Removes a Gallery widget. This API uses a promise to return the result.
1347
1348**System API**: This is a system API.
1349
1350**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1351
1352**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1353
1354**Parameters**
1355
1356| Name  | Type                    | Mandatory| Description                     |
1357| -------- | ------------------------ | ---- | ------------------------- |
1358| info  | [FormInfo](#forminfo11)        | Yes  |  Information about the Gallery widget to save, which includes the ID of the widget and the URI of the image bound to the widget.             |
1359
1360**Return value**
1361
1362| Type                                   | Description             |
1363| --------------------------------------- | ----------------- |
1364| Promise&lt;void&gt;| Promise that returns no value.|
1365
1366**Error codes**
1367
1368For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1369
1370| ID| Error Message|
1371| -------- | ---------------------------------------- |
1372| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
1373| 202   | Permission verification failed, application which is not a system application uses system API.         |
1374| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1375| 14000011       | System inner fail.         |
1376
1377**Example**
1378
1379For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1380
1381```ts
1382import { BusinessError } from '@kit.BasicServicesKit';
1383
1384async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1385  console.info('removeFormInfoDemo');
1386  let info: photoAccessHelper.FormInfo = {
1387    // formId is a string consisting of only digits. When removing a widget, leave uri empty.
1388    formId: "20230116123",
1389    uri: "",
1390  }
1391
1392  phAccessHelper.removeFormInfo(info).then(() => {
1393    console.info('removeFormInfo successfully');
1394  }).catch((err: BusinessError) => {
1395    console.error(`removeFormInfo failed with error: ${err.code}, ${err.message}`);
1396  });
1397}
1398```
1399
1400### createAssetsForApp<sup>19+</sup>
1401
1402createAssetsForApp(bundleName: string, appName: string, tokenId: number, photoCreationConfigs: Array&lt;PhotoCreationConfig&gt;): Promise&lt;Array&lt;string&gt;&gt;
1403
1404Creates media assets for an application with the specified token ID. The returned URIs has been granted with the permission for writing the media assets (images or videos).
1405
1406**System API**: This is a system API.
1407
1408**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1409
1410**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1411
1412**Parameters**
1413
1414| Name  | Type                                                                  | Mandatory| Description                     |
1415| -------- |----------------------------------------------------------------------| ---- | ------------------------- |
1416| bundleName | string | Yes| Bundle name of the target application.|
1417| appName | string | Yes| Name of the target application.|
1418| tokenId | number | Yes| Token ID of the target application.|
1419| photoCreationConfigs | Array&lt;[PhotoCreationConfig](arkts-apis-photoAccessHelper-i.md#photocreationconfig12)&gt; | Yes| Configuration for creating (saving) the media assets in the media library.|
1420
1421**Return value**
1422
1423| Type                                   | Description             |
1424| --------------------------------------- | ----------------- |
1425| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the media asset files in the media library. The target application (identified by **tokenId**) can write the media assets based on the URIs without requesting the write permission. If the URIs fail to be generated, a batch creation error code will be returned.<br>The error code **-3006** means that there are invalid characters; **-2004** means that the image type does not match the file name extension; **-203** means that the file operation is abnormal.|
1426
1427**Error codes**
1428
1429For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1430
1431| ID| Error Message|
1432| -------- | ---------------------------------------- |
1433| 201 |  Permission denied.         |
1434| 202 |  Called by non-system application.         |
1435| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
1436| 14000011       | Internal system error.         |
1437
1438**Example**
1439
1440For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1441
1442```ts
1443async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1444  console.info('createAssetsForAppDemo.');
1445
1446  try {
1447    let bundleName: string = 'testBundleName';
1448    let appName: string = 'testAppName';
1449    let tokenId: number = 537197950;
1450    let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [
1451      {
1452        title: 'test',
1453        fileNameExtension: 'jpg',
1454        photoType: photoAccessHelper.PhotoType.IMAGE,
1455        subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
1456      }
1457    ];
1458    let desFileUris: Array<string> = await phAccessHelper.createAssetsForApp(bundleName, appName, tokenId, photoCreationConfigs);
1459    console.info('createAssetsForApp success, data is ' + desFileUris);
1460  } catch (err) {
1461    console.error(`createAssetsForApp failed with error: ${err.code}, ${err.message}`);
1462  }
1463}
1464```
1465
1466### grantPhotoUriPermission<sup>19+</sup>
1467
1468grantPhotoUriPermission(tokenId: number, uri: string, photoPermissionType: PhotoPermissionType, hideSensitiveType: HideSensitiveType): Promise&lt;number&gt;
1469
1470Grants an application the permission to access a URI. This API uses a promise to return the result.
1471
1472**System API**: This is a system API.
1473
1474**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1475
1476**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1477
1478**Parameters**
1479
1480| Name  | Type                                                                  | Mandatory| Description                     |
1481| -------- |----------------------------------------------------------------------| ---- | ------------------------- |
1482| tokenId | number | Yes| ID of the target application.|
1483| uri | string | Yes| URI of the media asset.|
1484| photoPermissionType | [PhotoPermissionType](#photopermissiontype12) | Yes| Type of the permission to be granted. For details, see the enum.|
1485| hideSensitiveType | [HideSensitiveType](#hidesensitivetype12) | Yes| Type of the information to hide. This parameter is reserved. Currently, any enumerated value of **HideSensitiveType** can be passed in.|
1486
1487**Return value**
1488
1489| Type                                   | Description             |
1490| --------------------------------------- | ----------------- |
1491| Promise&lt;number&gt; | Promise used to return the result. The value **0** means the permission is granted to the application. The value **1** means the application already has the permission. The value **-1** means the permission fails to be granted.|
1492
1493**Error codes**
1494
1495For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1496
1497| ID| Error Message|
1498| -------- | ---------------------------------------- |
1499| 201 |  Permission denied.         |
1500| 202 |  Called by non-system application.         |
1501| 13900020 | Invalid argument. Possible causes: 1. Incorrect uri format; 2. The value of photoPermissionType or hideSensitiveType is out of range. |
1502| 14000011       | Internal system error.         |
1503
1504**Example**
1505
1506For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1507
1508```ts
1509async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1510  console.info('grantPhotoUriPermissionDemo');
1511
1512  try {
1513    let tokenId = 502334412;
1514    let result = await phAccessHelper.grantPhotoUriPermission(tokenId,
1515        'file://media/Photo/1/IMG_datetime_0001/displayName.jpg',
1516        photoAccessHelper.PhotoPermissionType.TEMPORARY_READ_IMAGEVIDEO,
1517        photoAccessHelper.HideSensitiveType.HIDE_LOCATION_AND_SHOOTING_PARAM);
1518
1519    console.info('grantPhotoUriPermission success, result=' + result);
1520  } catch (err) {
1521    console.error('grantPhotoUriPermission failed, error=' + err);
1522  }
1523}
1524```
1525
1526### grantPhotoUrisPermission<sup>19+</sup>
1527
1528grantPhotoUrisPermission(tokenId: number, uriList: Array&lt;string&gt;, photoPermissionType: PhotoPermissionType, hideSensitiveType: HideSensitiveType): Promise&lt;number&gt;
1529
1530Grants an application the permission to access multiple URIs. This API uses a promise to return the result.
1531
1532**System API**: This is a system API.
1533
1534**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1535
1536**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1537
1538**Parameters**
1539
1540| Name  | Type                                                                  | Mandatory| Description                     |
1541| -------- |----------------------------------------------------------------------| ---- | ------------------------- |
1542| tokenId | number | Yes| ID of the target application.|
1543| uriList | Array&lt;string&gt; | Yes| A list of URIs, which cannot exceed 1000.|
1544| photoPermissionType | [PhotoPermissionType](#photopermissiontype12) | Yes| Type of the permission to be granted. For details, see the enum.|
1545| hideSensitiveType | [HideSensitiveType](#hidesensitivetype12) | Yes| Type of the information to hide. This parameter is reserved. Currently, any enumerated value of **HideSensitiveType** can be passed in.|
1546
1547**Return value**
1548
1549| Type                                   | Description             |
1550| --------------------------------------- | ----------------- |
1551| Promise&lt;number&gt; | Promise used to return the result. The value **0** means the operation is successful; the value **-1** means the opposite.|
1552
1553**Error codes**
1554
1555For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1556
1557| ID| Error Message|
1558| -------- | ---------------------------------------- |
1559| 201 |  Permission denied.         |
1560| 202 |  Called by non-system application.         |
1561| 13900020 | Invalid argument. Possible causes: 1. Incorrect uri format; 2. The value of photoPermissionType or hideSensitiveType is out of range. |
1562| 14000011       | Internal system error.         |
1563
1564**Example**
1565
1566For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1567
1568```ts
1569async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1570  console.info('grantPhotoUrisPermissionDemo');
1571
1572  try {
1573    // URIs of the media assets.
1574    let uris: Array<string> = [
1575      'file://media/Photo/11/IMG_datetime_0001/displayName1.jpg',
1576      'file://media/Photo/22/IMG_datetime_0002/displayName2.jpg'];
1577    let tokenId = 502334412;
1578    let result = await phAccessHelper.grantPhotoUrisPermission(tokenId, uris,
1579        photoAccessHelper.PhotoPermissionType.TEMPORARY_READ_IMAGEVIDEO,
1580        photoAccessHelper.HideSensitiveType.HIDE_LOCATION_AND_SHOOTING_PARAM);
1581
1582    console.info('grantPhotoUrisPermission success, result=' + result);
1583  } catch (err) {
1584    console.error('grantPhotoUrisPermission failed, error=' + err);
1585  }
1586}
1587```
1588
1589### cancelPhotoUriPermission<sup>19+</sup>
1590
1591cancelPhotoUriPermission(tokenId: number, uri: string, photoPermissionType: PhotoPermissionType): Promise&lt;number&gt;
1592
1593Cancels the permission for accessing an URI from an application. This API uses a promise to return the result.
1594
1595**System API**: This is a system API.
1596
1597**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1598
1599**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1600
1601**Parameters**
1602
1603| Name  | Type                                                                  | Mandatory| Description                     |
1604| -------- |----------------------------------------------------------------------| ---- | ------------------------- |
1605| tokenId | number | Yes| ID of the target application.|
1606| uri | string | Yes| URI of the media asset.|
1607| photoPermissionType | [PhotoPermissionType](#photopermissiontype12) | Yes| Permission type.|
1608
1609**Return value**
1610
1611| Type                                   | Description             |
1612| --------------------------------------- | ----------------- |
1613| Promise&lt;number&gt; | Promise used to return the result. The value **0** means the operation is successful, and the value **-1** means the opposite.|
1614
1615**Error codes**
1616
1617For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1618
1619| ID| Error Message|
1620| -------- | ---------------------------------------- |
1621| 201 |  Permission denied.         |
1622| 202 |  Called by non-system application.         |
1623| 13900020 | Invalid argument. Possible causes: 1. Incorrect uri format; 2. The value of photoPermissionType or hideSensitiveType is out of range. |
1624| 14000011       | Internal system error.         |
1625
1626**Example**
1627
1628For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1629
1630```ts
1631async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1632  console.info('cancelPhotoUriPermissionDemo');
1633
1634  try {
1635    let tokenId = 502334412;
1636    let result = await phAccessHelper.cancelPhotoUriPermission(tokenId,
1637        'file://media/Photo/11/IMG_datetime_0001/displayName.jpg',
1638        photoAccessHelper.PhotoPermissionType.TEMPORARY_READ_IMAGEVIDEO);
1639
1640    console.info('cancelPhotoUriPermission success, result=' + result);
1641  } catch (err) {
1642    console.error('cancelPhotoUriPermission failed, error=' + err);
1643  }
1644}
1645```
1646
1647### startThumbnailCreationTask<sup>13+</sup>
1648
1649startThumbnailCreationTask(predicate: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<void\>): number
1650
1651Generates a thumbnail based on the specified rule.
1652
1653**System API**: This is a system API.
1654
1655**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1656
1657**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1658
1659**Parameters**
1660
1661| Name     | Type                                   | Mandatory| Description            |
1662| ---------  | --------------------------------------- | ---- | --------------- |
1663| predicates | [dataSharePredicates.DataSharePredicates](../apis-arkdata/js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes  | Rule for generating the thumbnail. |
1664| callback   | AsyncCallback&lt;void&gt;               | Yes  | Callback used to return the result. If the operation is successful, the notification task ends, and **err** is undefined. If the task fails, **err** is an error object.|
1665
1666**Return value**
1667
1668| Type                 | Description                 |
1669| --------------------- | -------------------- |
1670| Promise&lt;number&gt; | Promise used to return the ID of the thumbnail generation task.|
1671
1672**Error codes**
1673
1674For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1675
1676| ID| Error Message|
1677| -------- | ---------------------------------------- |
1678| 201 |  Permission denied.         |
1679| 202 |  Called by non-system application.         |
1680| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
1681| 14000011       | Internal system error.         |
1682
1683**Example**
1684
1685For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1686
1687```ts
1688import { dataSharePredicates } from '@kit.ArkData'
1689
1690function testCallBack() {
1691
1692}
1693
1694async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1695  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1696
1697  try {
1698    console.info('startThumbnailCreationTask test start');
1699    phAccessHelper.startThumbnailCreationTask(predicates, testCallBack);
1700  } catch (err) {
1701    console.error(`startThumbnailCreationTask failed, error: ${err.code}, ${err.message}`);
1702  }
1703}
1704```
1705
1706### stopThumbnailCreationTask<sup>13+</sup>
1707
1708stopThumbnailCreationTask(taskId: number): void
1709
1710Stops generating a thumbnail.
1711
1712**System API**: This is a system API.
1713
1714**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1715
1716**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1717
1718**Parameters**
1719
1720| Name | Type  | Mandatory| Description                    |
1721| -----  | ------ | ---- | ------------------------ |
1722| taskId | number | Yes  | ID of the thumbnail generation task to stop.|
1723
1724**Error codes**
1725
1726For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1727
1728| ID| Error Message|
1729| -------- | ---------------------------------------- |
1730| 201 |  Permission denied.         |
1731| 202 |  Called by non-system application.         |
1732| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
1733| 14000011       | Internal system error.         |
1734
1735**Example**
1736
1737For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1738
1739```ts
1740async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1741  try {
1742    console.info('stopThumbnailCreationTask test start');
1743    let taskId: number = 75983;
1744    phAccessHelper.stopThumbnailCreationTask(taskId);
1745  } catch (err) {
1746    console.error(`stopThumbnailCreationTask failed, error: ${err.code}, ${err.message}`);
1747  }
1748}
1749```
1750
1751### getIndexConstructProgress<sup>12+</sup>
1752
1753getIndexConstructProgress(): Promise&lt;string&gt;
1754
1755Obtains the index construction progress. This API uses a promise to return the result.
1756
1757**System API**: This is a system API.
1758
1759**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1760
1761**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1762
1763
1764**Return value**
1765
1766| Type                       | Description          |
1767| --------------------------- | -------------- |
1768| Promise&lt;string&gt; | Promise used to return a string in JSON format. The string indicates the number of images that have been analyzed, the total number of images, the number of videos that have been analyzed, and the total number of videos.|
1769
1770**Error codes**
1771
1772For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1773
1774
1775| ID| Error Message|
1776| -------- | ---------------------------------------- |
1777| 201      | Permission denied.                                           |
1778| 202      | Called by non-system application.                            |
1779| 14000011       | Internal system error.         |
1780
1781**Example**
1782
1783For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](arkts-apis-photoAccessHelper-f.md#photoaccesshelpergetphotoaccesshelper).
1784
1785```ts
1786async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1787
1788  class indexProgress {
1789    finishedImageCount: number = 0;
1790    totalImageCount: number = 0;
1791    finishedVideoCount: number = 0;
1792    totalVideoCount: number = 0;
1793  }
1794
1795  try {
1796    console.info('getIndexConstructProgress test start');
1797    let result: string = await phAccessHelper.getIndexConstructProgress();
1798    console.info('getIndexProgress:' + result);
1799
1800    let jsonObj: indexProgress = JSON.parse(result);
1801    //...Use the obtained index construction progress data.
1802  } catch (err) {
1803    console.error(`getIndexConstructProgress failed, error: ${err.code}, ${err.message}`);
1804  }
1805}
1806```
1807
1808### getDataAnalysisProgress<sup>12+</sup>
1809
1810getDataAnalysisProgress(analysisType: AnalysisType): Promise&lt;string&gt;
1811
1812Obtains the asset analysis progress. This API uses a promise to return the result.
1813
1814**System API**: This is a system API.
1815
1816**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1817
1818**Required permissions**: ohos.permission.READ_IMAGEVIDEO
1819
1820**Parameters**
1821
1822| Name | Type            | Mandatory  | Description   |
1823| ---- | -------------- | ---- | ----- |
1824| analysisType | [AnalysisType](#analysistype11) | Yes   | Smart analysis type.|
1825
1826**Return value**
1827
1828| Type                       | Description          |
1829| --------------------------- | -------------- |
1830| Promise&lt;string&gt; | Promise used to return a string in JSON format. The string indicates the asset analysis progress.|
1831
1832**Error codes**
1833
1834For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1835
1836| ID| Error Message|
1837| -------- | ---------------------------------------- |
1838| 201      | Permission denied.                                           |
1839| 202      | Called by non-system application.                            |
1840| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1841| 14000011       | Internal system error.         |
1842
1843**Example**
1844
1845For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](arkts-apis-photoAccessHelper-f.md#photoaccesshelpergetphotoaccesshelper).
1846
1847```ts
1848async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1849  try {
1850    console.info('getDataAnalysisProgress test start');
1851
1852    let result: string = await phAccessHelper.getDataAnalysisProgress(photoAccessHelper.AnalysisType.ANALYSIS_FACE);
1853    console.info('getDataAnalysisProgress:' + result);
1854
1855  } catch (err) {
1856    console.error(`getDataAnalysisProgress failed, error: ${err.code}, ${err.message}`);
1857  }
1858}
1859```
1860
1861### getSharedPhotoAssets<sup>13+</sup>
1862
1863getSharedPhotoAssets(options: FetchOptions): Array\<SharedPhotoAsset\>
1864
1865Obtains the shared photo assets.
1866
1867**System API**: This is a system API.
1868
1869**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1870
1871**Required permission**: ohos.permission.ACCESS_MEDIALIB_THUMB_DB
1872
1873**Parameters**
1874
1875| Name     | Type        | Mandatory| Description    |
1876| ---------  | ------------ | ---- | ------- |
1877| options    | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions) | Yes  | Options for obtaining the shared photo assets.|
1878
1879**Return value**
1880
1881| Type                   | Description               |
1882| ----------------------- | ------------------ |
1883| Array\<[SharedPhotoAsset](#sharedphotoasset13)\> | Shared photo assets obtained.|
1884
1885**Error codes**
1886
1887For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
1888
1889| ID| Error Message|
1890| -------- | ---------------------------------------- |
1891| 201 |  Permission denied.         |
1892| 202 |  Called by non-system application.         |
1893| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
1894| 14000011       | Internal system error.         |
1895
1896**Example**
1897
1898For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1899
1900```ts
1901import { dataSharePredicates } from '@kit.ArkData'
1902
1903async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
1904  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
1905  let fetchOptions: photoAccessHelper.FetchOptions = {
1906    fetchColumns: [],
1907    predicates: predicates
1908  };
1909
1910  try {
1911    console.info('getSharedPhotoAssets test start');
1912    phAccessHelper.getSharedPhotoAssets(fetchOptions);
1913    console.info('getSharedPhotoAssets test end');
1914  } catch (err) {
1915    console.error(`getSharedPhotoAssets failed, error: ${err.code}, ${err.message}`);
1916  }
1917}
1918```
1919
1920### startAssetAnalysis<sup>18+</sup>
1921
1922startAssetAnalysis(type: AnalysisType, assetUris?: Array&lt;string&gt;): Promise&lt;number&gt;
1923
1924Starts asset analysis.
1925
1926**System API**: This is a system API.
1927
1928**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1929
1930**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1931
1932**Parameters**
1933
1934| Name   | Type               | Mandatory| Description                                                        |
1935| --------- | ------------------- | ---- | ------------------------------------------------------------ |
1936| type      | [AnalysisType](#analysistype11) | Yes  | Smart analysis type.                                    |
1937| assetUris | Array&lt;string&gt; | No  | Array of asset URIs.<br>- If this parameter is specified, only the given assets are analyzed.<br>- If this parameter is left blank, full analysis is performed.|
1938
1939**Return value**
1940
1941| Type                 | Description                       |
1942| --------------------- | --------------------------- |
1943| Promise&lt;number&gt; | Promise used to return the task ID of the service.|
1944
1945**Error codes**
1946
1947For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
1948
1949| ID| Error Message                                                    |
1950| -------- | ------------------------------------------------------------ |
1951| 201      | Permission denied.                                           |
1952| 202      | Called by non-system application.                            |
1953| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
1954
1955**Example**
1956
1957For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
1958
1959```ts
1960async function example(context: Context) {
1961  console.info('startAssetAnalysisDemo');
1962  try {
1963    let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
1964    let uris = ["file://media/Photo/14/IMG_1729066473_013/IMG_20241016_122253.jpg",
1965                "file://media/Photo/68/IMG_1729033213_018/IMG_20241016_100082.jpg"];
1966    let taskId = await phAccessHelper.startAssetAnalysis(photoAccessHelper.AnalysisType.ANALYSIS_SEARCH_INDEX,
1967        uris);
1968    console.info('startAssetAnalysis success, taskId=' + taskId);
1969  } catch (err) {
1970    console.error('startAssetAnalysis failed, error=' + err);
1971  }
1972}
1973```
1974
1975### createAssetsForAppWithMode<sup>12+</sup>
1976
1977createAssetsForAppWithMode(boundleName: string, appName: string, appId: string, tokenId: number, authorizationMode: AuthorizationMode, photoCreationConfigs:Array\<PhotoCreationConfig>): Promise\<Array\<string>>
1978
1979Creates assets with a temporary permission. This API uses a promise to return the result.
1980
1981**System API**: This is a system API.
1982
1983**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
1984
1985**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
1986
1987**Parameters**
1988
1989| Name  | Type                                                                  | Mandatory| Description                     |
1990| -------- |----------------------------------------------------------------------| ---- | ------------------------- |
1991| boundleName| string | Yes| Bundle name of the target application.|
1992| appName| string | Yes| Name of the target application.|
1993| appId| string | Yes| ID of the target application.|
1994| tokenId| number| Yes| Unique identifier for the temporary authorization.|
1995| authorizationMode| [AuthorizationMode](#authorizationmode12)| Yes| Authorization mode. No confirmation dialog box is displayed when the application with the temporary permission saves media assets in the give period of time.|
1996| PhotoCreationConfig| Array\<[PhotoCreationConfig](arkts-apis-photoAccessHelper-i.md#photocreationconfig12)> | Yes| Configuration for creating (saving) the media assets in the media library.|
1997
1998**Return value**
1999
2000| Type                                   | Description             |
2001| --------------------------------------- | ----------------- |
2002| Promise\<Array\<string>> | Promise used to return the URIs of the media asset files in the media library. The target application (identified by **appid**) can write the assets based on the URIs without has been authorized to the application specified by appId to allow the application to write data. If the URIs fail to be generated, a batch creation error code will be returned.<br>The error code **-3006** means that there are invalid characters; **-2004** means that the image type does not match the file name extension; **-203** means that the file operation is abnormal.|
2003
2004**Error codes**
2005
2006For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2007
2008| ID| Error Message|
2009| -------- | ---------------------------------------- |
2010| 201 |  Permission denied.         |
2011| 202 |  Called by non-system application.         |
2012| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
2013| 14000011       | Internal system error.         |
2014
2015**Example**
2016
2017For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2018
2019```ts
2020async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2021  console.info('createAssetsForAppWithModeDemo.');
2022
2023  try {
2024    let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [
2025      {
2026        title: '123456',
2027        fileNameExtension: 'jpg',
2028        photoType: photoAccessHelper.PhotoType.IMAGE,
2029        subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
2030      }
2031    ];
2032    let bundleName: string = 'testBundleName';
2033    let appName: string = 'testAppName';
2034    let appId: string = 'testAppId';
2035    let tokenId: number = 537197950;
2036    let authorizationMode: photoAccessHelper.AuthorizationMode = photoAccessHelper.AuthorizationMode.SHORT_TIME_AUTHORIZATION;
2037    let result: Array<string> = await phAccessHelper.createAssetsForAppWithMode(bundleName, appName, appId, tokenId, authorizationMode, photoCreationConfigs);
2038    console.info(`result: ${JSON.stringify(result)}`);
2039    console.info('Photo createAssetsForAppWithMode success.');
2040  } catch (err) {
2041    console.error(`createAssetsForAppWithMode failed with error: ${err.code}, ${err.message}`);
2042  }
2043}
2044```
2045
2046### getKeyFrameThumbnail<sup>18+</sup>
2047
2048getKeyFrameThumbnail(beginFrameTimeMs: number, type: ThumbnailType): Promise<image.PixelMap>
2049
2050Obtains the thumbnail of the specified type for the key frame. This API uses a promise to return the result.
2051
2052**System API**: This is a system API.
2053
2054**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2055
2056**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2057
2058**Parameters**
2059
2060| Name | Type            | Mandatory  | Description   |
2061| ---- | -------------- | ---- | ----- |
2062| beginFrameTimeMs | number | Yes   | Time of the start frame, in ms. The value **0** indicates the cover frame.|
2063| type | [ThumbnailType](#thumbnailtype13)| Yes   | Type of the thumbnail.|
2064
2065**Return value**
2066
2067| Type                           | Description                   |
2068| ----------------------------- | --------------------- |
2069| Promise&lt;[image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md)&gt; | Promise used to return the PixelMap of the thumbnail obtained. The cover frame is returned by default if no thumbnail is obtained.|
2070
2071**Error codes**
2072
2073For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2074
2075| ID| Error Message|
2076| -------- | ---------------------------------------- |
2077| 201   | Permission denied.       |
2078| 202   | Called by non-system application.       |
2079| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2080| 14000011   | Internal system error.
2081
2082**Example**
2083
2084For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2085
2086```ts
2087import { common }  from '@kit.AbilityKit';
2088import { dataSharePredicates } from '@kit.ArkData';
2089import { image } from '@kit.ImageKit';
2090
2091async function example(context: Context) {
2092  try{
2093    console.info('getKeyFrameThumbnail demo');
2094    let phAccessHelper:photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
2095    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
2096    predicates.equalTo(photoAccessHelper.PhotoKeys.PHOTO_TYPE, photoAccessHelper.PhotoType.VIDEO);
2097    let fetchOption: photoAccessHelper.FetchOptions = {
2098      fetchColumns: [],
2099      predicates: predicates
2100    };
2101    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
2102    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getLastObject();
2103    let pixelMap: image.PixelMap = await asset.getKeyFrameThumbnail(0, photoAccessHelper.ThumbnailType.LCD);
2104    console.info('getKeyFrameThumbnail success');
2105  } catch (error) {
2106    console.error('getKeyFrameThumbnail failed, error: ' + JSON.stringify(error));
2107  }
2108}
2109```
2110
2111### saveGalleryFormInfo<sup>18+</sup>
2112
2113saveGalleryFormInfo(info:GalleryFormInfo):Promise&lt;void&gt;
2114
2115Saves a Gallery widget. This API uses a promise to return the result.
2116
2117**System API**: This is a system API.
2118
2119**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
2120
2121**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2122
2123**Parameters**
2124
2125| Name  | Type                    | Mandatory| Description                     |
2126| -------- | ------------------------ | ---- | ------------------------- |
2127| info  | [GalleryFormInfo](#galleryforminfo18)        | Yes  | Information about the Gallery widget, which includes the ID of the widget and the URIs of the image or album bound to the widget.             |
2128
2129**Return value**
2130
2131| Type                                   | Description             |
2132| --------------------------------------- | ----------------- |
2133| Promise&lt;void&gt;| Promise that returns no value.|
2134
2135**Error codes**
2136
2137For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2138
2139| ID| Error Message|
2140| -------- | ---------------------------------------- |
2141| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
2142| 202   | Permission verification failed, application which is not a system application uses system API.         |
2143| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2144| 14000011       | System inner fail.         |
2145
2146**Example**
2147
2148```ts
2149import { dataSharePredicates } from '@kit.ArkData';
2150import { BusinessError } from '@kit.BasicServicesKit';
2151
2152async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2153  console.info('saveGalleryFormInfoDemo');
2154  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
2155  let fetchOptions: photoAccessHelper.FetchOptions = {
2156    fetchColumns: [],
2157    predicates: predicates
2158  };
2159  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
2160  let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
2161  let uriList: Array<string> = [
2162    photoAsset.uri,
2163  ];
2164  let info: photoAccessHelper.GalleryFormInfo = {
2165    // formId is a string consisting of only digits. assetUris indicates the URIs of the images or albums in Gallery.
2166    formId: "20230116123",
2167    assetUris: uriList,
2168  }
2169
2170  phAccessHelper.saveGalleryFormInfo(info).then(() => {
2171    console.info('saveGalleryFormInfo successfully');
2172  }).catch((err: BusinessError) => {
2173    console.error(`saveGalleryFormInfo failed with error: ${err.code}, ${err.message}`);
2174  });
2175}
2176```
2177
2178### updateGalleryFormInfo<sup>18+</sup>
2179
2180updateGalleryFormInfo(info:GalleryFormInfo):Promise&lt;void&gt;
2181
2182Updates the information about a Gallery widget and saves the information to the database. This API uses a promise to return the result.
2183
2184**System API**: This is a system API.
2185
2186**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
2187
2188**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2189
2190**Parameters**
2191
2192| Name  | Type                    | Mandatory| Description                     |
2193| -------- | ------------------------ | ---- | ------------------------- |
2194| info  | [GalleryFormInfo](#galleryforminfo18)        | Yes  | Information about the Gallery widget, which includes the ID of the widget and the URIs of the image or album bound to the widget.             |
2195
2196**Return value**
2197
2198| Type                                   | Description             |
2199| --------------------------------------- | ----------------- |
2200| Promise&lt;void&gt;| Promise that returns no value.|
2201
2202**Error codes**
2203
2204For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2205
2206| ID| Error Message|
2207| -------- | ---------------------------------------- |
2208| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
2209| 202   | Permission verification failed, application which is not a system application uses system API.         |
2210| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2211| 14000011       | System inner fail.         |
2212
2213**Example**
2214
2215```ts
2216import { dataSharePredicates } from '@kit.ArkData';
2217import { BusinessError } from '@kit.BasicServicesKit';
2218
2219async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2220  console.info('updateGalleryFormInfoDemo');
2221  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
2222  let fetchOptions: photoAccessHelper.FetchOptions = {
2223    fetchColumns: [],
2224    predicates: predicates
2225  };
2226  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
2227  let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
2228  let photoAssetLast: photoAccessHelper.PhotoAsset = await fetchResult.getLastObject();
2229  let uriList: Array<string> = [
2230    photoAsset.uri,
2231    photoAssetLast.uri
2232  ];
2233  let info: photoAccessHelper.GalleryFormInfo = {
2234    // formId is a string consisting of only digits. assetUris indicates the URIs of the images or albums in Gallery.
2235    formId: "20230116123",
2236    assetUris: uriList,
2237  }
2238
2239  phAccessHelper.updateGalleryFormInfo(info).then(() => {
2240    console.info('updateGalleryFormInfo successfully');
2241  }).catch((err: BusinessError) => {
2242    console.error(`updateGalleryFormInfo failed with error: ${err.code}, ${err.message}`);
2243  });
2244}
2245```
2246
2247### removeGalleryFormInfo<sup>18+</sup>
2248
2249removeGalleryFormInfo(info:GalleryFormInfo):Promise&lt;void&gt;
2250
2251Removes a Gallery widget. This API uses a promise to return the result.
2252
2253**System API**: This is a system API.
2254
2255**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
2256
2257**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2258
2259**Parameters**
2260
2261| Name  | Type                    | Mandatory| Description                     |
2262| -------- | ------------------------ | ---- | ------------------------- |
2263| info  | [GalleryFormInfo](#galleryforminfo18)        | Yes  | Information about the Gallery widget, which includes the ID of the widget and the URIs of the image or album bound to the widget.             |
2264
2265**Return value**
2266
2267| Type                                   | Description             |
2268| --------------------------------------- | ----------------- |
2269| Promise&lt;void&gt;| Promise that returns no value.|
2270
2271**Error codes**
2272
2273For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2274
2275| ID| Error Message|
2276| -------- | ---------------------------------------- |
2277| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.         |
2278| 202   | Permission verification failed, application which is not a system application uses system API.         |
2279| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2280| 14000011       | System inner fail.         |
2281
2282**Example**
2283
2284```ts
2285import { BusinessError } from '@kit.BasicServicesKit';
2286
2287async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2288  console.info('removeGalleryFormInfoDemo');
2289  let info: photoAccessHelper.GalleryFormInfo = {
2290    // formId is a string consisting of only digits. When removing a widget, leave assertUris empty.
2291    formId: "20230116123"
2292  }
2293
2294  phAccessHelper.removeGalleryFormInfo(info).then(() => {
2295    console.info('removeGalleryFormInfo successfully');
2296  }).catch((err: BusinessError) => {
2297    console.error(`removeGalleryFormInfo failed with error: ${err.code}, ${err.message}`);
2298  });
2299}
2300```
2301
2302
2303### getAlbumsByIds<sup>18+</sup>
2304
2305getAlbumsByIds(albumIds: Array&lt;number&gt;): Promise&lt;Map&lt;number, Album&gt;&gt;
2306
2307Obtains album information by album IDs. This API uses a promise to return the result.
2308
2309**System API**: This is a system API.
2310
2311**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2312
2313**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2314
2315**Parameters**
2316
2317| Name   | Type               | Mandatory| Description                                                        |
2318| --------- | ------------------- | ---- | ------------------------------------------------------------ |
2319| albumIds  | Array&lt;number&gt;              | Yes  | Array of album IDs.                                    |
2320
2321**Return value**
2322
2323| Type                 | Description                       |
2324| --------------------- | --------------------------- |
2325| Promise&lt;Map&lt;number, Album&gt;&gt; | Promise used to return the map object that contains the album information.|
2326
2327**Error codes**
2328
2329For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2330
2331| ID| Error Message                                                    |
2332| -------- | ------------------------------------------------------------ |
2333| 201      | Permission denied.                                           |
2334| 202      | Called by non-system application.                            |
2335| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
2336| 14000011       | Internal system error.         |
2337
2338**Example**
2339
2340For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2341
2342```ts
2343async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2344  console.info('startGetAlbumsByIdsDemo');
2345
2346  try {
2347    // Obtain the sandbox URIs of the images or videos to be saved to the media library.
2348    let albumIds: Array<number> = [
2349      12 //Use the actual album ID.
2350    ];
2351    let map: Map<number, photoAccessHelper.Album> = await phAccessHelper.getAlbumsByIds(albumIds);
2352    console.info('getAlbumsByIds success, size is ' + map.size);
2353  } catch (err) {
2354    console.error('getAlbumsByIds failed, errCode is ' + err.code + ', errMsg is ' + err.message);
2355  }
2356}
2357```
2358
2359### createAssetsForAppWithAlbum<sup>18+</sup>
2360
2361createAssetsForAppWithAlbum(source: PhotoCreationSource, albumUri: string, isAuthorized: boolean, photoCreationConfigs: Array&lt;PhotoCreationConfig&gt;): Promise&lt;Array&lt;string&gt;&gt;
2362
2363Creates assets for the current application or other applications in the specified source or user album. This API uses a promise to return the result.
2364
2365**System API**: This is a system API.
2366
2367**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2368
2369**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
2370
2371**Parameters**
2372
2373| Name   | Type               | Mandatory| Description                                                        |
2374| --------- | ------------------- | ---- | ------------------------------------------------------------ |
2375| source  | [PhotoCreationSource](#photocreationsource18)         | Yes  | Application information provided to create assets on behalf of the application.                                    |
2376| albumUri  | string             | Yes  | URI of the album.                                    |
2377| isAuthorized  |  boolean              | Yes  | Whether to authorize other applications. **true** to authorize, **false** otherwise.                                    |
2378| PhotoCreationConfigs| Array\<[PhotoCreationConfig](arkts-apis-photoAccessHelper-i.md#photocreationconfig12)> | Yes| Configuration for creating (saving) the media assets in the media library.|
2379
2380**Return value**
2381
2382| Type                 | Description                       |
2383| --------------------- | --------------------------- |
2384| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the media asset files in the media library.<br>The target application (identified by **appid**) can write the media assets based on the URIs without requesting the write permission. If the URIs fail to be generated, a batch creation error code will be returned.<br>The error code **-3006** means that there are invalid characters; **-2004** means that the image type does not match the file name extension; **-203** means that the file operation is abnormal.|
2385
2386**Error codes**
2387
2388For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
2389
2390| ID| Error Message                                                    |
2391| -------- | ------------------------------------------------------------ |
2392| 201      | Permission denied.                                           |
2393| 202      | Called by non-system application.                            |
2394| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. |
2395| 14000011       | Internal system error.         |
2396
2397**Example**
2398
2399For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2400
2401```ts
2402async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2403  console.info('createAssetsForAppWithAlbumDemo.');
2404
2405  try {
2406    let source: photoAccessHelper.PhotoCreationSource = {
2407      bundleName: 'testBundleName',
2408      appName: 'testAppName',
2409      appId: 'testAppId',
2410      tokenId: 537197950,
2411    }
2412    let albumUri: string = 'file://media/PhotoAlbum/10';
2413    let isAuthorized: boolean = true;
2414    let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [
2415      {
2416        title: 'test',
2417        fileNameExtension: 'jpg',
2418        photoType: photoAccessHelper.PhotoType.IMAGE,
2419        subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
2420      }
2421    ];
2422    let desFileUris: Array<string> = await phAccessHelper.createAssetsForAppWithAlbum(source, albumUri, isAuthorized, photoCreationConfigs);
2423    console.info('createAssetsForAppWithAlbum success, data is ' + desFileUris);
2424  } catch (err) {
2425    console.error(`createAssetsForAppWithAlbum failed with error: ${err.code}, ${err.message}`);
2426  }
2427}
2428```
2429
2430### on('hiddenPhotoChange')<sup>20+</sup>
2431
2432on(type: 'hiddenPhotoChange', callback: Callback&lt;PhotoAssetChangeInfos&gt;): void
2433
2434Registers a listener for the **'hiddenPhotoChange'** event to monitor hidden media asset changes. This API uses a callback to return the result, and it accepts multiple callbacks.
2435
2436**System API**: This is a system API.
2437
2438**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2439
2440**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
2441
2442**Parameters**
2443
2444| Name  | Type                  | Mandatory| Description     |
2445|-----------|-------------------------|-----------|-----------------|
2446| type | string | Yes  | Event type. The value is fixed at **'hiddenPhotoChange'**. After the registration is complete, any change to the hidden media assets is returned through the callback.|
2447| callback  | Callback&lt;[PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20)&gt; | Yes  | Callback used to return the hidden media asset information after change, which is [PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20).<br>**NOTE**: You can register multiple listeners using this API, and you can call [off('hiddenPhotoChange')](#offhiddenphotochange20) to unregister all listeners or a specific one.|
2448
2449**Error codes**
2450
2451For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2452
2453| ID| Error Message|
2454| -------- | ---------------------------------------- |
2455| 201 | Permission denied. |
2456| 202 | Called by non-system application. |
2457| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'hiddenPhotoChange'; 2. The same callback is registered repeatedly. |
2458| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2459
2460**Example**
2461
2462For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2463
2464```ts
2465import { dataSharePredicates } from '@kit.ArkData'
2466
2467let onCallback1 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2468    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2469  // file had changed, do something.
2470}
2471let onCallback2 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2472    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2473  // file had changed, do something.
2474}
2475
2476async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper){
2477  console.info('onHiddenPhotoChangeDemo.');
2478
2479  try {
2480    // Register onCallback1.
2481    phAccessHelper.on('hiddenPhotoChange', onCallback1);
2482    // Register onCallback2.
2483    phAccessHelper.on('hiddenPhotoChange', onCallback2);
2484  } catch (error) {
2485    console.error('onHiddenPhotoChange failed, errCode is', error);
2486  }
2487}
2488```
2489
2490### off('hiddenPhotoChange')<sup>20+</sup>
2491
2492off(type: 'hiddenPhotoChange', callback?: Callback&lt;PhotoAssetChangeInfos&gt;): void
2493
2494Unregisters a listener for the **'hiddenPhotoChange'** event to stop monitoring hidden media asset changes. If multiple listeners are registered, you can unregister a specific listener by specifying **callback**. Alternatively, you can unregister all of them without specifying **callback**.
2495
2496**System API**: This is a system API.
2497
2498**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2499
2500**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
2501
2502**Parameters**
2503
2504| Name  | Type                  | Mandatory| Description     |
2505|-----------|-------------------------|-----------|-----------------|
2506| type | string | Yes  | Event type. The value is fixed at **'hiddenPhotoChange'**. After the unregistration is complete, any change to the hidden media assets is no longer returned through the callback.|
2507| callback | Callback&lt;[PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20)&gt; | No  | Exact callback you previously registered with [on('hiddenPhotoChange')](#onhiddenphotochange20). If this parameter is left unspecified, all listeners for the **'hiddenPhotoChange'** event are unregistered.<br>**NOTE**: Once a specific callback is unregistered, it will not be invoked when a hidden media asset changes.|
2508
2509**Error codes**
2510
2511For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2512
2513| ID| Error Message|
2514| -------- | ---------------------------------------- |
2515| 201 | Permission denied. |
2516| 202 | Called by non-system application. |
2517| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'hiddenPhotoChange'; 2. The same callback is unregistered repeatedly. |
2518| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2519
2520**Example**
2521
2522For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2523
2524```ts
2525import { dataSharePredicates } from '@kit.ArkData'
2526
2527let onCallback1 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2528    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2529  // file had changed, do something.
2530}
2531let onCallback2 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2532    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2533  // file had changed, do something.
2534}
2535
2536async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper){
2537  console.info('offHiddenPhotoChangeDemo.');
2538
2539  try {
2540    // Register onCallback1.
2541    phAccessHelper.on('hiddenPhotoChange', onCallback1);
2542    // Register onCallback2.
2543    phAccessHelper.on('hiddenPhotoChange', onCallback2);
2544
2545    // Unregister the listening of onCallback1.
2546    phAccessHelper.off('hiddenPhotoChange', onCallback1);
2547  } catch (error) {
2548    console.error('offHiddenPhotoChange failed, errCode is', error);
2549  }
2550}
2551```
2552
2553### on('trashedPhotoChange')<sup>20+</sup>
2554
2555on(type: 'trashedPhotoChange', callback: Callback&lt;PhotoAssetChangeInfos&gt;): void
2556
2557Registers a listener for the **'trashedPhotoChange'** event to monitor media asset changes in the trash. This API uses a callback to return the result, and it accepts multiple callbacks.
2558
2559**System API**: This is a system API.
2560
2561**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2562
2563**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2564
2565**Parameters**
2566
2567| Name  | Type                  | Mandatory| Description     |
2568|-----------|-------------------------|-----------|-----------------|
2569| type | string | Yes  | Event type. The value is fixed at **'trashedPhotoChange'**. After the registration is complete, any change to the trashed media assets is returned through the callback.|
2570| callback  | Callback&lt;[PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20)&gt; | Yes  | Callback used to return the trashed media asset information after change, which is [PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20).<br>**NOTE**: You can register multiple listeners using this API, and you can call [off('hiddenPhotoChange')](#offhiddenphotochange20) to unregister all listeners or a specific one.|
2571
2572**Error codes**
2573
2574For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2575
2576| ID| Error Message|
2577| -------- | ---------------------------------------- |
2578| 201 | Permission denied. |
2579| 202 | Called by non-system application. |
2580| 23800151  | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'trashedPhotoChange'; 2. The same callback is registered repeatedly. |
2581| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2582
2583**Example**
2584
2585For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2586
2587```ts
2588import { dataSharePredicates } from '@kit.ArkData'
2589
2590let onCallback1 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2591    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2592  // file had changed, do something.
2593}
2594let onCallback2 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2595    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2596  // file had changed, do something.
2597}
2598
2599async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context){
2600  console.info('onTrashedPhotoChangeDemo.');
2601
2602  try {
2603    // Register onCallback1.
2604    phAccessHelper.on('trashedPhotoChange', onCallback1);
2605    // Register onCallback2.
2606    phAccessHelper.on('trashedPhotoChange', onCallback2);
2607  } catch (error) {
2608    console.error('onTrashedPhotoChangeDemo failed, errCode is', error);
2609  }
2610}
2611```
2612
2613### off('trashedPhotoChange')<sup>20+</sup>
2614
2615off(type: 'trashedPhotoChange', callback?: Callback&lt;PhotoAssetChangeInfos&gt;): void
2616
2617Unregisters a listener for the **'trashedPhotoChange'** event to stop monitoring media asset changes in the trash. If multiple listeners are registered, you can unregister a specific listener by specifying **callback**. Alternatively, you can unregister all of them without specifying **callback**.
2618
2619**System API**: This is a system API.
2620
2621**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2622
2623**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2624
2625**Parameters**
2626
2627| Name  | Type                  | Mandatory| Description     |
2628|-----------|-------------------------|-----------|-----------------|
2629| type | string | Yes  | Event type. The value is fixed at **'trashedPhotoChange'**. After the unregistration is complete, any change to the trashed media assets is no longer returned through the callback.|
2630| callback | Callback&lt;[PhotoAssetChangeInfos](arkts-apis-photoAccessHelper-i.md#photoassetchangeinfos20)&gt; | No  | Exact callback you previously registered with [on('trashedPhotoChange')](#ontrashedphotochange20). If this parameter is left unspecified, all listeners for the **'trashedPhotoChange'** event are unregistered.<br>**NOTE**: Once a specific callback is unregistered, it will not be invoked when a trashed media asset changes.|
2631
2632**Error codes**
2633
2634For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2635
2636| ID| Error Message|
2637| -------- | ---------------------------------------- |
2638| 201 | Permission denied. |
2639| 202 | Called by non-system application. |
2640| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'trashedPhotoChange'; 2. The same callback is unregistered repeatedly. |
2641| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2642
2643**Example**
2644
2645For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2646
2647```ts
2648import { dataSharePredicates } from '@kit.ArkData'
2649
2650let onCallback1 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2651    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2652  // file had changed, do something.
2653}
2654let onCallback2 = (changeData: photoAccessHelper.PhotoAssetChangeInfos) => {
2655    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2656  // file had changed, do something.
2657}
2658
2659async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context){
2660  console.info('offTrashedPhotoChangeDemo.');
2661
2662  try {
2663    // Register onCallback1.
2664    phAccessHelper.on('trashedPhotoChange', onCallback1);
2665    // Register onCallback2.
2666    phAccessHelper.on('trashedPhotoChange', onCallback2);
2667
2668    // Unregister the listening of onCallback1.
2669    phAccessHelper.off('trashedPhotoChange', onCallback1);
2670  } catch (error) {
2671    console.error('offTrashedPhotoChangeDemo failed, errCode is', error);
2672  }
2673}
2674```
2675
2676### on('hiddenAlbumChange')<sup>20+</sup>
2677
2678on(type: 'hiddenAlbumChange', callback: Callback&lt;AlbumChangeInfos&gt;): void
2679
2680Registers a listener for the **'hiddenAlbumChange'** event to monitor hidden album changes. This API uses a callback to return the result, and it accepts multiple callbacks.
2681
2682**System API**: This is a system API.
2683
2684**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2685
2686**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
2687
2688**Parameters**
2689
2690| Name  | Type                  | Mandatory| Description     |
2691|-----------|-------------------------|-----------|-----------------|
2692| type | string | Yes  | Event type. The value is fixed at **'hiddenAlbumChange'**. After the registration is complete, any change to the hidden albums is returned through the callback.|
2693| callback  | Callback&lt;[AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20)&gt; | Yes  | Callback used to return the hidden album information after change, which is [AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20).<br>**NOTE**: You can register multiple listeners using this API, and you can call [off('hiddenAlbumChange')](#offhiddenalbumchange20) to unregister all listeners or a specific one.|
2694
2695**Error codes**
2696
2697For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2698
2699| ID| Error Message|
2700| -------- | ---------------------------------------- |
2701| 201 | Permission denied. |
2702| 202 | Called by non-system application. |
2703| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'hiddenAlbumChange'; 2. The same callback is registered repeatedly. |
2704| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2705
2706**Example**
2707
2708For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2709
2710```ts
2711import { dataSharePredicates } from '@kit.ArkData'
2712
2713let onCallback1 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2714    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2715  // file had changed, do something.
2716}
2717let onCallback2 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2718    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2719  // file had changed, do something.
2720}
2721
2722async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper){
2723  console.info('onHiddenAlbumChangeDemo.');
2724
2725  try {
2726    // Register onCallback1.
2727    phAccessHelper.on('hiddenAlbumChange', onCallback1);
2728    // Register onCallback2.
2729    phAccessHelper.on('hiddenAlbumChange', onCallback2);
2730  } catch (error) {
2731    console.error('onHiddenAlbumChangeDemo failed, errCode is', error);
2732  }
2733}
2734```
2735
2736### off('hiddenAlbumChange')<sup>20+</sup>
2737
2738off(type: 'hiddenAlbumChange', callback?: Callback&lt;AlbumChangeInfos&gt;): void
2739
2740Unregisters a listener for the **'hiddenAlbumChange'** event to stop monitoring hidden album changes. If multiple listeners are registered, you can unregister a specific listener by specifying **callback**. Alternatively, you can unregister all of them without specifying **callback**.
2741
2742**System API**: This is a system API.
2743
2744**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2745
2746**Required permissions**: ohos.permission.READ_IMAGEVIDEO and ohos.permission.MANAGE_PRIVATE_PHOTOS
2747
2748**Parameters**
2749
2750| Name  | Type                  | Mandatory| Description     |
2751|-----------|-------------------------|-----------|-----------------|
2752| type | string | Yes  | Event type. The value is fixed at **'hiddenAlbumChange'**. After the unregistration is complete, any change to the hidden albums is no longer returned through the callback.|
2753| callback | Callback&lt;[AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20)&gt; | No  | Exact callback you previously registered with [on('hiddenAlbumChange')](#onhiddenalbumchange20). If this parameter is left unspecified, all listeners for the **'hiddenAlbumChange'** event are unregistered.<br>**NOTE**: Once a specific callback is unregistered, it will not be invoked when a hidden album changes.|
2754
2755**Error codes**
2756
2757For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2758
2759| ID| Error Message|
2760| -------- | ---------------------------------------- |
2761| 201 | Permission denied. |
2762| 202 | Called by non-system application. |
2763| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'hiddenAlbumChange'; 2. The same callback is unregistered repeatedly. |
2764| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2765
2766**Example**
2767
2768For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2769
2770```ts
2771import { dataSharePredicates } from '@kit.ArkData'
2772
2773let onCallback1 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2774    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2775  // file had changed, do something.
2776}
2777let onCallback2 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2778    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2779  // file had changed, do something.
2780}
2781
2782async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper){
2783  console.info('onHiddenAlbumChangeDemo.');
2784
2785  try {
2786    // Register onCallback1.
2787    phAccessHelper.on('hiddenAlbumChange', onCallback1);
2788    // Register onCallback2.
2789    phAccessHelper.on('hiddenAlbumChange', onCallback2);
2790
2791    // Unregister the listening of onCallback1.
2792    phAccessHelper.off('hiddenAlbumChange', onCallback1);
2793  } catch (error) {
2794    console.error('onHiddenAlbumChangeDemo failed, errCode is', error);
2795  }
2796}
2797```
2798
2799### on('trashedAlbumChange')<sup>20+</sup>
2800
2801on(type: 'trashedAlbumChange', callback: Callback&lt;AlbumChangeInfos&gt;): void
2802
2803Registers a listener for the **'trashedAlbumChange'** event to monitor album changes in the trash. This API uses a callback to return the result, and it accepts multiple callbacks.
2804
2805**System API**: This is a system API.
2806
2807**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2808
2809**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2810
2811**Parameters**
2812
2813| Name  | Type                  | Mandatory| Description     |
2814|-----------|-------------------------|-----------|-----------------|
2815| type | string | Yes  | Event type. The value is fixed at **'trashedAlbumChange'**. After the registration is complete, any change to the trashed albums is returned through the callback.|
2816| callback  | Callback&lt;[AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20)&gt; | Yes  | Callback used to return the trashed album information after change, which is [AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20).<br>**NOTE**: You can register multiple listeners using this API, and you can call [off('trashedAlbumChange')](#offtrashedalbumchange20) to unregister all listeners or a specific one.|
2817
2818**Error codes**
2819
2820For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2821
2822| ID| Error Message|
2823| -------- | ---------------------------------------- |
2824| 201 | Permission denied. |
2825| 202 | Called by non-system application. |
2826| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'trashedAlbumChange'; 2. The same callback is registered repeatedly. |
2827| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2828
2829**Example**
2830
2831For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2832
2833```ts
2834import { dataSharePredicates } from '@kit.ArkData'
2835
2836let onCallback1 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2837    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2838  // file had changed, do something.
2839}
2840let onCallback2 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2841    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2842  // file had changed, do something.
2843}
2844
2845async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context){
2846  console.info('onTrashedAlbumChangeDemo.');
2847
2848  try {
2849    // Register onCallback1.
2850    phAccessHelper.on('trashedAlbumChange', onCallback1);
2851    // Register onCallback2.
2852    phAccessHelper.on('trashedAlbumChange', onCallback2);
2853  } catch (error) {
2854    console.error('onTrashedAlbumChangeDemo failed, errCode is', error);
2855  }
2856}
2857```
2858
2859### off('trashedAlbumChange')<sup>20+</sup>
2860
2861off(type: 'trashedAlbumChange', callback?: Callback&lt;AlbumChangeInfos&gt;): void
2862
2863Unregisters a listener for the **'trashedAlbumChange'** event to stop monitoring album changes in the trash. If multiple listeners are registered, you can unregister a specific listener by specifying **callback**. Alternatively, you can unregister all of them without specifying **callback**.
2864
2865**System API**: This is a system API.
2866
2867**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2868
2869**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2870
2871**Parameters**
2872
2873| Name  | Type                  | Mandatory| Description     |
2874|-----------|-------------------------|-----------|-----------------|
2875| type | string | Yes  | Event type. The value is fixed at **'trashedAlbumChange'**. After the unregistration is complete, any change to the trashed albums is no longer returned through the callback.|
2876| callback | Callback&lt;[AlbumChangeInfos](arkts-apis-photoAccessHelper-i.md#albumchangeinfos20)&gt; | No  | Exact callback you previously registered with [on('trashedAlbumChange')](#ontrashedalbumchange20). If this parameter is left unspecified, all listeners for the **'trashedAlbumChange'** event are unregistered.<br>**NOTE**: Once a specific callback is unregistered, it will not be invoked when an album in the trash changes.|
2877
2878**Error codes**
2879
2880For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2881
2882| ID| Error Message|
2883| -------- | ---------------------------------------- |
2884| 201 | Permission denied. |
2885| 202 | Called by non-system application. |
2886| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The type is not fixed at 'trashedAlbumChange'; 2. The same callback is unregistered repeatedly. |
2887| 23800301 | Internal system error. You are advised to retry and check the logs.<br>Possible causes: 1. The database is corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
2888
2889**Example**
2890
2891For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
2892
2893```ts
2894import { dataSharePredicates } from '@kit.ArkData'
2895
2896let onCallback1 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2897    console.info('onCallback1 success, changData: ' + JSON.stringify(changeData));
2898  // file had changed, do something.
2899}
2900let onCallback2 = (changeData: photoAccessHelper.AlbumChangeInfos) => {
2901    console.info('onCallback2 success, changData: ' + JSON.stringify(changeData));
2902  // file had changed, do something.
2903}
2904
2905async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context){
2906  console.info('onTrashedAlbumChangeDemo.');
2907
2908  try {
2909    // Register onCallback1.
2910    phAccessHelper.on('trashedAlbumChange', onCallback1);
2911    // Register onCallback2.
2912    phAccessHelper.on('trashedAlbumChange', onCallback2);
2913
2914    // Unregister the listening of onCallback1.
2915    phAccessHelper.off('trashedAlbumChange', onCallback1);
2916  } catch (error) {
2917    console.error('onTrashedAlbumChangeDemo failed, errCode is', error);
2918  }
2919}
2920```
2921
2922### getPhotoAlbums<sup>20+</sup>
2923
2924getPhotoAlbums(options?: FetchOptions): Promise&lt;FetchResult&lt;Album&gt;&gt;
2925
2926Obtains system, user, and source albums based on the specified options. This API uses a promise to return the result.
2927
2928Before the operation, ensure that the albums to obtain exist.
2929
2930**System API**: This is a system API.
2931
2932**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2933
2934**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2935
2936**Parameters**
2937
2938| Name   | Type               | Mandatory| Description                                                        |
2939| --------- | ------------------- | ---- | ------------------------------------------------------------ |
2940| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)         | No  |  Retrieval options. If this parameter is not specified, the albums are obtained based on the album type by default.             |
2941
2942**Return value**
2943
2944| Type                 | Description                       |
2945| --------------------- | --------------------------- |
2946| Promise&lt;[FetchResult](arkts-apis-photoAccessHelper-FetchResult.md)&lt;[Album](#album)&gt;&gt; | Promise used to return the result.|
2947
2948**Error codes**
2949
2950For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
2951
2952| ID| Error Message                                                    |
2953| -------- | ------------------------------------------------------------ |
2954| 201      | Permission denied.                                           |
2955| 202      | Called by non-system application.                            |
2956| 23800301 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
2957
2958
2959**Example**
2960
2961For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](arkts-apis-photoAccessHelper-f.md#photoaccesshelpergetphotoaccesshelper).
2962
2963```ts
2964import { dataSharePredicates } from '@kit.ArkData';
2965import { BusinessError } from '@kit.BasicServicesKit';
2966
2967async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
2968  console.info('getPhotoAlbumsDemo');
2969  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
2970  let fetchOptions: photoAccessHelper.FetchOptions = {
2971    fetchColumns: [],
2972    predicates: predicates
2973  };
2974  phAccessHelper.getPhotoAlbums(fetchOptions).then( async (fetchResult) => {
2975    if (fetchResult === undefined) {
2976      console.error('getPhotoAlbumsPromise fetchResult is undefined');
2977      return;
2978    }
2979    let albums: photoAccessHelper.Album[] = await fetchResult.getAllObjects();
2980    console.info(`getPhotoAlbumsPromise successfully, albums length: ${albums.length}`);
2981    fetchResult.close();
2982  }).catch((err: BusinessError) => {
2983    console.error(`getPhotoAlbumsPromise failed with err: ${err.code}, ${err.message}`);
2984  });
2985}
2986```
2987
2988### getPhotoAlbumOrder<sup>20+</sup>
2989
2990getPhotoAlbumOrder(orderStyle: number, options?: FetchOptions): Promise&lt;FetchResult&lt;AlbumOrder&gt;&gt;
2991
2992Obtains the sorting order for system, user, and source albums. This API uses a promise to return the result.
2993
2994**System API**: This is a system API.
2995
2996**Required permissions**: ohos.permission.READ_IMAGEVIDEO
2997
2998**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
2999
3000**Parameters**
3001
3002| Name   | Type               | Mandatory| Description                                                        |
3003| --------- | ------------------- | ---- | ------------------------------------------------------------ |
3004| orderStyle  | number         | Yes  |  Sorting style for albums.<br>The value **0** means the phone style, and **1** means the PC style.       |
3005| options  | [FetchOptions](arkts-apis-photoAccessHelper-i.md#fetchoptions)         | No  |  Retrieval options. If this parameter is not specified, the albums are obtained based on the album type by default.             |
3006
3007**Return value**
3008
3009| Type                 | Description                       |
3010| --------------------- | --------------------------- |
3011| Promise&lt;[FetchResult](arkts-apis-photoAccessHelper-FetchResult.md)&lt;[AlbumOrder](#albumorder20)&gt;&gt; | Promise used to return the sorting order.|
3012
3013**Error codes**
3014
3015For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
3016
3017| ID| Error Message                                                    |
3018| -------- | ------------------------------------------------------------ |
3019| 201      | Permission denied.                                           |
3020| 202      | Called by non-system application.                            |
3021| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The input parameter is not within the valid range. |
3022| 23800301 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
3023
3024**Example**
3025
3026For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](arkts-apis-photoAccessHelper-f.md#photoaccesshelpergetphotoaccesshelper).
3027
3028```ts
3029import { dataSharePredicates } from '@kit.ArkData';
3030import { BusinessError } from '@kit.BasicServicesKit';
3031
3032async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3033  console.info('getPhotoAlbumOrderDemo');
3034  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3035  let fetchOptions: photoAccessHelper.FetchOptions = {
3036    fetchColumns: [],
3037    predicates: predicates
3038  };
3039  let orderStyle: number = 0;
3040  phAccessHelper.getPhotoAlbumOrder(orderStyle, fetchOptions).then( async (fetchResult) => {
3041    if (fetchResult === undefined) {
3042      console.error('getPhotoAlbumOrderPromise fetchResult is undefined');
3043      return;
3044    }
3045    let albumOrders: photoAccessHelper.AlbumOrder[] = await fetchResult.getAllObjects();
3046    console.info(`getPhotoAlbumOrderPromise successfully, albumOrders length: ${albumOrders.length}`);
3047    fetchResult.close();
3048  }).catch((err: BusinessError) => {
3049    console.error(`getPhotoAlbumOrderPromise failed with err: ${err.code}, ${err.message}`);
3050  });
3051}
3052```
3053
3054### setPhotoAlbumOrder<sup>20+</sup>
3055
3056setPhotoAlbumOrder(orderStyle: number, albumOrders: Array&lt;AlbumOrder&gt;): Promise&lt;void&gt;
3057
3058Sets the sorting order for system, user, and source albums. This API uses a promise to return the result.
3059
3060**System API**: This is a system API.
3061
3062**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3063
3064**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3065
3066**Parameters**
3067
3068| Name   | Type               | Mandatory| Description                                                        |
3069| --------- | ------------------- | ---- | ------------------------------------------------------------ |
3070| orderStyle  | number         | Yes  |  Sorting style for albums.<br>The value **0** means the phone style, and **1** means the PC style.       |
3071| albumOrders | Array&lt;[AlbumOrder](#albumorder20)&gt; | Yes  | Array of album sorting orders.|
3072
3073**Return value**
3074
3075| Type                 | Description                       |
3076| --------------------- | --------------------------- |
3077| Promise&amp;lt;void&amp;gt;| Promise that returns no value.|
3078
3079**Error codes**
3080
3081For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
3082
3083| ID| Error Message                                                    |
3084| -------- | ------------------------------------------------------------ |
3085| 201      | Permission denied.                                           |
3086| 202      | Called by non-system application.                            |
3087| 23800151 | The scenario parameter verification fails.<br>Possible causes: 1. The input parameter is not within the valid range. |
3088| 23800301 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
3089
3090**Example**
3091
3092For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](arkts-apis-photoAccessHelper-f.md#photoaccesshelpergetphotoaccesshelper).
3093
3094```ts
3095import { dataSharePredicates } from '@kit.ArkData';
3096import { BusinessError } from '@kit.BasicServicesKit';
3097
3098async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3099  console.info('setPhotoAlbumOrderDemo');
3100  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3101  let fetchOptions: photoAccessHelper.FetchOptions = {
3102    fetchColumns: [],
3103    predicates: predicates
3104  };
3105  let orderStyle: number = 0;
3106  phAccessHelper.getPhotoAlbumOrder(orderStyle, fetchOptions).then( async (fetchResult) => {
3107    if (fetchResult === undefined) {
3108      console.error('getPhotoAlbumOrderPromise fetchResult is undefined');
3109      return;
3110    }
3111    let albumOrder: photoAccessHelper.AlbumOrder = await fetchResult.getFirstObject();
3112    albumOrder.albumOrder = 10;
3113    albumOrder.orderSection = 0;
3114    albumOrder.orderType = 1;
3115    albumOrder.orderStatus = 1;
3116    await phAccessHelper.setPhotoAlbumOrder(orderStyle, [albumOrder]);
3117    console.info('setPhotoAlbumOrderPromise successfully.');
3118    fetchResult.close();
3119  }).catch((err: BusinessError) => {
3120    console.error(`setPhotoAlbumOrderPromise failed with err: ${err.code}, ${err.message}`);
3121  });
3122}
3123```
3124
3125## PhotoAsset
3126
3127Provides APIs for encapsulating file asset attributes.
3128
3129### open<sup>(deprecated)</sup>
3130
3131open(mode: string, callback: AsyncCallback&lt;number&gt;): void
3132
3133Opens this file asset. This API uses an asynchronous callback to return the result.
3134
3135> **NOTE**
3136>
3137> This API is supported since API version 10 and deprecated since API version 11. For security purposes, the API for obtaining the media file handle is no longer provided.
3138
3139**NOTE**: A file can be opened in only one mode at a time. Use **close()** to close the FD returned when it is not required.
3140
3141**System API**: This is a system API.
3142
3143**Required permissions**: ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO
3144
3145**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3146
3147**Parameters**
3148
3149| Name     | Type                         | Mandatory  | Description                                 |
3150| -------- | --------------------------- | ---- | ----------------------------------- |
3151| mode     | string                      | Yes   | Mode for opening the file, which can be **'r'** (read-only), **'w'** (write-only), or **'rw'** (read/write).|
3152| callback | AsyncCallback&lt;number&gt; | Yes   | Callback used to return the file descriptor (FD) of the file opened.                           |
3153
3154**Error codes**
3155
3156For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3157
3158If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3159
3160| ID| Error Message|
3161| -------- | ---------------------------------------- |
3162| 202     |  Called by non-system application.         |
3163| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3164| 13900012     | Permission denied.         |
3165| 13900020     | Invalid argument.         |
3166| 14000011       | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.        |
3167
3168**Example**
3169
3170For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3171
3172```ts
3173async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3174  console.info('Open demo');
3175  let testFileName: string = 'testFile' + Date.now() + '.jpg';
3176  let photoAsset: photoAccessHelper.PhotoAsset = await phAccessHelper.createAsset(testFileName);
3177  photoAsset.open('rw', (err, fd) => {
3178    if (fd !== undefined) {
3179      console.info('File fd' + fd);
3180      photoAsset.close(fd);
3181    } else {
3182      console.error(`Open file err: ${err.code}, ${err.message}`);
3183    }
3184  });
3185}
3186```
3187
3188### open<sup>(deprecated)</sup>
3189
3190open(mode: string): Promise&lt;number&gt;
3191
3192Opens this file asset. This API uses a promise to return the result.
3193
3194> **NOTE**
3195>
3196> This API is supported since API version 10 and deprecated since API version 11. For security purposes, the API for obtaining the media file handle is no longer provided.
3197
3198**NOTE**: A file can be opened in only one mode at a time. Use **close()** to close the FD returned when it is not required.
3199
3200**System API**: This is a system API.
3201
3202**Required permissions**: ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO
3203
3204**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3205
3206**Parameters**
3207
3208| Name | Type    | Mandatory  | Description                                 |
3209| ---- | ------ | ---- | ----------------------------------- |
3210| mode | string | Yes   | Mode for opening the file, which can be **'r'** (read-only), **'w'** (write-only), or **'rw'** (read/write).|
3211
3212**Return value**
3213
3214| Type                   | Description           |
3215| --------------------- | ------------- |
3216| Promise&lt;number&gt; | Promise used to return the FD of the file opened.|
3217
3218**Error codes**
3219
3220For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3221
3222If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3223
3224| ID| Error Message|
3225| -------- | ---------------------------------------- |
3226| 202     |  Called by non-system application.         |
3227| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3228| 13900012     | Permission denied.         |
3229| 13900020     | Invalid argument.         |
3230| 14000011       | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.        |
3231
3232**Example**
3233
3234For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3235
3236```ts
3237async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3238  console.info('Open demo');
3239  try {
3240    let testFileName: string = 'testFile' + Date.now() + '.jpg';
3241    let photoAsset: photoAccessHelper.PhotoAsset = await phAccessHelper.createAsset(testFileName);
3242    let fd: number = await photoAsset.open('rw');
3243    if (fd !== undefined) {
3244      console.info('File fd' + fd);
3245      photoAsset.close(fd);
3246    } else {
3247      console.error('Open file fail');
3248    }
3249  } catch (err) {
3250    console.error(`Open demo err: ${err.code}, ${err.message}`);
3251  }
3252}
3253```
3254
3255### setFavorite<sup>(deprecated)</sup>
3256
3257setFavorite(favoriteState: boolean, callback: AsyncCallback&lt;void&gt;): void
3258
3259Favorites or unfavorites this file. This API uses an asynchronous callback to return the result.
3260
3261> **NOTE**
3262>
3263> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setFavorite](#setfavorite11) instead.
3264
3265**System API**: This is a system API.
3266
3267**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3268
3269**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3270
3271**Parameters**
3272
3273| Name       | Type                       | Mandatory  | Description                                |
3274| ---------- | ------------------------- | ---- | ---------------------------------- |
3275| favoriteState | boolean                   | Yes   | Whether to favorite the file asset. **true** to favorite, **false** otherwise.|
3276| callback   | AsyncCallback&lt;void&gt; | Yes   | Callback that returns no value.                             |
3277
3278**Error codes**
3279
3280For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3281
3282If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3283
3284| ID| Error Message|
3285| -------- | ---------------------------------------- |
3286| 201     | Permission denied.         |
3287| 202        |  Called by non-system application.         |
3288| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3289| 13900020     | Invalid argument.         |
3290| 14000011       | System inner fail.         |
3291
3292**Example**
3293
3294For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3295
3296```ts
3297import { dataSharePredicates } from '@kit.ArkData';
3298
3299async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3300  console.info('setFavoriteDemo');
3301  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3302  let fetchOption: photoAccessHelper.FetchOptions = {
3303    fetchColumns: [],
3304    predicates: predicates
3305  };
3306  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
3307  let asset = await fetchResult.getFirstObject();
3308  asset.setFavorite(true, (err) => {
3309    if (err === undefined) {
3310      console.info('favorite successfully');
3311    } else {
3312      console.error(`favorite failed with error: ${err.code}, ${err.message}`);
3313    }
3314  });
3315}
3316```
3317
3318### setFavorite<sup>(deprecated)</sup>
3319
3320setFavorite(favoriteState: boolean): Promise&lt;void&gt;
3321
3322Favorites or unfavorites this file asset. This API uses a promise to return the result.
3323
3324> **NOTE**
3325>
3326> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setFavorite](#setfavorite11) instead.
3327
3328**System API**: This is a system API.
3329
3330**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3331
3332**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3333
3334**Parameters**
3335
3336| Name       | Type     | Mandatory  | Description                                |
3337| ---------- | ------- | ---- | ---------------------------------- |
3338| favoriteState | boolean | Yes   | Whether to favorite the file asset. **true** to favorite, **false** otherwise.|
3339
3340**Return value**
3341
3342| Type                 | Description        |
3343| ------------------- | ---------- |
3344| Promise&lt;void&gt; | Promise that returns no value.|
3345
3346**Error codes**
3347
3348For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3349
3350If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3351
3352| ID| Error Message|
3353| -------- | ---------------------------------------- |
3354| 201     | Permission denied.         |
3355| 202        |  Called by non-system application.         |
3356| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3357| 13900020     | Invalid argument.         |
3358| 14000011       | System inner fail.         |
3359
3360**Example**
3361
3362For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3363
3364```ts
3365import { dataSharePredicates } from '@kit.ArkData';
3366import { BusinessError } from '@kit.BasicServicesKit';
3367
3368async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3369  console.info('setFavoriteDemo');
3370  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3371  let fetchOption: photoAccessHelper.FetchOptions = {
3372    fetchColumns: [],
3373    predicates: predicates
3374  };
3375  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
3376  let asset = await fetchResult.getFirstObject();
3377  asset.setFavorite(true).then(() => {
3378    console.info('setFavorite successfully');
3379  }).catch((err: BusinessError) => {
3380    console.error(`setFavorite failed with error: ${err.code}, ${err.message}`);
3381  });
3382}
3383```
3384
3385### setHidden<sup>(deprecated)</sup>
3386
3387setHidden(hiddenState: boolean, callback: AsyncCallback&lt;void&gt;): void
3388
3389Sets this file to hidden state. This API uses an asynchronous callback to return the result.
3390
3391Private files are stored in the private album. After obtaining private files from the private album, users can set **hiddenState** to **false** to remove them from the private album.
3392
3393> **NOTE**
3394>
3395> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setHidden](#sethidden11) instead.
3396
3397**System API**: This is a system API.
3398
3399**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3400
3401**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3402
3403**Parameters**
3404
3405| Name       | Type                       | Mandatory  | Description                                |
3406| ---------- | ------------------------- | ---- | ---------------------------------- |
3407| hiddenState | boolean                   | Yes   | Whether to set a file to hidden state. **true** to hide, **false** otherwise.|
3408| callback   | AsyncCallback&lt;void&gt; | Yes   | Callback that returns no value.                             |
3409
3410**Error codes**
3411
3412For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3413
3414If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3415
3416| ID| Error Message|
3417| -------- | ---------------------------------------- |
3418| 201     | Permission denied.         |
3419| 202        |  Called by non-system application.         |
3420| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3421| 13900020     | Invalid argument.         |
3422| 14000011       | System inner fail.         |
3423
3424**Example**
3425
3426For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3427
3428```ts
3429import { dataSharePredicates } from '@kit.ArkData';
3430
3431async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3432  console.info('setHiddenDemo');
3433  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3434  let fetchOption: photoAccessHelper.FetchOptions = {
3435    fetchColumns: [],
3436    predicates: predicates
3437  };
3438  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
3439  let asset = await fetchResult.getFirstObject();
3440  asset.setHidden(true, (err) => {
3441    if (err === undefined) {
3442      console.info('setHidden successfully');
3443    } else {
3444      console.error(`setHidden failed with error: ${err.code}, ${err.message}`);
3445    }
3446  });
3447}
3448```
3449
3450### setHidden<sup>(deprecated)</sup>
3451
3452setHidden(hiddenState: boolean): Promise&lt;void&gt;
3453
3454Sets this file asset to hidden state. This API uses a promise to return the result.
3455
3456Private files are stored in the private album. After obtaining private files from the private album, users can set **hiddenState** to **false** to remove them from the private album.
3457
3458> **NOTE**
3459>
3460> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setHidden](#sethidden11) instead.
3461
3462**System API**: This is a system API.
3463
3464**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3465
3466**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3467
3468**Parameters**
3469
3470| Name       | Type     | Mandatory  | Description                                |
3471| ---------- | ------- | ---- | ---------------------------------- |
3472| hiddenState | boolean | Yes   | Whether to set a file to hidden state. **true** to hide, **false** otherwise.|
3473
3474**Return value**
3475
3476| Type                 | Description        |
3477| ------------------- | ---------- |
3478| Promise&lt;void&gt; | Promise that returns no value.|
3479
3480**Error codes**
3481
3482For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3483
3484If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3485
3486| ID| Error Message|
3487| -------- | ---------------------------------------- |
3488| 201     | Permission denied.         |
3489| 202        |  Called by non-system application.         |
3490| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3491| 13900020     | Invalid argument.         |
3492| 14000011       | System inner fail.         |
3493
3494**Example**
3495
3496For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3497
3498```ts
3499import { dataSharePredicates } from '@kit.ArkData';
3500import { BusinessError } from '@kit.BasicServicesKit';
3501
3502async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3503  // Restore a file from a hidden album. Before the operation, ensure that the file exists in the hidden album.
3504  console.info('setHiddenDemo');
3505  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3506  let fetchOption: photoAccessHelper.FetchOptions = {
3507    fetchColumns: [],
3508    predicates: predicates
3509  };
3510  let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.HIDDEN);
3511  let album = await albumList.getFirstObject();
3512  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
3513  let asset = await fetchResult.getFirstObject();
3514  asset.setHidden(false).then(() => {
3515    console.info('setHidden successfully');
3516  }).catch((err: BusinessError) => {
3517    console.error(`setHidden failed with error: ${err.code}, ${err.message}`);
3518  });
3519}
3520```
3521
3522### getExif
3523
3524getExif(): Promise&lt;string&gt;
3525
3526Obtains the exchangeable image file format (EXIF) data from a JPG image. This API uses a promise to return the result.
3527
3528The EXIF information obtained are provided by the [image](../apis-image-kit/arkts-apis-image.md) module. For details about the EXIF information, see [image.PropertyKey](../apis-image-kit/arkts-apis-image-e.md#propertykey7).
3529
3530**NOTE**: This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and [PhotoKeys.USER_COMMENT](#photokeys). These two fields must be passed in via **fetchColumns**.
3531
3532**System API**: This is a system API.
3533
3534**Required permissions**: ohos.permission.READ_IMAGEVIDEO
3535
3536**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3537
3538**Return value**
3539
3540| Type                                   | Description             |
3541| --------------------------------------- | ----------------- |
3542| Promise&lt;string&gt; | Promise used to return the EXIF data, in JSON strings.|
3543
3544**Error codes**
3545
3546For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3547
3548If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3549
3550| ID| Error Message|
3551| -------- | ---------------------------------------- |
3552| 202        |  Called by non-system application.         |
3553| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3554| 13900012     | Permission denied.         |
3555| 13900020     | Invalid argument.         |
3556| 14000011       | System inner fail.         |
3557
3558**Example**
3559
3560For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3561
3562```ts
3563import { dataSharePredicates } from '@kit.ArkData';
3564
3565async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3566  try {
3567    console.info('getExifDemo');
3568    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3569    let fetchOptions: photoAccessHelper.FetchOptions = {
3570      fetchColumns: [ 'all_exif',  photoAccessHelper.PhotoKeys.USER_COMMENT],
3571      predicates: predicates
3572    };
3573    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
3574    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
3575    let exifMessage = await photoAsset.getExif();
3576    let userCommentKey = 'UserComment';
3577    let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
3578    console.info('getExifDemo userComment: ' + JSON.stringify(userComment));
3579    fetchResult.close();
3580  } catch (err) {
3581    console.error(`getExifDemoCallback failed with error: ${err.code}, ${err.message}`);
3582  }
3583}
3584```
3585
3586### getExif
3587
3588getExif(callback: AsyncCallback&lt;string&gt;): void
3589
3590Obtains the exchangeable image file format (EXIF) data from a JPG image. This API uses an asynchronous callback to return the result.
3591
3592The EXIF information obtained are provided by the [image](../apis-image-kit/arkts-apis-image.md) module. For details about the EXIF information, see [image.PropertyKey](../apis-image-kit/arkts-apis-image-e.md#propertykey7).
3593
3594**NOTE**: This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and [PhotoKeys.USER_COMMENT](#photokeys). These two fields must be passed in via **fetchColumns**.
3595
3596**System API**: This is a system API.
3597
3598**Required permissions**: ohos.permission.READ_IMAGEVIDEO
3599
3600**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3601
3602**Parameters**
3603
3604| Name  | Type                     | Mandatory| Description      |
3605| -------- | ------------------------- | ---- | ---------- |
3606| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the EXIF data, in JSON strings.|
3607
3608**Error codes**
3609
3610For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3611
3612If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3613
3614| ID| Error Message|
3615| -------- | ---------------------------------------- |
3616| 202        |  Called by non-system application.         |
3617| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3618| 13900012     | Permission denied.         |
3619| 13900020     | Invalid argument.         |
3620| 14000011       | System inner fail.         |
3621
3622**Example**
3623
3624For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3625
3626```ts
3627import { dataSharePredicates } from '@kit.ArkData';
3628
3629async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3630  try {
3631    console.info('getExifDemo');
3632    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3633    predicates.isNotNull('all_exif')
3634    let fetchOptions: photoAccessHelper.FetchOptions = {
3635      fetchColumns: ['all_exif', photoAccessHelper.PhotoKeys.USER_COMMENT],
3636      predicates: predicates
3637    };
3638    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
3639    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
3640    console.info('getExifDemo photoAsset displayName: ' + JSON.stringify(photoAsset.displayName));
3641    let userCommentKey = 'UserComment';
3642    photoAsset.getExif((err, exifMessage) => {
3643      if (exifMessage !== undefined) {
3644        let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
3645        console.info('getExifDemo userComment: ' + JSON.stringify(userComment));
3646      } else {
3647        console.error(`getExif failed, error: ${err.code}, ${err.message}`);
3648      }
3649    });
3650    fetchResult.close();
3651  } catch (err) {
3652    console.error(`getExifDemoCallback failed with error: ${err.code}, ${err.message}`);
3653  }
3654}
3655```
3656
3657### setUserComment<sup>(deprecated)</sup>
3658
3659setUserComment(userComment: string): Promise&lt;void&gt;
3660
3661Sets user comment information of an image or video. This API uses a promise to return the result.
3662
3663> **NOTE**
3664>
3665> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setUserComment](#setusercomment11) instead.
3666
3667**NOTE**: This API can be used to modify the comment information of only images or videos.
3668
3669**System API**: This is a system API.
3670
3671**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3672
3673**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3674
3675**Parameters**
3676
3677| Name  | Type                     | Mandatory| Description      |
3678| -------- | ------------------------- | ---- | ---------- |
3679| userComment | string | Yes  | User comment information to set, which cannot exceed 420 characters.|
3680
3681**Return value**
3682
3683| Type                                   | Description             |
3684| --------------------------------------- | ----------------- |
3685|Promise&lt;void&gt; | Promise that returns no value.|
3686
3687**Error codes**
3688
3689For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3690
3691If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3692
3693| ID| Error Message|
3694| -------- | ---------------------------------------- |
3695| 201     | Permission denied.         |
3696| 202        |  Called by non-system application.         |
3697| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3698| 13900020     | Invalid argument.         |
3699| 14000011       | System inner fail.         |
3700
3701**Example**
3702
3703For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3704
3705```ts
3706import { dataSharePredicates } from '@kit.ArkData';
3707
3708async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3709  try {
3710    console.info('setUserCommentDemo')
3711    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3712    let fetchOptions: photoAccessHelper.FetchOptions = {
3713      fetchColumns: [],
3714      predicates: predicates
3715    };
3716    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
3717    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
3718    let userComment = 'test_set_user_comment';
3719    await photoAsset.setUserComment(userComment);
3720  } catch (err) {
3721    console.error(`setUserCommentDemoPromise failed with error: ${err.code}, ${err.message}`);
3722  }
3723}
3724```
3725
3726### setUserComment<sup>(deprecated)</sup>
3727
3728setUserComment(userComment: string, callback: AsyncCallback&lt;void&gt;): void
3729
3730Sets user comment information of an image or video. This API uses an asynchronous callback to return the result.
3731
3732> **NOTE**
3733>
3734> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAssetChangeRequest.setUserComment](#setusercomment11) instead.
3735
3736**NOTE**: This API can be used to modify the comment information of only images or videos.
3737
3738**System API**: This is a system API.
3739
3740**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3741
3742**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3743
3744**Parameters**
3745
3746| Name  | Type                     | Mandatory| Description      |
3747| -------- | ------------------------- | ---- | ---------- |
3748| userComment | string | Yes  | User comment information to set, which cannot exceed 420 characters.|
3749| callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
3750
3751**Error codes**
3752
3753For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3754
3755If error code 201 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
3756
3757| ID| Error Message|
3758| -------- | ---------------------------------------- |
3759| 201     | Permission denied.         |
3760| 202        |  Called by non-system application.         |
3761| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3762| 13900020     | Invalid argument.         |
3763| 14000011       | System inner fail.         |
3764
3765**Example**
3766
3767For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3768
3769```ts
3770import { dataSharePredicates } from '@kit.ArkData';
3771
3772async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3773  try {
3774    console.info('setUserCommentDemo')
3775    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3776    let fetchOptions: photoAccessHelper.FetchOptions = {
3777      fetchColumns: [],
3778      predicates: predicates
3779    };
3780    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
3781    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
3782    let userComment = 'test_set_user_comment';
3783    photoAsset.setUserComment(userComment, (err) => {
3784      if (err === undefined) {
3785        console.info('setUserComment successfully');
3786      } else {
3787        console.error(`setUserComment failed with error: ${err.code}, ${err.message}`);
3788      }
3789    });
3790  } catch (err) {
3791    console.error(`setUserCommentDemoCallback failed with error: ${err.code}, ${err.message}`);
3792  }
3793}
3794```
3795
3796### setPending<sup>11+</sup>
3797
3798setPending(pendingState: boolean, callback: AsyncCallback&lt;void&gt;): void
3799
3800Sets the pending state for this image or video asset. This API uses an asynchronous callback to return the result.
3801
3802The pending state can be removed only through **setPending(false)**. You can use **photoAsset.get(photoAccessHelper.PhotoKeys.PENDING)** to check whether the asset state is pending. If the asset is in pending state, **true** is returned. Otherwise, **false** is returned.
3803
3804**NOTE**: **setPending** can be used only during the file creation process. Once the FD is closed, **setPending(true)** cannot be used to set the pending state for the file.
3805
3806**System API**: This is a system API.
3807
3808**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3809
3810**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3811
3812**Parameters**
3813
3814| Name       | Type     | Mandatory  | Description                                |
3815| ---------- | ------- | ---- | ---------------------------------- |
3816| pendingState | boolean | Yes   | Whether to set the file to pending state. **true** to pend, **false** otherwise.|
3817| callback | AsyncCallback&lt;void&gt; | Yes   | Callback that returns no value.|
3818
3819**Error codes**
3820
3821For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3822
3823| ID| Error Message|
3824| -------- | ---------------------------------------- |
3825| 201   | Permission denied.        |
3826| 202   | Called by non-system application.         |
3827| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3828| 14000011   | System inner fail.        |
3829
3830**Example**
3831
3832For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3833
3834```ts
3835async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3836  try {
3837    console.info('setPendingCallbackDemo');
3838    let testFileName: string = 'testFile' + Date.now() + '.jpg';
3839    let photoAsset = await phAccessHelper.createAsset(testFileName);
3840    photoAsset.setPending(true, async (err) => {
3841      if (err !== undefined) {
3842        console.error(`setPending(true) failed with error: ${err.code}, ${err.message}`);
3843        return;
3844      }
3845      // add asset resource.
3846      photoAsset.setPending(false, async (err) => {
3847        if (err !== undefined) {
3848          console.error(`setPending(false) failed with error: ${err.code}, ${err.message}`);
3849          return;
3850        }
3851      });
3852    });
3853  } catch (err) {
3854    console.error(`setPendingCallbackDemo failed with error: ${err.code}, ${err.message}`);
3855  }
3856}
3857```
3858
3859### setPending<sup>11+</sup>
3860
3861setPending(pendingState: boolean): Promise&lt;void&gt;
3862
3863Sets the pending state for this image or video asset. This API uses a promise to return the result.
3864
3865The pending state can be removed only through **setPending(false)**. You can use **photoAsset.get(photoAccessHelper.PhotoKeys.PENDING)** to check whether the asset state is pending. If the asset is in pending state, **true** is returned. Otherwise, **false** is returned.
3866
3867**NOTE**: **setPending** can be used only during the file creation process. Once the FD is closed, **setPending(true)** cannot be used to set the pending state for the file.
3868
3869**System API**: This is a system API.
3870
3871**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
3872
3873**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3874
3875**Parameters**
3876
3877| Name       | Type     | Mandatory  | Description                                |
3878| ---------- | ------- | ---- | ---------------------------------- |
3879| pendingState | boolean | Yes   | Whether to set the file to pending state. **true** to pend, **false** otherwise.|
3880
3881**Return value**
3882
3883| Type                                   | Description             |
3884| --------------------------------------- | ----------------- |
3885|Promise&lt;boolean&gt; | Promise that returns no value.|
3886
3887**Error codes**
3888
3889For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3890
3891| ID| Error Message|
3892| -------- | ---------------------------------------- |
3893| 201   | Permission denied.        |
3894| 202   | Called by non-system application.         |
3895| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
3896| 14000011   | System inner fail.        |
3897
3898**Example**
3899
3900For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3901
3902```ts
3903async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3904  try {
3905    console.info('setPendingPromiseDemo');
3906    let testFileName: string = 'testFile' + Date.now() + '.jpg';
3907    let photoAsset = await phAccessHelper.createAsset(testFileName);
3908    await photoAsset.setPending(true);
3909    // add asset resource.
3910    photoAsset.setPending(false);
3911  } catch (err) {
3912    console.error(`setPendingPromiseDemo failed with error: ${err.code}, ${err.message}`);
3913  }
3914}
3915```
3916
3917### isEdited<sup>11+</sup>
3918
3919isEdited(callback: AsyncCallback&lt;boolean&gt;): void
3920
3921Checks whether this image or video asset is edited. This API uses an asynchronous callback to return the result.
3922
3923**System API**: This is a system API.
3924
3925**Required permissions**: ohos.permission.READ_IMAGEVIDEO
3926
3927**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3928
3929**Parameters**
3930
3931| Name       | Type     | Mandatory  | Description                                |
3932| ---------- | ------- | ---- | ---------------------------------- |
3933| callback | AsyncCallback&lt;boolean&gt; | Yes   | Callback used to return the result indicating whether the image or video asset is edited. **true** if edited, **false** otherwise. The default value is **false**.|
3934
3935**Error codes**
3936
3937For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
3938
3939| ID| Error Message|
3940| -------- | ---------------------------------------- |
3941| 201   | Permission denied.        |
3942| 202   | Called by non-system application.         |
3943| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3944| 14000011   | System inner fail.        |
3945
3946**Example**
3947
3948For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
3949
3950```ts
3951import { dataSharePredicates } from '@kit.ArkData';
3952
3953async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
3954  try {
3955    console.info('isEditedCallbackDemo')
3956    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
3957    let fetchOptions: photoAccessHelper.FetchOptions = {
3958      fetchColumns: [],
3959      predicates: predicates
3960    };
3961    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
3962    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
3963    photoAsset.isEdited((err, isEdited) => {
3964      if (err === undefined) {
3965        if (isEdited === true) {
3966          console.info('Photo is edited');
3967        } else {
3968          console.info('Photo is not edited');
3969        }
3970      } else {
3971        console.error(`isEdited failed with error: ${err.code}, ${err.message}`);
3972      }
3973    });
3974  } catch (err) {
3975    console.error(`isEditedDemoCallback failed with error: ${err.code}, ${err.message}`);
3976  }
3977}
3978```
3979
3980### isEdited<sup>11+</sup>
3981
3982isEdited(): Promise&lt;boolean&gt;
3983
3984Checks whether this image or video asset is edited. This API uses a promise to return the result.
3985
3986**System API**: This is a system API.
3987
3988**Required permissions**: ohos.permission.READ_IMAGEVIDEO
3989
3990**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
3991
3992**Return value**
3993
3994| Type                                   | Description             |
3995| --------------------------------------- | ----------------- |
3996|Promise&lt;boolean&gt; | Promise used to return the result indicating whether the image or video asset is edited. **true** if edited, **false** otherwise. The default value is **false**.|
3997
3998
3999**Error codes**
4000
4001For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4002
4003| ID| Error Message|
4004| -------- | ---------------------------------------- |
4005| 201   | Permission denied.        |
4006| 202   | Called by non-system application.         |
4007| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4008| 14000011   | System inner fail.        |
4009
4010**Example**
4011
4012For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4013
4014```ts
4015import { dataSharePredicates } from '@kit.ArkData';
4016
4017async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4018  try {
4019    console.info('isEditedPromiseDemo')
4020    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4021    let fetchOptions: photoAccessHelper.FetchOptions = {
4022      fetchColumns: [],
4023      predicates: predicates
4024    };
4025    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4026    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4027    let isEdited = await photoAsset.isEdited();
4028    if (isEdited === true) {
4029      console.info('Photo is edited');
4030    } else {
4031      console.info('Photo is not edited');
4032    }
4033  } catch (err) {
4034    console.error(`isEditedDemoCallback failed with error: ${err.code}, ${err.message}`);
4035  }
4036}
4037```
4038
4039### requestEditData<sup>11+</sup>
4040
4041requestEditData(callback: AsyncCallback&lt;string&gt;): void
4042
4043Obtains the edit data of this image or video asset. This API uses an asynchronous callback to return the result.
4044
4045If the asset has never been edited, an empty string is returned.
4046
4047**System API**: This is a system API.
4048
4049**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4050
4051**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4052
4053**Parameters**
4054
4055| Name       | Type     | Mandatory  | Description                                |
4056| ---------- | ------- | ---- | ---------------------------------- |
4057| callback | AsyncCallback&lt;string&gt; | Yes   | Callback used to return the edit data obtained.|
4058
4059**Error codes**
4060
4061For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4062
4063| ID| Error Message|
4064| -------- | ---------------------------------------- |
4065| 201   | Permission denied.        |
4066| 202   | Called by non-system application.         |
4067| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4068| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4069
4070**Example**
4071
4072For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4073
4074```ts
4075import { dataSharePredicates } from '@kit.ArkData';
4076
4077async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4078  try {
4079    console.info('requestEditDataCallbackDemo')
4080    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4081    let fetchOptions: photoAccessHelper.FetchOptions = {
4082      fetchColumns: [],
4083      predicates: predicates
4084    };
4085    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4086    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4087    photoAsset.requestEditData((err, editdata) => {
4088      if (err === undefined) {
4089        console.info('Editdata is ' + editdata);
4090      } else {
4091        console.error(`requestEditData failed with error: ${err.code}, ${err.message}`);
4092      }
4093    });
4094  } catch (err) {
4095    console.error(`requestEditDataCallbackDemo failed with error: ${err.code}, ${err.message}`);
4096  }
4097}
4098```
4099
4100### requestEditData<sup>11+</sup>
4101
4102requestEditData(): Promise&lt;string&gt;
4103
4104Obtains the edit data of this image or video asset. This API uses a promise to return the result.
4105
4106If the asset has never been edited, an empty string is returned.
4107
4108**System API**: This is a system API.
4109
4110**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4111
4112**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4113
4114**Return value**
4115
4116| Type                                   | Description             |
4117| --------------------------------------- | ----------------- |
4118|Promise&lt;string&gt; | Promise used to return the edit data obtained.|
4119
4120
4121**Error codes**
4122
4123For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4124
4125| ID| Error Message|
4126| -------- | ---------------------------------------- |
4127| 201   | Permission denied.        |
4128| 202   | Called by non-system application.         |
4129| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4130| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4131
4132**Example**
4133
4134For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4135
4136```ts
4137import { dataSharePredicates } from '@kit.ArkData';
4138
4139async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4140  try {
4141    console.info('requestEditDataPromiseDemo')
4142    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4143    let fetchOptions: photoAccessHelper.FetchOptions = {
4144      fetchColumns: [],
4145      predicates: predicates
4146    };
4147    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4148    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4149    let editdata: string = await photoAsset.requestEditData();
4150    console.info('Editdata is ' + editdata);
4151  } catch (err) {
4152    console.error(`requestEditDataPromiseDemo failed with error: ${err.code}, ${err.message}`);
4153  }
4154}
4155```
4156
4157### getEditData<sup>11+</sup>
4158
4159getEditData(): Promise&lt;MediaAssetEditData&gt;
4160
4161Obtains the edited data of this asset. This API uses a promise to return the result.
4162
4163If the asset has never been edited, an empty string is returned.
4164
4165**System API**: This is a system API.
4166
4167**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4168
4169**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4170
4171**Return value**
4172
4173| Type                                   | Description             |
4174| --------------------------------------- | ----------------- |
4175|Promise&lt;[MediaAssetEditData](#mediaasseteditdata11)&gt; | Promise used to return the edited asset data.|
4176
4177**Error codes**
4178
4179For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4180
4181| ID| Error Message|
4182| -------- | ---------------------------------------- |
4183| 201   | Permission denied.        |
4184| 202   | Called by non-system application.         |
4185| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4186| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4187
4188**Example**
4189
4190For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4191
4192```ts
4193import { dataSharePredicates } from '@kit.ArkData';
4194
4195async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4196  try {
4197    console.info('getEditDataDemo')
4198    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4199    let fetchOptions: photoAccessHelper.FetchOptions = {
4200      fetchColumns: [],
4201      predicates: predicates
4202    };
4203    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4204    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4205    let assetEditData: photoAccessHelper.MediaAssetEditData = await photoAsset.getEditData();
4206    let data: string = assetEditData.data;
4207    console.info('edit data is ' + data);
4208  } catch (err) {
4209    console.error(`getEditDataDemo failed with error: ${err.code}, ${err.message}`);
4210  }
4211}
4212```
4213
4214### requestSource<sup>11+</sup>
4215
4216requestSource(callback: AsyncCallback&lt;number&gt;): void
4217
4218Opens the source file to obtain the FD. This API uses an asynchronous callback to return the result.
4219
4220**System API**: This is a system API.
4221
4222**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4223
4224**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4225
4226**Parameters**
4227
4228| Name       | Type     | Mandatory  | Description                                |
4229| ---------- | ------- | ---- | ---------------------------------- |
4230| callback | AsyncCallback&lt;number&gt; | Yes   | Callback used to return the FD.|
4231
4232**Error codes**
4233
4234For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4235
4236| ID| Error Message|
4237| -------- | ---------------------------------------- |
4238| 201   | Permission denied.        |
4239| 202   | Called by non-system application.         |
4240| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4241| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4242
4243**Example**
4244
4245For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4246
4247```ts
4248import { dataSharePredicates } from '@kit.ArkData';
4249
4250async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4251  try {
4252    console.info('requestSourceCallbackDemo')
4253    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4254    let fetchOptions: photoAccessHelper.FetchOptions = {
4255      fetchColumns: [],
4256      predicates: predicates
4257    };
4258    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4259    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4260    photoAsset.requestSource((err, fd) => {
4261      if (err === undefined) {
4262        console.info('Source fd is ' + fd);
4263      } else {
4264        console.error(`requestSource failed with error: ${err.code}, ${err.message}`);
4265      }
4266    });
4267  } catch (err) {
4268    console.error(`requestSourceCallbackDemo failed with error: ${err.code}, ${err.message}`);
4269  }
4270}
4271```
4272
4273### requestSource<sup>11+</sup>
4274
4275requestSource(): Promise&lt;number&gt;
4276
4277Opens the source file to obtain the FD. This API uses a promise to return the result.
4278
4279**System API**: This is a system API.
4280
4281**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4282
4283**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4284
4285**Return value**
4286
4287| Type                                   | Description             |
4288| --------------------------------------- | ----------------- |
4289|Promise&lt;number&gt; | Promise used to return the FD.|
4290
4291**Error codes**
4292
4293For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4294
4295| ID| Error Message|
4296| -------- | ---------------------------------------- |
4297| 201   | Permission denied.        |
4298| 202   | Called by non-system application.         |
4299| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4300| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4301
4302**Example**
4303
4304For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4305
4306```ts
4307import { dataSharePredicates } from '@kit.ArkData';
4308
4309async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4310  try {
4311    console.info('requestSourcePromiseDemo')
4312    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4313    let fetchOptions: photoAccessHelper.FetchOptions = {
4314      fetchColumns: [],
4315      predicates: predicates
4316    };
4317    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4318    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4319    let fd = await photoAsset.requestSource();
4320    console.info('Source fd is ' + fd);
4321  } catch (err) {
4322    console.error(`requestSourcePromiseDemo failed with error: ${err.code}, ${err.message}`);
4323  }
4324}
4325```
4326
4327### commitEditedAsset<sup>11+</sup>
4328
4329commitEditedAsset(editData: string, uri: string, callback: AsyncCallback&lt;void&gt;)
4330
4331Commits the edited image or video asset. This API uses an asynchronous callback to return the result.
4332
4333The edited file is transferred to the media library based on the URI, which is **FileUri** of the edited file in the application sandbox directory. For details, see [File URI](../apis-core-file-kit/js-apis-file-fileuri.md).
4334
4335**NOTE**: The commit operation overwrites the previous edited data.
4336
4337**System API**: This is a system API.
4338
4339**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
4340
4341**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4342
4343**Parameters**
4344
4345| Name       | Type     | Mandatory  | Description                                |
4346| ---------- | ------- | ---- | ---------------------------------- |
4347| editData | string | Yes   | New data to commit.|
4348| uri | string | Yes   | URI of the committed image or video in the application sandbox.|
4349| callback | AsyncCallback&lt;void&gt; | Yes   | Callback that returns no value.|
4350
4351**Error codes**
4352
4353For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4354
4355| ID| Error Message|
4356| -------- | ---------------------------------------- |
4357| 201   | Permission denied.        |
4358| 202   | Called by non-system application.         |
4359| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4360| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4361
4362**Example**
4363
4364For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4365
4366```ts
4367import { dataSharePredicates } from '@kit.ArkData';
4368
4369async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4370  try {
4371    console.info('commitEditedAssetCallbackDemo')
4372    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4373    let fetchOptions: photoAccessHelper.FetchOptions = {
4374      fetchColumns: [],
4375      predicates: predicates
4376    };
4377    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4378    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4379    let editData = '123456';
4380    let uri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/test.jpg';
4381    photoAsset.commitEditedAsset(editData, uri, (err) => {
4382      if (err === undefined) {
4383        console.info('commitEditedAsset is successful');
4384      } else {
4385        console.error(`commitEditedAsset failed with error: ${err.code}, ${err.message}`);
4386      }
4387    });
4388  } catch (err) {
4389    console.error(`commitEditedAssetCallbackDemo failed with error: ${err.code}, ${err.message}`);
4390  }
4391}
4392```
4393
4394### commitEditedAsset<sup>11+</sup>
4395
4396commitEditedAsset(editData: string, uri: string): Promise&lt;void&gt;
4397
4398Commits the edited image or video asset. This API uses a promise to return the result.
4399
4400The edited file is transferred to the media library based on the URI, which is **FileUri** of the edited file in the application sandbox directory. For details, see [File URI](../apis-core-file-kit/js-apis-file-fileuri.md).
4401
4402**NOTE**: The commit operation overwrites the previous edited data.
4403
4404**System API**: This is a system API.
4405
4406**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
4407
4408**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4409
4410**Parameters**
4411
4412| Name       | Type     | Mandatory  | Description                                |
4413| ---------- | ------- | ---- | ---------------------------------- |
4414| editData | string | Yes   | New data to commit.|
4415| uri | string | Yes   | URI of the committed image or video in the application sandbox.|
4416
4417**Return value**
4418
4419| Type                                   | Description             |
4420| --------------------------------------- | ----------------- |
4421|Promise&lt;void&gt; | Promise that returns no value.|
4422
4423**Error codes**
4424
4425For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4426
4427| ID| Error Message|
4428| -------- | ---------------------------------------- |
4429| 201   | Permission denied.        |
4430| 202   | Called by non-system application.         |
4431| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4432| 14000011   | System inner fail. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.       |
4433
4434**Example**
4435
4436For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4437
4438```ts
4439import { dataSharePredicates } from '@kit.ArkData';
4440
4441async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4442  try {
4443    console.info('commitEditedAssetPromiseDemo')
4444    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4445    let fetchOptions: photoAccessHelper.FetchOptions = {
4446      fetchColumns: [],
4447      predicates: predicates
4448    };
4449    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4450    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4451    let editData = '123456';
4452    let uri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/test.jpg';
4453    await photoAsset.commitEditedAsset(editData, uri);
4454    console.info('commitEditedAsset is successful');
4455  } catch (err) {
4456    console.error(`commitEditedAssetPromiseDemo failed with error: ${err.code}, ${err.message}`);
4457  }
4458}
4459```
4460
4461### revertToOriginal<sup>11+</sup>
4462
4463revertToOriginal(callback: AsyncCallback&lt;void&gt;)
4464
4465Reverts to the state of the file before being edited. This API uses an asynchronous callback to return the result.
4466
4467**NOTE**: This API deletes the edited data and edited image or video asset, and the deleted data cannot be restored. Exercise caution when using this API.
4468
4469**System API**: This is a system API.
4470
4471**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
4472
4473**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4474
4475**Parameters**
4476
4477| Name       | Type     | Mandatory  | Description                                |
4478| ---------- | ------- | ---- | ---------------------------------- |
4479| callback | AsyncCallback&lt;void&gt; | Yes   | Callback that returns no value.|
4480
4481**Error codes**
4482
4483For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4484
4485| ID| Error Message|
4486| -------- | ---------------------------------------- |
4487| 201   | Permission denied.        |
4488| 202   | Called by non-system application.         |
4489| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4490| 14000011   | System inner fail.        |
4491
4492**Example**
4493
4494For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4495
4496```ts
4497import { dataSharePredicates } from '@kit.ArkData';
4498
4499async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4500  try {
4501    console.info('revertToOriginalCallbackDemo')
4502    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4503    let fetchOptions: photoAccessHelper.FetchOptions = {
4504      fetchColumns: [],
4505      predicates: predicates
4506    };
4507    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4508    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4509    photoAsset.revertToOriginal((err) => {
4510      if (err === undefined) {
4511        console.info('revertToOriginal is successful');
4512      } else {
4513        console.error(`revertToOriginal failed with error: ${err.code}, ${err.message}`);
4514      }
4515    });
4516  } catch (err) {
4517    console.error(`revertToOriginalCallbackDemo failed with error: ${err.code}, ${err.message}`);
4518  }
4519}
4520```
4521
4522### revertToOriginal<sup>11+</sup>
4523
4524revertToOriginal(): Promise&lt;void&gt;
4525
4526Reverts to the state of the file before being edited. This API uses a promise to return the result.
4527
4528**NOTE**: This API deletes the edited data and edited image or video asset, and the deleted data cannot be restored. Exercise caution when using this API.
4529
4530**System API**: This is a system API.
4531
4532**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
4533
4534**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4535
4536**Return value**
4537
4538| Type                                   | Description             |
4539| --------------------------------------- | ----------------- |
4540|Promise&lt;string&gt; | Promise that returns no value.|
4541
4542**Error codes**
4543
4544For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4545
4546| ID| Error Message|
4547| -------- | ---------------------------------------- |
4548| 201   | Permission denied.        |
4549| 202   | Called by non-system application.         |
4550| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4551| 14000011   | System inner fail.        |
4552
4553**Example**
4554
4555For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4556
4557```ts
4558import { dataSharePredicates } from '@kit.ArkData';
4559
4560async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4561  try {
4562    console.info('revertToOriginalPromiseDemo')
4563    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4564    let fetchOptions: photoAccessHelper.FetchOptions = {
4565      fetchColumns: [],
4566      predicates: predicates
4567    };
4568    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
4569    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4570    photoAsset.revertToOriginal();
4571    console.info('revertToOriginal is successful');
4572  } catch (err) {
4573    console.error(`revertToOriginalPromiseDemo failed with error: ${err.code}, ${err.message}`);
4574  }
4575}
4576```
4577
4578### requestPhoto<sup>11+</sup>
4579
4580requestPhoto(callback: AsyncCallback&lt;image.PixelMap&gt;): string
4581
4582Obtains the quick thumbnail and quality thumbnail of this asset. This API uses an asynchronous callback to return the result.
4583
4584The size of a quick thumbnail is 128 x 128, and the size of a quality thumbnail is 256 x 256. After this API is called, the callback will be invoked twice to return a quick thumbnail and a quality thumbnail in sequence.
4585
4586**System API**: This is a system API.
4587
4588**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4589
4590**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4591
4592**Parameters**
4593
4594| Name       | Type     | Mandatory  | Description                                |
4595| ---------- | ------- | ---- | ---------------------------------- |
4596| callback | AsyncCallback&lt;[image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md)&gt; | Yes   | Callback invoked twice to return the quick and quality thumbnails obtained.|
4597
4598**Return value**
4599
4600| Type                                   | Description             |
4601| --------------------------------------- | ----------------- |
4602| string | ID of the task for obtaining thumbnails.|
4603
4604**Error codes**
4605
4606For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4607
4608| ID| Error Message|
4609| -------- | ---------------------------------------- |
4610| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.        |
4611| 202   | Permission verification failed, application which is not a system application uses system API.         |
4612| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
4613| 14000011   | System inner fail.        |
4614
4615**Example**
4616
4617For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4618
4619```ts
4620import { dataSharePredicates } from '@kit.ArkData';
4621import { image } from '@kit.ImageKit';
4622
4623async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4624  try {
4625    console.info('requestPhotoDemo')
4626    let options: photoAccessHelper.FetchOptions = {
4627      fetchColumns: [],
4628      predicates: new dataSharePredicates.DataSharePredicates()
4629    }
4630    let fetchResult = await phAccessHelper.getAssets(options);
4631    let photoAsset = await fetchResult.getFirstObject();
4632    let taskId: string = photoAsset.requestPhoto(async (err, pixel: image.PixelMap) => {
4633      if (err === undefined) {
4634        console.info("requestSource in, size: " + JSON.stringify((await pixel.getImageInfo()).size))
4635      } else {
4636        console.error(`requestSource failed with error: ${err.code}, ${err.message}`);
4637      }
4638    })
4639    console.info('requestSource taskId: ' + taskId)
4640  } catch (err) {
4641    console.error(`requestPhotoDemo failed with error: ${err.code}, ${err.message}`);
4642  }
4643}
4644```
4645
4646### requestPhoto<sup>11+</sup>
4647
4648requestPhoto(options: RequestPhotoOptions, callback: AsyncCallback&lt;image.PixelMap&gt;): string
4649
4650Obtains the thumbnails of an asset based on the specified options. This API uses an asynchronous callback to return the result.
4651
4652**System API**: This is a system API.
4653
4654**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4655
4656**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4657
4658**Parameters**
4659
4660| Name       | Type     | Mandatory  | Description                                |
4661| ---------- | ------- | ---- | ---------------------------------- |
4662| options | [RequestPhotoOptions](#requestphotooptions11) | Yes   | Options for obtaining the asset thumbnail.|
4663| callback | AsyncCallback&lt;[image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md)&gt; | Yes   | Callback used to return the thumbnails obtained. The callback may be invoked more than once, depending on **options**.|
4664
4665**Return value**
4666
4667| Type                                   | Description             |
4668| --------------------------------------- | ----------------- |
4669| string | ID of the task for obtaining thumbnails.|
4670
4671**Error codes**
4672
4673For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4674
4675| ID| Error Message|
4676| -------- | ---------------------------------------- |
4677| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.        |
4678| 202   | Permission verification failed, application which is not a system application uses system API.         |
4679| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4680| 14000011   | System inner fail.        |
4681
4682**Example**
4683
4684For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4685
4686```ts
4687import { dataSharePredicates } from '@kit.ArkData';
4688import { image } from '@kit.ImageKit';
4689
4690async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4691  try {
4692    console.info('requestPhotoDemo')
4693    let options: photoAccessHelper.FetchOptions = {
4694      fetchColumns: [],
4695      predicates: new dataSharePredicates.DataSharePredicates()
4696    }
4697    let fetchResult = await phAccessHelper.getAssets(options);
4698    let photoAsset = await fetchResult.getFirstObject();
4699    let taskId: string = photoAsset.requestPhoto({
4700      "size": {
4701        "width": 256,
4702        "height": 256
4703      },
4704      "requestPhotoType": photoAccessHelper.RequestPhotoType.REQUEST_ALL_THUMBNAILS
4705    }, async (err, pixel: image.PixelMap) => {
4706      if (err === undefined) {
4707        console.info("requestSource in, size: " + JSON.stringify((await pixel.getImageInfo()).size))
4708      } else {
4709        console.error(`requestSource failed with error: ${err.code}, ${err.message}`);
4710      }
4711    })
4712    console.info('requestSource taskId: ' + taskId)
4713  } catch (err) {
4714    console.error(`requestPhotoDemo failed with error: ${err.code}, ${err.message}`);
4715  }
4716}
4717```
4718
4719### cancelPhotoRequest<sup>11+</sup>
4720
4721cancelPhotoRequest(requestId: string): void
4722
4723Cancels a task for obtaining media thumbnails.
4724
4725**System API**: This is a system API.
4726
4727**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4728
4729**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4730
4731**Parameters**
4732
4733| Name       | Type     | Mandatory  | Description                                |
4734| ---------- | ------- | ---- | ---------------------------------- |
4735| requestId | string | Yes   | ID of the task to cancel.|
4736
4737**Error codes**
4738
4739For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4740
4741| ID| Error Message|
4742| -------- | ---------------------------------------- |
4743| 201   | Permission verification failed, usually the result returned by VerifyAccessToken.        |
4744| 202   | Permission verification failed, application which is not a system application uses system API.         |
4745| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4746| 14000011   | System inner fail.        |
4747
4748**Example**
4749
4750For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4751
4752```ts
4753import { dataSharePredicates } from '@kit.ArkData';
4754import { image } from '@kit.ImageKit';
4755
4756async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4757  try {
4758    console.info('cancelPhotoRequestDemo')
4759    let options: photoAccessHelper.FetchOptions = {
4760      fetchColumns: [],
4761      predicates: new dataSharePredicates.DataSharePredicates()
4762    }
4763    let fetchResult = await phAccessHelper.getAssets(options);
4764    let photoAsset = await fetchResult.getFirstObject();
4765    let taskId: string = photoAsset.requestPhoto({
4766      "size": {
4767        "width": 256,
4768        "height": 256
4769      },
4770      "requestPhotoType": photoAccessHelper.RequestPhotoType.REQUEST_ALL_THUMBNAILS
4771    }, async (err, pixel: image.PixelMap) => {
4772      if (err === undefined) {
4773        console.info("requestSource in, size: " + JSON.stringify((await pixel.getImageInfo()).size))
4774      } else {
4775        console.error(`requestSource failed with error: ${err.code}, ${err.message}`);
4776      }
4777    })
4778    console.info('requestSource taskId: ' + taskId)
4779    photoAsset.cancelPhotoRequest(taskId);
4780  } catch (err) {
4781    console.error(`cancelPhotoRequestDemo failed with error: ${err.code}, ${err.message}`);
4782  }
4783}
4784```
4785
4786### getAnalysisData<sup>11+</sup>
4787
4788getAnalysisData(analysisType: AnalysisType): Promise\<string>
4789
4790Obtains analysis data. This API uses a promise to return the result.
4791
4792**System API**: This is a system API.
4793
4794**Required permissions**: ohos.permission.READ\_IMAGEVIDEO
4795
4796**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4797
4798**Parameters**
4799
4800| Name         | Type          | Mandatory| Description          |
4801| :----------- | :----------- | :- | :----------- |
4802| analysisType | [AnalysisType](#analysistype11) | Yes | Smart analysis type.|
4803
4804**Error codes**
4805
4806For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4807
4808| ID   | Error Message                             |
4809| :------- | :-------------------------------- |
4810| 201      | Permission denied.                |
4811| 202      | Called by non-system application. |
4812| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4813| 14000011 | System inner fail.                |
4814
4815**Example**
4816
4817For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
4818
4819```ts
4820import { dataSharePredicates } from '@kit.ArkData';
4821
4822async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4823  try {
4824    console.info('getAnalysisDataDemo')
4825    let fetchOptions: photoAccessHelper.FetchOptions = {
4826      fetchColumns: [],
4827      predicates: new dataSharePredicates.DataSharePredicates()
4828    }
4829    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> =
4830      await phAccessHelper.getAssets(fetchOptions);
4831    let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
4832    if (photoAsset != undefined) {
4833      let analysisData: string = await photoAsset.getAnalysisData(
4834        photoAccessHelper.AnalysisType.ANALYSIS_OCR);
4835      console.info('get ocr result: ' + JSON.stringify(analysisData));
4836    }
4837    fetchResult.close();
4838  } catch (err) {
4839    console.error(`getAnalysisDataDemofailed with error: ${err.code}, ${err.message}`);
4840  }
4841}
4842```
4843
4844### getThumbnailData<sup>18+</sup>
4845
4846getThumbnailData(type: ThumbnailType): Promise&lt;ArrayBuffer&gt;
4847
4848Obtains the ArrayBuffer of a file thumbnail by specifying its type. This API uses a promise to return the result.
4849
4850**Required permissions**: ohos.permission.READ_IMAGEVIDEO
4851
4852**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4853
4854**Parameters**
4855
4856| Name | Type            | Mandatory  | Description   |
4857| ---- | -------------- | ---- | ----- |
4858| type | [ThumbnailType](#thumbnailtype13) | Yes   | Type of the thumbnail.|
4859
4860**Return value**
4861
4862| Type                           | Description                   |
4863| ----------------------------- | --------------------- |
4864| Promise\<ArrayBuffer> | Promise used to return the ArrayBuffer of the thumbnail.|
4865
4866**Error codes**
4867
4868For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4869
4870If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
4871
4872| ID| Error Message|
4873| -------- | ---------------------------------------- |
4874| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4875| 202      | Called by non-system application. |
4876| 13900012     | Permission denied.         |
4877| 13900020     | Invalid argument.         |
4878| 14000011       | System inner fail.         |
4879
4880**Example**
4881
4882```ts
4883import { dataSharePredicates } from '@kit.ArkData';
4884import { BusinessError } from '@kit.BasicServicesKit';
4885
4886async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
4887  console.info('getThumbnailDataDemo');
4888  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
4889  let fetchOption: photoAccessHelper.FetchOptions = {
4890    fetchColumns: [],
4891    predicates: predicates
4892  };
4893  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
4894  let asset = await fetchResult.getFirstObject();
4895  console.info('asset displayName = ', asset.displayName);
4896  asset.getThumbnailData(photoAccessHelper.ThumbnailType.LCD).then((buffer: ArrayBuffer) => {
4897    console.info('getThumbnailData successful, buffer byteLength = ${buffer.byteLength}');
4898  }).catch((err: BusinessError) => {
4899    console.error(`getThumbnailData fail with error: ${err.code}, ${err.message}`);
4900  });
4901}
4902```
4903
4904## SharedPhotoAsset<sup>13+</sup>
4905
4906Describes the information about a shared media asset.
4907
4908**System API**: This is a system API.
4909
4910**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4911
4912### Properties
4913
4914| Name| Type| Read-Only| Optional| Description|
4915| ---- | --- | ---- | ---- | --- |
4916| fileId | number | No| No| ID of the media asset.<br>**System API**: This is a system API.|
4917| uri | string | No| No| URI of the media asset.<br>**System API**: This is a system API.|
4918| data | string | No| No| Path data of the media asset.<br>**System API**: This is a system API.|
4919| mediaType | [PhotoType](arkts-apis-photoAccessHelper-e.md#phototype) | No| No| Media type of the media asset.<br>**System API**: This is a system API.|
4920| displayName | string | No| No| Display name of the media asset.<br>**System API**: This is a system API.|
4921| size | number  | No| No| File size of the media asset.<br>**System API**: This is a system API.|
4922| dataAdded | number | No| No| Data added to the media asset.<br>**System API**: This is a system API.|
4923| dataModified | number | No| No| Data modified in the media asset.<br>**System API**: This is a system API.|
4924| duration | number | No| No| Duration of the media asset if it is a video.<br>**System API**: This is a system API.|
4925| width | number | No| No| Pixel width of the media asset.<br>**System API**: This is a system API.|
4926| height | number | No| No| Pixel height of the media asset.<br>**System API**: This is a system API.|
4927| dataTaken | number | No| No| Timestamp when the media asset was taken and stored locally.<br>**System API**: This is a system API.|
4928| orientation | number | No| No| Rotation angle of the media asset.<br>**System API**: This is a system API.|
4929| isFavorite | boolean | No| No| Whether the media asset is marked as a favorite.<br>**System API**: This is a system API.|
4930| title | string | No| No| Title of the media asset.<br>**System API**: This is a system API.|
4931| position | [PositionType](arkts-apis-photoAccessHelper-e.md#positiontype16) | No| No| Location of the media asset.<br>**System API**: This is a system API.|
4932| dataTrashed | number | No| No| Whether the media asset is moved to the trash.<br>**System API**: This is a system API.|
4933| hidden | boolean | No| No| Whether the media asset is hidden.<br>**System API**: This is a system API.|
4934| userComment | string | No| No| User comments on the media asset.<br>**System API**: This is a system API.|
4935| cameraShotKey | string | No| No| Camera shot information of the media asset.<br>**System API**: This is a system API.|
4936| dateYear | string | No| No| Year when the media asset was created.<br>**System API**: This is a system API.|
4937| dateMonth | string | No| No| Month when the media asset was created.<br>**System API**: This is a system API.|
4938| dateDay | string | No| No| Time when the media asset was created.<br>**System API**: This is a system API.|
4939| pending | boolean | No| No| Whether the media asset is in a pending state. **true** if pending.<br>**System API**: This is a system API.|
4940| dateAddedMs | number | No| No| Time elapsed after the media asset was added.<br>**System API**: This is a system API.|
4941| dateTrashedMs | number | No| No| Time elapsed since the media asset was trashed.<br>**System API**: This is a system API.|
4942| subtype | [PhotoSubtype](#photosubtype) | No| No| Subtype of the media asset.<br>**System API**: This is a system API.|
4943| movingPhotoEffectMode | [MovingPhotoEffectMode](#movingphotoeffectmode12) | No| No| Effect of the moving photo.<br>**System API**: This is a system API.|
4944| dynamicRangeType | [DynamicRangeType](arkts-apis-photoAccessHelper-e.md#dynamicrangetype12) | No| No| Dynamic range type of the media asset.<br>**System API**: This is a system API.|
4945| thumbnailReady | boolean | No| No| Whether the thumbnail of the media asset is ready.<br>**System API**: This is a system API.|
4946| lcdSize | string | No| No| Width and height of the LCD thumbnail of the media asset.<br>**System API**: This is a system API.|
4947| thmSize | string | No| No| Width and height of the thumb thumbnail of the media asset.<br>**System API**: This is a system API.|
4948| thumbnailModifiedMs<sup>14+</sup> | number | No| Yes| Time elapsed since the thumbnail status of the media asset changed.<br>**System API**: This is a system API.|
4949| thumbnailVisible<sup>14+</sup> | [ThumbnailVisibility](#thumbnailvisibility14) | No| No| Whether the thumbnail of the media asset is visible.<br>**System API**: This is a system API.|
4950
4951## Album
4952
4953Provides APIs to manage albums.
4954
4955### Properties
4956
4957**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4958
4959| Name          | Type   | Read-Only  | Optional | Description  |
4960| ------------ | ------ | ---- | ---- | ------- |
4961| lpath<sup>18+</sup>    | string | Yes   | Yes  | Virtual path of the album.<br>**System API**: This is a system API.|
4962| dateAdded<sup>18+</sup>    | number | Yes   | Yes  | Time when the album was added.<br>**System API**: This is a system API.|
4963| dateModified<sup>18+</sup>    | number | Yes   | Yes  | Time when the album was modified.<br>**System API**: This is a system API.|
4964| coverUriSource<sup>20+</sup>    | number | Yes   | Yes  | Source URI of the album cover.<br>**System API**: This is a system API.|
4965
4966### recoverAssets<sup>(deprecated)</sup>
4967
4968recoverAssets(assets: Array&lt;PhotoAsset&gt;, callback: AsyncCallback&lt;void&gt;): void
4969
4970Recovers image or video assets from the trash. Before the operation, ensure that the image or video assets exist in the trash. This API uses an asynchronous callback to return the result.
4971
4972> **NOTE**
4973>
4974> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.recoverAssets](#recoverassets11) instead.
4975
4976**System API**: This is a system API.
4977
4978**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
4979
4980**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
4981
4982**Parameters**
4983
4984| Name  | Type                     | Mandatory| Description      |
4985| -------- | ------------------------- | ---- | ---------- |
4986| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Array of the image or video assets to recover.|
4987| callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
4988
4989**Error codes**
4990
4991For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
4992
4993If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
4994
4995| ID| Error Message|
4996| -------- | ---------------------------------------- |
4997| 202      |  Called by non-system application.         |
4998| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
4999| 13900012     | Permission denied.         |
5000| 13900020     | Invalid argument.         |
5001| 14000011       | System inner fail.         |
5002
5003**Example**
5004
5005For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5006
5007```ts
5008import { dataSharePredicates } from '@kit.ArkData';
5009
5010async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5011  try {
5012    console.info('recoverAssetsDemoCallback');
5013    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5014    let fetchOption: photoAccessHelper.FetchOptions = {
5015      fetchColumns: [],
5016      predicates: predicates
5017    };
5018    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
5019    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5020    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5021    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5022    album.recoverAssets([asset], (err) => {
5023      if (err === undefined) {
5024        console.info('album recoverAssets successfully');
5025      } else {
5026        console.error(`album recoverAssets failed with error: ${err.code}, ${err.message}`);
5027      }
5028    });
5029  } catch (err) {
5030    console.error(`recoverAssetsDemoCallback failed with error: ${err.code}, ${err.message}`);
5031  }
5032}
5033```
5034
5035### recoverAssets<sup>(deprecated)</sup>
5036
5037recoverAssets(assets: Array&lt;PhotoAsset&gt;): Promise&lt;void&gt;
5038
5039Recovers image or video assets from the trash. Before the operation, ensure that the image or video assets exist in the trash. This API uses a promise to return the result.
5040
5041> **NOTE**
5042>
5043> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.recoverAssets](#recoverassets11) instead.
5044
5045**System API**: This is a system API.
5046
5047**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
5048
5049**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5050
5051**Parameters**
5052
5053| Name  | Type                     | Mandatory| Description      |
5054| -------- | ------------------------- | ---- | ---------- |
5055| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Array of the image or video assets to recover.|
5056
5057**Return value**
5058
5059| Type                                   | Description             |
5060| --------------------------------------- | ----------------- |
5061|Promise&lt;void&gt; | Promise that returns no value.|
5062
5063**Error codes**
5064
5065For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5066
5067If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
5068
5069| ID| Error Message|
5070| -------- | ---------------------------------------- |
5071| 202      |  Called by non-system application.         |
5072| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5073| 13900012     | Permission denied.         |
5074| 13900020     | Invalid argument.         |
5075| 14000011       | System inner fail.         |
5076
5077**Example**
5078
5079For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5080
5081```ts
5082import { dataSharePredicates } from '@kit.ArkData';
5083import { BusinessError } from '@kit.BasicServicesKit';
5084
5085async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5086  try {
5087    console.info('recoverAssetsDemoPromise');
5088    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5089    let fetchOption: photoAccessHelper.FetchOptions = {
5090      fetchColumns: [],
5091      predicates: predicates
5092    };
5093    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
5094    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5095    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5096    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5097    album.recoverAssets([asset]).then(() => {
5098      console.info('album recoverAssets successfully');
5099    }).catch((err: BusinessError) => {
5100      console.error(`album recoverAssets failed with error: ${err.code}, ${err.message}`);
5101    });
5102  } catch (err) {
5103    console.error(`recoverAssetsDemoPromise failed with error: ${err.code}, ${err.message}`);
5104  }
5105}
5106```
5107
5108### deleteAssets<sup>(deprecated)</sup>
5109
5110deleteAssets(assets: Array&lt;PhotoAsset&gt;, callback: AsyncCallback&lt;void&gt;): void
5111
5112Deletes image or video assets from the trash. Before the operation, ensure that the image or video assets exist in the trash. This API uses an asynchronous callback to return the result.
5113
5114> **NOTE**
5115>
5116> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.deleteAssets](#deleteassets11) instead.
5117
5118**NOTE**: This operation is irreversible. The file assets deleted cannot be restored. Exercise caution when performing this operation.
5119
5120**System API**: This is a system API.
5121
5122**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
5123
5124**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5125
5126**Parameters**
5127
5128| Name  | Type                     | Mandatory| Description      |
5129| -------- | ------------------------- | ---- | ---------- |
5130| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Array of the image or video assets to delete.|
5131| callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
5132
5133**Error codes**
5134
5135For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5136
5137If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
5138
5139| ID| Error Message|
5140| -------- | ---------------------------------------- |
5141| 202      |  Called by non-system application.         |
5142| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5143| 13900012     | Permission denied.         |
5144| 13900020     | Invalid argument.         |
5145| 14000011       | System inner fail.         |
5146
5147**Example**
5148
5149For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5150
5151```ts
5152import { dataSharePredicates } from '@kit.ArkData';
5153
5154async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5155  try {
5156    console.info('deleteAssetsDemoCallback');
5157    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5158    let fetchOption: photoAccessHelper.FetchOptions = {
5159      fetchColumns: [],
5160      predicates: predicates
5161    };
5162    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
5163    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5164    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5165    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5166    album.deleteAssets([asset], (err) => {
5167      if (err === undefined) {
5168        console.info('album deleteAssets successfully');
5169      } else {
5170        console.error(`album deleteAssets failed with error: ${err.code}, ${err.message}`);
5171      }
5172    });
5173  } catch (err) {
5174    console.error(`deleteAssetsDemoCallback failed with error: ${err.code}, ${err.message}`);
5175  }
5176}
5177```
5178
5179### deleteAssets<sup>(deprecated)</sup>
5180
5181deleteAssets(assets: Array&lt;PhotoAsset&gt;): Promise&lt;void&gt;
5182
5183Deletes image or video assets from the trash. Before the operation, ensure that the image or video assets exist in the trash. It is recommended that the number of images or videos to be deleted be less than or equal to 1000. This API uses a promise to return the result.
5184
5185> **NOTE**
5186>
5187> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.deleteAssets](#deleteassets11) instead.
5188
5189**NOTE**: This operation is irreversible. The file assets deleted cannot be restored. Exercise caution when performing this operation.
5190
5191**System API**: This is a system API.
5192
5193**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
5194
5195**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5196
5197**Parameters**
5198
5199| Name  | Type                     | Mandatory| Description      |
5200| -------- | ------------------------- | ---- | ---------- |
5201| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Array of the image or video assets to delete.|
5202
5203**Return value**
5204
5205| Type                                   | Description             |
5206| --------------------------------------- | ----------------- |
5207|Promise&lt;void&gt; | Promise that returns no value.|
5208
5209**Error codes**
5210
5211For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5212
5213If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
5214
5215| ID| Error Message|
5216| -------- | ---------------------------------------- |
5217| 202      |  Called by non-system application.         |
5218| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5219| 13900012     | Permission denied.         |
5220| 13900020     | Invalid argument.         |
5221| 14000011       | System inner fail.         |
5222
5223**Example**
5224
5225For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5226
5227```ts
5228import { dataSharePredicates } from '@kit.ArkData';
5229import { BusinessError } from '@kit.BasicServicesKit';
5230
5231async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5232  try {
5233    console.info('deleteAssetsDemoPromise');
5234    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5235    let fetchOption: photoAccessHelper.FetchOptions = {
5236      fetchColumns: [],
5237      predicates: predicates
5238    };
5239    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
5240    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5241    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5242    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5243    album.deleteAssets([asset]).then(() => {
5244      console.info('album deleteAssets successfully');
5245    }).catch((err: BusinessError) => {
5246      console.error(`album deleteAssets failed with error: ${err.code}, ${err.message}`);
5247    });
5248  } catch (err) {
5249    console.error(`deleteAssetsDemoPromise failed with error: ${err.code}, ${err.message}`);
5250  }
5251}
5252```
5253
5254### setCoverUri<sup>(deprecated)</sup>
5255
5256setCoverUri(uri: string, callback: AsyncCallback&lt;void&gt;): void
5257
5258Sets the album cover. This API uses an asynchronous callback to return the result.
5259
5260> **NOTE**
5261>
5262> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.setCoverUri](#setcoveruri11) instead.
5263
5264**NOTE**: This API can be used to set the user album cover, but not the system album cover.
5265
5266**System API**: This is a system API.
5267
5268**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
5269
5270**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5271
5272**Parameters**
5273
5274| Name  | Type                     | Mandatory| Description      |
5275| -------- | ------------------------- | ---- | ---------- |
5276| uri | string | Yes  | URI of the file to be set as the album cover.|
5277| callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
5278
5279**Error codes**
5280
5281For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5282
5283If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
5284
5285| ID| Error Message|
5286| -------- | ---------------------------------------- |
5287| 202      |  Called by non-system application.         |
5288| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5289| 13900012     | Permission denied.         |
5290| 13900020     | Invalid argument.         |
5291| 14000011       | System inner fail.         |
5292
5293**Example**
5294
5295For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5296
5297```ts
5298import { dataSharePredicates } from '@kit.ArkData';
5299
5300async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5301  try {
5302    console.info('setCoverUriDemoCallback');
5303    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5304    let fetchOption: photoAccessHelper.FetchOptions = {
5305      fetchColumns: [],
5306      predicates: predicates
5307    };
5308    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
5309    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5310    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5311    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5312    album.setCoverUri(asset.uri, (err) => {
5313      if (err === undefined) {
5314        console.info('album setCoverUri successfully');
5315      } else {
5316        console.error(`album setCoverUri failed with error: ${err.code}, ${err.message}`);
5317      }
5318    });
5319  } catch (err) {
5320    console.error(`setCoverUriDemoCallback failed with error: ${err.code}, ${err.message}`);
5321  }
5322}
5323```
5324
5325### setCoverUri<sup>(deprecated)</sup>
5326
5327setCoverUri(uri: string): Promise&lt;void&gt;
5328
5329Sets the album cover. This API uses a promise to return the result.
5330
5331> **NOTE**
5332>
5333> This API is supported since API version 10 and deprecated since API version 11. Use [MediaAlbumChangeRequest.setCoverUri](#setcoveruri11) instead.
5334
5335**NOTE**: This API can be used to set the user album cover, but not the system album cover.
5336
5337**System API**: This is a system API.
5338
5339**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
5340
5341**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5342
5343**Parameters**
5344
5345| Name  | Type                     | Mandatory| Description      |
5346| -------- | ------------------------- | ---- | ---------- |
5347| uri | string | Yes  | URI of the file to be set as the album cover.|
5348
5349**Return value**
5350
5351| Type                                   | Description             |
5352| --------------------------------------- | ----------------- |
5353|Promise&lt;void&gt; | Promise that returns no value.|
5354
5355**Error codes**
5356
5357For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5358
5359If error code 13900012 is returned, follow the instructions provided in [Before You Start](../../media/medialibrary/photoAccessHelper-preparation.md).
5360
5361| ID| Error Message|
5362| -------- | ---------------------------------------- |
5363| 202      |  Called by non-system application.         |
5364| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5365| 13900012     | Permission denied.         |
5366| 13900020     | Invalid argument.         |
5367| 14000011       | System inner fail.         |
5368**Example**
5369
5370For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5371
5372```ts
5373import { dataSharePredicates } from '@kit.ArkData';
5374import { BusinessError } from '@kit.BasicServicesKit';
5375
5376async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5377  try {
5378    console.info('setCoverUriDemoPromise');
5379    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5380    let fetchOption: photoAccessHelper.FetchOptions = {
5381      fetchColumns: [],
5382      predicates: predicates
5383    };
5384    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
5385    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
5386    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOption);
5387    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
5388    album.setCoverUri(asset.uri).then(() => {
5389      console.info('album setCoverUri successfully');
5390    }).catch((err: BusinessError) => {
5391      console.error(`album setCoverUri failed with error: ${err.code}, ${err.message}`);
5392    });
5393  } catch (err) {
5394    console.error(`setCoverUriDemoPromise failed with error: ${err.code}, ${err.message}`);
5395  }
5396}
5397```
5398
5399### getFaceId<sup>13+</sup>
5400
5401getFaceId(): Promise\<string>
5402
5403Obtains the face identifier on the cover of a portrait album or group photo album.
5404
5405**System API**: This is a system API.
5406
5407**Required permissions**: ohos.permission.READ\_IMAGEVIDEO
5408
5409**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5410
5411**Return value**
5412
5413| Type               | Description                               |
5414| :------------------ | :---------------------------------- |
5415| Promise&lt;string&gt; | Promise used to return **tag_id** of the portrait album, **group_tag** of the group photo album, or an empty string if no face identifier is found.|
5416
5417**Error codes**
5418
5419For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5420
5421| ID| Error Message                                                    |
5422| :------- | :----------------------------------------------------------- |
5423| 201      | Permission denied.                                           |
5424| 202      | Called by non-system application.                            |
5425| 14000011 | Internal system error                                        |
5426
5427**Example**
5428
5429For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5430
5431```ts
5432import { dataSharePredicates } from '@kit.ArkData';
5433
5434async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5435  try {
5436    console.info('getFaceIdDemo');
5437    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5438    predicates.equalTo("user_display_level", 1);
5439    let fetchOptions: photoAccessHelper.FetchOptions = {
5440      fetchColumns: [],
5441      predicates: predicates
5442    };
5443    let fetchResult =
5444      await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.PORTRAIT,
5445        fetchOptions);
5446    let album = await fetchResult?.getFirstObject();
5447    let faceId = await album?.getFaceId();
5448    console.info(`getFaceId successfully, faceId: ${faceId}`);
5449    fetchResult.close();
5450  } catch (err) {
5451    console.error(`getFaceId failed with err: ${err.code}, ${err.message}`);
5452  }
5453}
5454```
5455
5456## MediaAssetEditData<sup>11+</sup>
5457
5458Represents the edited media asset data.
5459
5460**System API**: This is a system API.
5461
5462**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5463
5464### Properties
5465
5466| Name          | Type   | Readable  | Writable | Description  |
5467| ------------ | ------ | ---- | ---- | ------- |
5468| compatibleFormat | string | Yes   | Yes   | Format of the edited data.<br>**System API**: This is a system API.   |
5469| formatVersion | string | Yes   | Yes  | Version of the data format.<br>**System API**: This is a system API.   |
5470| data | string | Yes   | Yes  | Content edited.<br>**System API**: This is a system API.   |
5471
5472### constructor<sup>11+</sup>
5473
5474constructor(compatibleFormat: string, formatVersion: string)
5475
5476Constructor.
5477
5478**System API**: This is a system API.
5479
5480**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5481
5482**Parameters**
5483
5484| Name  | Type                     | Mandatory| Description      |
5485| -------- | ------------------------- | ---- | ---------- |
5486| compatibleFormat | string | Yes  | Format of the edited data.|
5487| formatVersion | string | Yes  | Version of the data format.|
5488
5489**Error codes**
5490
5491For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5492
5493| ID| Error Message|
5494| -------- | ---------------------------------------- |
5495| 202      |  Called by non-system application.         |
5496| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5497| 14000011       | System inner fail.          |
5498
5499**Example**
5500
5501```ts
5502let assetEditData: photoAccessHelper.MediaAssetEditData = new photoAccessHelper.MediaAssetEditData('system', '1.0');
5503```
5504
5505## MediaAssetChangeRequest<sup>11+</sup>
5506
5507Represents a media asset change request.
5508
5509**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5510
5511### createAssetRequest<sup>11+</sup>
5512
5513static createAssetRequest(context: Context, displayName: string, options?: PhotoCreateOptions): MediaAssetChangeRequest
5514
5515Creates an asset change request with the specified file name.
5516
5517The file name must comply with the following specifications:
5518- The file name consists of a valid file name and an image or video file name extension.
5519- The file name cannot exceed 255 characters.
5520- The file name cannot contain any of the following characters:<br>API version 18 and later: \ / : * ? " < > | <br>API versions 10 to 17: . .. \ / : * ? " ' ` < > | { } [ ]
5521
5522**System API**: This is a system API.
5523
5524**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5525
5526**Parameters**
5527
5528| Name | Type   | Mandatory| Description                      |
5529| ------- | ------- | ---- | -------------------------- |
5530| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
5531| displayName  | string        | Yes  | File name of the image or video to create.             |
5532| options  | [PhotoCreateOptions](#photocreateoptions)        | No  | Options for creating an image or video asset.             |
5533
5534**Return value**
5535
5536| Type                                   | Description             |
5537| --------------------------------------- | ----------------- |
5538| [MediaAssetChangeRequest](#mediaassetchangerequest11) | **MediaAssetChangeRequest** created.|
5539
5540**Error codes**
5541
5542For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5543
5544If error code 14000001 is returned, refer to [PhotoKeys](#photokeys) to learn about the format and length requirements of the file name.
5545
5546| ID| Error Message|
5547| -------- | ---------------------------------------- |
5548| 202   |  Called by non-system application.         |
5549| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5550| 14000001      | Invalid display name.         |
5551| 14000011       | System inner fail.         |
5552
5553**Example**
5554
5555For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5556
5557```ts
5558async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
5559  console.info('createAssetRequestDemo');
5560  try {
5561    let testFileName: string = 'testFile' + Date.now() + '.jpg';
5562    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = photoAccessHelper.MediaAssetChangeRequest.createAssetRequest(context, testFileName);
5563    // Ensure that the asset specified by fileUri exists.
5564    let fileUri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/test.jpg';
5565    assetChangeRequest.addResource(photoAccessHelper.ResourceType.IMAGE_RESOURCE, fileUri);
5566    await phAccessHelper.applyChanges(assetChangeRequest);
5567    console.info('apply createAssetRequest successfully');
5568  } catch (err) {
5569    console.error(`createAssetRequestDemo failed with error: ${err.code}, ${err.message}`);
5570  }
5571}
5572```
5573
5574### setFavorite<sup>11+</sup>
5575
5576setFavorite(favoriteState: boolean): void
5577
5578Favorites or unfavorites this file.
5579
5580**System API**: This is a system API.
5581
5582**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5583
5584**Parameters**
5585
5586| Name       | Type     | Mandatory  | Description                                |
5587| ---------- | ------- | ---- | ---------------------------------- |
5588| favoriteState | boolean | Yes   | Whether to favorite the file. **true** to favorite, **false** otherwise.|
5589
5590**Error codes**
5591
5592For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5593
5594| ID| Error Message|
5595| -------- | ---------------------------------------- |
5596| 202        |  Called by non-system application.         |
5597| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5598| 14000011       | System inner fail.         |
5599
5600**Example**
5601
5602For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5603
5604```ts
5605import { dataSharePredicates } from '@kit.ArkData';
5606import { BusinessError } from '@kit.BasicServicesKit';
5607
5608async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5609  console.info('setFavoriteDemo');
5610  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5611  let fetchOption: photoAccessHelper.FetchOptions = {
5612    fetchColumns: [],
5613    predicates: predicates
5614  };
5615  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
5616  let asset = await fetchResult.getFirstObject();
5617  let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5618  assetChangeRequest.setFavorite(true);
5619  phAccessHelper.applyChanges(assetChangeRequest).then(() => {
5620    console.info('apply setFavorite successfully');
5621  }).catch((err: BusinessError) => {
5622    console.error(`apply setFavorite failed with error: ${err.code}, ${err.message}`);
5623  });
5624}
5625```
5626
5627### setHidden<sup>11+</sup>
5628
5629setHidden(hiddenState: boolean): void
5630
5631Hides this file.
5632
5633**System API**: This is a system API.
5634
5635**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5636
5637**Parameters**
5638
5639| Name       | Type     | Mandatory  | Description                                |
5640| ---------- | ------- | ---- | ---------------------------------- |
5641| hiddenState | boolean  | Yes   | Whether to hide the file. **true** to hide, **false** otherwise.|
5642
5643**Error codes**
5644
5645For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5646
5647| ID| Error Message|
5648| -------- | ---------------------------------------- |
5649| 202        |  Called by non-system application.         |
5650| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5651| 14000011       | System inner fail.         |
5652
5653**Example**
5654
5655For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5656
5657```ts
5658import { dataSharePredicates } from '@kit.ArkData';
5659import { BusinessError } from '@kit.BasicServicesKit';
5660
5661async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5662  console.info('setHiddenDemo');
5663  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5664  let fetchOption: photoAccessHelper.FetchOptions = {
5665    fetchColumns: [],
5666    predicates: predicates
5667  };
5668  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
5669  let asset = await fetchResult.getFirstObject();
5670  let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5671  assetChangeRequest.setHidden(true);
5672  phAccessHelper.applyChanges(assetChangeRequest).then(() => {
5673    console.info('apply setHidden successfully');
5674  }).catch((err: BusinessError) => {
5675    console.error(`apply setHidden failed with error: ${err.code}, ${err.message}`);
5676  });
5677}
5678```
5679
5680### setUserComment<sup>11+</sup>
5681
5682setUserComment(userComment: string): void
5683
5684Sets the user comment information of this media asset.
5685
5686**System API**: This is a system API.
5687
5688**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5689
5690**Parameters**
5691
5692| Name       | Type     | Mandatory  | Description                                |
5693| ---------- | ------- | ---- | ---------------------------------- |
5694| userComment | string | Yes  | Comment information to set, which cannot exceed 420 characters.|
5695
5696**Error codes**
5697
5698For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5699
5700| ID| Error Message|
5701| -------- | ---------------------------------------- |
5702| 202        |  Called by non-system application.         |
5703| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5704| 14000011       | System inner fail.         |
5705
5706**Example**
5707
5708For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5709
5710```ts
5711import { dataSharePredicates } from '@kit.ArkData';
5712import { BusinessError } from '@kit.BasicServicesKit';
5713
5714async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5715  console.info('setUserCommentDemo');
5716  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5717  let fetchOption: photoAccessHelper.FetchOptions = {
5718    fetchColumns: [],
5719    predicates: predicates
5720  };
5721  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
5722  let asset = await fetchResult.getFirstObject();
5723  let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5724  let userComment: string = 'test_set_user_comment';
5725  assetChangeRequest.setUserComment(userComment);
5726  phAccessHelper.applyChanges(assetChangeRequest).then(() => {
5727    console.info('apply setUserComment successfully');
5728  }).catch((err: BusinessError) => {
5729    console.error(`apply setUserComment failed with error: ${err.code}, ${err.message}`);
5730  });
5731}
5732```
5733
5734### setEditData<sup>11+</sup>
5735
5736setEditData(editData: MediaAssetEditData): void
5737
5738Saves the edited data of an asset.
5739
5740**System API**: This is a system API.
5741
5742**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5743
5744**Parameters**
5745
5746| Name       | Type     | Mandatory  | Description                                |
5747| ---------- | ------- | ---- | ---------------------------------- |
5748| editData | [MediaAssetEditData](#mediaasseteditdata11) | Yes  | Edited data to save.|
5749
5750**Error codes**
5751
5752For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5753
5754| ID| Error Message|
5755| -------- | ---------------------------------------- |
5756| 202        |  Called by non-system application.         |
5757| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5758| 14000011       | System inner fail.         |
5759
5760**Example**
5761
5762For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5763
5764```ts
5765import { dataSharePredicates } from '@kit.ArkData';
5766import { BusinessError } from '@kit.BasicServicesKit';
5767
5768async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5769  console.info('setEditDataDemo');
5770  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5771  let fetchOption: photoAccessHelper.FetchOptions = {
5772    fetchColumns: [],
5773    predicates: predicates
5774  };
5775  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
5776  let asset = await fetchResult.getFirstObject();
5777  let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5778
5779  let assetEditData: photoAccessHelper.MediaAssetEditData = new photoAccessHelper.MediaAssetEditData('system', '1.0');
5780  let fileUri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/test.jpg';
5781  assetChangeRequest.addResource(photoAccessHelper.ResourceType.IMAGE_RESOURCE, fileUri);
5782  assetEditData.data = '123456';
5783  assetChangeRequest.setEditData(assetEditData);
5784  phAccessHelper.applyChanges(assetChangeRequest).then(() => {
5785    console.info('apply setEditData successfully');
5786  }).catch((err: BusinessError) => {
5787    console.error(`apply setEditData failed with error: ${err.code}, ${err.message}`);
5788  });
5789}
5790```
5791
5792### addResource<sup>11+</sup>
5793
5794addResource(type: ResourceType, proxy: PhotoProxy): void
5795
5796Adds resources using **PhotoProxy** data.
5797
5798**NOTE**: For the same asset change request, this API cannot be repeatedly called after resources are successfully added.
5799
5800**System API**: This is a system API available only for camera applications.
5801
5802**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5803
5804**Parameters**
5805
5806| Name | Type                             | Mandatory| Description                  |
5807| ------- |---------------------------------| ---- |----------------------|
5808| type | [ResourceType](#resourcetype11) | Yes  | Type of the resource to add.           |
5809| proxy | [PhotoProxy](#photoproxy11)     | Yes  | PhotoProxy data of the resource to add.|
5810
5811**Error codes**
5812
5813For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5814
5815| ID   | Error Message                             |
5816|----------|-----------------------------------|
5817| 202      | Called by non-system application. |
5818| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5819| 14000011 | System inner fail.                |
5820| 14000016 | Operation Not Support.            |
5821
5822**Example**
5823
5824For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5825
5826```ts
5827class PhotoProxyImpl implements photoAccessHelper.PhotoProxy {
5828  // Implement PhotoProxy.
5829}
5830
5831async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, asset: photoAccessHelper.PhotoAsset, context: Context) {
5832  console.info('addResourceByPhotoProxyDemo');
5833  try {
5834    let photoType: photoAccessHelper.PhotoType = photoAccessHelper.PhotoType.IMAGE;
5835    let extension: string = 'jpg';
5836    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = photoAccessHelper.MediaAssetChangeRequest.createAssetRequest(context, photoType, extension);
5837    let photoProxy: PhotoProxyImpl = new PhotoProxyImpl();
5838    assetChangeRequest.addResource(photoAccessHelper.ResourceType.IMAGE_RESOURCE, photoProxy);
5839    await phAccessHelper.applyChanges(assetChangeRequest);
5840    console.info('addResourceByPhotoProxy successfully');
5841  } catch (err) {
5842    console.error(`addResourceByPhotoProxyDemo failed with error: ${err.code}, ${err.message}`);
5843  }
5844}
5845```
5846
5847### setLocation<sup>11+</sup>
5848
5849setLocation(longitude: number, latitude: number): void
5850
5851Sets location information.
5852
5853**System API**: This is a system API.
5854
5855**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5856
5857**Parameters**
5858
5859| Name | Type         | Mandatory| Description   |
5860| ------- |-------------| ---- |-------|
5861| longitude | number      | Yes  | Longitude.|
5862| latitude | number | Yes  | Latitude.  |
5863
5864**Error codes**
5865
5866For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5867
5868| ID| Error Message|
5869| -------- | ---------------------------------------- |
5870| 202      | Called by non-system application. |
5871| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5872| 14000011 |  System inner fail.         |
5873
5874**Example**
5875
5876For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5877
5878```ts
5879import { dataSharePredicates } from '@kit.ArkData';
5880import { BusinessError } from '@kit.BasicServicesKit';
5881
5882async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
5883  console.info('setLocationDemo');
5884  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
5885  let fetchOption: photoAccessHelper.FetchOptions = {
5886    fetchColumns: [],
5887    predicates: predicates
5888  };
5889  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
5890  let asset = await fetchResult.getFirstObject();
5891  let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5892  assetChangeRequest.setLocation(120.52, 30.40);
5893  phAccessHelper.applyChanges(assetChangeRequest).then(() => {
5894    console.info('apply setLocation successfully');
5895  }).catch((err: BusinessError) => {
5896    console.error(`apply setLocation failed with error: ${err.code}, ${err.message}`);
5897  });
5898}
5899```
5900
5901### setCameraShotKey<sup>12+</sup>
5902
5903setCameraShotKey(cameraShotKey: string): void
5904
5905Sets the Key for the Ultra Snapshot feature, which allows the camera to take photos or record videos with the screen off.
5906
5907**System API**: This is a system API.
5908
5909**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5910
5911**Parameters**
5912
5913| Name       | Type     | Mandatory  | Description                                |
5914| ---------- | ------- | ---- | ---------------------------------- |
5915| cameraShotKey | string | Yes  | Key for the Ultra Snapshot feature. This parameter is available only for the system camera, and the key value is defined by the system camera.|
5916
5917**Error codes**
5918
5919For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5920
5921| ID| Error Message|
5922| -------- | ---------------------------------------- |
5923| 202        |  Called by non-system application.         |
5924| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5925| 14000011       | System inner fail.         |
5926
5927**Example**
5928
5929For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5930
5931```ts
5932async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, asset: photoAccessHelper.PhotoAsset) {
5933  console.info('setCameraShotKeyDemo');
5934  try {
5935    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5936    let cameraShotKey: string = 'test_MediaAssetChangeRequest_setCameraShotKey';
5937    assetChangeRequest.setCameraShotKey(cameraShotKey);
5938    await phAccessHelper.applyChanges(assetChangeRequest);
5939    console.info('apply setCameraShotKey successfully');
5940  } catch (err) {
5941    console.error(`apply setCameraShotKey failed with error: ${err.code}, ${err.message}`);
5942  }
5943}
5944```
5945
5946### setEffectMode<sup>12+</sup>
5947
5948setEffectMode(mode: MovingPhotoEffectMode): void
5949
5950Sets the effect of this moving photo.
5951
5952**System API**: This is a system API.
5953
5954**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
5955
5956**Parameters**
5957
5958| Name       | Type     | Mandatory  | Description                                |
5959| ---------- | ------- | ---- | ---------------------------------- |
5960| mode | [MovingPhotoEffectMode](#movingphotoeffectmode12) | Yes  | Effect to set.|
5961
5962**Error codes**
5963
5964For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
5965
5966| ID| Error Message|
5967| -------- | ---------------------------------------- |
5968| 202        |  Called by non-system application.         |
5969| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5970| 14000011       | System inner fail.         |
5971| 14000016       | Operation Not Support.         |
5972
5973**Example**
5974
5975For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
5976
5977```ts
5978async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, asset: photoAccessHelper.PhotoAsset) {
5979  console.info('setEffectModeDemo');
5980  try {
5981    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
5982    assetChangeRequest.setEffectMode(photoAccessHelper.MovingPhotoEffectMode.LONG_EXPOSURE);
5983    // Ensure that the asset specified by fileUri exists.
5984    let imageFileUri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/long_exposure.jpg';
5985    let videoFileUri = 'file://com.example.temptest/data/storage/el2/base/haps/entry/files/long_exposure.mp4';
5986    assetChangeRequest.addResource(photoAccessHelper.ResourceType.IMAGE_RESOURCE, imageFileUri);
5987    assetChangeRequest.addResource(photoAccessHelper.ResourceType.VIDEO_RESOURCE, videoFileUri);
5988    await phAccessHelper.applyChanges(assetChangeRequest);
5989    console.info('apply setEffectMode successfully');
5990  } catch (err) {
5991    console.error(`apply setEffectMode failed with error: ${err.code}, ${err.message}`);
5992  }
5993}
5994```
5995
5996### setSupportedWatermarkType<sup>14+</sup>
5997
5998setSupportedWatermarkType(watermarkType: WatermarkType): void
5999
6000Sets the watermark type supported by photos.
6001
6002**System API**: This is a system API.
6003
6004**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6005
6006**Parameters**
6007
6008| Name       | Type     | Mandatory  | Description                                |
6009| ---------- | ------- | ---- | ---------------------------------- |
6010| watermarkType | [WatermarkType](#watermarktype14) | Yes  | Watermark type to set. |
6011
6012**Error codes**
6013
6014For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6015
6016| ID| Error Message|
6017| -------- | ---------------------------------------- |
6018| 202        |  Called by non-system application.         |
6019| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6020| 14000011       | Internal system error.         |
6021
6022**Example**
6023
6024```ts
6025import { dataSharePredicates } from '@kit.ArkData';
6026
6027async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6028  console.info('setSupportedWatermarkTypeDemo');
6029  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6030  let fetchOption: photoAccessHelper.FetchOptions = {
6031    fetchColumns: [],
6032    predicates: predicates
6033  };
6034  try {
6035    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6036    let asset = await fetchResult.getFirstObject();
6037    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
6038    assetChangeRequest.setSupportedWatermarkType(photoAccessHelper.WatermarkType.BRAND_COMMON);
6039    await phAccessHelper.applyChanges(assetChangeRequest);
6040    console.info('apply setSupportedWatermarkType successfully');
6041  } catch (err) {
6042    console.error(`apply setSupportedWatermarkType failed with error: ${err.code}, ${err.message}`);
6043  }
6044}
6045```
6046
6047### deleteLocalAssetsPermanently<sup>18+</sup>
6048
6049static deleteLocalAssetsPermanently(context: Context, assets: Array\<PhotoAsset>): Promise&lt;void&gt;
6050
6051Permanently deletes photos or videos in batches. This API uses a promise to return the result.
6052
6053**NOTE**: This operation is irreversible. The file assets deleted cannot be restored. Exercise caution when performing this operation.
6054
6055**System API**: This is a system API.
6056
6057**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6058
6059**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
6060
6061**Parameters**
6062
6063| Name | Type            | Mandatory  | Description   |
6064| ---- | -------------- | ---- | ----- |
6065| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes   | Context of the ability instance.|
6066| assets | Array\<[PhotoAsset](#photoasset)>| Yes   | Array of images or videos to be permanently deleted.|
6067
6068**Return value**
6069
6070| Type                 | Description        |
6071| ------------------- | ---------- |
6072| Promise&lt;void&gt; | Promise that returns no value.|
6073
6074**Error codes**
6075
6076For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6077
6078| ID| Error Message|
6079| -------- | ---------------------------------------- |
6080| 201   | Permission denied.       |
6081| 202   | Called by non-system application.       |
6082| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6083| 14000011   | Internal system error.
6084
6085**Example**
6086
6087```ts
6088import { dataSharePredicates } from '@kit.ArkData';
6089import { BusinessError } from '@kit.BasicServicesKit';
6090
6091async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
6092  console.info('deleteAssetsPermanentlyDemo');
6093  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6094  let fetchOptions: photoAccessHelper.FetchOptions = {
6095    fetchColumns: [],
6096    predicates: predicates
6097  };
6098  try {
6099    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
6100    let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6101    await photoAccessHelper.MediaAssetChangeRequest.deleteLocalAssetsPermanently(context, photoAssetList);
6102  } catch (err) {
6103    console.error(`deleteAssetsPermanentlyDemo failed with error: ${err.code}, ${err.message}`);
6104  }
6105}
6106```
6107
6108### deleteLocalAssetsPermanentlyWithUri<sup>19+</sup>
6109
6110static deleteLocalAssetsPermanentlyWithUri(context: Context, assetUris: Array&lt;String&gt;): Promise&lt;void&gt;
6111
6112Permanently deletes images or video assets in batches by URI. This API uses a promise to return the result.
6113
6114>**NOTE**
6115>
6116> This operation is irreversible. The assets deleted cannot be restored. Exercise caution when performing this operation.
6117
6118**System API**: This is a system API.
6119
6120**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6121
6122**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
6123
6124**Parameters**
6125
6126| Name | Type            | Mandatory  | Description   |
6127| ---- | -------------- | ---- | ----- |
6128| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes   | Context of the ability instance.|
6129| assetUris | Array&lt;String&gt; | Yes   | Array of URIs of the images or videos to be permanently deleted.|
6130
6131**Return value**
6132
6133| Type                 | Description        |
6134| ------------------- | ---------- |
6135| Promise&lt;void&gt; | Promise that returns no value.|
6136
6137**Error codes**
6138
6139For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6140
6141| ID| Error Message|
6142| -------- | ---------------------------------------- |
6143| 201   | Permission denied.       |
6144| 202   | Called by non-system application.       |
6145| 13900020 | Invalid argument. |
6146| 14000011 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.  |
6147
6148**Example**
6149
6150```ts
6151import { dataSharePredicates } from '@kit.ArkData';
6152
6153async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
6154    console.info('deleteLocalAssetsPermanentlyWithUriDemo');
6155    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6156    let fetchOptions: photoAccessHelper.FetchOptions = {
6157    fetchColumns: [],
6158    predicates: predicates
6159    };
6160    try {
6161        let  photoUris: Array<string> = [];
6162        let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
6163        let assets: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6164        for (const asset of assets) {
6165            if (!asset?.uri) {
6166                continue;
6167            }
6168            let uri:string = asset.uri.trim();
6169            photoUris.push(uri);
6170        }
6171        await photoAccessHelper.MediaAssetChangeRequest.deleteLocalAssetsPermanentlyWithUri(context, photoUris);
6172    } catch (err) {
6173    console.error(`deleteLocalAssetsPermanentlyWithUriDemo failed with error: ${err.code}, ${err.message}`);
6174}
6175}
6176```
6177
6178## MediaAssetsChangeRequest<sup>11+</sup>
6179
6180Represents a request for changing multiple assets.
6181
6182**System API**: This is a system API.
6183
6184**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6185
6186### constructor<sup>11+</sup>
6187
6188constructor(assets: Array&lt;PhotoAsset&gt;)
6189
6190Constructor.
6191
6192**System API**: This is a system API.
6193
6194**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6195
6196**Parameters**
6197
6198| Name  | Type                     | Mandatory| Description      |
6199| -------- | ------------------------- | ---- | ---------- |
6200| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets to change.|
6201
6202**Error codes**
6203
6204For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6205
6206| ID| Error Message|
6207| -------- | ---------------------------------------- |
6208| 202        |  Called by non-system application.   |
6209| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6210| 14000011       | System inner fail.          |
6211
6212**Example**
6213
6214For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6215
6216```ts
6217import { dataSharePredicates } from '@kit.ArkData';
6218
6219async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6220  console.info('MediaAssetsChangeRequest constructorDemo');
6221  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6222  let fetchOption: photoAccessHelper.FetchOptions = {
6223    fetchColumns: [],
6224    predicates: predicates
6225  };
6226  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6227  let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6228  let assetsChangeRequest: photoAccessHelper.MediaAssetsChangeRequest = new photoAccessHelper.MediaAssetsChangeRequest(photoAssetList);
6229}
6230```
6231
6232### setFavorite<sup>11+</sup>
6233
6234setFavorite(favoriteState: boolean): void
6235
6236Favorites or unfavorites this file.
6237
6238**System API**: This is a system API.
6239
6240**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6241
6242**Parameters**
6243
6244| Name       | Type     | Mandatory  | Description                                |
6245| ---------- | ------- | ---- | ---------------------------------- |
6246| favoriteState | boolean | Yes   | Whether to favorite the file. **true** to favorite, **false** otherwise.|
6247
6248**Error codes**
6249
6250For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6251
6252| ID| Error Message|
6253| -------- | ---------------------------------------- |
6254| 202        |  Called by non-system application.         |
6255| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6256| 14000011       | System inner fail.         |
6257
6258**Example**
6259
6260For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6261
6262```ts
6263import { dataSharePredicates } from '@kit.ArkData';
6264import { BusinessError } from '@kit.BasicServicesKit';
6265
6266async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6267  console.info('setFavoriteDemo');
6268  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6269  let fetchOption: photoAccessHelper.FetchOptions = {
6270    fetchColumns: [],
6271    predicates: predicates
6272  };
6273  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6274  let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6275  let assetsChangeRequest: photoAccessHelper.MediaAssetsChangeRequest = new photoAccessHelper.MediaAssetsChangeRequest(photoAssetList);
6276  assetsChangeRequest.setFavorite(true);
6277  phAccessHelper.applyChanges(assetsChangeRequest).then(() => {
6278    console.info('apply setFavorite successfully');
6279  }).catch((err: BusinessError) => {
6280    console.error(`apply setFavorite failed with error: ${err.code}, ${err.message}`);
6281  });
6282}
6283```
6284
6285### setHidden<sup>11+</sup>
6286
6287setHidden(hiddenState: boolean): void
6288
6289Hides this file.
6290
6291**System API**: This is a system API.
6292
6293**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6294
6295**Parameters**
6296
6297| Name       | Type     | Mandatory  | Description                                |
6298| ---------- | ------- | ---- | ---------------------------------- |
6299| hiddenState | boolean  | Yes   | Whether to hide the file. **true** to hide, **false** otherwise.|
6300
6301**Error codes**
6302
6303For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6304
6305| ID| Error Message|
6306| -------- | ---------------------------------------- |
6307| 202        |  Called by non-system application.         |
6308| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6309| 14000011       | System inner fail.         |
6310
6311**Example**
6312
6313For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6314
6315```ts
6316import { dataSharePredicates } from '@kit.ArkData';
6317import { BusinessError } from '@kit.BasicServicesKit';
6318
6319async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6320  console.info('setHiddenDemo');
6321  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6322  let fetchOption: photoAccessHelper.FetchOptions = {
6323    fetchColumns: [],
6324    predicates: predicates
6325  };
6326  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6327  let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6328  let assetsChangeRequest: photoAccessHelper.MediaAssetsChangeRequest = new photoAccessHelper.MediaAssetsChangeRequest(photoAssetList);
6329  assetsChangeRequest.setHidden(true);
6330  phAccessHelper.applyChanges(assetsChangeRequest).then(() => {
6331    console.info('apply setHidden successfully');
6332  }).catch((err: BusinessError) => {
6333    console.error(`apply setHidden failed with error: ${err.code}, ${err.message}`);
6334  });
6335}
6336```
6337
6338### setUserComment<sup>11+</sup>
6339
6340setUserComment(userComment: string): void
6341
6342Sets the user comment information of this media asset.
6343
6344**System API**: This is a system API.
6345
6346**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6347
6348**Parameters**
6349
6350| Name       | Type     | Mandatory  | Description                                |
6351| ---------- | ------- | ---- | ---------------------------------- |
6352| userComment | string | Yes  | Comment information to set, which cannot exceed 420 characters.|
6353
6354**Error codes**
6355
6356For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6357
6358| ID| Error Message|
6359| -------- | ---------------------------------------- |
6360| 202        |  Called by non-system application.         |
6361| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6362| 14000011       | System inner fail.         |
6363
6364**Example**
6365
6366For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6367
6368```ts
6369import { dataSharePredicates } from '@kit.ArkData';
6370import { BusinessError } from '@kit.BasicServicesKit';
6371
6372async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6373  console.info('setUserCommentDemo');
6374  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6375  let fetchOption: photoAccessHelper.FetchOptions = {
6376    fetchColumns: [],
6377    predicates: predicates
6378  };
6379  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6380  let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6381  let assetsChangeRequest: photoAccessHelper.MediaAssetsChangeRequest = new photoAccessHelper.MediaAssetsChangeRequest(photoAssetList);
6382  assetsChangeRequest.setUserComment('test_set_user_comment');
6383  phAccessHelper.applyChanges(assetsChangeRequest).then(() => {
6384    console.info('apply setUserComment successfully');
6385  }).catch((err: BusinessError) => {
6386    console.error(`apply setUserComment failed with error: ${err.code}, ${err.message}`);
6387  });
6388}
6389```
6390
6391### setIsRecentShow<sup>18+</sup>
6392
6393setIsRecentShow(isRencentShow: boolean): void
6394
6395Sets whether this asset is displayed in the **Recent** list.
6396
6397**System API**: This is a system API.
6398
6399**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6400
6401**Parameters**
6402
6403| Name       | Type     | Mandatory  | Description                                |
6404| ---------- | ------- | ---- | ---------------------------------- |
6405| isRencentShow | boolean | Yes  | Whether this asset is displayed in the **Recent** list. **true** if displayed, **false** otherwise.|
6406
6407**Error codes**
6408
6409For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6410
6411| ID| Error Message|
6412| -------- | ---------------------------------------- |
6413| 202        |  Called by non-system application.         |
6414| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6415| 14000011       | System inner fail.         |
6416
6417**Example**
6418
6419For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6420
6421```ts
6422import { dataSharePredicates } from '@kit.ArkData';
6423import { BusinessError } from '@kit.BasicServicesKit';
6424
6425async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6426  console.info('setIsRecentShowDemo');
6427  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6428  let fetchOption: photoAccessHelper.FetchOptions = {
6429    fetchColumns: [],
6430    predicates: predicates
6431  };
6432  let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOption);
6433  let photoAssetList: Array<photoAccessHelper.PhotoAsset> = await fetchResult.getAllObjects();
6434  let assetsChangeRequest: photoAccessHelper.MediaAssetsChangeRequest = new photoAccessHelper.MediaAssetsChangeRequest(photoAssetList);
6435  assetsChangeRequest.setIsRecentShow(true);
6436  phAccessHelper.applyChanges(assetsChangeRequest).then(() => {
6437    console.info('apply setIsRecentShow successfully');
6438  }).catch((err: BusinessError) => {
6439    console.error(`apply setIsRecentShow failed with error: ${err.code}, ${err.message}`);
6440  });
6441}
6442```
6443
6444## MediaAlbumChangeRequest<sup>11+</sup>
6445
6446Provides APIs for managing the media album change request.
6447
6448**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6449
6450### createAlbumRequest<sup>11+</sup>
6451
6452static createAlbumRequest(context: Context, name: string): MediaAlbumChangeRequest
6453
6454Creates a MediaAlbumChangeRequest instance.
6455
6456The album name must comply with the following specifications:
6457- The album name cannot exceed 255 characters.
6458- The album name cannot contain any of the following characters:<br> . .. \ / : * ? " ' ` < > | { } [ ]
6459- The album name is case-insensitive.
6460- Duplicate album names are not allowed.
6461
6462**System API**: This is a system API.
6463
6464**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6465
6466**Parameters**
6467
6468| Name | Type   | Mandatory| Description                      |
6469| ------- | ------- | ---- | -------------------------- |
6470| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
6471| name | string | Yes  | Name of the album.|
6472
6473**Return value**
6474
6475| Type                                   | Description             |
6476| --------------------------------------- | ----------------- |
6477| [MediaAlbumChangeRequest](#mediaalbumchangerequest11) | MediaAlbumChangeRequest instance created.|
6478
6479**Error codes**
6480
6481For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6482
6483| ID| Error Message|
6484| -------- | ---------------------------------------- |
6485| 202   |  Called by non-system application.         |
6486| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6487| 14000011   | System inner fail.        |
6488
6489**Example**
6490
6491For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6492
6493```ts
6494async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
6495  console.info('createAlbumRequestDemo');
6496  try {
6497    let albumName: string = 'newAlbumName' + new Date().getTime();
6498    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = photoAccessHelper.MediaAlbumChangeRequest.createAlbumRequest(context, albumName);
6499    await phAccessHelper.applyChanges(albumChangeRequest);
6500    console.info('apply createAlbumRequest successfully');
6501  } catch (err) {
6502    console.error(`createAlbumRequestDemo failed with error: ${err.code}, ${err.message}`);
6503  }
6504}
6505```
6506
6507### deleteAlbums<sup>11+</sup>
6508
6509static deleteAlbums(context: Context, albums: Array&lt;Album&gt;): Promise&lt;void&gt;
6510
6511Deletes albums. This API uses a promise to return the result.
6512
6513Ensure that the albums to be deleted exist. Only user albums can be deleted.
6514
6515**System API**: This is a system API.
6516
6517**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
6518
6519**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6520
6521**Parameters**
6522
6523| Name | Type   | Mandatory| Description                      |
6524| ------- | ------- | ---- | -------------------------- |
6525| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
6526| albums  |  Array&lt;[Album](#album)&gt;          | Yes  | Albums to delete.        |
6527
6528**Return value**
6529
6530| Type                                   | Description             |
6531| --------------------------------------- | ----------------- |
6532| Promise&lt;void&gt;| Promise that returns no value.|
6533
6534**Error codes**
6535
6536For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6537
6538| ID| Error Message|
6539| -------- | ---------------------------------------- |
6540| 201      |  Permission denied.         |
6541| 202   |  Called by non-system application.  |
6542| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6543| 14000011 |  System inner fail.         |
6544
6545**Example**
6546
6547For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6548
6549```ts
6550import { dataSharePredicates } from '@kit.ArkData';
6551
6552async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
6553  console.info('deleteAlbumsDemo');
6554  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6555  let fetchOptions: photoAccessHelper.FetchOptions = {
6556    fetchColumns: [],
6557    predicates: predicates
6558  };
6559  try {
6560    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, fetchOptions);
6561    let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
6562    await photoAccessHelper.MediaAlbumChangeRequest.deleteAlbums(context, [album]);
6563    console.info('deleteAlbums successfully');
6564  } catch (err) {
6565    console.error(`deleteAlbumsDemo failed with error: ${err.code}, ${err.message}`);
6566  }
6567}
6568```
6569
6570### deleteAlbumsWithUri<sup>19+</sup>
6571
6572static deleteAlbumsWithUri(context: Context, albumUris: Array&lt;string&gt;): Promise&lt;void&gt;
6573
6574Deletes user albums by URI. This API uses a promise to return the result.
6575
6576**System API**: This is a system API.
6577
6578**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
6579
6580**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6581
6582**Parameters**
6583
6584| Name | Type   | Mandatory| Description                      |
6585| ------- | ------- | ---- | -------------------------- |
6586| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
6587| albumUris  |  Array&lt;string&gt;          | Yes  | Array of URIs of the albums to be deleted.        |
6588
6589**Return value**
6590
6591| Type                                   | Description             |
6592| --------------------------------------- | ----------------- |
6593| Promise&lt;void&gt;| Promise that returns no value.|
6594
6595**Error codes**
6596
6597For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6598
6599| ID| Error Message|
6600| -------- | ---------------------------------------- |
6601| 201      |  Permission denied.         |
6602| 202      |  Called by non-system application.  |
6603| 13900020 |  Invalid argument. |
6604| 14000011 |  Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2.The file System is abnormal; 3. The IPC request timed out;  |
6605
6606**Example**
6607
6608```ts
6609async function example(context: Context, albumUri: string) {
6610  console.info('deleteAlbumsWithUriDemo');
6611  try {
6612    await photoAccessHelper.MediaAlbumChangeRequest.deleteAlbumsWithUri(context, [albumUri]);
6613    console.info('deleteAlbums successfully');
6614  } catch (err) {
6615    console.error(`deleteAlbumsWithUriDemo failed with error: ${err.code}, ${err.message}`);
6616  }
6617}
6618```
6619
6620### setCoverUri<sup>11+</sup>
6621
6622setCoverUri(coverUri: string): void
6623
6624Sets the album cover.
6625
6626**System API**: This is a system API.
6627
6628**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6629
6630**Parameters**
6631
6632| Name       | Type     | Mandatory  | Description                                |
6633| ---------- | ------- | ---- | ---------------------------------- |
6634| coverUri | string | Yes  | URI of the file to be set as the album cover.|
6635
6636**Error codes**
6637
6638For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6639
6640| ID| Error Message|
6641| -------- | ---------------------------------------- |
6642| 202        |  Called by non-system application.         |
6643| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6644| 14000011       | System inner fail.         |
6645
6646**Example**
6647
6648For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6649
6650```ts
6651import { dataSharePredicates } from '@kit.ArkData';
6652
6653async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6654  console.info('setCoverUriDemo');
6655  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6656  let fetchOptions: photoAccessHelper.FetchOptions = {
6657    fetchColumns: [],
6658    predicates: predicates
6659  };
6660  try {
6661    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
6662    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6663    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
6664    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
6665
6666    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6667    albumChangeRequest.setCoverUri(asset.uri);
6668    await phAccessHelper.applyChanges(albumChangeRequest);
6669    console.info('setCoverUri successfully');
6670  } catch (err) {
6671    console.error(`setCoverUriDemo failed with error: ${err.code}, ${err.message}`);
6672  }
6673}
6674```
6675
6676### resetCoverUri<sup>20+</sup>
6677
6678resetCoverUri(): void
6679
6680Resets the cover.
6681
6682**System API**: This is a system API.
6683
6684**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6685
6686**Error codes**
6687
6688For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
6689
6690| ID| Error Message|
6691| -------- | ---------------------------------------- |
6692| 202        |  Called by non-system application.         |
6693| 23800301       | Internal system error.It is recommended to retry and check the logs. Possible causes: 1. Database corrupted. 2. The file system is abnormal. 3. The IPC request timed out. |
6694
6695**Example**
6696
6697For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](js-apis-photoAccessHelper.md).
6698
6699```ts
6700import { dataSharePredicates } from '@kit.ArkData';
6701
6702async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6703  console.info('resetCoverUriDemo');
6704  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6705  let fetchOptions: photoAccessHelper.FetchOptions = {
6706    fetchColumns: [],
6707    predicates: predicates
6708  };
6709  try {
6710    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
6711    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6712
6713    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6714    albumChangeRequest.resetCoverUri();
6715    await phAccessHelper.applyChanges(albumChangeRequest);
6716    console.info('resetCoverUri successfully');
6717  } catch (err) {
6718    console.error(`resetCoverUriDemo failed with error: ${err.code}, ${err.message}`);
6719  }
6720}
6721```
6722
6723### moveAssets<sup>11+</sup>
6724
6725moveAssets(assets: Array&lt;PhotoAsset&gt;, targetAlbum: Album): void
6726
6727Moves assets to another album.
6728
6729**System API**: This is a system API.
6730
6731**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6732
6733**Parameters**
6734
6735| Name       | Type     | Mandatory  | Description                                |
6736| ---------- | ------- | ---- | ---------------------------------- |
6737| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets to move.|
6738| targetAlbum | Album | Yes  | Album to which the assets are to be moved.|
6739
6740**Error codes**
6741
6742For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6743
6744| ID| Error Message|
6745| -------- | ---------------------------------------- |
6746| 202      |  Called by non-system application.         |
6747| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6748| 14000011       | System inner fail.         |
6749| 14000016 |  Operation Not Support.     |
6750
6751**Example**
6752
6753For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6754
6755```ts
6756import { dataSharePredicates } from '@kit.ArkData';
6757
6758async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6759  console.info('moveAssetsDemo');
6760  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6761  let fetchOptions: photoAccessHelper.FetchOptions = {
6762    fetchColumns: [],
6763    predicates: predicates
6764  };
6765  try {
6766    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
6767    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6768    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
6769    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
6770
6771    if (albumFetchResult.isAfterLast()) {
6772      console.error('lack of album to be moved into');
6773      return;
6774    }
6775    let nextAlbum: photoAccessHelper.Album = await albumFetchResult.getNextObject();
6776    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6777    albumChangeRequest.moveAssets([asset], nextAlbum);
6778    await phAccessHelper.applyChanges(albumChangeRequest);
6779    console.info('moveAssets successfully');
6780  } catch (err) {
6781    console.error(`moveAssetsDemo failed with error: ${err.code}, ${err.message}`);
6782  }
6783}
6784```
6785### moveAssetsWithUri<sup>19+</sup>
6786
6787moveAssetsWithUri(assetUris: Array&lt;String&gt;, targetAlbum: Album): void
6788
6789Moves assets in an album to another album.
6790
6791**System API**: This is a system API.
6792
6793**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6794
6795**Parameters**
6796
6797| Name       | Type     | Mandatory  | Description                                |
6798| ---------- | ------- | ---- | ---------------------------------- |
6799| assetUris | Array&lt;String&gt; | Yes  | Array of URIs of the assets to move.|
6800| targetAlbum | [Album](#album) | Yes  | Album to which the assets are to be moved.|
6801
6802**Error codes**
6803
6804For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6805
6806| ID| Error Message|
6807| -------- | ---------------------------------------- |
6808| 202      | Called by non-system application.         |
6809| 13900020 | Invalid argument.|
6810| 14000011 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.         |
6811| 14000016 | Operation Not Support.     |
6812
6813**Example**
6814
6815For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6816
6817```ts
6818import { dataSharePredicates } from '@kit.ArkData';
6819
6820async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6821  console.info('moveAssetsWithUriDemo');
6822  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6823  let fetchOptions: photoAccessHelper.FetchOptions = {
6824    fetchColumns: [],
6825    predicates: predicates
6826  };
6827  try {
6828    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
6829    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6830    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
6831    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
6832
6833    if (albumFetchResult.isAfterLast()) {
6834      console.error('lack of album to be moved into');
6835      return;
6836    }
6837    let nextAlbum: photoAccessHelper.Album = await albumFetchResult.getNextObject();
6838    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6839    albumChangeRequest.moveAssetsWithUri([asset.uri], nextAlbum);
6840    await phAccessHelper.applyChanges(albumChangeRequest);
6841    console.info('moveAssetsWithUri successfully');
6842  } catch (err) {
6843    console.error(`moveAssetsWithUriDemo failed with error: ${err.code}, ${err.message}`);
6844  }
6845}
6846```
6847
6848
6849### recoverAssets<sup>11+</sup>
6850
6851recoverAssets(assets: Array&lt;PhotoAsset&gt;): void
6852
6853Recovers assets from the trash.
6854
6855**System API**: This is a system API.
6856
6857**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6858
6859**Parameters**
6860
6861| Name       | Type     | Mandatory  | Description                                |
6862| ---------- | ------- | ---- | ---------------------------------- |
6863| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets to recover.|
6864
6865**Error codes**
6866
6867For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6868
6869| ID| Error Message|
6870| -------- | ---------------------------------------- |
6871| 202      |  Called by non-system application.         |
6872| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6873| 14000011       | System inner fail.         |
6874| 14000016 |  Operation Not Support.     |
6875
6876**Example**
6877
6878For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6879
6880```ts
6881import { dataSharePredicates } from '@kit.ArkData';
6882
6883async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6884  console.info('recoverAssetsDemo');
6885  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6886  let fetchOptions: photoAccessHelper.FetchOptions = {
6887    fetchColumns: [],
6888    predicates: predicates
6889  };
6890  try {
6891    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
6892    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6893    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
6894    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
6895
6896    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6897    albumChangeRequest.recoverAssets([asset]);
6898    await phAccessHelper.applyChanges(albumChangeRequest);
6899    console.info('recoverAssets successfully');
6900  } catch (err) {
6901    console.error(`recoverAssetsDemo failed with error: ${err.code}, ${err.message}`);
6902  }
6903}
6904```
6905
6906### recoverAssetsWithUri<sup>19+</sup>
6907
6908recoverAssetsWithUri(assetUris: Array&lt;String&gt;): void
6909
6910Recovers assets from the trash.
6911
6912**System API**: This is a system API.
6913
6914**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6915
6916**Parameters**
6917
6918| Name       | Type     | Mandatory  | Description                                |
6919| ---------- | ------- | ---- | ---------------------------------- |
6920| assetUris | Array&lt;String&gt; | Yes  | Array of URIs of the assets to recover.|
6921
6922**Error codes**
6923
6924For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6925
6926| ID| Error Message|
6927| -------- | ---------------------------------------- |
6928| 202      | Called by non-system application.         |
6929| 13900020 | Invalid argument.|
6930| 14000011 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.         |
6931| 14000016 | Operation Not Support.     |
6932
6933**Example**
6934
6935For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6936
6937```ts
6938import { dataSharePredicates } from '@kit.ArkData';
6939
6940async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
6941  console.info('recoverAssetsWithUriDemo');
6942  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
6943  let fetchOptions: photoAccessHelper.FetchOptions = {
6944    fetchColumns: [],
6945    predicates: predicates
6946  };
6947  try {
6948    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
6949    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
6950    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
6951    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
6952
6953    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
6954    albumChangeRequest.recoverAssetsWithUri([asset.uri]);
6955    await phAccessHelper.applyChanges(albumChangeRequest);
6956    console.info('recoverAssetsWithUri successfully');
6957  } catch (err) {
6958    console.error(`recoverAssetsWithUriDemo failed with error: ${err.code}, ${err.message}`);
6959  }
6960}
6961```
6962
6963### deleteAssets<sup>11+</sup>
6964
6965deleteAssets(assets: Array&lt;PhotoAsset&gt;): void
6966
6967Permanently deletes assets from the trash.
6968
6969**NOTE**: This operation is irreversible. The file assets deleted cannot be restored. Exercise caution when performing this operation.
6970
6971**System API**: This is a system API.
6972
6973**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
6974
6975**Parameters**
6976
6977| Name       | Type     | Mandatory  | Description                                |
6978| ---------- | ------- | ---- | ---------------------------------- |
6979| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets to be permanently deleted.|
6980
6981**Error codes**
6982
6983For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
6984
6985| ID| Error Message|
6986| -------- | ---------------------------------------- |
6987| 202      |  Called by non-system application.         |
6988| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
6989| 14000011       | System inner fail.         |
6990| 14000016 |  Operation Not Support.     |
6991
6992**Example**
6993
6994For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
6995
6996```ts
6997import { dataSharePredicates } from '@kit.ArkData';
6998
6999async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7000  console.info('deleteAssetsPermanentlyDemo');
7001  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7002  let fetchOptions: photoAccessHelper.FetchOptions = {
7003    fetchColumns: [],
7004    predicates: predicates
7005  };
7006  try {
7007    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
7008    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7009    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
7010    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
7011
7012    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7013    albumChangeRequest.deleteAssets([asset]);
7014    await phAccessHelper.applyChanges(albumChangeRequest);
7015    console.info('succeed to deleteAssets permanently');
7016  } catch (err) {
7017    console.error(`deleteAssetsPermanentlyDemo failed with error: ${err.code}, ${err.message}`);
7018  }
7019}
7020```
7021
7022### deleteAssetsWithUri<sup>19+</sup>
7023
7024deleteAssetsWithUri(assetUris: Array&lt;String&gt;): void
7025
7026Permanently deletes assets from the trash.
7027
7028> **NOTE**
7029>
7030> This operation is irreversible. The assets deleted cannot be restored. Exercise caution when performing this operation.
7031
7032**System API**: This is a system API.
7033
7034**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7035
7036**Parameters**
7037
7038| Name       | Type     | Mandatory  | Description                                |
7039| ---------- | ------- | ---- | ---------------------------------- |
7040| assetUris | Array&lt;String&gt; | Yes  | Array of URIs of the assets to be permanently deleted.|
7041
7042**Error codes**
7043
7044For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7045
7046| ID| Error Message|
7047| -------- | ---------------------------------------- |
7048| 202      | Called by non-system application.         |
7049| 13900020 | Invalid argument.|
7050| 14000011 | Internal system error. It is recommended to retry and check the logs.<br>Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.         |
7051| 14000016 | Operation Not Support.     |
7052
7053**Example**
7054
7055For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7056
7057```ts
7058import { dataSharePredicates } from '@kit.ArkData';
7059
7060async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7061  console.info('deleteAssetsWithUriDemo');
7062  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7063  let fetchOptions: photoAccessHelper.FetchOptions = {
7064    fetchColumns: [],
7065    predicates: predicates
7066  };
7067  try {
7068    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
7069    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7070    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await album.getAssets(fetchOptions);
7071    let asset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject();
7072
7073    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7074    albumChangeRequest.deleteAssetsWithUri([asset.uri]);
7075    await phAccessHelper.applyChanges(albumChangeRequest);
7076    console.info('succeed to deleteAssets permanently');
7077  } catch (err) {
7078    console.error(`deleteAssetsWithUriDemo failed with error: ${err.code}, ${err.message}`);
7079  }
7080}
7081```
7082
7083### setDisplayLevel<sup>11+</sup>
7084
7085setDisplayLevel(displayLevel: number): void
7086
7087Sets the display level of the portrait album.
7088
7089**System API**: This is a system API.
7090
7091**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7092
7093**Parameters**
7094
7095| Name       | Type     | Mandatory  | Description                                |
7096| ---------- | ------- | ---- | ---------------------------------- |
7097| displayLevel | number | Yes   | Display level to set. The options are as follows:<br>**0**: unfavorite the portrait album.<br>**1**: set the portrait album as the first to display.<br>**2**: do not display the portrait album as the first one.<br>**3**: favorite the portrait album.|
7098
7099**Error codes**
7100
7101For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7102
7103| ID| Error Message|
7104| -------- | ---------------------------------------- |
7105| 202        |  Called by non-system application.         |
7106| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7107| 14000011       | System inner fail.         |
7108
7109**Example**
7110
7111For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7112
7113``` ts
7114import { dataSharePredicates } from '@kit.ArkData';
7115
7116async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7117  try {
7118    console.info('setDisplayLevel Example')
7119    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7120    predicates.equalTo('user_display_level', 2);
7121    let fetchOptions: photoAccessHelper.FetchOptions = {
7122      fetchColumns: [],
7123      predicates: predicates
7124    };
7125    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.PORTRAIT, fetchOptions);
7126    let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
7127    let changeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7128    changeRequest.setDisplayLevel(1);
7129    await phAccessHelper.applyChanges(changeRequest);
7130  } catch (err) {
7131    console.error(`setDisplayLevel failed with error: ${err.code}, ${err.message}`);
7132  }
7133}
7134```
7135
7136### setIsMe<sup>11+</sup>
7137
7138setIsMe(): void
7139
7140Sets the relationship between people in the portrait album to **Me**.
7141
7142**System API**: This is a system API.
7143
7144**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7145
7146**Error codes**
7147
7148For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7149
7150| ID| Error Message|
7151| -------- | ---------------------------------------- |
7152| 202        |  Called by non-system application.         |
7153| 401    | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
7154| 14000011       | System inner fail.         |
7155
7156**Example**
7157
7158For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7159
7160``` ts
7161import { dataSharePredicates } from '@kit.ArkData';
7162
7163async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7164  try {
7165    console.info('setIsMe Example')
7166    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7167    predicates.equalTo('user_display_level', 2);
7168    let fetchOptions: photoAccessHelper.FetchOptions = {
7169      fetchColumns: [],
7170      predicates: predicates
7171    };
7172    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.PORTRAIT, fetchOptions);
7173    let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
7174    let changeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7175    changeRequest.setIsMe();
7176    await phAccessHelper.applyChanges(changeRequest);
7177  } catch (err) {
7178    console.error(`setIsMe failed with error: ${err.code}, ${err.message}`);
7179  }
7180}
7181```
7182
7183### dismissAssets<sup>11+</sup>
7184
7185dismissAssets(assets: Array&lt;PhotoAsset&gt;): void
7186
7187Removes assets from this portrait album or group photo album.
7188
7189**System API**: This is a system API.
7190
7191**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7192
7193**Parameters**
7194
7195| Name       | Type     | Mandatory  | Description                                |
7196| ---------- | ------- | ---- | ---------------------------------- |
7197| assets | Array&lt;PhotoAsset&gt; | Yes   | Assets to remove.|
7198
7199**Error codes**
7200
7201For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7202
7203| ID| Error Message|
7204| -------- | ---------------------------------------- |
7205| 202        |  Called by non-system application.         |
7206| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7207| 14000011       | System inner fail.         |
7208| 14000016       | Operation Not support.         |
7209
7210**Example**
7211
7212For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7213
7214``` ts
7215import { dataSharePredicates } from '@kit.ArkData';
7216
7217async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7218  try {
7219    console.info('dismissAssets Example')
7220    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7221    predicates.equalTo('user_display_level', 2);
7222    let fetchOptions: photoAccessHelper.FetchOptions = {
7223      fetchColumns: [],
7224      predicates: predicates
7225    };
7226    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.PORTRAIT, fetchOptions);
7227    let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
7228
7229    let predicatesAsset: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7230    let assetFetchOptions: photoAccessHelper.FetchOptions = {
7231      fetchColumns: [],
7232      predicates: predicatesAsset
7233    };
7234    let assetFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(assetFetchOptions);
7235    let asset: photoAccessHelper.PhotoAsset = await assetFetchResult.getFirstObject();
7236
7237    let changeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7238    changeRequest.dismissAssets([asset]);
7239    await phAccessHelper.applyChanges(changeRequest);
7240  } catch (err) {
7241    console.error(`dismissAssets failed with error: ${err.code}, ${err.message}`);
7242  }
7243}
7244```
7245
7246### mergeAlbum<sup>11+</sup>
7247
7248mergeAlbum(target: Album): void
7249
7250Merges two portrait albums.
7251
7252**System API**: This is a system API.
7253
7254**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7255
7256**Parameters**
7257
7258| Name       | Type     | Mandatory  | Description                                |
7259| ---------- | ------- | ---- | ---------------------------------- |
7260| target | [Album](#album) | Yes   | Album generated after the merge. The album must be renamed.|
7261
7262**Error codes**
7263
7264For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7265
7266| ID| Error Message|
7267| -------- | ---------------------------------------- |
7268| 202        |  Called by non-system application.         |
7269| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7270| 14000011       | System inner fail.         |
7271| 14000016       | Operation Not support.         |
7272
7273**Example**
7274
7275For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7276
7277``` ts
7278import { dataSharePredicates } from '@kit.ArkData';
7279
7280async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7281  try {
7282    console.info('mergeAlbum Example')
7283    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7284    predicates.equalTo('user_display_level', 2);
7285    let fetchOptions: photoAccessHelper.FetchOptions = {
7286      fetchColumns: [],
7287      predicates: predicates
7288    };
7289    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.PORTRAIT, fetchOptions);
7290    let album: photoAccessHelper.Album = await fetchResult.getFirstObject();
7291    if (fetchResult.isAfterLast()) {
7292      console.error('lack of album to merge');
7293      return;
7294    }
7295    let target: photoAccessHelper.Album = await fetchResult.getNextObject();
7296
7297    let changeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7298    changeRequest.mergeAlbum(target);
7299    changeRequest.setAlbumName("testName");
7300    await phAccessHelper.applyChanges(changeRequest);
7301  } catch (err) {
7302    console.error(`mergeAlbum failed with error: ${err.code}, ${err.message}`);
7303  }
7304}
7305```
7306
7307### placeBefore<sup>11+</sup>
7308
7309placeBefore(album: Album): void;
7310
7311Places this album before an album.
7312
7313**System API**: This is a system API.
7314
7315**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7316
7317**Parameters**
7318
7319| Name       | Type     | Mandatory  | Description                                |
7320| ---------- | ------- | ---- | ---------------------------------- |
7321| album | [Album](#album) | Yes  |  Target album. To place this album to the end, set **album** to null.|
7322
7323**Error codes**
7324
7325For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7326
7327| ID| Error Message|
7328| -------- | ---------------------------------------- |
7329| 202      |  Called by non-system application.         |
7330| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7331| 14000011       | System inner fail.         |
7332
7333**Example**
7334
7335For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7336
7337```ts
7338async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7339  console.info('placeBeforeDemo');
7340  try {
7341    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
7342    let firstAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7343    if (albumFetchResult.isAfterLast()) {
7344      console.error('lack of album to place before');
7345      return;
7346    }
7347    let secondAlbum: photoAccessHelper.Album = await albumFetchResult.getNextObject();
7348    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(secondAlbum);
7349    albumChangeRequest.placeBefore(firstAlbum);
7350    await phAccessHelper.applyChanges(albumChangeRequest);
7351    console.info('placeBefore successfully');
7352  } catch (err) {
7353    console.error(`placeBeforeDemo failed with error: ${err.code}, ${err.message}`);
7354  }
7355}
7356```
7357
7358### dismiss<sup>13+</sup>
7359
7360dismiss(): void
7361
7362Removes this group photo album.
7363
7364**System API**: This is a system API.
7365
7366**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7367
7368**Error codes**
7369
7370For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7371
7372| ID   | Error Message                             |
7373| :------- | :-------------------------------- |
7374| 202      | Called by non-system application. |
7375| 401 | Parameter error. Possible causes: Incorrect parameter types. |
7376| 14000011 | System inner fail.            |
7377
7378**Example**
7379
7380For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
7381
7382```ts
7383import { dataSharePredicates } from '@kit.ArkData';
7384
7385async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7386  console.info('dismissDemo');
7387  try {
7388    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.GROUP_PHOTO);
7389    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7390
7391    let albumChangeRequest: photoAccessHelper.MediaAlbumChangeRequest = new photoAccessHelper.MediaAlbumChangeRequest(album);
7392    albumChangeRequest.dismiss();
7393    await phAccessHelper.applyChanges(albumChangeRequest);
7394    console.info('dismiss successfully');
7395  } catch (err) {
7396    console.error(`dismissDemo failed with error: ${err.code}, ${err.message}`);
7397  }
7398}
7399```
7400
7401## HighlightAlbum<sup>12+</sup>
7402
7403Provides APIs for managing the **Highlights** album, which is an automatically generated collection of memorable photos or videos.
7404
7405**System API**: This is a system API.
7406
7407**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7408
7409### constructor<sup>12+</sup>
7410
7411constructor(album: Album)
7412
7413A constructor used to create a **Highlights** album instance.
7414
7415**System API**: This is a system API.
7416
7417**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7418
7419**Parameters**
7420
7421| Name  | Type                     | Mandatory| Description      |
7422| -------- | ------------------------- | ---- | ---------- |
7423| album | [Album](#album) | Yes  | **Highlights** album to create.|
7424
7425**Error codes**
7426
7427For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7428
7429| ID| Error Message|
7430| -------- | ---------------------------------------- |
7431| 202      |  Called by non-system application.   |
7432| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7433| 14000011 | Internal system error.            |
7434
7435**Example**
7436
7437```ts
7438import { dataSharePredicates } from '@kit.ArkData';
7439
7440async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7441  console.info('HighlightAlbum constructorDemo');
7442  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7443  let fetchOption: photoAccessHelper.FetchOptions = {
7444    fetchColumns: [],
7445    predicates: predicates
7446  };
7447  let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(
7448    photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, fetchOption);
7449  let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7450  let highlightAlbum: photoAccessHelper.HighlightAlbum = new photoAccessHelper.HighlightAlbum(album);
7451  albumFetchResult.close();
7452}
7453```
7454
7455### getHighlightAlbumInfo<sup>12+</sup>
7456
7457getHighlightAlbumInfo(type: HighlightAlbumInfoType): Promise&lt;string&gt;
7458
7459Obtains specific information about the **Highlights** album.
7460
7461**System API**: This is a system API.
7462
7463**Required permissions**: ohos.permission.READ\_IMAGEVIDEO
7464
7465**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7466
7467**Parameters**
7468
7469| Name       | Type     | Mandatory  | Description                                |
7470| ---------- | ------- | ---- | ---------------------------------- |
7471| type       | [HighlightAlbumInfoType](#highlightalbuminfotype12) | Yes   | Type of the album information to obtain.|
7472
7473
7474**Return value**
7475
7476| Type                       | Description          |
7477| --------------------------- | -------------- |
7478| Promise&lt;string&gt; | Promise used to return the album information.|
7479
7480**Error codes**
7481
7482For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7483
7484| ID   | Error Message                             |
7485| :------- | :-------------------------------- |
7486| 201      | Permission denied.                |
7487| 202      | Called by non-system application. |
7488| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7489| 14000011 | Internal system error.            |
7490
7491**Example**
7492
7493```ts
7494import { dataSharePredicates } from '@kit.ArkData';
7495
7496async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7497  try {
7498    console.info('getHighlightAlbumInfoDemo')
7499    let fetchOptions: photoAccessHelper.FetchOptions = {
7500      fetchColumns: [],
7501      predicates: new dataSharePredicates.DataSharePredicates()
7502    }
7503    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(
7504      photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, fetchOptions);
7505    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7506    if (album != undefined) {
7507      let highlightAlbum: photoAccessHelper.HighlightAlbum = new photoAccessHelper.HighlightAlbum(album);
7508      let coverInfo: string = await highlightAlbum.getHighlightAlbumInfo(
7509        photoAccessHelper.HighlightAlbumInfoType.COVER_INFO);
7510      console.info('get cover info result: ' + JSON.stringify(coverInfo));
7511    }
7512
7513    albumFetchResult.close();
7514  } catch (err) {
7515    console.error(`getHighlightAlbumInfoDemofailed with error: ${err.code}, ${err.message}`);
7516  }
7517}
7518```
7519
7520### getHighlightResource<sup>12+</sup>
7521
7522getHighlightResource(resourceUri: string): Promise&lt;ArrayBuffer&gt;
7523
7524Obtains the ArrayBuffer for caching the specified asset.
7525
7526**System API**: This is a system API.
7527
7528**Required permissions**: ohos.permission.READ\_IMAGEVIDEO
7529
7530**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7531
7532**Parameters**
7533
7534| Name       | Type     | Mandatory  | Description                                |
7535| ---------- | ------- | ---- | ---------------------------------- |
7536| resourceUri       | string | Yes   | URI of the asset to cache.|
7537
7538**Return value**
7539
7540| Type                       | Description          |
7541| --------------------------- | -------------- |
7542| Promise&lt;ArrayBuffer&gt; | Promise used to return the ArrayBuffer.|
7543
7544**Error codes**
7545
7546For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7547
7548| ID   | Error Message                             |
7549| :------- | :-------------------------------- |
7550| 201      | Permission denied.                |
7551| 202      | Called by non-system application. |
7552| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7553| 14000011 | Internal system error. Possible causes: 1. The database is corrupted; 2. The file system is abnormal; 3. The IPC request timed out; 4. Permission denied.           |
7554
7555**Example**
7556
7557```ts
7558import { dataSharePredicates } from '@kit.ArkData';
7559
7560async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7561  try {
7562    console.info('getHighlightResourceDemo')
7563    let fetchOptions: photoAccessHelper.FetchOptions = {
7564      fetchColumns: [],
7565      predicates: new dataSharePredicates.DataSharePredicates()
7566    }
7567    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(
7568      photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, fetchOptions);
7569    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7570    if (album != undefined) {
7571      let highlightAlbum: photoAccessHelper.HighlightAlbum = new photoAccessHelper.HighlightAlbum(album);
7572      let uri: string = 'file://media/highlight/cover/10/1_1/background.png?oper=highlight'
7573      let arrayBuffer: ArrayBuffer = await highlightAlbum.getHighlightResource(uri);
7574    }
7575    albumFetchResult.close();
7576  } catch (err) {
7577    console.error(`getHighlightResourceDemofailed with error: ${err.code}, ${err.message}`);
7578  }
7579}
7580```
7581
7582### setHighlightUserActionData<sup>12+</sup>
7583
7584setHighlightUserActionData(type: HighlightUserActionType, actionData: number): Promise&lt;void&gt;
7585
7586Sets the user behavior data for the **Highlights** album.
7587
7588**System API**: This is a system API.
7589
7590**Required permissions**: ohos.permission.WRITE\_IMAGEVIDEO
7591
7592**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7593
7594**Parameters**
7595
7596| Name       | Type     | Mandatory  | Description                                |
7597| ---------- | ------- | ---- | ---------------------------------- |
7598| type       | [HighlightUserActionType](#highlightuseractiontype12) | Yes   | Type of the user behavior data to set.|
7599| actionData | number | Yes   | Behavior data.|
7600
7601**Return value**
7602
7603| Type                       | Description          |
7604| --------------------------- | -------------- |
7605| Promise&lt;void&gt; | Promise that returns no value.|
7606
7607**Error codes**
7608
7609For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7610
7611| ID   | Error Message                             |
7612| :------- | :-------------------------------- |
7613| 201      | Permission denied.                |
7614| 202      | Called by non-system application. |
7615| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7616| 14000011 | Internal system error.            |
7617
7618**Example**
7619
7620```ts
7621import { dataSharePredicates } from '@kit.ArkData';
7622
7623async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper) {
7624  try {
7625    console.info('setHighlightUserActionDataDemo')
7626    let fetchOptions: photoAccessHelper.FetchOptions = {
7627      fetchColumns: [],
7628      predicates: new dataSharePredicates.DataSharePredicates()
7629    }
7630    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(
7631      photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, fetchOptions);
7632    let album: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7633    if (album != undefined) {
7634      let highlightAlbum: photoAccessHelper.HighlightAlbum = new photoAccessHelper.HighlightAlbum(album);
7635      highlightAlbum.setHighlightUserActionData(photoAccessHelper.HighlightUserActionType.INSERTED_PIC_COUNT, 1);
7636    }
7637    albumFetchResult.close();
7638  } catch (err) {
7639    console.error(`setHighlightUserActionDataDemofailed with error: ${err.code}, ${err.message}`);
7640  }
7641}
7642```
7643
7644### setSubTitle<sup>18+</sup>
7645
7646setSubTitle(title: string): void
7647
7648Sets the subtitle for this **Highlights** album instance.
7649
7650The subtitle must meet the following requirements:
7651
7652- The subtitle string contains 0 to 255 characters.
7653- The subtitle cannot contain any of the following characters:<br> . \ / : * ? " ' ` < > | { } [ ]
7654- The subtitle is case-insensitive.
7655
7656**System API**: This is a system API.
7657
7658**Required permissions**: ohos.permission.WRITE\_IMAGEVIDEO
7659
7660**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7661
7662**Parameters**
7663
7664| Name       | Type     | Mandatory  | Description                                |
7665| ---------- | ------- | ---- | ---------------------------------- |
7666| title       | string | Yes   | Subtitle to set.|
7667
7668**Error codes**
7669
7670For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7671
7672| ID   | Error Message                             |
7673| :------- | :-------------------------------- |
7674| 201      | Permission denied.                |
7675| 202      | Called by non-system application. |
7676| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7677| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
7678
7679**Example**
7680
7681```ts
7682import { dataSharePredicates } from '@kit.ArkData';
7683
7684async function example(context: Context) {
7685  try {
7686    console.info('setSubTitle');
7687    let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
7688    let albumFetchOption: photoAccessHelper.FetchOptions = {
7689      fetchColumns: [],
7690      predicates: new dataSharePredicates.DataSharePredicates()
7691    };
7692    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
7693      await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
7694    if (albumFetchResult.getCount() === 0) {
7695      console.error('No album');
7696      return;
7697    }
7698    let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7699    albumFetchResult.close();
7700    let changeHighlightAlbumRequest: photoAccessHelper.HighlightAlbum = new photoAccessHelper.HighlightAlbum(highlightAlbum);
7701    changeHighlightAlbumRequest.setSubTitle("testName");
7702    console.info('setSubTitle success');
7703  } catch (err) {
7704    console.error(`setSubTitle with error: ${err}`);
7705  }
7706}
7707```
7708
7709### deleteHighlightAlbums<sup>18+</sup>
7710
7711static deleteHighlightAlbums(context: Context, albums: Array&lt;Album&gt;): Promise&lt;number&gt;
7712
7713Deletes highlight albums.
7714
7715**System API**: This is a system API.
7716
7717**Required permissions**: ohos.permission.WRITE\_IMAGEVIDEO
7718
7719**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7720
7721**Parameters**
7722
7723| Name       | Type     | Mandatory  | Description                                |
7724| ---------- | ------- | ---- | ---------------------------------- |
7725| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
7726| albums       | Array&lt;[Album](#album)&gt;   | Yes   | Array of highlight albums to delete.|
7727
7728**Return value**
7729
7730| Type               | Description                               |
7731| :------------------ | :---------------------------------- |
7732| Promise&lt;number&gt; | Promise used to return the operation result. The value **0** means that the operation is successful, and **1** means the opposite.|
7733
7734**Error codes**
7735
7736For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7737
7738| ID   | Error Message                             |
7739| :------- | :-------------------------------- |
7740| 201      | Permission denied.                |
7741| 202      | Called by non-system application. |
7742| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7743| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
7744
7745**Example**
7746
7747```ts
7748import { dataSharePredicates } from '@kit.ArkData';
7749
7750async function example(context: Context) {
7751  try {
7752    console.info('deleteHighlightAlbums');
7753    let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
7754    let albumFetchOption: photoAccessHelper.FetchOptions = {
7755      fetchColumns: [],
7756      predicates: new dataSharePredicates.DataSharePredicates()
7757    };
7758    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
7759      await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
7760    if (albumFetchResult.getCount() === 0) {
7761      console.error('No album');
7762      return;
7763    }
7764    let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7765    albumFetchResult.close();
7766    let result = await photoAccessHelper.HighlightAlbum.deleteHighlightAlbums(context, [highlightAlbum]);
7767    console.info('deleteHighlightAlbums success');
7768  } catch (err) {
7769    console.error(`deleteHighlightAlbums with error: ${err}`);
7770  }
7771}
7772```
7773
7774## MediaAnalysisAlbumChangeRequest<sup>18+</sup>
7775
7776Provides APIs for managing the analysis album change request.
7777
7778**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7779
7780### constructor<sup>18+</sup>
7781
7782constructor(album: Album)
7783
7784A constructor used to create an **Analysis** album instance.
7785
7786**System API**: This is a system API.
7787
7788**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7789
7790**Parameters**
7791
7792| Name       | Type     | Mandatory  | Description                                |
7793| ---------- | ------- | ---- | ---------------------------------- |
7794| album | [Album](#album) | Yes  | **Analysis** album to create.|
7795
7796**Error codes**
7797
7798For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7799
7800| ID| Error Message|
7801| -------- | ---------------------------------------- |
7802| 202      |  Called by non-system application.   |
7803| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7804
7805**Example**
7806
7807```ts
7808import { dataSharePredicates } from '@kit.ArkData';
7809
7810async function example(context: Context) {
7811  console.info('MediaAnalysisAlbumChangeRequest constructorDemo');
7812  let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
7813  let albumFetchOption: photoAccessHelper.FetchOptions = {
7814    fetchColumns: [],
7815    predicates: new dataSharePredicates.DataSharePredicates()
7816  };
7817  let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
7818    await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
7819  if (albumFetchResult.getCount() === 0) {
7820    console.error('No album');
7821    return;
7822  }
7823  let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7824  albumFetchResult.close();
7825  let changeRequest: photoAccessHelper.MediaAnalysisAlbumChangeRequest =
7826    new photoAccessHelper.MediaAnalysisAlbumChangeRequest(highlightAlbum);
7827}
7828```
7829
7830### setOrderPosition<sup>18+</sup>
7831
7832setOrderPosition(assets: Array&lt;PhotoAsset&gt;, position: Array&lt;number&gt;): void
7833
7834Sets the sequence of assets in the **Analysis** album.
7835
7836**System API**: This is a system API.
7837
7838**Required permissions**: ohos.permission.WRITE\_IMAGEVIDEO
7839
7840**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7841
7842**Parameters**
7843
7844| Name       | Type     | Mandatory  | Description                                |
7845| ---------- | ------- | ---- | ---------------------------------- |
7846| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets in the album for which the sequence needs to be set.|
7847| position       | Array&lt;number&gt;   | Yes   | Sequence of assets in the album.|
7848
7849**Error codes**
7850
7851For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7852
7853| ID   | Error Message                             |
7854| :------- | :-------------------------------- |
7855| 201      | Permission denied.                |
7856| 202      | Called by non-system application. |
7857| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7858| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
7859
7860**Example**
7861
7862```ts
7863import { dataSharePredicates } from '@kit.ArkData';
7864
7865async function example(context: Context) {
7866  try {
7867    console.info('setOrderPosition');
7868    let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
7869    let albumFetchOption: photoAccessHelper.FetchOptions = {
7870      fetchColumns: [],
7871      predicates: new dataSharePredicates.DataSharePredicates()
7872    };
7873    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
7874      await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
7875    if (albumFetchResult.getCount() === 0) {
7876      console.error('No album');
7877      return;
7878    }
7879    let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7880    albumFetchResult.close();
7881    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
7882    const fetchOption: photoAccessHelper.FetchOptions = {
7883      fetchColumns: [],
7884      predicates: predicates
7885    };
7886    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> =
7887      await highlightAlbum.getAssets(fetchOption);
7888    let assets: photoAccessHelper.PhotoAsset[] = await fetchResult.getAllObjects();
7889    let indexes: number[] = [];
7890    for (let i = 0; i < assets.length; i++) {
7891      indexes.push(i);
7892    }
7893    let changeRequest: photoAccessHelper.MediaAnalysisAlbumChangeRequest =
7894      new photoAccessHelper.MediaAnalysisAlbumChangeRequest(highlightAlbum);
7895    changeRequest.setOrderPosition(assets, indexes);
7896    await helper.applyChanges(changeRequest);
7897    console.info(`setOrderPosition ${indexes}`);
7898  } catch (err) {
7899    console.error(`setOrderPosition error: ${err}`);
7900  }
7901}
7902```
7903
7904## AnalysisAlbum<sup>18+</sup>
7905
7906**Analysis** album to create.
7907
7908**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7909
7910### constructor<sup>18+</sup>
7911
7912constructor(album: Album)
7913
7914A constructor used to create an **Analysis** album instance.
7915
7916**System API**: This is a system API.
7917
7918**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7919
7920**Parameters**
7921
7922| Name       | Type     | Mandatory  | Description                                |
7923| ---------- | ------- | ---- | ---------------------------------- |
7924| album | [Album](#album) | Yes  | **Analysis** album to create.|
7925
7926**Error codes**
7927
7928For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7929
7930| ID| Error Message|
7931| -------- | ---------------------------------------- |
7932| 202      |  Called by non-system application.   |
7933| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7934
7935**Example**
7936
7937```ts
7938import { dataSharePredicates } from '@kit.ArkData';
7939
7940async function example(context: Context) {
7941  console.info('AnalysisAlbum constructorDemo');
7942  let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
7943  let albumFetchOption: photoAccessHelper.FetchOptions = {
7944    fetchColumns: [],
7945    predicates: new dataSharePredicates.DataSharePredicates()
7946  };
7947  let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
7948    await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
7949  if (albumFetchResult.getCount() === 0) {
7950    console.error('No album');
7951    return;
7952  }
7953  let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
7954  albumFetchResult.close();
7955  let analysisAlbum: photoAccessHelper.AnalysisAlbum = new photoAccessHelper.AnalysisAlbum(highlightAlbum);
7956}
7957```
7958
7959### getOrderPosition<sup>18+</sup>
7960
7961getOrderPosition(assets: Array&lt;PhotoAsset&gt;): Promise&lt;Array&lt;number&gt;&gt;
7962
7963Obtains the sequence of assets in the **Analysis** album.
7964
7965**System API**: This is a system API.
7966
7967**Required permissions**: ohos.permission.READ\_IMAGEVIDEO
7968
7969**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
7970
7971**Parameters**
7972
7973| Name       | Type     | Mandatory  | Description                                |
7974| ---------- | ------- | ---- | ---------------------------------- |
7975| assets | Array&lt;[PhotoAsset](#photoasset)&gt; | Yes  | Assets in the album whose sequence needs to be obtained.|
7976
7977**Return value**
7978
7979| Type               | Description                               |
7980| :------------------ | :---------------------------------- |
7981| Promise&lt;Array&lt;number&gt;&gt; | Sequence number of an asset in the album.|
7982
7983**Error codes**
7984
7985For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
7986
7987| ID   | Error Message                             |
7988| :------- | :-------------------------------- |
7989| 201      | Permission denied.                |
7990| 202      | Called by non-system application. |
7991| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
7992| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
7993
7994**Example**
7995
7996```ts
7997import { dataSharePredicates } from '@kit.ArkData';
7998
7999async function example(context: Context) {
8000  try {
8001    console.info('getOrderPosition');
8002    let helper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8003    let albumFetchOption: photoAccessHelper.FetchOptions = {
8004      fetchColumns: [],
8005      predicates: new dataSharePredicates.DataSharePredicates()
8006    };
8007    let albumFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> =
8008      await helper.getAlbums(photoAccessHelper.AlbumType.SMART, photoAccessHelper.AlbumSubtype.HIGHLIGHT, albumFetchOption);
8009    if (albumFetchResult.getCount() === 0) {
8010      console.error('No album');
8011      return;
8012    }
8013    let highlightAlbum: photoAccessHelper.Album = await albumFetchResult.getFirstObject();
8014    albumFetchResult.close();
8015    let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8016    let analysisAlbum: photoAccessHelper.AnalysisAlbum = new photoAccessHelper.AnalysisAlbum(highlightAlbum);
8017    const fetchOption: photoAccessHelper.FetchOptions = {
8018      fetchColumns: [],
8019      predicates: predicates
8020    };
8021    let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> =
8022      await highlightAlbum.getAssets(fetchOption);
8023    let assets: photoAccessHelper.PhotoAsset[] = await fetchResult.getAllObjects();
8024    let positions: number[] = await analysisAlbum.getOrderPosition(assets);
8025    console.info(`getOrderPosition ${positions}`);
8026  } catch (err) {
8027    console.error(`getOrderPosition error: ${err}`);
8028  }
8029}
8030```
8031
8032## CloudEnhancement<sup>13+</sup>
8033
8034Provides APIs for cloud enhancement management, including managing the tasks of generating AI-powered cloud-enhanced photos and obtaining the association between the original photos and AI cloud-enhanced photos.
8035
8036**System API**: This is a system API.
8037
8038**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8039
8040### getCloudEnhancementInstance<sup>13+</sup>
8041
8042static getCloudEnhancementInstance(context: Context): CloudEnhancement
8043
8044Obtains a cloud enhancement instance.
8045
8046**System API**: This is a system API.
8047
8048**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8049
8050**Parameters**
8051
8052| Name  | Type                     | Mandatory| Description      |
8053| -------- | ------------------------- | ---- | ---------- |
8054| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
8055
8056**Return value**
8057
8058| Type                                   | Description             |
8059| --------------------------------------- | ----------------- |
8060| [CloudEnhancement](#cloudenhancement13) | A cloud enhancement instance.|
8061
8062**Error codes**
8063
8064For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8065
8066| ID| Error Message|
8067| -------- | ---------------------------------------- |
8068| 202      |  Called by non-system application.   |
8069| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8070| 14000011 | Internal system error.            |
8071
8072**Example**
8073
8074```ts
8075import { dataSharePredicates } from '@kit.ArkData';
8076
8077async function example(context: Context) {
8078  console.info('getCloudEnhancementInstanceDemo');
8079  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8080  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8081    fetchColumns: [],
8082    predicates: photoPredicates
8083  };
8084  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8085  try {
8086    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8087    let asset = await fetchResult.getLastObject();
8088    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8089      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8090    let hasCloudWatermark = true;
8091    await cloudEnhancementInstance.submitCloudEnhancementTasks([asset], hasCloudWatermark);
8092  } catch (err) {
8093    console.error(`getCloudEnhancementInstanceDemo failed with error: ${err.code}, ${err.message}`);
8094  }
8095}
8096```
8097
8098### submitCloudEnhancementTasks<sup>13+</sup>
8099
8100submitCloudEnhancementTasks(photoAssets: Array&lt;PhotoAsset&gt;, hasCloudWatermark: boolean): Promise&lt;void&gt;
8101
8102Submits cloud enhancement tasks.
8103
8104**System API**: This is a system API.
8105
8106**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8107
8108**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
8109
8110**Parameters**
8111
8112| Name  | Type                     | Mandatory| Description      |
8113| -------- | ------------------------- | ---- | ---------- |
8114| photoAssets | Array<[PhotoAsset](#photoasset)> | Yes  | [PhotoAsset](#photoasset) to enhance.|
8115| hasCloudWatermark | boolean | Yes  | Whether to add a cloud enhancement watermark to the enhanced images.|
8116
8117**Return value**
8118
8119| Type                 | Description        |
8120| ------------------- | ---------- |
8121| Promise&lt;void&gt; | Promise that returns no value.|
8122
8123**Error codes**
8124
8125For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8126
8127| ID| Error Message|
8128| -------- | ---------------------------------------- |
8129| 201      | Permission denied.                |
8130| 202      | Called by non-system application. |
8131| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8132| 14000011 | Internal system error.            |
8133
8134**Example**
8135
8136For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8137
8138```ts
8139import { dataSharePredicates } from '@kit.ArkData';
8140
8141async function example(context: Context) {
8142  console.info('submitCloudEnhancementTasksDemo');
8143  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8144  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8145    fetchColumns: [],
8146    predicates: photoPredicates
8147  };
8148  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8149  try {
8150    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8151    let asset = await fetchResult.getLastObject();
8152    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8153      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8154    let hasCloudWatermark = true;
8155    await cloudEnhancementInstance.submitCloudEnhancementTasks([asset], hasCloudWatermark);
8156  } catch (err) {
8157    console.error(`submitCloudEnhancementTasksDemo failed with error: ${err.code}, ${err.message}`);
8158  }
8159}
8160```
8161
8162### submitCloudEnhancementTasks<sup>18+</sup>
8163
8164submitCloudEnhancementTasks(photoAssets: Array&lt;PhotoAsset&gt;, hasCloudWatermark: boolean, triggerMode?: number): Promise&lt;void&gt;
8165
8166Submits cloud enhancement tasks.
8167
8168**System API**: This is a system API.
8169
8170**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8171
8172**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
8173
8174**Parameters**
8175
8176| Name  | Type                     | Mandatory| Description      |
8177| -------- | ------------------------- | ---- | ---------- |
8178| photoAssets | Array<[PhotoAsset](#photoasset)> | Yes  | [PhotoAsset](#photoasset) to enhance.|
8179| hasCloudWatermark | boolean | Yes  | Whether to add a cloud watermark to the enhanced image. **true** to add, **false** otherwise.|
8180| triggerMode | number | No  | Trigger mode of the cloud enhancement task.<br>**- 0**: manually triggered.<br>**- 1**: automatically triggered.<br>The default value is **0**.|
8181
8182**Return value**
8183
8184| Type                 | Description        |
8185| ------------------- | ---------- |
8186| Promise&lt;void&gt; | Promise that returns no value.|
8187
8188**Error codes**
8189
8190For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8191
8192| ID| Error Message|
8193| -------- | ---------------------------------------- |
8194| 201      | Permission denied.                |
8195| 202      | Called by non-system application. |
8196| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8197| 14000011 | Internal system error.            |
8198
8199**Example**
8200
8201For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8202
8203```ts
8204import { dataSharePredicates } from '@kit.ArkData';
8205
8206async function example(context: Context) {
8207  console.info('submitCloudEnhancementTasksDemo');
8208  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8209  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8210    fetchColumns: [],
8211    predicates: photoPredicates
8212  };
8213  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8214  try {
8215    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8216    let asset = await fetchResult.getLastObject();
8217    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8218      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8219    let hasCloudWatermark = true;
8220    let triggerAuto = 1;
8221    await cloudEnhancementInstance.submitCloudEnhancementTasks([asset], hasCloudWatermark, triggerAuto);
8222  } catch (err) {
8223    console.error(`submitCloudEnhancementTasksDemo failed with error: ${err.code}, ${err.message}`);
8224  }
8225}
8226```
8227
8228### prioritizeCloudEnhancementTask<sup>13+</sup>
8229
8230prioritizeCloudEnhancementTask(photoAsset: PhotoAsset): Promise&lt;void&gt;
8231
8232Prioritizes a cloud enhancement task.
8233
8234**System API**: This is a system API.
8235
8236**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8237
8238**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
8239
8240**Parameters**
8241
8242| Name  | Type                     | Mandatory| Description      |
8243| -------- | ------------------------- | ---- | ---------- |
8244| photoAsset | [PhotoAsset](#photoasset) | Yes  | [PhotoAsset](#photoasset) whose cloud enhancement priority needs to be escalated.|
8245
8246**Return value**
8247
8248| Type                 | Description        |
8249| ------------------- | ---------- |
8250| Promise&lt;void&gt; | Promise that returns no value.|
8251
8252**Error codes**
8253
8254For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8255
8256| ID| Error Message|
8257| -------- | ---------------------------------------- |
8258| 201      | Permission denied.                |
8259| 202      | Called by non-system application. |
8260| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8261| 14000011 | Internal system error.            |
8262
8263**Example**
8264
8265For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8266
8267```ts
8268import { dataSharePredicates } from '@kit.ArkData';
8269
8270async function example(context: Context) {
8271  console.info('prioritizeCloudEnhancementTaskDemo');
8272  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8273  // Obtain the cloud enhancement tasks in progress.
8274  photoPredicates.equalTo(photoAccessHelper.PhotoKeys.CE_AVAILABLE, 2);
8275  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8276    fetchColumns: [],
8277    predicates: photoPredicates
8278  };
8279  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8280  try {
8281    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8282    let asset = await fetchResult.getLastObject();
8283    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8284      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8285    let hasCloudWatermark = true;
8286    await cloudEnhancementInstance.prioritizeCloudEnhancementTask(asset);
8287  } catch (err) {
8288    console.error(`prioritizeCloudEnhancementTaskDemo failed with error: ${err.code}, ${err.message}`);
8289  }
8290}
8291```
8292
8293### cancelCloudEnhancementTasks<sup>13+</sup>
8294
8295cancelCloudEnhancementTasks(photoAssets: Array&lt;PhotoAsset&gt;): Promise&lt;void&gt;
8296
8297Cancels cloud enhancement tasks.
8298
8299**System API**: This is a system API.
8300
8301**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8302
8303**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
8304
8305**Parameters**
8306
8307| Name  | Type                     | Mandatory| Description      |
8308| -------- | ------------------------- | ---- | ---------- |
8309| photoAssets | Array<[PhotoAsset](#photoasset)> | Yes  | Array of [PhotoAssets](#photoasset) whose cloud enhancement tasks are to be canceled.|
8310
8311**Return value**
8312
8313| Type                 | Description        |
8314| ------------------- | ---------- |
8315| Promise&lt;void&gt; | Promise that returns no value.|
8316
8317**Error codes**
8318
8319For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8320
8321| ID| Error Message|
8322| -------- | ---------------------------------------- |
8323| 201      | Permission denied.                |
8324| 202      | Called by non-system application. |
8325| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8326| 14000011 | Internal system error.            |
8327
8328**Example**
8329
8330For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8331
8332```ts
8333import { dataSharePredicates } from '@kit.ArkData';
8334
8335async function example(context: Context) {
8336  console.info('cancelCloudEnhancementTasksDemo');
8337  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8338  // Obtain the cloud enhancement tasks in progress.
8339  photoPredicates.equalTo(photoAccessHelper.PhotoKeys.CE_AVAILABLE, 2);
8340  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8341    fetchColumns: [],
8342    predicates: photoPredicates
8343  };
8344  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8345  try {
8346    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8347    let asset = await fetchResult.getLastObject();
8348    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8349      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8350    await cloudEnhancementInstance.cancelCloudEnhancementTasks([asset]);
8351  } catch (err) {
8352    console.error(`cancelCloudEnhancementTasksDemo failed with error: ${err.code}, ${err.message}`);
8353  }
8354}
8355```
8356
8357### cancelAllCloudEnhancementTasks<sup>13+</sup>
8358
8359cancelAllCloudEnhancementTasks(): Promise&lt;void&gt;
8360
8361Cancels all cloud enhancement tasks.
8362
8363**System API**: This is a system API.
8364
8365**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8366
8367**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
8368
8369**Return value**
8370
8371| Type                 | Description        |
8372| ------------------- | ---------- |
8373| Promise&lt;void&gt; | Promise that returns no value.|
8374
8375**Error codes**
8376
8377For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8378
8379| ID| Error Message|
8380| -------- | ---------------------------------------- |
8381| 201      | Permission denied.                |
8382| 202      | Called by non-system application. |
8383| 14000011 | Internal system error.            |
8384
8385**Example**
8386
8387```ts
8388import { dataSharePredicates } from '@kit.ArkData';
8389
8390async function example(context: Context) {
8391  console.info('cancelAllCloudEnhancementTasksDemo');
8392  try {
8393    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8394      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8395    await cloudEnhancementInstance.cancelAllCloudEnhancementTasks();
8396  } catch (err) {
8397    console.error(`cancelAllCloudEnhancementTasksDemo failed with error: ${err.code}, ${err.message}`);
8398  }
8399}
8400```
8401
8402### queryCloudEnhancementTaskState<sup>13+</sup>
8403
8404queryCloudEnhancementTaskState(photoAsset: PhotoAsset): Promise&lt;CloudEnhancementTaskState&gt;
8405
8406Queries information about a cloud enhancement task.
8407
8408**System API**: This is a system API.
8409
8410**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8411
8412**Required permissions**: ohos.permission.READ_IMAGEVIDEO
8413
8414**Parameters**
8415
8416| Name  | Type                     | Mandatory| Description      |
8417| -------- | ------------------------- | ---- | ---------- |
8418| photoAsset | [PhotoAsset](#photoasset) | Yes  | [PhotoAsset](#photoasset) whose cloud enhancement task information is to be queried.|
8419
8420**Return value**
8421
8422| Type                                   | Description             |
8423| --------------------------------------- | ----------------- |
8424| Promise<[CloudEnhancementTaskState](#cloudenhancementtaskstate13)> | Promise used to return the information about the cloud enhancement task.|
8425
8426**Error codes**
8427
8428For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8429
8430| ID| Error Message|
8431| -------- | ---------------------------------------- |
8432| 201      | Permission denied.                |
8433| 202      | Called by non-system application. |
8434| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8435| 14000011 | Internal system error.            |
8436
8437**Example**
8438
8439For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8440
8441```ts
8442import { dataSharePredicates } from '@kit.ArkData';
8443
8444async function example(context: Context) {
8445  console.info('queryCloudEnhancementTaskStateDemo');
8446  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8447  // Obtain the cloud enhancement tasks in progress.
8448  photoPredicates.equalTo(photoAccessHelper.PhotoKeys.CE_AVAILABLE, 2);
8449  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8450    fetchColumns: [],
8451    predicates: photoPredicates
8452  };
8453  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8454  try {
8455    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8456    let asset = await fetchResult.getLastObject();
8457    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8458      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8459    const cloudEnhancementTaskState: photoAccessHelper.CloudEnhancementTaskState
8460      = await cloudEnhancementInstance.queryCloudEnhancementTaskState(asset);
8461    let taskStage = cloudEnhancementTaskState.taskStage;
8462    if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_EXCEPTION) {
8463      console.log("task has exception");
8464    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_PREPARING) {
8465      console.log("task is preparing");
8466    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_UPLOADING) {
8467      let transferredFileSize = cloudEnhancementTaskState.transferredFileSize;
8468      let totalFileSize = cloudEnhancementTaskState.totalFileSize;
8469      let message = `task is uploading, transferredFileSize: ${transferredFileSize}, totalFileSize: ${totalFileSize}`;
8470      console.log(message);
8471    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_EXECUTING) {
8472      let expectedDuration = cloudEnhancementTaskState.expectedDuration;
8473      let message = `task is executing, expectedDuration: ${expectedDuration}`;
8474      console.log(message);
8475    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_DOWNLOADING) {
8476      let transferredFileSize = cloudEnhancementTaskState.transferredFileSize;
8477      let totalFileSize = cloudEnhancementTaskState.totalFileSize;
8478      let message = `task is downloading, transferredFileSize: ${transferredFileSize}, totalFileSize: ${totalFileSize}`;
8479      console.log(message);
8480    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_FAILED) {
8481      let errCode = cloudEnhancementTaskState.statusCode;
8482      let message = `task is failed, errCode: ${errCode}`;
8483      console.log(message);
8484    } else if (taskStage == photoAccessHelper.CloudEnhancementTaskStage.TASK_STAGE_COMPLETED) {
8485      console.log("task is completed");
8486    }
8487  } catch (err) {
8488    console.error(`queryCloudEnhancementTaskStateDemo failed with error: ${err.code}, ${err.message}`);
8489  }
8490}
8491```
8492
8493### syncCloudEnhancementTaskStatus<sup>13+</sup>
8494
8495syncCloudEnhancementTaskStatus(): Promise&lt;void&gt;
8496
8497Synchronizes the cloud enhancement task status.
8498
8499**System API**: This is a system API.
8500
8501**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8502
8503**Required permissions**: ohos.permission.READ_IMAGEVIDEO
8504
8505**Return value**
8506
8507| Type                 | Description        |
8508| ------------------- | ---------- |
8509| Promise&lt;void&gt; | Promise that returns no value.|
8510
8511**Error codes**
8512
8513For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8514
8515| ID| Error Message|
8516| -------- | ---------------------------------------- |
8517| 201      | Permission denied.                |
8518| 202      | Called by non-system application. |
8519| 14000011 | Internal system error.            |
8520
8521**Example**
8522
8523```ts
8524import { dataSharePredicates } from '@kit.ArkData';
8525
8526async function example(context: Context) {
8527  console.info('syncCloudEnhancementTaskStatusDemo');
8528  try {
8529    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8530      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8531    await cloudEnhancementInstance.syncCloudEnhancementTaskStatus();
8532  } catch (err) {
8533    console.error(`syncCloudEnhancementTaskStatusDemo failed with error: ${err.code}, ${err.message}`);
8534  }
8535}
8536```
8537
8538### getCloudEnhancementPair<sup>13+</sup>
8539
8540getCloudEnhancementPair(asset: PhotoAsset): Promise&lt;PhotoAsset&gt;
8541
8542Obtains the photo after cloud enhancement.
8543
8544**System API**: This is a system API.
8545
8546**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8547
8548**Required permissions**: ohos.permission.READ_IMAGEVIDEO
8549
8550**Parameters**
8551
8552| Name  | Type                     | Mandatory| Description      |
8553| -------- | ------------------------- | ---- | ---------- |
8554| photoAsset | [PhotoAsset](#photoasset) | Yes  | [PhotoAsset](#photoasset) for which the cloud-enhanced photo is to be obtained.|
8555
8556**Return value**
8557
8558| Type                                   | Description             |
8559| --------------------------------------- | ----------------- |
8560| Promise<[PhotoAsset](#photoasset)> | Promise used to return the photo after cloud enhancement.|
8561
8562**Error codes**
8563
8564For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8565
8566| ID| Error Message|
8567| -------- | ---------------------------------------- |
8568| 201      | Permission denied.                |
8569| 202      | Called by non-system application. |
8570| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8571| 14000011 | Internal system error.            |
8572
8573**Example**
8574
8575For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8576
8577```ts
8578import { dataSharePredicates } from '@kit.ArkData';
8579
8580async function example(context: Context) {
8581  console.info('getCloudEnhancementPairDemo');
8582  let photoPredicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
8583  // Query the completed cloud enhancement tasks.
8584  photoPredicates.equalTo(photoAccessHelper.PhotoKeys.CE_AVAILABLE, 5);
8585  let photoFetchOptions: photoAccessHelper.FetchOptions = {
8586    fetchColumns: [],
8587    predicates: photoPredicates
8588  };
8589  let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
8590  try {
8591    let fetchResult = await phAccessHelper.getAssets(photoFetchOptions);
8592    let asset = await fetchResult.getLastObject();
8593    let cloudEnhancementInstance: photoAccessHelper.CloudEnhancement
8594      = photoAccessHelper.CloudEnhancement.getCloudEnhancementInstance(context);
8595    let photoAsset: photoAccessHelper.PhotoAsset
8596      = await cloudEnhancementInstance.getCloudEnhancementPair(asset);
8597  } catch (err) {
8598    console.error(`getCloudEnhancementPairDemo failed with error: ${err.code}, ${err.message}`);
8599  }
8600}
8601```
8602
8603### setVideoEnhancementAttr<sup>13+</sup>
8604
8605setVideoEnhancementAttr(videoEnhancementType: VideoEnhancementType, photoId: string): Promise&lt;void&gt;
8606
8607Sets the attributes for deferred video enhancement.
8608
8609**System API**: This is a system API.
8610
8611**Required permissions**: ohos.permission.WRITE\_IMAGEVIDEO
8612
8613**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8614
8615**Parameters**
8616
8617| Name       | Type     | Mandatory  | Description                                |
8618| ---------- | ------- | ---- | ---------------------------------- |
8619| videoEnhancementType       | [VideoEnhancementType](#videoenhancementtype13) | Yes   | Type of video enhancement.|
8620| photoId | string | Yes   | Photo ID of the image.|
8621
8622**Return value**
8623
8624| Type                 | Description        |
8625| ------------------- | ---------- |
8626| Promise&lt;void&gt; | Promise that returns no value.|
8627
8628**Error codes**
8629
8630For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8631
8632| ID   | Error Message                             |
8633| :------- | :-------------------------------- |
8634| 202      | Called by non-system application. |
8635| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8636| 14000011 | Internal system error.            |
8637| 14000016 | Operation Not Support.            |
8638
8639**Example**
8640
8641For details about how to create a phAccessHelper instance, see the example provided in [@ohos.file.photoAccessHelper (Album Management)](arkts-apis-photoAccessHelper-f.md).
8642
8643```ts
8644async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, asset: photoAccessHelper.PhotoAsset) {
8645  try {
8646    let assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = new photoAccessHelper.MediaAssetChangeRequest(asset);
8647    let photoId = "202410011800";
8648    assetChangeRequest.setVideoEnhancementAttr(photoAccessHelper.VideoEnhancementType.QUALITY_ENHANCEMENT_LOCAL, photoId);
8649    await phAccessHelper.applyChanges(assetChangeRequest);
8650  } catch (err) {
8651    console.error(`setVideoEnhancementAttr fail with error: ${err.code}, ${err.message}`);
8652  }
8653}
8654```
8655
8656## CloudMediaAssetManager<sup>14+</sup>
8657
8658A class used for cloud media asset management. It is used to manage download tasks for media assets stored in the cloud and delete local data and files pertaining to these cloud-based assets.
8659
8660**System API**: This is a system API.
8661
8662**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8663
8664### getCloudMediaAssetManagerInstance<sup>14+</sup>
8665
8666static getCloudMediaAssetManagerInstance(context: Context): CloudMediaAssetManager
8667
8668Obtains a CloudMediaAssetManager instance.
8669
8670**System API**: This is a system API.
8671
8672**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8673
8674**Parameters**
8675
8676| Name  | Type                     | Mandatory| Description      |
8677| -------- | ------------------------- | ---- | ---------- |
8678| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes  | Context of the ability instance.|
8679
8680**Return value**
8681
8682| Type                                   | Description             |
8683| --------------------------------------- | ----------------- |
8684| [CloudMediaAssetManager](#cloudmediaassetmanager14) | CloudMediaAssetManager instance.|
8685
8686**Error codes**
8687
8688For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8689
8690| ID| Error Message|
8691| -------- | ---------------------------------------- |
8692| 202      |  Called by non-system application.   |
8693| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8694| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.          |
8695
8696**Example**
8697
8698```ts
8699async function example(context: Context) {
8700  console.info('getCloudMediaAssetManagerInstanceDemo');
8701  try {
8702    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8703      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8704    await cloudMediaAssetManagerInstance.pauseDownloadCloudMedia();
8705  } catch (err) {
8706    console.error(`getCloudMediaAssetManagerInstanceDemo failed with error: ${err.code}, ${err.message}`);
8707  }
8708}
8709```
8710
8711### startDownloadCloudMedia<sup>14+</sup>
8712
8713startDownloadCloudMedia(downloadType: CloudMediaDownloadType): Promise&lt;void&gt;
8714
8715Starts or resumes a task to download cloud media assets.
8716
8717**System API**: This is a system API.
8718
8719**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8720
8721**Required permissions**: ohos.permission.CLOUDFILE_SYNC_MANAGER
8722
8723**Parameters**
8724
8725| Name  | Type                     | Mandatory| Description      |
8726| -------- | ------------------------- | ---- | ---------- |
8727| downloadType | [CloudMediaDownloadType](#cloudmediadownloadtype14) | Yes  | Type of the download task.|
8728
8729**Return value**
8730
8731| Type                                   | Description             |
8732| --------------------------------------- | ----------------- |
8733| Promise&lt;void&gt;| Promise that returns no value.|
8734
8735**Error codes**
8736
8737For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8738
8739| ID| Error Message|
8740| -------- | ---------------------------------------- |
8741| 201      | Permission denied.                |
8742| 202      | Called by non-system application. |
8743| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8744| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.           |
8745
8746**Example**
8747
8748```ts
8749async function example(context: Context) {
8750  console.info('startDownloadCloudMediaDemo');
8751  try {
8752    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8753      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8754    await cloudMediaAssetManagerInstance.startDownloadCloudMedia(photoAccessHelper.CloudMediaDownloadType.DOWNLOAD_FORCE);
8755  } catch (err) {
8756    console.error(`startDownloadCloudMediaDemo failed with error: ${err.code}, ${err.message}`);
8757  }
8758}
8759```
8760
8761### pauseDownloadCloudMedia<sup>14+</sup>
8762
8763pauseDownloadCloudMedia(): Promise&lt;void&gt;
8764
8765Suspends a task that downloads cloud media assets.
8766
8767**System API**: This is a system API.
8768
8769**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8770
8771**Required permissions**: ohos.permission.CLOUDFILE_SYNC_MANAGER
8772
8773**Return value**
8774
8775| Type                                   | Description             |
8776| --------------------------------------- | ----------------- |
8777| Promise&lt;void&gt;| Promise that returns no value.|
8778
8779**Error codes**
8780
8781For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8782
8783| ID| Error Message|
8784| -------- | ---------------------------------------- |
8785| 201      | Permission denied.                |
8786| 202      | Called by non-system application. |
8787| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
8788
8789**Example**
8790
8791```ts
8792async function example(context: Context) {
8793  console.info('pauseDownloadCloudMediaDemo');
8794  try {
8795    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8796      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8797    await cloudMediaAssetManagerInstance.pauseDownloadCloudMedia();
8798  } catch (err) {
8799    console.error(`pauseDownloadCloudMediaDemo failed with error: ${err.code}, ${err.message}`);
8800  }
8801}
8802```
8803
8804### cancelDownloadCloudMedia<sup>14+</sup>
8805
8806cancelDownloadCloudMedia(): Promise&lt;void&gt;
8807
8808Cancels a task that downloads cloud media assets.
8809
8810**System API**: This is a system API.
8811
8812**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8813
8814**Required permissions**: ohos.permission.CLOUDFILE_SYNC_MANAGER
8815
8816**Return value**
8817
8818| Type                                   | Description             |
8819| --------------------------------------- | ----------------- |
8820| Promise&lt;void&gt;| Promise that returns no value.|
8821
8822**Error codes**
8823
8824For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8825
8826| ID| Error Message|
8827| -------- | ---------------------------------------- |
8828| 201      | Permission denied.                |
8829| 202      | Called by non-system application. |
8830| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
8831
8832**Example**
8833
8834```ts
8835async function example(context: Context) {
8836  console.info('cancelDownloadCloudMediaDemo');
8837  try {
8838    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8839      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8840    await cloudMediaAssetManagerInstance.cancelDownloadCloudMedia();
8841  } catch (err) {
8842    console.error(`cancelDownloadCloudMediaDemo failed with error: ${err.code}, ${err.message}`);
8843  }
8844}
8845```
8846
8847### retainCloudMediaAsset<sup>14+</sup>
8848
8849retainCloudMediaAsset(retainType: CloudMediaRetainType): Promise&lt;void&gt;
8850
8851Deletes local metadata and files of cloud media assets.
8852
8853**System API**: This is a system API.
8854
8855**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8856
8857**Required permissions**: ohos.permission.CLOUDFILE_SYNC_MANAGER
8858
8859**Parameters**
8860
8861| Name  | Type                     | Mandatory| Description      |
8862| -------- | ------------------------- | ---- | ---------- |
8863| retainType | [CloudMediaRetainType](#cloudmediaretaintype14) | Yes  | Mode for deleting cloud media assets.|
8864
8865**Return value**
8866
8867| Type                                   | Description             |
8868| --------------------------------------- | ----------------- |
8869| Promise&lt;void&gt;| Promise that returns no value.|
8870
8871**Error codes**
8872
8873For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8874
8875| ID| Error Message|
8876| -------- | ---------------------------------------- |
8877| 201      | Permission denied.                |
8878| 202      | Called by non-system application. |
8879| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
8880| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
8881
8882**Example**
8883
8884```ts
8885async function example(context: Context) {
8886  console.info('retainCloudMediaAssetDemo');
8887  try {
8888    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8889      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8890    await cloudMediaAssetManagerInstance.retainCloudMediaAsset(photoAccessHelper.CloudMediaRetainType.RETAIN_FORCE);
8891  } catch (err) {
8892    console.error(`retainCloudMediaAssetDemo failed with error: ${err.code}, ${err.message}`);
8893  }
8894}
8895```
8896
8897### getCloudMediaAssetStatus<sup>14+</sup>
8898
8899getCloudMediaAssetStatus(): Promise&lt;CloudMediaAssetStatus&gt;
8900
8901Obtains the status of a task that downloads cloud media assets.
8902
8903**System API**: This is a system API.
8904
8905**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8906
8907**Required permissions**: ohos.permission.READ_IMAGEVIDEO
8908
8909**Return value**
8910
8911| Type                                   | Description             |
8912| --------------------------------------- | ----------------- |
8913|Promise&lt;[CloudMediaAssetStatus](#cloudmediaassetstatus14)&gt; | Promise used to return the task status.|
8914
8915**Error codes**
8916
8917For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [File Management Error Codes](../apis-core-file-kit/errorcode-filemanagement.md).
8918
8919| ID| Error Message|
8920| -------- | ---------------------------------------- |
8921| 201      | Permission denied.                |
8922| 202      | Called by non-system application. |
8923| 14000011 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out.            |
8924
8925**Example**
8926
8927```ts
8928async function example(context: Context) {
8929  console.info('getCloudMediaAssetStatusDemo');
8930  try {
8931    let cloudMediaAssetManagerInstance: photoAccessHelper.CloudMediaAssetManager
8932      = photoAccessHelper.CloudMediaAssetManager.getCloudMediaAssetManagerInstance(context);
8933    const cloudMediaAssetStatus: photoAccessHelper.CloudMediaAssetStatus = await cloudMediaAssetManagerInstance.getCloudMediaAssetStatus();
8934    let taskStatus = cloudMediaAssetStatus.taskStatus;
8935    let taskInfo = cloudMediaAssetStatus.taskInfo;
8936    let errorCode = cloudMediaAssetStatus.errorCode;
8937    let message = `taskStatus: ${taskStatus}, taskInfo: ${taskInfo}, errorCode: ${errorCode}`;
8938    console.log(message);
8939  } catch (err) {
8940    console.error(`getCloudMediaAssetStatusDemo failed with error: ${err.code}, ${err.message}`);
8941  }
8942}
8943```
8944
8945## MovingPhoto<sup>12+</sup>
8946
8947Provides APIs for managing a moving photo instance.
8948
8949### isVideoReady<sup>20+</sup>
8950
8951isVideoReady(): Promise&lt;boolean&gt;
8952
8953Checks whether the video of the moving photo is ready. This API uses a promise to return the result.
8954
8955**System API**: This is a system API.
8956
8957**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
8958
8959**Required permissions**: ohos.permission.READ_IMAGEVIDEO
8960
8961**Return value**
8962
8963| Type                                   | Description             |
8964| --------------------------------------- | ----------------- |
8965| Promise&lt;boolean&gt; | Promise used to return the result. **true** if the video of the moving photo is ready, **false** otherwise.|
8966
8967**Error codes**
8968
8969For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
8970
8971| ID| Error Message|
8972| -------- | ---------------------------------------- |
8973| 201      | Permission denied |
8974| 202      | Called by non-system application |
8975| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
8976
8977**Example**
8978
8979For details about how to create a phAccessHelper instance, see the example provided in [photoAccessHelper.getPhotoAccessHelper](./js-apis-photoAccessHelper.md#photoaccesshelpergetphotoaccesshelper).
8980
8981```ts
8982import { dataSharePredicates } from '@kit.ArkData';
8983
8984class MovingPhotoHandler implements photoAccessHelper.MediaAssetDataHandler<photoAccessHelper.MovingPhoto> {
8985  async onDataPrepared(movingPhoto: photoAccessHelper.MovingPhoto) {
8986    if (movingPhoto === undefined) {
8987      console.error('Error occurred when preparing data');
8988      return;
8989    }
8990    try {
8991    let isVideoReady = await movingPhoto.isVideoReady()
8992      console.info("moving photo video ready:" + `${isVideoReady}`);
8993    } catch (err) {
8994      console.error(`failed to get isVideoReady, error code is ${err.code}, message is ${err.message}`)
8995    }
8996  }
8997}
8998
8999async function example(phAccessHelper: photoAccessHelper.PhotoAccessHelper, context: Context) {
9000  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
9001  predicates.equalTo(photoAccessHelper.PhotoKeys.PHOTO_SUBTYPE, photoAccessHelper.PhotoSubtype.MOVING_PHOTO);
9002  let fetchOptions: photoAccessHelper.FetchOptions = {
9003    fetchColumns: [],
9004    predicates: predicates
9005  };
9006  // Ensure that there are moving photos in Gallery.
9007  let assetResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = await phAccessHelper.getAssets(fetchOptions);
9008  let asset: photoAccessHelper.PhotoAsset = await assetResult.getFirstObject();
9009  let requestOptions: photoAccessHelper.RequestOptions = {
9010    deliveryMode: photoAccessHelper.DeliveryMode.FAST_MODE,
9011  }
9012  const handler = new MovingPhotoHandler();
9013  try {
9014    let requestId: string = await photoAccessHelper.MediaAssetManager.requestMovingPhoto(context, asset, requestOptions, handler);
9015    console.info("moving photo requested successfully, requestId: " + requestId);
9016  } catch (err) {
9017    console.error(`failed to request moving photo, error code is ${err.code}, message is ${err.message}`);
9018  }
9019}
9020```
9021
9022## PhotoAssetCustomRecordManager<sup>20+</sup>
9023
9024Provides APIs for custom user behavior recording for Gallery.
9025
9026**System API**: This is a system API.
9027
9028### getCustomRecordManagerInstance<sup>20+</sup>
9029
9030static getCustomRecordManagerInstance(context: Context): PhotoAssetCustomRecordManager
9031
9032Obtains an instance of custom user behavior recording for Gallery.
9033
9034**System API**: This is a system API.
9035
9036**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9037
9038**Parameters**
9039
9040| Name| Type| Mandatory| Description|
9041| --- | --- | --- | --- |
9042| context | [Context](../apis-ability-kit/js-apis-inner-application-context.md#context) | Yes| Context of the ability instance.|
9043
9044**Return value**
9045
9046| Type| Description|
9047| --- | --- |
9048| [PhotoAssetCustomRecordManager](#photoassetcustomrecordmanager20) | Custom user behavior recording instance.|
9049
9050**Error codes**
9051
9052For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9053
9054| ID| Error Message|
9055| --- | --- |
9056| 202 | Called by non-system application. |
9057| 23800107 | Context is invalid. |
9058
9059**Example**
9060
9061```ts
9062import { common } from '@kit.AbilityKit';
9063import { BusinessError } from '@kit.BasicServicesKit';
9064
9065async function example(context: Context) {
9066  console.info('getCustomRecordManagerInstance');
9067  try {
9068    let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9069  } catch(err) {
9070    console.error(`getCustomRecordManagerInstance failed with error: ${err.code}, ${err.message}`);
9071  }
9072}
9073```
9074
9075### createCustomRecords<sup>20+</sup>
9076
9077createCustomRecords(customRecords: Array&lt;PhotoAssetCustomRecord&gt;): Promise&lt;void&gt;
9078
9079Adds custom user behavior recordings. This API uses a promise to return the result.
9080
9081**System API**: This is a system API.
9082
9083**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9084
9085**Parameters**
9086
9087| Name| Type| Mandatory| Description|
9088| --- | --- | --- | --- |
9089| customRecords | Array&lt;[PhotoAssetCustomRecord](#photoassetcustomrecord20)&gt; | Yes| Custom user behavior recordings.|
9090
9091**Return value**
9092
9093| Type| Description|
9094| --- | --- |
9095| Promise&lt;void&gt; | Promise that returns no value.|
9096
9097**Error codes**
9098
9099For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9100
9101| ID| Error Message|
9102| --- | --- |
9103| 202 | Called by non-system application. |
9104| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The value range of mandatory parameters in photoAssetCustomRecord does not meet the requirements. 2. The transferred record already exists. 3. The number of transferred records exceeds 200. |
9105| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9106
9107**Example**
9108
9109```ts
9110import { BusinessError } from '@kit.BasicServicesKit';
9111
9112async function example(context: Context) {
9113  console.info('createCustomRecords');
9114  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9115  let crArray:Array<photoAccessHelper.PhotoAssetCustomRecord> = [
9116    {fileId:1,shareCount:1,lcdJumpCount:1}
9117  ];
9118  crManager.createCustomRecords(crArray).then(() => {
9119    console.info('createCustomRecords successful');
9120  }).catch((err: BusinessError) => {
9121    console.error('createCustomRecords fail with error: ${err.code}, ${err.message}');
9122  });
9123}
9124```
9125
9126### getCustomRecords<sup>20+</sup>
9127
9128getCustomRecords(optionCheck: FetchOptions): Promise&lt;FetchResult&lt;PhotoAssetCustomRecord&gt;&gt;
9129
9130Obtains custom user behavior recordings based on retrieval options. This API uses a promise to return the result.
9131
9132**System API**: This is a system API.
9133
9134**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9135
9136**Parameters**
9137
9138| Name| Type| Mandatory| Description|
9139| --- | --- | --- | --- |
9140| optionCheck | [FetchOptions](js-apis-photoAccessHelper.md#fetchoptions) | Yes| Retrieval options.|
9141
9142**Return value**
9143
9144| Type| Description|
9145| --- | --- |
9146| Promise&lt;FetchResult&lt;[PhotoAssetCustomRecord](#photoassetcustomrecord20)&gt;&gt; | Promise used to return the collection of custom user behavior recordings.|
9147
9148**Error codes**
9149
9150For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9151
9152| ID| Error Message|
9153| --- | --- |
9154| 202 | Called by non-system application. |
9155| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The fileter criteria or fetchColumns that are not supported by options are transferred. |
9156| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9157
9158**Example**
9159
9160```ts
9161import { dataSharePredicates } from '@kit.ArkData';
9162import { BusinessError } from '@kit.BasicServicesKit';
9163
9164async function example(context: Context) {
9165  console.info('getCustomRecords');
9166  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9167  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
9168  predicates.equalTo('file_id', 1);
9169  let fetchOption: photoAccessHelper.FetchOptions = {
9170    fetchColumns: [],
9171    predicates: predicates
9172  };
9173  crManager.getCustomRecords(fetchOption).then(async (fetchResult) => {
9174    let record = await fetchResult.getFirstObject();
9175    console.info('record file id is ' + record.fileId);
9176  }).catch((err: BusinessError) => {
9177    console.error('getCustomRecords fail with error: ${err.code}, ${err.message}');
9178  });
9179}
9180```
9181
9182### setCustomRecords<sup>20+</sup>
9183
9184setCustomRecords(customRecords: Array&lt;PhotoAssetCustomRecord&gt;): Promise&lt;Array&lt;number&gt;&gt;
9185
9186Updates the existing database fields based on custom user behavior recordings. This API uses a promise to return the result.
9187
9188**System API**: This is a system API.
9189
9190**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9191
9192**Parameters**
9193
9194| Name| Type| Mandatory| Description|
9195| --- | --- | --- | --- |
9196| customRecords | Array&lt;[PhotoAssetCustomRecord](#photoassetcustomrecord20)&gt; | Yes| Custom user behavior recordings.|
9197
9198**Return value**
9199
9200| Type| Description|
9201| --- | --- |
9202| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the file ID in the custom user behavior recordings that fail to be updated.|
9203
9204**Error codes**
9205
9206For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9207
9208| ID| Error Message|
9209| --- | --- |
9210| 202 | Called by non-system application. |
9211| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The value range of mandatory parameters in photoAssetCustomRecord does not meet the requirements. 2. The number of transferred records exceeds 200. |
9212| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9213
9214**Example**
9215
9216```ts
9217import { BusinessError } from '@kit.BasicServicesKit';
9218
9219async function example(context: Context) {
9220  console.info('setCustomRecords');
9221  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9222  let UpdateArray: Array<photoAccessHelper.PhotoAssetCustomRecord> = [
9223    {fileId:1,shareCount:2,lcdJumpCount:3},
9224    {fileId:2,shareCount:2,lcdJumpCount:3}
9225  ];
9226  crManager.setCustomRecords(UpdateArray).then((failIds) => {
9227    console.info('setCustomRecords successful');
9228  }).catch((err: BusinessError) => {
9229    console.error('setCustomRecords file with err: ${err.code}, ${err.message}');
9230  });
9231}
9232```
9233
9234### removeCustomRecords<sup>20+</sup>
9235
9236removeCustomRecords(optionCheck: FetchOptions): Promise&lt;void&gt;
9237
9238Removes custom user behavior recordings based on retrieval options. This API uses a promise to return the result.
9239
9240**System API**: This is a system API.
9241
9242**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9243
9244**Parameters**
9245
9246| Name| Type| Mandatory| Description|
9247| --- | --- | --- | --- |
9248| optionCheck | [FetchOptions](js-apis-photoAccessHelper.md#fetchoptions) | Yes| Retrieval options.|
9249
9250**Return value**
9251
9252| Type| Description|
9253| --- | --- |
9254| Promise&lt;void&gt; | Promise that returns no value.|
9255
9256**Error codes**
9257
9258For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9259
9260| ID| Error Message|
9261| --- | --- |
9262| 202 | Called by non-system application. |
9263| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The fileter criteria or fetchColumns that are not supported by options are transferred |
9264| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9265
9266**Example**
9267
9268```ts
9269import { dataSharePredicates } from '@kit.ArkData';
9270import { BusinessError } from '@kit.BasicServicesKit';
9271
9272async function example(context: Context) {
9273  console.info('removeCustomRecords');
9274  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9275  let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
9276  predicates.equalTo('file_id', 1);
9277  let fetchOption: photoAccessHelper.FetchOptions = {
9278    fetchColumns: [],
9279    predicates: predicates
9280  };
9281  crManager.removeCustomRecords(fetchOption).then(() => {
9282    console.info('removeCustomRecords successful');
9283  }).catch((err: BusinessError) => {
9284    console.error('removeCustomRecords fail with error: ${err.code}, ${err.message}');
9285  });
9286}
9287```
9288
9289### addShareCount<sup>20+</sup>
9290
9291addShareCount(ids: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt;&gt;
9292
9293Increases the value of **shareCount** by 1 for the data in the database based on **fileId** in [PhotoAssetCustomRecord](#photoassetcustomrecord20). This API uses a promise to return the result.
9294
9295**System API**: This is a system API.
9296
9297**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9298
9299**Parameters**
9300
9301| Name| Type| Mandatory| Description|
9302| --- | --- | --- | --- |
9303| ids | Array&lt;number&gt; | Yes| Array of file IDs in [PhotoAssetCustomRecord](#photoassetcustomrecord20).|
9304
9305**Return value**
9306
9307| Type| Description|
9308| --- | --- |
9309| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the file ID in the custom user behavior recordings that fail to be updated.|
9310
9311**Error codes**
9312
9313For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9314
9315| ID| Error Message|
9316| --- | --- |
9317| 202 | Called by non-system application. |
9318| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The ids list is empty; 2. The number of ids lists exceeds 500. |
9319| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9320
9321```ts
9322import { BusinessError } from '@kit.BasicServicesKit';
9323
9324async function example(context: Context) {
9325  console.info('addShareCount');
9326  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9327  let ids: Array<number> = [1, 2];
9328  crManager.addShareCount(ids).then((failIds) => {
9329    console.info('addShareCount successful');
9330  }).catch((err: BusinessError) => {
9331    console.error('addShareCount fail with error: ${err.code}, ${err.message}');
9332  });
9333}
9334```
9335
9336### addLcdJumpCount<sup>20+</sup>
9337
9338addLcdJumpCount(ids: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt;&gt;
9339
9340Increases the value of **LcdJumpCount** by 1 for the data in the database based on **fileId** in [PhotoAssetCustomRecord](#photoassetcustomrecord20). This API uses a promise to return the result.
9341
9342**System API**: This is a system API.
9343
9344**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9345
9346**Parameters**
9347
9348| Name| Type| Mandatory| Description|
9349| --- | --- | --- | --- |
9350| ids | Array&lt;number&gt; | Yes| Array of file IDs in [PhotoAssetCustomRecord](#photoassetcustomrecord20).|
9351
9352**Return value**
9353
9354| Type| Description|
9355| --- | --- |
9356| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the file ID in the custom user behavior recordings that fail to be updated.|
9357
9358**Error codes**
9359
9360For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Media Library Error Codes](errcode-medialibrary.md).
9361
9362| ID| Error Message|
9363| --- | --- |
9364| 202 | Called by non-system application. |
9365| 23800151 | Scenario parameters fail to pass the verification. Possible causes: 1. The ids list is empty; 2. The number of ids lists exceeds 500. |
9366| 23800301 | Internal system error. It is recommended to retry and check the logs. Possible causes: 1. Database corrupted; 2. The file system is abnormal; 3. The IPC request timed out. |
9367
9368```ts
9369import { BusinessError } from '@kit.BasicServicesKit';
9370
9371async function example(context: Context) {
9372  console.info('addLcdJumpCount');
9373  let crManager = photoAccessHelper.PhotoAssetCustomRecordManager.getCustomRecordManagerInstance(context);
9374  let ids: Array<number> = [1, 2];
9375  crManager.addLcdJumpCount(ids).then((failIds) => {
9376    console.info('addLcdJumpCount successful');
9377  }).catch((err: BusinessError) => {
9378    console.error('addLcdJumpCount fail with error: ${err.code}, ${err.message}');
9379  });
9380}
9381```
9382
9383## PhotoSelectOptions
9384
9385Defines additional options for selecting media assets from Gallery. It inherits from **BaseSelectOptions**. It is used to start the picker of the corresponding user ID space.
9386
9387**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9388
9389| Name| Type| Mandatory| Description|
9390| -------- | -------- | -------- | -------- |
9391| userId<sup>18+</sup> | number  | No  | ID of the user space to access. The default value is **-1**.<br>To use it as a parameter of [PhotoViewPicker.select](arkts-apis-photoAccessHelper-PhotoViewPicker.md#select), request the permission ohos.permission.INTERACTA_CROSS_LOCAL_ACCOUNTS.<br>**System API**: This is a system API.|
9392
9393**Example**
9394
9395```ts
9396  async function photoPicker() {
9397    let picker = new photoAccessHelper.PhotoViewPicker();
9398    let option = new photoAccessHelper.PhotoSelectOptions();
9399    option.userId = 101;
9400    picker.select(option);
9401  }
9402```
9403
9404## PhotoSubtype
9405
9406Enumerates the [PhotoAsset](#photoasset) types.
9407
9408**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9409
9410| Name |  Value|  Description|
9411| ----- |  ---- |  ---- |
9412| SCREENSHOT |  1 |  Screenshot and screen recording file.<br>**System API**: This is a system API.|
9413
9414## AlbumType
9415
9416Enumerates the album types.
9417
9418**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9419
9420| Name                 | Value   | Description                       |
9421| ------------------- | ---- | ------------------------- |
9422| SOURCE<sup>18+</sup> | 2048 | Source album.<br>**System API**: This is a system API.|
9423| SMART<sup>11+</sup> | 4096 | Smart analysis album.<br>**System API**: This is a system API.|
9424
9425## AlbumSubtype
9426
9427Enumerate the album subtypes.
9428
9429**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9430
9431| Name                               | Value         | Description                             |
9432| --------------------------------- | ---------- | ------------------------------- |
9433| HIDDEN                            | 1027       | Hidden album. **System API**: This is a system API.        |
9434| TRASH                             | 1028       | Trash. **System API**: This is a system API.         |
9435| SCREENSHOT                        | 1029       | Album for screenshots and screen recording files. **System API**: This is a system API.     |
9436| CAMERA                            | 1030       | Album for photos and videos taken by the camera. **System API**: This is a system API.|
9437| SOURCE\_GENERIC<sup>11+</sup>     | 2049       | Source album. **System API**: This is a system API.        |
9438| CLASSIFY<sup>11+</sup>            | 4097       | Classified album. **System API**: This is a system API.        |
9439| GEOGRAPHY\_LOCATION<sup>11+</sup> | 4099       | Geographic location album. **System API**: This is a system API.        |
9440| GEOGRAPHY\_CITY<sup>11+</sup>     | 4100       | City album. **System API**: This is a system API.        |
9441| SHOOTING\_MODE<sup>11+</sup>      | 4101       | Shooting mode album. **System API**: This is a system API.      |
9442| PORTRAIT<sup>11+</sup>            | 4102       | Portrait album. **System API**: This is a system API.        |
9443| GROUP_PHOTO<sup>13+</sup>         | 4103       | Group photo album. **System API**: This is a system API.        |
9444| HIGHLIGHT<sup>12+</sup>           | 4104       | Highlights album. **System API**: This is a system API.        |
9445| HIGHLIGHT_SUGGESTIONS<sup>12+</sup> | 4105     | Highlights suggestion album. **System API**: This is a system API.        |
9446| CLOUD_ENHANCEMENT<sup>13+</sup> | 1032     | AI-powered cloud enhanced album. **System API**: This is a system API.        |
9447
9448## RequestPhotoType<sup>11+</sup>
9449
9450Enumerates the types of the operation for obtaining image or video thumbnails.
9451
9452**System API**: This is a system API.
9453
9454**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9455
9456| Name |  Value|  Description|
9457| ----- |  ---- |  ---- |
9458| REQUEST_ALL_THUMBNAILS  |  0 |  Obtain both the quick thumbnail and the quality thumbnail.|
9459| REQUEST_FAST_THUMBNAIL |  1 |  Obtain only the quick thumbnail.|
9460| REQUEST_QUALITY_THUMBNAIL |  2 |  Obtain only the quality thumbnail.|
9461
9462## PhotoKeys
9463
9464Defines the key information about an image or video file.
9465
9466**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9467
9468| Name         | Value             | Description                                                      |
9469| ------------- | ------------------- | ---------------------------------------------------------- |
9470| DATE_TRASHED  | 'date_trashed'  | Date when the file was deleted. The value is the number of seconds elapsed since the Epoch time. **System API**: This is a system API.                |
9471| HIDDEN  | 'hidden'            | Whether the file is hidden. **System API**: This is a system API.                              |
9472| CAMERA_SHOT_KEY  | 'camera_shot_key'  | Key for the Ultra Snapshot 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.) **System API**: This is a system API.           |
9473| USER_COMMENT<sup>10+</sup>  | 'user_comment'            | User comment information. **System API**: This is a system API.          |
9474| DATE_YEAR<sup>11+</sup>  | 'date_year'            | Year when the file was created. **System API**: This is a system API.          |
9475| DATE_MONTH<sup>11+</sup>  | 'date_month'            | Month when the file was created. **System API**: This is a system API.          |
9476| DATE_DAY<sup>11+</sup>  | 'date_day'            | Date when the file was created. **System API**: This is a system API.          |
9477| PENDING<sup>11+</sup>  | 'pending'            | Pending state. **System API**: This is a system API.          |
9478| DATE_TRASHED_MS<sup>12+</sup>  | 'date_trashed_ms'  | Date when the file was deleted. The value is the number of milliseconds elapsed since the Epoch time. **System API**: This is a system API.<br>**NOTE**: The photos queried cannot be sorted based on this field.|
9479| MOVING_PHOTO_EFFECT_MODE<sup>12+</sup>  | 'moving_photo_effect_mode' | Effect of the moving photo. **System API**: This is a system API.|
9480| CE_AVAILABLE<sup>13+</sup>  | 'ce_available' | Cloud enhancement identifier. **System API**: This is a system API.|
9481| SUPPORTED_WATERMARK_TYPE<sup>14+</sup>  | 'supported_watermark_type' | Editable watermark identifier. **System API**: This is a system API.|
9482| IS_CE_AUTO<sup>18+</sup>  | 'is_auto' | Specifies whether automatic cloud enhancement is supported. **System API**: This is a system API.|
9483| OWNER_ALBUM_ID<sup>18+</sup>  | 'owner_album_id' | ID of the album to which the photo belongs. **System API**: This is a system API.|
9484| IS_RECENT_SHOW<sup>18+</sup>  | 'is_recent_show' | Whether the asset is displayed in the **Recent** list. **System API**: This is a system API.|
9485| SUM_SIZE<sup>19+</sup>  | 'sum(size)' | Total size of files. When **SUM_SIZE** is filled in **fetchColumns**, only the first asset is obtained, and the property includes the total size of all assets. **System API**: This is a system API.|
9486| EXIF_ROTATE<sup>20+</sup>  | 'exif_rotate' | Rotational angle of the file. **System API**: This is a system API.|
9487
9488## AlbumKeys
9489
9490Enumerates the album keys.
9491
9492**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9493
9494| Name                             | Value                   | Description                                                      |
9495| --------------------------------- | -------------------- | ----------------------------------------------------- |
9496| ALBUM_LPATH<sup>18+</sup>          | 'lpath'                 | Virtual path of the album.<br>**System API**: This is a system API.           |
9497| BUNDLE_NAME<sup>18+</sup>          | 'bundle_name'                 | Bundle name of the album.<br>**System API**: This is a system API.           |
9498| DATE_MODIFIED<sup>18+</sup>        | 'date_modified'         | Timestamp when the album was modified, in milliseconds.<br>**System API**: This is a system API.           |
9499| COVER_URI_SOURCE<sup>20+</sup>     | 'cover_uri_source'      | Source URI of the album cover.<br>**System API**: This is a system API.           |
9500
9501## HiddenPhotosDisplayMode<sup>11+</sup>
9502
9503Enumerates the display modes of hidden files in the system.
9504
9505**System API**: This is a system API.
9506
9507**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9508
9509| Name         | Value             | Description                                                      |
9510| ------------- | ------------------- | ---------------------------------------------------------- |
9511| ASSETS_MODE   | 0       | Display all hidden files in the system.   |
9512| ALBUMS_MODE    | 1    | Display hidden files by album (display all albums that contain hidden files in the system, excluding the preset hidden album and the albums in the trash). |
9513
9514## PhotoCreateOptions
9515
9516Options for creating an image or video asset.
9517
9518**System API**: This is a system API.
9519
9520**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9521
9522| Name                  | Type               | Mandatory| Description                                             |
9523| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9524| subtype           | [PhotoSubtype](#photosubtype) | No | Subtype of the image or video. |
9525| cameraShotKey           | string | No | Key for the Ultra Snapshot 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.)  |
9526| userId<sup>19+</sup>           | number | No | User ID. |
9527
9528## RequestPhotoOptions<sup>11+</sup>
9529
9530Defines the options for obtaining the thumbnail of an image or video.
9531
9532**System API**: This is a system API.
9533
9534**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9535
9536| Name                  | Type               | Mandatory| Description                                             |
9537| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9538| size           | [image.Size](../apis-image-kit/arkts-apis-image-i.md#size) | No | Size of the thumbnail to obtain. |
9539| requestPhotoType    | [RequestPhotoType](#requestphototype11) | No | Operation to perform. |
9540
9541## PhotoCreationSource<sup>18+</sup>
9542
9543Defines the application information provided to create assets on behalf of the application.
9544
9545**System API**: This is a system API.
9546
9547**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9548
9549| Name                  | Type               | Read-Only| Optional| Description                                             |
9550| ---------------------- | ------------------- | ---- | ---- | ------------------------------------------------ |
9551| bundleName           | string | Yes | Yes |Bundle name of the target application. |
9552| appName    | string | Yes | Yes |Name of the target application. |
9553| appId    | string | Yes | Yes |ID of the target application. |
9554| tokenId    | number | Yes | Yes |Token ID of the target application. |
9555
9556## RequestOptions<sup>11+</sup>
9557
9558Represents request options.
9559
9560**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9561
9562| Name                  | Type                             | Readable| Writable| Description                                             |
9563| ---------------------- |---------------------------------| ---- |---- | ------------------------------------------------ |
9564| sourceMode           | [SourceMode](#sourcemode11)     | Yes  | Yes  | Type of the asset file requested, which can be the original file or edited file. **System API**: This is a system API.|
9565
9566## PhotoProxy<sup>11+</sup>
9567
9568Photo proxy object, which is used by the camera application to write image data.
9569
9570**System API**: This is a system API.
9571
9572**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9573
9574## MediaChangeRequest<sup>11+</sup>
9575
9576Media change request, which is the parent class of the asset change request and album change request.
9577
9578**NOTE**: The media change request takes effect only after [applyChanges](arkts-apis-photoAccessHelper-PhotoAccessHelper.md#applychanges11) is called.
9579
9580**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9581
9582## FormInfo<sup>11+</sup>
9583
9584Defines the Gallery widget information.
9585
9586**System API**: This is a system API.
9587
9588**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9589
9590| Name                  | Type               | Mandatory| Description                                             |
9591| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9592|formId       |string  |Yes| Widget ID, which is provided when a widget is created in Gallery.|
9593|uri          |string  |Yes| URI of the image bound to the widget. When a widget is created, **uri** can be empty or the URI of an image. When a widget is removed, **uri** is not verified and can be empty. |
9594
9595## GalleryFormInfo<sup>18+</sup>
9596
9597Defines the Gallery widget information.
9598
9599**System API**: This is a system API.
9600
9601**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9602
9603| Name                  | Type               | Mandatory| Description                                             |
9604| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9605|formId             |string               |Yes| Widget ID, which is provided when a widget is created in Gallery.|
9606|assetUris          |Array&lt;string&gt;  |Yes| URIs of the images or albums bound to the widget.<br>This parameter cannot be empty when creating or updating a widget.<br>If you attempt to create or update a widget with more than 500 URIs in **assetUris**, only the first 500 URIs are registered for listening. Any URIs beyond the first 500 are not registered. <br>When deleting a widget, this parameter can be omitted. |
9607
9608## ResourceType<sup>11+</sup>
9609
9610Enumerates the types of the resources to write.
9611
9612**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9613
9614| Name |  Value|  Description|
9615| ----- |  ---- |  ---- |
9616| PHOTO_PROXY |  3 |  Photo proxy. **System API**: This is a system API.|
9617| PRIVATE_MOVING_PHOTO_RESOURCE<sup>13+</sup> |  4 |  Private moving photo. **System API**: This is a system API.|
9618| PRIVATE_MOVING_PHOTO_METADATA<sup>18+</sup> |  5 |  Metadata resource of the private moving photo. **System API**: This is a system API.|
9619
9620## DefaultChangeUri
9621
9622Enumerates the **DefaultChangeUri** subtypes.
9623
9624**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9625
9626| Name             | Value                     | Description                                                        |
9627| ----------------- | ----------------------- | ------------------------------------------------------------ |
9628| DEFAULT_HIDDEN_ALBUM_URI<sup>11+</sup>  | 'file://media/HiddenAlbum' | URI of an album in the hidden albums that are displayed by album, that is, the URI of an album with hidden files. Such albums do not include the preset hidden album and the albums in the trash. This URI is used to subscribe to the change notifications of the hidden albums displayed by album. **System API**: This is a system API.|
9629
9630## SourceMode<sup>11+</sup>
9631
9632Enumerates the types of the file to read.
9633
9634**System API**: This is a system API.
9635
9636**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9637
9638| Name |  Value|  Description|
9639| ----- |  ---- |  ---- |
9640| ORIGINAL_MODE |  0 |  Original file.|
9641| EDITED_MODE |  1 |  Edited file.|
9642## AuthorizationMode<sup>12+</sup>
9643
9644Enumerates the authorization modes.
9645
9646**System API**: This is a system API.
9647
9648**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9649
9650| Name |  Value|  Description|
9651| ----- |  ---- |  ---- |
9652| SHORT_TIME_AUTHORIZATION|  0 |  Temporary authorization.|
9653
9654## AnalysisType<sup>11+</sup>
9655
9656Enumerates the smart analysis types.
9657
9658**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9659
9660| Name                           | Value | Description      |
9661| :---------------------------- | :- | :------- |
9662| ANALYSIS\_AESTHETICS\_SCORE   | 0  | Aesthetics score. **System API**: This is a system API.   |
9663| ANALYSIS\_LABEL               | 1  | Label. **System API**: This is a system API.   |
9664| ANALYSIS\_OCR                 | 2  | Optical character recognition (OCR) analysis. **System API**: This is a system API.   |
9665| ANALYSIS\_FACE                | 3  | Facial detection analysis. **System API**: This is a system API.   |
9666| ANALYSIS\_OBJECT              | 4  | Object detection analysis. **System API**: This is a system API.   |
9667| ANALYSIS\_RECOMMENDATION      | 5  | Recommendation analysis. **System API**: This is a system API.   |
9668| ANALYSIS\_SEGMENTATION        | 6  | Segmentation analysis. **System API**: This is a system API.   |
9669| ANALYSIS\_COMPOSITION         | 7  | Aesthetic composition analysis. **System API**: This is a system API.  |
9670| ANALYSIS\_SALIENCY            | 8  | Salience analysis. **System API**: This is a system API.  |
9671| ANALYSIS\_DETAIL\_ADDRESS     | 9  | Detailed address analysis. **System API**: This is a system API.   |
9672| ANALYSIS\_HUMAN\_FACE\_TAG<sup>12+</sup>    | 10 | Face clustering analysis. **System API**: This is a system API.   |
9673| ANALYSIS\_HEAD\_POSITION<sup>12+</sup>      | 11 | Analysis of the position of a person's or pet's head. **System API**: This is a system API.   |
9674| ANALYSIS\_BONE\_POSE<sup>12+</sup>        | 12 | Analysis of the position of skeletal elements (bones) in a human body. **System API**: This is a system API.   |
9675| ANALYSIS\_VIDEO\_LABEL<sup>12+</sup>        | 13 | Video label analysis. **System API**: This is a system API.   |
9676| ANALYSIS\_HIGHLIGHT<sup>12+</sup>        | 14 | Highlight label. **System API**: This is a system API.   |
9677
9678## HighlightAlbumInfoType<sup>12+</sup>
9679
9680Enumerates the types of the highlights album information.
9681
9682**System API**: This is a system API.
9683
9684**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9685
9686| Name           | Value | Description      |
9687| :------------ | :- | :------- |
9688| COVER\_INFO   | 0  | Cover information.   |
9689| PLAY\_INFO    | 1  | Music information.   |
9690
9691## HighlightUserActionType<sup>12+</sup>
9692
9693Enumerates the user behavior types of the highlights album.
9694
9695**System API**: This is a system API.
9696
9697**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9698
9699| Name                          | Value | Description      |
9700| :---------------------------- | :- | :------- |
9701| INSERTED\_PIC\_COUNT          | 0  | Number of inserted pictures.   |
9702| REMOVED\_PIC\_COUNT           | 1  | Number of removed pictures.   |
9703| SHARED\_SCREENSHOT\_COUNT     | 2  | Number of times that a full-length image in a highlights album is shared.   |
9704| SHARED\_COVER\_COUNT          | 3  | Number of times that a highlights cover is shared.   |
9705| RENAMED\_COUNT                | 4  | Number of times that a highlights album is renamed.   |
9706| CHANGED\_COVER\_COUNT         | 5  | Number of times that a cover is changed.   |
9707| RENDER\_VIEWED\_TIMES         | 100  | Number of times that the pictures in a highlights album are played.   |
9708| RENDER\_VIEWED\_DURATION      | 101  | Time used to play the pictures in a highlights album.  |
9709| ART\_LAYOUT\_VIEWED\_TIMES    | 102  | Number of times that a highlights album is viewed.  |
9710| ART\_LAYOUT\_VIEWED\_DURATION | 103  | Time used to view a highlights album.   |
9711
9712## ThumbnailVisibility<sup>14+</sup>
9713
9714Enumerates the visibility statuses of thumbnails.
9715
9716**System API**: This is a system API.
9717
9718**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9719
9720| Name                          | Value | Description      |
9721| :---------------------------- | :- | :------- |
9722| INVISIBLE        | 0  | The thumbnail is inaccessible.   |
9723| VISIBLE         | 1  | The thumbnail is accessible.   |
9724
9725## MovingPhotoEffectMode<sup>12+</sup>
9726
9727Enumerates the effects of a moving photo.
9728
9729**System API**: This is a system API.
9730
9731**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9732
9733| Name                          | Value | Description      |
9734| :---------------------------- | :- | :------- |
9735| DEFAULT          | 0  | Default effect.|
9736| BOUNCE\_PLAY     | 1  | Back-and-forth motion.|
9737| LOOP\_PLAY       | 2  | Continuously repeated animation.|
9738| LONG\_EXPOSURE   | 3  | Long exposure. |
9739| MULTI\_EXPOSURE  | 4  | Multiple exposures. |
9740| CINEMA\_GRAPH<sup>13+</sup>  | 5  | Cinemagraph. |
9741| IMAGE\_ONLY<sup>13+</sup>  | 10  | Image only. |
9742
9743## PhotoPermissionType<sup>12+</sup>
9744
9745Enumerates the types of permissions for accessing media assets.
9746
9747The permissions include temporary read permission and persistent read permission. The temporary read permission will be removed when the application is dead, while the persistent read permission will not.
9748
9749For the same media asset and application, the persistent read permission overwrites the temporary read permission. The temporary read permission does not overwrite the persistent read permission.
9750
9751**System API**: This is a system API.
9752
9753**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9754
9755| Name |  Value|  Description|
9756| ----- |  ---- |  ---- |
9757| TEMPORARY_READ_IMAGEVIDEO |  0 |  Temporary read permission.|
9758| PERSISTENT_READ_IMAGEVIDEO |  1 |  Persistent read permission.|
9759
9760## HideSensitiveType<sup>12+</sup>
9761
9762Enumerates the types of media resource information to be hidden from an application.
9763
9764**System API**: This is a system API.
9765
9766**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9767
9768| Name |  Value|  Description|
9769| ----- |  ---- |  ---- |
9770| HIDE_LOCATION_AND_SHOOTING_PARAM |  0 |  Geographical location and shooting parameters.|
9771| HIDE_LOCATION_ONLY |  1 |  Geographical location information.|
9772| HIDE_SHOOTING_PARAM_ONLY |  2 |  Shooting parameters.|
9773| NO_HIDE_SENSITIVE_TYPE |  3 |  Do not hide any information.|
9774
9775## CloudEnhancementTaskStage<sup>13+</sup>
9776
9777Enumerates the cloud enhancement task states, which are returned by [CloudEnhancementTaskState](#cloudenhancement13).
9778
9779**System API**: This is a system API.
9780
9781**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9782
9783| Name |  Value|  Description|
9784| ----- |  ---- |  ---- |
9785| TASK_STAGE_EXCEPTION |  -1 |  The cloud enhancement task is abnormal.|
9786| TASK_STAGE_PREPARING |  0 |  The cloud enhancement task is being prepared.|
9787| TASK_STAGE_UPLOADING |  1 |  The cloud enhancement task is uploading data.|
9788| TASK_STAGE_EXECUTING |  2 |  The cloud enhancement task is being executed.|
9789| TASK_STAGE_DOWNLOADING |  3 |  The cloud enhancement task is downloading data.|
9790| TASK_STAGE_FAILED |  4 |  The cloud enhancement task failed.|
9791| TASK_STAGE_COMPLETED |  5 |  The cloud enhancement task is complete.|
9792
9793## CloudEnhancementState<sup>13+</sup>
9794
9795Enumerates the cloud enhancement states.
9796
9797**System API**: This is a system API.
9798
9799**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9800
9801| Name |  Value|  Description|
9802| ----- |  ---- |  ---- |
9803| UNAVAILABLE |  0 |  Cloud enhancement is unavailable.|
9804| AVAILABLE |  1 |  Cloud enhancement is available.|
9805| EXECUTING |  2 |  Cloud enhancement is being executed.|
9806| COMPLETED |  3 |  Cloud enhancement has been completed.|
9807
9808## CloudEnhancementTaskState<sup>13+</sup>
9809
9810Represents the cloud enhancement task information, which includes the cloud enhancement task state and other information related to certain states.
9811
9812**System API**: This is a system API.
9813
9814**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9815
9816| Name                  | Type               | Mandatory| Description                                             |
9817| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9818|taskStage       |[CloudEnhancementTaskStage](#cloudenhancementtaskstage13)  |Yes| Cloud enhancement task state.|
9819|transferredFileSize          |number  |No| Size of the file transferred. This parameter is mandatory when **taskStage** is **CloudEnhancementTaskStage.TASK_STAGE_UPLOADING** or **CloudEnhancementTaskStage.TASK_STAGE_DOWNLOADING**. |
9820|totalFileSize          |number  |No| Total file size. This parameter is mandatory when **taskStage** is **CloudEnhancementTaskStage.TASK_STAGE_UPLOADING** or **CloudEnhancementTaskStage.TASK_STAGE_DOWNLOADING**. |
9821|expectedDuration          |number  |No| Queuing time. This parameter is mandatory when **taskStage** is **CloudEnhancementTaskStage.TASK_STAGE_EXECUTING**. |
9822|statusCode          |number  |No| Status code. This parameter is mandatory when **taskStage** is **CloudEnhancementTaskStage.TASK_STAGE_FAILED**. |
9823
9824## VideoEnhancementType<sup>13+</sup>
9825
9826Enumerates the types of segmented video enhancement.
9827
9828**System API**: This is a system API.
9829
9830**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9831
9832| Name |  Value|  Description|
9833| ----- |  ---- |  ---- |
9834| QUALITY_ENHANCEMENT_LOCAL |  0 |  Apply enhancement on the device.|
9835| QUALITY_ENHANCEMENT_CLOUD |  1 |  Apply enhancement on the cloud.|
9836| QUALITY_ENHANCEMENT_LOCAL_AND_CLOUD |  2 |  Apply enhancement on both the device and cloud.|
9837
9838## ThumbnailType<sup>13+</sup>
9839
9840Enumerates thumbnail types.
9841
9842**System API**: This is a system API.
9843
9844**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9845
9846| Name                          | Value | Description      |
9847| :---------------------------- | :- | :------- |
9848| LCD         | 1  | LCD thumbnail.   |
9849| THM          | 2 | THM thumbnail.   |
9850
9851## WatermarkType<sup>14+</sup>
9852
9853Enumerates the watermark editable flags.
9854
9855**System API**: This is a system API.
9856
9857**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9858
9859| Name |  Value|  Description|
9860| ----- |  ---- |  ---- |
9861| DEFAULT |  0 |  Watermarks are not editable.|
9862| BRAND_COMMON |  1 |  Brand and common watermarks are editable.|
9863| COMMON |  2 |  Common watermarks are editable.|
9864| BRAND |  3 |  Brand watermarks are editable.|
9865
9866## CloudMediaDownloadType<sup>14+</sup>
9867
9868Enumerates the types of download tasks.
9869
9870**System API**: This is a system API.
9871
9872**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9873
9874| Name |  Value|  Description|
9875| ----- |  ---- |  ---- |
9876| DOWNLOAD_FORCE |  0 |  High-priority download, without the need for the device to switch to screen-off charging mode.|
9877| DOWNLOAD_GENTLE |  1 |  Low-priority download, demanding that device be in screen-off charging mode.|
9878
9879## CloudMediaRetainType<sup>14+</sup>
9880
9881Enumerates the modes used for deleting cloud media assets.
9882
9883**System API**: This is a system API.
9884
9885**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9886
9887| Name |  Value|  Description|
9888| ----- |  ---- |  ---- |
9889| RETAIN_FORCE |  0 |  Deletes the local metadata and thumbnail of the original files from the cloud.|
9890
9891## CloudMediaAssetTaskStatus<sup>14+</sup>
9892
9893Enumerates the statuses of tasks used for downloading cloud media assets.
9894
9895**System API**: This is a system API.
9896
9897**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9898
9899| Name |  Value|  Description|
9900| ----- |  ---- |  ---- |
9901| DOWNLOADING |  0 |  The task is in progress.|
9902| PAUSED |  1 |  The task is paused.|
9903| IDLE |  2 |  There is no download task.|
9904
9905## CloudMediaTaskPauseCause<sup>14+</sup>
9906
9907Enumerates the reasons why a cloud media asset download task is paused.
9908
9909**System API**: This is a system API.
9910
9911**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9912
9913| Name |  Value|  Description|
9914| ----- |  ---- |  ---- |
9915| NO_PAUSE  |  0 |  Downloading is proceeding normally without any pauses.|
9916| TEMPERATURE_LIMIT |  1 |  The device temperature is excessively high.|
9917| ROM_LIMIT |  2 |  The local disk space is insufficient.|
9918| NETWORK_FLOW_LIMIT |  3 |  Network traffic is restricted, and Wi-Fi is not available.|
9919| WIFI_UNAVAILABLE |  4 |  The network is abnormal.|
9920| POWER_LIMIT |  5 |  Power usage is restricted.|
9921| BACKGROUND_TASK_UNAVAILABLE |  6 |  The device is not in charging screen-off mode.|
9922| FREQUENT_USER_REQUESTS |  7 |  The user is making requests too frequently.|
9923| CLOUD_ERROR |  8 |  There is an error with the cloud service.|
9924| USER_PAUSED |  9 |  The download has been paused by the user.|
9925
9926## CloudMediaAssetStatus<sup>14+</sup>
9927
9928Describes the details of a cloud media asset download task. It is the return value of the API used by applications to obtain the cloud asset download task status.
9929
9930**System API**: This is a system API.
9931
9932**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9933
9934| Name                  | Type               | Mandatory| Description                                             |
9935| ---------------------- | ------------------- | ---- | ------------------------------------------------ |
9936|taskStatus       |[CloudMediaAssetTaskStatus](#cloudmediaassettaskstatus14)  |Yes| Status of the download task.|
9937|taskInfo          |string  |Yes| Total number of and size (measured in bytes) of the assets that have been downloaded, and the total number and size (also measured in bytes) of the assets remaining to be downloaded. |
9938|errorCode       |[CloudMediaTaskPauseCause](#cloudmediataskpausecause14)  |Yes| Reason why the download task is suspended.|
9939
9940## RecommendationType<sup>11+</sup>
9941
9942Enumerates the types of recommended images.
9943
9944**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9945
9946| Name |  Value|  Description|
9947| ----- |  ---- | ---- |
9948| COLOR_STYLE_PHOTO<sup>18+</sup> |  12 | Recommended style. **System API**: This is a system API.|
9949
9950## ThumbnailChangeStatus<sup>20+</sup>
9951
9952Enumerates the change statuses of thumbnails (including images and videos).
9953
9954**System API**: This is a system API.
9955
9956**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9957
9958| Name                     | Value  | Description                            |
9959| ------------------------- | ---- | -------------------------------- |
9960| THUMBNAIL_NOT_EXISTS      | 0    | The thumbnail does not exist.    |
9961| THUMBNAIL_ADD             | 1    | The thumbnail has been re-created.    |
9962| THUMBNAIL_UPDATE          | 2    | The thumbnail has been updated.    |
9963| THUMBNAIL_NOT_CHANGE      | 3    | The thumbnail has not changed.    |
9964
9965## StrongAssociationType<sup>20+</sup>
9966
9967Enumerates the strong association types of photos.
9968
9969**System API**: This is a system API.
9970
9971**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9972
9973| Name                     | Value  | Description                            |
9974| ------------------------- | ---- | -------------------------------- |
9975| NORMAL                    | 0    | Common photo.    |
9976| CLOUD_ENHANCEMENT         | 1    | Cloud-enhanced photo.    |
9977
9978## PhotoAssetChangeInfo<sup>20+</sup>
9979
9980Describes the information about a media asset.
9981
9982**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
9983
9984| Name | Type               | Read-Only| Optional| Description                                             |
9985| ---- | ------- | ---- |  ---- | ----- |
9986| fileId | number  | No| No| ID of the media asset.<br>**System API**: This is a system API. |
9987| dateDay | string  | No| No| Date when the media asset was created.<br>**System API**: This is a system API. |
9988| isFavorite | boolean  | No| No| Whether the media asset is marked as a favorite. **true** if marked, **false** otherwise.<br>**System API**: This is a system API. |
9989| isHidden | boolean  | No| No| Whether the media asset is hidden. **true** if hidden, **false** otherwise.<br>**System API**: This is a system API. |
9990| strongAssociation | [StrongAssociationType](#strongassociationtype20)  | No| No| Strong association type of the media asset.<br>**System API**: This is a system API. |
9991| thumbnailVisible | [ThumbnailVisibility](#thumbnailvisibility14)  | No| No| Accessibility status of the thumbnail.<br>**System API**: This is a system API. |
9992| dateTrashedMs |number  |No| No| Unix timestamp when the media asset was deleted, in milliseconds.<br>**System API**: This is a system API. |
9993| dateAddedMs | number  | No| No| Unix timestamp when the media asset was created, in milliseconds.<br>**System API**: This is a system API. |
9994| dateTakenMs | number  | No| No| Unix timestamp when the media asset was captured, in milliseconds.<br>**System API**: This is a system API. |
9995
9996## PhotoAssetChangeData<sup>20+</sup>
9997
9998Describes the change data of a media asset.
9999
10000**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10001
10002| Name                  | Type               | Read-Only| Optional| Description         |
10003| ---- | ------- | ---- |  ---- | ----- |
10004| thumbnailChangeStatus | [ThumbnailChangeStatus](#thumbnailchangestatus20)  | No| No| Change status of the thumbnail (image/video).<br>**System API**: This is a system API.|
10005| version       |  number  | No| No| Version number of the media asset notification, which is used to determine the order of notifications.<br>**System API**: This is a system API. |
10006
10007## AlbumChangeInfo<sup>20+</sup>
10008
10009Describes the information about an album.
10010
10011**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10012
10013| Name | Type               | Read-Only| Optional| Description                                             |
10014| ---- | ------- | ---- |  ---- | ----- |
10015| hiddenCount | number  | No| No| Number of hidden assets in the album.<br>**System API**: This is a system API.|
10016| hiddenCoverUri | string  | No| No| URI of the hidden cover asset in the album.<br>**System API**: This is a system API.|
10017| isCoverChanged | boolean  | No| No| Whether the file content of the album cover has changed. **true** if changed, **false** otherwise.<br>**System API**: This is a system API.|
10018| isHiddenCoverChanged | boolean  | No| No| Whether the file content of the hidden album cover has changed. **true** if changed, **false** otherwise.<br>**System API**: This is a system API.|
10019| coverInfo | [PhotoAssetChangeInfo](#photoassetchangeinfo20)  | No| Yes| Information of the album cover asset.<br>**System API**: This is a system API.|
10020| hiddenCoverInfo | [PhotoAssetChangeInfo](#photoassetchangeinfo20)  | No| Yes| Information of the hidden album cover asset.<br>**System API**: This is a system API.|
10021
10022## AlbumChangeData<sup>20+</sup>
10023
10024Describes the change data of an album.
10025
10026**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10027
10028| Name                  | Type               | Read-Only| Optional| Description      |
10029| ---- | ------- | ---- |  ---- | ----- |
10030| version | number  | No| No| Version number of the album notification, which is used to determine the order of notifications.<br>**System API**: This is a system API.|
10031
10032## PhotoAssetCustomRecord<sup>20+</sup>
10033
10034Provides APIs for custom user behavior recording for Gallery.
10035
10036**System API**: This is a system API.
10037
10038**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10039
10040| Name| Type| Read-Only| Optional| Description|
10041| --- | --- | --- | --- | --- |
10042| fileId | number | Yes| No| File ID, which must be an integer greater than 0.|
10043| shareCount | number | Yes| No| Number of times that image or video was shared. The value must be an integer greater than 0.|
10044| lcdJumpCount | number | Yes| No| Number of times the image or video was jumped to in large view. The value must be an integer greater than 0.|
10045
10046## CoverUriSource<sup>20+</sup>
10047
10048Enumerates the sources of the album covers.
10049
10050**System API**: This is a system API.
10051
10052**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10053
10054| Name                     | Value  | Description                            |
10055| ------------------------- | ---- | -------------------------------- |
10056| DEFAULT_COVER        | 0    | Default cover.    |
10057| MANUAL_COVER         | 1    | Cover manually set.    |
10058
10059## AlbumOrder<sup>20+</sup>
10060
10061Describes the album sorting order.
10062
10063### Properties
10064
10065**System API**: This is a system API.
10066
10067**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
10068
10069| Name          | Type   | Read-Only  | Optional | Description  |
10070| ------------ | ------ | ---- | ---- | ------- |
10071| albumId      | number | No  | No | Album ID.    |
10072| albumOrder   | number | No  | No | Sorting value of the album. |
10073| orderSection | number | No  | No | Sorting section of the album.|
10074| orderType    | number | No  | No | Sorting type of the album.|
10075| orderStatus  | number | No  | No | Sorting status of the album.|
10076