• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { PermissionInfo, GroupInfo } from '../utils/typedef';
17
18export const permissionGroups: Array<PermissionInfo> = [
19    new PermissionInfo("ohos.permission.LOCATION_IN_BACKGROUND", "LOCATION", $r("sys.string.ohos_lab_location_in_background"), 0),
20    new PermissionInfo("ohos.permission.APPROXIMATELY_LOCATION", "LOCATION", $r("sys.string.ohos_lab_approximately_location"), 0),
21    new PermissionInfo("ohos.permission.LOCATION", "LOCATION", $r("sys.string.ohos_lab_location"), 0),
22    new PermissionInfo("ohos.permission.CAMERA", "CAMERA", $r("sys.string.ohos_lab_camera"), 1),
23    new PermissionInfo("ohos.permission.MICROPHONE", "MICROPHONE", $r("sys.string.ohos_lab_microphone"), 2),
24    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")),
25    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")),
26    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")),
27    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")),
28    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")),
29    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")),
30    new PermissionInfo("ohos.permission.ACTIVITY_MOTION", "SPORT", $r("sys.string.ohos_lab_activity_motion"), 5),
31    new PermissionInfo("ohos.permission.READ_HEALTH_DATA", "HEALTH", $r("sys.string.ohos_lab_read_health_data"), 6),
32    new PermissionInfo("ohos.permission.READ_IMAGEVIDEO", "IMAGE_AND_VIDEOS", $r('sys.string.ohos_desc_read_imagevideo'), 8),
33    new PermissionInfo("ohos.permission.WRITE_IMAGEVIDEO", "IMAGE_AND_VIDEOS", $r('sys.string.ohos_desc_write_imagevideo'), 8),
34    new PermissionInfo("ohos.permission.MEDIA_LOCATION", "IMAGE_AND_VIDEOS", $r("sys.string.ohos_lab_media_location"), 8),
35    new PermissionInfo("ohos.permission.READ_AUDIO", "AUDIOS", $r('sys.string.ohos_desc_read_audio'), 9),
36    new PermissionInfo("ohos.permission.WRITE_AUDIO", "AUDIOS", $r('sys.string.ohos_desc_write_audio'), 9),
37    new PermissionInfo("ohos.permission.READ_DOCUMENT", "DOCUMENTS", $r('sys.string.ohos_desc_read_document'), 10),
38    new PermissionInfo("ohos.permission.WRITE_DOCUMENT", "DOCUMENTS", $r('sys.string.ohos_desc_write_document'), 10),
39    new PermissionInfo("ohos.permission.READ_MEDIA", "DOCUMENTS", $r("sys.string.ohos_lab_read_media"), 10),
40    new PermissionInfo("ohos.permission.WRITE_MEDIA", "DOCUMENTS", $r("sys.string.ohos_lab_write_media"), 10),
41    new PermissionInfo("ohos.permission.APP_TRACKING_CONSENT", "ADS", $r('sys.string.ohos_lab_app_tracking_consent'), 11),
42    new PermissionInfo("ohos.permission.GET_INSTALLED_BUNDLE_LIST", "GET_INSTALLED_BUNDLE_LIST", $r('sys.string.ohos_lab_get_installed_bundle_list'), 12),
43    new PermissionInfo("ohos.permission.DISTRIBUTED_DATASYNC", "DISTRIBUTED_DATASYNC", $r("sys.string.ohos_lab_distributed_datasync"), 13),
44    new PermissionInfo("ohos.permission.ACCESS_BLUETOOTH", "BLUETOOTH", $r('sys.string.ohos_lab_access_bluetooth'), 14),
45    new PermissionInfo("ohos.permission.READ_PASTEBOARD", "PASTEBOARD", $r('sys.string.ohos_lab_read_pasteboard'), 15),
46    new PermissionInfo("ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY", "FOLDER", $r('sys.string.ohos_lab_read_write_download_directory'), 16),
47    new PermissionInfo("ohos.permission.READ_WRITE_DESKTOP_DIRECTORY", "FOLDER", $r('sys.string.ohos_lab_read_write_desktop_directory'), 16),
48    new PermissionInfo("ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY", "FOLDER", $r('sys.string.ohos_lab_read_write_documents_directory'), 16)
49]
50
51export const groups: Array<GroupInfo> = [
52    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")),
53    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")),
54    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")),
55    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),
56    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),
57    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")),
58    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")),
59    new GroupInfo("OTHER", $r("app.string.groupName_other"), '', $r('app.media.ic_more'), [], '', [], true),
60    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")),
61    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")),
62    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")),
63    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")),
64    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")),
65    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")),
66    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")),
67    new GroupInfo("PASTEBOARD", $r('app.string.groupName_pasteboard'), $r('app.string.group_label_pasteboard'), $r('app.media.ic_clipboard'), [], '', ["ohos.permission.READ_PASTEBOARD"], false, $r("app.string.enable_description_start_default"), $r('app.string.enable_description_end_pasteboard'), $r('app.string.forbidden_description_pasteboard')),
68    new GroupInfo("FOLDER", $r('app.string.groupName_folder'), $r('app.string.group_label_folder'), $r('app.media.ic_public_folder'), [], '', ["ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY", "ohos.permission.READ_WRITE_DESKTOP_DIRECTORY", "ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY"], false, $r("app.string.enable_description_start_default"), $r('app.string.enable_description_end_folder'), $r('app.string.forbidden_description_folder'))
69];
70
71export const userGrantPermissions: string[] = [
72    "ohos.permission.LOCATION_IN_BACKGROUND",
73    "ohos.permission.APPROXIMATELY_LOCATION",
74    "ohos.permission.LOCATION",
75    "ohos.permission.CAMERA",
76    "ohos.permission.MICROPHONE",
77    "ohos.permission.READ_CONTACTS",
78    "ohos.permission.WRITE_CONTACTS",
79    "ohos.permission.MEDIA_LOCATION",
80    "ohos.permission.READ_MEDIA",
81    "ohos.permission.WRITE_MEDIA",
82    "ohos.permission.READ_CALENDAR",
83    "ohos.permission.WRITE_CALENDAR",
84    "ohos.permission.ACTIVITY_MOTION",
85    "ohos.permission.READ_HEALTH_DATA",
86    "ohos.permission.READ_IMAGEVIDEO",
87    "ohos.permission.WRITE_IMAGEVIDEO",
88    "ohos.permission.READ_AUDIO",
89    "ohos.permission.WRITE_AUDIO",
90    "ohos.permission.READ_DOCUMENT",
91    "ohos.permission.WRITE_DOCUMENT",
92    "ohos.permission.READ_WHOLE_CALENDAR",
93    "ohos.permission.WRITE_WHOLE_CALENDAR",
94    "ohos.permission.APP_TRACKING_CONSENT",
95    "ohos.permission.GET_INSTALLED_BUNDLE_LIST",
96    "ohos.permission.DISTRIBUTED_DATASYNC",
97    "ohos.permission.ACCESS_BLUETOOTH",
98    "ohos.permission.READ_PASTEBOARD",
99    "ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY",
100    "ohos.permission.READ_WRITE_DESKTOP_DIRECTORY",
101    "ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY"
102];
103
104export const showSubpermissionsGrop: string[] = [
105    "CALENDAR",
106    "CONTACTS",
107];
108
109export const polymorphismGroup: string[] = [
110    "LOCATION",
111    "FOLDER"
112]
113
114export const globalGroup: string[] = [
115    "MICROPHONE",
116    "CAMERA"
117]