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 /**
20  * App-global constants
21  */
22 public class Constants {
23 
24     /**
25      * ID for the periodic job in
26      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
27      */
28     public static final int PERIODIC_LOCATION_ACCESS_CHECK_JOB_ID = 0;
29 
30     /**
31      * ID for the on-demand, but delayed job in
32      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
33      */
34     public static final int LOCATION_ACCESS_CHECK_JOB_ID = 1;
35 
36     /**
37      * ID of the periodic job
38      * {@link com.android.permissioncontroller.permission.service.AutoRevokeService}
39      */
40     public static final int AUTO_REVOKE_JOB_ID = 2;
41 
42     /**
43      * Name of file to containing the packages we already showed a notificaiton for.
44      *
45      * @see com.android.permissioncontroller.permission.service.LocationAccessCheck
46      */
47     public static final String LOCATION_ACCESS_CHECK_ALREADY_NOTIFIED_FILE =
48             "packages_already_notified_location_access";
49 
50     /**
51      * ID for notification shown by
52      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
53      */
54     public static final int LOCATION_ACCESS_CHECK_NOTIFICATION_ID = 0;
55 
56     /**
57      * ID for notification shown by
58      * {@link com.android.permissioncontroller.permission.service.AutoRevokeService}.
59      */
60     public static final int AUTO_REVOKE_NOTIFICATION_ID = 1;
61 
62     /**
63      * String action for navigating to the auto revoke screen.
64      */
65     public static final String ACTION_MANAGE_AUTO_REVOKE = "manageAutoRevoke";
66 
67     /**
68      * Key for Notification.Builder.setGroup() for the incident report approval notification.
69      */
70     public static final String INCIDENT_NOTIFICATION_GROUP_KEY = "incident confirmation";
71 
72     /**
73      * Key for Notification.Builder.setChannelId() for the incident report approval notification.
74      */
75     public static final String INCIDENT_NOTIFICATION_CHANNEL_ID = "incident_confirmation";
76 
77     /**
78      * ID for our notification.  We always post it with a tag which is the uri in string form.
79      */
80     public static final int INCIDENT_NOTIFICATION_ID = 66900652;
81 
82     /**
83      * Channel of the notifications shown by
84      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}.
85      */
86     public static final String PERMISSION_REMINDER_CHANNEL_ID = "permission reminders";
87 
88     /**
89      * Name of generic shared preferences file.
90      */
91     public static final String PREFERENCES_FILE = "preferences";
92 
93     /**
94      * Key in the generic shared preferences that stores when the location access feature
95      * was enabled, specifically when it was picked up by the code managing the feature.
96      */
97     public static final String KEY_LOCATION_ACCESS_CHECK_ENABLED_TIME =
98             "location_access_check_enabled_time";
99 
100     /**
101      * Key in the generic shared preferences that stores when the last notification was shown by
102      * {@link com.android.permissioncontroller.permission.service.LocationAccessCheck}
103      */
104     public static final String KEY_LAST_LOCATION_ACCESS_NOTIFICATION_SHOWN =
105             "last_location_access_notification_shown";
106 
107     /**
108      * Key in the generic shared preferences that stores if the user manually selected the "none"
109      * role holder for a role.
110      */
111     public static final String IS_NONE_ROLE_HOLDER_SELECTED_KEY = "is_none_role_holder_selected:";
112 
113     /**
114      * Key in the generic shared preferences that stores if the user manually selected the "none"
115      * role holder for a role.
116      */
117     public static final String SEARCH_INDEXABLE_PROVIDER_PASSWORD_KEY =
118             "search_indexable_provider_password";
119 
120     /**
121      * Key in the generic shared preferences that stores the name of the packages that are currently
122      * have an overridden user sensitivity.
123      */
124     public static final String FORCED_USER_SENSITIVE_UIDS_KEY = "forced_user_sensitive_uids_key";
125 
126     /**
127      * Key in the generic shared preferences that stores if all packages should be considered user
128      * sensitive
129      */
130     public static final String ALLOW_OVERRIDE_USER_SENSITIVE_KEY =
131             "allow_override_user_sensitive_key";
132 
133     /**
134      * Key in the generic shared preferences that controls if the
135      * {@link android.Manifest.permission#RECORD_AUDIO} of the currently registered assistant is
136      * user sensitive.
137      */
138     public static final String ASSISTANT_RECORD_AUDIO_IS_USER_SENSITIVE_KEY =
139             "assistant_record_audio_is_user_sensitive_key";
140 
141     /**
142      * Name of file containing the permissions that should be restored, but have not been restored
143      * yet.
144      */
145     public static final String DELAYED_RESTORE_PERMISSIONS_FILE = "delayed_restore_permissions.xml";
146 
147     /**
148      * Name of file containing the user denied status for requesting roles.
149      */
150     public static final String REQUEST_ROLE_USER_DENIED_FILE = "request_role_user_denied";
151 
152     /**
153      * Logs to dump
154      */
155     public static final String LOGS_TO_DUMP_FILE = "LogToDump.log";
156 
157     /**
158      * Key in the user denied status for requesting roles shared preferences that stores a string
159      * set for the names of the roles that an application has been denied for once.
160      */
161     public static final String REQUEST_ROLE_USER_DENIED_ONCE_KEY_PREFIX = "denied_once:";
162 
163     /**
164      * Key in the user denied status for requesting roles shared preferences that stores a string
165      * set for the names of the roles that an application is always denied for.
166      */
167     public static final String REQUEST_ROLE_USER_DENIED_ALWAYS_KEY_PREFIX = "denied_always:";
168 
169     /**
170      * Intent extra used to pass current sessionId between Permission Controller fragments.
171      */
172     public static final String EXTRA_SESSION_ID =
173             "com.android.permissioncontroller.extra.SESSION_ID";
174 
175     /**
176      * Invalid session id.
177      */
178     public static final long INVALID_SESSION_ID = 0;
179 
180     /**
181      * Key for NotificationManager.notify for auto-granted permissions notification,
182      * when silently displayed to the user.
183      */
184     public static final String ADMIN_AUTO_GRANTED_PERMISSIONS_NOTIFICATION_CHANNEL_ID =
185             "auto granted permissions";
186 
187     /**
188      * Key for NotificationManager.notify the auto-granted permissions notification,
189      * when alerting the user (with sound and vibration).
190      */
191     public static final String ADMIN_AUTO_GRANTED_PERMISSIONS_ALERTING_NOTIFICATION_CHANNEL_ID =
192             "alerting auto granted permissions";
193     /**
194      * ID for notification of auto-granted permissions shown by
195      * {@link com.android.permissioncontroller.permission.ui.AutoGrantPermissionsNotifier}.
196      */
197     public static final int PERMISSION_GRANTED_BY_ADMIN_NOTIFICATION_ID = 1;
198 }
199