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.packageinstaller;
18 
19 /**
20  * App-global constants
21  */
22 public class Constants {
23 
24     /**
25      * ID for the periodic job in
26      * {@link com.android.packageinstaller.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.packageinstaller.permission.service.LocationAccessCheck}.
33      */
34     public static final int LOCATION_ACCESS_CHECK_JOB_ID = 1;
35 
36     /**
37      * Name of file to containing the packages we already showed a notificaiton for.
38      *
39      * @see com.android.packageinstaller.permission.service.LocationAccessCheck
40      */
41     public static final String LOCATION_ACCESS_CHECK_ALREADY_NOTIFIED_FILE =
42             "packages_already_notified_location_access";
43 
44     /**
45      * ID for notification shown by
46      * {@link com.android.packageinstaller.permission.service.LocationAccessCheck}.
47      */
48     public static final int LOCATION_ACCESS_CHECK_NOTIFICATION_ID = 0;
49 
50     /**
51      * Key for Notification.Builder.setGroup() for the incident report approval notification.
52      */
53     public static final String INCIDENT_NOTIFICATION_GROUP_KEY = "incident confirmation";
54 
55     /**
56      * Key for Notification.Builder.setChannelId() for the incident report approval notification.
57      */
58     public static final String INCIDENT_NOTIFICATION_CHANNEL_ID = "incident_confirmation";
59 
60     /**
61      * ID for our notification.  We always post it with a tag which is the uri in string form.
62      */
63     public static final int INCIDENT_NOTIFICATION_ID = 66900652;
64 
65     /**
66      * Channel of the notifications shown by
67      * {@link com.android.packageinstaller.permission.service.LocationAccessCheck}.
68      */
69     public static final String PERMISSION_REMINDER_CHANNEL_ID = "permission reminders";
70 
71     /**
72      * Name of generic shared preferences file.
73      */
74     public static final String PREFERENCES_FILE = "preferences";
75 
76     /**
77      * Key in the generic shared preferences that stores when the location access feature
78      * was enabled, specifically when it was picked up by the code managing the feature.
79      */
80     public static final String KEY_LOCATION_ACCESS_CHECK_ENABLED_TIME =
81             "location_access_check_enabled_time";
82 
83     /**
84      * Key in the generic shared preferences that stores when the last notification was shown by
85      * {@link com.android.packageinstaller.permission.service.LocationAccessCheck}
86      */
87     public static final String KEY_LAST_LOCATION_ACCESS_NOTIFICATION_SHOWN =
88             "last_location_access_notification_shown";
89 
90     /**
91      * Key in the generic shared preferences that stores if the user manually selected the "none"
92      * role holder for a role.
93      */
94     public static final String IS_NONE_ROLE_HOLDER_SELECTED_KEY = "is_none_role_holder_selected:";
95 
96     /**
97      * Key in the generic shared preferences that stores if the user manually selected the "none"
98      * role holder for a role.
99      */
100     public static final String SEARCH_INDEXABLE_PROVIDER_PASSWORD_KEY =
101             "search_indexable_provider_password";
102 
103     /**
104      * Key in the generic shared preferences that stores the name of the packages that are currently
105      * have an overridden user sensitivity.
106      */
107     public static final String FORCED_USER_SENSITIVE_UIDS_KEY = "forced_user_sensitive_uids_key";
108 
109     /**
110      * Key in the generic shared preferences that stores if all packages should be considered user
111      * sensitive
112      */
113     public static final String ALLOW_OVERRIDE_USER_SENSITIVE_KEY =
114             "allow_override_user_sensitive_key";
115 
116     /**
117      * Key in the generic shared preferences that controls if the
118      * {@link android.Manifest.permission#RECORD_AUDIO} of the currently registered assistant is
119      * user sensitive.
120      */
121     public static final String ASSISTANT_RECORD_AUDIO_IS_USER_SENSITIVE_KEY =
122             "assistant_record_audio_is_user_sensitive_key";
123 
124     /**
125      * Name of file containing the permissions that should be restored, but have not been restored
126      * yet.
127      */
128     public static final String DELAYED_RESTORE_PERMISSIONS_FILE = "delayed_restore_permissions.xml";
129 
130     /**
131      * Name of file containing the user denied status for requesting roles.
132      */
133     public static final String REQUEST_ROLE_USER_DENIED_FILE = "request_role_user_denied";
134 
135     /**
136      * Key in the user denied status for requesting roles shared preferences that stores a string
137      * set for the names of the roles that an application has been denied for once.
138      */
139     public static final String REQUEST_ROLE_USER_DENIED_ONCE_KEY_PREFIX = "denied_once:";
140 
141     /**
142      * Key in the user denied status for requesting roles shared preferences that stores a string
143      * set for the names of the roles that an application is always denied for.
144      */
145     public static final String REQUEST_ROLE_USER_DENIED_ALWAYS_KEY_PREFIX = "denied_always:";
146 
147     /**
148      * Intent extra used to pass current sessionId between Permission Controller fragments.
149      */
150     public static final String EXTRA_SESSION_ID =
151             "com.android.packageinstaller.extra.SESSION_ID";
152 
153     /**
154      * Invalid session id.
155      */
156     public static final long INVALID_SESSION_ID = 0;
157 }
158