harmony 鸿蒙Application Access Control Subsystem Changelog

  • 2023-10-30
  • 浏览 (307)

Application Access Control Subsystem Changelog

cl.access_token.1 Change of the Value Returned by getPermissionUsedRecord

Change Impact

Before the change, the permission access record returned by getPermissionUsedRecord includes the foreground and background status, access timestamp, and access duration.

After the change, the permission access record also includes lockScreenStatus, which is optional.

For details, see UsedRecordDetail.

Adaptation Guide

For details, see getPermissionUsedRecord.

For example, call getPermissionUsedRecord to obtain information about the permission usage and parse lockScreenStatus.

Sample code:

import privacyManager from '@ohos.privacyManager';

try {
    privacyManager.getPermissionUsedRecord({
        flag:1
    }, (err, data) => {
        try {
            let record = data.bundleRecords[0].permissionRecords[0];
            let access = record.accessRecords;
            let reject = record.rejectRecords;
            for (let i = 0; i < access.length; i++) {
                let detail = access[i];
                console.log(`access record detail lockscreen status: ` + detail.lockScreenStatus);
            }
            for (let i = 0; i < reject.length; i++) {
                let detail = reject[i];
                console.log(`reject record detail lockscreen status: ` + detail.lockScreenStatus);
            }
        } catch(err) {
            console.log(`catch err->${JSON.stringify(err)}`);
        }
    })
} catch(err) {
    console.log(`catch err->${JSON.stringify(err)}`);
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙1.0.0 (2022/03/09)

harmony 鸿蒙1.0.0 (2022/03/09)

harmony 鸿蒙OpenHarmony Docker镜像

harmony 鸿蒙OpenHarmony Docker Image

harmony 鸿蒙Legal Notices

harmony 鸿蒙OpenHarmony Project

harmony 鸿蒙IDL Specifications and User Guide (for System Applications Only)

harmony 鸿蒙Application Development

harmony 鸿蒙OAID Service

harmony 鸿蒙AI

0  赞