blob: 9c1d1b4e09d1f6b55c2bcec6478417769e3b3b3c [file] [log] [blame]
Clay Murphy648990e2015-04-08 17:58:14 -07001page.title=Implementing Device Administration
2@jd:body
3
4<!--
5 Copyright 2015 The Android Open Source Project
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19<div id="qv-wrapper">
20 <div id="qv">
21 <h2>In this document</h2>
22 <ol id="auto-toc">
23 </ol>
24 </div>
25</div>
26
Heidi von Markham8fba4742016-06-28 15:09:15 -070027<p>This section describes how to enable and validate device administration
28features required to prepare devices for managed profiles. It also covers device
29owner user cases that are essential in a corporate environment.</p>
Clay Murphy648990e2015-04-08 17:58:14 -070030
Heidi von Markham8fba4742016-06-28 15:09:15 -070031<p>In addition to Android Open Source Project (AOSP) code, a device requires the
32following components to function with managed profiles.</p>
Clay Murphy648990e2015-04-08 17:58:14 -070033
Heidi von Markham8fba4742016-06-28 15:09:15 -070034<h2 id=requirements>General requirements</h2>
35<p>Devices intending to support device administration must meet the following
36general requirements.</p>
37
38<h3 id=HAL_values>Thermal HAL values</h3>
39<p>Android N includes support for HardwarePropertiesManager API, a new device
40monitoring and health reporting API that enables applications to query the state
41of device hardware. This API is exposed via
42<code>android.os.HardwarePropertiesManager</code> and makes calls through
43<code>HardwarePropertiesManagerService</code> to the hardware thermal HAL
44(<code>hardware/libhardware/include/hardware/thermal.h</code>). It is a
45protected API, meaning only device/profile owner Device Policy Controller (DPC)
46applications and the current <code>VrListenerService</code> can call it.</p>
47
48<p>To support the HardwarePropertiesManager API, the device thermal HAL
49implementation must be able to report the following values:</p>
50
51<table>
52<tr>
53<th width="32%">Value</th>
54<th>Reporting Scale</th>
55<th>Enables</th>
56</tr>
57
58<tr>
59 <td>Temperature of [CPU|GPU|Battery|Device Skin]</td>
60 <td>Temperature of component in degrees Celsius</td>
61 <td>Apps can check device temperatures and component throttling/shutdown
62 temperatures</td>
63</tr>
64
65<tr>
66 <td>CPU active/total enabled times</td>
67 <td>Time in milliseconds</td>
68 <td>Apps can check CPU usage per core</td>
69</tr>
70
71<tr>
72 <td>Fan speed</td>
73 <td>RPM</td>
74 <td>Apps can check fan speed</td>
75</tr>
76
77</table>
78
79<p>Implementations should correctly handle reporting values situations when a
80core (or GPU, battery, fan) goes offline or is plugged/unplugged.</p>
81
82
83<h3 id=low_ram>No low-RAM</h3>
84<p>Device should not be a low-RAM device, meaning <code>ro.config.low_ram</code>
85should not be defined. The framework automatically limits the number of users
86to 1 when the <code>low_ram</code> flag is defined.</p>
87
88<h3 id=uses-feature>Uses-feature</h3>
89<p>Devices must define the following <code>uses-feature</code>:</p>
Clay Murphy648990e2015-04-08 17:58:14 -070090
91<pre>
92android.software.managed_users
93android.software.device_admin
94</pre>
95
Heidi von Markham8fba4742016-06-28 15:09:15 -070096<p>To confirm these <code>uses-feature</code> values have been defined on a
97device, run: <code>adb shell pm list features</code>.</p>
Clay Murphy648990e2015-04-08 17:58:14 -070098
Heidi von Markham8fba4742016-06-28 15:09:15 -070099<h3 id=required_apps>Essential apps only</h3>
100<p>By default, only applications essential for correct operation of the profile
101should be enabled as part of provisioning a managed device. OEMs must ensure the
102managed profile or device has all required applications by modifying:</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700103
Heidi von Markham8fba4742016-06-28 15:09:15 -0700104<pre>vendor_required_apps_managed_profile.xml
Clay Murphy648990e2015-04-08 17:58:14 -0700105vendor_required_apps_managed_device.xml
106</pre>
107
Heidi von Markham8fba4742016-06-28 15:09:15 -0700108<p>Examples from a Nexus device:</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700109
Heidi von Markham8fba4742016-06-28 15:09:15 -0700110<p><code>packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml</code></p>
Clay Murphy648990e2015-04-08 17:58:14 -0700111
Heidi von Markham8fba4742016-06-28 15:09:15 -0700112<pre>&lt;resources&gt;
Clay Murphy648990e2015-04-08 17:58:14 -0700113 &lt;!-- A list of apps to be retained on the managed device --&gt;
114 &lt;string-array name="vendor_required_apps_managed_device"&gt;
115 &lt;item&gt;com.android.vending&lt;/item&gt; &lt;!--­Google Play --&gt;
116 &lt;item&gt;com.google.android.gms&lt;/item&gt; &lt;!--­Required by Play --&gt;
117 &lt;item&gt;com.google.android.contacts&lt;/item&gt; &lt;!--­Google or OEM Contacts­--&gt;
118 &lt;item&gt;com.google.android.googlequicksearchbox&lt;/item&gt; &lt;!--­Google Launcher --&gt;
119 &lt;item&gt;com.google.android.launcher&lt;/item&gt; &lt;!--­Google Launcher or OEM Launcher --&gt;
120 &lt;item&gt;com.google.android.dialer&lt;/item&gt; &lt;!--­Google or OEM dialer to enable making phone calls --&gt;
121 &lt;/string-array&gt;
122&lt;/resources&gt;
123</pre>
124
Heidi von Markham8fba4742016-06-28 15:09:15 -0700125<p><code>
Clay Murphy648990e2015-04-08 17:58:14 -0700126packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml
Heidi von Markham8fba4742016-06-28 15:09:15 -0700127</code></p>
Clay Murphy648990e2015-04-08 17:58:14 -0700128
129<pre>
130&lt;resources&gt;
131 &lt;!-- A list of apps to be retained in the managed profile. This includes any Google experience apps required. --&gt;
132 &lt;string-array name="vendor_required_apps_managed_profile"&gt;
133 &lt;item&gt;com.android.vending&lt;/item&gt; &lt;!-- Google Play --&gt;
134 &lt;item&gt;com.google.android.gms&lt;/item&gt; &lt;!-- Required by Play --&gt;
135 &lt;item&gt;com.google.android.contacts&lt;/item&gt; &lt;!-- Google or OEM Contacts --&gt;
136 &lt;/string-array&gt;
137&lt;/resources&gt;
138</pre>
139
Heidi von Markham8fba4742016-06-28 15:09:15 -0700140<h2 id=launcher>Launcher requirements</h2>
Clay Murphy648990e2015-04-08 17:58:14 -0700141
Heidi von Markham8fba4742016-06-28 15:09:15 -0700142<p>You must update the Launcher to support badging applications with the icon
143badge (provided in AOSP to represent the managed applications) and other badge
144user interface elements such as recents and notifications. If you use
145<a href="https://android.googlesource.com/platform/packages/apps/Launcher3/">launcher3</a>
146in AOSP without modifications, then you likely already support this badging
147feature.</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700148
Heidi von Markham8fba4742016-06-28 15:09:15 -0700149<h2 id=nfc>NFC requirements</h2>
Clay Murphy648990e2015-04-08 17:58:14 -0700150
Heidi von Markham8fba4742016-06-28 15:09:15 -0700151<p>Devices with NFC must enable NFC during the out-of-the-box experience (i.e.,
152setup wizard) and be configured to accept managed provisioning intents:</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700153
Heidi von Markham8fba4742016-06-28 15:09:15 -0700154<p><code>packages/apps/Nfc/res/values/provisioning.xml</code></p>
155<pre>&lt;bool name="enable_nfc_provisioning"&gt;true&lt;/bool&gt;
Clay Murphy648990e2015-04-08 17:58:14 -0700156&lt;item>application/com.android.managedprovisioning&lt;/item&gt;
157</pre>
158
Heidi von Markham8fba4742016-06-28 15:09:15 -0700159<h2 id=setup_wizard>Setup requirements</h2>
Clay Murphy648990e2015-04-08 17:58:14 -0700160
Heidi von Markham8fba4742016-06-28 15:09:15 -0700161<p>Devices that include an out-of-box experience (i.e., setup wizard)
162should implement device owner provisioning. When the out-of-box experience
163opens, it should check if another process (such as device owner provisioning)
164has already finished the user setup and, if so, it should fire a home intent
165and finish the setup. This intent is caught by the provisioning application,
166which then hands control to the newly-set device owner.</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700167
Heidi von Markham8fba4742016-06-28 15:09:15 -0700168<p>To meet setup requirements, add the following code to the device setup's main
169activity:</p>
Clay Murphy648990e2015-04-08 17:58:14 -0700170
Heidi von Markham8fba4742016-06-28 15:09:15 -0700171<pre>&#64;Override
Clay Murphy648990e2015-04-08 17:58:14 -0700172 protected void onStart() {
173 super.onStart();
174
175 // When returning to a setup wizard activity, check to see if another setup process
176 // has intervened and, if so, complete an orderly exit
177 boolean completed = Settings.Secure.getInt(getContentResolver(),
178 Settings.Secure.USER_SETUP_COMPLETE, 0) != 0;
Heidi von Markham8fba4742016-06-28 15:09:15 -0700179 if (completed) {
Clay Murphy648990e2015-04-08 17:58:14 -0700180 startActivity(new Intent(Intent.ACTION_MAIN, null)
181 .addCategory(Intent.CATEGORY_HOME)
182 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
183 | Intent.FLAG_ACTIVITY_CLEAR_TASK
184 | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED));
185 finish();
186 }
187
188 ...
189 }
190</pre>