diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/components/location.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/components/location.ets new file mode 100644 index 0000000000000000000000000000000000000000..af952fe11d51792c10201b7c9805d5b6e73135da --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/components/location.ets @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 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 Constants from '../utils/constant'; + +@Extend(Button) function locationButton() { + .backgroundColor($r('app.color.default_background_color')) + .fontWeight(FontWeight.Medium) + .fontSize(Constants.TEXT_SMALLER_FONT_SIZE) + .height(Constants.LOCATION_BUTTON_HEIGHT) + .width(Constants.LOCATION_BUTTON_WIDTH) + .borderRadius(Constants.LOCATION_BUTTON_RADIUS) + .position({ x: Constants.LOCATION_BUTTON_POSITION_X, y: Constants.LOCATION_BUTTON_POSITION_Y }) +} + +@Component +export struct LocationCanvas { + @Link locationFlag: any + + build() { + Column() { + Image($r('app.media.img_location_map')) + .width(Constants.FULL_WIDTH) + .height(Constants.FULL_HEIGHT) + .scale({ x: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) + ? Constants.LOCATION_CANVAS_ZOOM_SCALE : Constants.LOCATION_CANVAS_INITIAL_SCALE, + y: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) + ? Constants.LOCATION_CANVAS_ZOOM_SCALE : Constants.LOCATION_CANVAS_INITIAL_SCALE }) + .animation({ + duration: Constants.LOCATION_ANIMATION_DURATION, // Animation duration + curve: Curve.Smooth, // The animation curve + playMode: PlayMode.Normal // The animation mode + }) + Image($r('app.media.ic_public_gps_filled')) + .fillColor($r('sys.color.ohos_id_color_emphasize')) + .width(Constants.LOCATION_ICON_WIDTH) + .height(Constants.LOCATION_ICON_HEIGHT) + .position({ x: Constants.LOCATION_ICON_POSITION_X, y: Constants.LOCATION_ICON_POSITION_Y }) + .opacity(((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) ? 1 : 0) + .scale({ x: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) ? 1 : 0.8, + y: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) ? 1 : 0.8 }) + .animation({ + duration: Constants.LOCATION_ANIMATION_DURATION / 2, // Animation duration + delay: this.locationFlag == Constants.LOCATION_BOTH_PRECISE ? (Constants.LOCATION_ANIMATION_DURATION / 2) : 0, + curve: Curve.Smooth, // The animation curve + playMode: PlayMode.Normal // The animation mode + }) + Circle({ width: Constants.LOCATION_CIRCLE_DIA, height: Constants.LOCATION_CIRCLE_DIA }) + .position({ x: Constants.LOCATION_CIRCLE_POSITION_X, y: Constants.LOCATION_CIRCLE_POSITION_Y }) + .fill($r('app.color.location_circle_color')) + .fillOpacity(Constants.LOCATION_CIRCLE_OPACITY) + .stroke($r('app.color.location_circle_color')) + .scale({ x: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) ? 0 : 1, + y: ((this.locationFlag == Constants.LOCATION_UPGRADE) || (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) ? 0 : 1 }) + .animation({ + duration: Constants.LOCATION_ANIMATION_DURATION, // Animation duration + curve: Curve.Smooth, // The animation curve + playMode: PlayMode.Normal // The animation mode + }) + if(this.locationFlag == Constants.LOCATION_BOTH_PRECISE) { + Button($r('app.string.precise_location_on')) + .locationButton() + .fontColor($r('app.color.button_color')) + .onClick(() => { this.locationFlag = Constants.LOCATION_BOTH_FUZZY }) + } + if(this.locationFlag == Constants.LOCATION_BOTH_FUZZY) { + Button($r('app.string.precise_location_off')) + .locationButton() + .fontColor($r('app.color.label_color_light')) + .onClick(() => { this.locationFlag = Constants.LOCATION_BOTH_PRECISE }) + } + }.width(Constants.FULL_WIDTH) + .height(Constants.LOCATION_CANVAS_HEIGHT) + .margin({ top: Constants.LOCATION_CANVAS_MARGIN_TOP, bottom: Constants.LOCATION_CANVAS_MARGIN_BOTTOM }) + .clip(true) + } +} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/model/permissionGroup.ets index d389c6b59f9cc339205b910b8fc957995fc4ae3f..72b00b42d08f6d557eef3534a1bec45e38f618c1 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/model/permissionGroup.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/model/permissionGroup.ets @@ -21,6 +21,13 @@ export const permissionGroups: any[] = [ "description": "允许应用在后台运行时获取位置信息。", "groupId": 0 }, + { + "permissionName": "ohos.permission.APPROXIMATELY_LOCATION", + "groupName": "LOCATION", + "label": "模糊位置权限", + "description": "允许应用获取模糊位置信息。", + "groupId": 0 + }, { "permissionName": "ohos.permission.LOCATION", "groupName": "LOCATION", @@ -195,8 +202,9 @@ export const groups: any[] = [ "label": "访问位置信息?", "permissions": [ "ohos.permission.LOCATION_IN_BACKGROUND", - "ohos.permission.LOCATION" + "ohos.permission.APPROXIMATELY_LOCATION" ], + "specialPermission": 'ohos.permission.LOCATION', "isShow":true }, { @@ -335,6 +343,7 @@ export const groups: any[] = [ export const permissionGroupPermissions: object = { "LOCATION": [ "ohos.permission.LOCATION_IN_BACKGROUND", + "ohos.permission.APPROXIMATELY_LOCATION", "ohos.permission.LOCATION" ], "CAMERA": [ @@ -386,6 +395,7 @@ export const permissionGroupPermissions: object = { export const userGrantPermissions: string[] = [ "ohos.permission.LOCATION_IN_BACKGROUND", + "ohos.permission.APPROXIMATELY_LOCATION", "ohos.permission.LOCATION", "ohos.permission.CAMERA", "ohos.permission.MICROPHONE", @@ -411,50 +421,9 @@ export const userGrantPermissions: string[] = [ "ohos.permission.DISTRIBUTED_DATASYNC" ]; -export const permissionDescriptions: object = { - "位置信息": "允许应用在后台运行时获取位置信息。" , - "相机": "允许应用拍摄照片和视频。" , - "麦克风": "允许应用打开或关闭录音通路。" , - "电话": "允许应用接听电话。" , - "信息": "允许应用发送短彩信。" , - "通讯录": "允许应用新建/修改/删除设备上存储的联系人信息。" , - "通话记录": "允许新建/修改/删除设备上的通话记录信息。" , - "媒体和文件": "允许应用访问户媒体文件,如视频、音频、图片等。" , - "日历": "允许应用新建/修改/删除日历。" , - "健身运动": "允许应用程序读取用户的运动状态。" , - "身体传感器": "允许应用程序读取用户的健康数据。" , - "其他权限": "允许应用与远程设备交换用户数据(如图片、音乐、视频、及应用数据等)。" -}; - -export const permissionPermissionGroup: object = { - "ohos.permission.LOCATION_IN_BACKGROUND": "LOCATION", - "ohos.permission.LOCATION": "LOCATION", - "ohos.permission.CAMERA": "CAMERA", - "ohos.permission.MICROPHONE": "MICROPHONE", - "ohos.permission.ANSWER_CALL": "PHONE", - "ohos.permission.MANAGE_VOICEMAIL": "PHONE", - "ohos.permission.READ_CELL_MESSAGES": "SMS", - "ohos.permission.READ_MESSAGES": "SMS", - "ohos.permission.RECEIVE_MMS": "SMS", - "ohos.permission.RECEIVE_SMS": "SMS", - "ohos.permission.RECEIVE_WAP_MESSAGES": "SMS", - "ohos.permission.SEND_MESSAGES": "SMS", - "ohos.permission.READ_CONTACTS": "CONTACTS", - "ohos.permission.WRITE_CONTACTS": "CONTACTS", - "ohos.permission.READ_CALL_LOG": "CALL_LOG", - "ohos.permission.WRITE_CALL_LOG": "CALL_LOG", - "ohos.permission.MEDIA_LOCATION": "MEDIA", - "ohos.permission.READ_MEDIA": "MEDIA", - "ohos.permission.WRITE_MEDIA": "MEDIA", - "ohos.permission.READ_CALENDAR": "CALENDAR", - "ohos.permission.WRITE_CALENDAR": "CALENDAR", - "ohos.permission.ACTIVITY_MOTION": "SPORT", - "ohos.permission.READ_HEALTH_DATA": "HEALTH", - "ohos.permission.DISTRIBUTED_DATASYNC": "OTHER" -}; - 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", @@ -480,25 +449,6 @@ export const permissionGroupIds: object = { "ohos.permission.DISTRIBUTED_DATASYNC": "11" }; -export const orderGroup: string[] = [ - "位置信息", - "相机", - "麦克风", - "电话", - "信息", - "通讯录", - "通话记录", - "媒体和文件", - "日历", - "健身运动", - "身体传感器", - "其他权限" -]; - -export const otherPermissionsLabel: object = { - "ohos.permission.DISTRIBUTED_DATASYNC": "多设备协同" -}; - export const noNeedDisplayApp: string[] = [ "com.ohos.launcher" ] @@ -509,4 +459,8 @@ export const showSubpermissionsGrop: string[] = [ "信息", "通讯录", "通话记录" -]; \ No newline at end of file +]; + +export const polymorphismGroup: string[] = [ + "LOCATION" +] \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/utils/constant.ets index 1bfa23125625a0a3ff173eceef2f590ae786bbd1..36c204c0b886cb146f7f16e365202e2478041da9 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/utils/constant.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/common/utils/constant.ets @@ -162,6 +162,8 @@ export default class Constants { static TERTIARY_LIST_PADDING_RIGHT = 12; static TERTIARY_LIST_PADDING_TOP = 4; static TERTIARY_LIST_PADDING_BOTTOM = 4; + static LOCATION_MARGIN_TOP = 12; + static LOCATION_MARGIN_BOTTOM = 8; // authority-tertiary static AUTHORITY_IMAGE_WIDTH = 40; @@ -336,6 +338,34 @@ export default class Constants { static RESULT_FAILURE = 0 static RESULT_CODE = 0 + //location status + static LOCATION_NONE = 0 + static LOCATION_FUZZY = 1 + static LOCATION_UPGRADE = 2 + static LOCATION_BOTH_PRECISE = 3 + static LOCATION_BOTH_FUZZY = 4 + + //location canvas + static LOCATION_CANVAS_HEIGHT = 172; + static LOCATION_CANVAS_MARGIN_TOP = 4; + static LOCATION_CANVAS_MARGIN_BOTTOM = 8; + static LOCATION_CANVAS_INITIAL_SCALE = 1; + static LOCATION_CANVAS_ZOOM_SCALE = 1.3; + static LOCATION_BUTTON_WIDTH = 120; + static LOCATION_BUTTON_HEIGHT = 32; + static LOCATION_BUTTON_RADIUS = 16; + static LOCATION_BUTTON_POSITION_X = 137.5; + static LOCATION_BUTTON_POSITION_Y = 16; + static LOCATION_ICON_POSITION_X = 228; + static LOCATION_ICON_POSITION_Y = 86.5; + static LOCATION_CIRCLE_POSITION_X = 194; + static LOCATION_CIRCLE_POSITION_Y = 62.5; + static LOCATION_ICON_WIDTH = 24; + static LOCATION_ICON_HEIGHT = 29; + static LOCATION_CIRCLE_DIA = 94; + static LOCATION_CIRCLE_OPACITY = 0.3; + static LOCATION_ANIMATION_DURATION = 400; + // static SETTING_OPER = -1 static PASS_OPER = 0 diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-secondary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-secondary.ets index 6ff3deb72f928a82c9aee361ad2a9bb41d1d1a2c..b8a3b83d825092df78be71b1579aedbb277743e6 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-secondary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-secondary.ets @@ -23,30 +23,23 @@ var TAG = 'PermissionManager_MainAbility:' const allowedStatus = 0; // Status: Allowed const bannedStatus = 1; // Status: Banned - -class AllowedObj { +class permissionObj { groupName: string; permission: string[]; - constructor(groupName: string, permission: string[]) { + group: string; + constructor(groupName: string, permission: string[], group: string) { this.groupName = groupName; this.permission = permission; + this.group = group } -} // Class Allowed -class BannedObj { - groupName: string; - permission: string[]; - constructor(groupName: string, permission: string[]) { - this.groupName = groupName; - this.permission = permission; - } -} // Class Banned +} @Entry @Component struct appNamePlusPage { - @State allowedListItem: AllowedObj[] = []; // Array of allowed permissions - @State bannedListItem: BannedObj[] = []; // array of forbidden permissions - private routerData = router.getParams().routerData; // Routing jump data + @State allowedListItem: permissionObj[] = []; // Array of allowed permissions + @State bannedListItem: permissionObj[] = []; // array of forbidden permissions + private routerData: any = router.getParams().routerData; // Routing jump data @Builder ListItemLayout(item, index, status) { ListItem() { @@ -76,6 +69,7 @@ struct appNamePlusPage { } } }.onClick(() => { + globalThis.currentPermissionGroup = item.group if (status === 'allow') { if (item.groupName == "其他权限") { router.push({ @@ -145,6 +139,7 @@ struct appNamePlusPage { for (let i = 0; i < reqGroupIds.length; i++) { let id = reqGroupIds[i]; let groupName = groups[id].groupName; + let group = groups[id].name; let groupReqPermissons = []; for (let j = 0; j < reqPermissions.length; j++) { let permission = reqPermissions[j]; @@ -163,9 +158,9 @@ struct appNamePlusPage { } if (isGranted) { - this.allowedListItem.push(new AllowedObj(groupName, groupReqPermissons)); + this.allowedListItem.push(new permissionObj(groupName, groupReqPermissons, group)); } else { - this.bannedListItem.push(new BannedObj(groupName, groupReqPermissons)); + this.bannedListItem.push(new permissionObj(groupName, groupReqPermissons, group)); } } } @@ -251,6 +246,7 @@ struct appNamePlusPage { .fontWeight(FontWeight.Medium) .lineHeight(Constants.SUBTITLE_LINE_HEIGHT) }.constraintSize({ minHeight: Constants.SUBTITLE_MIN_HEIGHT }) + .width(Constants.FULL_WIDTH) .padding({ top: Constants.SUBTITLE_PADDING_TOP, bottom: Constants.SUBTITLE_PADDING_BOTTOM, left: Constants.SECONDARY_TEXT_MARGIN_LEFT}) } @@ -285,6 +281,7 @@ struct appNamePlusPage { .fontWeight(FontWeight.Medium) .lineHeight(Constants.SUBTITLE_LINE_HEIGHT) }.constraintSize({ minHeight: Constants.SUBTITLE_MIN_HEIGHT }) + .width(Constants.FULL_WIDTH) .padding({ top: Constants.SUBTITLE_PADDING_TOP, bottom: Constants.SUBTITLE_PADDING_BOTTOM, left: Constants.SECONDARY_TEXT_MARGIN_LEFT}) } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-tertiary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-tertiary.ets index e4d4e0c5258a83dc22bb58dbeca54f13fa49ae7f..6dad7c660c1b924925f2cc411a378a0a21e18834 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-tertiary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/application-tertiary.ets @@ -20,20 +20,22 @@ import { getAppLabel, getAppIcon, verifyAccessToken } from "../common/utils/util import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import Resmgr from '@ohos.resourceManager' import { authorizeDialog } from "../common/components/dialog"; -import { permissionDescriptions, permissionGroups, showSubpermissionsGrop } from "../common/model/permissionGroup"; +import { permissionGroups, showSubpermissionsGrop, polymorphismGroup } from "../common/model/permissionGroup"; import Constants from '../common/utils/constant'; var TAG = 'PermissionManager_MainAbility:' -let routerData = router.getParams().routerData; // Routing jump data -let backTitle = router.getParams().backTitle; // return title name +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 = router.getParams().permission; // permissions name +let permissions: any = router.getParams().permission; // permissions name 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 reason = null // Authorized reason +let bundleInfo: any = {} +const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION' class MeidaDocObj { name: string index: number @@ -58,17 +60,10 @@ class MediaListObj { labelId: string iconId: string versionName: string - description: string - constructor( - labelId: string, - iconId: string, - versionName: string, - description: string - ) { + constructor(labelId: string, iconId: string, versionName: string,) { this.labelId = labelId this.iconId = iconId this.versionName = versionName - this.description = description } }; // Permission application information class @@ -133,9 +128,10 @@ struct mediaDocumentItem { labelId: '', iconId: '', versionName: '', - description: '' }; // application info array @State isCheckList: boolean[] = []; // Permission status array + @State accurateIsOn: boolean = true; + @State reqPermissions: any = [] authorizeDialogController: CustomDialogController = new CustomDialogController({ builder: authorizeDialog({ }), @@ -177,7 +173,6 @@ struct mediaDocumentItem { * Lifecycle function, executed when the page is initialized */ aboutToAppear() { - let permissionDescription = permissionDescriptions[backTitle]; if(showSubpermissionsGrop.indexOf(backTitle) != -1) { reason = [] permissions.forEach(permission => { @@ -200,6 +195,8 @@ struct mediaDocumentItem { } let hasReason = false bundle.getBundleInfo(routerData, Constants.PARMETER_BUNDLE_FLAG).then(res => { + this.reqPermissions = res.reqPermissions + bundleInfo = res permissions.forEach(permission => { res.reqPermissionDetails.forEach(reqPermissionDetail => { if(reqPermissionDetail.name == permission) { @@ -214,11 +211,15 @@ struct mediaDocumentItem { } }) }) + var acManager = abilityAccessCtrl.createAtManager() + acManager.verifyAccessToken(res.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION).then(accurateStatus => { + accurateStatus == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED ? this.accurateIsOn = true : this.accurateIsOn = false + }) Promise.all([getAppLabel(res.appInfo.labelId, res.name), getAppIcon(res.appInfo.iconId, res.name)]) .then((values) => { this.mediaListItem = new MediaListObj( - String(values[0]), String(values[1]), res.versionName, permissionDescription); + String(values[0]), String(values[1]), res.versionName); }) this.mediaDocListItem.push( new MeidaDocObj( @@ -240,7 +241,7 @@ struct mediaDocumentItem { ); }).catch((error) => { console.error(TAG + 'bundle.getBundleInfo failed. Cause: ' + JSON.stringify(error)); - this.mediaListItem = new MediaListObj('', '', '', permissionDescription); + this.mediaListItem = new MediaListObj('', '', ''); this.mediaDocListItem.push( new MeidaDocObj(Constants.RADIO_ALLOW_NAME, Constants.RADIO_ALLOW_INDEX, Constants.RADIO_ALLOW_GROUP_NAME, '', permissions) @@ -352,6 +353,9 @@ struct mediaDocumentItem { .height(Constants.LISTITEM_ROW_HEIGHT) .onClick(() => { item.permissions.forEach((permission) => { + if(permission == PRECISE_LOCATION_PERMISSION) { + return false + } if (!item.index) { this.grantUserGrantedPermission(item.accessTokenId, permission) if (nowGrantResult != Constants.PERMISSION_INDEX) { @@ -418,6 +422,55 @@ struct mediaDocumentItem { .padding({ top: Constants.TERTIARY_LIST_PADDING_TOP, bottom: Constants.TERTIARY_LIST_PADDING_BOTTOM }) + + if ((polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) && (this.reqPermissions.includes(PRECISE_LOCATION_PERMISSION))) { + Column() { + Row() { + Text($r('app.string.precise_location')) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.label_color')) + .fontWeight(FontWeight.Medium) + .flexGrow(Constants.FLEX_GROW) + Toggle({ type: ToggleType.Switch, isOn: this.accurateIsOn }) + .selectedColor($r('app.color.button_color')) + .switchPointColor($r('app.color.selected_Color')) + .onChange((isOn: boolean) => { + var acManager = abilityAccessCtrl.createAtManager() + if (isOn) { + acManager.grantUserGrantedPermission(bundleInfo.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG) + .then((res) => { res == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED ? this.accurateIsOn = true : this.accurateIsOn = false }) + .catch(() => { this.accurateIsOn = false }) + } else { + acManager.revokeUserGrantedPermission(bundleInfo.appInfo.accessTokenId, PRECISE_LOCATION_PERMISSION, Constants.PERMISSION_FLAG) + .then(() => { this.accurateIsOn = false }) + .catch(() => { this.accurateIsOn = true }) + } + }) + .padding({ right: 0 }) + .enabled(this.isCheckList[0]) + }.width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + }.margin({ top: Constants.LOCATION_MARGIN_TOP, bottom: Constants.LOCATION_MARGIN_BOTTOM }) + .padding({ + left: Constants.DEFAULT_PADDING_START, + right: Constants.DEFAULT_PADDING_END, + top: Constants.TERTIARY_LIST_PADDING_TOP, + bottom: Constants.TERTIARY_LIST_PADDING_BOTTOM + }) + .borderRadius(Constants.BORDER_RADIUS) + .backgroundColor($r('app.color.default_background_color')) + + Row() { + Text($r('app.string.get_the_exact_position')) + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .fontColor($r('app.color.label_color_light')) + .lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT) + }.width(Constants.FULL_WIDTH) + .padding({ + left: Constants.DEFAULT_PADDING_START, + right: Constants.DEFAULT_PADDING_END, + }) + } } .padding({ left: Constants.LIST_PADDING_LEFT, diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-management.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-management.ets index a1e25356287db91257a9e2a493dfc2e9a0c673fa..a1e90b2a1f8a92f04feb86ef2cefcdf7e00bbc25 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-management.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-management.ets @@ -21,7 +21,7 @@ import bundle from "@ohos.bundle"; import Resmgr from '@ohos.resourceManager'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import { groups, userGrantPermissions, permissionGroupPermissions, noNeedDisplayApp } from "../common/model/permissionGroup"; -import { permissionGroups, permissionPermissionGroup, permissionGroupIds } from "../common/model/permissionGroup"; +import { permissionGroups, permissionGroupIds } from "../common/model/permissionGroup"; import { makePy } from "../common/utils/utils"; import Constants from '../common/utils/constant'; @@ -106,6 +106,7 @@ struct authorityManagementPage { return ele.groupName === item.group }) + globalThis.currentPermissionGroup = item.group router.push({ uri: 'pages/authority-tertiary-groups', params: { routerData: dataList, backTitle: item.groupName } @@ -374,8 +375,8 @@ struct authorityManagementPage { let dePermissions = []; let groupIds = []; for (let i = 0; i < reqUserPermissions.length; i++) { - if(dePermissions.indexOf(permissionPermissionGroup[reqUserPermissions[i]]) == -1){ - dePermissions.push(permissionPermissionGroup[reqUserPermissions[i]]); + if(dePermissions.indexOf(groups[permissionGroupIds[reqUserPermissions[i]]].name) == -1){ + dePermissions.push(groups[permissionGroupIds[reqUserPermissions[i]]].name); } if(groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1){ groupIds.push(permissionGroupIds[reqUserPermissions[i]]); diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets index 44cd9224d2b33bf31ef301dcab55c2462ce5f621..8f7730f2e52b9c5859cef0be7c3aa0fd113ca312 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets @@ -24,6 +24,7 @@ import { getAppLabel, getAppIcon, verifyAccessToken} from "../common/utils/utils import { makePy } from "../common/utils/utils"; import { authorizeDialog } from "../common/components/dialog"; import Constants from '../common/utils/constant'; +import { polymorphismGroup } from "../common/model/permissionGroup"; var TAG = 'PermissionManager_MainAbility:' @@ -33,7 +34,7 @@ var TAG = 'PermissionManager_MainAbility:' .height(height) } -let routerData = router.getParams().routerData; // Routing jump data +let routerData: any = router.getParams().routerData; // Routing jump data let backTitle = router.getParams().backTitle; // return title name let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results @@ -66,6 +67,8 @@ class ApplicationObj { @Entry @Component struct locationInfoPage { + @State polymorphismIsOn: Array = [] + build() { GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { @@ -84,7 +87,7 @@ struct locationInfoPage { } Row() { Column() { - applicationItem() + applicationItem({ polymorphismIsOn: $polymorphismIsOn }) }.width(Constants.FULL_WIDTH) } @@ -113,6 +116,42 @@ struct locationInfoPage { .opacity(Constants.MANAGEMENT_TRANSPARENCY) } } + + onPageShow() { + console.log(TAG + "onPageShow"); + if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) { + var bundleNames = [] + routerData.forEach(permissionmanager => { + permissionmanager.bundleNames.forEach( bundleName => { + if (bundleNames.indexOf(bundleName) == -1) { + bundleNames.push(bundleName) + } + }) + }) + + bundleNames.forEach((bundleName, index) => { + bundle.getBundleInfo(bundleName, Constants.PARMETER_BUNDLE_FLAG).then(res => { + // 0: have permission; -1: no permission + this.polymorphismIsOn[index] = true + for (let j = 0; j < routerData.length; j++) { + if (routerData[j].permission == 'ohos.permission.LOCATION') { + continue + } + if (res.reqPermissions.indexOf(routerData[j].permission) == -1) { + continue + } + verifyAccessToken(res.appInfo.accessTokenId, routerData[j].permission).then((access) => { + if (Number(access) === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) { + this.polymorphismIsOn[index] = false; + } + }); + } + }).catch(error => { + console.log(TAG + bundleName + "onPageShow getBundleInfo failed, cause: " + JSON.stringify(error)); + }) + }) + } + } } @Component @@ -123,6 +162,8 @@ struct applicationItem { @State oldApplicationItem: ApplicationObj[] = []; // Original application information array @State searchResult: boolean = true; // search results @State placeholder: string = '' + @State bundleNameGroup: Array = [] + @Link polymorphismIsOn: any authorizeDialogController: CustomDialogController = new CustomDialogController({ builder: authorizeDialog({ }), @@ -143,61 +184,70 @@ struct applicationItem { .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) .fontColor($r('app.color.text_color')) .flexGrow(Constants.FLEX_GROW) - Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) - .selectedColor($r('app.color.toggle_color')) - .width(Constants.AUTHORITY_TOGGLE_WIDTH) - .height(Constants.AUTHORITY_TOGGLE_HEIGHT) - .onChange((isOn: boolean) => { - if (item.accessTokenId === '' || item.permission === '') { - return; - } - let _this = this; - if (isOn) { - let promises = routerData.map(it => new Promise((resolve, reject) => { - _this.grantUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); - })); - Promise.all(promises).then(function(results) { - if(results.indexOf(-1) != -1) { - _this.authorizeDialogController.open(); - _this.toggleIsOn[item.index] = false; - setTimeout(()=> { - _this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - _this.toggleIsOn[item.index] = true; - } - let num = Constants.PERMISSION_NUM; - for(let key in _this.toggleIsOn){ - if(_this.toggleIsOn[key]){ - num++; + if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) == -1) { + Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) + .selectedColor($r('app.color.toggle_color')) + .width(Constants.AUTHORITY_TOGGLE_WIDTH) + .height(Constants.AUTHORITY_TOGGLE_HEIGHT) + .onChange((isOn: boolean) => { + if (item.accessTokenId === '' || item.permission === '') { + return; + } + let _this = this; + if (isOn) { + let promises = routerData.map(it => new Promise((resolve, reject) => { + _this.grantUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); + })); + Promise.all(promises).then(function(results) { + if(results.indexOf(-1) != -1) { + _this.authorizeDialogController.open(); + _this.toggleIsOn[item.index] = false; + setTimeout(()=> { + _this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + _this.toggleIsOn[item.index] = true; } - } - _this.permissionNum = num; - }); - } else { - let promises = routerData.map(it => new Promise((resolve, reject) => { - _this.revokeUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); - })); - Promise.all(promises).then(function(results) { - if(results.indexOf(-1) != -1) { - _this.authorizeDialogController.open(); - _this.toggleIsOn[item.index] = true; - setTimeout(()=> { - _this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - _this.toggleIsOn[item.index] = false; - } - let num = Constants.PERMISSION_NUM; - for(let key in _this.toggleIsOn){ - if(_this.toggleIsOn[key]){ - num++; + let num = Constants.PERMISSION_NUM; + for(let key in _this.toggleIsOn){ + if(_this.toggleIsOn[key]){ + num++; + } } - } - _this.permissionNum = num; - }); - } - }) + _this.permissionNum = num; + }); + } else { + let promises = routerData.map(it => new Promise((resolve, reject) => { + _this.revokeUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); + })); + Promise.all(promises).then(function(results) { + if(results.indexOf(-1) != -1) { + _this.authorizeDialogController.open(); + _this.toggleIsOn[item.index] = true; + setTimeout(()=> { + _this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + _this.toggleIsOn[item.index] = false; + } + let num = Constants.PERMISSION_NUM; + for(let key in _this.toggleIsOn){ + if(_this.toggleIsOn[key]){ + num++; + } + } + _this.permissionNum = num; + }); + } + }) + }else { + Text(this.polymorphismIsOn[item.index] ? $r('app.string.allow') : $r('app.string.ban')) + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .fontColor($r('app.color.label_color_light')) + .margin({ right: Constants.AUTHORITY_IMAGE_MARGIN_RIGHT }) + Image($r('app.media.rightarrow')) + .customizeImage(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT) + } } .width(Constants.FULL_WIDTH) .height(Constants.AUTHORITY_ROW_HEIGHT) @@ -215,11 +265,38 @@ struct applicationItem { } } }.onClick(() => { + if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) { + var permissions: any = [] + routerData.forEach(item => { + permissions.push(item.permission) + }) + router.push({ + uri: 'pages/application-tertiary', + params: { + routerData: this.bundleNameGroup[item.index], + backTitle, + permission: permissions, + status: this.polymorphismIsOn[item.index] ? Constants.RADIO_ALLOW_INDEX : Constants.RADIO_BAN_INDEX + } + }); + } }) } }.padding({ left: Constants.DEFAULT_PADDING_START, right: Constants.DEFAULT_PADDING_END }) } + /** + * Take the total number of access applications + */ + getGrantApplicationNumber() { + if (polymorphismGroup.indexOf(globalThis.currentPermissionGroup) !== -1) { + var sum = this.polymorphismIsOn.filter(item => item == true) + return sum.length + }else { + return this.permissionNum + } + } + /** * Grant permissions to the app * @param {Number} accessTokenId @@ -279,6 +356,7 @@ struct applicationItem { new ApplicationObj('', '', i, 0, '', '')); this.oldApplicationItem.push( new ApplicationObj('', '', i, 0, '', '')); + this.bundleNameGroup.push(bundleNames[i]) } for (let i = 0; i < bundleNames.length; i++) { @@ -306,6 +384,7 @@ struct applicationItem { routerData[0].permission, makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array ); + this.bundleNameGroup[i] = bundleNames[i] }); // 0: have permission; -1: no permission var boole = true; @@ -351,7 +430,7 @@ struct applicationItem { Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { Column() { Flex({ justifyContent: FlexAlign.Start }) { - Text(this.permissionNum + '个应用获取此权限') + Text(this.getGrantApplicationNumber() + '个应用获取此权限') .fontSize(Constants.TEXT_SMAL_FONT_SIZE) .fontColor($r('app.color.secondary_font_color')) .margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP, left: Constants.AUTHORITY_TEXT_MARGIN_LEFT }) diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/dialogPlus.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/dialogPlus.ets index a56068a7223ded5d18965f4530906d85fbd97424..c765d824761ce399d4b9e6fedce7a7b8cd150d67 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/dialogPlus.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/dialogPlus.ets @@ -21,6 +21,7 @@ import { Log, getPermissionGroup } from '../common/utils/utils' import Constants from '../common/utils/constant' import { BundleFlag } from '../common/model/bundle' import { permissionGroups, showSubpermissionsGrop } from '../common/model/permissionGroup' +import { LocationCanvas } from '../common/components/location' @Extend(Button) function customizeButton() { .backgroundColor($r('app.color.default_background_color')) @@ -30,6 +31,9 @@ import { permissionGroups, showSubpermissionsGrop } from '../common/model/permis .width(Constants.BUTTON_WIDTH) } +const FUZZY_LOCATION_PERMISSION = 'ohos.permission.APPROXIMATELY_LOCATION' +const PRECISE_LOCATION_PERMISSION = 'ohos.permission.LOCATION' + @Entry @Component struct dialogPlusPage { @@ -43,6 +47,8 @@ struct dialogPlusPage { @State appName: string = "" @State win: any = "" @State proxy: any = '' + @State locationFlag: number = Constants.LOCATION_NONE + @State resource: any = {} build() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { @@ -65,8 +71,7 @@ struct dialogPlusPage { Column() { Row() { Flex({ justifyContent: FlexAlign.Start }) { - Text("是否允许" + this.appName + - this.grantGroups[this.count].label) + Text(this.showTitle()) .fontSize(Constants.DIALOG_REQ_FONT_SIZE) .fontColor($r('app.color.first_font_color')) .fontWeight(FontWeight.Medium) @@ -81,7 +86,7 @@ struct dialogPlusPage { Row() { Flex({ justifyContent: FlexAlign.Start }) { - Text(this.grantGroups[this.count].description) + Text(this.showReason()) .fontSize(Constants.DIALOG_DESP_FONT_SIZE) .fontColor($r('app.color.text_secondary_color')) .fontSize(Constants.DIALOG_DESP_FONT_SIZE) @@ -94,17 +99,21 @@ struct dialogPlusPage { }) } } + + if(this.locationFlag > Constants.LOCATION_NONE) { + LocationCanvas({ locationFlag: $locationFlag }) + } } } Row() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { - Button('禁止') + Button($r('app.string.ban')) .fontSize(Constants.BUTTON_FONT_SIZE) .onClick(() => { this.privacyCancel(this.grantGroups[this.count], this.accessTokenId, this.reqPerms, this.userFixedFlag) }).customizeButton().margin({ left: Constants.BUTTON_MARGIN_LEFT }) Text('|').fontSize(Constants.BUTTON_DIVIDER_FONT_SIZE).fontColor($r('app.color.divider_color')) - Button('允许') + Button($r('app.string.allow')) .fontSize(Constants.BUTTON_FONT_SIZE) .onClick(() => { this.privacyAccept(this.grantGroups[this.count], this.accessTokenId, this.reqPerms, this.userFixedFlag) @@ -120,6 +129,27 @@ struct dialogPlusPage { .height(Constants.FULL_HEIGHT) } + showTitle() { + if(this.grantGroups[this.count].name == 'LOCATION') { + if(this.locationFlag == Constants.LOCATION_FUZZY) { + return this.resource.whether_to_allow + this.appName + this.resource.access_general_location + } + if(this.locationFlag == Constants.LOCATION_UPGRADE) { + return this.resource.whether_to_allow + this.appName + this.resource.fuzzy_to_exact + } + } + return this.resource.whether_to_allow + this.appName + this.grantGroups[this.count].label + } + + showReason() { + if(this.grantGroups[this.count].name == 'LOCATION') { + if((this.locationFlag == Constants.LOCATION_FUZZY) || (this.locationFlag == Constants.LOCATION_BOTH_FUZZY)) { + return $r('app.string.close_exact_position') + } + } + return this.grantGroups[this.count].description + } + verify() { if((this.initStatus == Constants.INIT_NEED_TO_TERMINATED) || (this.count >= this.grantGroups.length)) { this.answerRequest() @@ -174,6 +204,14 @@ struct dialogPlusPage { async privacyAccept(group, accessTokenId, permissionList, userFixedFlag) { var acManager = abilityAccessCtrl.createAtManager() var num = 0 + if(group.name == 'LOCATION') { + if((this.locationFlag == Constants.LOCATION_UPGRADE) || + (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) { + await acManager.grantUserGrantedPermission(accessTokenId, PRECISE_LOCATION_PERMISSION, userFixedFlag) + var preciseIndex = permissionList.indexOf(FUZZY_LOCATION_PERMISSION) + this.result[preciseIndex] = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED; + } + } group.permissions.forEach(async permission => { let result if(showSubpermissionsGrop.indexOf(group.groupName) == -1) { @@ -203,6 +241,13 @@ struct dialogPlusPage { async privacyCancel(group, accessTokenId, permissionList, userFixedFlag) { var acManager = abilityAccessCtrl.createAtManager() + if(group.name == 'LOCATION') { + if((this.locationFlag == Constants.LOCATION_UPGRADE) || + (this.locationFlag == Constants.LOCATION_BOTH_FUZZY) || + (this.locationFlag == Constants.LOCATION_BOTH_PRECISE)) { + await acManager.revokeUserGrantedPermission(accessTokenId, PRECISE_LOCATION_PERMISSION, userFixedFlag) + } + } group.permissions.forEach(async permission => { let result if(showSubpermissionsGrop.indexOf(group.groupName) == -1) { @@ -218,6 +263,18 @@ struct dialogPlusPage { } getgrantGroups(stateGroup) { + //Processing of positioning + 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) + if(stateGroup[fuzzyIndex] == Constants.PASS_OPER) { + this.locationFlag = Constants.LOCATION_UPGRADE + } + } + } + this.reqPerms.forEach((permission, idx) => { //已授权 if(stateGroup[idx] == Constants.PASS_OPER) { @@ -321,6 +378,22 @@ struct dialogPlusPage { }) } + getStrings() { + Resmgr.getResourceManager(globalThis.extensionContext, Constants.BUNDLE_NAME).then(item => { + item.getString($r("app.string.whether_to_allow").id, (err, val) => { + this.resource.whether_to_allow = val + }) + item.getString($r("app.string.access_general_location").id, (err, val) => { + this.resource.access_general_location = val + }) + item.getString($r("app.string.fuzzy_to_exact").id, (err, val) => { + this.resource.fuzzy_to_exact = val + }) + }).catch(error => { + Log.error('Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error)); + }) + } + aboutToAppear() { this.count = 0; this.initStatus = Constants.INIT_NEED_TO_WAIT @@ -337,6 +410,7 @@ struct dialogPlusPage { Log.info("request permission=" + JSON.stringify(this.reqPerms) + ", tokenId = " + this.accessTokenId) Log.info("permission state=" + JSON.stringify(globalThis.abilityWant.parameters['ohos.user.grant.permission.state'])); this.result = new Array(this.reqPerms.length).fill(-1); + this.getStrings() this.getgrantGroups(globalThis.abilityWant.parameters['ohos.user.grant.permission.state']); this.getApplicationName(globalThis.abilityWant.parameters['ohos.aafwk.param.callerUid']) } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/other-permissions.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/other-permissions.ets index 1de45de538c1eb26f07fc85971a161bbaf78d65c..6f648aa43e6358f7b6807ff586c2b4e30cdbf820 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/other-permissions.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/pages/other-permissions.ets @@ -16,7 +16,7 @@ import { backBar } from "../common/components/backBar"; import router from '@system.router'; import Constants from '../common/utils/constant'; -import { otherPermissionsLabel } from '../common/model/permissionGroup' +import { permissionGroups } from '../common/model/permissionGroup' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' var TAG = 'PermissionManager_MainAbility:' @@ -29,7 +29,7 @@ let permissions: any = router.getParams().permission; // permissions name let otherPermissionList = []; // otherPermission List for (let i = 0; i < permissions.length; i++) { otherPermissionList.push({ - permissionLabel: otherPermissionsLabel[permissions[i]], + permissionLabel: permissionGroups.filter(item => item.permissionName == permissions[i])[0].label, permission: permissions[i] }) } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json index d9c648ab678d07802b9a9470d730d98fa6b30ab1..5999b441a503f9ee3b53dfa7f3df2f84b8cf73a6 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json @@ -60,6 +60,14 @@ "name": "shape_allow_color", "value": "#1856D4" }, + { + "name": "location_circle_color", + "value": "#254FF7" + }, + { + "name": "location_bgColor", + "value": "#19596080" + }, { "name": "shape_ban_color", "value": "#000000" diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json index a1b07a9814be99a34db87663861cb91508d60029..de1f1afde0eb7fd00706008df4b25e0dd5e71cb0 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json @@ -87,6 +87,46 @@ { "name": "record_time_limit", "value": "Access records in the last 7 days" + }, + { + "name": "allow", + "value": "allow" + }, + { + "name": "ban", + "value": "ban" + }, + { + "name": "precise_location", + "value": "Precise location" + }, + { + "name": "precise_location_on", + "value": "Precise position: On" + }, + { + "name": "precise_location_off", + "value": "Precise position: Off" + }, + { + "name": "get_the_exact_position", + "value": "Allows the app to get your exact location. When closed, the location obtained by the application will be biased." + }, + { + "name": "close_exact_position", + "value": "When Precise location is turned off, the location obtained by the application is biased." + }, + { + "name": "whether_to_allow", + "value": "Whether to allow" + }, + { + "name": "access_general_location", + "value": " access the general location?" + }, + { + "name": "fuzzy_to_exact", + "value": " position access to change from \"APPROXIMATE POSITION\" to \"EXACT POSITION\"?" } ] } \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_gps_filled.svg b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_gps_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..5048ae019748c0c09fa6072f1f1afbbc97eb706a --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_gps_filled.svg @@ -0,0 +1,26 @@ + + + Public/ic_public_gps_filled + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/img_location_map.svg b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/img_location_map.svg new file mode 100644 index 0000000000000000000000000000000000000000..8846dcd84101f4534e97ad08f0213c5d29eb8d76 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/img_location_map.svg @@ -0,0 +1,29 @@ + + + img_location_map + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/zh_CN/element/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/zh_CN/element/string.json index e92d068a4ca22b1e67d5ebfdd2884414be207b05..f5601de207a339c66ea0d14689d43fcbb0a03196 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/zh_CN/element/string.json +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/zh_CN/element/string.json @@ -87,6 +87,46 @@ { "name": "record_time_limit", "value": "近7天访问记录" + }, + { + "name": "allow", + "value": "允许" + }, + { + "name": "ban", + "value": "禁止" + }, + { + "name": "precise_location", + "value": "精确位置" + }, + { + "name": "precise_location_on", + "value": "精确位置:开启" + }, + { + "name": "precise_location_off", + "value": "精确位置:关闭" + }, + { + "name": "get_the_exact_position", + "value": "允许该应用获取您的准确位置。关闭后,应用获取的位置会有偏差。" + }, + { + "name": "close_exact_position", + "value": "关闭精确位置后,应用获取的位置会有偏差。" + }, + { + "name": "whether_to_allow", + "value": "是否允许" + }, + { + "name": "access_general_location", + "value": "访问大致位置?" + }, + { + "name": "fuzzy_to_exact", + "value": "的位置访问权限从“大致位置”改为“精确位置”?" } ] } \ No newline at end of file