diff --git a/api/@ohos.abilityAccessCtrl.d.ts b/api/@ohos.abilityAccessCtrl.d.ts index a7e2c44790375f5978fe8ae1ac1621d3f6c7463a..015e4f2f53a6929f6bd2a8c2eb7b290f7fe35cb2 100644 --- a/api/@ohos.abilityAccessCtrl.d.ts +++ b/api/@ohos.abilityAccessCtrl.d.ts @@ -74,6 +74,17 @@ import { AsyncCallback } from "./basic"; * @since 8 */ getPermissionFlags(tokenID: number, permissionName: string): Promise; + + /** + * Queries the access records of sensitive permission. + * @param request The request of permission used records. + * @return Return the reponse of permission used records. + * @permission ohos.permission.PERMISSION_USED_STATS. + * @systemapi hid this for inner system use + * @since 9 + */ + getPermissionUsedRecords(request: PermissionUsedRequest): Promise; + getPermissionUsedRecords(request: PermissionUsedRequest, callback: AsyncCallback): void; } /** @@ -90,6 +101,150 @@ import { AsyncCallback } from "./basic"; */ PERMISSION_GRANTED = 0, } - } - export default abilityAccessCtrl; + /** + * PermissionUsageFlag. + * @since 9 + */ + enum PermissionUsageFlag { + /** + * permission used summary + */ + FLAG_PERMISSION_USAGE_SUMMARY = 0, + /** + * permission used detail + */ + FLAG_PERMISSION_USAGE_DETAIL = 1, + } + + /** + * Provides request of querying permission used records. + * @since 9 + */ + interface PermissionUsedRequest { + /** + * The device id + */ + deviceId: string; + + /** + * The bundle name + */ + bundleName: string; + + /** + * The list of permision name + */ + permNames: Array; + + /** + * The begin time + */ + beginTimeMillis: number; + + /** + * The end time + */ + endTimeMillis: number; + + /** + * The permission usage flag + */ + flag: PermissionUsageFlag; + } + + /** + * Provides response of querying permission used records. + * @since 9 + */ + interface PermissionUsedResponse { + /** + * The begin time + */ + beginTimeMillis: number; + + /** + * The end time + */ + endTimeMillis: number; + + /** + * The list of permision used records + */ + permissionRecords: Array; + } + + /** + * PermissionUsedRecord. + * @since 9 + */ + interface PermissionUsedRecord { + /** + * The permission name + */ + permissionName: string; + + /** + * The list of bundle used records + */ + bundleRecords: Array; + } + + /** + * BundleUsedRecord. + * @since 9 + */ + interface BundleUsedRecord { + /** + * The device id + */ + deviceId: string; + + /** + * The bundle name + */ + bundleName: string; + + /** + * The access counts in the foreground + */ + accessCountFg: number; + + /** + * The reject counts in the foreground + */ + rejectCountFg: number; + + /** + * The access counts in the background + */ + accessCountBg: number; + + /** + * The reject counts in the background + */ + rejectCountBg: number; + + /** + * The list of access records in the foreground + */ + accessRecordFg: Array; + + /** + * The list of access records in the foreground + */ + rejectRecordFg: Array; + + /** + * The list of access records in the background + */ + accessRecordBg: Array; + + /** + * The list of access records in the background + */ + rejectRecordBg: Array; + } +} + +export default abilityAccessCtrl;