• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22import { Permissions } from './permissions';
23
24/**
25 * @namespace privacyManager
26 * @syscap SystemCapability.Security.AccessToken
27 * @since 9
28 */
29declare namespace privacyManager {
30  /**
31   * Adds access record of sensitive permission.
32   *
33   * @permission ohos.permission.PERMISSION_USED_STATS
34   * @param { number } tokenID - Token ID of the application.
35   * @param { Permissions } permissionName - Name of the permission to be added.
36   * @param { number } successCount - Access count.
37   * @param { number } failCount - Reject count.
38   * @returns { Promise<void> } Promise that returns no value.
39   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
40   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
41   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
42   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
43   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
44   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
45   * @throws { BusinessError } 12100007 - The service is abnormal.
46   * @throws { BusinessError } 12100008 - Out of memory.
47   * @syscap SystemCapability.Security.AccessToken
48   * @systemapi
49   * @since 9
50   */
51  /**
52   * Adds an access record of a sensitive permission.
53   *
54   * @permission ohos.permission.PERMISSION_USED_STATS
55   * @param { number } tokenID - Token ID of the application.
56   * @param { Permissions } permissionName - Name of the permission accessed.
57   * @param { number } successCount - Number of successful accesses to the permission.
58   * @param { number } failCount - Number of failed accesses to the permission.
59   * @param { AddPermissionUsedRecordOptions } options - Options to be added.
60   * @returns { Promise<void> } Promise that returns no value.
61   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
62   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
63   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
64   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, the count value is invalid,
65   *  or usedType in AddPermissionUsedRecordOptions is invalid.
66   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
67   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
68   * @throws { BusinessError } 12100007 - The service is abnormal.
69   * @throws { BusinessError } 12100008 - Out of memory.
70   * @syscap SystemCapability.Security.AccessToken
71   * @systemapi
72   * @since 12
73   */
74  function addPermissionUsedRecord(
75    tokenID: number,
76    permissionName: Permissions,
77    successCount: number,
78    failCount: number,
79    options?: AddPermissionUsedRecordOptions
80  ): Promise<void>;
81
82  /**
83   * Adds access record of sensitive permission.
84   *
85   * @permission ohos.permission.PERMISSION_USED_STATS
86   * @param { number } tokenID - Token ID of the application.
87   * @param { Permissions } permissionName - Name of the permission to be added.
88   * @param { number } successCount - Access count.
89   * @param { number } failCount - Reject count.
90   * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
91   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
92   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
93   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
94   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
95   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
96   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
97   * @throws { BusinessError } 12100007 - The service is abnormal.
98   * @throws { BusinessError } 12100008 - Out of memory.
99   * @syscap SystemCapability.Security.AccessToken
100   * @systemapi
101   * @since 9
102   */
103  function addPermissionUsedRecord(
104    tokenID: number,
105    permissionName: Permissions,
106    successCount: number,
107    failCount: number,
108    callback: AsyncCallback<void>
109  ): void;
110
111  /**
112   * Queries the access records of sensitive permission.
113   *
114   * @permission ohos.permission.PERMISSION_USED_STATS
115   * @param { PermissionUsedRequest } request - The request of permission used records.
116   * @returns { Promise<PermissionUsedResponse> } Return the response of permission used records.
117   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
118   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
119   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
120   * @throws { BusinessError } 12100001 - Invalid parameter. The value of flag in request is invalid.
121   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
122   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
123   * @throws { BusinessError } 12100007 - The service is abnormal.
124   * @throws { BusinessError } 12100008 - Out of memory.
125   * @syscap SystemCapability.Security.AccessToken
126   * @systemapi
127   * @since 9
128   */
129  function getPermissionUsedRecord(request: PermissionUsedRequest): Promise<PermissionUsedResponse>;
130
131  /**
132   * Queries the access records of sensitive permission.
133   *
134   * @permission ohos.permission.PERMISSION_USED_STATS
135   * @param { PermissionUsedRequest } request - The request of permission used records.
136   * @param { AsyncCallback<PermissionUsedResponse> } callback - Return the response of permission used records.
137   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
138   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
139   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
140   * @throws { BusinessError } 12100001 - Invalid parameter. The value of flag in request is invalid.
141   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
142   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
143   * @throws { BusinessError } 12100007 - The service is abnormal.
144   * @throws { BusinessError } 12100008 - Out of memory.
145   * @syscap SystemCapability.Security.AccessToken
146   * @systemapi
147   * @since 9
148   */
149  function getPermissionUsedRecord(
150    request: PermissionUsedRequest,
151    callback: AsyncCallback<PermissionUsedResponse>
152  ): void;
153
154  /**
155   * Start using sensitive permission.
156   *
157   * @permission ohos.permission.PERMISSION_USED_STATS
158   * @param { number } tokenID - Token ID of the application.
159   * @param { Permissions } permissionName - Name of the permission to be started.
160   * @returns { Promise<void> } Promise that returns no value.
161   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
162   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
163   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
164   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
165   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
166   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
167   * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
168   *  It means the application specified by the tokenID has been using the specified permission.
169   * @throws { BusinessError } 12100007 - The service is abnormal.
170   * @throws { BusinessError } 12100008 - Out of memory.
171   * @syscap SystemCapability.Security.AccessToken
172   * @systemapi
173   * @since 9
174   */
175  function startUsingPermission(tokenID: number, permissionName: Permissions): Promise<void>;
176
177  /**
178   * Start using sensitive permission.
179   *
180   * @permission ohos.permission.PERMISSION_USED_STATS
181   * @param { number } tokenID - Token ID of the application.
182   * @param { Permissions } permissionName - Name of the permission to be started.
183   * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
184   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
185   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
186   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
187   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
188   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
189   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
190   * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
191   *  It means the application specified by the tokenID has been using the specified permission.
192   * @throws { BusinessError } 12100007 - The service is abnormal.
193   * @throws { BusinessError } 12100008 - Out of memory.
194   * @syscap SystemCapability.Security.AccessToken
195   * @systemapi
196   * @since 9
197   */
198  function startUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback<void>): void;
199
200  /**
201   * Stop using sensitive permission.
202   *
203   * @permission ohos.permission.PERMISSION_USED_STATS
204   * @param { number } tokenID - Token ID of the application.
205   * @param { Permissions } permissionName - Name of the permission to be stopped.
206   * @returns { Promise<void> } Promise that returns no value.
207   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
208   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
209   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
210   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
211   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
212   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
213   * @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'.
214   * @throws { BusinessError } 12100007 - The service is abnormal.
215   * @throws { BusinessError } 12100008 - Out of memory.
216   * @syscap SystemCapability.Security.AccessToken
217   * @systemapi
218   * @since 9
219   */
220  function stopUsingPermission(tokenID: number, permissionName: Permissions): Promise<void>;
221
222  /**
223   * Stop using sensitive permission.
224   *
225   * @permission ohos.permission.PERMISSION_USED_STATS
226   * @param { number } tokenID - Token ID of the application.
227   * @param { Permissions } permissionName - Name of the permission to be stopped.
228   * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
229   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
230   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
231   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
232   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
233   * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
234   * @throws { BusinessError } 12100003 - The specified permission does not exist or is not an user_grant permission.
235   * @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'.
236   * @throws { BusinessError } 12100007 - The service is abnormal.
237   * @throws { BusinessError } 12100008 - Out of memory.
238   * @syscap SystemCapability.Security.AccessToken
239   * @systemapi
240   * @since 9
241   */
242  function stopUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback<void>): void;
243
244  /**
245   * Subscribes to the change of active state of the specified permission.
246   *
247   * @permission ohos.permission.PERMISSION_USED_STATS
248   * @param { 'activeStateChange' } type - Event type. This parameter cannot change.
249   * @param { Array<Permissions> } permissionList - Indicates the permission list, which are specified. This parameter cannot be null or empty.
250   * @param { Callback<ActiveChangeResponse> } callback Callback for listening permission change.
251   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
252   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
253   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
254   * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, or the permissionName exceeds 256 characters.
255   * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
256   * @throws { BusinessError } 12100005 - The registration time has exceeded the limitation.
257   * @throws { BusinessError } 12100007 - The service is abnormal.
258   * @throws { BusinessError } 12100008 - Out of memory.
259   * @syscap SystemCapability.Security.AccessToken
260   * @systemapi
261   * @since 9
262   */
263  function on(
264    type: 'activeStateChange',
265    permissionList: Array<Permissions>,
266    callback: Callback<ActiveChangeResponse>
267  ): void;
268
269  /**
270   * Unsubscribes to the change of active state of the specified permission.
271   *
272   * @permission ohos.permission.PERMISSION_USED_STATS
273   * @param { 'activeStateChange' } type - Event type. This parameter cannot change.
274   * @param { Array<Permissions> } permissionList - Indicates the permission list, which are specified. This parameter cannot be null or empty.
275   * @param { Callback<ActiveChangeResponse> } callback - Callback for listening permission change.
276   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
277   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
278   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
279   * @throws { BusinessError } 12100001 - Invalid parameter. The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes.
280   * @throws { BusinessError } 12100004 - The API is not used in pair with 'on'.
281   * @throws { BusinessError } 12100007 - The service is abnormal.
282   * @throws { BusinessError } 12100008 - Out of memory.
283   * @syscap SystemCapability.Security.AccessToken
284   * @systemapi
285   * @since 9
286   */
287  function off(
288    type: 'activeStateChange',
289    permissionList: Array<Permissions>,
290    callback?: Callback<ActiveChangeResponse>
291  ): void;
292
293  /**
294   * Obtains the used type of the permission accessed.
295   *
296   * @permission ohos.permission.PERMISSION_USED_STATS
297   * @param { number } tokenId - Token ID of the application. By default, all token IDs of the device are returned.
298   * @param { Permissions } permissionName - Name of the permission to query. By default, all permissions of the device are returned.
299   * @returns { Promise<Array<PermissionUsedTypeInfo>> } Promise used to return the information obtained.
300   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.
301   * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
302   * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
303   * @throws { BusinessError } 12100001 - Invalid parameter. PermissionName exceeds 256 characters.
304   * @throws { BusinessError } 12100002 - The input tokenId does not exist.
305   * @throws { BusinessError } 12100003 - The input permissionName does not exist.
306   * @syscap SystemCapability.Security.AccessToken
307   * @systemapi
308   * @since 12
309   */
310  function getPermissionUsedTypeInfos(tokenId?: number, permissionName?: Permissions): Promise<Array<PermissionUsedTypeInfo>>;
311
312  /**
313   * Enum for permission for status.
314   *
315   * @enum { number } PermissionActiveStatus
316   * @syscap SystemCapability.Security.AccessToken
317   * @systemapi
318   * @since 9
319   */
320  enum PermissionActiveStatus {
321    /**
322     * permission is not used yet.
323     *
324     * @syscap SystemCapability.Security.AccessToken
325     * @systemapi
326     * @since 9
327     */
328    PERM_INACTIVE = 0,
329
330    /**
331     * permission is used in front_end.
332     *
333     * @syscap SystemCapability.Security.AccessToken
334     * @systemapi
335     * @since 9
336     */
337    PERM_ACTIVE_IN_FOREGROUND = 1,
338
339    /**
340     * permission is used in back_end.
341     *
342     * @syscap SystemCapability.Security.AccessToken
343     * @systemapi
344     * @since 9
345     */
346    PERM_ACTIVE_IN_BACKGROUND = 2
347  }
348
349  /**
350   * Indicates the response of permission active status.
351   *
352   * @interface ActiveChangeResponse
353   * @syscap SystemCapability.Security.AccessToken
354   * @systemapi
355   * @since 9
356   */
357  interface ActiveChangeResponse {
358    /**
359     * AccessTokenID
360     *
361     * @type { number }
362     * @syscap SystemCapability.Security.AccessToken
363     * @systemapi
364     * @since 9
365     */
366    tokenId: number;
367
368    /**
369     * The permission name
370     *
371     * @type { Permissions }
372     * @syscap SystemCapability.Security.AccessToken
373     * @systemapi
374     * @since 9
375     */
376    permissionName: Permissions;
377
378    /**
379     * The device id
380     *
381     * @type { string }
382     * @syscap SystemCapability.Security.AccessToken
383     * @systemapi
384     * @since 9
385     */
386    deviceId: string;
387    /**
388     * The active status name
389     *
390     * @type { PermissionActiveStatus }
391     * @syscap SystemCapability.Security.AccessToken
392     * @systemapi
393     * @since 9
394     */
395    activeStatus: PermissionActiveStatus;
396  }
397
398  /**
399   * PermissionUsageFlag.
400   *
401   * @enum { number } PermissionUsageFlag
402   * @syscap SystemCapability.Security.AccessToken
403   * @systemapi
404   * @since 9
405   */
406  enum PermissionUsageFlag {
407    /**
408     * permission used summary
409     *
410     * @syscap SystemCapability.Security.AccessToken
411     * @systemapi
412     * @since 9
413     */
414    FLAG_PERMISSION_USAGE_SUMMARY = 0,
415    /**
416     * permission used detail
417     *
418     * @syscap SystemCapability.Security.AccessToken
419     * @systemapi
420     * @since 9
421     */
422    FLAG_PERMISSION_USAGE_DETAIL = 1
423  }
424
425  /**
426   * Provides request of querying permission used records.
427   *
428   * @interface PermissionUsedRequest
429   * @syscap SystemCapability.Security.AccessToken
430   * @systemapi
431   * @since 9
432   */
433  interface PermissionUsedRequest {
434    /**
435     * AccessTokenID
436     *
437     * @type { ?number }
438     * @syscap SystemCapability.Security.AccessToken
439     * @systemapi
440     * @since 9
441     */
442    tokenId?: number;
443
444    /**
445     * Distribute flag
446     *
447     * @type { ?boolean }
448     * @default false
449     * @syscap SystemCapability.Security.AccessToken
450     * @systemapi
451     * @since 9
452     */
453    isRemote?: boolean;
454
455    /**
456     * The device id
457     *
458     * @type { ?string }
459     * @syscap SystemCapability.Security.AccessToken
460     * @systemapi
461     * @since 9
462     */
463    deviceId?: string;
464
465    /**
466     * The bundle name
467     *
468     * @type { ?string }
469     * @syscap SystemCapability.Security.AccessToken
470     * @systemapi
471     * @since 9
472     */
473    bundleName?: string;
474
475    /**
476     * The list of permission name
477     *
478     * @type { ?Array<Permissions> }
479     * @syscap SystemCapability.Security.AccessToken
480     * @systemapi
481     * @since 9
482     */
483    permissionNames?: Array<Permissions>;
484
485    /**
486     * The begin time, in milliseconds
487     *
488     * @type { ?number }
489     * @default 0
490     * @syscap SystemCapability.Security.AccessToken
491     * @systemapi
492     * @since 9
493     */
494    beginTime?: number;
495
496    /**
497     * The end time, in milliseconds
498     *
499     * @type { ?number }
500     * @default 0
501     * @syscap SystemCapability.Security.AccessToken
502     * @systemapi
503     * @since 9
504     */
505    endTime?: number;
506
507    /**
508     * The permission usage flag
509     *
510     * @type { PermissionUsageFlag }
511     * @syscap SystemCapability.Security.AccessToken
512     * @systemapi
513     * @since 9
514     */
515    flag: PermissionUsageFlag;
516  }
517
518  /**
519   * Provides response of querying permission used records.
520   *
521   * @interface PermissionUsedResponse
522   * @syscap SystemCapability.Security.AccessToken
523   * @systemapi
524   * @since 9
525   */
526  interface PermissionUsedResponse {
527    /**
528     * The begin time, in milliseconds
529     *
530     * @type { number }
531     * @syscap SystemCapability.Security.AccessToken
532     * @systemapi
533     * @since 9
534     */
535    beginTime: number;
536
537    /**
538     * The end time, in milliseconds
539     *
540     * @type { number }
541     * @syscap SystemCapability.Security.AccessToken
542     * @systemapi
543     * @since 9
544     */
545    endTime: number;
546
547    /**
548     * The list of permission used records of bundle
549     *
550     * @type { Array<BundleUsedRecord> }
551     * @syscap SystemCapability.Security.AccessToken
552     * @systemapi
553     * @since 9
554     */
555    bundleRecords: Array<BundleUsedRecord>;
556  }
557
558  /**
559   * BundleUsedRecord.
560   *
561   * @interface BundleUsedRecord
562   * @syscap SystemCapability.Security.AccessToken
563   * @systemapi
564   * @since 9
565   */
566  interface BundleUsedRecord {
567    /**
568     * AccessTokenID
569     *
570     * @type { number }
571     * @syscap SystemCapability.Security.AccessToken
572     * @systemapi
573     * @since 9
574     */
575    tokenId: number;
576
577    /**
578     * Distribute flag
579     *
580     * @type { boolean }
581     * @syscap SystemCapability.Security.AccessToken
582     * @systemapi
583     * @since 9
584     */
585    isRemote: boolean;
586
587    /**
588     * The device id
589     *
590     * @type { string }
591     * @syscap SystemCapability.Security.AccessToken
592     * @systemapi
593     * @since 9
594     */
595    deviceId: string;
596
597    /**
598     * The bundle name
599     *
600     * @type { string }
601     * @syscap SystemCapability.Security.AccessToken
602     * @systemapi
603     * @since 9
604     */
605    bundleName: string;
606
607    /**
608     * The list of permission used records
609     *
610     * @type { Array<PermissionUsedRecord> }
611     * @syscap SystemCapability.Security.AccessToken
612     * @systemapi
613     * @since 9
614     */
615    permissionRecords: Array<PermissionUsedRecord>;
616  }
617
618  /**
619   * PermissionUsedRecord.
620   *
621   * @interface PermissionUsedRecord
622   * @syscap SystemCapability.Security.AccessToken
623   * @systemapi
624   * @since 9
625   */
626  interface PermissionUsedRecord {
627    /**
628     * The permission name
629     *
630     * @type { Permissions }
631     * @syscap SystemCapability.Security.AccessToken
632     * @systemapi
633     * @since 9
634     */
635    permissionName: Permissions;
636
637    /**
638     * The access counts
639     *
640     * @type { number }
641     * @syscap SystemCapability.Security.AccessToken
642     * @systemapi
643     * @since 9
644     */
645    accessCount: number;
646
647    /**
648     * The reject counts
649     *
650     * @type { number }
651     * @syscap SystemCapability.Security.AccessToken
652     * @systemapi
653     * @since 9
654     */
655    rejectCount: number;
656
657    /**
658     * The last access time, in milliseconds
659     *
660     * @type { number }
661     * @syscap SystemCapability.Security.AccessToken
662     * @systemapi
663     * @since 9
664     */
665    lastAccessTime: number;
666
667    /**
668     * The last reject time, in milliseconds
669     *
670     * @type { number }
671     * @syscap SystemCapability.Security.AccessToken
672     * @systemapi
673     * @since 9
674     */
675    lastRejectTime: number;
676
677    /**
678     * The last access duration, in milliseconds
679     *
680     * @type { number }
681     * @syscap SystemCapability.Security.AccessToken
682     * @systemapi
683     * @since 9
684     */
685    lastAccessDuration: number;
686
687    /**
688     * The list of access records of details
689     *
690     * @type { Array<UsedRecordDetail> }
691     * @syscap SystemCapability.Security.AccessToken
692     * @systemapi
693     * @since 9
694     */
695    accessRecords: Array<UsedRecordDetail>;
696
697    /**
698     * The list of reject records of details
699     *
700     * @type { Array<UsedRecordDetail> }
701     * @syscap SystemCapability.Security.AccessToken
702     * @systemapi
703     * @since 9
704     */
705    rejectRecords: Array<UsedRecordDetail>;
706  }
707
708  /**
709   * UsedRecordDetail.
710   *
711   * @interface UsedRecordDetail
712   * @syscap SystemCapability.Security.AccessToken
713   * @systemapi
714   * @since 9
715   */
716  interface UsedRecordDetail {
717    /**
718     * The status
719     *
720     * @type { number }
721     * @syscap SystemCapability.Security.AccessToken
722     * @systemapi
723     * @since 9
724     */
725    status: number;
726
727    /**
728     * Indicates the status of lockscreen.
729     *
730     * @type { ?number }
731     * @syscap SystemCapability.Security.AccessToken
732     * @systemapi
733     * @since 11
734     */
735    lockScreenStatus?: number;
736
737    /**
738     * Timestamp, in milliseconds
739     *
740     * @type { number }
741     * @syscap SystemCapability.Security.AccessToken
742     * @systemapi
743     * @since 9
744     */
745    timestamp: number;
746
747    /**
748     * The value of successCount or failCount passed in to addPermissionUsedRecord.
749     *
750     * @type { ?number }
751     * @syscap SystemCapability.Security.AccessToken
752     * @systemapi
753     * @since 11
754     */
755    count?: number;
756
757    /**
758     * Access duration, in milliseconds
759     *
760     * @type { number }
761     * @syscap SystemCapability.Security.AccessToken
762     * @systemapi
763     * @since 9
764     */
765    accessDuration: number;
766
767    /**
768     * Used type of the permission accessed.
769     *
770     * @type { ?PermissionUsedType }
771     * @syscap SystemCapability.Security.AccessToken
772     * @systemapi
773     * @since 12
774     */
775    usedType?: PermissionUsedType;
776  }
777
778  /**
779   * Enumerates the means by which sensitive resources are accessed.
780   *
781   * @enum { number } PermissionUsedType
782   * @syscap SystemCapability.Security.AccessToken
783   * @systemapi
784   * @since 12
785   */
786  enum PermissionUsedType {
787    /**
788     * Sensitive resources are accessed with the declared permission or permission granted by the user.
789     *
790     * @syscap SystemCapability.Security.AccessToken
791     * @systemapi
792     * @since 12
793     */
794    NORMAL_TYPE = 0,
795
796    /**
797     * Sensitive resources are accessed through a picker.
798     *
799     * @syscap SystemCapability.Security.AccessToken
800     * @systemapi
801     * @since 12
802     */
803    PICKER_TYPE = 1,
804
805    /**
806     * Sensitive resources are accessed through a security component.
807     *
808     * @syscap SystemCapability.Security.AccessToken
809     * @systemapi
810     * @since 12
811     */
812    SECURITY_COMPONENT_TYPE = 2
813  }
814
815  /**
816   * Information about the permission used type.
817   *
818   * @interface PermissionUsedTypeInfo
819   * @syscap SystemCapability.Security.AccessToken
820   * @systemapi
821   * @since 12
822   */
823  interface PermissionUsedTypeInfo {
824    /**
825     * Token ID of the application.
826     *
827     * @type { number }
828     * @syscap SystemCapability.Security.AccessToken
829     * @systemapi
830     * @since 12
831     */
832    tokenId: number;
833
834    /**
835     * Name of the permission accessed.
836     *
837     * @type { Permissions }
838     * @syscap SystemCapability.Security.AccessToken
839     * @systemapi
840     * @since 12
841     */
842    permissionName: Permissions;
843
844    /**
845     * Used type of the permission accessed.
846     *
847     * @type { PermissionUsedType }
848     * @syscap SystemCapability.Security.AccessToken
849     * @systemapi
850     * @since 12
851     */
852    usedType: PermissionUsedType;
853  }
854
855  /**
856   * Additional information to add.
857   *
858   * @interface AddPermissionUsedRecordOptions
859   * @syscap SystemCapability.Security.AccessToken
860   * @systemapi
861   * @since 12
862   */
863  interface AddPermissionUsedRecordOptions {
864    /**
865     * Used type of the permission accessed.
866     *
867     * @type { ?PermissionUsedType }
868     * @syscap SystemCapability.Security.AccessToken
869     * @systemapi
870     * @since 12
871     */
872    usedType?: PermissionUsedType;
873  }
874}
875
876export default privacyManager;
877export { Permissions };