mirror of
https://gitee.com/openharmony/applications_permission_manager
synced 2024-11-23 11:19:46 +00:00
新增剪贴板权限
Signed-off-by: fanchenxuan <fanchenxuan@huawei.com>
This commit is contained in:
parent
2744407906
commit
ab241361e2
@ -41,7 +41,8 @@ export const permissionGroups: Array<PermissionInfo> = [
|
||||
new PermissionInfo("ohos.permission.APP_TRACKING_CONSENT", "ADS", $r('sys.string.ohos_lab_app_tracking_consent'), 11),
|
||||
new PermissionInfo("ohos.permission.GET_INSTALLED_BUNDLE_LIST", "GET_INSTALLED_BUNDLE_LIST", $r('sys.string.ohos_lab_get_installed_bundle_list'), 12),
|
||||
new PermissionInfo("ohos.permission.DISTRIBUTED_DATASYNC", "DISTRIBUTED_DATASYNC", $r("sys.string.ohos_lab_distributed_datasync"), 13),
|
||||
new PermissionInfo("ohos.permission.ACCESS_BLUETOOTH", "BLUETOOTH", $r('sys.string.ohos_lab_access_bluetooth'), 14)
|
||||
new PermissionInfo("ohos.permission.ACCESS_BLUETOOTH", "BLUETOOTH", $r('sys.string.ohos_lab_access_bluetooth'), 14),
|
||||
new PermissionInfo("ohos.permission.READ_PASTEBOARD", "PASTEBOARD", $r('sys.string.ohos_lab_read_pasteboard'), 15)
|
||||
]
|
||||
|
||||
export const groups: Array<GroupInfo> = [
|
||||
@ -59,7 +60,8 @@ export const groups: Array<GroupInfo> = [
|
||||
new GroupInfo("ADS", $r("app.string.groupName_ADS"), $r("app.string.group_label_ADS"), $r('app.media.track'), [], '', ["ohos.permission.APP_TRACKING_CONSENT"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_ADS"), $r("app.string.forbidden_description_ADS")),
|
||||
new GroupInfo("GET_INSTALLED_BUNDLE_LIST", $r('app.string.groupName_appList'), $r('app.string.group_label_appList'), $r('app.media.ic_public_app_list'), [], '', ["ohos.permission.GET_INSTALLED_BUNDLE_LIST"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_appList"), $r("app.string.forbidden_description_appList")),
|
||||
new GroupInfo("DISTRIBUTED_DATASYNC", $r('app.string.multi_device_collaboration'), $r('app.string.group_label_distributed_datasync'), $r('app.media.ic_multi_device_vector'), [], '', ["ohos.permission.DISTRIBUTED_DATASYNC"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_distributed_datasync"), $r("app.string.forbidden_description_distributed_datasync")),
|
||||
new GroupInfo("BLUETOOTH", $r('app.string.groupName_bluetooth'), $r('app.string.group_label_bluetooth'), $r('app.media.ic_public_bluetooth'), [], '', ["ohos.permission.ACCESS_BLUETOOTH"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_bluetooth"), $r("app.string.forbidden_description_bluetooth"))
|
||||
new GroupInfo("BLUETOOTH", $r('app.string.groupName_bluetooth'), $r('app.string.group_label_bluetooth'), $r('app.media.ic_public_bluetooth'), [], '', ["ohos.permission.ACCESS_BLUETOOTH"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_bluetooth"), $r("app.string.forbidden_description_bluetooth")),
|
||||
new GroupInfo("PASTEBOARD", $r('app.string.groupName_pasteboard'), $r('app.string.group_label_pasteboard'), $r('app.media.ic_clipboard'), [], '', ["ohos.permission.READ_PASTEBOARD"], false, $r("app.string.enable_description_start_default"), $r('app.string.enable_description_end_pasteboard'), $r('app.string.forbidden_description_pasteboard'))
|
||||
];
|
||||
|
||||
export const userGrantPermissions: string[] = [
|
||||
@ -88,7 +90,8 @@ export const userGrantPermissions: string[] = [
|
||||
"ohos.permission.APP_TRACKING_CONSENT",
|
||||
"ohos.permission.GET_INSTALLED_BUNDLE_LIST",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.ACCESS_BLUETOOTH"
|
||||
"ohos.permission.ACCESS_BLUETOOTH",
|
||||
"ohos.permission.READ_PASTEBOARD"
|
||||
];
|
||||
|
||||
export const showSubpermissionsGrop: string[] = [
|
||||
|
@ -204,6 +204,7 @@ export default class Constants {
|
||||
static APPLICATION_ALPHABETINDEX_MARGIN_TOP = 12;
|
||||
static APPLICATION_ALPHABETINDEX_WIDTH = 24;
|
||||
static LOADING_WIDTH = 100;
|
||||
static BAR_WIDTH = 250;
|
||||
|
||||
//group number
|
||||
static FIXED_GROUP = 1;
|
||||
@ -219,6 +220,11 @@ export default class Constants {
|
||||
static RADIO_ALLOW_INDEX = 0;
|
||||
static RADIO_BAN_INDEX = 1;
|
||||
|
||||
//Permission state
|
||||
static PERMISSION_ALLOW = 0;
|
||||
static PERMISSION_BAN = 1;
|
||||
static PERMISSION_ONLY_THIS_TIME = 2;
|
||||
|
||||
//shape
|
||||
static SHAPE_DIA = 20;
|
||||
|
||||
@ -238,6 +244,7 @@ export default class Constants {
|
||||
static PERMISSION_SYSTEM_FIXED = 4;
|
||||
static PERMISSION_COMPONENT_SET = 16;
|
||||
static PERMISSION_POLICY_FIXED = 32;
|
||||
static PERMISSION_ALLOW_THIS_TIME = 64;
|
||||
|
||||
static DEFAULT_DEVICE_TYPE = 'default'
|
||||
static PHONE_DEVICE_TYPE = 'phone'
|
||||
|
@ -112,12 +112,10 @@ export class CalendarObj {
|
||||
|
||||
export class MediaDocObj {
|
||||
name: Resource
|
||||
accessTokenId: number
|
||||
permissions: Array<Permissions>
|
||||
index: number
|
||||
constructor(name: Resource, accessTokenId: number, permissions: Array<Permissions>, index: number) {
|
||||
constructor(name: Resource, permissions: Array<Permissions>, index: number) {
|
||||
this.name = name
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permissions = permissions
|
||||
this.index = index
|
||||
}
|
||||
|
@ -27,11 +27,8 @@ import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
const PASTE = 'ohos.permission.READ_PASTEBOARD';
|
||||
let api: number = 0;
|
||||
let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now
|
||||
let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results
|
||||
let GrantResultFlag: number[] = []; // Authorization result Flag
|
||||
let RevokeResultFlag: number[] = []; // Cancel authorization result Flag
|
||||
let accessTokenId: number = 0;
|
||||
let reqPermissionInfo: bundleManager.ReqPermissionDetail;
|
||||
|
||||
@ -41,8 +38,9 @@ struct mediaDocumentPage {
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_3).backTitle;
|
||||
private permissions: Permissions[] = (router.getParams() as routerParams_3).permission;
|
||||
private tokenId: number = (router.getParams() as routerParams_3).tokenId;
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@State refresh: boolean = false;
|
||||
@State isCheckList: boolean[] = []; // Permission status array
|
||||
@State selected: number = 0; // Permission status array
|
||||
@State isRefreshReason: number = 0
|
||||
|
||||
build() {
|
||||
@ -58,7 +56,7 @@ struct mediaDocumentPage {
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
mediaDocumentItem({ isCheckList: $isCheckList, isRefreshReason: $isRefreshReason })
|
||||
mediaDocumentItem({ selected: $selected, isRefreshReason: $isRefreshReason })
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
}
|
||||
.margin({ top: Constants.TITLE_MARGIN_BOTTOM })
|
||||
@ -95,10 +93,19 @@ struct mediaDocumentPage {
|
||||
}
|
||||
console.log(TAG + 'isGranted: ' + JSON.stringify(isGranted));
|
||||
|
||||
if (isGranted) {
|
||||
this.isCheckList = [true, false];
|
||||
} else {
|
||||
this.isCheckList = [false, true];
|
||||
this.selected = isGranted ? Constants.PERMISSION_ALLOW : Constants.PERMISSION_BAN;
|
||||
if (this.currentGroup === 'PASTEBOARD') {
|
||||
try {
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
acManager.getPermissionFlags(this.tokenId, PASTE).then(flag => {
|
||||
if (flag == Constants.PERMISSION_ALLOW_THIS_TIME) {
|
||||
this.selected = Constants.PERMISSION_ONLY_THIS_TIME;
|
||||
}
|
||||
})
|
||||
}
|
||||
catch(err) {
|
||||
console.log(TAG + 'getPermissionFlags error: ' + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,7 +120,7 @@ struct mediaDocumentItem {
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@State applicationInfo: appInfo = GlobalContext.load('applicationInfo');
|
||||
@State mediaDocListItem: MediaDocObj[] = []; // Permission information array
|
||||
@Link isCheckList: boolean[]; // Permission status array
|
||||
@Link selected: number;
|
||||
@State accurateIsOn: boolean = true;
|
||||
@State api: number = 0;
|
||||
@State isRisk: boolean = false; // Whether it is a risky application
|
||||
@ -131,9 +138,7 @@ struct mediaDocumentItem {
|
||||
*/
|
||||
grantUserGrantedPermission(accessTokenId: number, permission: Permissions) {
|
||||
abilityAccessCtrl.createAtManager().grantUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG)
|
||||
.then(() => {
|
||||
nowGrantResult = Constants.PERMISSION_INDEX;
|
||||
})
|
||||
.then(() => {})
|
||||
.catch((error: BusinessError) => {
|
||||
console.error(TAG + 'grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
@ -144,11 +149,9 @@ struct mediaDocumentItem {
|
||||
* @param {Number} accessTokenId
|
||||
* @param {String} permission permission name
|
||||
*/
|
||||
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG)
|
||||
.then(() => {
|
||||
nowRevokeResult = Constants.PERMISSION_INDEX;
|
||||
})
|
||||
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions, flag: number) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(accessTokenId, permission, flag)
|
||||
.then(() => {})
|
||||
.catch((error: BusinessError) => {
|
||||
console.error(TAG + 'revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
@ -182,6 +185,18 @@ struct mediaDocumentItem {
|
||||
* Lifecycle function, executed when the page is initialized
|
||||
*/
|
||||
aboutToAppear() {
|
||||
this.selected = this.status ? Constants.PERMISSION_BAN : Constants.PERMISSION_ALLOW;
|
||||
if (this.currentGroup == 'PASTEBOARD') {
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.per_use_query'), this.permissions, Constants.PERMISSION_ONLY_THIS_TIME)
|
||||
);
|
||||
}
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj(this.currentGroup == 'PASTEBOARD' ? $r('app.string.always_allow') : $r('app.string.allow'), this.permissions, Constants.PERMISSION_ALLOW)
|
||||
);
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.ban'), this.permissions, Constants.PERMISSION_BAN)
|
||||
);
|
||||
this.label = this.applicationInfo.label;
|
||||
if (showSubpermissionsGrop.indexOf(this.currentGroup) != -1) {
|
||||
this.permissions.forEach((permission, idx) => {
|
||||
@ -226,27 +241,21 @@ struct mediaDocumentItem {
|
||||
} catch(err) {
|
||||
console.log(TAG + 'acManager.getPermissionFlags failed. Cause: ' + JSON.stringify(err));
|
||||
}
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.allow'), res.appInfo.accessTokenId, this.permissions, 0)
|
||||
);
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.ban'), res.appInfo.accessTokenId, this.permissions, 1)
|
||||
);
|
||||
if (this.currentGroup == 'PASTEBOARD') {
|
||||
try {
|
||||
acManager.getPermissionFlags(res.appInfo.accessTokenId, PASTE).then(flag => {
|
||||
if (flag == Constants.PERMISSION_ALLOW_THIS_TIME) {
|
||||
this.selected = Constants.PERMISSION_ONLY_THIS_TIME;
|
||||
}
|
||||
})
|
||||
}
|
||||
catch(err) {
|
||||
console.log(TAG + 'getPermissionFlags error: ' + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
}).catch((error: BusinessError) => {
|
||||
console.error(TAG + 'bundle.getBundleInfo failed. Cause: ' + JSON.stringify(error));
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.allow'), 0, this.permissions, 0)
|
||||
);
|
||||
this.mediaDocListItem.push(
|
||||
new MediaDocObj($r('app.string.ban'), 0, this.permissions, 1)
|
||||
);
|
||||
})
|
||||
// Get permission status
|
||||
if (!this.status) {
|
||||
this.isCheckList = [true, false];
|
||||
} else {
|
||||
this.isCheckList = [false, true];
|
||||
}
|
||||
}
|
||||
|
||||
build(){
|
||||
@ -352,7 +361,7 @@ struct mediaDocumentItem {
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.flexGrow(Constants.FLEX_GROW)
|
||||
Radio({ value: 'Radio', group: 'radioGroup' })
|
||||
.checked(this.isCheckList[item.index])
|
||||
.checked(item.index === this.selected)
|
||||
.touchable(false)
|
||||
.height(Constants.SHAPE_DIA)
|
||||
.width(Constants.SHAPE_DIA)
|
||||
@ -360,45 +369,27 @@ struct mediaDocumentItem {
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.LISTITEM_ROW_HEIGHT)
|
||||
.onClick(() => {
|
||||
let index = item.index;
|
||||
this.selected = item.index;
|
||||
item.permissions.forEach((permission): boolean => {
|
||||
if (!index) {
|
||||
if (item.index === Constants.PERMISSION_ALLOW) {
|
||||
if ((this.api >= Constants.API_VERSION_SUPPORT_STAGE) && (permission == PRECISE_LOCATION_PERMISSION)) {
|
||||
return false;
|
||||
}
|
||||
this.grantUserGrantedPermission(item.accessTokenId, permission);
|
||||
if (nowGrantResult != Constants.PERMISSION_INDEX) {
|
||||
GrantResultFlag.push(-1);
|
||||
} else {
|
||||
GrantResultFlag.push(0);
|
||||
}
|
||||
} else {
|
||||
this.grantUserGrantedPermission(accessTokenId, permission);
|
||||
} else if (item.index === Constants.PERMISSION_BAN) {
|
||||
if ((permission == PRECISE_LOCATION_PERMISSION) && (this.api >= Constants.API_VERSION_SUPPORT_STAGE)) {
|
||||
if (this.accurateIsOn) {
|
||||
this.revokeUserGrantedPermission(item.accessTokenId, permission);
|
||||
this.revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG);
|
||||
this.accurateIsOn = false;
|
||||
}
|
||||
} else {
|
||||
this.revokeUserGrantedPermission(item.accessTokenId, permission);
|
||||
this.revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG);
|
||||
}
|
||||
|
||||
if (nowRevokeResult != Constants.PERMISSION_INDEX) {
|
||||
RevokeResultFlag.push(-1);
|
||||
} else {
|
||||
RevokeResultFlag.push(0);
|
||||
}
|
||||
this.revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_ALLOW_THIS_TIME);
|
||||
}
|
||||
return true;
|
||||
})
|
||||
if (!index) {
|
||||
if (GrantResultFlag.indexOf(-1) <= -1) {
|
||||
this.isCheckList = [true, false];
|
||||
}
|
||||
} else {
|
||||
if (RevokeResultFlag.indexOf(-1) <= -1) {
|
||||
this.isCheckList = [false, true];
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -461,7 +452,7 @@ struct mediaDocumentItem {
|
||||
}
|
||||
})
|
||||
.padding({ right: 0 })
|
||||
.enabled(this.isCheckList[0])
|
||||
.enabled(this.selected === Constants.PERMISSION_ALLOW)
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.LISTITEM_ROW_HEIGHT)
|
||||
}.margin({ top: Constants.LOCATION_MARGIN_TOP, bottom: Constants.LOCATION_MARGIN_BOTTOM })
|
||||
|
@ -506,6 +506,7 @@ struct authorityManagementPage {
|
||||
}.tabBar(this.TabBuilder(1))
|
||||
}
|
||||
.barMode(BarMode.Fixed)
|
||||
.barWidth(Constants.BAR_WIDTH)
|
||||
.onChange((index) => {
|
||||
this.currentIndex = index
|
||||
})
|
||||
|
@ -20,12 +20,13 @@ import window from '@ohos.window';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import pasteboard from '@ohos.pasteboard';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { Log, getPermissionGroup, titleTrim, getPermissionLabel } from '../common/utils/utils';
|
||||
import { GroupInfo, wantInfo } from '../common/utils/typedef';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
import Constants from '../common/utils/constant';
|
||||
import { showSubpermissionsGrop } from '../common/model/permissionGroup';
|
||||
import { showSubpermissionsGrop, userGrantPermissions } from '../common/model/permissionGroup';
|
||||
import { LocationCanvas } from '../common/components/location';
|
||||
|
||||
@Extend(Button) function customizeButton() {
|
||||
@ -39,6 +40,7 @@ import { LocationCanvas } from '../common/components/location';
|
||||
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
const PASTE = 'ohos.permission.READ_PASTEBOARD';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
let win: window.Window;
|
||||
@ -89,6 +91,7 @@ struct PermissionDialog {
|
||||
@State reqPermissionDetails: bundleManager.ReqPermissionDetail[] = [];
|
||||
@State naviHeight: number = 0
|
||||
@State refresh: number = 0;
|
||||
@State pasteBoardName: string = '';
|
||||
@Link @Watch('updateReason') isUpdate: number;
|
||||
controller?: CustomDialogController
|
||||
|
||||
@ -141,8 +144,17 @@ struct PermissionDialog {
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.Start }) {
|
||||
Text() {
|
||||
if (this.showReason()) {
|
||||
if (this.currentGroup() === 'LOCATION') {
|
||||
Span($r('app.string.close_exact_position'))
|
||||
} else if (this.currentGroup() === 'PASTEBOARD') {
|
||||
if (this.pasteBoardName) {
|
||||
Span($r('app.string.pasteBoard_start'))
|
||||
Span(this.pasteBoardName)
|
||||
Span($r('app.string.pasteBoard_end'))
|
||||
Span($r('app.string.pasteBoard_desc'))
|
||||
} else {
|
||||
Span($r('app.string.pasteBoard_desc'))
|
||||
}
|
||||
} else {
|
||||
if (this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].description.length > 0) {
|
||||
ForEach(this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].description, (item: ResourceStr) => {
|
||||
@ -182,9 +194,9 @@ struct PermissionDialog {
|
||||
.vertical(true)
|
||||
.height(Constants.DIVIDER_HEIGHT)
|
||||
.opacity(.2)
|
||||
Button($r('app.string.ALLOW'))
|
||||
Button(this.currentGroup() === 'PASTEBOARD'? $r('app.string.THIS_TIME_ONLY') : $r('app.string.ALLOW'))
|
||||
.onClick(() => {
|
||||
this.privacyAccept(this.grantGroups[this.count], this.accessTokenId, this.reqPerms, this.userFixedFlag)
|
||||
this.privacyAccept(this.grantGroups[this.count], this.accessTokenId, this.reqPerms, this.currentGroup() === 'PASTEBOARD' ? Constants.PERMISSION_ALLOW_THIS_TIME : this.userFixedFlag)
|
||||
}).customizeButton()
|
||||
}.margin({ left: Constants.BUTTON_MARGIN_LEFT, right: Constants.BUTTON_MARGIN_RIGHT })
|
||||
}
|
||||
@ -217,14 +229,17 @@ struct PermissionDialog {
|
||||
return this.grantGroups[index].label;
|
||||
}
|
||||
|
||||
showReason() {
|
||||
currentGroup() {
|
||||
let index = this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count;
|
||||
if (this.grantGroups[index].name == 'LOCATION') {
|
||||
if ((this.locationFlag == Constants.LOCATION_FUZZY) || (this.locationFlag == Constants.LOCATION_BOTH_FUZZY)) {
|
||||
return true;
|
||||
return 'LOCATION';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (this.grantGroups[index].name == 'PASTEBOARD') {
|
||||
return 'PASTEBOARD';
|
||||
}
|
||||
return 'Normal';
|
||||
}
|
||||
|
||||
punctuation() {
|
||||
@ -394,7 +409,7 @@ struct PermissionDialog {
|
||||
//待授权
|
||||
} else if (stateGroup[idx] == Constants.DYNAMIC_OPER) {
|
||||
let group = getPermissionGroup(permission);
|
||||
if (!group) {
|
||||
if (!userGrantPermissions.includes(permission)) {
|
||||
Log.info("permission not find:" + permission);
|
||||
} else {
|
||||
let exist = this.grantGroups.find(grantGroup => grantGroup.name == group.name);
|
||||
@ -489,6 +504,13 @@ struct PermissionDialog {
|
||||
};
|
||||
}
|
||||
|
||||
getPasteBoardInfo() {
|
||||
if (this.reqPerms.includes(PASTE)) {
|
||||
let systemPasteboard: pasteboard.SystemPasteboard = pasteboard.getSystemPasteboard();
|
||||
this.pasteBoardName = systemPasteboard.getDataSource();
|
||||
}
|
||||
}
|
||||
|
||||
updateReason() {
|
||||
if (this.isUpdate > 0) {
|
||||
this.getApplicationName(want.parameters['ohos.aafwk.param.callerBundleName'])
|
||||
@ -511,6 +533,7 @@ struct PermissionDialog {
|
||||
this.result = new Array(this.reqPerms.length).fill(-1);
|
||||
this.getAvoidWindow();
|
||||
this.getPopupPosition();
|
||||
this.getPasteBoardInfo();
|
||||
let bundleName: string = want.parameters['ohos.aafwk.param.callerBundleName'];
|
||||
bundleManager.getBundleInfo(bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(bundleInfo => {
|
||||
this.targetVersion = bundleInfo.targetVersion;
|
||||
|
@ -377,6 +377,7 @@ struct permissionRecordPage {
|
||||
}.tabBar(this.TabBuilder(1))
|
||||
}
|
||||
.barMode(BarMode.Fixed)
|
||||
.barWidth(Constants.BAR_WIDTH)
|
||||
.onChange((index) => {
|
||||
this.currentIndex = index;
|
||||
if (!this.show) this.show = true;
|
||||
@ -566,11 +567,11 @@ struct permissionRecordPage {
|
||||
flag: 1
|
||||
}
|
||||
privacyManager.getPermissionUsedRecord(request).then(async records => {
|
||||
console.info(TAG + "records: " + JSON.stringify(records.bundleRecords));
|
||||
let groupArray: GroupRecordInfo[] = [];
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
for (let i = 0; i < records.bundleRecords.length; i++) {
|
||||
let record = records.bundleRecords[i];
|
||||
console.info(TAG + "bundleName: " + record.bundleName + " permissionRecords: " + JSON.stringify(record.permissionRecords));
|
||||
try {
|
||||
await bundleManager.queryAbilityInfo({
|
||||
bundleName: record.bundleName,
|
||||
@ -580,7 +581,6 @@ struct permissionRecordPage {
|
||||
} catch(e) {
|
||||
continue;
|
||||
}
|
||||
console.info(TAG + "record: " + JSON.stringify(record));
|
||||
this.getInfo(record, (i + 1) == records.bundleRecords.length);
|
||||
|
||||
for (let j = 0; j < record.permissionRecords.length; j++) {
|
||||
|
@ -116,6 +116,14 @@
|
||||
"name": "ban",
|
||||
"value": "Ban"
|
||||
},
|
||||
{
|
||||
"name": "always_allow",
|
||||
"value": "Always allow"
|
||||
},
|
||||
{
|
||||
"name": "per_use_query",
|
||||
"value": "Per-use query"
|
||||
},
|
||||
{
|
||||
"name": "ALLOW",
|
||||
"value": "ALLOW"
|
||||
@ -124,6 +132,10 @@
|
||||
"name": "BAN",
|
||||
"value": "BAN"
|
||||
},
|
||||
{
|
||||
"name": "THIS_TIME_ONLY",
|
||||
"value": "THIS TIME ONLY"
|
||||
},
|
||||
{
|
||||
"name": "precise_location",
|
||||
"value": "Precise location"
|
||||
@ -228,6 +240,18 @@
|
||||
"name": "close_camera_desc",
|
||||
"value": "After it is turned off, all apps will not be able to use the camera properly to take photos, videos or perform face recognition. To restore data, turn on the camera switch."
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_start",
|
||||
"value": "Content copied from \""
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_end",
|
||||
"value": "\". "
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_desc",
|
||||
"value": "Disabling will no longer allow this app to access the clipboard."
|
||||
},
|
||||
{
|
||||
"name": "groupName_location",
|
||||
"value": "Location information"
|
||||
@ -288,6 +312,10 @@
|
||||
"name": "groupName_bluetooth",
|
||||
"value": "Bluetooth"
|
||||
},
|
||||
{
|
||||
"name": "groupName_pasteboard",
|
||||
"value": "Pasteboard"
|
||||
},
|
||||
{
|
||||
"name": "multi_device_collaboration",
|
||||
"value": "Multi-device collaboration"
|
||||
@ -364,6 +392,10 @@
|
||||
"name": "group_label_bluetooth",
|
||||
"value": " access Bluetooth?"
|
||||
},
|
||||
{
|
||||
"name": "group_label_pasteboard",
|
||||
"value": " access Pasteboard?"
|
||||
},
|
||||
{
|
||||
"name": "enable_description_start_default",
|
||||
"value": " "
|
||||
@ -444,6 +476,10 @@
|
||||
"name": "enable_description_end_bluetooth",
|
||||
"value": " apps have been allowed to use Bluetooth to find and connect to nearby devices."
|
||||
},
|
||||
{
|
||||
"name": "enable_description_end_pasteboard",
|
||||
"value": " apps have been allowed to read and write clipboard information without using the system clipboard control. It is recommended to use apps that use system clipboard controls that only temporarily access the clipboard when you click to reduce the risk of private data being accessed."
|
||||
},
|
||||
{
|
||||
"name": "forbidden_description_location",
|
||||
"value": "When the system positioning service is enabled, applications are not allowed to obtain the location of the device."
|
||||
@ -516,6 +552,10 @@
|
||||
"name": "forbidden_description_bluetooth",
|
||||
"value": "Applications are prohibited from using Bluetooth to find or connect to nearby devices."
|
||||
},
|
||||
{
|
||||
"name": "forbidden_description_pasteboard",
|
||||
"value": "Applications are prohibited from reading or writing clipboard information without using the system clipboard control. It is recommended to use apps that use system clipboard controls that only temporarily access the clipboard when you click to reduce the risk of private data being accessed."
|
||||
},
|
||||
{
|
||||
"name": "risk_warning",
|
||||
"value": "Risk application does not obtain this permission"
|
||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.2 KiB |
@ -116,6 +116,14 @@
|
||||
"name": "ban",
|
||||
"value": "禁止"
|
||||
},
|
||||
{
|
||||
"name": "always_allow",
|
||||
"value": "始终允许"
|
||||
},
|
||||
{
|
||||
"name": "per_use_query",
|
||||
"value": "每次使用询问"
|
||||
},
|
||||
{
|
||||
"name": "ALLOW",
|
||||
"value": "允许"
|
||||
@ -124,6 +132,10 @@
|
||||
"name": "BAN",
|
||||
"value": "禁止"
|
||||
},
|
||||
{
|
||||
"name": "THIS_TIME_ONLY",
|
||||
"value": "仅本次允许"
|
||||
},
|
||||
{
|
||||
"name": "precise_location",
|
||||
"value": "精确位置"
|
||||
@ -228,6 +240,18 @@
|
||||
"name": "close_camera_desc",
|
||||
"value": "关闭后,所有应用服务都将无法正常使用摄像头拍摄照片、视频或进行人脸识别。若需恢复,请打开摄像头开关。"
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_start",
|
||||
"value": "内容复制自“"
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_end",
|
||||
"value": "”。"
|
||||
},
|
||||
{
|
||||
"name": "pasteBoard_desc",
|
||||
"value": "禁止后将不再允许此应用访问剪贴板。"
|
||||
},
|
||||
{
|
||||
"name": "groupName_location",
|
||||
"value": "位置信息"
|
||||
@ -288,6 +312,10 @@
|
||||
"name": "groupName_bluetooth",
|
||||
"value": "蓝牙"
|
||||
},
|
||||
{
|
||||
"name": "groupName_pasteboard",
|
||||
"value": "剪贴板"
|
||||
},
|
||||
{
|
||||
"name": "multi_device_collaboration",
|
||||
"value": "多设备协同"
|
||||
@ -364,6 +392,10 @@
|
||||
"name": "group_label_bluetooth",
|
||||
"value": "访问蓝牙?"
|
||||
},
|
||||
{
|
||||
"name": "group_label_pasteboard",
|
||||
"value": "访问剪贴板?"
|
||||
},
|
||||
{
|
||||
"name": "enable_description_start_default",
|
||||
"value": "已允许"
|
||||
@ -444,6 +476,10 @@
|
||||
"name": "enable_description_end_bluetooth",
|
||||
"value": "个应用使用蓝牙查找、连接附近设备。"
|
||||
},
|
||||
{
|
||||
"name": "enable_description_end_pasteboard",
|
||||
"value": "个应用不通过系统剪贴控件读写剪贴板信息。推荐使用采用系统剪贴控件的应用,仅在您点击时临时访问剪贴板,以减少隐私数据被获取的风险。"
|
||||
},
|
||||
{
|
||||
"name": "forbidden_description_location",
|
||||
"value": "系统定位服务开关开启时,已禁止应用获取此设备的位置。"
|
||||
@ -516,6 +552,10 @@
|
||||
"name": "forbidden_description_bluetooth",
|
||||
"value": "已禁止应用使用蓝牙查找、连接附近设备。"
|
||||
},
|
||||
{
|
||||
"name": "forbidden_description_pasteboard",
|
||||
"value": "已禁止应用不通过系统剪贴控件读写剪贴板信息。推荐使用采用系统剪贴控件的应用,仅在您点击时临时访问剪贴板,以减少隐私数据被获取的风险。"
|
||||
},
|
||||
{
|
||||
"name": "risk_warning",
|
||||
"value": "风险应用禁止获取该权限"
|
||||
|
Loading…
Reference in New Issue
Block a user