1<?xml version="1.0" encoding="utf-8"?>
2
3<!-- Copyright (C) 2018 The Android Open Source Project
4
5     Licensed under the Apache License, Version 2.0 (the "License"" />
6     you may not use this file except in compliance with the License.
7     You may obtain a copy of the License at
8
9          http://www.apache.org/licenses/LICENSE-2.0
10
11     Unless required by applicable law or agreed to in writing, software
12     distributed under the License is distributed on an "AS IS" BASIS,
13     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14     See the License for the specific language governing permissions and
15     limitations under the License.
16-->
17
18<roles>
19
20    <permission-set name="phone">
21        <permission name="android.permission.READ_PHONE_STATE" />
22        <permission name="android.permission.CALL_PHONE" />
23        <permission name="android.permission.READ_CALL_LOG" />
24        <permission name="android.permission.WRITE_CALL_LOG" />
25        <permission name="com.android.voicemail.permission.ADD_VOICEMAIL" />
26        <permission name="android.permission.USE_SIP" />
27        <permission name="android.permission.PROCESS_OUTGOING_CALLS" />
28    </permission-set>
29
30    <permission-set name="contacts">
31        <permission name="android.permission.READ_CONTACTS" />
32        <permission name="android.permission.WRITE_CONTACTS" />
33        <permission name="android.permission.GET_ACCOUNTS" />
34    </permission-set>
35
36    <permission-set name="location">
37        <permission name="android.permission.ACCESS_FINE_LOCATION" />
38        <permission name="android.permission.ACCESS_COARSE_LOCATION" />
39    </permission-set>
40
41    <permission-set name="coarse_location">
42        <permission name="android.permission.ACCESS_COARSE_LOCATION" />
43    </permission-set>
44
45    <permission-set name="calendar">
46        <permission name="android.permission.READ_CALENDAR" />
47        <permission name="android.permission.WRITE_CALENDAR" />
48    </permission-set>
49
50    <permission-set name="sms">
51        <permission name="android.permission.SEND_SMS" />
52        <permission name="android.permission.RECEIVE_SMS" />
53        <permission name="android.permission.READ_SMS" />
54        <permission name="android.permission.RECEIVE_WAP_PUSH" />
55        <permission name="android.permission.RECEIVE_MMS" />
56        <permission name="android.permission.READ_CELL_BROADCASTS" />
57    </permission-set>
58
59    <permission-set name="microphone">
60        <permission name="android.permission.RECORD_AUDIO" />
61    </permission-set>
62
63    <permission-set name="camera">
64        <permission name="android.permission.CAMERA" />
65    </permission-set>
66
67    <permission-set name="sensors">
68        <permission name="android.permission.BODY_SENSORS" />
69    </permission-set>
70
71    <permission-set name="storage">
72        <permission name="android.permission.READ_EXTERNAL_STORAGE" />
73        <permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
74    </permission-set>
75
76    <role
77        name="android.app.role.ASSISTANT"
78        behavior="AssistantRoleBehavior"
79        defaultHolders="config_defaultAssistant"
80        description="@string/role_assistant_description"
81        exclusive="true"
82        fallBackToDefaultHolder="true"
83        showNone="true"
84        label="@string/role_assistant_label"
85        requestable="false"
86        shortLabel="@string/role_assistant_short_label">
87        <required-components>
88            <!-- Qualified components are determined int AssistantRoleBehavior. This comment here is
89                 ignored and represents just a rough description
90
91            <any-of>
92                <service permission="android.permission.BIND_VOICE_INTERACTION"
93                         supportsAssist="true">
94                    <intent-filter>
95                        <action name="android.service.voice.VoiceInteractionService" />
96                    </intent-filter>
97                    <meta-data name="android.voice_interaction"
98                               optional="false">
99                        required tag in metadata xml: sessionService
100                        required tag in metadata xml: recognitionService
101                        required tag in metadata xml: supportsAssist = true
102                    </meta-data>
103                </service>
104                <activity>
105                    <intent-filter>
106                        <action name="android.intent.action.ASSIST" />
107                    </intent-filter>
108                </activity>
109            </ any-of>
110
111            -->
112        </required-components>
113        <permissions>
114            <permission-set name="sms" />
115            <permission name="android.permission.READ_CALL_LOG" />
116        </permissions>
117    </role>
118
119    <!---
120      ~ @see com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController
121      ~ @see com.android.settings.applications.defaultapps.DefaultBrowserPicker
122      ~ @see com.android.server.pm.PackageManagerService.resolveAllBrowserApps(int)
123      ~ @see com.android.server.pm.PackageManagerService.setDefaultBrowserPackageName(String, int)
124      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultBrowser(String, int)
125      -->
126    <role
127        name="android.app.role.BROWSER"
128        behavior="BrowserRoleBehavior"
129        defaultHolders="config_defaultBrowser"
130        description="@string/role_browser_description"
131        exclusive="true"
132        label="@string/role_browser_label"
133        requestDescription="@string/role_browser_request_description"
134        requestTitle="@string/role_browser_request_title"
135        shortLabel="@string/role_browser_short_label">
136        <!--
137          ~ Required components matching is handled in BrowserRoleBehavior because it needs the
138          ~ PackageManager.MATCH_ALL flag and other manual filtering, which cannot fit in our
139          ~ current mechanism easily.
140          -->
141        <!--
142        <required-components>
143            <activity>
144                <intent-filter>
145                    <action name="android.intent.action.VIEW" />
146                    <category name="android.intent.category.BROWSABLE" />
147                    <data scheme="http" />
148                </intent-filter>
149            </activity>
150        </required-components>
151        -->
152        <!--
153          ~ Not need to set preferred activity because PackageManager handles browser intents
154          ~ specially.
155          -->
156    </role>
157
158    <!--
159      ~ @see com.android.settings.applications.defaultapps.DefaultPhonePreferenceController
160      ~ @see com.android.settings.applications.defaultapps.DefaultPhonePicker
161      ~ @see android.telecom.DefaultDialerManager
162      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultDialerApp(String, int)
163      ~ @see com.android.server.pm.Settings.setDefaultDialerPackageNameLPw(String, int)
164      -->
165    <role
166        name="android.app.role.DIALER"
167        behavior="DialerRoleBehavior"
168        defaultHolders="config_defaultDialer"
169        description="@string/role_dialer_description"
170        exclusive="true"
171        fallBackToDefaultHolder="true"
172        label="@string/role_dialer_label"
173        requestDescription="@string/role_dialer_request_description"
174        requestTitle="@string/role_dialer_request_title"
175        searchKeywords="@string/role_dialer_search_keywords"
176        shortLabel="@string/role_dialer_short_label">
177        <required-components>
178            <activity>
179                <intent-filter>
180                    <action name="android.intent.action.DIAL" />
181                </intent-filter>
182            </activity>
183            <activity>
184                <intent-filter>
185                    <action name="android.intent.action.DIAL" />
186                    <data scheme="tel" />
187                </intent-filter>
188            </activity>
189        </required-components>
190        <permissions>
191            <permission-set name="phone" />
192            <permission-set name="contacts" />
193            <permission-set name="sms" />
194            <permission-set name="microphone" />
195            <permission-set name="camera" />
196        </permissions>
197        <app-ops>
198            <!--
199              ~ @see com.android.settings.applications.defaultapps.DefaultPhonePicker#setDefaultKey(String)
200              ~ @see com.android.settings.fuelgauge.BatteryUtils#setForceAppStandby(int, String, int)
201              -->
202            <app-op name="android:run_in_background" maxTargetSdkVersion="25" mode="allowed" />
203            <app-op name="android:run_any_in_background" mode="allowed" />
204        </app-ops>
205        <preferred-activities>
206            <preferred-activity>
207                <activity>
208                    <intent-filter>
209                        <action name="android.intent.action.DIAL" />
210                    </intent-filter>
211                </activity>
212                <intent-filter>
213                    <action name="android.intent.action.DIAL" />
214                </intent-filter>
215            </preferred-activity>
216            <preferred-activity>
217                <activity>
218                    <intent-filter>
219                        <action name="android.intent.action.DIAL" />
220                        <data scheme="tel" />
221                    </intent-filter>
222                </activity>
223                <intent-filter>
224                    <action name="android.intent.action.DIAL" />
225                    <data scheme="tel" />
226                </intent-filter>
227            </preferred-activity>
228        </preferred-activities>
229    </role>
230
231    <!--
232      ~ @see com.android.settings.applications.defaultapps.DefaultSmsPreferenceController
233      ~ @see com.android.settings.applications.defaultapps.DefaultSmsPicker
234      ~ @see com.android.internal.telephony.SmsApplication
235      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultSmsApp(String, int)
236      -->
237    <role
238        name="android.app.role.SMS"
239        behavior="SmsRoleBehavior"
240        defaultHolders="config_defaultSms"
241        description="@string/role_sms_description"
242        exclusive="true"
243        label="@string/role_sms_label"
244        requestDescription="@string/role_sms_request_description"
245        requestTitle="@string/role_sms_request_title"
246        searchKeywords="@string/role_sms_search_keywords"
247        shortLabel="@string/role_sms_short_label">
248        <required-components>
249            <receiver permission="android.permission.BROADCAST_SMS">
250                <intent-filter>
251                    <action name="android.provider.Telephony.SMS_DELIVER" />
252                </intent-filter>
253            </receiver>
254            <receiver permission="android.permission.BROADCAST_WAP_PUSH">
255                <intent-filter>
256                    <action name="android.provider.Telephony.WAP_PUSH_DELIVER" />
257                    <data mimeType="application/vnd.wap.mms-message" />
258                </intent-filter>
259            </receiver>
260            <service permission="android.permission.SEND_RESPOND_VIA_MESSAGE">
261                <intent-filter>
262                    <action name="android.intent.action.RESPOND_VIA_MESSAGE" />
263                    <data scheme="smsto" />
264                </intent-filter>
265            </service>
266            <activity>
267                <intent-filter>
268                    <action name="android.intent.action.SENDTO" />
269                    <data scheme="smsto" />
270                </intent-filter>
271            </activity>
272        </required-components>
273        <permissions>
274            <permission-set name="phone" />
275            <permission-set name="contacts" />
276            <permission-set name="sms" />
277            <permission-set name="storage" />
278            <permission-set name="microphone" />
279            <permission-set name="camera" />
280        </permissions>
281        <app-ops>
282            <app-op name="android:write_sms" mode="allowed" />
283            <!--
284              ~ @see com.android.settings.applications.defaultapps.DefaultSmsPicker#setDefaultKey(String)
285              ~ @see com.android.settings.fuelgauge.BatteryUtils#setForceAppStandby(int, String, int)
286              -->
287            <app-op name="android:run_in_background" maxTargetSdkVersion="25" mode="allowed" />
288            <app-op name="android:run_any_in_background" mode="allowed" />
289            <app-op name="android:read_device_identifiers" mode="allowed" />
290        </app-ops>
291        <preferred-activities>
292            <preferred-activity>
293                <activity>
294                    <intent-filter>
295                        <action name="android.intent.action.SENDTO" />
296                        <data scheme="smsto" />
297                    </intent-filter>
298                </activity>
299                <intent-filter>
300                    <action name="android.intent.action.SENDTO" />
301                    <data scheme="sms" />
302                </intent-filter>
303                <intent-filter>
304                    <action name="android.intent.action.SENDTO" />
305                    <data scheme="smsto" />
306                </intent-filter>
307                <intent-filter>
308                    <action name="android.intent.action.SENDTO" />
309                    <data scheme="mms" />
310                </intent-filter>
311                <intent-filter>
312                    <action name="android.intent.action.SENDTO" />
313                    <data scheme="mmsto" />
314                </intent-filter>
315            </preferred-activity>
316        </preferred-activities>
317    </role>
318
319    <!---
320      ~ @see com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController
321      ~ @see com.android.settings.applications.defaultapps.DefaultEmergencyPicker
322      ~ @see com.android.phone.EmergencyAssistanceHelper
323      -->
324    <role
325        name="android.app.role.EMERGENCY"
326        behavior="EmergencyRoleBehavior"
327        description="@string/role_emergency_description"
328        exclusive="true"
329        label="@string/role_emergency_label"
330        requestDescription="@string/role_emergency_request_description"
331        requestTitle="@string/role_emergency_request_title"
332        searchKeywords="@string/role_emergency_search_keywords"
333        shortLabel="@string/role_emergency_short_label"
334        systemOnly="true">
335        <required-components>
336            <activity>
337                <intent-filter>
338                    <action name="android.telephony.action.EMERGENCY_ASSISTANCE" />
339                </intent-filter>
340            </activity>
341        </required-components>
342    </role>
343
344    <!---
345      ~ @see com.android.settings.applications.defaultapps.DefaultHomePreferenceController
346      ~ @see com.android.settings.applications.defaultapps.DefaultHomePicker
347      ~ @see com.android.server.pm.PackageManagerService#setHomeActivity(ComponentName, int)
348      -->
349    <role
350        name="android.app.role.HOME"
351        behavior="HomeRoleBehavior"
352        description="@string/role_home_description"
353        exclusive="true"
354        label="@string/role_home_label"
355        requestDescription="@string/role_home_request_description"
356        requestTitle="@string/role_home_request_title"
357        searchKeywords="@string/role_home_search_keywords"
358        shortLabel="@string/role_home_short_label">
359        <!-- Also used by HomeRoleBehavior.getFallbackHolder(). -->
360        <required-components>
361            <activity>
362                <intent-filter>
363                    <action name="android.intent.action.MAIN" />
364                    <category name="android.intent.category.HOME" />
365                </intent-filter>
366            </activity>
367        </required-components>
368        <preferred-activities>
369            <preferred-activity>
370                <activity>
371                    <intent-filter>
372                        <action name="android.intent.action.MAIN" />
373                        <category name="android.intent.category.HOME" />
374                    </intent-filter>
375                </activity>
376                <intent-filter>
377                    <action name="android.intent.action.MAIN" />
378                    <category name="android.intent.category.HOME" />
379                </intent-filter>
380            </preferred-activity>
381        </preferred-activities>
382    </role>
383
384    <!--- @see android.telecom.CallRedirectionService -->
385    <role
386        name="android.app.role.CALL_REDIRECTION"
387        defaultHolders="config_defaultCallRedirection"
388        description="@string/role_call_redirection_description"
389        exclusive="true"
390        label="@string/role_call_redirection_label"
391        requestDescription="@string/role_call_redirection_request_description"
392        requestTitle="@string/role_call_redirection_request_title"
393        shortLabel="@string/role_call_redirection_short_label"
394        showNone="true">
395        <required-components>
396            <service permission="android.permission.BIND_CALL_REDIRECTION_SERVICE">
397                <intent-filter>
398                    <action name="android.telecom.CallRedirectionService" />
399                </intent-filter>
400            </service>
401        </required-components>
402    </role>
403
404    <!--- @see android.telecom.CallScreeningService -->
405    <role
406        name="android.app.role.CALL_SCREENING"
407        defaultHolders="config_defaultCallScreening"
408        description="@string/role_call_screening_description"
409        exclusive="true"
410        label="@string/role_call_screening_label"
411        requestDescription="@string/role_call_screening_request_description"
412        requestTitle="@string/role_call_screening_request_title"
413        shortLabel="@string/role_call_screening_short_label"
414        showNone="true">
415        <required-components>
416            <service permission="android.permission.BIND_SCREENING_SERVICE">
417                <intent-filter>
418                    <action name="android.telecom.CallScreeningService" />
419                </intent-filter>
420            </service>
421        </required-components>
422        <app-op-permissions>
423            <app-op-permission name="android.permission.SYSTEM_ALERT_WINDOW" />
424        </app-op-permissions>
425    </role>
426
427    <role
428        name="android.app.role.SYSTEM_GALLERY"
429        defaultHolders="config_systemGallery"
430        exclusive="true"
431        fallBackToDefaultHolder="true"
432        systemOnly="true"
433        visible="false">
434        <permissions>
435            <permission-set name="storage" />
436            <permission name="android.permission.ACCESS_MEDIA_LOCATION" />
437        </permissions>
438        <app-ops>
439            <app-op name="android:write_media_images" mode="allowed" />
440            <app-op name="android:write_media_video" mode="allowed" />
441        </app-ops>
442    </role>
443</roles>
444