From 8cfdff5845337f6ed3f6ac92348857ebbc2d0623 Mon Sep 17 00:00:00 2001 From: chennian Date: Tue, 16 Aug 2022 16:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=9A=90=E7=A7=81=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=BD=BF=E7=94=A8=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:chennian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chennian --- api/@ohos.privacyManager.d.ts | 112 ++++++++++++++++++++++++++++++---- 1 file changed, 101 insertions(+), 11 deletions(-) diff --git a/api/@ohos.privacyManager.d.ts b/api/@ohos.privacyManager.d.ts index d5d0c94d9..e1ceb7834 100644 --- a/api/@ohos.privacyManager.d.ts +++ b/api/@ohos.privacyManager.d.ts @@ -13,21 +13,21 @@ * limitations under the License. */ -import {AsyncCallback} from './basic' +import {AsyncCallback, Callback} from './basic' /** * @syscap SystemCapability.Security.AccessToken */ declare namespace privacyManager { /** - * Add access record of sensitive permission. + * Adds access record of sensitive permission. * @param tokenID The tokenId of specified application. * @param permissionName The permission name to be added. * @param successCount Access count. * @param failCount Reject account. * @return Returns 0 if the method is called successfully, returns -1 otherwise. * @permission ohos.permission.PERMISSION_USED_STATS. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ function addPermissionUsedRecord(tokenID: number, permissionName: string, successCount: number, failCount: number): Promise; @@ -36,17 +36,107 @@ import {AsyncCallback} from './basic' /** * Queries the access records of sensitive permission. * @param request The request of permission used records. - * @return Return the reponse of permission used records. + * @return Return the response of permission used records. * @permission ohos.permission.PERMISSION_USED_STATS. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ function getPermissionUsedRecords(request: PermissionUsedRequest): Promise; function getPermissionUsedRecords(request: PermissionUsedRequest, callback: AsyncCallback): void; + /** + * Start using sensitive permission. + * @param tokenID The tokenId of specified application. + * @param permissionName The permission name to be started. + * @return Returns 0 if the method is called successfully, returns -1 otherwise. + * @permission ohos.permission.PERMISSION_USED_STATS. + * @systemapi + * @since 9 + */ + function startUsingPermission(tokenID: number, permissionName: string): Promise; + function startUsingPermission(tokenID: number, permissionName: string, callback: AsyncCallback): void; + + /** + * Stop using sensitive permission. + * @param tokenID The tokenId of specified application. + * @param permissionName The permission name to be stopped. + * @return Returns 0 if the method is called successfully, returns -1 otherwise. + * @permission ohos.permission.PERMISSION_USED_STATS. + * @systemapi + * @since 9 + */ + function stopUsingPermission(tokenID: number, permissionName: string): Promise; + function stopUsingPermission(tokenID: number, permissionName: string, callback: AsyncCallback): void; + + /** + * Subscribes to the change of active state of the specified permission. + * @param permissionNameLists Indicated the permission lists, which are specified. + * @permission ohos.permission.PERMISSION_USED_STATS. + * @systemapi + * @since 9 + */ + function on(type: 'activeStateChange', permissionNameList: Array, callback: Callback): void; + + /** + * Unsubscribes from . + * @param permissionNameLists Indicated the permission lists, which are specified. + * @permission ohos.permission.PERMISSION_USED_STATS. + * @systemapi + * @since 9 + */ + function off(type: 'activeStateChange', permissionNameList: Array, callback?: Callback): void; + + /** + * Enum for permission for status. + * @systemapi + * @since 9 + */ + enum PermissionActiveStatus { + /** + * permission is not used yet. + */ + PERM_INACTIVE = 0, + + /** + * permission is used in front_end. + */ + PERM_ACTIVE_IN_FOREGROUND = 1, + + /** + * permission is used in back_end. + */ + PERM_ACTIVE_IN_BACKGROUND = 2, + } + + /** + * Indicates the response of permission active status. + * @systemapi + * @since 9 + */ + interface ActiveChangeResponse { + /** + * AccessTokenID + */ + tokenId: number; + + /** + * The permission name + */ + permissionName: string; + + /** + * The device id + */ + deviceId: string; + /** + * The active status name + */ + activeStatus: PermissionActiveStatus; + } + /** * PermissionUsageFlag. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ enum PermissionUsageFlag { @@ -62,7 +152,7 @@ import {AsyncCallback} from './basic' /** * Provides request of querying permission used records. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ interface PermissionUsedRequest { @@ -109,7 +199,7 @@ import {AsyncCallback} from './basic' /** * Provides response of querying permission used records. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ interface PermissionUsedResponse { @@ -131,7 +221,7 @@ import {AsyncCallback} from './basic' /** * BundleUsedRecord. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ interface BundleUsedRecord { @@ -163,7 +253,7 @@ import {AsyncCallback} from './basic' /** * PermissionUsedRecord. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ interface PermissionUsedRecord { @@ -210,7 +300,7 @@ import {AsyncCallback} from './basic' /** * UsedRecordDetail. - * @systemapi hide this for inner system use + * @systemapi * @since 9 */ interface UsedRecordDetail {