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 './typedef';
17
18export const permissionGroups: 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, 'app.string.enable_description_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, 'app.string.enable_description_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, 'app.string.enable_description_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, 'app.string.enable_description_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, 'app.string.enable_description_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, 'app.string.enable_description_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    new PermissionInfo('ohos.permission.ACCESS_NEARLINK', 'NEARLINK', $r('sys.string.ohos_lab_access_nearlink'), 17)
50]
51
52export const groups: GroupInfo[] = [
53    new GroupInfo('LOCATION', $r('app.string.groupName_location'), 'app.string.group_label_location', $r('app.media.ic_public_gps'), [], '', ['ohos.permission.LOCATION_IN_BACKGROUND', 'ohos.permission.APPROXIMATELY_LOCATION', 'ohos.permission.LOCATION'], true, 'app.string.enable_description_location', $r('app.string.forbidden_description_location')),
54    new GroupInfo('CAMERA', $r('app.string.groupName_camera'), 'app.string.group_label_camera', $r('app.media.ic_public_camera'), [], '', ['ohos.permission.CAMERA'], true, 'app.string.enable_description_camera', $r('app.string.forbidden_description_camera')),
55    new GroupInfo('MICROPHONE', $r('app.string.groupName_microphone'), 'app.string.group_label_microphone', $r('app.media.ic_public_voice'), [], '', ['ohos.permission.MICROPHONE'], true, 'app.string.enable_description_microphone', $r('app.string.forbidden_description_microphone')),
56    new GroupInfo('CONTACTS', $r('app.string.groupName_contacts'), 'app.string.group_label_contacts', $r('app.media.ic_public_contacts_group'), [], '', ['ohos.permission.READ_CONTACTS', 'ohos.permission.WRITE_CONTACTS'], false),
57    new GroupInfo('CALENDAR', $r('app.string.groupName_calendar'), '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),
58    new GroupInfo('SPORT', $r('app.string.groupName_sport'), 'app.string.group_label_sport', $r('app.media.ic_sport'), [], '', ['ohos.permission.ACTIVITY_MOTION'], true, 'app.string.enable_description_sport', $r('app.string.forbidden_description_sport')),
59    new GroupInfo('HEALTH', $r('app.string.groupName_health'), 'app.string.group_label_health', $r('app.media.ic_ssensor'), [], '', ['ohos.permission.READ_HEALTH_DATA'], true, 'app.string.enable_description_health', $r('app.string.forbidden_description_health')),
60    new GroupInfo('OTHER', $r('app.string.groupName_other'), '', $r('app.media.ic_more'), [], '', [], true),
61    new GroupInfo('IMAGE_AND_VIDEOS', $r('sys.string.ohos_lab_read_imagevideo'), '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, 'app.string.enable_description_image', $r('app.string.forbidden_description_image')),
62    new GroupInfo('AUDIOS', $r('sys.string.ohos_lab_read_audio'), 'app.string.group_label_audios', $r('app.media.ic_public_audio'), [], '', ['ohos.permission.READ_AUDIO', 'ohos.permission.WRITE_AUDIO'], false, 'app.string.enable_description_audios', $r('app.string.forbidden_description_audios')),
63    new GroupInfo('DOCUMENTS', $r('sys.string.ohos_lab_read_document'), '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, 'app.string.enable_description_documents', $r('app.string.forbidden_description_documents')),
64    new GroupInfo('ADS', $r('app.string.groupName_ADS'), 'app.string.group_label_ADS', $r('app.media.track'), [], '', ['ohos.permission.APP_TRACKING_CONSENT'], false, 'app.string.enable_description_ADS', $r('app.string.forbidden_description_ADS')),
65    new GroupInfo('GET_INSTALLED_BUNDLE_LIST', $r('app.string.groupName_appList'), 'app.string.group_label_appList', $r('app.media.ic_public_app_list'), [], '', ['ohos.permission.GET_INSTALLED_BUNDLE_LIST'], false, 'app.string.enable_description_appList', $r('app.string.forbidden_description_appList')),
66    new GroupInfo('DISTRIBUTED_DATASYNC', $r('app.string.multi_device_collaboration'), 'app.string.group_label_distributed_datasync', $r('app.media.ic_multi_device_vector'), [], '', ['ohos.permission.DISTRIBUTED_DATASYNC'], false, 'app.string.enable_description_distributed_datasync', $r('app.string.forbidden_description_distributed_datasync')),
67    new GroupInfo('BLUETOOTH', $r('app.string.groupName_bluetooth'), 'app.string.group_label_bluetooth', $r('app.media.ic_public_bluetooth'), [], '', ['ohos.permission.ACCESS_BLUETOOTH'], false, 'app.string.enable_description_bluetooth', $r('app.string.forbidden_description_bluetooth')),
68    new GroupInfo('PASTEBOARD', $r('app.string.groupName_pasteboard'), 'app.string.group_label_pasteboard', $r('app.media.ic_clipboard'), [], '', ['ohos.permission.READ_PASTEBOARD'], false, 'app.string.enable_description_pasteboard', $r('app.string.forbidden_description_pasteboard')),
69    new GroupInfo('FOLDER', $r('app.string.groupName_folder'), '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, 'app.string.enable_description_folder', $r('app.string.forbidden_description_folder')),
70    new GroupInfo('NEARLINK', $r('app.string.groupName_nearLink'), 'app.string.group_label_nearLink', $r('app.media.ic_nearLink'), [], '', ['ohos.permission.ACCESS_NEARLINK'], false, 'app.string.enable_description_nearLink', $r('app.string.forbidden_description_nearLink'))
71];
72
73export const userGrantPermissions: string[] = [
74    'ohos.permission.LOCATION_IN_BACKGROUND',
75    'ohos.permission.APPROXIMATELY_LOCATION',
76    'ohos.permission.LOCATION',
77    'ohos.permission.CAMERA',
78    'ohos.permission.MICROPHONE',
79    'ohos.permission.READ_CONTACTS',
80    'ohos.permission.WRITE_CONTACTS',
81    'ohos.permission.MEDIA_LOCATION',
82    'ohos.permission.READ_MEDIA',
83    'ohos.permission.WRITE_MEDIA',
84    'ohos.permission.READ_CALENDAR',
85    'ohos.permission.WRITE_CALENDAR',
86    'ohos.permission.ACTIVITY_MOTION',
87    'ohos.permission.READ_HEALTH_DATA',
88    'ohos.permission.READ_IMAGEVIDEO',
89    'ohos.permission.WRITE_IMAGEVIDEO',
90    'ohos.permission.READ_AUDIO',
91    'ohos.permission.WRITE_AUDIO',
92    'ohos.permission.READ_DOCUMENT',
93    'ohos.permission.WRITE_DOCUMENT',
94    'ohos.permission.READ_WHOLE_CALENDAR',
95    'ohos.permission.WRITE_WHOLE_CALENDAR',
96    'ohos.permission.APP_TRACKING_CONSENT',
97    'ohos.permission.GET_INSTALLED_BUNDLE_LIST',
98    'ohos.permission.DISTRIBUTED_DATASYNC',
99    'ohos.permission.ACCESS_BLUETOOTH',
100    'ohos.permission.READ_PASTEBOARD',
101    'ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY',
102    'ohos.permission.READ_WRITE_DESKTOP_DIRECTORY',
103    'ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY',
104    'ohos.permission.ACCESS_NEARLINK'
105];
106
107export const showSubPermissionsGroup: string[] = [
108    'CALENDAR',
109    'CONTACTS',
110];
111
112export const polymorphismGroup: string[] = [
113    'LOCATION',
114    'FOLDER'
115]
116
117export const globalGroup: string[] = [
118    'MICROPHONE',
119    'CAMERA'
120]