mirror of
https://gitee.com/openharmony/applications_permission_manager
synced 2024-11-23 11:19:46 +00:00
arkts整改
Signed-off-by: fanchenxuan <fanchenxuan@huawei.com>
This commit is contained in:
parent
2295152273
commit
75062ce46f
@ -4,8 +4,8 @@
|
||||
"app": {
|
||||
"bundleName": "com.ohos.permissionmanager",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000022,
|
||||
"versionName": "1.2.2",
|
||||
"versionCode": 1000030,
|
||||
"versionName": "1.3.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"minAPIVersion": 10,
|
||||
|
@ -16,11 +16,10 @@
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
const TAG = 'PermissionManager_Log:';
|
||||
const BG_COLOR = '#00000000';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
export default class GlobalExtensionAbility extends extension {
|
||||
/**
|
||||
@ -28,11 +27,10 @@ export default class GlobalExtensionAbility extends extension {
|
||||
*/
|
||||
onCreate(want): void {
|
||||
console.info(TAG + 'ServiceExtensionAbility onCreate, ability name is ' + want.abilityName);
|
||||
|
||||
globalThis.globalContext = this.context;
|
||||
globalThis.globalState = want.parameters['ohos.sensitive.resource'];
|
||||
console.info(TAG + 'want: ' + JSON.stringify(want));
|
||||
|
||||
GlobalContext.store('globalState', want.parameters['ohos.sensitive.resource']);
|
||||
|
||||
try {
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
let navigationBarRect = {
|
||||
@ -41,8 +39,6 @@ export default class GlobalExtensionAbility extends extension {
|
||||
width: dis.width,
|
||||
height: dis.height
|
||||
};
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
globalThis.isBottomPopover = bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical;
|
||||
this.createWindow('globalDialog', window.WindowType.TYPE_KEYGUARD, navigationBarRect);
|
||||
} catch (exception) {
|
||||
console.error(TAG + 'Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
@ -61,14 +57,15 @@ export default class GlobalExtensionAbility extends extension {
|
||||
*/
|
||||
onDestroy(): void {
|
||||
console.info(TAG + 'ServiceExtensionAbility onDestroy.');
|
||||
globalThis.globalWin.destroy();
|
||||
let win = GlobalContext.load('globalWin');
|
||||
win.destroyWindow();
|
||||
}
|
||||
|
||||
private async createWindow(name: string, windowType: number, rect): Promise<void> {
|
||||
console.info(TAG + 'create window');
|
||||
try {
|
||||
const win = await window.createWindow({ ctx: globalThis.globalContext, name, windowType });
|
||||
globalThis.globalWin = win;
|
||||
const win = await window.createWindow({ ctx: this.context, name, windowType });
|
||||
GlobalContext.store('globalWin', win);
|
||||
await win.moveWindowTo(rect.left, rect.top);
|
||||
await win.resize(rect.width, rect.height);
|
||||
await win.setUIContent('pages/globalSwitch');
|
||||
|
@ -15,16 +15,14 @@
|
||||
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const USER_ID = 100;
|
||||
|
||||
export default class MainAbility extends UIAbility {
|
||||
onCreate(want, launchParam): void {
|
||||
console.log(TAG + 'MainAbility onCreate, ability name is ' + want.abilityName + '.');
|
||||
globalThis.context = this.context;
|
||||
globalThis.allBundleInfo = [];
|
||||
globalThis.allUserPermissions = [];
|
||||
globalThis.allGroups = [];
|
||||
globalThis.initialGroups = [];
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage): void {
|
||||
@ -32,31 +30,43 @@ export default class MainAbility extends UIAbility {
|
||||
console.log(TAG + 'MainAbility onWindowStageCreate.');
|
||||
|
||||
const flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
|
||||
bundleManager.getAllBundleInfo(flag).then(async(bundleInfos) => {
|
||||
if (bundleInfos.length <= 0) {
|
||||
console.info(TAG + 'bundle.getAllBundleInfo result.length less than or equal to zero');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < bundleInfos.length; i++) {
|
||||
let info = bundleInfos[i];
|
||||
// Filter blank icon icon and text label resources
|
||||
try {
|
||||
await bundleManager.queryAbilityInfo({
|
||||
bundleName: info.name,
|
||||
action: 'action.system.home',
|
||||
entities: ['entity.system.home']
|
||||
}, bundleManager.AbilityFlag.GET_ABILITY_INFO_WITH_APPLICATION);
|
||||
} catch (error) {
|
||||
console.log(TAG + 'queryAbilityByWant catch error: ' + JSON.stringify(info.name));
|
||||
continue;
|
||||
}
|
||||
let accountManager = account_osAccount.getAccountManager();
|
||||
try {
|
||||
accountManager.getActivatedOsAccountLocalIds((err, idArray: number[])=>{
|
||||
console.log(TAG + 'getActivatedOsAccountLocalIds err:' + JSON.stringify(err));
|
||||
console.log(TAG + 'getActivatedOsAccountLocalIds idArray: ' + JSON.stringify(idArray));
|
||||
let userId = idArray[0];
|
||||
bundleManager.getAllBundleInfo(flag, userId || USER_ID).then(async(bundleInfos) => {
|
||||
if (bundleInfos.length <= 0) {
|
||||
console.info(TAG + 'bundle.getAllBundleInfo result.length less than or equal to zero');
|
||||
return;
|
||||
}
|
||||
let initialGroups = [];
|
||||
for (let i = 0; i < bundleInfos.length; i++) {
|
||||
let info = bundleInfos[i];
|
||||
// Filter blank icon icon and text label resources
|
||||
try {
|
||||
await bundleManager.queryAbilityInfo({
|
||||
bundleName: info.name,
|
||||
action: 'action.system.home',
|
||||
entities: ['entity.system.home']
|
||||
}, bundleManager.AbilityFlag.GET_ABILITY_INFO_WITH_APPLICATION);
|
||||
} catch (error) {
|
||||
console.error(TAG + 'queryAbilityByWant catch app: ' + JSON.stringify(info.name) + 'err: ' + JSON.stringify(error));
|
||||
continue;
|
||||
}
|
||||
|
||||
globalThis.initialGroups.push(info);
|
||||
}
|
||||
windowStage.setUIContent(this.context, 'pages/authority-management', null);
|
||||
}).catch((error) => {
|
||||
console.error(TAG + 'bundle.getAllBundleInfo failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
initialGroups.push(info);
|
||||
}
|
||||
let storage: LocalStorage = new LocalStorage({ 'initialGroups': initialGroups });
|
||||
windowStage.loadContent('pages/authority-management', storage);
|
||||
}).catch((error) => {
|
||||
console.error(TAG + 'bundle.getAllBundleInfo failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(TAG + 'getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
|
||||
}
|
||||
}
|
||||
|
||||
onForeground(): void {
|
||||
|
@ -16,11 +16,9 @@
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
|
||||
const TAG = 'PermissionManager_Log:';
|
||||
const BG_COLOR = '#00000000';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
export default class SecurityExtensionAbility extends extension {
|
||||
/**
|
||||
@ -28,9 +26,6 @@ export default class SecurityExtensionAbility extends extension {
|
||||
*/
|
||||
onCreate(want): void {
|
||||
console.info(TAG + 'SecurityExtensionAbility onCreate, ability name is ' + want.abilityName);
|
||||
|
||||
globalThis.securityContext = this.context;
|
||||
globalThis.windowNum = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,8 +43,6 @@ export default class SecurityExtensionAbility extends extension {
|
||||
width: dis.width,
|
||||
height: dis.height
|
||||
};
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
globalThis.isBottomPopover = (bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical) ? true : false;
|
||||
this.createWindow('SecurityDialog' + startId, window.WindowType.TYPE_DIALOG, navigationBarRect, want);
|
||||
} catch (exception) {
|
||||
console.error(TAG + 'Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
@ -66,17 +59,11 @@ export default class SecurityExtensionAbility extends extension {
|
||||
private async createWindow(name: string, windowType, rect, want): Promise<void> {
|
||||
console.info(TAG + 'create securitywindow');
|
||||
try {
|
||||
const win = await window.createWindow({ ctx: globalThis.securityContext, name, windowType });
|
||||
let storage: LocalStorage = new LocalStorage({
|
||||
'want': want,
|
||||
'win': win
|
||||
});
|
||||
const win = await window.createWindow({ ctx: this.context, name, windowType });
|
||||
let storage: LocalStorage = new LocalStorage({ 'want': want, 'win': win });
|
||||
await win.bindDialogTarget(want.parameters['ohos.ability.params.token'].value, () => {
|
||||
win.destroyWindow();
|
||||
globalThis.windowNum --;
|
||||
if (globalThis.windowNum === 0) {
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
this.context.terminateSelf();
|
||||
});
|
||||
await win.moveWindowTo(rect.left, rect.top);
|
||||
await win.resize(rect.width, rect.height);
|
||||
@ -84,7 +71,6 @@ export default class SecurityExtensionAbility extends extension {
|
||||
await win.setWindowBackgroundColor(BG_COLOR);
|
||||
await win.showWindow();
|
||||
await win.setWindowLayoutFullScreen(true);
|
||||
globalThis.windowNum ++;
|
||||
} catch {
|
||||
console.info(TAG + 'window create failed!');
|
||||
}
|
||||
|
@ -16,11 +16,10 @@
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
const TAG = 'PermissionManager_Log: ';
|
||||
const BG_COLOR = '#00000000';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
export default class ServiceExtensionAbility extends extension {
|
||||
/**
|
||||
@ -29,7 +28,6 @@ export default class ServiceExtensionAbility extends extension {
|
||||
onCreate(want): void {
|
||||
console.info(TAG + 'ServiceExtensionAbility onCreate, ability name is ' + want.abilityName);
|
||||
|
||||
globalThis.extensionContext = this.context;
|
||||
globalThis.windowNum = 0;
|
||||
}
|
||||
|
||||
@ -48,8 +46,6 @@ export default class ServiceExtensionAbility extends extension {
|
||||
width: dis.width,
|
||||
height: dis.height
|
||||
};
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
globalThis.isBottomPopover = (bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical) ? true : false;
|
||||
this.createWindow('permissionDialog' + startId, window.WindowType.TYPE_DIALOG, navigationBarRect, want);
|
||||
} catch (exception) {
|
||||
console.error(TAG + 'Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
@ -66,15 +62,14 @@ export default class ServiceExtensionAbility extends extension {
|
||||
private async createWindow(name: string, windowType, rect, want): Promise<void> {
|
||||
console.info(TAG + 'create window');
|
||||
try {
|
||||
const win = await window.createWindow({ ctx: globalThis.extensionContext, name, windowType });
|
||||
let storage: LocalStorage = new LocalStorage({
|
||||
'want': want,
|
||||
'win': win
|
||||
});
|
||||
const win = await window.createWindow({ ctx: this.context, name, windowType });
|
||||
let storage: LocalStorage = new LocalStorage({ 'want': want, 'win': win });
|
||||
await win.bindDialogTarget(want.parameters['ohos.ability.params.token'].value, () => {
|
||||
let windowNum = GlobalContext.load('windowNum');
|
||||
windowNum --;
|
||||
GlobalContext.store('windowNum', windowNum);
|
||||
win.destroyWindow();
|
||||
globalThis.windowNum --;
|
||||
if (globalThis.windowNum === 0) {
|
||||
if (windowNum === 0) {
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
});
|
||||
@ -85,6 +80,7 @@ export default class ServiceExtensionAbility extends extension {
|
||||
await win.showWindow();
|
||||
await win.setWindowLayoutFullScreen(true);
|
||||
globalThis.windowNum ++;
|
||||
GlobalContext.store('windowNum', globalThis.windowNum);
|
||||
} catch {
|
||||
console.info(TAG + 'window create failed!');
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import bundle from '@ohos.bundle.bundleManager';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
export default class SpecificAbility extends UIAbility {
|
||||
onCreate(want, launchParam): void {
|
||||
globalThis.context = this.context;
|
||||
onCreate(want): void {
|
||||
globalThis.bundleName = want.parameters.bundleName;
|
||||
globalThis.applicationInfo = {};
|
||||
GlobalContext.store('bundleName', want.parameters.bundleName);
|
||||
}
|
||||
|
||||
onDestroy(): void {}
|
||||
@ -19,18 +19,22 @@ export default class SpecificAbility extends UIAbility {
|
||||
bundleInfo.reqPermissionDetails.forEach(item => {
|
||||
reqPermissions.push(item.name);
|
||||
});
|
||||
|
||||
let info = {
|
||||
'bundleName': bundleInfo.name,
|
||||
'api': bundleInfo.targetVersion,
|
||||
'tokenId': bundleInfo.appInfo.accessTokenId,
|
||||
'icon': '',
|
||||
'iconId': bundleInfo.appInfo.iconResource.id ? bundleInfo.appInfo.iconResource : bundleInfo.appInfo.iconId,
|
||||
'iconId': bundleInfo.appInfo.iconId,
|
||||
'label': '',
|
||||
'labelId': bundleInfo.appInfo.labelResource.id ? bundleInfo.appInfo.labelResource : bundleInfo.appInfo.labelId,
|
||||
'labelId': bundleInfo.appInfo.labelId,
|
||||
'permissions': reqPermissions,
|
||||
'groupId': [],
|
||||
'zhTag': '',
|
||||
'indexTag': '',
|
||||
'language': ''
|
||||
};
|
||||
globalThis.applicationInfo = info;
|
||||
GlobalContext.store('applicationInfo', info);
|
||||
windowStage.setUIContent(this.context, 'pages/application-secondary', null);
|
||||
}).catch(() => {
|
||||
this.context.terminateSelf();
|
||||
|
@ -14,19 +14,21 @@
|
||||
*/
|
||||
|
||||
import Constants from '../utils/constant';
|
||||
import { indexValue, appSort } from '../utils/utils';
|
||||
import { indexValue, sortByName } from '../utils/utils';
|
||||
import { GlobalContext } from '../utils/globalContext';
|
||||
import { appInfo, ApplicationObj } from '../utils/typedef';
|
||||
|
||||
@Component
|
||||
export struct alphabetIndexerComponent {
|
||||
@Link applicationItem: Array<any>; // application info array
|
||||
@Link applicationItem: Array<appInfo | ApplicationObj>; // application info array
|
||||
@Link index: number; // alphabetical index
|
||||
@State usingPopup: boolean = false;
|
||||
|
||||
aboutToAppear() {
|
||||
const this_ = this;
|
||||
setTimeout(function (){
|
||||
setTimeout(() => {
|
||||
this_.usingPopup = true;
|
||||
}, 500)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -40,17 +42,11 @@ export struct alphabetIndexerComponent {
|
||||
.popupFont({ size: $r('sys.float.ohos_id_text_size_headline7') }) // Demo of the popup
|
||||
.onSelect((index: number) => {
|
||||
const value = indexValue[index];
|
||||
if (value === '#') {
|
||||
if (this.applicationItem.length > 0) {
|
||||
let item = appSort(this.applicationItem)[0];
|
||||
indexValue.includes(item.alphabeticalIndex.toUpperCase()) ? '' : globalThis.scroller.scrollToIndex(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
let scroller: Scroller = GlobalContext.getContext().get('scroller') as Scroller;
|
||||
for (let i = 0; i < this.applicationItem.length; i++) {
|
||||
let item = appSort(this.applicationItem)[i];
|
||||
if (item.alphabeticalIndex.toUpperCase() === value) {
|
||||
globalThis.scroller.scrollToIndex(i);
|
||||
let item = sortByName(this.applicationItem)[i];
|
||||
if (item.indexTag === value) {
|
||||
scroller.scrollToIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,14 @@
|
||||
*/
|
||||
|
||||
import router from '@ohos.router';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import Constants from '../utils/constant';
|
||||
|
||||
@Component
|
||||
export struct backBar {
|
||||
@Prop title: string; // return title name
|
||||
@Prop recordable: boolean;
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@Prop title: string = ''; // return title name
|
||||
@Prop recordable: boolean = false;
|
||||
@State record: string = '';
|
||||
@State isTouch: string = '';
|
||||
@State isBack: boolean = false;
|
||||
@ -44,7 +46,10 @@ export struct backBar {
|
||||
right: Constants.BACKBAR_MARGIN_RIGHT
|
||||
})
|
||||
.backgroundColor(this.isBack ? $r('sys.color.ohos_id_color_click_effect') : '')
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isBack = true;
|
||||
}
|
||||
@ -54,7 +59,7 @@ export struct backBar {
|
||||
})
|
||||
.onClick(() => {
|
||||
let length = router.getLength();
|
||||
Number(length) == 1 ? globalThis.context.terminateSelf() : router.back();
|
||||
Number(length) == 1 ? this.context.terminateSelf() : router.back();
|
||||
})
|
||||
Text(JSON.parse(this.title))
|
||||
.align(Alignment.Start)
|
||||
@ -81,7 +86,10 @@ export struct backBar {
|
||||
})
|
||||
.bindMenu(this.MenuBuilder())
|
||||
.backgroundColor(this.isMore ? $r('sys.color.ohos_id_color_click_effect') : '')
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isMore = true;
|
||||
}
|
||||
@ -119,7 +127,10 @@ export struct backBar {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = 'true';
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import audio from '@ohos.multimedia.audio';
|
||||
import camera from '@ohos.multimedia.camera';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import display from '@ohos.display';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { GlobalContext } from "../utils/globalContext";
|
||||
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
@ -30,35 +32,13 @@ let bottomPopoverTypes = ['default', 'phone'];
|
||||
.flexGrow(Constants.FLEX_GROW)
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct authorizeDialog {
|
||||
controller: CustomDialogController;
|
||||
cancel: () => void;
|
||||
confirm: () => void;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.Center }) {
|
||||
Text($r("app.string.Authorization_failed")).fontSize(Constants.DIALOG_TEXT_FONT_SIZE)
|
||||
.margin({
|
||||
top: Constants.DIALOG_TEXT_MARGIN_TOP
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius(Constants.DIALOG_BORDER_RADIUS)
|
||||
.height(Constants.DIALOG_HEIGHT)
|
||||
.width(Constants.DIALOG_WIDTH)
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct globalDialog {
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@Link globalIsOn: boolean;
|
||||
@State isBottomPopover: boolean = true;
|
||||
controller: CustomDialogController;
|
||||
controller?: CustomDialogController;
|
||||
|
||||
build() {
|
||||
GridRow({ columns: { xs: Constants.XS_COLUMNS, sm: Constants.SM_COLUMNS, md: Constants.MD_COLUMNS, lg: Constants.LG_COLUMNS }, gutter: Constants.DIALOG_GUTTER }) {
|
||||
@ -66,7 +46,7 @@ export struct globalDialog {
|
||||
offset: {xs: Constants.XS_OFFSET, sm: Constants.SM_OFFSET, md: Constants.DIALOG_MD_OFFSET, lg: Constants.DIALOG_LG_OFFSET} }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: this.isBottomPopover ? ItemAlign.End : ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(globalThis.currentPermissionGroup == 'CAMERA' ? $r('app.string.close_camera') : $r('app.string.close_microphone'))
|
||||
Text(this.currentGroup == 'CAMERA' ? $r('app.string.close_camera') : $r('app.string.close_microphone'))
|
||||
.fontSize(Constants.TEXT_BIG_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
@ -74,7 +54,7 @@ export struct globalDialog {
|
||||
.height(Constants.ROW_HEIGHT)
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.padding({ left: Constants.DIALOG_DESP_MARGIN_LEFT, right: Constants.DIALOG_DESP_MARGIN_RIGHT })
|
||||
Text(globalThis.currentPermissionGroup == 'CAMERA' ? $r('app.string.close_camera_desc') : $r('app.string.close_microphone_desc'))
|
||||
Text(this.currentGroup == 'CAMERA' ? $r('app.string.close_camera_desc') : $r('app.string.close_microphone_desc'))
|
||||
.fontSize(Constants.TEXT_MIDDLE_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(Constants.TEXT_LINE_HEIGHT)
|
||||
@ -114,24 +94,31 @@ export struct globalDialog {
|
||||
}
|
||||
|
||||
confirm() {
|
||||
if (globalThis.currentPermissionGroup === 'CAMERA') {
|
||||
let cameraManager = camera.getCameraManager(globalThis.context);
|
||||
if (this.currentGroup === 'CAMERA') {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
cameraManager.muteCamera(true);
|
||||
this.controller.close();
|
||||
if (this.controller !== undefined) {
|
||||
this.controller.close();
|
||||
}
|
||||
} else {
|
||||
var audioManager = audio.getAudioManager();
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
audioVolumeGroupManager.setMicrophoneMute(true).then(() => {
|
||||
this.controller.close();
|
||||
if (this.controller !== undefined) {
|
||||
this.controller.close();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.controller.close();
|
||||
if (this.controller !== undefined) {
|
||||
this.controller.close();
|
||||
}
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
|
@ -14,12 +14,13 @@
|
||||
*/
|
||||
|
||||
import Constants from '../utils/constant';
|
||||
import { appInfo, ApplicationObj } from '../utils/typedef';
|
||||
|
||||
@Component
|
||||
export struct textInput {
|
||||
@Link applicationItem: Array<any>; // application info array
|
||||
@Link applicationItem: Array<appInfo | ApplicationObj>; // application info array
|
||||
@Link searchResult: boolean; // search results
|
||||
@State oldApplicationItem: Array<any> = []; // Original application information array
|
||||
@State oldApplicationItem: Array<appInfo | ApplicationObj> = []; // Original application information array
|
||||
|
||||
aboutToAppear() {
|
||||
this.oldApplicationItem = this.applicationItem;
|
||||
@ -37,12 +38,11 @@ export struct textInput {
|
||||
.placeholderFont({ size: Constants.TEXTINPUT_PLACEHOLDER_Font_SIZE, weight: FontWeight.Normal, family: "sans-serif", style: FontStyle.Normal })
|
||||
.caretColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.height(Constants.TEXTINPUT_HEIGHT)
|
||||
.enableKeyboardOnFocus(false)
|
||||
.onChange((value: string) => {
|
||||
if (value === '' || value === null) {
|
||||
this.applicationItem = this.oldApplicationItem;
|
||||
} else {
|
||||
this.applicationItem = this.oldApplicationItem.filter((item) => {
|
||||
this.applicationItem = this.oldApplicationItem.filter((item: appInfo | ApplicationObj) => {
|
||||
return String(item.label).indexOf(value) > -1;
|
||||
})
|
||||
}
|
||||
@ -52,6 +52,7 @@ export struct textInput {
|
||||
this.searchResult = false;
|
||||
}
|
||||
})
|
||||
Button().defaultFocus(true).opacity(0).position({ x: '-100%' })
|
||||
Image($r('app.media.ic_public_search_filled'))
|
||||
.objectFit(ImageFit.Contain)
|
||||
.width(Constants.TEXTINPUT_IMAGE_WIDTH)
|
||||
|
@ -13,456 +13,55 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const permissionGroups: any[] = [
|
||||
{
|
||||
"permissionName": "ohos.permission.LOCATION_IN_BACKGROUND",
|
||||
"groupName": "LOCATION",
|
||||
"label": $r("sys.string.ohos_lab_location_in_background"),
|
||||
"groupId": 0
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.APPROXIMATELY_LOCATION",
|
||||
"groupName": "LOCATION",
|
||||
"label": $r("sys.string.ohos_lab_approximately_location"),
|
||||
"groupId": 0
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.LOCATION",
|
||||
"groupName": "LOCATION",
|
||||
"label": $r("sys.string.ohos_lab_location"),
|
||||
"groupId": 0
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.CAMERA",
|
||||
"groupName": "CAMERA",
|
||||
"label": $r("sys.string.ohos_lab_camera"),
|
||||
"groupId": 1
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.MICROPHONE",
|
||||
"groupName": "MICROPHONE",
|
||||
"label": $r("sys.string.ohos_lab_microphone"),
|
||||
"groupId": 2
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_CONTACTS",
|
||||
"groupName": "CONTACTS",
|
||||
"label": $r("sys.string.ohos_lab_read_contacts"),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_read_contacts"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_read_contacts"),
|
||||
"groupId": 3
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_CONTACTS",
|
||||
"groupName": "CONTACTS",
|
||||
"label": $r("sys.string.ohos_lab_write_contacts"),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_write_contacts"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_write_contacts"),
|
||||
"groupId": 3
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_CALENDAR",
|
||||
"groupName": "CALENDAR",
|
||||
"label": $r("sys.string.ohos_lab_read_calendar"),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_read_calendar"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_read_calendar"),
|
||||
"groupId": 4
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_CALENDAR",
|
||||
"groupName": "CALENDAR",
|
||||
"label": $r("sys.string.ohos_lab_write_calendar"),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_write_calendar"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_write_calendar"),
|
||||
"groupId": 4
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_WHOLE_CALENDAR",
|
||||
"groupName": "CALENDAR",
|
||||
"label": $r('sys.string.ohos_lab_read_whole_calendar'),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_read_whole_calendar"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_read_whole_calendar"),
|
||||
"groupId": 4
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_WHOLE_CALENDAR",
|
||||
"groupName": "CALENDAR",
|
||||
"label": $r('sys.string.ohos_lab_write_whole_calendar'),
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_write_whole_calendar"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_write_whole_calendar"),
|
||||
"groupId": 4
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.ACTIVITY_MOTION",
|
||||
"groupName": "SPORT",
|
||||
"label": $r("sys.string.ohos_lab_activity_motion"),
|
||||
"groupId": 5
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_HEALTH_DATA",
|
||||
"groupName": "HEALTH",
|
||||
"label": $r("sys.string.ohos_lab_read_health_data"),
|
||||
"groupId": 6
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"groupName": "DISTRIBUTED_DATASYNC",
|
||||
"label": $r("sys.string.ohos_lab_distributed_datasync"),
|
||||
"groupId": 13
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_IMAGEVIDEO",
|
||||
"groupName": "IMAGE_AND_VIDEOS",
|
||||
"label": $r('sys.string.ohos_desc_read_imagevideo'),
|
||||
"groupId": 8
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_IMAGEVIDEO",
|
||||
"groupName": "IMAGE_AND_VIDEOS",
|
||||
"label": $r('sys.string.ohos_desc_write_imagevideo'),
|
||||
"groupId": 8
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.MEDIA_LOCATION",
|
||||
"groupName": "IMAGE_AND_VIDEOS",
|
||||
"label": $r("sys.string.ohos_lab_media_location"),
|
||||
"groupId": 8
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_AUDIO",
|
||||
"groupName": "AUDIOS",
|
||||
"label": $r('sys.string.ohos_desc_read_audio'),
|
||||
"groupId": 9
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_AUDIO",
|
||||
"groupName": "AUDIOS",
|
||||
"label": $r('sys.string.ohos_desc_write_audio'),
|
||||
"groupId": 9
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_DOCUMENT",
|
||||
"groupName": "DOCUMENTS",
|
||||
"label": $r('sys.string.ohos_desc_read_document'),
|
||||
"groupId": 10
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_DOCUMENT",
|
||||
"groupName": "DOCUMENTS",
|
||||
"label": $r('sys.string.ohos_desc_write_document'),
|
||||
"groupId": 10
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.READ_MEDIA",
|
||||
"groupName": "DOCUMENTS",
|
||||
"label": $r("sys.string.ohos_lab_read_media"),
|
||||
"groupId": 10
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.WRITE_MEDIA",
|
||||
"groupName": "DOCUMENTS",
|
||||
"label": $r("sys.string.ohos_lab_write_media"),
|
||||
"groupId": 10
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.APP_TRACKING_CONSENT",
|
||||
"groupName": "ADS",
|
||||
"label": $r('sys.string.ohos_lab_app_tracking_consent'),
|
||||
"groupId": 11
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.GET_INSTALLED_BUNDLE_LIST",
|
||||
"groupName": "GET_INSTALLED_BUNDLE_LIST",
|
||||
"label": $r('sys.string.ohos_lab_get_installed_bundle_list'),
|
||||
"groupId": 12
|
||||
},
|
||||
{
|
||||
"permissionName": "ohos.permission.ACCESS_BLUETOOTH",
|
||||
"groupName": "BLUETOOTH",
|
||||
"label": $r('sys.string.ohos_lab_access_bluetooth'),
|
||||
"groupId": 14
|
||||
}
|
||||
import { PermissionInfo, GroupInfo } from '../utils/typedef';
|
||||
|
||||
export const permissionGroups: Array<PermissionInfo> = [
|
||||
new PermissionInfo("ohos.permission.LOCATION_IN_BACKGROUND", "LOCATION", $r("sys.string.ohos_lab_location_in_background"), 0),
|
||||
new PermissionInfo("ohos.permission.APPROXIMATELY_LOCATION", "LOCATION", $r("sys.string.ohos_lab_approximately_location"), 0),
|
||||
new PermissionInfo("ohos.permission.LOCATION", "LOCATION", $r("sys.string.ohos_lab_location"), 0),
|
||||
new PermissionInfo("ohos.permission.CAMERA", "CAMERA", $r("sys.string.ohos_lab_camera"), 1),
|
||||
new PermissionInfo("ohos.permission.MICROPHONE", "MICROPHONE", $r("sys.string.ohos_lab_microphone"), 2),
|
||||
new PermissionInfo("ohos.permission.READ_CONTACTS", "CONTACTS", $r("sys.string.ohos_lab_read_contacts"), 3, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_read_contacts"), $r("app.string.forbidden_description_read_contacts")),
|
||||
new PermissionInfo("ohos.permission.WRITE_CONTACTS", "CONTACTS", $r("sys.string.ohos_lab_write_contacts"), 3, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_write_contacts"), $r("app.string.forbidden_description_write_contacts")),
|
||||
new PermissionInfo("ohos.permission.READ_CALENDAR", "CALENDAR", $r("sys.string.ohos_lab_read_calendar"), 4, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_read_calendar"), $r("app.string.forbidden_description_read_calendar")),
|
||||
new PermissionInfo("ohos.permission.WRITE_CALENDAR", "CALENDAR", $r("sys.string.ohos_lab_write_calendar"), 4, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_write_calendar"), $r("app.string.forbidden_description_write_calendar")),
|
||||
new PermissionInfo("ohos.permission.READ_WHOLE_CALENDAR", "CALENDAR", $r('sys.string.ohos_lab_read_whole_calendar'), 4, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_read_whole_calendar"), $r("app.string.forbidden_description_read_whole_calendar")),
|
||||
new PermissionInfo("ohos.permission.WRITE_WHOLE_CALENDAR", "CALENDAR", $r('sys.string.ohos_lab_write_whole_calendar'), 4, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_write_whole_calendar"), $r("app.string.forbidden_description_write_whole_calendar")),
|
||||
new PermissionInfo("ohos.permission.ACTIVITY_MOTION", "SPORT", $r("sys.string.ohos_lab_activity_motion"), 5),
|
||||
new PermissionInfo("ohos.permission.READ_HEALTH_DATA", "HEALTH", $r("sys.string.ohos_lab_read_health_data"), 6),
|
||||
new PermissionInfo("ohos.permission.READ_IMAGEVIDEO", "IMAGE_AND_VIDEOS", $r('sys.string.ohos_desc_read_imagevideo'), 8),
|
||||
new PermissionInfo("ohos.permission.WRITE_IMAGEVIDEO", "IMAGE_AND_VIDEOS", $r('sys.string.ohos_desc_write_imagevideo'), 8),
|
||||
new PermissionInfo("ohos.permission.MEDIA_LOCATION", "IMAGE_AND_VIDEOS", $r("sys.string.ohos_lab_media_location"), 8),
|
||||
new PermissionInfo("ohos.permission.READ_AUDIO", "AUDIOS", $r('sys.string.ohos_desc_read_audio'), 9),
|
||||
new PermissionInfo("ohos.permission.WRITE_AUDIO", "AUDIOS", $r('sys.string.ohos_desc_write_audio'), 9),
|
||||
new PermissionInfo("ohos.permission.READ_DOCUMENT", "DOCUMENTS", $r('sys.string.ohos_desc_read_document'), 10),
|
||||
new PermissionInfo("ohos.permission.WRITE_DOCUMENT", "DOCUMENTS", $r('sys.string.ohos_desc_write_document'), 10),
|
||||
new PermissionInfo("ohos.permission.READ_MEDIA", "DOCUMENTS", $r("sys.string.ohos_lab_read_media"), 10),
|
||||
new PermissionInfo("ohos.permission.WRITE_MEDIA", "DOCUMENTS", $r("sys.string.ohos_lab_write_media"), 10),
|
||||
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)
|
||||
]
|
||||
|
||||
export const groups: any[] = [
|
||||
{
|
||||
"name": "LOCATION",
|
||||
"groupName": $r("app.string.groupName_location"),
|
||||
"icon": $r('app.media.ic_public_gps'),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_location"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_location"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_location"),
|
||||
"label": $r("app.string.group_label_location"),
|
||||
"permissions": [
|
||||
"ohos.permission.LOCATION_IN_BACKGROUND",
|
||||
"ohos.permission.APPROXIMATELY_LOCATION",
|
||||
"ohos.permission.LOCATION"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "CAMERA",
|
||||
"groupName": $r("app.string.groupName_camera"),
|
||||
"icon": $r('app.media.ic_public_camera'),
|
||||
"label": $r("app.string.group_label_camera"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_camera"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_camera"),
|
||||
"permissions": [
|
||||
"ohos.permission.CAMERA"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "MICROPHONE",
|
||||
"groupName": $r("app.string.groupName_microphone"),
|
||||
"icon": $r('app.media.ic_public_voice'),
|
||||
"label": $r("app.string.group_label_microphone"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_microphone"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_microphone"),
|
||||
"permissions": [
|
||||
"ohos.permission.MICROPHONE"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "CONTACTS",
|
||||
"groupName": $r("app.string.groupName_contacts"),
|
||||
"icon": $r('app.media.ic_public_contacts_group'),
|
||||
"label": $r("app.string.group_label_contacts"),
|
||||
"description": "",
|
||||
"permissions": [
|
||||
"ohos.permission.READ_CONTACTS",
|
||||
"ohos.permission.WRITE_CONTACTS"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "CALENDAR",
|
||||
"groupName": $r("app.string.groupName_calendar"),
|
||||
"icon": $r('app.media.ic_public_calendar'),
|
||||
"label": $r("app.string.group_label_calendar"),
|
||||
"description": "",
|
||||
"permissions": [
|
||||
"ohos.permission.READ_CALENDAR",
|
||||
"ohos.permission.WRITE_CALENDAR",
|
||||
"ohos.permission.READ_WHOLE_CALENDAR",
|
||||
"ohos.permission.WRITE_WHOLE_CALENDAR"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "SPORT",
|
||||
"groupName": $r("app.string.groupName_sport"),
|
||||
"icon": $r('app.media.ic_sport'),
|
||||
"label": $r("app.string.group_label_sport"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_sport"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_sport"),
|
||||
"permissions": [
|
||||
"ohos.permission.ACTIVITY_MOTION"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "HEALTH",
|
||||
"groupName": $r("app.string.groupName_health"),
|
||||
"icon": $r('app.media.ic_ssensor'),
|
||||
"label": $r("app.string.group_label_health"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_health"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_health"),
|
||||
"permissions": [
|
||||
"ohos.permission.READ_HEALTH_DATA"
|
||||
],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "OTHER",
|
||||
"groupName": $r("app.string.groupName_other"),
|
||||
"icon": $r('app.media.ic_more'),
|
||||
"label": '',
|
||||
"description": "",
|
||||
"permissions": [],
|
||||
"isShow":true
|
||||
},
|
||||
{
|
||||
"name": "IMAGE_AND_VIDEOS",
|
||||
"groupName": $r('sys.string.ohos_lab_read_imagevideo'),
|
||||
"icon": $r('app.media.ic_public_picture'),
|
||||
"label": $r("app.string.group_label_image_and_videos"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_image"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_image"),
|
||||
"permissions": [
|
||||
"ohos.permission.READ_IMAGEVIDEO",
|
||||
"ohos.permission.WRITE_IMAGEVIDEO",
|
||||
"ohos.permission.MEDIA_LOCATION"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "AUDIOS",
|
||||
"groupName": $r('sys.string.ohos_lab_read_audio'),
|
||||
"icon": $r('app.media.ic_public_audio'),
|
||||
"label": $r("app.string.group_label_audios"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_audios"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_audios"),
|
||||
"permissions": [
|
||||
"ohos.permission.READ_AUDIO",
|
||||
"ohos.permission.WRITE_AUDIO"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "DOCUMENTS",
|
||||
"groupName": $r('sys.string.ohos_lab_read_document'),
|
||||
"icon": $r('app.media.ic_public_folder'),
|
||||
"label": $r("app.string.group_label_document"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_documents"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_documents"),
|
||||
"permissions": [
|
||||
"ohos.permission.READ_DOCUMENT",
|
||||
"ohos.permission.WRITE_DOCUMENT",
|
||||
"ohos.permission.READ_MEDIA",
|
||||
"ohos.permission.WRITE_MEDIA"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "ADS",
|
||||
"groupName": $r("app.string.groupName_ADS"),
|
||||
"icon": $r('app.media.track'),
|
||||
"label": $r("app.string.group_label_ADS"),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_ADS"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_ADS"),
|
||||
"permissions": [
|
||||
"ohos.permission.APP_TRACKING_CONSENT"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "GET_INSTALLED_BUNDLE_LIST",
|
||||
"groupName": $r('app.string.groupName_appList'),
|
||||
"icon": $r('app.media.ic_public_app_list'),
|
||||
"label": $r('app.string.group_label_appList'),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_appList"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_appList"),
|
||||
"permissions": [
|
||||
"ohos.permission.GET_INSTALLED_BUNDLE_LIST"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "DISTRIBUTED_DATASYNC",
|
||||
"groupName": $r('app.string.multi_device_collaboration'),
|
||||
"icon": $r('app.media.ic_multi_device_vector'),
|
||||
"label": $r('app.string.group_label_distributed_datasync'),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_distributed_datasync"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_distributed_datasync"),
|
||||
"permissions": [
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
],
|
||||
"isShow":false
|
||||
},
|
||||
{
|
||||
"name": "BLUETOOTH",
|
||||
"groupName": $r('app.string.groupName_bluetooth'),
|
||||
"icon": $r('app.media.ic_public_bluetooth'),
|
||||
"label": $r('app.string.group_label_bluetooth'),
|
||||
"description": "",
|
||||
"enable_description_start": $r("app.string.enable_description_start_default"),
|
||||
"enable_description_end": $r("app.string.enable_description_end_bluetooth"),
|
||||
"forbidden_description": $r("app.string.forbidden_description_bluetooth"),
|
||||
"permissions": [
|
||||
"ohos.permission.ACCESS_BLUETOOTH"
|
||||
],
|
||||
"isShow":false
|
||||
}
|
||||
export const groups: Array<GroupInfo> = [
|
||||
new GroupInfo("LOCATION", $r("app.string.groupName_location"), $r("app.string.group_label_location"), $r('app.media.ic_public_gps'), [], '', ["ohos.permission.LOCATION_IN_BACKGROUND", "ohos.permission.APPROXIMATELY_LOCATION", "ohos.permission.LOCATION"], true, $r("app.string.enable_description_start_location"), $r("app.string.enable_description_end_location"), $r("app.string.forbidden_description_location")),
|
||||
new GroupInfo("CAMERA", $r("app.string.groupName_camera"), $r("app.string.group_label_camera"), $r('app.media.ic_public_camera'), [], '', ["ohos.permission.CAMERA"], true, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_camera"), $r("app.string.forbidden_description_camera")),
|
||||
new GroupInfo("MICROPHONE", $r("app.string.groupName_microphone"), $r("app.string.group_label_microphone"), $r('app.media.ic_public_voice'), [], '', ["ohos.permission.MICROPHONE"], true, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_microphone"), $r("app.string.forbidden_description_microphone")),
|
||||
new GroupInfo("CONTACTS", $r("app.string.groupName_contacts"), $r("app.string.group_label_contacts"), $r('app.media.ic_public_contacts_group'), [], '', ["ohos.permission.READ_CONTACTS", "ohos.permission.WRITE_CONTACTS"], false),
|
||||
new GroupInfo("CALENDAR", $r("app.string.groupName_calendar"), $r("app.string.group_label_calendar"), $r('app.media.ic_public_calendar'), [], '', ["ohos.permission.READ_CALENDAR", "ohos.permission.WRITE_CALENDAR", "ohos.permission.READ_WHOLE_CALENDAR", "ohos.permission.WRITE_WHOLE_CALENDAR"], true),
|
||||
new GroupInfo("SPORT", $r("app.string.groupName_sport"), $r("app.string.group_label_sport"), $r('app.media.ic_sport'), [], '', ["ohos.permission.ACTIVITY_MOTION"], true, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_sport"), $r("app.string.forbidden_description_sport")),
|
||||
new GroupInfo("HEALTH", $r("app.string.groupName_health"), $r("app.string.group_label_health"), $r('app.media.ic_ssensor'), [], '', ["ohos.permission.READ_HEALTH_DATA"], true, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_health"), $r("app.string.forbidden_description_health")),
|
||||
new GroupInfo("OTHER", $r("app.string.groupName_other"), '', $r('app.media.ic_more'), [], '', [], true),
|
||||
new GroupInfo("IMAGE_AND_VIDEOS", $r('sys.string.ohos_lab_read_imagevideo'), $r("app.string.group_label_image_and_videos"), $r('app.media.ic_public_picture'), [], '', ["ohos.permission.READ_IMAGEVIDEO", "ohos.permission.WRITE_IMAGEVIDEO", "ohos.permission.MEDIA_LOCATION"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_image"), $r("app.string.forbidden_description_image")),
|
||||
new GroupInfo("AUDIOS", $r('sys.string.ohos_lab_read_audio'), $r("app.string.group_label_audios"), $r('app.media.ic_public_audio'), [], '', ["ohos.permission.READ_AUDIO", "ohos.permission.WRITE_AUDIO"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_audios"), $r("app.string.forbidden_description_audios")),
|
||||
new GroupInfo("DOCUMENTS", $r('sys.string.ohos_lab_read_document'), $r("app.string.group_label_document"), $r('app.media.ic_public_folder'), [], '', ["ohos.permission.READ_DOCUMENT", "ohos.permission.WRITE_DOCUMENT", "ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA"], false, $r("app.string.enable_description_start_default"), $r("app.string.enable_description_end_documents"), $r("app.string.forbidden_description_documents")),
|
||||
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"))
|
||||
];
|
||||
|
||||
export const permissionGroupPermissions: object = {
|
||||
"LOCATION": [
|
||||
"ohos.permission.LOCATION_IN_BACKGROUND",
|
||||
"ohos.permission.APPROXIMATELY_LOCATION",
|
||||
"ohos.permission.LOCATION"
|
||||
],
|
||||
"CAMERA": [
|
||||
"ohos.permission.CAMERA"
|
||||
],
|
||||
"MICROPHONE": [
|
||||
"ohos.permission.MICROPHONE"
|
||||
],
|
||||
"CONTACTS": [
|
||||
"ohos.permission.READ_CONTACTS",
|
||||
"ohos.permission.WRITE_CONTACTS"
|
||||
],
|
||||
"CALENDAR": [
|
||||
"ohos.permission.READ_CALENDAR",
|
||||
"ohos.permission.WRITE_CALENDAR",
|
||||
"ohos.permission.READ_WHOLE_CALENDAR",
|
||||
"ohos.permission.WRITE_WHOLE_CALENDAR"
|
||||
],
|
||||
"SPORT": [
|
||||
"ohos.permission.ACTIVITY_MOTION"
|
||||
],
|
||||
"HEALTH": [
|
||||
"ohos.permission.READ_HEALTH_DATA"
|
||||
],
|
||||
"OTHER": [],
|
||||
"IMAGE_AND_VIDEOS": [
|
||||
"ohos.permission.READ_IMAGEVIDEO",
|
||||
"ohos.permission.WRITE_IMAGEVIDEO",
|
||||
"ohos.permission.MEDIA_LOCATION"
|
||||
],
|
||||
"AUDIOS": [
|
||||
"ohos.permission.READ_AUDIO",
|
||||
"ohos.permission.WRITE_AUDIO"
|
||||
],
|
||||
"DOCUMENTS": [
|
||||
"ohos.permission.READ_DOCUMENT",
|
||||
"ohos.permission.WRITE_DOCUMENT",
|
||||
"ohos.permission.READ_MEDIA",
|
||||
"ohos.permission.WRITE_MEDIA"
|
||||
],
|
||||
"ADS": [
|
||||
"ohos.permission.APP_TRACKING_CONSENT"
|
||||
],
|
||||
"GET_INSTALLED_BUNDLE_LIST": [
|
||||
"ohos.permission.GET_INSTALLED_BUNDLE_LIST"
|
||||
],
|
||||
"DISTRIBUTED_DATASYNC": [
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
],
|
||||
"BLUETOOTH": [
|
||||
"ohos.permission.ACCESS_BLUETOOTH"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
export const userGrantPermissions: string[] = [
|
||||
"ohos.permission.LOCATION_IN_BACKGROUND",
|
||||
"ohos.permission.APPROXIMATELY_LOCATION",
|
||||
@ -478,7 +77,6 @@ export const userGrantPermissions: string[] = [
|
||||
"ohos.permission.WRITE_CALENDAR",
|
||||
"ohos.permission.ACTIVITY_MOTION",
|
||||
"ohos.permission.READ_HEALTH_DATA",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.READ_IMAGEVIDEO",
|
||||
"ohos.permission.WRITE_IMAGEVIDEO",
|
||||
"ohos.permission.READ_AUDIO",
|
||||
@ -489,38 +87,10 @@ export const userGrantPermissions: string[] = [
|
||||
"ohos.permission.WRITE_WHOLE_CALENDAR",
|
||||
"ohos.permission.APP_TRACKING_CONSENT",
|
||||
"ohos.permission.GET_INSTALLED_BUNDLE_LIST",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.ACCESS_BLUETOOTH"
|
||||
];
|
||||
|
||||
export const permissionGroupIds: object = {
|
||||
"ohos.permission.LOCATION_IN_BACKGROUND": "0",
|
||||
"ohos.permission.APPROXIMATELY_LOCATION": "0",
|
||||
"ohos.permission.LOCATION": "0",
|
||||
"ohos.permission.CAMERA": "1",
|
||||
"ohos.permission.MICROPHONE": "2",
|
||||
"ohos.permission.READ_CONTACTS": "3",
|
||||
"ohos.permission.WRITE_CONTACTS": "3",
|
||||
"ohos.permission.READ_CALENDAR": "4",
|
||||
"ohos.permission.WRITE_CALENDAR": "4",
|
||||
"ohos.permission.READ_WHOLE_CALENDAR": "4",
|
||||
"ohos.permission.WRITE_WHOLE_CALENDAR": "4",
|
||||
"ohos.permission.ACTIVITY_MOTION": "5",
|
||||
"ohos.permission.READ_HEALTH_DATA": "6",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC": "13",
|
||||
"ohos.permission.READ_IMAGEVIDEO": "8",
|
||||
"ohos.permission.WRITE_IMAGEVIDEO": "8",
|
||||
"ohos.permission.MEDIA_LOCATION": "8",
|
||||
"ohos.permission.READ_AUDIO": "9",
|
||||
"ohos.permission.WRITE_AUDIO": "9",
|
||||
"ohos.permission.READ_DOCUMENT": "10",
|
||||
"ohos.permission.WRITE_DOCUMENT": "10",
|
||||
"ohos.permission.READ_MEDIA": "10",
|
||||
"ohos.permission.WRITE_MEDIA": "10",
|
||||
"ohos.permission.APP_TRACKING_CONSENT": "11",
|
||||
"ohos.permission.GET_INSTALLED_BUNDLE_LIST": "12",
|
||||
"ohos.permission.ACCESS_BLUETOOTH": "14"
|
||||
};
|
||||
|
||||
export const showSubpermissionsGrop: string[] = [
|
||||
"CALENDAR",
|
||||
"CONTACTS",
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommonUtils } from './commonUtils';
|
||||
|
||||
export class BundleInfoUtils {
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
static readonly zh: string = '阿八嚓哒妸发旮哈靃讥咔垃呣拏噢妑七呥仨它唾畖窊夕丫帀';
|
||||
static readonly en: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
static getStringZh(input: string): string {
|
||||
let result: string = '';
|
||||
let upperCaseStr = input.toLocaleUpperCase();
|
||||
let regex: RegExp = new RegExp("[A-Z]")
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
if (upperCaseStr[i].match(regex)) {
|
||||
let index = upperCaseStr.charCodeAt(i) - 'A'.charCodeAt(0);
|
||||
let ch = BundleInfoUtils.zh.charAt(index);
|
||||
result += ch;
|
||||
} else {
|
||||
result += upperCaseStr[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
static findZhIndex(zhCharacter: string): string {
|
||||
if (CommonUtils.isEmpty(zhCharacter) || zhCharacter.localeCompare(BundleInfoUtils.zh[0], 'zh') < 0) {
|
||||
return '#';
|
||||
}
|
||||
for (let left = 0; left < BundleInfoUtils.zh.length - 1; left++) {
|
||||
let next = left + 1;
|
||||
if (zhCharacter.localeCompare(BundleInfoUtils.zh[left], 'zh') >= 0 && zhCharacter.localeCompare(BundleInfoUtils.zh[next], 'zh') < 0) {
|
||||
return BundleInfoUtils.en[left];
|
||||
}
|
||||
if (next === BundleInfoUtils.zh.length - 1 && zhCharacter.localeCompare(BundleInfoUtils.zh[next], 'zh') >= 0) {
|
||||
return BundleInfoUtils.en[next];
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
33
permissionmanager/src/main/ets/common/utils/commonUtils.ets
Normal file
33
permissionmanager/src/main/ets/common/utils/commonUtils.ets
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class CommonUtils {
|
||||
/**
|
||||
* Determines whether the object is unavailable
|
||||
* @param {str} string to be judged
|
||||
*/
|
||||
static isInvalid(str: string): boolean {
|
||||
return str == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* String null
|
||||
* @param {str} Word string
|
||||
*/
|
||||
static isEmpty(str: string): boolean {
|
||||
return CommonUtils.isInvalid(str) || str.trim().length == 0;
|
||||
}
|
||||
|
||||
}
|
@ -239,8 +239,6 @@ export default class Constants {
|
||||
static PERMISSION_COMPONENT_SET = 16;
|
||||
static PERMISSION_POLICY_FIXED = 32;
|
||||
|
||||
static BUNDLE_NAME = 'com.ohos.permissionmanager'
|
||||
|
||||
static DEFAULT_DEVICE_TYPE = 'default'
|
||||
static PHONE_DEVICE_TYPE = 'phone'
|
||||
static TABLET_DEVICE_TYPE = 'tablet'
|
||||
|
50
permissionmanager/src/main/ets/common/utils/globalContext.ts
Normal file
50
permissionmanager/src/main/ets/common/utils/globalContext.ts
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class GlobalContext {
|
||||
currentPermissionGroup: string;
|
||||
isMuteSupported: boolean;
|
||||
isVertical: boolean;
|
||||
bundleName: string;
|
||||
globalState: string;
|
||||
windowNum: number;
|
||||
|
||||
private constructor() {}
|
||||
private static instance: GlobalContext;
|
||||
private _objects = new Map<string, Object>();
|
||||
|
||||
public static getContext(): GlobalContext {
|
||||
if (!GlobalContext.instance) {
|
||||
GlobalContext.instance = new GlobalContext();
|
||||
}
|
||||
return GlobalContext.instance;
|
||||
}
|
||||
|
||||
static load(name: string): any {
|
||||
return globalThis[name];
|
||||
}
|
||||
|
||||
static store(name: string, obj: Object): void {
|
||||
globalThis[name] = obj;
|
||||
}
|
||||
|
||||
get(value: string): Object {
|
||||
return this._objects.get(value);
|
||||
}
|
||||
|
||||
set(key: string, objectClass: Object): void {
|
||||
this._objects.set(key, objectClass);
|
||||
}
|
||||
}
|
346
permissionmanager/src/main/ets/common/utils/typedef.ets
Normal file
346
permissionmanager/src/main/ets/common/utils/typedef.ets
Normal file
@ -0,0 +1,346 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
|
||||
export class appInfo {
|
||||
bundleName: string
|
||||
api: number
|
||||
tokenId: number
|
||||
icon: ResourceStr | PixelMap
|
||||
iconId: number
|
||||
label: string
|
||||
labelId: number
|
||||
permissions: Permissions[]
|
||||
groupId: number[]
|
||||
zhTag: string
|
||||
indexTag: string
|
||||
language: string
|
||||
|
||||
constructor(bundleName: string, api: number, tokenId: number, icon: ResourceStr | PixelMap, iconId: number, label: string, labelId: number, permissions: Permissions[], groupId: number[], zhTag: string, indexTag: string, language: string) {
|
||||
this.bundleName = bundleName
|
||||
this.api = api
|
||||
this.tokenId = tokenId
|
||||
this.icon = icon
|
||||
this.iconId = iconId
|
||||
this.label = label
|
||||
this.labelId = labelId
|
||||
this.permissions = permissions
|
||||
this.groupId = groupId
|
||||
this.zhTag = zhTag
|
||||
this.indexTag = indexTag
|
||||
this.language = language
|
||||
}
|
||||
};
|
||||
|
||||
export class permissionApplications {
|
||||
permission: Permissions
|
||||
groupName: string
|
||||
bundleNames: string[]
|
||||
icon: ResourceStr
|
||||
|
||||
constructor(permission: Permissions, groupName: string, bundleNames: string[], icon: ResourceStr) {
|
||||
this.permission = permission
|
||||
this.groupName = groupName
|
||||
this.bundleNames = bundleNames
|
||||
this.icon = icon
|
||||
}
|
||||
};
|
||||
|
||||
export class groupPermission {
|
||||
group: string
|
||||
permissions: string[]
|
||||
groupName: ResourceStr
|
||||
icon: ResourceStr
|
||||
isShow:boolean
|
||||
|
||||
constructor(group: string, permissions: string[], groupName: ResourceStr, icon: ResourceStr, isShow:boolean) {
|
||||
this.group = group
|
||||
this.permissions = permissions
|
||||
this.groupName = groupName
|
||||
this.icon = icon
|
||||
this.isShow = isShow
|
||||
}
|
||||
};
|
||||
|
||||
export class ApplicationObj {
|
||||
label: string
|
||||
icon: ResourceStr | PixelMap
|
||||
index: number
|
||||
accessTokenId: number
|
||||
permission: Permissions
|
||||
zhTag: string
|
||||
indexTag: string
|
||||
language: string
|
||||
bundleName?: string
|
||||
constructor(label: string, icon: ResourceStr | PixelMap, index: number, accessTokenId: number, permission: Permissions, zhTag: string, indexTag: string, language: string, bundleName?: string,) {
|
||||
this.label = label
|
||||
this.icon = icon
|
||||
this.index = index
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permission = permission
|
||||
this.zhTag = zhTag
|
||||
this.indexTag = indexTag
|
||||
this.language = language
|
||||
this.bundleName = bundleName
|
||||
}
|
||||
}
|
||||
|
||||
export class CalendarObj {
|
||||
permissionName: string
|
||||
groupName: string
|
||||
label: ResourceStr
|
||||
index: number
|
||||
constructor(permissionName: string, groupName: string, label: ResourceStr, index: number) {
|
||||
this.permissionName = permissionName
|
||||
this.groupName = groupName
|
||||
this.label = label
|
||||
this.index = index
|
||||
}
|
||||
}
|
||||
|
||||
export class MediaDocObj {
|
||||
name: Resource
|
||||
accessTokenId: number
|
||||
permissions: Array<Permissions>
|
||||
index: number
|
||||
constructor(name: Resource, accessTokenId: number, permissions: Array<Permissions>, index: number) {
|
||||
this.name = name
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permissions = permissions
|
||||
this.index = index
|
||||
}
|
||||
}
|
||||
|
||||
export class permissionObj {
|
||||
groupName: ResourceStr;
|
||||
permission: string[];
|
||||
group: string;
|
||||
constructor(groupName: ResourceStr, permission: string[], group: string) {
|
||||
this.groupName = groupName;
|
||||
this.permission = permission;
|
||||
this.group = group
|
||||
}
|
||||
}
|
||||
|
||||
export class StringObj {
|
||||
morning: string
|
||||
afternoon: string
|
||||
constructor(morning: string, afternoon: string) {
|
||||
this.morning = morning
|
||||
this.afternoon = afternoon
|
||||
}
|
||||
}
|
||||
|
||||
export class appInfoSimple {
|
||||
bundleName: string
|
||||
api: number
|
||||
tokenId: number
|
||||
icon: ResourceStr | PixelMap
|
||||
label: ResourceStr
|
||||
permissions: Array<string>
|
||||
groupId: Array<number>
|
||||
|
||||
constructor(bundleName: string, api: number, tokenId: number, icon: ResourceStr | PixelMap, label: ResourceStr, permissions: Array<string>, groupId: Array<number>) {
|
||||
this.bundleName = bundleName
|
||||
this.api = api
|
||||
this.tokenId = tokenId
|
||||
this.icon = icon
|
||||
this.label = label
|
||||
this.permissions = permissions
|
||||
this.groupId = groupId
|
||||
}
|
||||
}
|
||||
|
||||
export class param {
|
||||
icon: Resource
|
||||
label: Resource
|
||||
|
||||
constructor(icon: Resource, label: Resource) {
|
||||
this.icon = icon
|
||||
this.label = label
|
||||
}
|
||||
};
|
||||
|
||||
export class otherPermission {
|
||||
permissionLabel: ResourceStr
|
||||
permission: string
|
||||
|
||||
constructor(permissionLabel: ResourceStr, permission: string) {
|
||||
this.permissionLabel = permissionLabel
|
||||
this.permission = permission
|
||||
}
|
||||
}
|
||||
|
||||
export class PermissionInfo {
|
||||
permissionName: string
|
||||
groupName: string
|
||||
label: ResourceStr
|
||||
groupId: number
|
||||
enable_description_start?: ResourceStr
|
||||
enable_description_end?: ResourceStr
|
||||
forbidden_description?: ResourceStr
|
||||
|
||||
constructor(permissionName: string, groupName: string, label: ResourceStr, groupId: number, enable_description_start?: ResourceStr, enable_description_end?: ResourceStr, forbidden_description?: ResourceStr,) {
|
||||
this.permissionName = permissionName;
|
||||
this.groupName = groupName;
|
||||
this.label = label;
|
||||
this.groupId = groupId;
|
||||
this.enable_description_start = enable_description_start;
|
||||
this.enable_description_end = enable_description_end;
|
||||
this.forbidden_description = forbidden_description;
|
||||
}
|
||||
}
|
||||
|
||||
export class GroupInfo {
|
||||
name: string
|
||||
groupName: ResourceStr
|
||||
label: ResourceStr
|
||||
icon: ResourceStr
|
||||
description: Array<ResourceStr>
|
||||
reason: string
|
||||
permissions: Array<Permissions>
|
||||
isShow: boolean
|
||||
enable_description_start?: ResourceStr
|
||||
enable_description_end?: ResourceStr
|
||||
forbidden_description?: ResourceStr
|
||||
|
||||
constructor(name: string, groupName: ResourceStr, label: ResourceStr, icon: ResourceStr, description: Array<ResourceStr>, reason: string, permissions: Array<Permissions>, isShow: boolean, enable_description_start?: ResourceStr, enable_description_end?: ResourceStr, forbidden_description?: ResourceStr) {
|
||||
this.name = name;
|
||||
this.groupName = groupName;
|
||||
this.label = label;
|
||||
this.icon = icon;
|
||||
this.description = description;
|
||||
this.reason = reason;
|
||||
this.permissions = permissions;
|
||||
this.isShow = isShow;
|
||||
this.enable_description_start = enable_description_start;
|
||||
this.enable_description_end = enable_description_end;
|
||||
this.forbidden_description = forbidden_description;
|
||||
}
|
||||
}
|
||||
|
||||
export class appRecordInfo {
|
||||
groupName: ResourceStr
|
||||
icon: ResourceStr | PixelMap
|
||||
name: string
|
||||
api: number
|
||||
accessTokenId: number
|
||||
reqUserPermissions: string[]
|
||||
permissions: appGroupRecordInfo[]
|
||||
groupNames: ResourceStr[]
|
||||
groupIds: number[]
|
||||
appLastTime: number
|
||||
|
||||
constructor(groupName: ResourceStr, icon: ResourceStr | PixelMap, name: string, api: number, accessTokenId: number, reqUserPermissions: string[], permissions: appGroupRecordInfo[], groupNames: ResourceStr[], groupIds: number[], appLastTime: number) {
|
||||
this.groupName = groupName
|
||||
this.icon = icon
|
||||
this.name = name
|
||||
this.api = api
|
||||
this.accessTokenId = accessTokenId
|
||||
this.reqUserPermissions = reqUserPermissions
|
||||
this.permissions = permissions
|
||||
this.groupNames = groupNames
|
||||
this.groupIds = groupIds
|
||||
this.appLastTime = appLastTime
|
||||
}
|
||||
}
|
||||
|
||||
export class GroupRecordInfo {
|
||||
name: string
|
||||
groupName: ResourceStr
|
||||
label: ResourceStr
|
||||
icon: ResourceStr
|
||||
permissions: Array<Permissions>
|
||||
sum: number
|
||||
recentVisit: number
|
||||
|
||||
constructor(name: string, groupName: ResourceStr, label: ResourceStr, icon: ResourceStr, permissions: Array<Permissions>, sum: number, recentVisit: number) {
|
||||
this.name = name;
|
||||
this.groupName = groupName;
|
||||
this.label = label;
|
||||
this.icon = icon;
|
||||
this.permissions = permissions;
|
||||
this.sum = sum;
|
||||
this.recentVisit = recentVisit;
|
||||
}
|
||||
}
|
||||
|
||||
export class appGroupRecordInfo {
|
||||
name: string
|
||||
groupName: ResourceStr
|
||||
label: ResourceStr
|
||||
icon: ResourceStr
|
||||
count: number
|
||||
lastTime: number
|
||||
|
||||
constructor(name: string, groupName: ResourceStr, label: ResourceStr, icon: ResourceStr, count: number, lastTime: number) {
|
||||
this.name = name;
|
||||
this.groupName = groupName;
|
||||
this.label = label;
|
||||
this.icon = icon;
|
||||
this.count = count;
|
||||
this.lastTime = lastTime;
|
||||
}
|
||||
}
|
||||
|
||||
export class routerParams_1 {
|
||||
list: permissionApplications[]
|
||||
backTitle: ResourceStr
|
||||
group: string
|
||||
globalIsOn: boolean
|
||||
|
||||
constructor(list: permissionApplications[], backTitle: ResourceStr, group: string, globalIsOn: boolean) {
|
||||
this.list = list
|
||||
this.backTitle = backTitle
|
||||
this.group = group
|
||||
this.globalIsOn = globalIsOn
|
||||
}
|
||||
}
|
||||
|
||||
export class routerParams_2 {
|
||||
list: permissionApplications[]
|
||||
backTitle: ResourceStr
|
||||
permissionName: string
|
||||
|
||||
constructor(list: permissionApplications[], backTitle: ResourceStr, permissionName: string) {
|
||||
this.list = list
|
||||
this.backTitle = backTitle
|
||||
this.permissionName = permissionName
|
||||
}
|
||||
}
|
||||
|
||||
export class routerParams_3 {
|
||||
bundleName: string
|
||||
backTitle: ResourceStr
|
||||
permission: Permissions[]
|
||||
status: number
|
||||
tokenId: number
|
||||
|
||||
constructor(bundleName: string, backTitle: ResourceStr, permission: Permissions[], status: number, tokenId: number) {
|
||||
this.bundleName = bundleName
|
||||
this.backTitle = backTitle
|
||||
this.permission = permission
|
||||
this.status = status
|
||||
this.tokenId = tokenId
|
||||
}
|
||||
}
|
||||
|
||||
export class wantInfo {
|
||||
parameters: Object[]
|
||||
|
||||
constructor(parameters: Object[]) {
|
||||
this.parameters = parameters
|
||||
}
|
||||
}
|
@ -13,54 +13,28 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import i18n from '@ohos.i18n';
|
||||
import { permissionGroups, groups } from "../model/permissionGroup";
|
||||
import Constants from '../utils/constant';
|
||||
|
||||
/**
|
||||
* Get app name resource
|
||||
* @param {Number} labelId app name id
|
||||
* @param {String} bundleName Package names
|
||||
*/
|
||||
export function getAppLabel(labelId, bundleName) {
|
||||
return new Promise((resolve) => {
|
||||
globalThis.context.createBundleContext(bundleName).resourceManager.getString(labelId).then(value => {
|
||||
resolve(value);
|
||||
}).catch(error => {
|
||||
console.error('Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get app icon resources
|
||||
* @param {Number} iconId app icon id
|
||||
* @param {String} bundleName Package names
|
||||
*/
|
||||
export function getAppIcon(iconId, bundleName) {
|
||||
return new Promise((resolve) => {
|
||||
globalThis.context.createBundleContext(bundleName).resourceManager.getMediaBase64(iconId).then(value => {
|
||||
resolve(value);
|
||||
}).catch(error => {
|
||||
console.error('Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
})
|
||||
}
|
||||
import { BundleInfoUtils } from './bundleInfoUtils';
|
||||
import { CommonUtils } from './commonUtils';
|
||||
import { GroupInfo, appInfo, ApplicationObj } from './typedef';
|
||||
|
||||
/**
|
||||
* verify permission
|
||||
* @param {Number} accessTokenId
|
||||
* @param {String} permission permission name
|
||||
*/
|
||||
export function verifyAccessToken(accessTokenId, permission) {
|
||||
return new Promise((resolve) => {
|
||||
export function verifyAccessToken(accessTokenId: number, permission: Permissions) {
|
||||
return new Promise<number>((resolve) => {
|
||||
let atManager = abilityAccessCtrl.createAtManager();
|
||||
let data = atManager.verifyAccessTokenSync(accessTokenId, permission);
|
||||
if (data == abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||
resolve(data);
|
||||
} else {
|
||||
try {
|
||||
atManager.getPermissionFlags(accessTokenId, permission).then(flag => {
|
||||
atManager.getPermissionFlags(accessTokenId, permission).then((flag: number) => {
|
||||
if (flag == Constants.PERMISSION_COMPONENT_SET) {
|
||||
resolve(abilityAccessCtrl.GrantStatus.PERMISSION_DENIED);
|
||||
} else {
|
||||
@ -80,10 +54,10 @@ export function verifyAccessToken(accessTokenId, permission) {
|
||||
* Omit display when application name is too long
|
||||
* @param {String} Application name
|
||||
*/
|
||||
export function titleTrim(title) {
|
||||
const length = title.length;
|
||||
export function titleTrim(title: string): string {
|
||||
const length: number = title.length;
|
||||
if (length > Constants.MAXIMUM_HEADER_LENGTH) {
|
||||
var str = '';
|
||||
let str = '';
|
||||
str = title.substring(0, Constants.MAXIMUM_HEADER_LENGTH) + '...';
|
||||
return str;
|
||||
} else {
|
||||
@ -121,366 +95,127 @@ export const indexValue: string[] = [
|
||||
'Z'
|
||||
]; // Array of alphabetically indexed names
|
||||
|
||||
// List of Chinese Pinyin Initials
|
||||
let strChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSC" +
|
||||
"YYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZ" +
|
||||
"JJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZS" +
|
||||
"BSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZYRJXSDLTYZCQKCN" +
|
||||
"NJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQT" +
|
||||
"GLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMB" +
|
||||
"DTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZA" +
|
||||
"SYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZS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"SSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHWWKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWP" +
|
||||
"YMLGKDLDLGKQQBGYCHJXY";
|
||||
// 375 polyphonic words are included here
|
||||
let oMultiDiff = { "19969": "DZ", "19975": "WM", "19988": "QJ", "20048": "YL", "20056": "SC", "20060": "NM",
|
||||
"20094": "QG", "20127": "QJ", "20167": "QC", "20193": "YG", "20250": "KH", "20256": "ZC", "20282": "SC",
|
||||
"20285": "QJG", "20291": "TD", "20314": "YD", "20340": "NE", "20375": "TD", "20389": "YJ", "20391": "CZ",
|
||||
"20415": "PB", "20446": "YS", "20447": "SQ", "20504": "TC", "20608": "KG", "20854": "QJ", "20857": "ZC",
|
||||
"20911": "PF", "20985": "AW", "21032": "PB", "21048": "XQ", "21049": "SC", "21089": "YS", "21119": "JC",
|
||||
"21242": "SB", "21273": "SC", "21305": "YP", "21306": "QO", "21330": "ZC", "21333": "SDC", "21345": "QK",
|
||||
"21378": "CA", "21397": "SC", "21414": "XS", "21442": "SC", "21477": "JG", "21480": "TD", "21484": "ZS",
|
||||
"21494": "YX", "21505": "YX", "21512": "HG", "21523": "XH", "21537": "PB", "21542": "PF", "21549": "KH",
|
||||
"21571": "E", "21574": "DA", "21588": "TD", "21589": "O", "21618": "ZC", "21621": "KHA", "21632": "ZJ",
|
||||
"21654": "KG", "21679": "LKG", "21683": "KH", "21710": "A", "21719": "YH", "21734": "WOE", "21769": "A",
|
||||
"21780": "WN", "21804": "XH", "21834": "A", "21899": "ZD", "21903": "RN", "21908": "WO", "21939": "ZC",
|
||||
"21956": "SA", "21964": "YA", "21970": "TD", "22003": "A", "22031": "JG", "22040": "XS", "22060": "ZC",
|
||||
"22066": "ZC", "22079": "MH", "22129": "XJ", "22179": "XA", "22237": "NJ", "22244": "TD", "22280": "JQ",
|
||||
"22300": "YH", "22313": "XW", "22331": "YQ", "22343": "YJ", "22351": "PH", "22395": "DC", "22412": "TD",
|
||||
"22484": "PB", "22500": "PB", "22534": "ZD", "22549": "DH", "22561": "PB", "22612": "TD", "22771": "KQ",
|
||||
"22831": "HB", "22841": "JG", "22855": "QJ", "22865": "XQ", "23013": "ML", "23081": "WM", "23487": "SX",
|
||||
"23558": "QJ", "23561": "YW", "23586": "YW", "23614": "YW", "23615": "SN", "23631": "PB", "23646": "ZS",
|
||||
"23663": "ZT", "23673": "YG", "23762": "TD", "23769": "ZS", "23780": "QJ", "23884": "QK", "24055": "XH",
|
||||
"24113": "DC", "24162": "ZC", "24191": "GA", "24273": "QJ", "24324": "NL", "24377": "TD", "24378": "QJ",
|
||||
"24439": "PF", "24554": "ZS", "24683": "TD", "24694": "WE", "24733": "LK", "24925": "TN", "25094": "ZG",
|
||||
"25100": "XQ", "25103": "XH", "25153": "PB", "25170": "PB", "25179": "KG", "25203": "PB", "25240": "ZS",
|
||||
"25282": "FB", "25303": "NA", "25324": "KG", "25341": "ZY", "25373": "WZ", "25375": "XJ", "25384": "A",
|
||||
"25457": "A", "25528": "SD", "25530": "SC", "25552": "TD", "25774": "ZC", "25874": "ZC", "26044": "YW",
|
||||
"26080": "WM", "26292": "PB", "26333": "PB", "26355": "ZY", "26366": "CZ", "26397": "ZC", "26399": "QJ",
|
||||
"26415": "ZS", "26451": "SB", "26526": "ZC", "26552": "JG", "26561": "TD", "26588": "JG", "26597": "CZ",
|
||||
"26629": "ZS", "26638": "YL", "26646": "XQ", "26653": "KG", "26657": "XJ", "26727": "HG", "26894": "ZC",
|
||||
"26937": "ZS", "26946": "ZC", "26999": "KJ", "27099": "KJ", "27449": "YQ", "27481": "XS", "27542": "ZS",
|
||||
"27663": "ZS", "27748": "TS", "27784": "SC", "27788": "ZD", "27795": "TD", "27812": "O", "27850": "PB",
|
||||
"27852": "MB", "27895": "SL", "27898": "PL", "27973": "QJ", "27981": "KH", "27986": "HX", "27994": "XJ",
|
||||
"28044": "YC", "28065": "WG", "28177": "SM", "28267": "QJ", "28291": "KH", "28337": "ZQ", "28463": "TL",
|
||||
"28548": "DC", "28601": "TD", "28689": "PB", "28805": "JG", "28820": "QG", "28846": "PB", "28952": "TD",
|
||||
"28975": "ZC", "29100": "A", "29325": "QJ", "29575": "SL", "29602": "FB", "30010": "TD", "30044": "CX",
|
||||
"30058": "PF", "30091": "YSP", "30111": "YN", "30229": "XJ", "30427": "SC", "30465": "SX", "30631": "YQ",
|
||||
"30655": "QJ", "30684": "QJG", "30707": "SD", "30729": "XH", "30796": "LG", "30917": "PB", "31074": "NM",
|
||||
"31085": "JZ", "31109": "SC", "31181": "ZC", "31192": "MLB", "31293": "JQ", "31400": "YX", "31584": "YJ",
|
||||
"31896": "ZN", "31909": "ZY", "31995": "XJ", "32321": "PF", "32327": "ZY", "32418": "HG", "32420": "XQ",
|
||||
"32421": "HG", "32438": "LG", "32473": "GJ", "32488": "TD", "32521": "QJ", "32527": "PB", "32562": "ZSQ",
|
||||
"32564": "JZ", "32735": "ZD", "32793": "PB", "33071": "PF", "33098": "XL", "33100": "YA", "33152": "PB",
|
||||
"33261": "CX", "33324": "BP", "33333": "TD", "33406": "YA", "33426": "WM", "33432": "PB", "33445": "JG",
|
||||
"33486": "ZN", "33493": "TS", "33507": "QJ", "33540": "QJ", "33544": "ZC", "33564": "XQ", "33617": "YT",
|
||||
"33632": "QJ", "33636": "XH", "33637": "YX", "33694": "WG", "33705": "PF", "33728": "YW", "33882": "SR",
|
||||
"34067": "WM", "34074": "YW", "34121": "QJ", "34255": "ZC", "34259": "XL", "34425": "JH", "34430": "XH",
|
||||
"34485": "KH", "34503": "YS", "34532": "HG", "34552": "XS", "34558": "YE", "34593": "ZL", "34660": "YQ",
|
||||
"34892": "XH", "34928": "SC", "34999": "QJ", "35048": "PB", "35059": "SC", "35098": "ZC", "35203": "TQ",
|
||||
"35265": "JX", "35299": "JX", "35782": "SZ", "35828": "YS", "35830": "E", "35843": "TD", "35895": "YG",
|
||||
"35977": "MH", "36158": "JG", "36228": "QJ", "36426": "XQ", "36466": "DC", "36710": "JC", "36711": "ZYG",
|
||||
"36767": "PB", "36866": "SK", "36951": "YW", "37034": "YX", "37063": "XH", "37218": "ZC", "37325": "ZC",
|
||||
"38063": "PB", "38079": "TD", "38085": "QY", "38107": "DC", "38116": "TD", "38123": "YD", "38224": "HG",
|
||||
"38241": "XTC", "38271": "ZC", "38415": "YE", "38426": "KH", "38461": "YD", "38463": "AE", "38466": "PB",
|
||||
"38477": "XJ", "38518": "YT", "38551": "WK", "38585": "ZC", "38704": "XS", "38739": "LJ", "38761": "GJ",
|
||||
"38808": "SQ", "39048": "JG", "39049": "XJ", "39052": "HG", "39076": "CZ", "39271": "XT", "39534": "TD",
|
||||
"39552": "TD", "39584": "PB", "39647": "SB", "39730": "LG", "39748": "TPB", "40109": "ZQ", "40479": "ND",
|
||||
"40516": "HG", "40536": "HG", "40583": "QJ", "40765": "YQ", "40784": "QJ", "40840": "YK", "40863": "QJG" };
|
||||
export function addLocalTag(info: appInfo) {
|
||||
let isZh = i18n.System.getSystemLanguage().indexOf('zh') >= 0;
|
||||
let appName: string = info.label;
|
||||
let upperCase = CommonUtils.isEmpty(appName) ? '' : appName[0].toLocaleUpperCase();
|
||||
let regexEn: RegExp = new RegExp("[A-Z]");
|
||||
let regexNm: RegExp = new RegExp("[0-9]");
|
||||
|
||||
export function appSort(appList) {
|
||||
return appList.sort((a, b) => a.sortId.localeCompare(b.sortId, 'zh-CN'))
|
||||
}
|
||||
|
||||
export function getSortId(label) {
|
||||
let pattern_Num = new RegExp("[0-9]");
|
||||
let pattern_En = new RegExp("[A-Za-z]");
|
||||
let pattern_Ch = new RegExp("[\u4E00-\u9FA5]");
|
||||
if (typeof(label) != "string") {
|
||||
return String(label);
|
||||
}
|
||||
if (pattern_Num.test(label[0])) {
|
||||
return label;
|
||||
} else if(pattern_En.test(label[0])) {
|
||||
return label.toLowerCase();
|
||||
} else if(pattern_Ch.test(label[0])) {
|
||||
return makePy(label)[0].slice(0, 1) + ' ' + label;
|
||||
} else {
|
||||
return '#' + label;
|
||||
}
|
||||
}
|
||||
|
||||
// Program that returns the first letter array of Chinese characters
|
||||
export function makePy(str) {
|
||||
if (typeof(str) != "string") str = String(str)
|
||||
var arrResult = [];
|
||||
// Convert string to array
|
||||
for (var i = 0, len = str.length; i < len; i++) {
|
||||
var ch = str.charAt(i);
|
||||
arrResult.push(checkCh(ch));
|
||||
}
|
||||
return mkRslt(arrResult);
|
||||
}
|
||||
|
||||
// Check processing Chinese characters
|
||||
function checkCh(ch) {
|
||||
var uni = ch.charCodeAt(Constants.CHAR_CODE);
|
||||
// If it is not within the scope of Chinese character processing, return the original character, and you can also call your own processing function
|
||||
if (uni > Constants.UNI_MAX || uni < Constants.UNI_MIN)
|
||||
return ch; //dealWithOthers(ch);
|
||||
// Check whether it is a polyphonic word, it is processed as a polyphonic word, if not, just find the corresponding first letter in the strChineseFirstPY string.
|
||||
return (oMultiDiff[uni] ? oMultiDiff[uni] : (strChineseFirstPY.charAt(uni - Constants.UNI_MIN)));
|
||||
}
|
||||
|
||||
// Process the characters and return an array of letters
|
||||
function mkRslt(arr) {
|
||||
var arrRslt = [""];
|
||||
for (var i = 0, len = arr.length; i < len; i++) {
|
||||
var str = arr[i];
|
||||
var strlen = str.length;
|
||||
if (strlen == 1) {
|
||||
for (var k = 0; k < arrRslt.length; k++) {
|
||||
arrRslt[k] += str;
|
||||
}
|
||||
if (isZh) {
|
||||
if (upperCase.match(regexEn)) {
|
||||
info.zhTag = BundleInfoUtils.getStringZh(appName);
|
||||
info.indexTag = upperCase;
|
||||
info.language = 'EN';
|
||||
} else {
|
||||
var tmpArr = arrRslt.slice(0);
|
||||
arrRslt = [];
|
||||
for (k = 0; k < strlen; k++) {
|
||||
// Copy an identical arrRslt
|
||||
var tmp = tmpArr.slice(0);
|
||||
// Add the current character str[k] to the end of each element
|
||||
for (var j = 0; j < tmp.length; j++) {
|
||||
tmp[j] += str.charAt(k);
|
||||
}
|
||||
// Concatenate the copied and modified array to arrRslt
|
||||
arrRslt = arrRslt.concat(tmp);
|
||||
info.zhTag = appName;
|
||||
info.language = 'CN';
|
||||
if (upperCase.match(regexNm)) {
|
||||
info.indexTag = '#';
|
||||
} else {
|
||||
info.indexTag = BundleInfoUtils.findZhIndex(upperCase);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (upperCase.match(regexEn)) {
|
||||
info.zhTag = appName;
|
||||
info.indexTag = upperCase;
|
||||
info.language = 'EN';
|
||||
} else {
|
||||
info.zhTag = appName;
|
||||
info.indexTag = '#';
|
||||
info.language = 'CN';
|
||||
}
|
||||
}
|
||||
return arrRslt;
|
||||
}
|
||||
|
||||
let enComparator = new Intl.Collator('en');
|
||||
let zhComparator = new Intl.Collator('zh-Hans-CN');
|
||||
|
||||
export function sortByName(appArray: Array<appInfo | ApplicationObj>): Array<appInfo | ApplicationObj> {
|
||||
return appArray.sort((item1: appInfo | ApplicationObj, item2: appInfo | ApplicationObj) => {
|
||||
if (item1.indexTag !== item2.indexTag) {
|
||||
return enComparator.compare(item1.indexTag, item2.indexTag);
|
||||
}
|
||||
|
||||
let isEn1 = item1.language === 'EN';
|
||||
let isEn2 = item2.language === 'EN';
|
||||
|
||||
if (isEn1 && isEn2) {
|
||||
return enComparator.compare(item1.label, item2.label);
|
||||
} else if (isEn1 && !isEn2) {
|
||||
return 1;
|
||||
} else if (!isEn1 && isEn2) {
|
||||
return -1;
|
||||
} else {
|
||||
return zhComparator.compare(item1.zhTag, item2.zhTag);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get permission label
|
||||
* @param {String} permission name
|
||||
*/
|
||||
export function getPermissionLabel(permission: string) {
|
||||
for (var i = 0; i < permissionGroups.length; i++) {
|
||||
export function getPermissionLabel(permission: string): ResourceStr {
|
||||
for (let i = 0; i < permissionGroups.length; i++) {
|
||||
if (permissionGroups[i].permissionName == permission) {
|
||||
return permissionGroups[i].label
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the corresponding permission group id according to the permission
|
||||
* @param {String} permission app name id
|
||||
* @return {Number} groupId
|
||||
* @return {GroupInfo} group
|
||||
*/
|
||||
export function getPermissionGroup(permission: string) {
|
||||
for (var i = 0; i < permissionGroups.length; i++) {
|
||||
export function getPermissionGroup(permission: string): GroupInfo {
|
||||
for (let i = 0; i < permissionGroups.length; i++) {
|
||||
if (permissionGroups[i].permissionName == permission) {
|
||||
if (permissionGroups[i].groupName == 'OTHER') {
|
||||
return {
|
||||
"name": permissionGroups[i].groupName,
|
||||
"groupName": permissionGroups[i].label,
|
||||
"label": permissionGroups[i].text,
|
||||
"icon": permissionGroups[i].icon,
|
||||
"description": '',
|
||||
"permissions": [
|
||||
permissionGroups[i].permissionName
|
||||
]
|
||||
}
|
||||
} else {
|
||||
return groups[permissionGroups[i].groupId];
|
||||
}
|
||||
return groups[permissionGroups[i].groupId];
|
||||
}
|
||||
}
|
||||
return groups[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a permission group by its name
|
||||
* @param {String} group name
|
||||
* @return {GroupInfo} group
|
||||
*/
|
||||
export function getPermissionGroupByName(name: string): GroupInfo {
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
if (groups[i].name === name) {
|
||||
return groups[i];
|
||||
}
|
||||
}
|
||||
return groups[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the permission group ID by permission name
|
||||
* @param {String} permission name
|
||||
* @return {number} groupId
|
||||
*/
|
||||
export function getGroupIdByPermission(permission: string): number {
|
||||
for (let i = 0; i < permissionGroups.length; i++) {
|
||||
if (permissionGroups[i].permissionName === permission) {
|
||||
return permissionGroups[i].groupId;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const TAG = 'PermissionManager_Log';
|
||||
|
||||
export class Log {
|
||||
static info(log) {
|
||||
static info(log: string) {
|
||||
console.info(`Info: ${TAG} ${log}`);
|
||||
}
|
||||
|
||||
static error(log) {
|
||||
static error(log: string) {
|
||||
console.error(`Error: ${TAG} ${log}`);
|
||||
}
|
||||
}
|
@ -15,62 +15,34 @@
|
||||
|
||||
import { backBar } from "../common/components/backBar";
|
||||
import router from '@ohos.router';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import { groups, permissionGroups, userGrantPermissions, permissionGroupIds } from "../common/model/permissionGroup";
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { groups, userGrantPermissions } from "../common/model/permissionGroup";
|
||||
import Constants from '../common/utils/constant';
|
||||
import { verifyAccessToken } from "../common/utils/utils";
|
||||
import { verifyAccessToken, getGroupIdByPermission } from "../common/utils/utils";
|
||||
import { permissionObj, appInfo } from '../common/utils/typedef';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
const allowedStatus = 0; // Status: Allowed
|
||||
const bannedStatus = 1; // Status: Banned
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
class permissionObj {
|
||||
groupName: string;
|
||||
permission: string[];
|
||||
group: string;
|
||||
constructor(groupName: string, permission: string[], group: string) {
|
||||
this.groupName = groupName;
|
||||
this.permission = permission;
|
||||
this.group = group
|
||||
}
|
||||
}
|
||||
|
||||
class ResourceObj {
|
||||
bundleName: string
|
||||
api: number
|
||||
tokenId: string
|
||||
icon: string
|
||||
iconId: string
|
||||
label: string
|
||||
labelId: string
|
||||
permissions: Array<any>
|
||||
groupId: Array<any>
|
||||
constructor(bundleName: string, api: number, tokenId: string, icon: string, iconId: string, label: string, labelId: string, permissions: Array<any>, groupId: Array<any>) {
|
||||
this.bundleName = bundleName
|
||||
this.api = api
|
||||
this.tokenId = tokenId
|
||||
this.icon = icon
|
||||
this.iconId = iconId
|
||||
this.label = label
|
||||
this.labelId = labelId
|
||||
this.permissions = permissions
|
||||
this.groupId = groupId
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct appNamePlusPage {
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@State allowedListItem: permissionObj[] = []; // Array of allowed permissions
|
||||
@State bannedListItem: permissionObj[] = []; // array of forbidden permissions
|
||||
@State routerData: ResourceObj = globalThis.applicationInfo; // Routing jump data
|
||||
@State applicationInfo: appInfo = GlobalContext.load('applicationInfo'); // Routing jump data
|
||||
@State bundleName: string = GlobalContext.load('bundleName');
|
||||
@State label: string = '';
|
||||
@State isTouch: string = '';
|
||||
|
||||
@Builder ListItemLayout(item, status) {
|
||||
@Builder ListItemLayout(item: permissionObj, status: number) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -91,15 +63,15 @@ struct appNamePlusPage {
|
||||
.height(Constants.LISTITEM_ROW_HEIGHT)
|
||||
}
|
||||
}.onClick(() => {
|
||||
globalThis.currentPermissionGroup = item.group
|
||||
GlobalContext.store('currentPermissionGroup', item.group);
|
||||
router.pushUrl({
|
||||
url: item.group == "OTHER" ? 'pages/other-permissions' : 'pages/application-tertiary',
|
||||
params: {
|
||||
routerData: this.routerData.bundleName,
|
||||
bundleName: this.applicationInfo.bundleName,
|
||||
backTitle: item.groupName,
|
||||
permission: item.permission,
|
||||
status: !status ? allowedStatus : bannedStatus,
|
||||
tokenId: this.routerData.tokenId
|
||||
tokenId: this.applicationInfo.tokenId
|
||||
}
|
||||
});
|
||||
})
|
||||
@ -115,7 +87,10 @@ struct appNamePlusPage {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = item.group;
|
||||
}
|
||||
@ -125,14 +100,11 @@ struct appNamePlusPage {
|
||||
})
|
||||
}
|
||||
|
||||
async initApplicationInfo(info) {
|
||||
async initApplicationInfo(info: appInfo) {
|
||||
console.info(TAG + `labelId: ` + JSON.stringify(info.labelId));
|
||||
let resourceManager = globalThis.context.resourceManager;
|
||||
if (!info.labelId.id) {
|
||||
resourceManager = globalThis.context.createBundleContext(info.bundleName).resourceManager;
|
||||
}
|
||||
let resourceManager = this.context.createBundleContext(info.bundleName).resourceManager;
|
||||
|
||||
resourceManager.getString(info.labelId, (error, value) => {
|
||||
resourceManager.getStringValue(info.labelId, (error, value) => {
|
||||
info.label = value;
|
||||
})
|
||||
|
||||
@ -142,18 +114,20 @@ struct appNamePlusPage {
|
||||
} catch (error) {
|
||||
console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`);
|
||||
}
|
||||
if (!info.icon) {
|
||||
let icon = info.icon;
|
||||
if (!icon) {
|
||||
info.icon = await resourceManager.getMediaContentBase64(info.iconId);
|
||||
}
|
||||
if (!info.icon) {
|
||||
let icon1 = info.icon;
|
||||
if (!icon1) {
|
||||
info.icon = $r('app.media.icon');
|
||||
}
|
||||
|
||||
var reqUserPermissions: string[] = [];
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
let reqUserPermissions: Permissions[] = [];
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
if (info.permissions.length > 0) {
|
||||
for (let j = 0; j < info.permissions.length; j++) {
|
||||
var permission = info.permissions[j];
|
||||
let permission = info.permissions[j];
|
||||
if (userGrantPermissions.indexOf(permission) == -1) {
|
||||
continue;
|
||||
}
|
||||
@ -161,7 +135,7 @@ struct appNamePlusPage {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
var flag = await acManager.getPermissionFlags(info.tokenId, permission);
|
||||
let flag = await acManager.getPermissionFlags(info.tokenId, permission);
|
||||
if (flag == Constants.PERMISSION_SYSTEM_FIXED) {
|
||||
continue;
|
||||
}
|
||||
@ -172,10 +146,11 @@ struct appNamePlusPage {
|
||||
reqUserPermissions.push(permission);
|
||||
}
|
||||
}
|
||||
let groupIds = [];
|
||||
let groupIds: number[] = [];
|
||||
for (let i = 0; i < reqUserPermissions.length; i++) {
|
||||
if (groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1) {
|
||||
groupIds.push(permissionGroupIds[reqUserPermissions[i]]);
|
||||
let groupId = getGroupIdByPermission(reqUserPermissions[i])
|
||||
if (groupIds.indexOf(groupId) == -1) {
|
||||
groupIds.push(groupId);
|
||||
}
|
||||
}
|
||||
info.permissions = reqUserPermissions;
|
||||
@ -186,11 +161,11 @@ struct appNamePlusPage {
|
||||
* Initialize permission status information and group permission information
|
||||
*/
|
||||
async initialPermissions() {
|
||||
if (globalThis.bundleName && !this.routerData.groupId.length) {
|
||||
await this.initApplicationInfo(this.routerData);
|
||||
if (this.bundleName && !this.applicationInfo.groupId.length) {
|
||||
await this.initApplicationInfo(this.applicationInfo);
|
||||
}
|
||||
var reqPermissions = this.routerData.permissions;
|
||||
var reqGroupIds = this.routerData.groupId;
|
||||
let reqPermissions = this.applicationInfo.permissions;
|
||||
let reqGroupIds = this.applicationInfo.groupId;
|
||||
|
||||
this.allowedListItem = [];
|
||||
this.bannedListItem = [];
|
||||
@ -199,7 +174,7 @@ struct appNamePlusPage {
|
||||
let id = reqGroupIds[i];
|
||||
let groupName = groups[id].groupName;
|
||||
let group = groups[id].name;
|
||||
let groupReqPermissons = [];
|
||||
let groupReqPermissons: Permissions[] = [];
|
||||
for (let j = 0; j < reqPermissions.length; j++) {
|
||||
let permission = reqPermissions[j];
|
||||
if (groups[id].permissions.indexOf(permission) != -1) {
|
||||
@ -209,10 +184,10 @@ struct appNamePlusPage {
|
||||
let isGranted = true;
|
||||
for (let i = 0; i < groupReqPermissons.length; i++) {
|
||||
let permission = groupReqPermissons[i];
|
||||
if (this.routerData.api >= Constants.API_VERSION_SUPPORT_STAGE && permission == PRECISE_LOCATION_PERMISSION) {
|
||||
if (this.applicationInfo.api >= Constants.API_VERSION_SUPPORT_STAGE && permission == PRECISE_LOCATION_PERMISSION) {
|
||||
continue;
|
||||
}
|
||||
let res = await verifyAccessToken(this.routerData.tokenId, permission);
|
||||
let res = await verifyAccessToken(this.applicationInfo.tokenId, permission);
|
||||
if (res != abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
|
||||
isGranted = false;
|
||||
}
|
||||
@ -232,15 +207,16 @@ struct appNamePlusPage {
|
||||
onPageShow() {
|
||||
console.log(TAG + 'onPageShow application-secondary');
|
||||
this.initialPermissions();
|
||||
bundleManager.getApplicationInfo(globalThis.applicationInfo.bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(appInfo => {
|
||||
let bundleContext = globalThis.context.createBundleContext(globalThis.applicationInfo.bundleName)
|
||||
bundleManager.getApplicationInfo(this.applicationInfo.bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(appInfo => {
|
||||
let bundleContext = this.context.createBundleContext(this.applicationInfo.bundleName)
|
||||
bundleContext.resourceManager.getStringValue(appInfo.labelId, (error, value) => {
|
||||
if (value) {
|
||||
globalThis.applicationInfo.label = value;
|
||||
this.applicationInfo.label = value;
|
||||
GlobalContext.store('applicationInfo', this.applicationInfo);
|
||||
this.label = value
|
||||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
}).catch((error: BusinessError) => {
|
||||
console.error(TAG + 'getApplicationInfo error: ' + JSON.stringify(error));
|
||||
})
|
||||
}
|
||||
@ -254,7 +230,7 @@ struct appNamePlusPage {
|
||||
Row() {
|
||||
Column() {
|
||||
Row() {
|
||||
backBar({ title: JSON.stringify(this.label || this.routerData.label), recordable: false })
|
||||
backBar({ title: JSON.stringify(this.label || this.applicationInfo.label), recordable: false })
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
@ -309,9 +285,9 @@ struct appNamePlusPage {
|
||||
ListItem() {
|
||||
Row() {
|
||||
List() {
|
||||
ForEach(this.allowedListItem, (item) => {
|
||||
ForEach(this.allowedListItem, (item: permissionObj) => {
|
||||
this.ListItemLayout(item, Constants.RADIO_ALLOW_INDEX)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: permissionObj) => JSON.stringify(item))
|
||||
}
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
@ -346,9 +322,9 @@ struct appNamePlusPage {
|
||||
ListItem() {
|
||||
Row() {
|
||||
List() {
|
||||
ForEach(this.bannedListItem, (item) => {
|
||||
ForEach(this.bannedListItem, (item: permissionObj) => {
|
||||
this.ListItemLayout(item, Constants.RADIO_BAN_INDEX)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: permissionObj) => JSON.stringify(item))
|
||||
}
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
|
@ -15,42 +15,32 @@
|
||||
|
||||
import { backBar } from "../common/components/backBar";
|
||||
import router from '@ohos.router';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import { authorizeDialog } from "../common/components/dialog";
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { showSubpermissionsGrop } from "../common/model/permissionGroup";
|
||||
import { verifyAccessToken, getPermissionLabel } from "../common/utils/utils";
|
||||
import Constants from '../common/utils/constant';
|
||||
import { MediaDocObj, routerParams_3, appInfo } from '../common/utils/typedef';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
|
||||
let routerData: any = router.getParams()['routerData']; // Routing jump data
|
||||
let backTitle: any = router.getParams()['backTitle']; // return title name
|
||||
let status = router.getParams()['status']; // Status: Allowed, Forbidden
|
||||
let permissions: any = router.getParams()['permission']; // permissions name
|
||||
let tokenId: any = router.getParams()['tokenId']; // tokenId for verify permission
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
let api: number = 0;
|
||||
let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now
|
||||
let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results
|
||||
let GrantResultFlag = []; // Authorization result Flag
|
||||
let RevokeResultFlag = []; // Cancel authorization result Flag
|
||||
let bundleInfo: any = {};
|
||||
let reqPermissionInfo;
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
class MeidaDocObj {
|
||||
name: Resource
|
||||
accessTokenId: number
|
||||
permissions: []
|
||||
constructor(name: Resource, accessTokenId: number, permissions: []) {
|
||||
this.name = name
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permissions = permissions
|
||||
}
|
||||
}; // permission information class
|
||||
let GrantResultFlag: number[] = []; // Authorization result Flag
|
||||
let RevokeResultFlag: number[] = []; // Cancel authorization result Flag
|
||||
let accessTokenId: number = 0;
|
||||
let reqPermissionInfo: bundleManager.ReqPermissionDetail;
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
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 refresh: boolean = false;
|
||||
@State isCheckList: boolean[] = []; // Permission status array
|
||||
@State isRefreshReason: number = 0
|
||||
@ -64,7 +54,7 @@ struct mediaDocumentPage {
|
||||
Row() {
|
||||
Column() {
|
||||
Row() {
|
||||
backBar({ title: JSON.stringify(backTitle), recordable: false })
|
||||
backBar({ title: JSON.stringify(this.backTitle), recordable: false })
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
@ -93,12 +83,12 @@ struct mediaDocumentPage {
|
||||
this.isRefreshReason ++;
|
||||
console.log(TAG + 'Refresh permission status');
|
||||
let isGranted = true;
|
||||
for (let i = 0; i < permissions.length; i++) {
|
||||
let permission = permissions[i];
|
||||
for (let i = 0; i < this.permissions.length; i++) {
|
||||
let permission = this.permissions[i];
|
||||
if (api >= Constants.API_VERSION_SUPPORT_STAGE && permission == PRECISE_LOCATION_PERMISSION) {
|
||||
continue;
|
||||
}
|
||||
let res = await verifyAccessToken(tokenId, permission);
|
||||
let res = await verifyAccessToken(this.tokenId, permission);
|
||||
if (res != abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
|
||||
isGranted = false;
|
||||
}
|
||||
@ -115,7 +105,14 @@ struct mediaDocumentPage {
|
||||
|
||||
@Component
|
||||
struct mediaDocumentItem {
|
||||
@State mediaDocListItem: MeidaDocObj[] = []; // Permission information array
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_3).backTitle;
|
||||
private bundleName: string = (router.getParams() as routerParams_3).bundleName;
|
||||
private permissions: Permissions[] = (router.getParams() as routerParams_3).permission;
|
||||
private status: number = (router.getParams() as routerParams_3).status;
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@State applicationInfo: appInfo = GlobalContext.load('applicationInfo');
|
||||
@State mediaDocListItem: MediaDocObj[] = []; // Permission information array
|
||||
@Link isCheckList: boolean[]; // Permission status array
|
||||
@State accurateIsOn: boolean = true;
|
||||
@State api: number = 0;
|
||||
@ -124,26 +121,20 @@ struct mediaDocumentItem {
|
||||
@State reason: string = '';
|
||||
@State label: string = '';
|
||||
@State version: string = '';
|
||||
@State permissionLabels: Array<any> = [];
|
||||
@State permissionLabels: Array<ResourceStr> = [];
|
||||
@Link @Watch("updateReason") isRefreshReason: number;
|
||||
|
||||
authorizeDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: authorizeDialog({ }),
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Center
|
||||
});
|
||||
|
||||
/**
|
||||
* Grant permissions to the app
|
||||
* @param {Number} accessTokenId
|
||||
* @param {String} permission permission name
|
||||
*/
|
||||
grantUserGrantedPermission(accessTokenId, permission) {
|
||||
grantUserGrantedPermission(accessTokenId: number, permission: Permissions) {
|
||||
abilityAccessCtrl.createAtManager().grantUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG)
|
||||
.then(() => {
|
||||
nowGrantResult = Constants.PERMISSION_INDEX;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: BusinessError) => {
|
||||
console.error(TAG + 'grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
}
|
||||
@ -153,12 +144,12 @@ struct mediaDocumentItem {
|
||||
* @param {Number} accessTokenId
|
||||
* @param {String} permission permission name
|
||||
*/
|
||||
revokeUserGrantedPermission(accessTokenId, permission) {
|
||||
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG)
|
||||
.then(() => {
|
||||
nowRevokeResult = Constants.PERMISSION_INDEX;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: BusinessError) => {
|
||||
console.error(TAG + 'revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
}
|
||||
@ -167,18 +158,19 @@ struct mediaDocumentItem {
|
||||
* Update reason
|
||||
*/
|
||||
updateReason() {
|
||||
bundleManager.getApplicationInfo(globalThis.applicationInfo.bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(appInfo => {
|
||||
let bundleContext = globalThis.context.createBundleContext(routerData)
|
||||
bundleManager.getApplicationInfo(this.applicationInfo.bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(appInfo => {
|
||||
let bundleContext = this.context.createBundleContext(this.bundleName)
|
||||
bundleContext.resourceManager.getStringValue(appInfo.labelId, (error, value) => {
|
||||
if (value) {
|
||||
globalThis.applicationInfo.label = value;
|
||||
this.applicationInfo.label = value;
|
||||
GlobalContext.store('applicationInfo', this.applicationInfo);
|
||||
this.label = value
|
||||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
}).catch((error: BusinessError) => {
|
||||
console.error(TAG + 'getApplicationInfo error: ' + JSON.stringify(error));
|
||||
})
|
||||
let context = globalThis.context.createModuleContext(routerData, reqPermissionInfo.moduleName);
|
||||
let context = this.context.createModuleContext(this.bundleName, reqPermissionInfo.moduleName);
|
||||
context.resourceManager.getString(reqPermissionInfo.reasonId).then(value => {
|
||||
if (value !== undefined) {
|
||||
this.reason = value.slice(Constants.START_SUBSCRIPT, Constants.END_SUBSCRIPT);
|
||||
@ -190,8 +182,9 @@ struct mediaDocumentItem {
|
||||
* Lifecycle function, executed when the page is initialized
|
||||
*/
|
||||
aboutToAppear() {
|
||||
if (showSubpermissionsGrop.indexOf(globalThis.currentPermissionGroup) != -1) {
|
||||
permissions.forEach((permission, idx) => {
|
||||
this.label = this.applicationInfo.label;
|
||||
if (showSubpermissionsGrop.indexOf(this.currentGroup) != -1) {
|
||||
this.permissions.forEach((permission, idx) => {
|
||||
if (idx > 0) {
|
||||
this.permissionLabels.push($r("app.string.and"))
|
||||
}
|
||||
@ -200,12 +193,12 @@ struct mediaDocumentItem {
|
||||
})
|
||||
}
|
||||
let hasReason = false;
|
||||
bundleManager.getBundleInfo(routerData, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(info => {
|
||||
permissions.forEach(permission => {
|
||||
bundleManager.getBundleInfo(this.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(info => {
|
||||
this.permissions.forEach(permission => {
|
||||
info.reqPermissionDetails.forEach(reqPermissionDetail => {
|
||||
if (reqPermissionDetail.name == permission) {
|
||||
console.info("reqPermissionDetail: " + JSON.stringify(reqPermissionDetail));
|
||||
let context = globalThis.context.createModuleContext(routerData, reqPermissionDetail.moduleName);
|
||||
let context = this.context.createModuleContext(this.bundleName, reqPermissionDetail.moduleName);
|
||||
context.resourceManager.getString(reqPermissionDetail.reasonId).then(value => {
|
||||
if (value !== undefined && !hasReason) {
|
||||
this.reason = value.slice(Constants.START_SUBSCRIPT, Constants.END_SUBSCRIPT);
|
||||
@ -217,16 +210,16 @@ struct mediaDocumentItem {
|
||||
})
|
||||
})
|
||||
})
|
||||
bundleManager.getBundleInfo(routerData, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then(res => {
|
||||
bundleManager.getBundleInfo(this.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then(res => {
|
||||
this.api = res.targetVersion;
|
||||
this.version = res.versionName;
|
||||
api = res.targetVersion;
|
||||
bundleInfo = res;
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
accessTokenId = res.appInfo.accessTokenId;
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
let accurateStatus = acManager.verifyAccessTokenSync(res.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION);
|
||||
this.accurateIsOn = (accurateStatus == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) ? true : false;
|
||||
try {
|
||||
acManager.getPermissionFlags(res.appInfo.accessTokenId, permissions[0]).then((data) => {
|
||||
acManager.getPermissionFlags(res.appInfo.accessTokenId, this.permissions[0]).then((data) => {
|
||||
console.log(TAG + `getPermissionFlags success, data->${JSON.stringify(data)}`);
|
||||
this.isRisk = (data == Constants.PERMISSION_POLICY_FIXED) ? true : false;
|
||||
})
|
||||
@ -234,22 +227,22 @@ struct mediaDocumentItem {
|
||||
console.log(TAG + 'acManager.getPermissionFlags failed. Cause: ' + JSON.stringify(err));
|
||||
}
|
||||
this.mediaDocListItem.push(
|
||||
new MeidaDocObj($r('app.string.allow'), res.appInfo.accessTokenId, permissions)
|
||||
new MediaDocObj($r('app.string.allow'), res.appInfo.accessTokenId, this.permissions, 0)
|
||||
);
|
||||
this.mediaDocListItem.push(
|
||||
new MeidaDocObj($r('app.string.ban'), res.appInfo.accessTokenId, permissions)
|
||||
new MediaDocObj($r('app.string.ban'), res.appInfo.accessTokenId, this.permissions, 1)
|
||||
);
|
||||
}).catch((error) => {
|
||||
}).catch((error: BusinessError) => {
|
||||
console.error(TAG + 'bundle.getBundleInfo failed. Cause: ' + JSON.stringify(error));
|
||||
this.mediaDocListItem.push(
|
||||
new MeidaDocObj($r('app.string.allow'), 0, permissions)
|
||||
new MediaDocObj($r('app.string.allow'), 0, this.permissions, 0)
|
||||
);
|
||||
this.mediaDocListItem.push(
|
||||
new MeidaDocObj($r('app.string.ban'), 0, permissions)
|
||||
new MediaDocObj($r('app.string.ban'), 0, this.permissions, 1)
|
||||
);
|
||||
})
|
||||
// Get permission status
|
||||
if (!status) {
|
||||
if (!this.status) {
|
||||
this.isCheckList = [true, false];
|
||||
} else {
|
||||
this.isCheckList = [false, true];
|
||||
@ -260,13 +253,13 @@ struct mediaDocumentItem {
|
||||
Column() {
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Image(globalThis.applicationInfo.icon)
|
||||
Image(this.applicationInfo.icon)
|
||||
.width(Constants.TERTIARY_IMAGE_WIDTH)
|
||||
.height(Constants.TERTIARY_IMAGE_HEIGHT)
|
||||
.margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT })
|
||||
Column() {
|
||||
Row() {
|
||||
Text(this.label || globalThis.applicationInfo.label)
|
||||
Text(this.label)
|
||||
.maxLines(Constants.MAXIMUM_HEADER_LINES)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontSize(Constants.TEXT_MIDDLE_FONT_SIZE)
|
||||
@ -296,7 +289,7 @@ struct mediaDocumentItem {
|
||||
Row() {
|
||||
Text() {
|
||||
if (this.permissionLabels.length > 0) {
|
||||
ForEach(this.permissionLabels, item => {
|
||||
ForEach(this.permissionLabels, (item: ResourceStr) => {
|
||||
Span(item)
|
||||
})
|
||||
Span(this.reason ? $r("app.string.comma") : $r("app.string.period"))
|
||||
@ -333,7 +326,7 @@ struct mediaDocumentItem {
|
||||
}
|
||||
Row() {
|
||||
Text() {
|
||||
Span(backTitle)
|
||||
Span(this.backTitle)
|
||||
Span($r('app.string.access_permission'))
|
||||
}
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
@ -347,7 +340,7 @@ struct mediaDocumentItem {
|
||||
left: Constants.TERTIARY_TEXT_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT})
|
||||
Column() {
|
||||
List() {
|
||||
ForEach(this.mediaDocListItem, (item, index) => {
|
||||
ForEach(this.mediaDocListItem, (item: MediaDocObj) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
@ -358,14 +351,17 @@ struct mediaDocumentItem {
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.flexGrow(Constants.FLEX_GROW)
|
||||
Radio({ value: 'Radio', group: 'radioGroup' }).checked(this.isCheckList[index]).touchable(false)
|
||||
Radio({ value: 'Radio', group: 'radioGroup' })
|
||||
.checked(this.isCheckList[item.index])
|
||||
.touchable(false)
|
||||
.height(Constants.SHAPE_DIA)
|
||||
.width(Constants.SHAPE_DIA)
|
||||
}
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.LISTITEM_ROW_HEIGHT)
|
||||
.onClick(() => {
|
||||
item.permissions.forEach((permission) => {
|
||||
let index = item.index;
|
||||
item.permissions.forEach((permission): boolean => {
|
||||
if (!index) {
|
||||
if ((this.api >= Constants.API_VERSION_SUPPORT_STAGE) && (permission == PRECISE_LOCATION_PERMISSION)) {
|
||||
return false;
|
||||
@ -388,31 +384,18 @@ struct mediaDocumentItem {
|
||||
|
||||
if (nowRevokeResult != Constants.PERMISSION_INDEX) {
|
||||
RevokeResultFlag.push(-1);
|
||||
this.authorizeDialogController.open();
|
||||
setTimeout(()=> {
|
||||
this.authorizeDialogController.close();
|
||||
}, Constants.DELAY_TIME)
|
||||
} else {
|
||||
RevokeResultFlag.push(0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
if (!index) {
|
||||
if (GrantResultFlag.indexOf(-1) > -1) {
|
||||
this.authorizeDialogController.open();
|
||||
setTimeout(()=> {
|
||||
this.authorizeDialogController.close();
|
||||
}, Constants.DELAY_TIME)
|
||||
} else {
|
||||
if (GrantResultFlag.indexOf(-1) <= -1) {
|
||||
this.isCheckList = [true, false];
|
||||
}
|
||||
} else {
|
||||
if (RevokeResultFlag.indexOf(-1) > -1) {
|
||||
this.authorizeDialogController.open();
|
||||
setTimeout(()=> {
|
||||
this.authorizeDialogController.close();
|
||||
}, Constants.DELAY_TIME)
|
||||
} else {
|
||||
if (RevokeResultFlag.indexOf(-1) <= -1) {
|
||||
this.isCheckList = [false, true];
|
||||
}
|
||||
}
|
||||
@ -423,7 +406,7 @@ struct mediaDocumentItem {
|
||||
}
|
||||
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
|
||||
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
|
||||
.linearGradient((this.isTouch === index) ? {
|
||||
.linearGradient((this.isTouch === item.index) ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
|
||||
@ -432,16 +415,19 @@ struct mediaDocumentItem {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = index;
|
||||
this.isTouch = item.index;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouch = -1;
|
||||
}
|
||||
})
|
||||
.margin({ top: Constants.TERTIARY_LISTITEM_MARGIN_TOP })
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: MediaDocObj) => JSON.stringify(item))
|
||||
}
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
@ -453,7 +439,7 @@ struct mediaDocumentItem {
|
||||
endMargin: Constants.DEFAULT_MARGIN_END
|
||||
})
|
||||
|
||||
if ((this.api >= Constants.API_VERSION_SUPPORT_STAGE) && (permissions.includes(PRECISE_LOCATION_PERMISSION))) {
|
||||
if ((this.api >= Constants.API_VERSION_SUPPORT_STAGE) && (this.permissions.includes(PRECISE_LOCATION_PERMISSION))) {
|
||||
Column() {
|
||||
Row() {
|
||||
Text($r('app.string.precise_location'))
|
||||
@ -465,12 +451,12 @@ struct mediaDocumentItem {
|
||||
.selectedColor($r('sys.color.ohos_id_color_toolbar_icon_actived'))
|
||||
.switchPointColor($r('sys.color.ohos_id_color_foreground_contrary'))
|
||||
.onChange((isOn: boolean) => {
|
||||
var acManager = abilityAccessCtrl.createAtManager()
|
||||
let acManager = abilityAccessCtrl.createAtManager()
|
||||
if (isOn) {
|
||||
acManager.grantUserGrantedPermission(bundleInfo.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG)
|
||||
acManager.grantUserGrantedPermission(accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG)
|
||||
.then(() => { this.accurateIsOn = true })
|
||||
} else {
|
||||
acManager.revokeUserGrantedPermission(bundleInfo.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG)
|
||||
acManager.revokeUserGrantedPermission(accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG)
|
||||
.then(() => { this.accurateIsOn = false })
|
||||
}
|
||||
})
|
||||
|
@ -17,17 +17,22 @@ import { backBar } from "../common/components/backBar";
|
||||
import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex";
|
||||
import { textInput } from "../common/components/search";
|
||||
import router from '@ohos.router';
|
||||
import bundle from "@ohos.bundle.bundleManager";
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import audio from '@ohos.multimedia.audio'
|
||||
import camera from '@ohos.multimedia.camera'
|
||||
import display from '@ohos.display';
|
||||
import { groups, userGrantPermissions, permissionGroupPermissions, globalGroup } from "../common/model/permissionGroup";
|
||||
import { permissionGroups, permissionGroupIds, showSubpermissionsGrop } from "../common/model/permissionGroup";
|
||||
import { makePy, appSort, getSortId, indexValue } from "../common/utils/utils";
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { groups, userGrantPermissions, globalGroup, permissionGroups, showSubpermissionsGrop } from "../common/model/permissionGroup";
|
||||
import { indexValue, getPermissionGroupByName, getGroupIdByPermission, addLocalTag, sortByName } from "../common/utils/utils";
|
||||
import { appInfo, permissionApplications, groupPermission, GroupInfo } from "../common/utils/typedef";
|
||||
import { GlobalContext } from "../common/utils/globalContext";
|
||||
import Constants from '../common/utils/constant';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
let storage = LocalStorage.getShared();
|
||||
|
||||
@Extend(Image) function customizeImage(width: number, height: number) {
|
||||
.objectFit(ImageFit.Contain)
|
||||
@ -35,42 +40,10 @@ var TAG = 'PermissionManager_MainAbility:';
|
||||
.height(height)
|
||||
};
|
||||
|
||||
interface applicationPermissions {
|
||||
'bundleName': string,
|
||||
'api': number,
|
||||
'icon': ResourceStr | PixelMap,
|
||||
'iconId': string,
|
||||
'permissions': string[],
|
||||
'label': string,
|
||||
'labelId': string,
|
||||
'tokenId': number,
|
||||
'groupId': number[],
|
||||
'sortId': string,
|
||||
'alphabeticalIndex': string
|
||||
};
|
||||
|
||||
interface permissionApplications {
|
||||
'permission': string,
|
||||
'groupName': string,
|
||||
'bundleNames': string[],
|
||||
'icon': string
|
||||
};
|
||||
|
||||
interface groupPermission {
|
||||
'group': string,
|
||||
'permissions': string[],
|
||||
'groupName': string,
|
||||
'icon': string,
|
||||
'isShow':boolean
|
||||
};
|
||||
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
|
||||
@Entry
|
||||
@Entry(storage)
|
||||
@Component
|
||||
struct authorityManagementPage {
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: groupPermission) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -96,40 +69,41 @@ struct authorityManagementPage {
|
||||
if (item.group === 'OTHER' || showSubpermissionsGrop.indexOf(item.group) !== -1) {
|
||||
router.pushUrl({
|
||||
url: 'pages/authority-secondary',
|
||||
params: { routerData: this.allPermissionApplications, backTitle: item.groupName, group: item.group }
|
||||
params: { list: this.allPermissionApplications, backTitle: item.groupName, group: item.group }
|
||||
})
|
||||
} else {
|
||||
var dataList = this.allPermissionApplications.filter((ele) => {
|
||||
let dataList = this.allPermissionApplications.filter((ele) => {
|
||||
return ele.groupName === item.group;
|
||||
})
|
||||
|
||||
globalThis.currentPermissionGroup = item.group;
|
||||
GlobalContext.store('currentPermissionGroup', item.group);
|
||||
if (globalGroup.indexOf(item.group) == -1) {
|
||||
router.pushUrl({
|
||||
url: 'pages/authority-tertiary-groups',
|
||||
params: { routerData: dataList, backTitle: item.groupName }
|
||||
params: { list: dataList, backTitle: item.groupName }
|
||||
})
|
||||
} else {
|
||||
if (item.group == 'MICROPHONE') {
|
||||
var audioManager = audio.getAudioManager();
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
audioVolumeGroupManager.isMicrophoneMute().then(value => {
|
||||
globalThis.ismutesuppotred = true;
|
||||
GlobalContext.store('isMuteSupported', true);
|
||||
router.pushUrl({
|
||||
url: 'pages/authority-tertiary-groups',
|
||||
params: { routerData: dataList, backTitle: item.groupName, globalIsOn: !value }
|
||||
params: { list: dataList, backTitle: item.groupName, globalIsOn: !value }
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
let cameraManager = camera.getCameraManager(globalThis.context);
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let mute = cameraManager.isCameraMuted();
|
||||
globalThis.ismutesuppotred = cameraManager.isCameraMuteSupported();
|
||||
GlobalContext.store('isMuteSupported', cameraManager.isCameraMuteSupported());
|
||||
router.pushUrl({
|
||||
url: 'pages/authority-tertiary-groups',
|
||||
params: { routerData: dataList, backTitle: item.groupName, globalIsOn: !mute }
|
||||
params: { list: dataList, backTitle: item.groupName, globalIsOn: !mute }
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -147,7 +121,10 @@ struct authorityManagementPage {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = item.group;
|
||||
}
|
||||
@ -157,10 +134,16 @@ struct authorityManagementPage {
|
||||
})
|
||||
}
|
||||
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@LocalStorageLink('initialGroups') initialGroups: bundleManager.BundleInfo[] = [];
|
||||
@State allPermissionApplications: permissionApplications [] = []; // All app permissions
|
||||
@State allGroupPermission: groupPermission[] = []; // All group permissions
|
||||
@State allUserPermissions: Permissions[] = [];
|
||||
@State allBundleInfo: appInfo[] = [];
|
||||
@State allGroups: string[] = [];
|
||||
@State currentIndex: number = 0;
|
||||
@State isTouch: string = '';
|
||||
@State isVertical: boolean = true;
|
||||
@Builder TabBuilder(index: number) {
|
||||
Flex({ alignItems: index ? ItemAlign.Start : ItemAlign.End, justifyContent: FlexAlign.Center, direction: FlexDirection.Column }) {
|
||||
Text(index ? $r('app.string.application') : $r('app.string.permission'))
|
||||
@ -180,56 +163,21 @@ struct authorityManagementPage {
|
||||
}
|
||||
}.height(Constants.TAB_HEIGHT)
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.padding({ left: globalThis.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_START,
|
||||
right: globalThis.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_END })
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the permission array into key, value key-value objects for easy sorting
|
||||
* @param {Array} order User rights
|
||||
* @return {Object} return the processed object
|
||||
*/
|
||||
orderDict(order) {
|
||||
let result = {};
|
||||
for (let i = 0; i < order.length; i++) {
|
||||
let key = order[i];
|
||||
result[key] = i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare and sort the permission array according to the permission key value
|
||||
* @param {String} prop Sort by permission
|
||||
* @param {Object} orderSort objects to be sorted
|
||||
* @return {Array} Returns a sorted array of permissions
|
||||
*/
|
||||
compare(prop, orderSort) {
|
||||
return function(a, b) {
|
||||
let aSortValue = orderSort[a[prop]];
|
||||
let bSortValue = orderSort[b[prop]];
|
||||
if (aSortValue == undefined) {
|
||||
throw new Error('当前的字段不在排序列表里:' + a[prop]);
|
||||
}
|
||||
if (bSortValue == undefined) {
|
||||
throw new Error('当前的字段不在排序列表里:' + b[prop]);
|
||||
}
|
||||
return aSortValue - bSortValue;
|
||||
}
|
||||
.padding({ left: this.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_START,
|
||||
right: this.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_END })
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all app permission information
|
||||
*/
|
||||
async getAllBundlePermissions() {
|
||||
for (let i = 0; i < globalThis.initialGroups.length; i++) {
|
||||
await this.deduplicationPermissions(globalThis.initialGroups[i]);
|
||||
}
|
||||
this.getAllGroupPermission();
|
||||
this.getAllPermissionApplications();
|
||||
let orderSort = this.orderDict(userGrantPermissions);
|
||||
this.allPermissionApplications.sort(this.compare('permission', orderSort));
|
||||
this.getLabelAndIcon();
|
||||
for (let i = 0; i < this.initialGroups.length; i++) {
|
||||
await this.deduplicationPermissions(this.initialGroups[i]);
|
||||
}
|
||||
this.getAllGroupPermission();
|
||||
this.getAllPermissionApplications();
|
||||
this.getLabelAndIcon();
|
||||
GlobalContext.store('allBundleInfo', this.allBundleInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,19 +185,20 @@ struct authorityManagementPage {
|
||||
* @param {String} permission app name id
|
||||
* @return {Number} groupId
|
||||
*/
|
||||
getPermissionGroupByPermission(permission: string) {
|
||||
getPermissionGroupByPermission(permission: string): GroupInfo {
|
||||
for (let i = 0; i < permissionGroups.length; i++) {
|
||||
if (permissionGroups[i].permissionName == permission) {
|
||||
return groups[permissionGroups[i].groupId];
|
||||
}
|
||||
}
|
||||
return groups[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all permission label
|
||||
*/
|
||||
getLabelAndIcon() {
|
||||
globalThis.allBundleInfo.forEach(bundleInfo => {
|
||||
this.allBundleInfo.forEach((bundleInfo: appInfo) => {
|
||||
this.updateAppLabel(bundleInfo);
|
||||
this.updateAppIcon(bundleInfo);
|
||||
})
|
||||
@ -259,23 +208,18 @@ struct authorityManagementPage {
|
||||
* Get all app permission information
|
||||
*/
|
||||
getAllPermissionApplications() {
|
||||
const this_ = this;
|
||||
for (let i = 0; i < globalThis.allUserPermissions.length; i++) {
|
||||
var permissionGroup = this_.getPermissionGroupByPermission(globalThis.allUserPermissions[i]);
|
||||
var icon: string = permissionGroup.icon;
|
||||
var bundleNames: string[] = [];
|
||||
for (let j = 0; j < globalThis.allBundleInfo.length; j++) {
|
||||
if (globalThis.allBundleInfo[j].permissions.indexOf(globalThis.allUserPermissions[i]) != -1) {
|
||||
bundleNames.push(globalThis.allBundleInfo[j].bundleName);
|
||||
for (let i = 0; i < this.allUserPermissions.length; i++) {
|
||||
let permission: Permissions = this.allUserPermissions[i];
|
||||
let permissionGroup: GroupInfo = this.getPermissionGroupByPermission(permission);
|
||||
let icon: ResourceStr = permissionGroup.icon;
|
||||
let bundleNames: string[] = [];
|
||||
for (let j = 0; j < this.allBundleInfo.length; j++) {
|
||||
if (this.allBundleInfo[j].permissions.indexOf(permission) != -1) {
|
||||
bundleNames.push(this.allBundleInfo[j].bundleName);
|
||||
}
|
||||
}
|
||||
var pa: permissionApplications = {
|
||||
'permission': globalThis.allUserPermissions[i],
|
||||
'groupName': permissionGroup.name,
|
||||
'bundleNames': bundleNames,
|
||||
'icon': icon
|
||||
};
|
||||
this_.allPermissionApplications.push(pa);
|
||||
let pa: permissionApplications = new permissionApplications(permission, permissionGroup.name, bundleNames, icon);
|
||||
this.allPermissionApplications.push(pa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,56 +227,41 @@ struct authorityManagementPage {
|
||||
* Get permission group information
|
||||
*/
|
||||
getAllGroupPermission() {
|
||||
const this_ = this;
|
||||
groups.forEach((item) => {
|
||||
if (item.isShow) {
|
||||
globalThis.allGroups.push(item.name);
|
||||
this.allGroups.push(item.name);
|
||||
}
|
||||
})
|
||||
globalThis.allUserPermissions.forEach(userPermission => {
|
||||
if (globalThis.allGroups.indexOf(groups[permissionGroupIds[userPermission]].name) == -1) {
|
||||
globalThis.allGroups.push(groups[permissionGroupIds[userPermission]].name);
|
||||
this.allUserPermissions.forEach((userPermission: Permissions) => {
|
||||
let groupId = getGroupIdByPermission(userPermission)
|
||||
if (this.allGroups.indexOf(groups[groupId].name) == -1) {
|
||||
this.allGroups.push(groups[groupId].name);
|
||||
}
|
||||
})
|
||||
// Permission layout
|
||||
for (let i = 0; i < globalThis.allGroups.length; i++) {
|
||||
var permissions: string[] = permissionGroupPermissions[globalThis.allGroups[i]];
|
||||
var gp: groupPermission = {
|
||||
"group": globalThis.allGroups[i],
|
||||
"permissions": permissions,
|
||||
'groupName': '',
|
||||
'icon': '',
|
||||
'isShow': false
|
||||
};
|
||||
this_.allGroupPermission.push(gp);
|
||||
for (let i = 0; i < this.allGroups.length; i++) {
|
||||
let group = getPermissionGroupByName(this.allGroups[i]);
|
||||
let gp: groupPermission = new groupPermission(this.allGroups[i], group.permissions, group.groupName, group.icon, group.isShow)
|
||||
this.allGroupPermission.push(gp);
|
||||
}
|
||||
this.allGroupPermission.forEach((ele) => {
|
||||
groups.forEach((item) => {
|
||||
if (ele.group === item.name) {
|
||||
ele.groupName = item.groupName;
|
||||
ele.icon = item.icon;
|
||||
ele.isShow = item.isShow;
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Deduplicate permission information and permission group information
|
||||
* @param {Object} info bundleInfos Application Information
|
||||
*/
|
||||
async deduplicationPermissions(info) {
|
||||
async deduplicationPermissions(info: bundleManager.BundleInfo) {
|
||||
console.log(TAG + 'allBundleInfo start: ' + info.name);
|
||||
let reqPermissions: Array<any> = [];
|
||||
let reqPermissions: Array<Permissions> = [];
|
||||
info.reqPermissionDetails.forEach(item => {
|
||||
reqPermissions.push(item.name);
|
||||
reqPermissions.push(item.name as Permissions);
|
||||
})
|
||||
var reqPermissionsLen = reqPermissions.length;
|
||||
var reqUserPermissions: string[] = [];
|
||||
var acManager = abilityAccessCtrl.createAtManager()
|
||||
let reqPermissionsLen = reqPermissions.length;
|
||||
let reqUserPermissions: Permissions[] = [];
|
||||
let acManager = abilityAccessCtrl.createAtManager()
|
||||
if (reqPermissionsLen > 0) {
|
||||
for (let j = 0; j < reqPermissions.length; j++) {
|
||||
var permission = reqPermissions[j];
|
||||
let permission = reqPermissions[j];
|
||||
console.log(TAG + 'getPermissionFlags: ' + permission + 'app: ' + info.name)
|
||||
if ((info.targetVersion < Constants.API_VERSION_SUPPORT_STAGE) && (permission == FUZZY_LOCATION_PERMISSION)) {
|
||||
continue;
|
||||
@ -341,7 +270,7 @@ struct authorityManagementPage {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
var flag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, permission);
|
||||
let flag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, permission);
|
||||
console.log(TAG + 'getPermissionFlags: ' + permission + 'app: ' + info.name + 'flag: ' + flag);
|
||||
if (flag == Constants.PERMISSION_SYSTEM_FIXED) {
|
||||
continue;
|
||||
@ -352,34 +281,36 @@ struct authorityManagementPage {
|
||||
}
|
||||
if (userGrantPermissions.indexOf(permission) != -1) {
|
||||
reqUserPermissions.push(permission);
|
||||
if (globalThis.allUserPermissions.indexOf(permission) == -1) {
|
||||
globalThis.allUserPermissions.push(permission);
|
||||
if (this.allUserPermissions.indexOf(permission) == -1) {
|
||||
this.allUserPermissions.push(permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let groupIds = [];
|
||||
let groupIds: number[] = [];
|
||||
for (let i = 0; i < reqUserPermissions.length; i++) {
|
||||
if (groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1) {
|
||||
groupIds.push(permissionGroupIds[reqUserPermissions[i]]);
|
||||
let groupId = getGroupIdByPermission(reqUserPermissions[i])
|
||||
if (groupIds.indexOf(groupId) == -1) {
|
||||
groupIds.push(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
var ap: applicationPermissions = {
|
||||
'bundleName': info.name,
|
||||
'api': info.targetVersion,
|
||||
'tokenId': info.appInfo.accessTokenId,
|
||||
'icon': '',
|
||||
'iconId': info.appInfo.iconResource.id ? info.appInfo.iconResource : info.appInfo.iconId,
|
||||
'label': info.appInfo.label,
|
||||
'labelId': info.appInfo.labelResource.id ? info.appInfo.labelResource : info.appInfo.labelId,
|
||||
'permissions': reqUserPermissions,
|
||||
'groupId': groupIds,
|
||||
'sortId': '',
|
||||
'alphabeticalIndex': ''
|
||||
};
|
||||
let ap: appInfo = new appInfo(
|
||||
info.name,
|
||||
info.targetVersion,
|
||||
info.appInfo.accessTokenId,
|
||||
'',
|
||||
info.appInfo.iconId,
|
||||
info.appInfo.label,
|
||||
info.appInfo.labelId,
|
||||
reqUserPermissions,
|
||||
groupIds,
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
console.log(TAG + 'allBundleInfo.push: ' + info.name);
|
||||
globalThis.allBundleInfo.push(ap);
|
||||
this.allBundleInfo.push(ap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,25 +319,16 @@ struct authorityManagementPage {
|
||||
* @param {String} bundleName Package names
|
||||
* @param {String} labelName Application Name
|
||||
*/
|
||||
updateAppLabel(info) {
|
||||
console.info(TAG + `labelId: ` + JSON.stringify(info.labelId));
|
||||
let resourceManager = globalThis.context.resourceManager;
|
||||
if (!info.labelId.id) {
|
||||
resourceManager = globalThis.context.createBundleContext(info.bundleName).resourceManager;
|
||||
async updateAppLabel(info: appInfo) {
|
||||
console.info(TAG + 'bundleName: ' + JSON.stringify(info.bundleName) + `labelId: ` + JSON.stringify(info.labelId));
|
||||
let resourceManager = this.context.createBundleContext(info.bundleName).resourceManager;
|
||||
|
||||
try {
|
||||
info.label = await resourceManager.getStringValue(info.labelId);
|
||||
} catch (error) {
|
||||
console.error(TAG + "getStringValue promise error is " + error);
|
||||
}
|
||||
|
||||
resourceManager.getStringValue(info.labelId, (error, value) => {
|
||||
if (!!value) {
|
||||
info.label = value;
|
||||
}
|
||||
if (!isNaN(info.label)) {
|
||||
info.alphabeticalIndex = '';
|
||||
} else {
|
||||
info.alphabeticalIndex = makePy(info.label)[0].slice(0, 1); // Get the first letter in the returned initials array
|
||||
}
|
||||
|
||||
info.sortId = getSortId(value);
|
||||
})
|
||||
addLocalTag(info);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -414,12 +336,9 @@ struct authorityManagementPage {
|
||||
* @param {Number} index index of all app permissions array
|
||||
* @param {String} bundleName Package names
|
||||
*/
|
||||
async updateAppIcon(info) {
|
||||
console.info(TAG + `iconId: ` + JSON.stringify(info.iconId));
|
||||
let resourceManager = globalThis.context.resourceManager;
|
||||
if (!info.iconId.id) {
|
||||
resourceManager = globalThis.context.createBundleContext(info.bundleName).resourceManager;
|
||||
}
|
||||
async updateAppIcon(info: appInfo) {
|
||||
console.info(TAG + 'bundleName: ' + JSON.stringify(info.bundleName) + `iconId: ` + JSON.stringify(info.iconId));
|
||||
let resourceManager = this.context.createBundleContext(info.bundleName).resourceManager;
|
||||
|
||||
try {
|
||||
let iconDescriptor = resourceManager.getDrawableDescriptor(info.iconId);
|
||||
@ -428,10 +347,12 @@ struct authorityManagementPage {
|
||||
console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`);
|
||||
}
|
||||
|
||||
if (!info.icon) {
|
||||
let icon = info.icon;
|
||||
if (!icon) {
|
||||
info.icon = await resourceManager.getMediaContentBase64(info.iconId);
|
||||
}
|
||||
if (!info.icon) {
|
||||
let icon1 = info.icon;
|
||||
if (!icon1) {
|
||||
info.icon = $r('app.media.icon');
|
||||
}
|
||||
}
|
||||
@ -443,20 +364,17 @@ struct authorityManagementPage {
|
||||
console.log(TAG + 'on aboutToAppear, version 1.01');
|
||||
this.getAllBundlePermissions();
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
globalThis.isVertical = dis.height > dis.width ? true : false;
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
bundle.getApplicationInfo(Constants.BUNDLE_NAME, bundle.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(data => {
|
||||
acManager.grantUserGrantedPermission(data.accessTokenId, "ohos.permission.MICROPHONE", 2);
|
||||
})
|
||||
this.isVertical = dis.height > dis.width ? true : false;
|
||||
GlobalContext.store('isVertical', dis.height > dis.width ? true : false);
|
||||
}
|
||||
|
||||
getPermissionGroup(allGroup, order) {
|
||||
var fixedName: string[] = ['LOCATION', 'CAMERA', 'MICROPHONE'];
|
||||
var extraName: string[] = ['ADS'];
|
||||
var fixedGroup: any[] = [];
|
||||
var extraGroup: any[] = [];
|
||||
var changeGroup: any[] = [];
|
||||
var otherGroup: any[] = [];
|
||||
getPermissionGroup(allGroup: groupPermission[], order: number): groupPermission[] {
|
||||
let fixedName: string[] = ['LOCATION', 'CAMERA', 'MICROPHONE'];
|
||||
let extraName: string[] = ['ADS'];
|
||||
let fixedGroup: groupPermission[] = [];
|
||||
let extraGroup: groupPermission[] = [];
|
||||
let changeGroup: groupPermission[] = [];
|
||||
let otherGroup: groupPermission[] = [];
|
||||
|
||||
allGroup.forEach(group => {
|
||||
if (fixedName.indexOf(group.group) !== -1) {
|
||||
@ -479,6 +397,7 @@ struct authorityManagementPage {
|
||||
} else if (order == Constants.EXTRA_GROUP) {
|
||||
return extraGroup;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -505,9 +424,9 @@ struct authorityManagementPage {
|
||||
List() {
|
||||
ListItem() {
|
||||
List() {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.FIXED_GROUP), (item) => {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.FIXED_GROUP), (item: groupPermission) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: groupPermission) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
@ -522,9 +441,9 @@ struct authorityManagementPage {
|
||||
|
||||
ListItem() {
|
||||
List() {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.CHANGE_GROUP), (item) => {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.CHANGE_GROUP), (item: groupPermission) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: groupPermission) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
@ -540,9 +459,9 @@ struct authorityManagementPage {
|
||||
if(this.getPermissionGroup(this.allGroupPermission, Constants.EXTRA_GROUP).length) {
|
||||
ListItem() {
|
||||
List() {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.EXTRA_GROUP), (item) => {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.EXTRA_GROUP), (item: groupPermission) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: groupPermission) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
@ -558,9 +477,9 @@ struct authorityManagementPage {
|
||||
|
||||
ListItem() {
|
||||
List() {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.OTHER_GROUP), (item) => {
|
||||
ForEach(this.getPermissionGroup(this.allGroupPermission, Constants.OTHER_GROUP), (item: groupPermission) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: groupPermission) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
@ -611,13 +530,13 @@ struct authorityManagementPage {
|
||||
|
||||
@Component
|
||||
struct applicationItem {
|
||||
@State applicationItem: any[] = globalThis.allBundleInfo; // application info array
|
||||
@State applicationItem: appInfo[] = GlobalContext.load('allBundleInfo'); // application info array
|
||||
@State searchResult: boolean = true; // search results
|
||||
@State selectedIndex: number = 0;
|
||||
@State isTouch: string = '';
|
||||
scroller: Scroller = new Scroller();
|
||||
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: appInfo) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -650,7 +569,7 @@ struct applicationItem {
|
||||
.constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT })
|
||||
}
|
||||
}.onClick(() => {
|
||||
globalThis.applicationInfo = item
|
||||
GlobalContext.store('applicationInfo', item);
|
||||
router.pushUrl({ url: 'pages/application-secondary' });
|
||||
})
|
||||
}
|
||||
@ -665,7 +584,10 @@ struct applicationItem {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = item.bundleName;
|
||||
}
|
||||
@ -702,9 +624,9 @@ struct applicationItem {
|
||||
} else {
|
||||
Row() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(appSort(this.applicationItem), (item) => {
|
||||
ForEach(sortByName(this.applicationItem), (item: appInfo) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: appInfo) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
@ -715,10 +637,10 @@ struct applicationItem {
|
||||
endMargin: Constants.DEFAULT_MARGIN_END
|
||||
})
|
||||
.onScrollIndex((start, end) => {
|
||||
globalThis.scroller = this.scroller;
|
||||
GlobalContext.getContext().set('scroller', this.scroller);
|
||||
if (this.applicationItem.length > 0) {
|
||||
let alphabeticalIndex = appSort(this.applicationItem)[start].alphabeticalIndex;
|
||||
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
|
||||
let alphabeticalIndex = sortByName(this.applicationItem)[start].indexTag;
|
||||
let index = indexValue.indexOf(alphabeticalIndex);
|
||||
this.selectedIndex = index >= 0 ? index : 0;
|
||||
}
|
||||
})
|
||||
@ -736,4 +658,4 @@ struct applicationItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,25 +17,12 @@ import { backBar } from "../common/components/backBar";
|
||||
import { permissionGroups, groups } from "../common/model/permissionGroup";
|
||||
import router from '@ohos.router';
|
||||
import Constants from '../common/utils/constant';
|
||||
|
||||
|
||||
class CalendarObj {
|
||||
permissionName: string
|
||||
groupName: string
|
||||
label: string
|
||||
index: number
|
||||
constructor(permissionName: string, groupName: string, label: string, index: number) {
|
||||
this.permissionName = permissionName
|
||||
this.groupName = groupName
|
||||
this.label = label
|
||||
this.index = index
|
||||
}
|
||||
} // Permission management secondary interface data class
|
||||
import { CalendarObj, routerParams_1, permissionApplications } from '../common/utils/typedef';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct appNamePage {
|
||||
private backTitle = router.getParams()['backTitle']; // return title name
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_1).backTitle;
|
||||
|
||||
build() {
|
||||
GridRow({ gutter: Constants.GUTTER, columns: {
|
||||
@ -67,11 +54,11 @@ struct appNamePage {
|
||||
@Component
|
||||
struct appNameItem {
|
||||
@State calendarListItem: CalendarObj[] = []; // Permission management secondary interface data array
|
||||
private routerData: any = router.getParams()['routerData']; // Routing jump data
|
||||
private group = router.getParams()['group'];
|
||||
private list: permissionApplications[] = (router.getParams() as routerParams_1).list; // Routing jump data
|
||||
private group: string = (router.getParams() as routerParams_1).group;
|
||||
@State isTouch: string = '';
|
||||
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: CalendarObj) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -92,12 +79,12 @@ struct appNameItem {
|
||||
.height(Constants.LISTITEM_ROW_HEIGHT)
|
||||
}
|
||||
}.onClick(() => {
|
||||
let dataList = this.routerData.filter((ele) => {
|
||||
let dataList = this.list.filter((ele) => {
|
||||
return ele.permission === item.permissionName;
|
||||
})
|
||||
router.pushUrl({
|
||||
url: 'pages/authority-tertiary',
|
||||
params: { routerData: dataList, backTitle: item.label, permissionName: item.permissionName }
|
||||
params: { list: dataList, backTitle: item.label, permissionName: item.permissionName }
|
||||
});
|
||||
})
|
||||
}
|
||||
@ -112,7 +99,10 @@ struct appNameItem {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = item.permissionName;
|
||||
}
|
||||
@ -126,7 +116,7 @@ struct appNameItem {
|
||||
* Lifecycle function, executed when the page is initialized
|
||||
*/
|
||||
aboutToAppear() {
|
||||
var permissionsList = groups.filter((item) => {
|
||||
let permissionsList = groups.filter((item) => {
|
||||
return item.name === this.group;
|
||||
})
|
||||
for (let i = 0; i < permissionsList[0].permissions.length; i++) {
|
||||
@ -146,9 +136,9 @@ struct appNameItem {
|
||||
Row() {
|
||||
List() {
|
||||
if (this.calendarListItem.length > 0) {
|
||||
ForEach(this.calendarListItem, (item) => {
|
||||
ForEach(this.calendarListItem, (item: CalendarObj) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: CalendarObj) => JSON.stringify(item))
|
||||
} else {
|
||||
ListItem() {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
|
@ -18,15 +18,22 @@ import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex
|
||||
import { textInput } from "../common/components/search";
|
||||
import router from '@ohos.router';
|
||||
import bundleManager from "@ohos.bundle.bundleManager";
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import audio from '@ohos.multimedia.audio'
|
||||
import camera from '@ohos.multimedia.camera'
|
||||
import { verifyAccessToken, appSort, indexValue } from "../common/utils/utils";
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { verifyAccessToken, indexValue, sortByName } from "../common/utils/utils";
|
||||
import { ApplicationObj, GroupInfo, routerParams_1, permissionApplications, appInfo } from "../common/utils/typedef";
|
||||
import { GlobalContext } from "../common/utils/globalContext";
|
||||
import { globalDialog } from "../common/components/dialog";
|
||||
import Constants from '../common/utils/constant';
|
||||
import { polymorphismGroup, globalGroup, groups } from "../common/model/permissionGroup";
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
let globalIsOn: boolean = (router.getParams() as routerParams_1).globalIsOn; // return title name
|
||||
|
||||
@Extend(Image) function customizeImage(width: number, height: number) {
|
||||
.objectFit(ImageFit.Contain)
|
||||
@ -34,44 +41,12 @@ var TAG = 'PermissionManager_MainAbility:';
|
||||
.height(height)
|
||||
}
|
||||
|
||||
let routerData: any = router.getParams()['routerData']; // Routing jump data
|
||||
let backTitle = router.getParams()['backTitle']; // return title name
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
let globalIsOn: any = router.getParams()['globalIsOn']; // return title name
|
||||
|
||||
class ApplicationObj {
|
||||
bundleName: string
|
||||
label: string
|
||||
icon: string
|
||||
index: number
|
||||
accessTokenId: number
|
||||
permission: string
|
||||
alphabeticalIndex: string
|
||||
sortId: string
|
||||
constructor(
|
||||
bundleName: string,
|
||||
label: string,
|
||||
icon: string,
|
||||
index: number,
|
||||
accessTokenId: number,
|
||||
permission: string,
|
||||
alphabeticalIndex: string,
|
||||
sortId: string) {
|
||||
this.bundleName = bundleName
|
||||
this.label = label
|
||||
this.icon = icon
|
||||
this.index = index
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permission = permission
|
||||
this.alphabeticalIndex = alphabeticalIndex
|
||||
this.sortId = sortId
|
||||
}
|
||||
} // application information
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct locationInfoPage {
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_1).backTitle;
|
||||
private list: permissionApplications[] = (router.getParams() as routerParams_1).list;
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@State polymorphismIsOn: Array<boolean> = [];
|
||||
|
||||
build() {
|
||||
@ -82,7 +57,7 @@ struct locationInfoPage {
|
||||
Row() {
|
||||
Column() {
|
||||
Row() {
|
||||
backBar({ title: JSON.stringify(backTitle), recordable: false })
|
||||
backBar({ title: JSON.stringify(this.backTitle), recordable: false })
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
@ -102,10 +77,10 @@ struct locationInfoPage {
|
||||
|
||||
onPageShow() {
|
||||
console.log(TAG + "onPageShow");
|
||||
if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
|
||||
var bundleNames = [];
|
||||
routerData.forEach(permissionmanager => {
|
||||
permissionmanager.bundleNames.forEach( bundleName => {
|
||||
if (polymorphismGroup.indexOf(this.currentGroup) !== -1) {
|
||||
let bundleNames: string[] = [];
|
||||
this.list.forEach(permissionmanager => {
|
||||
permissionmanager.bundleNames.forEach(bundleName => {
|
||||
if (bundleNames.indexOf(bundleName) == -1) {
|
||||
bundleNames.push(bundleName);
|
||||
}
|
||||
@ -120,23 +95,23 @@ struct locationInfoPage {
|
||||
res.reqPermissionDetails.forEach(item => {
|
||||
reqPermissions.push(item.name);
|
||||
})
|
||||
for (let j = 0; j < routerData.length; j++) {
|
||||
if ((routerData[j].permission == PRECISE_LOCATION_PERMISSION) && (res.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE)) {
|
||||
for (let j = 0; j < this.list.length; j++) {
|
||||
if ((this.list[j].permission == PRECISE_LOCATION_PERMISSION) && (res.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE)) {
|
||||
continue;
|
||||
}
|
||||
if ((routerData[j].permission == FUZZY_LOCATION_PERMISSION) && (res.targetVersion < Constants.API_VERSION_SUPPORT_STAGE)) {
|
||||
if ((this.list[j].permission == FUZZY_LOCATION_PERMISSION) && (res.targetVersion < Constants.API_VERSION_SUPPORT_STAGE)) {
|
||||
continue;
|
||||
}
|
||||
if (reqPermissions.indexOf(routerData[j].permission) == -1) {
|
||||
if (reqPermissions.indexOf(this.list[j].permission) == -1) {
|
||||
continue;
|
||||
}
|
||||
verifyAccessToken(res.appInfo.accessTokenId, routerData[j].permission).then((access) => {
|
||||
verifyAccessToken(res.appInfo.accessTokenId, this.list[j].permission).then((access) => {
|
||||
if (Number(access) === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||
this.polymorphismIsOn[index] = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
}).catch((error: BusinessError) => {
|
||||
console.log(TAG + bundleName + "onPageShow getBundleInfo failed, cause: " + JSON.stringify(error));
|
||||
})
|
||||
})
|
||||
@ -146,16 +121,22 @@ struct locationInfoPage {
|
||||
|
||||
@Component
|
||||
struct applicationItem {
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_1).backTitle;
|
||||
private list: permissionApplications[] = (router.getParams() as routerParams_1).list;
|
||||
@State permissionNum: number = Constants.PERMISSION_NUM; // permission num
|
||||
@State toggleIsOn: object = {}; // toggle switch state array
|
||||
@State isRisk: object = {};
|
||||
@State toggleIsOn: boolean[] = []; // toggle switch state array
|
||||
@State isRisk: boolean[] = [];
|
||||
@State applicationList: ApplicationObj[] = []; // application info array
|
||||
@State searchResult: boolean = true; // search results
|
||||
@Link polymorphismIsOn: Array<boolean>;
|
||||
@State globalIsOn: boolean = true;
|
||||
@State selectedIndex: number = 0;
|
||||
@State isTouch: string = '';
|
||||
@State groupInfo: object = {};
|
||||
@State groupInfo: GroupInfo = new GroupInfo('', '', '', '', [], '', [], false);
|
||||
@State currentGroup: string = GlobalContext.load('currentPermissionGroup');
|
||||
@State isMuteSupported: boolean = GlobalContext.load('isMuteSupported');
|
||||
@State allBundleInfo: appInfo[] = GlobalContext.load('allBundleInfo');
|
||||
scroller: Scroller = new Scroller();
|
||||
|
||||
privacyDialogController: CustomDialogController = new CustomDialogController({
|
||||
@ -165,7 +146,7 @@ struct applicationItem {
|
||||
customStyle: true
|
||||
})
|
||||
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: ApplicationObj) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -189,7 +170,7 @@ struct applicationItem {
|
||||
}
|
||||
}.flexGrow(Constants.FLEX_GROW)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) == -1) {
|
||||
if (polymorphismGroup.indexOf(this.currentGroup) == -1) {
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] })
|
||||
.selectedColor($r('sys.color.ohos_id_color_toolbar_icon_actived'))
|
||||
.switchPointColor($r('sys.color.ohos_id_color_foreground_contrary'))
|
||||
@ -197,36 +178,26 @@ struct applicationItem {
|
||||
.width(Constants.AUTHORITY_TOGGLE_WIDTH)
|
||||
.height(Constants.AUTHORITY_TOGGLE_HEIGHT)
|
||||
.onChange((isOn: boolean) => {
|
||||
if (item.accessTokenId === '' || item.permission === '') {
|
||||
if (item.permission === undefined) {
|
||||
return;
|
||||
}
|
||||
let _this = this;
|
||||
if (isOn) {
|
||||
let promises = routerData.map(it => new Promise((resolve) => {
|
||||
_this.grantUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve);
|
||||
let promises = this.list.map(it => new Promise<number>((resolve) => {
|
||||
_this.grantUserGrantedPermission(item.accessTokenId, it.permission, resolve);
|
||||
}));
|
||||
Promise.all(promises).then(function() {
|
||||
Promise.all(promises).then(() => {
|
||||
_this.toggleIsOn[item.index] = true;
|
||||
let num = Constants.PERMISSION_NUM;
|
||||
for (let key in _this.toggleIsOn) {
|
||||
if (_this.toggleIsOn[key]) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
let num = _this.toggleIsOn.filter(item => item === true).length;
|
||||
_this.permissionNum = num;
|
||||
});
|
||||
} else {
|
||||
let promises = routerData.map(it => new Promise((resolve) => {
|
||||
_this.revokeUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve);
|
||||
let promises = this.list.map(it => new Promise<number>((resolve) => {
|
||||
_this.revokeUserGrantedPermission(item.accessTokenId, it.permission, resolve);
|
||||
}));
|
||||
Promise.all(promises).then(function() {
|
||||
Promise.all(promises).then(() => {
|
||||
_this.toggleIsOn[item.index] = false;
|
||||
let num = Constants.PERMISSION_NUM;
|
||||
for (let key in _this.toggleIsOn) {
|
||||
if (_this.toggleIsOn[key]) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
let num = _this.toggleIsOn.filter(item => item === true).length;
|
||||
_this.permissionNum = num;
|
||||
});
|
||||
}
|
||||
@ -246,21 +217,21 @@ struct applicationItem {
|
||||
.constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT })
|
||||
}
|
||||
}.onClick(() => {
|
||||
if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
|
||||
var permissions: any = [];
|
||||
routerData.forEach(item => {
|
||||
if (polymorphismGroup.indexOf(this.currentGroup) !== -1) {
|
||||
let permissions: string[] = [];
|
||||
this.list.forEach(item => {
|
||||
permissions.push(item.permission);
|
||||
})
|
||||
globalThis.allBundleInfo.forEach(bundleInfo => {
|
||||
this.allBundleInfo.forEach(bundleInfo => {
|
||||
if (bundleInfo.bundleName === item.bundleName) {
|
||||
globalThis.applicationInfo = bundleInfo;
|
||||
GlobalContext.store('applicationInfo', bundleInfo);
|
||||
}
|
||||
})
|
||||
router.pushUrl({
|
||||
url: 'pages/application-tertiary',
|
||||
params: {
|
||||
routerData: item.bundleName,
|
||||
backTitle,
|
||||
bundleName: item.bundleName,
|
||||
backTitle: this.backTitle,
|
||||
permission: permissions,
|
||||
status: this.polymorphismIsOn[item.index] ? Constants.RADIO_ALLOW_INDEX : Constants.RADIO_BAN_INDEX
|
||||
}
|
||||
@ -281,9 +252,12 @@ struct applicationItem {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down && polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
|
||||
this.isTouch = item.bundleName;
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down && polymorphismGroup.indexOf(this.currentGroup) !== -1) {
|
||||
this.isTouch = item.bundleName ? item.bundleName : '';
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouch = '';
|
||||
@ -295,8 +269,8 @@ struct applicationItem {
|
||||
* Take the total number of access applications
|
||||
*/
|
||||
getGrantApplicationNumber() {
|
||||
if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
|
||||
var sum = this.polymorphismIsOn.filter(item => item == true);
|
||||
if (polymorphismGroup.indexOf(this.currentGroup) !== -1) {
|
||||
let sum = this.polymorphismIsOn.filter(item => item == true);
|
||||
return sum.length;
|
||||
} else {
|
||||
return this.permissionNum;
|
||||
@ -309,12 +283,10 @@ struct applicationItem {
|
||||
* @param {String} permission permission name
|
||||
* @param {Number} index Array index to modify permission status
|
||||
*/
|
||||
grantUserGrantedPermission(accessTokenId, permission, index, resolve) {
|
||||
abilityAccessCtrl.createAtManager().grantUserGrantedPermission(
|
||||
accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => {
|
||||
// result: 0 Authorization succeeded; result: -1 Authorization failed
|
||||
resolve(result);
|
||||
}).catch(error => {
|
||||
grantUserGrantedPermission(accessTokenId: number, permission: Permissions, resolve: (value: number) => void) {
|
||||
abilityAccessCtrl.createAtManager().grantUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG).then(() => {
|
||||
resolve(0);
|
||||
}).catch((error: BusinessError) => {
|
||||
resolve(-1);
|
||||
console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
@ -326,12 +298,10 @@ struct applicationItem {
|
||||
* @param {String} permission permission name
|
||||
* @param {Number} index Array index to modify permission status
|
||||
*/
|
||||
revokeUserGrantedPermission(accessTokenId, permission, index, resolve) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(
|
||||
accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => {
|
||||
// result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed
|
||||
resolve(result);
|
||||
}).catch(error => {
|
||||
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions, resolve: (value: number) => void) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(accessTokenId, permission, Constants.PERMISSION_FLAG).then(() => {
|
||||
resolve(0);
|
||||
}).catch((error: BusinessError) => {
|
||||
resolve(-1);
|
||||
console.error(TAG + 'abilityAccessCtrl.createAtManager.revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
@ -341,17 +311,17 @@ struct applicationItem {
|
||||
* Lifecycle function, executed when the page is initialized
|
||||
*/
|
||||
aboutToAppear() {
|
||||
var bundleNames = [];
|
||||
let bundleNames: string[] = [];
|
||||
this.applicationList = [];
|
||||
routerData.forEach(permissionmanager => {
|
||||
permissionmanager.bundleNames.forEach( bundleName => {
|
||||
this.list.forEach(permissionmanager => {
|
||||
permissionmanager.bundleNames.forEach(bundleName => {
|
||||
if (bundleNames.indexOf(bundleName) == -1) {
|
||||
bundleNames.push(bundleName);
|
||||
}
|
||||
})
|
||||
})
|
||||
groups.forEach(group => {
|
||||
if (group.name === globalThis.currentPermissionGroup) {
|
||||
if (group.name === this.currentGroup) {
|
||||
this.groupInfo = group;
|
||||
}
|
||||
})
|
||||
@ -359,22 +329,23 @@ struct applicationItem {
|
||||
let atManager = abilityAccessCtrl.createAtManager();
|
||||
for (let i = 0; i < bundleNames.length; i++) {
|
||||
// Get BundleInfo based on bundle name
|
||||
globalThis.allBundleInfo.forEach(bundleInfo => {
|
||||
this.allBundleInfo.forEach(bundleInfo => {
|
||||
if (bundleInfo.bundleName === bundleNames[i]) {
|
||||
this.applicationList.push(
|
||||
new ApplicationObj(
|
||||
bundleInfo.bundleName,
|
||||
bundleInfo.label,
|
||||
bundleInfo.icon,
|
||||
bundleInfo.label,
|
||||
bundleInfo.icon,
|
||||
i,
|
||||
bundleInfo.tokenId,
|
||||
routerData[0].permission,
|
||||
bundleInfo.alphabeticalIndex,
|
||||
bundleInfo.sortId) // Get the first letter in the returned initials array
|
||||
bundleInfo.tokenId,
|
||||
this.list[0].permission,
|
||||
bundleInfo.zhTag,
|
||||
bundleInfo.indexTag,
|
||||
bundleInfo.language,
|
||||
bundleInfo.bundleName) // Get the first letter in the returned initials array
|
||||
);
|
||||
this.isRisk[i] = false;
|
||||
try {
|
||||
atManager.getPermissionFlags(bundleInfo.tokenId, routerData[0].permission).then(data => {
|
||||
atManager.getPermissionFlags(bundleInfo.tokenId, this.list[0].permission).then(data => {
|
||||
if (data == Constants.PERMISSION_POLICY_FIXED) {
|
||||
this.isRisk[i] = true;
|
||||
}
|
||||
@ -384,13 +355,13 @@ struct applicationItem {
|
||||
console.log(TAG + 'getPermissionFlags error: ' + JSON.stringify(err));
|
||||
}
|
||||
// 0: have permission; -1: no permission
|
||||
var boole = true;
|
||||
let boole = true;
|
||||
this.permissionNum++;
|
||||
for (let j = 0; j < routerData.length; j++) {
|
||||
if (bundleInfo.permissions.indexOf(routerData[j].permission) == -1) {
|
||||
for (let j = 0; j < this.list.length; j++) {
|
||||
if (bundleInfo.permissions.indexOf(this.list[j].permission) == -1) {
|
||||
continue;
|
||||
}
|
||||
verifyAccessToken(bundleInfo.tokenId, routerData[j].permission).then((access) => {
|
||||
verifyAccessToken(bundleInfo.tokenId, this.list[j].permission).then((access) => {
|
||||
if (Number(access) === Constants.PERMISSION_INDEX) {
|
||||
if (boole) {
|
||||
this.toggleIsOn[i] = true;
|
||||
@ -407,16 +378,17 @@ struct applicationItem {
|
||||
}
|
||||
})
|
||||
}
|
||||
if (globalGroup.indexOf(globalThis.currentPermissionGroup) !== -1) {
|
||||
if (globalGroup.indexOf(this.currentGroup) !== -1) {
|
||||
this.globalIsOn = globalIsOn;
|
||||
if (globalThis.currentPermissionGroup == "CAMERA") {
|
||||
let cameraManager = camera.getCameraManager(globalThis.context);
|
||||
if (this.currentGroup == "CAMERA") {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
cameraManager.on('cameraMute', (err, curMuted) => {
|
||||
console.log(TAG + 'curMuted: ' + JSON.stringify(curMuted) + ' err: ' + JSON.stringify(err));
|
||||
this.globalIsOn = !curMuted;
|
||||
})
|
||||
} else {
|
||||
var audioManager = audio.getAudioManager();
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
@ -441,10 +413,10 @@ struct applicationItem {
|
||||
})
|
||||
Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) {
|
||||
Column() {
|
||||
if (globalGroup.indexOf(globalThis.currentPermissionGroup) !== -1 && globalThis.ismutesuppotred === true) {
|
||||
if (globalGroup.indexOf(this.currentGroup) !== -1 && this.isMuteSupported === true) {
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Text(globalThis.currentPermissionGroup == "CAMERA" ? $r('app.string.camera') : $r('app.string.microphone'))
|
||||
Text(this.currentGroup == "CAMERA" ? $r('app.string.camera') : $r('app.string.microphone'))
|
||||
.fontSize(Constants.TEXT_MIDDLE_FONT_SIZE).fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Row() {
|
||||
@ -454,11 +426,12 @@ struct applicationItem {
|
||||
.padding({ right: 0 })
|
||||
.onChange((isOn: boolean) => {
|
||||
if (isOn) {
|
||||
if (globalThis.currentPermissionGroup == "CAMERA") {
|
||||
let cameraManager = camera.getCameraManager(globalThis.context);
|
||||
if (this.currentGroup == "CAMERA") {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
cameraManager.muteCamera(false);
|
||||
} else {
|
||||
var audioManager = audio.getAudioManager();
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
@ -482,21 +455,21 @@ struct applicationItem {
|
||||
if (this.globalIsOn) {
|
||||
if (this.getGrantApplicationNumber() > 0) {
|
||||
Text() {
|
||||
Span(this.groupInfo['enable_description_start'])
|
||||
Span(this.groupInfo.enable_description_start ? this.groupInfo.enable_description_start : '')
|
||||
Span(String(this.getGrantApplicationNumber()))
|
||||
Span(this.groupInfo['enable_description_end'])
|
||||
Span(this.groupInfo.enable_description_end ? this.groupInfo.enable_description_end : '')
|
||||
}
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP })
|
||||
} else {
|
||||
Text(this.groupInfo['forbidden_description'])
|
||||
Text(this.groupInfo.forbidden_description)
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP })
|
||||
}
|
||||
} else {
|
||||
Text(globalThis.currentPermissionGroup == "CAMERA" ? $r('app.string.camera_is_off') : $r('app.string.microphone_is_off'))
|
||||
Text(this.currentGroup == "CAMERA" ? $r('app.string.camera_is_off') : $r('app.string.microphone_is_off'))
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP })
|
||||
@ -519,9 +492,9 @@ struct applicationItem {
|
||||
} else {
|
||||
Row() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(appSort(this.applicationList), (item) => {
|
||||
ForEach(sortByName(this.applicationList), (item: ApplicationObj) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: ApplicationObj) => JSON.stringify(item))
|
||||
}
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
@ -533,17 +506,17 @@ struct applicationItem {
|
||||
endMargin: Constants.DEFAULT_MARGIN_END
|
||||
})
|
||||
.onScrollIndex((start, end) => {
|
||||
globalThis.scroller = this.scroller;
|
||||
GlobalContext.getContext().set('scroller', this.scroller);
|
||||
if (this.applicationList.length > 0) {
|
||||
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
|
||||
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
|
||||
let alphabeticalIndex: string = sortByName(this.applicationList)[start].indexTag;
|
||||
let index = indexValue.indexOf(alphabeticalIndex);
|
||||
this.selectedIndex = index >= 0 ? index : 0;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
.margin({ bottom: globalGroup.includes(globalThis.currentPermissionGroup) && globalThis.ismutesuppotred === true ? Constants.AUTHORITY_LIST_MARGIN_BOTTOM_GLOBAL : Constants.AUTHORITY_LIST_MARGIN_BOTTOM })
|
||||
.margin({ bottom: globalGroup.includes(this.currentGroup) && this.isMuteSupported === true ? Constants.AUTHORITY_LIST_MARGIN_BOTTOM_GLOBAL : Constants.AUTHORITY_LIST_MARGIN_BOTTOM })
|
||||
}
|
||||
}.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT })
|
||||
Column() {
|
||||
|
@ -17,13 +17,15 @@ import { backBar } from "../common/components/backBar";
|
||||
import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex";
|
||||
import { textInput } from "../common/components/search";
|
||||
import router from '@ohos.router';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import { verifyAccessToken, appSort, indexValue } from "../common/utils/utils";
|
||||
import { authorizeDialog } from "../common/components/dialog";
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { verifyAccessToken, indexValue, sortByName } from "../common/utils/utils";
|
||||
import { ApplicationObj, PermissionInfo, routerParams_2, permissionApplications, appInfo } from "../common/utils/typedef";
|
||||
import { GlobalContext } from "../common/utils/globalContext";
|
||||
import Constants from '../common/utils/constant';
|
||||
import { permissionGroups } from "../common/model/permissionGroup";
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
|
||||
@Extend(Image) function customizeImage(width: number, height: number) {
|
||||
.objectFit(ImageFit.Contain)
|
||||
@ -31,38 +33,11 @@ var TAG = 'PermissionManager_MainAbility:';
|
||||
.height(height)
|
||||
}
|
||||
|
||||
let routerData: any = router.getParams()['routerData']; // Routing jump data
|
||||
let backTitle = router.getParams()['backTitle']; // return title name
|
||||
let permissionName = router.getParams()['permissionName'];
|
||||
class ApplicationObj {
|
||||
label: string
|
||||
icon: string
|
||||
index: number
|
||||
accessTokenId: number
|
||||
permission: string
|
||||
alphabeticalIndex: string
|
||||
sortId: string
|
||||
constructor(
|
||||
label: string,
|
||||
icon: string,
|
||||
index: number,
|
||||
accessTokenId: number,
|
||||
permission: string,
|
||||
alphabeticalIndex: string,
|
||||
sortId: string) {
|
||||
this.label = label
|
||||
this.icon = icon
|
||||
this.index = index
|
||||
this.accessTokenId = accessTokenId
|
||||
this.permission = permission
|
||||
this.alphabeticalIndex = alphabeticalIndex
|
||||
this.sortId = sortId
|
||||
}
|
||||
} // application information
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct locationInfoPage {
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_2).backTitle;
|
||||
|
||||
build() {
|
||||
GridRow({ gutter: Constants.GUTTER, columns: {
|
||||
xs: Constants.XS_COLUMNS, sm: Constants.SM_COLUMNS, md: Constants.MD_COLUMNS, lg: Constants.LG_COLUMNS } }) {
|
||||
@ -71,7 +46,7 @@ struct locationInfoPage {
|
||||
Row() {
|
||||
Column() {
|
||||
Row() {
|
||||
backBar({ title: JSON.stringify(backTitle), recordable: false })
|
||||
backBar({ title: JSON.stringify(this.backTitle), recordable: false })
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
@ -92,22 +67,19 @@ struct locationInfoPage {
|
||||
|
||||
@Component
|
||||
struct applicationItem {
|
||||
private list: permissionApplications[] = (router.getParams() as routerParams_2).list;
|
||||
private permissionName: string = (router.getParams() as routerParams_2).permissionName;
|
||||
@State permissionNum: number = Constants.PERMISSION_NUM; // permission num
|
||||
@State toggleIsOn: object = {}; // toggle switch state array
|
||||
@State isRisk: object = {};
|
||||
@State toggleIsOn: boolean[] = []; // toggle switch state array
|
||||
@State isRisk: boolean[] = [];
|
||||
@State applicationList: ApplicationObj[] = []; // application info array
|
||||
@State searchResult: boolean = true; // search results
|
||||
@State selectedIndex: number = 0;
|
||||
@State permissionInfo: object = {};
|
||||
@State permissionInfo: PermissionInfo = new PermissionInfo('', '', '', 0);
|
||||
@State allBundleInfo: appInfo[] = GlobalContext.load('allBundleInfo');
|
||||
scroller: Scroller = new Scroller();
|
||||
|
||||
authorizeDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: authorizeDialog({ }),
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Center
|
||||
});
|
||||
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: ApplicationObj) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -138,7 +110,7 @@ struct applicationItem {
|
||||
.width(Constants.AUTHORITY_TOGGLE_WIDTH)
|
||||
.height(Constants.AUTHORITY_TOGGLE_HEIGHT)
|
||||
.onChange((isOn: boolean) => {
|
||||
if (item.accessTokenId === '' || item.permission === '') {
|
||||
if (item.permission === undefined) {
|
||||
return;
|
||||
}
|
||||
if (isOn) {
|
||||
@ -166,24 +138,15 @@ struct applicationItem {
|
||||
* @param {String} permission permission name
|
||||
* @param {Number} index Array index to modify permission status
|
||||
*/
|
||||
grantUserGrantedPermission(accessTokenId, permission, index) {
|
||||
grantUserGrantedPermission(accessTokenId: number, permission: Permissions, index: number) {
|
||||
abilityAccessCtrl.createAtManager().grantUserGrantedPermission(
|
||||
accessTokenId, permission, Constants.PERMISSION_FLAG).then(() => {
|
||||
// result: 0 Authorization succeeded; result: -1 Authorization failed
|
||||
this.toggleIsOn[index] = true;
|
||||
let num = Constants.PERMISSION_NUM;
|
||||
for(let key in this.toggleIsOn){
|
||||
if(this.toggleIsOn[key]){
|
||||
num++;
|
||||
}
|
||||
}
|
||||
let num = this.toggleIsOn.filter(item => item === true).length;
|
||||
this.permissionNum = num;
|
||||
}).catch(error => {
|
||||
this.authorizeDialogController.open();
|
||||
this.toggleIsOn[index] = false;
|
||||
setTimeout(()=> {
|
||||
this.authorizeDialogController.close();
|
||||
}, Constants.DELAY_TIME)
|
||||
}).catch((error: BusinessError) => {
|
||||
this.toggleIsOn[index] = false;
|
||||
console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error));
|
||||
})
|
||||
}
|
||||
@ -194,24 +157,15 @@ struct applicationItem {
|
||||
* @param {String} permission permission name
|
||||
* @param {Number} index Array index to modify permission status
|
||||
*/
|
||||
revokeUserGrantedPermission(accessTokenId, permission, index) {
|
||||
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions, index: number) {
|
||||
abilityAccessCtrl.createAtManager().revokeUserGrantedPermission(
|
||||
accessTokenId, permission, Constants.PERMISSION_FLAG).then(() => {
|
||||
// result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed
|
||||
this.toggleIsOn[index] = false;
|
||||
let num = Constants.PERMISSION_NUM;
|
||||
for (let key in this.toggleIsOn) {
|
||||
if (this.toggleIsOn[key]) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
let num = this.toggleIsOn.filter(item => item === true).length;
|
||||
this.permissionNum = num;
|
||||
}).catch(() => {
|
||||
this.authorizeDialogController.open();
|
||||
this.toggleIsOn[index] = true;
|
||||
setTimeout(() => {
|
||||
this.authorizeDialogController.close();
|
||||
}, Constants.DELAY_TIME)
|
||||
this.toggleIsOn[index] = true;
|
||||
})
|
||||
}
|
||||
|
||||
@ -219,9 +173,9 @@ struct applicationItem {
|
||||
* Lifecycle function, executed when the page is initialized
|
||||
*/
|
||||
aboutToAppear() {
|
||||
let bundleNames = routerData.length > 0 ? routerData[0].bundleNames : routerData;
|
||||
let bundleNames = this.list.length > 0 ? this.list[0].bundleNames : this.list;
|
||||
permissionGroups.forEach(permission => {
|
||||
if (permission.permissionName === permissionName) {
|
||||
if (permission.permissionName === this.permissionName) {
|
||||
this.permissionInfo = permission;
|
||||
}
|
||||
})
|
||||
@ -229,19 +183,20 @@ struct applicationItem {
|
||||
let atManager = abilityAccessCtrl.createAtManager();
|
||||
for (let i = 0; i < bundleNames.length; i++) {
|
||||
// Get BundleInfo based on bundle name
|
||||
globalThis.allBundleInfo.forEach(bundleInfo => {
|
||||
this.allBundleInfo.forEach(bundleInfo => {
|
||||
if (bundleInfo.bundleName === bundleNames[i]) {
|
||||
verifyAccessToken(bundleInfo.tokenId, routerData[0].permission).then(data => {
|
||||
this.applicationList.push(
|
||||
new ApplicationObj(
|
||||
this.applicationList.push(
|
||||
new ApplicationObj(
|
||||
bundleInfo.label,
|
||||
bundleInfo.icon,
|
||||
i,
|
||||
i,
|
||||
bundleInfo.tokenId,
|
||||
routerData[0].permission,
|
||||
bundleInfo.alphabeticalIndex,
|
||||
bundleInfo.sortId) // Get the first letter in the returned initials array
|
||||
);
|
||||
this.list[0].permission,
|
||||
bundleInfo.zhTag,
|
||||
bundleInfo.indexTag,
|
||||
bundleInfo.language) // Get the first letter in the returned initials array
|
||||
);
|
||||
verifyAccessToken(bundleInfo.tokenId, this.list[0].permission).then(data => {
|
||||
// 0: have permission; -1: no permission
|
||||
if (data === Constants.PERMISSION_INDEX) {
|
||||
this.toggleIsOn[i] = true;
|
||||
@ -252,7 +207,7 @@ struct applicationItem {
|
||||
})
|
||||
this.isRisk[i] = false;
|
||||
try {
|
||||
atManager.getPermissionFlags(bundleInfo.tokenId, routerData[0].permission).then(data => {
|
||||
atManager.getPermissionFlags(bundleInfo.tokenId, this.list[0].permission).then(data => {
|
||||
if (data == Constants.PERMISSION_POLICY_FIXED) {
|
||||
this.isRisk[i] = true;
|
||||
}
|
||||
@ -282,15 +237,15 @@ struct applicationItem {
|
||||
Flex({ justifyContent: FlexAlign.Start }) {
|
||||
if (this.permissionNum > 0) {
|
||||
Text() {
|
||||
Span(this.permissionInfo['enable_description_start'])
|
||||
Span(this.permissionInfo.enable_description_start ? this.permissionInfo.enable_description_start : '')
|
||||
Span(String(this.permissionNum))
|
||||
Span(this.permissionInfo['enable_description_end'])
|
||||
Span(this.permissionInfo.enable_description_end ? this.permissionInfo.enable_description_end : '')
|
||||
}
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP })
|
||||
} else {
|
||||
Text(this.permissionInfo['forbidden_description'])
|
||||
Text(this.permissionInfo.forbidden_description)
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP })
|
||||
@ -313,9 +268,9 @@ struct applicationItem {
|
||||
} else {
|
||||
Row() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(appSort(this.applicationList), (item) => {
|
||||
ForEach(sortByName(this.applicationList), (item: ApplicationObj) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: ApplicationObj) => JSON.stringify(item))
|
||||
}
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
@ -327,10 +282,10 @@ struct applicationItem {
|
||||
endMargin: Constants.DEFAULT_MARGIN_END
|
||||
})
|
||||
.onScrollIndex((start, end) => {
|
||||
globalThis.scroller = this.scroller;
|
||||
GlobalContext.getContext().set('scroller', this.scroller);
|
||||
if (this.applicationList.length > 0) {
|
||||
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
|
||||
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
|
||||
let alphabeticalIndex = sortByName(this.applicationList)[start].indexTag;
|
||||
let index = indexValue.indexOf(alphabeticalIndex);
|
||||
this.selectedIndex = index >= 0 ? index : 0;
|
||||
}
|
||||
})
|
||||
|
@ -17,7 +17,13 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import rpc from '@ohos.rpc';
|
||||
import window from '@ohos.window';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
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 { LocationCanvas } from '../common/components/location';
|
||||
@ -33,26 +39,17 @@ import { LocationCanvas } from '../common/components/location';
|
||||
|
||||
const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION';
|
||||
const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
let win: any = "";
|
||||
let proxy: any = '';
|
||||
let want: any = '';
|
||||
let storage = LocalStorage.GetShared();
|
||||
|
||||
class BundleInfo {
|
||||
targetVersion: number
|
||||
reqPermissionDetails: Array<any>
|
||||
constructor(targetVersion: number, reqPermissionDetails: Array<any>) {
|
||||
this.targetVersion = targetVersion
|
||||
this.reqPermissionDetails = reqPermissionDetails
|
||||
}
|
||||
}
|
||||
let win: window.Window;
|
||||
let want: wantInfo;
|
||||
let storage = LocalStorage.getShared();
|
||||
|
||||
@Entry(storage)
|
||||
@Component
|
||||
struct dialogPlusPage {
|
||||
@LocalStorageLink('want') want: Object = {};
|
||||
@LocalStorageLink('win') win: Object = {};
|
||||
@LocalStorageLink('want') want: wantInfo = new wantInfo([]);
|
||||
@LocalStorageLink('win') win: window.Window = {} as window.Window;
|
||||
@State isUpdate: number = -1;
|
||||
|
||||
privacyDialogController: CustomDialogController = new CustomDialogController({
|
||||
@ -77,26 +74,29 @@ struct dialogPlusPage {
|
||||
|
||||
@CustomDialog
|
||||
struct PermissionDialog {
|
||||
private context = getContext(this) as common.ServiceExtensionContext;
|
||||
@State isBottomPopover: boolean = true;
|
||||
@State count: number = 0;
|
||||
@State result: Array<any> = [];
|
||||
@State result: Array<number> = [];
|
||||
@State accessTokenId: number = 0;
|
||||
@State initStatus: number = Constants.INIT_NEED_TO_WAIT;
|
||||
@State reqPerms: Array<string> = [];
|
||||
@State grantGroups: Array<any> = [];
|
||||
@State grantGroups: Array<GroupInfo> = [];
|
||||
@State userFixedFlag: number = 2; // means user fixed
|
||||
@State appName: string = "";
|
||||
@State locationFlag: number = Constants.LOCATION_NONE;
|
||||
@State bundleInfo: BundleInfo = new BundleInfo(0, []);
|
||||
@State targetVersion: number = 0;
|
||||
@State reqPermissionDetails: bundleManager.ReqPermissionDetail[] = [];
|
||||
@State naviHeight: number = 0
|
||||
@State refresh: number = 0;
|
||||
@Link @Watch('updateReason') isUpdate: number;
|
||||
controller: CustomDialogController
|
||||
controller?: CustomDialogController
|
||||
|
||||
build() {
|
||||
GridRow({ columns: { xs: Constants.XS_COLUMNS, sm: Constants.SM_COLUMNS, md: Constants.MD_COLUMNS, lg: Constants.LG_COLUMNS }, gutter: Constants.DIALOG_GUTTER }) {
|
||||
GridCol({ span: { xs: Constants.XS_SPAN, sm: Constants.SM_SPAN, md: Constants.DIALOG_MD_SPAN, lg: Constants.DIALOG_LG_SPAN },
|
||||
offset: {xs: Constants.XS_OFFSET, sm: Constants.SM_OFFSET, md: Constants.DIALOG_MD_OFFSET, lg: Constants.DIALOG_LG_OFFSET} }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: globalThis.isBottomPopover ? ItemAlign.End : ItemAlign.Center }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: this.isBottomPopover ? ItemAlign.End : ItemAlign.Center }) {
|
||||
Column() {
|
||||
if ((this.initStatus != Constants.INIT_NEED_TO_WAIT) && this.verify()) {
|
||||
Image(this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].icon)
|
||||
@ -144,11 +144,11 @@ struct PermissionDialog {
|
||||
if (this.showReason()) {
|
||||
Span($r('app.string.close_exact_position'))
|
||||
} else {
|
||||
if (this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].description) {
|
||||
ForEach(this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].description, item => {
|
||||
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) => {
|
||||
Span(item)
|
||||
})
|
||||
Span(this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].reason ? $r("app.string.comma") : $r("app.string.period"))
|
||||
Span(this.punctuation())
|
||||
}
|
||||
Span(this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : (this.count + this.refresh - this.refresh)].reason)
|
||||
}
|
||||
@ -199,12 +199,12 @@ struct PermissionDialog {
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
}
|
||||
}.margin({ left: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
bottom: globalThis.isBottomPopover ? this.naviHeight : 0})
|
||||
}.margin({ left: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
bottom: this.isBottomPopover ? this.naviHeight : 0})
|
||||
}
|
||||
|
||||
showTitle() {
|
||||
showTitle(): ResourceStr {
|
||||
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) {
|
||||
@ -227,6 +227,11 @@ struct PermissionDialog {
|
||||
return false;
|
||||
}
|
||||
|
||||
punctuation() {
|
||||
let reason = this.grantGroups[this.count >= this.grantGroups.length ? this.grantGroups.length - 1 : this.count].reason;
|
||||
return reason ? $r("app.string.comma") : $r("app.string.period");
|
||||
}
|
||||
|
||||
verify() {
|
||||
if ((this.initStatus == Constants.INIT_NEED_TO_TERMINATED) || (this.count >= this.grantGroups.length)) {
|
||||
this.answerRequest();
|
||||
@ -237,17 +242,17 @@ struct PermissionDialog {
|
||||
}
|
||||
|
||||
answerRequest() {
|
||||
var ret: number = Constants.RESULT_SUCCESS;
|
||||
let ret: number = Constants.RESULT_SUCCESS;
|
||||
if (this.initStatus == Constants.INIT_NEED_TO_TERMINATED) {
|
||||
ret = Constants.RESULT_FAILURE;
|
||||
}
|
||||
this.answer(ret, this.reqPerms);
|
||||
}
|
||||
|
||||
answer(ret, reqPerms) {
|
||||
answer(ret: number, reqPerms: string[]) {
|
||||
Log.info("code:" + ret + ", perms="+ JSON.stringify(reqPerms) +", result=" + JSON.stringify(this.result));
|
||||
var perms = [];
|
||||
var results = [];
|
||||
let perms: string[] = [];
|
||||
let results: number[] = [];
|
||||
reqPerms.forEach(perm => {
|
||||
perms.push(perm);
|
||||
})
|
||||
@ -261,7 +266,8 @@ struct PermissionDialog {
|
||||
data.writeStringArray(perms),
|
||||
data.writeIntArray(results)
|
||||
]).then(() => {
|
||||
proxy.sendRequest(Constants.RESULT_CODE, data, reply, option);
|
||||
let proxy = want.parameters['ohos.ability.params.callback'].value as rpc.RemoteObject;
|
||||
proxy.sendMessageRequest(Constants.RESULT_CODE, data, reply, option);
|
||||
this.destruction();
|
||||
}).catch(() => {
|
||||
Log.error('write result failed!');
|
||||
@ -270,21 +276,23 @@ struct PermissionDialog {
|
||||
}
|
||||
|
||||
destruction() {
|
||||
win.destroy();
|
||||
globalThis.windowNum --;
|
||||
Log.info("windowNum:" + globalThis.windowNum);
|
||||
if (globalThis.windowNum == 0) {
|
||||
globalThis.extensionContext.terminateSelf();
|
||||
let windowNum: number = GlobalContext.load('windowNum');
|
||||
windowNum --;
|
||||
Log.info("windowNum:" + windowNum);
|
||||
GlobalContext.store('windowNum', windowNum);
|
||||
win.destroyWindow();
|
||||
if (windowNum == 0) {
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
async privacyAccept(group, accessTokenId, permissionList, userFixedFlag) {
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
var num = 0;
|
||||
async privacyAccept(group: GroupInfo, accessTokenId: number, permissionList: string[], userFixedFlag: number) {
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
let num = 0;
|
||||
group.permissions.forEach(async permission => {
|
||||
let result;
|
||||
let result: number = -1;
|
||||
if (showSubpermissionsGrop.indexOf(group.name) == -1) {
|
||||
if (group.name == 'LOCATION' && this.bundleInfo.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE) {
|
||||
if (group.name == 'LOCATION' && this.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE) {
|
||||
if (!(((this.locationFlag == Constants.LOCATION_BOTH_FUZZY) || (this.locationFlag == Constants.LOCATION_FUZZY))
|
||||
&& (permission == PRECISE_LOCATION_PERMISSION))) {
|
||||
try {
|
||||
@ -293,7 +301,7 @@ struct PermissionDialog {
|
||||
})
|
||||
}
|
||||
catch(err) {
|
||||
Log.error("failed to grant permission:" + permission + " ret:" + result);
|
||||
Log.error("failed to grant permission:" + permission);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -303,7 +311,7 @@ struct PermissionDialog {
|
||||
})
|
||||
}
|
||||
catch(err) {
|
||||
Log.error("failed to grant permission:" + permission + " ret:" + result);
|
||||
Log.error("failed to grant permission:" + permission);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -314,12 +322,12 @@ struct PermissionDialog {
|
||||
})
|
||||
}
|
||||
catch(err) {
|
||||
Log.error("failed to grant permission:" + permission + " ret:" + result);
|
||||
Log.error("failed to grant permission:" + permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
num ++;
|
||||
Log.info("grant permission result:" + result + "permission" + permission);
|
||||
Log.info("grant permission permission" + permission);
|
||||
if (result == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
|
||||
permissionList.forEach((req, idx) => {
|
||||
if (req == permission) {
|
||||
@ -328,7 +336,7 @@ struct PermissionDialog {
|
||||
})
|
||||
Log.info("grant permission success:" + permission);
|
||||
} else {
|
||||
Log.error("failed to grant permission:" + permission + " ret:" + result);
|
||||
Log.error("failed to grant permission:" + permission);
|
||||
}
|
||||
if (num == group.permissions.length) {
|
||||
this.count ++;
|
||||
@ -336,8 +344,8 @@ struct PermissionDialog {
|
||||
})
|
||||
}
|
||||
|
||||
async privacyCancel(group, accessTokenId, permissionList, userFixedFlag) {
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
async privacyCancel(group: GroupInfo, accessTokenId: number, permissionList: string[], userFixedFlag: number) {
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
group.permissions.forEach(async permission => {
|
||||
if (showSubpermissionsGrop.indexOf(group.name) == -1) {
|
||||
if (!(this.locationFlag == Constants.LOCATION_UPGRADE && group.name == 'LOCATION') || permission == PRECISE_LOCATION_PERMISSION) {
|
||||
@ -363,14 +371,14 @@ struct PermissionDialog {
|
||||
this.count ++;
|
||||
}
|
||||
|
||||
getgrantGroups(stateGroup) {
|
||||
getgrantGroups(stateGroup: number[]) {
|
||||
//Processing of positioning
|
||||
if (this.bundleInfo.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE) {
|
||||
if (this.targetVersion >= Constants.API_VERSION_SUPPORT_STAGE) {
|
||||
if (this.reqPerms.includes(FUZZY_LOCATION_PERMISSION)) {
|
||||
this.locationFlag = Constants.LOCATION_FUZZY;
|
||||
if (this.reqPerms.includes(PRECISE_LOCATION_PERMISSION)) {
|
||||
this.locationFlag = Constants.LOCATION_BOTH_PRECISE;
|
||||
var fuzzyIndex = this.reqPerms.indexOf(FUZZY_LOCATION_PERMISSION);
|
||||
let fuzzyIndex = this.reqPerms.indexOf(FUZZY_LOCATION_PERMISSION);
|
||||
if (stateGroup[fuzzyIndex] == Constants.PASS_OPER) {
|
||||
this.locationFlag = Constants.LOCATION_UPGRADE;
|
||||
}
|
||||
@ -385,16 +393,16 @@ struct PermissionDialog {
|
||||
this.result[idx] = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED;
|
||||
//待授权
|
||||
} else if (stateGroup[idx] == Constants.DYNAMIC_OPER) {
|
||||
var group = getPermissionGroup(permission);
|
||||
let group = getPermissionGroup(permission);
|
||||
if (!group) {
|
||||
Log.info("permission not find:" + permission);
|
||||
} else {
|
||||
var exist = this.grantGroups.find(grantGroup => grantGroup.name == group.name);
|
||||
let exist = this.grantGroups.find(grantGroup => grantGroup.name == group.name);
|
||||
//判断是否为需要展示子权限的权限组
|
||||
if (showSubpermissionsGrop.indexOf(group.name) != -1) {
|
||||
let label = getPermissionLabel(permission)
|
||||
if (!exist) {
|
||||
group.description = [label];
|
||||
group.description.push(label);
|
||||
this.grantGroups.push(group);
|
||||
} else {
|
||||
if (exist.description.indexOf(label) == -1) {
|
||||
@ -413,10 +421,10 @@ struct PermissionDialog {
|
||||
this.initStatus = Constants.INIT_NEED_TO_VERIFY;
|
||||
}
|
||||
|
||||
getApplicationName(bundleName) {
|
||||
getApplicationName(bundleName: string) {
|
||||
Log.info("getApplicationName bundleName:" + bundleName);
|
||||
bundleManager.getApplicationInfo(bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT).then(applicationInfo => {
|
||||
let context = globalThis.extensionContext.createBundleContext(bundleName);
|
||||
let context = this.context.createBundleContext(bundleName);
|
||||
context.resourceManager.getString(applicationInfo.labelId, (err, value) => {
|
||||
if (value == undefined) {
|
||||
this.appName = titleTrim(applicationInfo.label);
|
||||
@ -425,27 +433,25 @@ struct PermissionDialog {
|
||||
}
|
||||
Log.info("hap label:" + applicationInfo.label + ", value:"+this.appName);
|
||||
})
|
||||
}).catch(err => {
|
||||
}).catch((err: BusinessError) => {
|
||||
Log.error("applicationInfo error :" + err);
|
||||
this.initStatus = Constants.INIT_NEED_TO_TERMINATED;
|
||||
})
|
||||
this.grantGroups.forEach((group) => {
|
||||
group.hasReason = false;
|
||||
this.getReason(group, bundleName);
|
||||
})
|
||||
}
|
||||
|
||||
getReason(group, bundleName) {
|
||||
getReason(group: GroupInfo, bundleName: string) {
|
||||
group.permissions.forEach(permission => {
|
||||
if (this.reqPerms.indexOf(permission) != -1) {
|
||||
this.bundleInfo.reqPermissionDetails.forEach(reqPermissionDetail => {
|
||||
this.reqPermissionDetails.forEach(reqPermissionDetail => {
|
||||
if (reqPermissionDetail.name == permission) {
|
||||
Log.info("reqPermissionDetail: " + JSON.stringify(reqPermissionDetail));
|
||||
let context = globalThis.extensionContext.createModuleContext(bundleName, reqPermissionDetail.moduleName);
|
||||
let context = this.context.createModuleContext(bundleName, reqPermissionDetail.moduleName);
|
||||
context.resourceManager.getString(reqPermissionDetail.reasonId, (err, value) => {
|
||||
if (value !== undefined && !group.hasReason) {
|
||||
if (value !== undefined && group.reason === '') {
|
||||
group.reason = value.slice(Constants.START_SUBSCRIPT, Constants.END_SUBSCRIPT);
|
||||
group.hasReason = true;
|
||||
this.refresh ++;
|
||||
}
|
||||
this.initStatus = Constants.INIT_NEED_TO_REFRESH;
|
||||
@ -473,6 +479,16 @@ struct PermissionDialog {
|
||||
}
|
||||
}
|
||||
|
||||
getPopupPosition() {
|
||||
try {
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
this.isBottomPopover = (bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical) ? true : false;
|
||||
} catch (exception) {
|
||||
Log.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
};
|
||||
}
|
||||
|
||||
updateReason() {
|
||||
if (this.isUpdate > 0) {
|
||||
this.getApplicationName(want.parameters['ohos.aafwk.param.callerBundleName'])
|
||||
@ -485,7 +501,6 @@ struct PermissionDialog {
|
||||
this.result = [];
|
||||
this.reqPerms = want.parameters['ohos.user.grant.permission'];
|
||||
this.accessTokenId = want.parameters['ohos.aafwk.param.callerToken'];
|
||||
proxy = want.parameters['ohos.ability.params.callback'].value;
|
||||
if (this.reqPerms == undefined || this.accessTokenId == undefined || this.reqPerms.length == 0) {
|
||||
Log.info("invalid parameters");
|
||||
this.initStatus = Constants.INIT_NEED_TO_TERMINATED;
|
||||
@ -495,18 +510,15 @@ struct PermissionDialog {
|
||||
Log.info("permission state=" + JSON.stringify(want.parameters['ohos.user.grant.permission.state']));
|
||||
this.result = new Array(this.reqPerms.length).fill(-1);
|
||||
this.getAvoidWindow();
|
||||
let uid = want.parameters['ohos.aafwk.param.callerUid'];
|
||||
bundleManager.getBundleNameByUid(uid).then((data) => {
|
||||
bundleManager.getBundleInfo(data, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(bundleInfo => {
|
||||
this.bundleInfo = bundleInfo;
|
||||
this.getgrantGroups(want.parameters['ohos.user.grant.permission.state']);
|
||||
this.getApplicationName(data);
|
||||
}).catch(err => {
|
||||
Log.error("getBundleInfo error :" + JSON.stringify(err));
|
||||
this.initStatus = Constants.INIT_NEED_TO_TERMINATED;
|
||||
})
|
||||
}).catch(err => {
|
||||
Log.error("getNameForUid error :" + JSON.stringify(err));
|
||||
this.getPopupPosition();
|
||||
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;
|
||||
this.reqPermissionDetails = bundleInfo.reqPermissionDetails;
|
||||
this.getgrantGroups(want.parameters['ohos.user.grant.permission.state']);
|
||||
this.getApplicationName(bundleName);
|
||||
}).catch((err: BusinessError) => {
|
||||
Log.error("getBundleInfo error :" + JSON.stringify(err));
|
||||
this.initStatus = Constants.INIT_NEED_TO_TERMINATED;
|
||||
})
|
||||
}
|
||||
|
@ -16,12 +16,16 @@
|
||||
import Constants from '../common/utils/constant';
|
||||
import audio from '@ohos.multimedia.audio';
|
||||
import camera from '@ohos.multimedia.camera';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import { Log } from '../common/utils/utils';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
const MICROPHONE = 'microphone';
|
||||
const CAMERA = 'camera';
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
|
||||
@Extend(Button) function customizeButton() {
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
@ -35,12 +39,14 @@ const CAMERA = 'camera';
|
||||
@Entry
|
||||
@Component
|
||||
struct globalSwitch {
|
||||
@State globalWin: window.Window = GlobalContext.load('globalWin');
|
||||
|
||||
privacyDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: globalDialog(),
|
||||
autoCancel: false,
|
||||
alignment: DialogAlignment.Center,
|
||||
customStyle: true,
|
||||
cancel: () => { globalThis.globalWin.destroyWindow() }
|
||||
cancel: () => { this.globalWin.destroyWindow() }
|
||||
})
|
||||
|
||||
build() {}
|
||||
@ -52,16 +58,19 @@ struct globalSwitch {
|
||||
|
||||
@CustomDialog
|
||||
struct globalDialog {
|
||||
controller: CustomDialogController
|
||||
private context = getContext(this) as common.ServiceExtensionContext;
|
||||
@State isBottomPopover: boolean = true;
|
||||
@State globalState: string = GlobalContext.load('globalState');
|
||||
controller?: CustomDialogController
|
||||
|
||||
build() {
|
||||
GridRow({ columns: { xs: Constants.XS_COLUMNS, sm: Constants.SM_COLUMNS, md: Constants.MD_COLUMNS, lg: Constants.LG_COLUMNS }, gutter: Constants.DIALOG_GUTTER }) {
|
||||
GridCol({ span: { xs: Constants.XS_SPAN, sm: Constants.SM_SPAN, md: Constants.DIALOG_MD_SPAN, lg: Constants.DIALOG_LG_SPAN },
|
||||
offset: {xs: Constants.XS_OFFSET, sm: Constants.SM_OFFSET, md: Constants.DIALOG_MD_OFFSET, lg: Constants.DIALOG_LG_OFFSET} }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: globalThis.isBottomPopover ? ItemAlign.End : ItemAlign.Center }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: this.isBottomPopover ? ItemAlign.End : ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(globalThis.globalState == MICROPHONE ? $r('app.string.global_title_microphone') :
|
||||
globalThis.globalState == CAMERA ? $r('app.string.global_title_camera') :
|
||||
Text(this.globalState == MICROPHONE ? $r('app.string.global_title_microphone') :
|
||||
this.globalState == CAMERA ? $r('app.string.global_title_camera') :
|
||||
$r('app.string.global_title_camera_and_microphone'))
|
||||
.fontSize(Constants.TEXT_BIG_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
@ -70,8 +79,8 @@ struct globalDialog {
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.padding({ left: Constants.DIALOG_DESP_MARGIN_LEFT, right: Constants.DIALOG_DESP_MARGIN_RIGHT,
|
||||
top: Constants.ROW_PADDING_TOP, bottom: Constants.ROW_PADDING_BOTTOM})
|
||||
Text(globalThis.globalState == MICROPHONE ? $r('app.string.global_desc_microphone') :
|
||||
globalThis.globalState == CAMERA ? $r('app.string.global_desc_camera') :
|
||||
Text(this.globalState == MICROPHONE ? $r('app.string.global_desc_microphone') :
|
||||
this.globalState == CAMERA ? $r('app.string.global_desc_camera') :
|
||||
$r('app.string.global_desc_camera_and_microphone'))
|
||||
.fontSize(Constants.TEXT_MIDDLE_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
@ -107,34 +116,35 @@ struct globalDialog {
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
}
|
||||
}.margin({ left: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN })
|
||||
}.margin({ left: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN })
|
||||
}
|
||||
|
||||
accept() {
|
||||
Log.info('global accept');
|
||||
if (globalThis.globalState == MICROPHONE) {
|
||||
var audioManager = audio.getAudioManager();
|
||||
let context: any = this.context;
|
||||
if (this.globalState == MICROPHONE) {
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
audioVolumeGroupManager.setMicrophoneMute(false).then(() => {
|
||||
globalThis.globalContext.terminateSelf();
|
||||
this.context.terminateSelf();
|
||||
})
|
||||
})
|
||||
} else if (globalThis.globalState == CAMERA) {
|
||||
let cameraManager = camera.getCameraManager(globalThis.globalContext);
|
||||
} else if (this.globalState == CAMERA) {
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
cameraManager.muteCamera(false);
|
||||
globalThis.globalContext.terminateSelf();
|
||||
this.context.terminateSelf();
|
||||
} else {
|
||||
let cameraManager = camera.getCameraManager(globalThis.globalContext);
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
cameraManager.muteCamera(false);
|
||||
var audioManager = audio.getAudioManager();
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
||||
audioVolumeManager.getVolumeGroupManager(groupid).then(audioVolumeGroupManager => {
|
||||
audioVolumeGroupManager.setMicrophoneMute(false).then(() => {
|
||||
globalThis.globalContext.terminateSelf();
|
||||
this.context.terminateSelf();
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -143,14 +153,17 @@ struct globalDialog {
|
||||
|
||||
cancel() {
|
||||
Log.info('global cancel');
|
||||
globalThis.globalContext.terminateSelf();
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
bundleManager.getApplicationInfo(Constants.BUNDLE_NAME, 0).then(data => {
|
||||
acManager.grantUserGrantedPermission(data.accessTokenId, "ohos.permission.MICROPHONE", 2);
|
||||
})
|
||||
try {
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
this.isBottomPopover = (bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical) ? true : false;
|
||||
} catch (exception) {
|
||||
Log.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -18,25 +18,23 @@ import router from '@ohos.router';
|
||||
import Constants from '../common/utils/constant';
|
||||
import { permissionGroups } from '../common/model/permissionGroup';
|
||||
import { verifyAccessToken } from "../common/utils/utils";
|
||||
import { otherPermission, routerParams_3 } from '../common/utils/typedef';
|
||||
import { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
|
||||
let routerData = router.getParams()['routerData']; // Routing jump data
|
||||
let tokenId: any = router.getParams()['tokenId']; // tokenId for verify permission
|
||||
let backTitle = router.getParams()['backTitle']; // return title name
|
||||
let status = router.getParams()['status']; // Status: Allowed, Forbidden
|
||||
let permissions: any = router.getParams()['permission']; // permissions name
|
||||
let otherPermissionList = []; // otherPermission List
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
let status: number = (router.getParams() as routerParams_3).status; // Status: Allowed, Forbidden
|
||||
let permissions: Permissions[] = (router.getParams() as routerParams_3).permission; // permissions name
|
||||
let otherPermissionList: otherPermission[] = []; // otherPermission List
|
||||
for (let i = 0; i < permissions.length; i++) {
|
||||
otherPermissionList.push({
|
||||
permissionLabel: permissionGroups.filter(item => item.permissionName == permissions[i])[0].label,
|
||||
permission: permissions[i]
|
||||
})
|
||||
otherPermissionList.push(new otherPermission(permissionGroups.filter(item => item.permissionName == permissions[i])[0].label, permissions[i]));
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct appNamePage {
|
||||
private backTitle: ResourceStr = (router.getParams() as routerParams_3).backTitle;
|
||||
private tokenId: number = (router.getParams() as routerParams_3).tokenId;
|
||||
|
||||
build() {
|
||||
GridRow({ gutter: Constants.GUTTER, columns: {
|
||||
xs: Constants.XS_COLUMNS, sm: Constants.SM_COLUMNS, md: Constants.MD_COLUMNS, lg: Constants.LG_COLUMNS } }) {
|
||||
@ -45,7 +43,7 @@ struct appNamePage {
|
||||
Row() {
|
||||
Column() {
|
||||
Row() {
|
||||
backBar({ title: JSON.stringify(backTitle), recordable: false })
|
||||
backBar({ title: JSON.stringify(this.backTitle), recordable: false })
|
||||
}
|
||||
Row() {
|
||||
Column() {
|
||||
@ -69,17 +67,21 @@ struct appNamePage {
|
||||
onPageShow() {
|
||||
console.log(TAG + 'onPageShow other-permissions');
|
||||
permissions.forEach(permission => {
|
||||
verifyAccessToken(tokenId, permission).then(data => status = data);
|
||||
verifyAccessToken(this.tokenId, permission).then((data): void => {
|
||||
status = data;
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct appNameItem {
|
||||
@State otherPermissionListItem: string[] = otherPermissionList; // Other permission interface data array
|
||||
private bundleName: string = (router.getParams() as routerParams_3).bundleName;
|
||||
private tokenId: number = (router.getParams() as routerParams_3).tokenId;
|
||||
@State otherPermissionListItem: otherPermission[] = otherPermissionList; // Other permission interface data array
|
||||
@State isTouch: string = '';
|
||||
|
||||
@Builder ListItemLayout(item) {
|
||||
@Builder ListItemLayout(item: otherPermission) {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -102,11 +104,11 @@ struct appNameItem {
|
||||
router.pushUrl({
|
||||
url: 'pages/application-tertiary',
|
||||
params: {
|
||||
routerData: routerData,
|
||||
bundleName: this.bundleName,
|
||||
backTitle: item.permissionLabel,
|
||||
permission: [item.permission],
|
||||
status,
|
||||
tokenId
|
||||
tokenId: this.tokenId
|
||||
}
|
||||
});
|
||||
})
|
||||
@ -122,7 +124,10 @@ struct appNameItem {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = item.permission;
|
||||
}
|
||||
@ -137,9 +142,9 @@ struct appNameItem {
|
||||
Column() {
|
||||
Row() {
|
||||
List() {
|
||||
ForEach(this.otherPermissionListItem, (item) => {
|
||||
ForEach(this.otherPermissionListItem, (item: otherPermission) => {
|
||||
this.ListItemLayout(item)
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: otherPermission) => JSON.stringify(item))
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
.padding(Constants.LIST_PADDING_TOP)
|
||||
|
@ -15,14 +15,17 @@
|
||||
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import router from '@ohos.router';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import privacyManager from '@ohos.privacyManager';
|
||||
import { backBar } from "../common/components/backBar";
|
||||
import Constants from '../common/utils/constant';
|
||||
import { userGrantPermissions, permissionGroupIds } from "../common/model/permissionGroup";
|
||||
import { getPermissionGroup } from '../common/utils/utils';
|
||||
import { userGrantPermissions } from "../common/model/permissionGroup";
|
||||
import { getPermissionGroup, getGroupIdByPermission } from '../common/utils/utils';
|
||||
import { StringObj, appInfoSimple, appRecordInfo, appInfo, GroupRecordInfo, appGroupRecordInfo } from '../common/utils/typedef';
|
||||
import { GlobalContext } from "../common/utils/globalContext";
|
||||
|
||||
var TAG = 'PermissionManager_MainAbility:';
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
|
||||
@Extend(Image) function customizeImage(width: number, height: number) {
|
||||
.objectFit(ImageFit.Contain)
|
||||
@ -30,21 +33,15 @@ var TAG = 'PermissionManager_MainAbility:';
|
||||
.height(height)
|
||||
};
|
||||
|
||||
class StringObj {
|
||||
morning: string
|
||||
afternoon: string
|
||||
constructor(morning: string, afternoon: string) {
|
||||
this.morning = morning
|
||||
this.afternoon = afternoon
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct permissionRecordPage {
|
||||
@State groups: any[] = [];
|
||||
@State applicationInfos: any[] = [];
|
||||
@State permissionApplications: any[] = [];
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@State isVertical: boolean = GlobalContext.load('isVertical');
|
||||
@State allBundleInfo: appInfo[] = GlobalContext.load('allBundleInfo');
|
||||
@State groups: GroupRecordInfo[] = [];
|
||||
@State applicationInfos: appRecordInfo[] = [];
|
||||
@State permissionApplications: appRecordInfo[] = [];
|
||||
@State permissionIndex: number = -1;
|
||||
@State applicationIndex: number = -1;
|
||||
@State strings: StringObj = new StringObj('', '');
|
||||
@ -69,26 +66,20 @@ struct permissionRecordPage {
|
||||
}
|
||||
}.height(Constants.TAB_HEIGHT)
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.padding({ left: globalThis.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_START,
|
||||
right: globalThis.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_END })
|
||||
.padding({ left: this.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_START,
|
||||
right: this.isVertical ? Constants.TAB_INNER_PADDING : Constants.DEFAULT_PADDING_END })
|
||||
}
|
||||
|
||||
@Builder ListItemLayout(item, index, dimension) {
|
||||
@Builder PermissionListItemLayout(item: GroupRecordInfo, index: number) {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Column() {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
if (dimension) {
|
||||
Image(item.icon)
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.MANAGEMENT_IMAGE_WIDTH, Constants.MANAGEMENT_IMAGE_HEIGHT)
|
||||
.margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT_RECORD, left: Constants.MANAGEMENT_IMAGE_MARGIN_LEFT })
|
||||
} else {
|
||||
Image(item.icon)
|
||||
.customizeImage(Constants.APPLICATION_IMAGE_WIDTH, Constants.APPLICATION_IMAGE_HEIGHT)
|
||||
.margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT })
|
||||
}
|
||||
Image(item.icon)
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.MANAGEMENT_IMAGE_WIDTH, Constants.MANAGEMENT_IMAGE_HEIGHT)
|
||||
.margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT_RECORD, left: Constants.MANAGEMENT_IMAGE_MARGIN_LEFT })
|
||||
Column() {
|
||||
Text(item.groupName)
|
||||
.width(Constants.MAXIMUM_HEADER_WIDTH)
|
||||
@ -99,67 +90,32 @@ struct permissionRecordPage {
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(Constants.TEXT_LINE_HEIGHT)
|
||||
.margin({ bottom: Constants.TERTIARY_LABEL_MARGIN_BOTTOM })
|
||||
if (dimension) {
|
||||
Text() {
|
||||
Span($r("app.string.visits"))
|
||||
Span(String(item.sum))
|
||||
}
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT)
|
||||
} else {
|
||||
Row() {
|
||||
if (item.permissions) {
|
||||
ForEach(item.permissions, permission => {
|
||||
Image(permission.icon)
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD_APPLICATION, Constants.IMAGE_HEIGHT_RECORD_APPLICATION)
|
||||
.margin({ right: Constants.APPLICATION_TEXT_MARGIN_RIGHT })
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
}
|
||||
Text() {
|
||||
Span($r("app.string.visits"))
|
||||
Span(String(item.sum))
|
||||
}
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT)
|
||||
}.flexGrow(Constants.FLEX_GROW)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
if (dimension) {
|
||||
if (index == this.permissionIndex) {
|
||||
Image($r('app.media.xiangshangjiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
} else {
|
||||
Image($r('app.media.xiangxiajiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
}
|
||||
} else {
|
||||
if (index == this.applicationIndex) {
|
||||
Image($r('app.media.xiangshangjiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
} else {
|
||||
Image($r('app.media.xiangxiajiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
}
|
||||
}
|
||||
Image(index == this.permissionIndex ? $r('app.media.xiangshangjiantou') : $r('app.media.xiangxiajiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
}
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.height(dimension ? Constants.LISTITEM_HEIGHT_PERMISSION : Constants.LISTITEM_HEIGHT_APPLICATION)
|
||||
.height(Constants.LISTITEM_HEIGHT_PERMISSION)
|
||||
}
|
||||
}.onClick(() => {
|
||||
dimension ?
|
||||
(this.permissionIndex = this.permissionIndex == index ? -1 : index) :
|
||||
(this.applicationIndex = this.applicationIndex == index ? -1 : index)
|
||||
if (dimension) {
|
||||
this.permissionApplications = this.applicationInfos.filter(appInfo => {
|
||||
return appInfo.groupNames.includes(item.groupName);
|
||||
})
|
||||
}
|
||||
this.permissionIndex = this.permissionIndex == index ? -1 : index
|
||||
this.permissionApplications = this.applicationInfos.filter((appInfo) => {
|
||||
return appInfo.groupNames.includes(item.groupName);
|
||||
})
|
||||
})
|
||||
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
|
||||
if (dimension && (index == this.permissionIndex)) {
|
||||
if (index == this.permissionIndex) {
|
||||
List() {
|
||||
ForEach(this.permissionApplications, (permissionApplication) => {
|
||||
ForEach(this.permissionApplications, (permissionApplication: appRecordInfo) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image(permissionApplication.icon)
|
||||
@ -195,15 +151,16 @@ struct permissionRecordPage {
|
||||
}
|
||||
}.height(Constants.LISTITEM_HEIGHT_APPLICATION)
|
||||
.onClick(() => {
|
||||
globalThis.applicationInfo = {
|
||||
'bundleName': permissionApplication.name,
|
||||
'api': permissionApplication.api,
|
||||
'tokenId': permissionApplication.accessTokenId,
|
||||
'icon': permissionApplication.icon,
|
||||
'label': permissionApplication.groupName,
|
||||
'permissions': permissionApplication.reqUserPermissions,
|
||||
'groupId': permissionApplication.groupIds
|
||||
}
|
||||
let info: appInfoSimple = new appInfoSimple(
|
||||
permissionApplication.name,
|
||||
permissionApplication.api,
|
||||
permissionApplication.accessTokenId,
|
||||
permissionApplication.icon,
|
||||
permissionApplication.groupName,
|
||||
permissionApplication.reqUserPermissions,
|
||||
permissionApplication.groupIds
|
||||
)
|
||||
GlobalContext.store('applicationInfo', info);
|
||||
router.pushUrl({ url: 'pages/application-secondary' });
|
||||
})
|
||||
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
|
||||
@ -217,7 +174,10 @@ struct permissionRecordPage {
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = permissionApplication.name;
|
||||
}
|
||||
@ -225,12 +185,59 @@ struct permissionRecordPage {
|
||||
this.isTouch = '';
|
||||
}
|
||||
})
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: appRecordInfo) => JSON.stringify(item))
|
||||
}
|
||||
}
|
||||
if (!dimension && (index == this.applicationIndex)) {
|
||||
}
|
||||
}.padding(Constants.LIST_PADDING_TOP)
|
||||
.margin({ bottom: Constants.LISTITEM_MARGIN_BOTTOM })
|
||||
.backgroundColor($r('sys.color.ohos_id_color_list_card_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_card'))
|
||||
}
|
||||
|
||||
@Builder ApplicationListItemLayout(item: appRecordInfo, index: number) {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Column() {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Image(item.icon)
|
||||
.customizeImage(Constants.APPLICATION_IMAGE_WIDTH, Constants.APPLICATION_IMAGE_HEIGHT)
|
||||
.margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT })
|
||||
Column() {
|
||||
Text(item.groupName)
|
||||
.width(Constants.MAXIMUM_HEADER_WIDTH)
|
||||
.maxLines(Constants.MAXIMUM_HEADER_LINES)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontSize(Constants.TEXT_MIDDLE_FONT_SIZE)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(Constants.TEXT_LINE_HEIGHT)
|
||||
.margin({ bottom: Constants.TERTIARY_LABEL_MARGIN_BOTTOM })
|
||||
Row() {
|
||||
ForEach(item.permissions, (permission: appGroupRecordInfo) => {
|
||||
Image(permission.icon)
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD_APPLICATION, Constants.IMAGE_HEIGHT_RECORD_APPLICATION)
|
||||
.margin({ right: Constants.APPLICATION_TEXT_MARGIN_RIGHT })
|
||||
}, (item: appGroupRecordInfo) => JSON.stringify(item))
|
||||
}
|
||||
}.flexGrow(Constants.FLEX_GROW)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
Image(index == this.applicationIndex ? $r('app.media.xiangshangjiantou') : $r('app.media.xiangxiajiantou'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.customizeImage(Constants.IMAGE_WIDTH_RECORD, Constants.IMAGE_HEIGHT_RECORD)
|
||||
}
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.LISTITEM_HEIGHT_APPLICATION)
|
||||
}
|
||||
}.onClick(() => {
|
||||
this.applicationIndex = this.applicationIndex == index ? -1 : index
|
||||
})
|
||||
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
|
||||
if (index == this.applicationIndex) {
|
||||
List() {
|
||||
ForEach(item.permissions, (permission) => {
|
||||
ForEach(item.permissions, (permission: appGroupRecordInfo) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image(permission.icon)
|
||||
@ -249,14 +256,14 @@ struct permissionRecordPage {
|
||||
.margin({ bottom: Constants.TERTIARY_LABEL_MARGIN_BOTTOM })
|
||||
Text() {
|
||||
Span($r("app.string.visits"))
|
||||
Span(String(permission['count' + item.accessTokenId]))
|
||||
Span(String(permission.count))
|
||||
Span($r("app.string.recent_visit"))
|
||||
Span(this.getTime(permission['lastTime' + item.accessTokenId]))
|
||||
Span(this.getTime(permission.lastTime))
|
||||
}
|
||||
.padding({ right: Constants.LISTITEM_PADDING_RIGHT_RECORD })
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT)
|
||||
.padding({ right: Constants.LISTITEM_PADDING_RIGHT_RECORD })
|
||||
.fontSize(Constants.TEXT_SMALL_FONT_SIZE)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT)
|
||||
}.alignItems(HorizontalAlign.Start)
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
.width(Constants.FULL_WIDTH)
|
||||
@ -264,29 +271,25 @@ struct permissionRecordPage {
|
||||
}
|
||||
}.height(Constants.LISTITEM_HEIGHT_PERMISSION)
|
||||
.onClick(() => {
|
||||
globalThis.applicationInfo = {
|
||||
'bundleName': item.name,
|
||||
'api': item.api,
|
||||
'tokenId': item.accessTokenId,
|
||||
'icon': item.icon,
|
||||
'label': item.groupName,
|
||||
'permissions': item.reqUserPermissions,
|
||||
'groupId': item.groupIds
|
||||
}
|
||||
let info: appInfoSimple = new appInfoSimple(item.name, item.api, item.accessTokenId, item.icon, item.groupName, item.reqUserPermissions, item.groupIds);
|
||||
GlobalContext.store('applicationInfo', info);
|
||||
router.pushUrl({ url: 'pages/application-secondary' });
|
||||
})
|
||||
.padding({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') })
|
||||
.borderRadius($r("sys.float.ohos_id_corner_radius_default_l"))
|
||||
.linearGradient((this.isTouch === permission.name) ? {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [['#DCEAF9', 0.0], ['#FAFAFA', 1.0]]
|
||||
} : {
|
||||
angle: 90,
|
||||
direction: GradientDirection.Right,
|
||||
colors: [[$r("sys.color.ohos_id_color_list_card_bg"), 1], [$r("sys.color.ohos_id_color_list_card_bg"), 1]]
|
||||
})
|
||||
.onTouch(event => {
|
||||
if (event === undefined) {
|
||||
return;
|
||||
}
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = permission.name;
|
||||
}
|
||||
@ -294,7 +297,7 @@ struct permissionRecordPage {
|
||||
this.isTouch = '';
|
||||
}
|
||||
})
|
||||
}, item => JSON.stringify(item))
|
||||
}, (item: appGroupRecordInfo) => JSON.stringify(item))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,9 +337,9 @@ struct permissionRecordPage {
|
||||
Scroll() {
|
||||
Row() {
|
||||
List() {
|
||||
ForEach(this.groups, (item, index) => {
|
||||
this.ListItemLayout(item, index, Constants.PERMISSION)
|
||||
}, item => JSON.stringify(item))
|
||||
ForEach(this.groups, (item: GroupRecordInfo, index) => {
|
||||
this.PermissionListItemLayout(item, index as number)
|
||||
}, (item: GroupRecordInfo) => JSON.stringify(item))
|
||||
}.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
}.padding({
|
||||
@ -356,9 +359,9 @@ struct permissionRecordPage {
|
||||
Row() {
|
||||
if (this.show) {
|
||||
List() {
|
||||
ForEach(this.applicationInfos, (item, index) => {
|
||||
this.ListItemLayout(item, index, Constants.APPLICATION)
|
||||
}, item => JSON.stringify(item))
|
||||
ForEach(this.applicationInfos, (item: appRecordInfo, index) => {
|
||||
this.ApplicationListItemLayout(item, index as number)
|
||||
}, (item: appRecordInfo) => JSON.stringify(item))
|
||||
}.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
}
|
||||
@ -407,19 +410,20 @@ struct permissionRecordPage {
|
||||
* Get time
|
||||
* @param {Number} The time stamp
|
||||
*/
|
||||
getTime(time, format='MM月DD日 NNHH:mm') {
|
||||
getTime(time: number, format='MM月DD日 NNHH:mm') {
|
||||
if (this.strings.morning == 'am') { format = 'HH:mm NN MM/DD' }
|
||||
let date = new Date(time);
|
||||
let config = {
|
||||
MM: date.getMonth() + 1,
|
||||
DD: date.getDate(),
|
||||
NN: date.getHours() >= 12 ? this.strings.afternoon : this.strings.morning,
|
||||
HH: date.getHours() >= 12 ? date.getHours() - 12 : date.getHours(),
|
||||
mm: date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes(),
|
||||
}
|
||||
let key = ['MM', 'DD', 'NN', 'HH', 'mm'];
|
||||
let value = [
|
||||
date.getMonth() + 1,
|
||||
date.getDate(),
|
||||
date.getHours() >= 12 ? this.strings.afternoon : this.strings.morning,
|
||||
date.getHours() >= 12 ? date.getHours() - 12 : date.getHours(),
|
||||
date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes(),
|
||||
];
|
||||
|
||||
for (const key in config) {
|
||||
format = format.replace(key,config[key]);
|
||||
for (let i = 0; i < key.length; ++i) {
|
||||
format = format.replace(key[i], String(value[i]));
|
||||
}
|
||||
return format;
|
||||
}
|
||||
@ -430,41 +434,41 @@ struct permissionRecordPage {
|
||||
* @param {String} groupName
|
||||
* @param {Boolean} true: count, false: lastTime
|
||||
*/
|
||||
getAppRecords(appInfo, groupName, option) {
|
||||
var record = appInfo.permissions.filter(permission => {
|
||||
getAppRecords(appInfo: appRecordInfo, groupName: ResourceStr, option: boolean): number {
|
||||
let record = appInfo.permissions.filter(permission => {
|
||||
return permission.groupName == groupName;
|
||||
})
|
||||
if (record.length > 0) {
|
||||
return option ? record[0]['count' + appInfo.accessTokenId] : record[0]['lastTime' + appInfo.accessTokenId];
|
||||
return option ? record[0].count : record[0].lastTime;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
getStrings() {
|
||||
globalThis.context.resourceManager.getString($r("app.string.morning").id, (err, val) => {
|
||||
this.context.resourceManager.getString($r("app.string.morning").id, (err, val) => {
|
||||
this.strings.morning = val;
|
||||
})
|
||||
globalThis.context.resourceManager.getString($r("app.string.afternoon").id, (err, val) => {
|
||||
this.context.resourceManager.getString($r("app.string.afternoon").id, (err, val) => {
|
||||
this.strings.afternoon = val;
|
||||
})
|
||||
}
|
||||
|
||||
getInfo(record, sortFlag) {
|
||||
bundleManager.getBundleInfo(record.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(async info => {
|
||||
var reqUserPermissions: string[] = [];
|
||||
var reqUserRecords: any[] = [];
|
||||
var permissionGroups: any[] = [];
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
var appInfo: any = {};
|
||||
let reqPermissions: Array<string> = [];
|
||||
getInfo(record: privacyManager.BundleUsedRecord, sortFlag: boolean) {
|
||||
bundleManager.getBundleInfo(record.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(async (info): Promise<boolean> => {
|
||||
let reqUserPermissions: string[] = [];
|
||||
let reqUserRecords: privacyManager.PermissionUsedRecord[] = [];
|
||||
let permissionGroups: appGroupRecordInfo[] = [];
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
let appInfo: appRecordInfo = new appRecordInfo('', '', '', 0, 0, [], [], [], [], 0);
|
||||
let reqPermissions: Array<Permissions> = [];
|
||||
info.reqPermissionDetails.forEach(item => {
|
||||
reqPermissions.push(item.name);
|
||||
reqPermissions.push(item.name as Permissions);
|
||||
});
|
||||
for (let j = 0; j < record.permissionRecords.length; j++) {
|
||||
var permission = record.permissionRecords[j].permissionName;
|
||||
let permission = record.permissionRecords[j].permissionName;
|
||||
try {
|
||||
var flag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, permission);
|
||||
let flag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, permission);
|
||||
if (flag == Constants.PERMISSION_SYSTEM_FIXED) {
|
||||
continue;
|
||||
}
|
||||
@ -480,9 +484,9 @@ struct permissionRecordPage {
|
||||
return false;
|
||||
}
|
||||
for (let k = 0; k < reqPermissions.length; k++) {
|
||||
var reqPermission: any = reqPermissions[k];
|
||||
let reqPermission = reqPermissions[k];
|
||||
try {
|
||||
var reqFlag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, reqPermission);
|
||||
let reqFlag = await acManager.getPermissionFlags(info.appInfo.accessTokenId, reqPermission);
|
||||
if (reqFlag == Constants.PERMISSION_SYSTEM_FIXED) {
|
||||
continue;
|
||||
}
|
||||
@ -495,36 +499,36 @@ struct permissionRecordPage {
|
||||
}
|
||||
}
|
||||
|
||||
let groupNames = [];
|
||||
let groupNames: ResourceStr[] = [];
|
||||
let appLastTime = 0;
|
||||
reqUserRecords.forEach(reqUserRecord => {
|
||||
var group = getPermissionGroup(reqUserRecord.permissionName);
|
||||
let group = getPermissionGroup(reqUserRecord.permissionName);
|
||||
if (!group) {
|
||||
console.info(TAG + "permission not find:" + reqUserRecord.permissionName);
|
||||
} else {
|
||||
var existing = permissionGroups.find(permissionGroup => permissionGroup.name == group.name);
|
||||
var lastTime = reqUserRecord.lastAccessTime;
|
||||
let existing = permissionGroups.find(permissionGroup => permissionGroup.name == group.name);
|
||||
let lastTime = reqUserRecord.lastAccessTime;
|
||||
lastTime > appLastTime ? appLastTime = lastTime : '';
|
||||
if (!existing) {
|
||||
group['count' + record.tokenId] = reqUserRecord.accessCount;
|
||||
group['lastTime' + record.tokenId] = lastTime;
|
||||
permissionGroups.push(group);
|
||||
let appGroupRecord: appGroupRecordInfo = new appGroupRecordInfo(group.name, group.groupName, group.label, group.icon, reqUserRecord.accessCount, lastTime);
|
||||
permissionGroups.push(appGroupRecord);
|
||||
groupNames.push(group.groupName);
|
||||
} else {
|
||||
existing['count' + record.tokenId] += reqUserRecord.accessCount;
|
||||
lastTime > existing['lastTime' + record.tokenId] ? existing['lastTime' + record.tokenId] = lastTime : '';
|
||||
existing.count += reqUserRecord.accessCount;
|
||||
lastTime > existing.lastTime ? existing.lastTime = lastTime : '';
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let groupIds = [];
|
||||
let groupIds: number[] = [];
|
||||
for (let i = 0; i < reqUserPermissions.length; i++) {
|
||||
if (groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1){
|
||||
groupIds.push(permissionGroupIds[reqUserPermissions[i]]);
|
||||
let groupId = getGroupIdByPermission(reqUserPermissions[i])
|
||||
if (groupIds.indexOf(groupId) == -1){
|
||||
groupIds.push(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.allBundleInfo.forEach(bundleInfo => {
|
||||
this.allBundleInfo.forEach(bundleInfo => {
|
||||
if (bundleInfo.bundleName === info.name) {
|
||||
appInfo.groupName = bundleInfo.label;
|
||||
appInfo.icon = bundleInfo.icon;
|
||||
@ -541,31 +545,32 @@ struct permissionRecordPage {
|
||||
appInfo.appLastTime = appLastTime;
|
||||
this.applicationInfos.push(appInfo);
|
||||
if (sortFlag) {
|
||||
var appInfos: any[] = [];
|
||||
let appInfos: appRecordInfo[] = [];
|
||||
this.applicationInfos.forEach(item => { appInfos.push(item) });
|
||||
appInfos.sort((a, b) => { return b.appLastTime - a.appLastTime });
|
||||
this.applicationInfos = appInfos;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
}
|
||||
|
||||
getAllRecords() {
|
||||
let request = {
|
||||
"tokenId": 0,
|
||||
"isRemote": false,
|
||||
"deviceId": '',
|
||||
"bundleName": '',
|
||||
"permissionNames": [],
|
||||
"beginTime": 0,
|
||||
"endTime": 0,
|
||||
"flag": 1
|
||||
let request: privacyManager.PermissionUsedRequest = {
|
||||
tokenId: 0,
|
||||
isRemote: false,
|
||||
deviceId: '',
|
||||
bundleName: '',
|
||||
permissionNames: [],
|
||||
beginTime: 0,
|
||||
endTime: 0,
|
||||
flag: 1
|
||||
}
|
||||
privacyManager.getPermissionUsedRecord(request).then(async records => {
|
||||
console.info(TAG + "records: " + JSON.stringify(records.bundleRecords));
|
||||
var groupArray: any[] = [];
|
||||
var acManager = abilityAccessCtrl.createAtManager();
|
||||
let groupArray: GroupRecordInfo[] = [];
|
||||
let acManager = abilityAccessCtrl.createAtManager();
|
||||
for (let i = 0; i < records.bundleRecords.length; i++) {
|
||||
var record = records.bundleRecords[i];
|
||||
let record = records.bundleRecords[i];
|
||||
try {
|
||||
await bundleManager.queryAbilityInfo({
|
||||
bundleName: record.bundleName,
|
||||
@ -579,9 +584,9 @@ struct permissionRecordPage {
|
||||
this.getInfo(record, (i + 1) == records.bundleRecords.length);
|
||||
|
||||
for (let j = 0; j < record.permissionRecords.length; j++) {
|
||||
var permissionRecord = record.permissionRecords[j];
|
||||
let permissionRecord = record.permissionRecords[j];
|
||||
try {
|
||||
var reqFlag = await acManager.getPermissionFlags(record.tokenId, permissionRecord.permissionName);
|
||||
let reqFlag = await acManager.getPermissionFlags(record.tokenId, permissionRecord.permissionName);
|
||||
if (reqFlag == Constants.PERMISSION_SYSTEM_FIXED) {
|
||||
continue;
|
||||
}
|
||||
@ -589,14 +594,13 @@ struct permissionRecordPage {
|
||||
catch(err) {
|
||||
console.log(TAG + 'getPermissionFlags error: ' + JSON.stringify(err));
|
||||
}
|
||||
var group = getPermissionGroup(permissionRecord.permissionName);
|
||||
let group = getPermissionGroup(permissionRecord.permissionName);
|
||||
if (group) {
|
||||
var exist = groupArray.find(permissionGroup => permissionGroup.name == group.name);
|
||||
var lastTime = permissionRecord.lastAccessTime;
|
||||
let exist = groupArray.find(permissionGroup => permissionGroup.name == group.name);
|
||||
let lastTime = permissionRecord.lastAccessTime;
|
||||
if (!exist) {
|
||||
group.sum = permissionRecord.accessCount;
|
||||
group.recentVisit = lastTime;
|
||||
groupArray.push(group);
|
||||
let groupRecord: GroupRecordInfo = new GroupRecordInfo(group.name, group.groupName, group.label, group.icon, group.permissions, permissionRecord.accessCount, lastTime);
|
||||
groupArray.push(groupRecord);
|
||||
} else {
|
||||
exist.sum += permissionRecord.accessCount;
|
||||
lastTime > exist.recentVisit ? exist.recentVisit = lastTime : '';
|
||||
|
@ -15,33 +15,32 @@
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import Constants from '../common/utils/constant';
|
||||
import window from '@ohos.window';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { Log } from '../common/utils/utils';
|
||||
import { param, wantInfo } from '../common/utils/typedef';
|
||||
|
||||
let storage = LocalStorage.GetShared();
|
||||
let want: any = '';
|
||||
let win: any = '';
|
||||
|
||||
interface param {
|
||||
'icon': Resource,
|
||||
'label': Resource
|
||||
};
|
||||
let bottomPopoverTypes = ['default', 'phone'];
|
||||
let storage = LocalStorage.getShared();
|
||||
let want: wantInfo;
|
||||
let win: window.Window;
|
||||
|
||||
@Entry(storage)
|
||||
@Component
|
||||
struct SecurityDialog {
|
||||
@LocalStorageLink('want') want: Object = {};
|
||||
@LocalStorageLink('win') win: Object = {};
|
||||
private context = getContext(this) as common.ServiceExtensionContext;
|
||||
@LocalStorageLink('want') want: wantInfo = new wantInfo([]);
|
||||
@LocalStorageLink('win') win: window.Window = {} as window.Window;
|
||||
|
||||
securityDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomSecurityDialog(),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
customStyle: true,
|
||||
cancel: () => {
|
||||
win.destroy();
|
||||
globalThis.windowNum --;
|
||||
if (globalThis.windowNum == 0) {
|
||||
globalThis.securityContext.terminateSelf();
|
||||
}
|
||||
win.destroyWindow();
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
})
|
||||
|
||||
@ -56,46 +55,39 @@ struct SecurityDialog {
|
||||
|
||||
@CustomDialog
|
||||
struct CustomSecurityDialog {
|
||||
controller: CustomDialogController;
|
||||
private context = getContext(this) as common.ServiceExtensionContext;
|
||||
@State isBottomPopover: boolean = true;
|
||||
controller?: CustomDialogController;
|
||||
descriptor: string = ''
|
||||
@State appName: string = 'ToBeInstead';
|
||||
@State index: number = 0;
|
||||
@State naviHeight: number = 0
|
||||
|
||||
securityParams : Array<param> = [
|
||||
{
|
||||
'icon': $r('app.media.ic_public_gps'),
|
||||
'label': $r('app.string.location_desc'),
|
||||
},
|
||||
{
|
||||
'icon': $r('app.media.ic_public_folder'),
|
||||
'label': $r('app.string.media_files_desc')
|
||||
}
|
||||
new param($r('app.media.ic_public_gps'), $r('app.string.location_desc')),
|
||||
new param($r('app.media.ic_public_folder'), $r('app.string.media_files_desc'))
|
||||
]
|
||||
|
||||
GetAppName() {
|
||||
let bundleName: string = want.parameters['ohos.aafwk.param.callerBundleName'];
|
||||
bundleManager.getApplicationInfo(bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT)
|
||||
.then(data => {
|
||||
globalThis.securityContext.resourceManager.getStringValue(data.labelResource)
|
||||
this.context.resourceManager.getStringValue(data.labelResource)
|
||||
.then(data => {
|
||||
this.appName = data;
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error: BusinessError) => {
|
||||
Log.error('getStringValue failed. err is ' + JSON.stringify(error));
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error: BusinessError) => {
|
||||
Log.error('getApplicationInfo failed. err is ' + JSON.stringify(error));
|
||||
});
|
||||
}
|
||||
|
||||
destruction() {
|
||||
win.destroy();
|
||||
globalThis.windowNum --;
|
||||
if (globalThis.windowNum == 0) {
|
||||
globalThis.securityContext.terminateSelf();
|
||||
}
|
||||
win.destroyWindow();
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
|
||||
getAvoidWindow() {
|
||||
@ -109,6 +101,16 @@ struct CustomSecurityDialog {
|
||||
}
|
||||
}
|
||||
|
||||
getPopupPosition() {
|
||||
try {
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
let isVertical = dis.width > dis.height ? false : true;
|
||||
this.isBottomPopover = (bottomPopoverTypes.includes(deviceInfo.deviceType) && isVertical) ? true : false;
|
||||
} catch (exception) {
|
||||
Log.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
|
||||
};
|
||||
}
|
||||
|
||||
build() {
|
||||
GridRow({
|
||||
columns: {
|
||||
@ -129,7 +131,7 @@ struct CustomSecurityDialog {
|
||||
}) {
|
||||
Flex({
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: globalThis.isBottomPopover ? ItemAlign.End : ItemAlign.Center
|
||||
alignItems: this.isBottomPopover ? ItemAlign.End : ItemAlign.Center
|
||||
}) {
|
||||
Row() {
|
||||
Column() {
|
||||
@ -176,7 +178,9 @@ struct CustomSecurityDialog {
|
||||
.height(Constants.SECURITY_BUTTON_HEIGHT)
|
||||
.width(Constants.FULL_WIDTH)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
if (this.controller !== undefined) {
|
||||
this.controller.close();
|
||||
}
|
||||
this.destruction();
|
||||
})
|
||||
}
|
||||
@ -190,9 +194,9 @@ struct CustomSecurityDialog {
|
||||
}.width(Constants.FULL_WIDTH)
|
||||
.height(Constants.FULL_HEIGHT)
|
||||
}
|
||||
}.margin({ left: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: globalThis.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
bottom: globalThis.isBottomPopover ? this.naviHeight : 0})
|
||||
}.margin({ left: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
right: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN,
|
||||
bottom: this.isBottomPopover ? this.naviHeight : 0})
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
@ -200,6 +204,7 @@ struct CustomSecurityDialog {
|
||||
this.getAvoidWindow();
|
||||
this.GetAppName();
|
||||
this.index = want.parameters['ohos.user.security.type'];
|
||||
this.getPopupPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,6 @@
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_AUDIO_CONFIG"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MICROPHONE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_CAMERA_CONFIG"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user