Go to file
fanchenxuan 3d0c69ca45 预制应用信息公示方案说明
Signed-off-by: fanchenxuan <fanchenxuan@huawei.com>
2024-06-27 14:49:52 +08:00
AppScope 安全控件彈窗替換新控件 2024-06-04 18:04:12 +08:00
entry 告警修改 2024-03-28 18:10:07 +08:00
figures update docs 2022-12-19 11:05:40 +08:00
hvigor 适配修复流水线概率性构建失败 2024-03-15 10:09:55 +08:00
permissionmanager 预制应用信息公示方案说明 2024-06-27 14:49:52 +08:00
signature 安全隐私中心接入 2024-03-15 14:21:08 +08:00
.gitignore 切换ohpm 2023-07-28 17:28:39 +08:00
build-profile.json5 安全控件彈窗替換新控件 2024-06-04 18:04:12 +08:00
bundle.json Add bundle.json 2023-08-01 22:44:24 +08:00
hvigorfile.js codecheck 2023-12-12 15:04:09 +08:00
hvigorw 切换ohpm 2023-07-28 17:28:39 +08:00
LICENSE test 2022-08-30 09:17:44 +08:00
OAT.xml OAT告警 2024-05-22 16:43:27 +08:00
oh-package-lock.json5 切换ohpm 2023-07-28 17:28:39 +08:00
oh-package.json5 切换ohpm 2023-07-28 17:28:39 +08:00
publicity.xml 预制应用信息公示方案说明 2024-06-27 14:49:52 +08:00
README_zh.md Readme更新 2023-06-05 17:16:01 +08:00
README.md Readme更新 2023-06-05 17:16:01 +08:00

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