applications_permission_manager:基于 OpenHarmony 的权限管理系统应用项目

用户可通过该项目管理 OpenHarmony 应用权限,包括运行时权限弹框交互、权限设置管理及使用记录展示,核心功能基于 ETS 构建,支持权限请求与调试日志抓取。【此简介由AI生成】

Branch3Tags0
FilesLast commitLast update
2 years ago
2 years ago
3 years ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
2 years ago
4 years ago
2 years ago
3 years ago
3 years ago
1 year ago
3 years ago
2 years ago
1 year ago
1 year ago
2 years ago

PermissionManager

Introduction

PermissionManager, a system application preset in OpenHarmony, provides permission dialog boxes, permission management settings, and permission usage records during the running of apps.

The following figure shows the architecture of the PermissionManager application.

Directory Structure

/applications/standard/permission_manager
├── entry                              # Directory of the entry module
├── permissionmanager                  # Directory of the PermissionManager module
│   ├── src/main/ets                   # ets module
│   │       ├── Application            # abilitystage directory
│   │       ├── MainAbility            # Permission management ability
│   │       ├── ServiceExtAbility      # serviceExtension configuration
│   │       ├── common                 # Common utilities
│   │       └── pages                  # Pages
│   ├──  resources                     # Global resource files
│   └──  module.json5                  # Global configuration file
├── signature                          # Certificate files
└── LICENSE                            # License file

Installation, operation and commissioning

Application installation

  • There are two files that need to change the suffix to json5
/AppScope/app.json
/permissionmanager/src/main/module.json
  • Uninstall preset rights management for the first installation
hdc shell mount -o remount,rw /
hdc shell rm -rf /system/app/com.ohos.permissionmanager
hdc shell rm -rf /data/*
hdc shell reboot
  • Install the signed hap package
hdc install Packet path

Application running

import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
try {
    atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA'], (err, data)=>{
        console.info('data:' + JSON.stringify(data));
        console.info('data permissions:' + data.permissions);
        console.info('data authResults:' + data.authResults);
    });
} catch(err) {
    console.log(`catch err->${JSON.stringify(err)}`);
}
  • Permission manager

Settings-Privacy-Permission Manager

Application debugging

  • Add log to the program
const TAG = "PermissionManager_Log"
console.info(TAG + `log`);
  • Grab log:
hdc shell hilog -Q pidoff
hdc shell -b D
hdc shell hilog -r && hdc hilog > log.txt

How to Use

For details, see Permission Application Guide.

Repositories Involved

security_access_token

Introduction

用户可通过该项目管理 OpenHarmony 应用权限,包括运行时权限弹框交互、权限设置管理及使用记录展示,核心功能基于 ETS 构建,支持权限请求与调试日志抓取。【此简介由AI生成】

Customize your domain