• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.permissioncontroller;
18 
19 import com.android.permissioncontroller.hibernation.HibernationJobService;
20 
21 /**
22  * App-global constants
23  */
24 public class Constants {
25 
26     /**
27      * ID for the periodic job in
28      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
29      */
30     public static final int PERIODIC_LOCATION_ACCESS_CHECK_JOB_ID = 0;
31 
32     /**
33      * ID for the on-demand, but delayed job in
34      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
35      */
36     public static final int LOCATION_ACCESS_CHECK_JOB_ID = 1;
37 
38     /**
39      * ID of the periodic job
40      * {@link HibernationJobService}
41      */
42     public static final int HIBERNATION_JOB_ID = 2;
43 
44     /**
45      * Name of file to containing the packages we already showed a notificaiton for.
46      *
47      * @see com.android.permissioncontroller.permission.service.LocationAccessCheck
48      */
49     public static final String LOCATION_ACCESS_CHECK_ALREADY_NOTIFIED_FILE =
50             "packages_already_notified_location_access";
51 
52     /**
53      * ID for notification shown by
54      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
55      */
56     public static final int LOCATION_ACCESS_CHECK_NOTIFICATION_ID = 0;
57 
58     /**
59      * ID for notification shown by
60      * {@link HibernationJobService}.
61      */
62     public static final int UNUSED_APPS_NOTIFICATION_ID = 1;
63 
64     /**
65      * String action for navigating to the auto revoke screen.
66      */
67     public static final String ACTION_MANAGE_AUTO_REVOKE = "manageAutoRevoke";
68 
69     /**
70      * Key for Notification.Builder.setGroup() for the incident report approval notification.
71      */
72     public static final String INCIDENT_NOTIFICATION_GROUP_KEY = "incident confirmation";
73 
74     /**
75      * Key for Notification.Builder.setChannelId() for the incident report approval notification.
76      */
77     public static final String INCIDENT_NOTIFICATION_CHANNEL_ID = "incident_confirmation";
78 
79     /**
80      * ID for our notification.  We always post it with a tag which is the uri in string form.
81      */
82     public static final int INCIDENT_NOTIFICATION_ID = 66900652;
83 
84     /**
85      * Channel of the notifications shown by
86      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
87      */
88     public static final String PERMISSION_REMINDER_CHANNEL_ID = "permission reminders";
89 
90     /**
91      * Name of generic shared preferences file.
92      */
93     public static final String PREFERENCES_FILE = "preferences";
94 
95     /**
96      * Key in the generic shared preferences that stores when the location access feature
97      * was enabled, specifically when it was picked up by the code managing the feature.
98      */
99     public static final String KEY_LOCATION_ACCESS_CHECK_ENABLED_TIME =
100             "location_access_check_enabled_time";
101 
102     /**
103      * Key in the generic shared preferences that stores when the last notification was shown by
104      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}
105      */
106     public static final String KEY_LAST_LOCATION_ACCESS_NOTIFICATION_SHOWN =
107             "last_location_access_notification_shown";
108 
109     /**
110      * Key in the generic shared preferences that stores if the user manually selected the "none"
111      * role holder for a role.
112      */
113     public static final String IS_NONE_ROLE_HOLDER_SELECTED_KEY = "is_none_role_holder_selected:";
114 
115     /**
116      * Key in the generic shared preferences that stores if the user manually selected the "none"
117      * role holder for a role.
118      */
119     public static final String SEARCH_INDEXABLE_PROVIDER_PASSWORD_KEY =
120             "search_indexable_provider_password";
121 
122     /**
123      * Key in the generic shared preferences that stores the name of the packages that are currently
124      * have an overridden user sensitivity.
125      */
126     public static final String FORCED_USER_SENSITIVE_UIDS_KEY = "forced_user_sensitive_uids_key";
127 
128     /**
129      * Key in the generic shared preferences that stores if all packages should be considered user
130      * sensitive
131      */
132     public static final String ALLOW_OVERRIDE_USER_SENSITIVE_KEY =
133             "allow_override_user_sensitive_key";
134 
135     /**
136      * Key in the generic shared preferences that controls if the
137      * {@link android.Manifest.permission#RECORD_AUDIO} of the currently registered assistant is
138      * user sensitive.
139      */
140     public static final String ASSISTANT_RECORD_AUDIO_IS_USER_SENSITIVE_KEY =
141             "assistant_record_audio_is_user_sensitive_key";
142 
143     /**
144      * Name of file containing the permissions that should be restored, but have not been restored
145      * yet.
146      */
147     public static final String DELAYED_RESTORE_PERMISSIONS_FILE = "delayed_restore_permissions.xml";
148 
149     /**
150      * Name of file containing the user denied status for requesting roles.
151      */
152     public static final String REQUEST_ROLE_USER_DENIED_FILE = "request_role_user_denied";
153 
154     /**
155      * Logs to dump
156      */
157     public static final String LOGS_TO_DUMP_FILE = "LogToDump.log";
158 
159     /**
160      * Key in the user denied status for requesting roles shared preferences that stores a string
161      * set for the names of the roles that an application has been denied for once.
162      */
163     public static final String REQUEST_ROLE_USER_DENIED_ONCE_KEY_PREFIX = "denied_once:";
164 
165     /**
166      * Key in the user denied status for requesting roles shared preferences that stores a string
167      * set for the names of the roles that an application is always denied for.
168      */
169     public static final String REQUEST_ROLE_USER_DENIED_ALWAYS_KEY_PREFIX = "denied_always:";
170 
171     /**
172      * Intent extra used to pass current sessionId between Permission Controller fragments.
173      */
174     public static final String EXTRA_SESSION_ID =
175             "com.android.permissioncontroller.extra.SESSION_ID";
176 
177     /**
178      * Invalid session id.
179      */
180     public static final long INVALID_SESSION_ID = 0;
181 
182     /**
183      * Key for NotificationManager.notify for auto-granted permissions notification,
184      * when silently displayed to the user.
185      */
186     public static final String ADMIN_AUTO_GRANTED_PERMISSIONS_NOTIFICATION_CHANNEL_ID =
187             "auto granted permissions";
188 
189     /**
190      * Key for NotificationManager.notify the auto-granted permissions notification,
191      * when alerting the user (with sound and vibration).
192      */
193     public static final String ADMIN_AUTO_GRANTED_PERMISSIONS_ALERTING_NOTIFICATION_CHANNEL_ID =
194             "alerting auto granted permissions";
195     /**
196      * ID for notification of auto-granted permissions shown by
197      * {@link com.android.permissioncontroller.permission.ui.AutoGrantPermissionsNotifier}.
198      */
199     public static final int PERMISSION_GRANTED_BY_ADMIN_NOTIFICATION_ID = 1;
200 
201     /**
202      * Package name of the Android platform.
203      */
204     public static final String OS_PACKAGE_NAME = "android";
205 }
206