46 Star 173 Fork 4.7K

OpenHarmony/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.privacyManager.d.ts 37.52 KB
一键复制 编辑 原始数据 按行查看 历史
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit AbilityKit
*/
import { AsyncCallback, Callback } from './@ohos.base';
import { Permissions } from './permissions';
/**
* @namespace privacyManager
* @syscap SystemCapability.Security.AccessToken
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
declare namespace privacyManager {
/**
* Adds access record of sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { int } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be added.
* @param { int } successCount - Access count.
* @param { int } failCount - Reject count.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
/**
* Adds an access record of a sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { int } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission accessed.
* @param { int } successCount - Number of successful accesses to the permission.
* @param { int } failCount - Number of failed accesses to the permission.
* @param { AddPermissionUsedRecordOptions } [options] - Options to be added.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, the count value is invalid,
* or usedType in AddPermissionUsedRecordOptions is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
function addPermissionUsedRecord(
tokenID: int,
permissionName: Permissions,
successCount: int,
failCount: int,
options?: AddPermissionUsedRecordOptions
): Promise<void>;
/**
* Adds access record of sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { int } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be added.
* @param { int } successCount - Access count.
* @param { int } failCount - Reject count.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, or the count value is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
function addPermissionUsedRecord(
tokenID: int,
permissionName: Permissions,
successCount: int,
failCount: int,
callback: AsyncCallback<void>
): void;
/**
* Queries the access records of sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { PermissionUsedRequest } request - The request of permission used records.
* @returns { Promise<PermissionUsedResponse> } Return the response of permission used records.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The value of flag, begin, or end in request is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function getPermissionUsedRecord(request: PermissionUsedRequest): Promise<PermissionUsedResponse>;
/**
* Queries the access records of sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { PermissionUsedRequest } request - The request of permission used records.
* @param { AsyncCallback<PermissionUsedResponse> } callback - Return the response of permission used records.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The value of flag, begin, or end in request is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function getPermissionUsedRecord(
request: PermissionUsedRequest,
callback: AsyncCallback<PermissionUsedResponse>
): void;
/**
* Start using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be started.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* or the type of the specified tokenID is not of the application type.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
* It means the application specified by the tokenID has been using the specified permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function startUsingPermission(tokenID: number, permissionName: Permissions): Promise<void>;
/**
* Start using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be started.
* @param { number } [pid] - Pid of the application, default -1.
* @param { PermissionUsedType } [usedType] - Used type of the permission accessed, default NORMAL_TYPE.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* the type of the specified tokenID is not of the application type, or usedType is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
* It means the application specified by the tokenID has been using the specified permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 18
*/
function startUsingPermission(
tokenID: number,
permissionName: Permissions,
pid?: number,
usedType?: PermissionUsedType
): Promise<void>;
/**
* Start using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be started.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* or the type of the specified tokenID is not of the application type.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
* It means the application specified by the tokenID has been using the specified permission.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function startUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback<void>): void;
/**
* Stop using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be stopped.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* or the type of the specified tokenID is not of the application type.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function stopUsingPermission(tokenID: number, permissionName: Permissions): Promise<void>;
/**
* Stop using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be stopped.
* @param { number } [pid] - Pid of the application, default -1.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* or the type of the specified tokenID is not of the application type.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 18
*/
function stopUsingPermission(
tokenID: number,
permissionName: Permissions,
pid?: number
): Promise<void>;
/**
* Stop using sensitive permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { number } tokenID - Token ID of the application.
* @param { Permissions } permissionName - Name of the permission to be stopped.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters,
* or the type of the specified tokenID is not of the application type.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process.
* @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission.
* @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
function stopUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback<void>): void;
/**
* Subscribes to the change of active state of the specified permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { 'activeStateChange' } type - Event type. This parameter cannot change.
* @param { Array<Permissions> } permissionList - Indicates the permission list, which are specified. This parameter cannot be null or empty.
* @param { Callback<ActiveChangeResponse> } callback Callback for listening permission change.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The permissionList exceeds the size limit, or the permissionNames in the list are all invalid.
* @throws { BusinessError } 12100004 - The API is used repeatedly with the same input.
* @throws { BusinessError } 12100005 - The registration time has exceeded the limit.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
function on(
type: 'activeStateChange',
permissionList: Array<Permissions>,
callback: Callback<ActiveChangeResponse>
): void;
/**
* Unsubscribes to the change of active state of the specified permission.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { 'activeStateChange' } type - Event type. This parameter cannot change.
* @param { Array<Permissions> } permissionList - Indicates the permission list, which are specified. This parameter cannot be null or empty.
* @param { Callback<ActiveChangeResponse> } [callback] - Callback for listening permission change.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. The permissionList is not in the listening list.
* @throws { BusinessError } 12100004 - The API is not used in pair with 'on'.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
function off(
type: 'activeStateChange',
permissionList: Array<Permissions>,
callback?: Callback<ActiveChangeResponse>
): void;
/**
* Obtains the used type of the permission accessed.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { int } tokenId - Token ID of the application. By default, all token IDs of the device are returned.
* @param { Permissions } permissionName - Name of the permission to query. By default, all permissions of the device are returned.
* @returns { Promise<Array<PermissionUsedTypeInfo>> } Promise used to return the information obtained.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. PermissionName exceeds 256 characters.
* @throws { BusinessError } 12100002 - The input tokenId does not exist.
* @throws { BusinessError } 12100003 - The input permissionName does not exist.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
/**
* Obtains the used type of the permission accessed.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @param { int | null } [tokenId] - Token ID of the application. By default, all token IDs of the device
* are returned.
* @param { Permissions } [permissionName] - Name of the permission to query. By default, all permissions
* of the device are returned.
* @returns { Promise<Array<PermissionUsedTypeInfo>> } Promise used to return the information obtained.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission
* "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100001 - Invalid parameter. PermissionName exceeds 256 characters.
* @throws { BusinessError } 12100002 - The input tokenId does not exist.
* @throws { BusinessError } 12100003 - The input permissionName does not exist.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 20
*/
function getPermissionUsedTypeInfos(tokenId?: int | null, permissionName?: Permissions): Promise<Array<PermissionUsedTypeInfo>>;
/**
* Sets the toggle state of permission access records for the current user.
*
* @permission ohos.permission.PERMISSION_RECORD_TOGGLE
* @param { boolean } status - The toggle status to be set.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_RECORD_TOGGLE".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @throws { BusinessError } 12100009 - Common inner error.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 18
*/
function setPermissionUsedRecordToggleStatus(status: boolean): Promise<void>;
/**
* Obtains the toggle state of permission access records of the current user.
*
* @permission ohos.permission.PERMISSION_USED_STATS
* @returns { Promise<boolean> } Return the toggle status.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS".
* @throws { BusinessError } 202 - Not system app. Interface caller is not a system app.
* @throws { BusinessError } 12100007 - The service is abnormal.
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 18
*/
function getPermissionUsedRecordToggleStatus(): Promise<boolean>;
/**
* Enum for permission for status.
*
* @enum { int } PermissionActiveStatus
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
enum PermissionActiveStatus {
/**
* permission is not used yet.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
PERM_INACTIVE = 0,
/**
* permission is used in front_end.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
PERM_ACTIVE_IN_FOREGROUND = 1,
/**
* permission is used in back_end.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
PERM_ACTIVE_IN_BACKGROUND = 2
}
/**
* Indicates the response of permission active status.
*
* @interface ActiveChangeResponse
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
interface ActiveChangeResponse {
/**
* AccessTokenID which called the interface
*
* @type { ?int }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
callingTokenId?: int;
/**
* AccessTokenID
*
* @type { int }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
tokenId: int;
/**
* The permission name
*
* @type { Permissions }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
permissionName: Permissions;
/**
* The device id
*
* @type { string }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* The active status name
*
* @type { PermissionActiveStatus }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'9', '1.2':'20'}
* @arkts 1.1&1.2
*/
activeStatus: PermissionActiveStatus;
/**
* Used type of the permission accessed.
*
* @type { ?PermissionUsedType }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
usedType?: PermissionUsedType;
}
/**
* PermissionUsageFlag.
*
* @enum { number } PermissionUsageFlag
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
enum PermissionUsageFlag {
/**
* permission used summary
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
FLAG_PERMISSION_USAGE_SUMMARY = 0,
/**
* permission used detail
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
FLAG_PERMISSION_USAGE_DETAIL = 1
}
/**
* Provides request of querying permission used records.
*
* @interface PermissionUsedRequest
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
interface PermissionUsedRequest {
/**
* AccessTokenID
*
* @type { ?number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
tokenId?: number;
/**
* Distribute flag
*
* @type { ?boolean }
* @default false
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
isRemote?: boolean;
/**
* The device id
*
* @type { ?string }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
deviceId?: string;
/**
* The bundle name
*
* @type { ?string }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
bundleName?: string;
/**
* The list of permission name
*
* @type { ?Array<Permissions> }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
permissionNames?: Array<Permissions>;
/**
* The begin time, in milliseconds
*
* @type { ?number }
* @default 0
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
beginTime?: number;
/**
* The end time, in milliseconds
*
* @type { ?number }
* @default 0
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
endTime?: number;
/**
* The permission usage flag
*
* @type { PermissionUsageFlag }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
flag: PermissionUsageFlag;
}
/**
* Provides response of querying permission used records.
*
* @interface PermissionUsedResponse
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
interface PermissionUsedResponse {
/**
* The begin time, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
beginTime: number;
/**
* The end time, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
endTime: number;
/**
* The list of permission used records of bundle
*
* @type { Array<BundleUsedRecord> }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
bundleRecords: Array<BundleUsedRecord>;
}
/**
* BundleUsedRecord.
*
* @interface BundleUsedRecord
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
interface BundleUsedRecord {
/**
* AccessTokenID
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
tokenId: number;
/**
* Distribute flag
*
* @type { boolean }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
isRemote: boolean;
/**
* The device id
*
* @type { string }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
deviceId: string;
/**
* The bundle name
*
* @type { string }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
bundleName: string;
/**
* The list of permission used records
*
* @type { Array<PermissionUsedRecord> }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
permissionRecords: Array<PermissionUsedRecord>;
}
/**
* PermissionUsedRecord.
*
* @interface PermissionUsedRecord
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
interface PermissionUsedRecord {
/**
* The permission name
*
* @type { Permissions }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
permissionName: Permissions;
/**
* The access counts
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
accessCount: number;
/**
* The reject counts
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
rejectCount: number;
/**
* The last access time, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
lastAccessTime: number;
/**
* The last reject time, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
lastRejectTime: number;
/**
* The last access duration, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
lastAccessDuration: number;
/**
* The list of access records of details
*
* @type { Array<UsedRecordDetail> }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
accessRecords: Array<UsedRecordDetail>;
/**
* The list of reject records of details
*
* @type { Array<UsedRecordDetail> }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
rejectRecords: Array<UsedRecordDetail>;
}
/**
* UsedRecordDetail.
*
* @interface UsedRecordDetail
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
interface UsedRecordDetail {
/**
* The status
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
status: number;
/**
* Indicates the status of lockscreen.
*
* @type { ?number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
lockScreenStatus?: number;
/**
* Timestamp, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
timestamp: number;
/**
* The value of successCount or failCount passed in to addPermissionUsedRecord.
*
* @type { ?number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
count?: number;
/**
* Access duration, in milliseconds
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 9
*/
accessDuration: number;
/**
* Used type of the permission accessed.
*
* @type { ?PermissionUsedType }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
usedType?: PermissionUsedType;
}
/**
* Enumerates the means by which sensitive resources are accessed.
*
* @enum { int } PermissionUsedType
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
enum PermissionUsedType {
/**
* Sensitive resources are accessed with the declared permission or permission granted by the user.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
NORMAL_TYPE = 0,
/**
* Sensitive resources are accessed through a picker.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
PICKER_TYPE = 1,
/**
* Sensitive resources are accessed through a security component.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
SECURITY_COMPONENT_TYPE = 2
}
/**
* Information about the permission used type.
*
* @interface PermissionUsedTypeInfo
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
interface PermissionUsedTypeInfo {
/**
* Token ID of the application.
*
* @type { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
tokenId: number;
/**
* Name of the permission accessed.
*
* @type { Permissions }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
permissionName: Permissions;
/**
* Used type of the permission accessed.
*
* @type { PermissionUsedType }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 12
*/
usedType: PermissionUsedType;
}
/**
* Additional information to add.
*
* @interface AddPermissionUsedRecordOptions
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
interface AddPermissionUsedRecordOptions {
/**
* Used type of the permission accessed.
*
* @type { ?PermissionUsedType }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
usedType?: PermissionUsedType;
}
}
export default privacyManager;
export { Permissions };
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助