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        description="@string/role_assistant_description"
80        exclusive="true"
81        showNone="true"
82        label="@string/role_assistant_label"
83        requestable="false"
84        shortLabel="@string/role_assistant_short_label">
85        <required-components>
86            <!-- Qualified components are determined int AssistantRoleBehavior. This comment here is
87                 ignored and represents just a rough description
88
89            <any-of>
90                <service permission="android.permission.BIND_VOICE_INTERACTION"
91                         supportsAssist="true">
92                    <intent-filter>
93                        <action name="android.service.voice.VoiceInteractionService" />
94                    </intent-filter>
95                    <meta-data name="android.voice_interaction"
96                               optional="false">
97                        required tag in metadata xml: sessionService
98                        required tag in metadata xml: recognitionService
99                        required tag in metadata xml: supportsAssist = true
100                    </meta-data>
101                </service>
102                <activity>
103                    <intent-filter>
104                        <action name="android.intent.action.ASSIST" />
105                    </intent-filter>
106                </activity>
107            </ any-of>
108
109            -->
110        </required-components>
111        <permissions>
112            <permission-set name="sms" />
113            <permission name="android.permission.READ_CALL_LOG" />
114        </permissions>
115    </role>
116
117    <!---
118      ~ @see com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController
119      ~ @see com.android.settings.applications.defaultapps.DefaultBrowserPicker
120      ~ @see com.android.server.pm.PackageManagerService.resolveAllBrowserApps(int)
121      ~ @see com.android.server.pm.PackageManagerService.setDefaultBrowserPackageName(String, int)
122      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultBrowser(String, int)
123      -->
124    <role
125        name="android.app.role.BROWSER"
126        behavior="BrowserRoleBehavior"
127        description="@string/role_browser_description"
128        exclusive="true"
129        label="@string/role_browser_label"
130        requestDescription="@string/role_browser_request_description"
131        requestTitle="@string/role_browser_request_title"
132        shortLabel="@string/role_browser_short_label">
133        <!--
134          ~ Required components matching is handled in BrowserRoleBehavior because it needs the
135          ~ PackageManager.MATCH_ALL flag and other manual filtering, which cannot fit in our
136          ~ current mechanism easily.
137          -->
138        <!--
139        <required-components>
140            <activity>
141                <intent-filter>
142                    <action name="android.intent.action.VIEW" />
143                    <category name="android.intent.category.BROWSABLE" />
144                    <data scheme="http" />
145                </intent-filter>
146            </activity>
147        </required-components>
148        -->
149        <!--
150          ~ Not need to set preferred activity because PackageManager handles browser intents
151          ~ specially.
152          -->
153    </role>
154
155    <!--
156      ~ @see com.android.settings.applications.defaultapps.DefaultPhonePreferenceController
157      ~ @see com.android.settings.applications.defaultapps.DefaultPhonePicker
158      ~ @see android.telecom.DefaultDialerManager
159      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultDialerApp(String, int)
160      ~ @see com.android.server.pm.Settings.setDefaultDialerPackageNameLPw(String, int)
161      -->
162    <role
163        name="android.app.role.DIALER"
164        behavior="DialerRoleBehavior"
165        description="@string/role_dialer_description"
166        exclusive="true"
167        label="@string/role_dialer_label"
168        requestDescription="@string/role_dialer_request_description"
169        requestTitle="@string/role_dialer_request_title"
170        shortLabel="@string/role_dialer_short_label">
171        <required-components>
172            <activity>
173                <intent-filter>
174                    <action name="android.intent.action.DIAL" />
175                </intent-filter>
176            </activity>
177            <activity>
178                <intent-filter>
179                    <action name="android.intent.action.DIAL" />
180                    <data scheme="tel" />
181                </intent-filter>
182            </activity>
183        </required-components>
184        <permissions>
185            <permission-set name="phone" />
186            <permission-set name="contacts" />
187            <permission-set name="sms" />
188            <permission-set name="microphone" />
189            <permission-set name="camera" />
190        </permissions>
191        <app-ops>
192            <!--
193              ~ @see com.android.settings.applications.defaultapps.DefaultPhonePicker#setDefaultKey(String)
194              ~ @see com.android.settings.fuelgauge.BatteryUtils#setForceAppStandby(int, String, int)
195              -->
196            <app-op name="android:run_in_background" maxTargetSdkVersion="25" mode="allowed" />
197            <app-op name="android:run_any_in_background" mode="allowed" />
198        </app-ops>
199        <preferred-activities>
200            <preferred-activity>
201                <activity>
202                    <intent-filter>
203                        <action name="android.intent.action.DIAL" />
204                    </intent-filter>
205                </activity>
206                <intent-filter>
207                    <action name="android.intent.action.DIAL" />
208                </intent-filter>
209            </preferred-activity>
210            <preferred-activity>
211                <activity>
212                    <intent-filter>
213                        <action name="android.intent.action.DIAL" />
214                        <data scheme="tel" />
215                    </intent-filter>
216                </activity>
217                <intent-filter>
218                    <action name="android.intent.action.DIAL" />
219                    <data scheme="tel" />
220                </intent-filter>
221            </preferred-activity>
222        </preferred-activities>
223    </role>
224
225    <!--
226      ~ @see com.android.settings.applications.defaultapps.DefaultSmsPreferenceController
227      ~ @see com.android.settings.applications.defaultapps.DefaultSmsPicker
228      ~ @see com.android.internal.telephony.SmsApplication
229      ~ @see com.android.server.pm.permission.DefaultPermissionGrantPolicy.grantDefaultPermissionsToDefaultSmsApp(String, int)
230      -->
231    <role
232        name="android.app.role.SMS"
233        behavior="SmsRoleBehavior"
234        description="@string/role_sms_description"
235        exclusive="true"
236        label="@string/role_sms_label"
237        requestDescription="@string/role_sms_request_description"
238        requestTitle="@string/role_sms_request_title"
239        shortLabel="@string/role_sms_short_label">
240        <required-components>
241            <receiver permission="android.permission.BROADCAST_SMS">
242                <intent-filter>
243                    <action name="android.provider.Telephony.SMS_DELIVER" />
244                </intent-filter>
245            </receiver>
246            <receiver permission="android.permission.BROADCAST_WAP_PUSH">
247                <intent-filter>
248                    <action name="android.provider.Telephony.WAP_PUSH_DELIVER" />
249                    <data mimeType="application/vnd.wap.mms-message" />
250                </intent-filter>
251            </receiver>
252            <service permission="android.permission.SEND_RESPOND_VIA_MESSAGE">
253                <intent-filter>
254                    <action name="android.intent.action.RESPOND_VIA_MESSAGE" />
255                    <data scheme="smsto" />
256                </intent-filter>
257            </service>
258            <activity>
259                <intent-filter>
260                    <action name="android.intent.action.SENDTO" />
261                    <data scheme="smsto" />
262                </intent-filter>
263            </activity>
264        </required-components>
265        <permissions>
266            <permission-set name="phone" />
267            <permission-set name="contacts" />
268            <permission-set name="sms" />
269            <permission-set name="storage" />
270            <permission-set name="microphone" />
271            <permission-set name="camera" />
272        </permissions>
273        <app-ops>
274            <app-op name="android:write_sms" mode="allowed" />
275            <!--
276              ~ @see com.android.settings.applications.defaultapps.DefaultSmsPicker#setDefaultKey(String)
277              ~ @see com.android.settings.fuelgauge.BatteryUtils#setForceAppStandby(int, String, int)
278              -->
279            <app-op name="android:run_in_background" maxTargetSdkVersion="25" mode="allowed" />
280            <app-op name="android:run_any_in_background" mode="allowed" />
281            <app-op name="android:read_device_identifiers" mode="allowed" />
282        </app-ops>
283        <preferred-activities>
284            <preferred-activity>
285                <activity>
286                    <intent-filter>
287                        <action name="android.intent.action.SENDTO" />
288                        <data scheme="smsto" />
289                    </intent-filter>
290                </activity>
291                <intent-filter>
292                    <action name="android.intent.action.SENDTO" />
293                    <data scheme="sms" />
294                </intent-filter>
295                <intent-filter>
296                    <action name="android.intent.action.SENDTO" />
297                    <data scheme="smsto" />
298                </intent-filter>
299                <intent-filter>
300                    <action name="android.intent.action.SENDTO" />
301                    <data scheme="mms" />
302                </intent-filter>
303                <intent-filter>
304                    <action name="android.intent.action.SENDTO" />
305                    <data scheme="mmsto" />
306                </intent-filter>
307            </preferred-activity>
308        </preferred-activities>
309    </role>
310
311    <!---
312      ~ @see com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController
313      ~ @see com.android.settings.applications.defaultapps.DefaultEmergencyPicker
314      ~ @see com.android.phone.EmergencyAssistanceHelper
315      -->
316    <role
317        name="android.app.role.EMERGENCY"
318        behavior="EmergencyRoleBehavior"
319        description="@string/role_emergency_description"
320        exclusive="true"
321        label="@string/role_emergency_label"
322        requestDescription="@string/role_emergency_request_description"
323        requestTitle="@string/role_emergency_request_title"
324        shortLabel="@string/role_emergency_short_label"
325        systemOnly="true">
326        <required-components>
327            <activity>
328                <intent-filter>
329                    <action name="android.telephony.action.EMERGENCY_ASSISTANCE" />
330                </intent-filter>
331            </activity>
332        </required-components>
333    </role>
334
335    <!---
336      ~ @see com.android.settings.applications.defaultapps.DefaultHomePreferenceController
337      ~ @see com.android.settings.applications.defaultapps.DefaultHomePicker
338      ~ @see com.android.server.pm.PackageManagerService#setHomeActivity(ComponentName, int)
339      -->
340    <role
341        name="android.app.role.HOME"
342        behavior="HomeRoleBehavior"
343        description="@string/role_home_description"
344        exclusive="true"
345        label="@string/role_home_label"
346        requestDescription="@string/role_home_request_description"
347        requestTitle="@string/role_home_request_title"
348        shortLabel="@string/role_home_short_label">
349        <!-- Also used by HomeRoleBehavior.getFallbackHolder(). -->
350        <required-components>
351            <activity>
352                <intent-filter>
353                    <action name="android.intent.action.MAIN" />
354                    <category name="android.intent.category.HOME" />
355                </intent-filter>
356            </activity>
357        </required-components>
358        <preferred-activities>
359            <preferred-activity>
360                <activity>
361                    <intent-filter>
362                        <action name="android.intent.action.MAIN" />
363                        <category name="android.intent.category.HOME" />
364                    </intent-filter>
365                </activity>
366                <intent-filter>
367                    <action name="android.intent.action.MAIN" />
368                    <category name="android.intent.category.HOME" />
369                </intent-filter>
370            </preferred-activity>
371        </preferred-activities>
372    </role>
373
374    <!--- @see android.telecom.CallRedirectionService -->
375    <role
376        name="android.app.role.CALL_REDIRECTION"
377        description="@string/role_call_redirection_description"
378        exclusive="true"
379        label="@string/role_call_redirection_label"
380        requestDescription="@string/role_call_redirection_request_description"
381        requestTitle="@string/role_call_redirection_request_title"
382        shortLabel="@string/role_call_redirection_short_label">
383        <required-components>
384            <service permission="android.permission.BIND_CALL_REDIRECTION_SERVICE">
385                <intent-filter>
386                    <action name="android.telecom.CallRedirectionService" />
387                </intent-filter>
388            </service>
389        </required-components>
390    </role>
391
392    <!--- @see android.telecom.CallScreeningService -->
393    <role
394        name="android.app.role.CALL_SCREENING"
395        description="@string/role_call_screening_description"
396        exclusive="true"
397        label="@string/role_call_screening_label"
398        requestDescription="@string/role_call_screening_request_description"
399        requestTitle="@string/role_call_screening_request_title"
400        shortLabel="@string/role_call_screening_short_label">
401        <required-components>
402            <service permission="android.permission.BIND_SCREENING_SERVICE">
403                <intent-filter>
404                    <action name="android.telecom.CallScreeningService" />
405                </intent-filter>
406            </service>
407        </required-components>
408    </role>
409</roles>
410