aboutsummaryrefslogtreecommitdiff
path: root/en/compatibility/cts/setup.html
blob: f7600b4dad421319147160ef495b3038669de2dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<html devsite>
  <head>
    <title>Setting up CTS</title>
    <meta name="project_path" value="/_project.yaml" />
    <meta name="book_path" value="/_book.yaml" />
  </head>
  <body>
  <!--
      Copyright 2017 The Android Open Source Project

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
  -->



<h2 id=physical_environment>Physical environment</h2>

<h3 id=ble_beacons>Bluetooth LE beacons</h3>
<p>If the device-under-test (DUT) supports the Bluetooth LE feature, then at
least three Bluetooth LE beacons should be placed within five meters of the DUT
for Bluetooth LE scan testing. Those beacons can be any kind, do not need to be
configured or emit anything specific, and can include iBeacon, Eddystone, or
even devices simulating BLE beacons.</p>

<h3 id=camera>Cameras</h3>
<p>When running camera CTS, you are recommended to use normal lighting
conditions with a test pattern chart (such as a checkerboard pattern) that is
not too close to the lens (the distance depends on the device's minimum focus
distance).</p>

<p>If the DUT supports external cameras, such as USB
webcams, an external camera must be plugged in when running CTS.
Otherwise, the CTS tests will fail.</p>

<h3 id="gnss">GPS/GNSS</h3>
<p>If the DUT supports the Global Positioning System (GPS) Global Navigation
Satellite System (GNSS) feature, then a GPS/GNSS signal, with GPS portion
compliant with ICD-GPS-200C, should be provided to the DUT at a suitable signal
level for reception and GPS location calculation. The GPS/GNSS signal source can
be of any kind, ranging from a satellite simulator, to a GPS/GNSS repeater of
outdoor signals, simply to placement of the DUT close enough to a window such that
it can directly receive enough GPS/GNSS signal.</p>

<aside class="caution">
  <strong>Caution:</strong> For the GPS testing, the internet connection setup
  must not block connections to  supl.google.com port 7276. This port is used to
  download GPS assistance data for testing position calculation on the local device.
</aside>

<h3 id=wifi>Wi-Fi and IPv6</h3>
<p>CTS tests require a Wi-Fi network that supports IPv6, can treat the Device
Under Test (DUT) as an isolated client, and has an internet
connection. An isolated client refers to a
configuration where the DUT does not have visibility to the
broadcast/multinetwork messages on that subnetwork, either by a Wi-Fi AP
configuration or by running the DUT on an isolated sub-network without
other devices being connected.</p>

<p>If you don't have access to a native IPv6 network, an IPv6 carrier network,
or a VPN to pass some tests depending on IPv6, you may instead use a Wi-Fi
access point and an IPv6 tunnel. See Wikipedia <a
href="http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers">list of IPv6
tunnel brokers</a>.</p>

<h3 id="rtt">Wi-Fi RTT (Round Trip Time)</h3>
<p>Android 9 adds an API for a <a ref="/devices/tech/connect/wifi-rtt">Wi-Fi RTT</a> capability,
which allows devices to measure their distance to access points with an accuracy of 1 to 2 meters,
thus increasing indoor location accuracy significantly. Here are two recommended devices
supporting Wi-Fi RTT: <a href="https://store.google.com/product/google_wifi">Google Wifi</a>
and <a href="https://fit-iot.com/web/products/fitlet2/">Compulab's Filet2 Access Point</a>
(set to 40MHz bandwidth at 5GHz).</p>

<p>The access points should be powered up, but not required to be connected to any network.
Access points do not need to be next to the testing device; however, they are recommended to be
within a distance of 40 ft from the DUT. One access point is typically sufficient.</p>


<h2 id=desktop_setup>Desktop machine setup</h2>
<aside class="caution"><strong>Caution:</strong> CTS currently supports 64-bit
Linux and Mac OS host machines. CTS will not work on Windows OS.</aside>

<h3 id=adb>ADB and AAPT</h3>
<p>Before running the CTS, make sure you have recent versions of both <a
href="http://developer.android.com/tools/help/adb.html">Android Debug
Bridge (adb)</a> and <a
href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html#testing">Android
Asset Packaging Tool (AAPT)</a> installed and those tools' location added
to the system path of your machine.</p>

<p>To install ADB, download the <a
href="http://developer.android.com/sdk/index.html#Other">Android SDK Tools</a>
package for your operating system, open it, and follow the instructions in the
included README file. For troubleshooting information, see <a
href="http://developer.android.com/sdk/installing/index.html?pkg=tools">Installing
the Stand-alone SDK Tools</a>.</p>

<p>Ensure <code>adb</code> and <code>aapt</code> are in your system path. The
following command assumes you've opened the package archive in your home
directory:</p>
<hr>
<pre class="devsite-terminal devsite-click-to-copy">
export PATH=$PATH:$HOME/android-sdk-linux/build-tools/&lt;version&gt;
</pre>

<p class="note"><strong>Note:</strong> Please ensure your starting path and
directory name are correct.</p>

<h3 id=JDK>Java Development Kit (JDK)</h3>
<p>Install the proper version of the Java Development Kit (JDK). For Android 7.0&mdash;
</p>
<ul>
  <li>On Ubuntu, use <a href="http://openjdk.java.net/install/">OpenJDK 8</a>.
  <li>On Mac OS, use <a
  href="http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html#jdk-8u45-oth-JPR">jdk
  8u45 or newer</a>.</li>
</ul>
<p>
For details, see the <a href="/setup/requirements.html#jdk">JDK requirements</a>.
</p>

<h3 id=CTS_files>CTS files</h3>

<p><a href="downloads.html">Download</a> and open the CTS
packages matching your devices' Android version and all the Application Binary
Interfaces (ABIs) your devices support.</p>

<p>Download and open the latest version of the <a
href="downloads.html#cts-media-files">CTS Media
Files</a>.</p>

<h3 id=system_detect>Device detection</h3>
<p>Follow the step to <a
href="http://developer.android.com/tools/device.html#setting-up">set up your
system to detect your device</a>, such as creating a <code>udev</code> rules
file for Ubuntu Linux.</p>

<h2 id=device_setup>Android device setup</h2>

<h3 id=user_builds>User builds</h3>

<p>A compatible device is defined as a device with a user/release-key signed
build, so your device should be running a system image based on the known to be
compatible user build (Android 4.0 and later) from <a
href="/setup/build-numbers.html">Codenames, Tags, and Build
Numbers</a>.<br>

<p class="caution"><strong>Caution:</strong> When used to confirm Android
compatibility of your final system image, CTS must be executed on devices with
a user build.</p>

<h3 id=first-api-level>First API level build property</h3>

<p>Certain CTS requirements depend on the build a device was originally shipped
with. For example, devices that originally ship with earlier builds may be excluded from
system requirements that apply to devices that ship with later builds.</p>

<p>To make this information available to CTS, device manufacturers may define
the build-time property: <code>ro.product.first_api_level</code>. The value of this
property is the first API level the device was commercially launched with.</p>

<p>OEMs can add <code>PRODUCT_PROPERTY_OVERRIDES</code> into their device.mk file to set
this property, as shown in the following example: </p>

<pre class="devsite-click-to-copy">
#ro.product.first_api_level indicates the first api level that the device has
been commercially launched on.
PRODUCT_PROPERTY_OVERRIDES +=\
ro.product.first_api_level=21
</pre>

<h4 id="android-9-higher">First API level for Android 9 and higher</h4>

  <p>
    For devices launched with Android 9 or higher, set the property
    <code>ro.product.first_api_level</code> to a valid value found on
    <a href="/setup/start/build-numbers">Codenames, Tags, and Build Numbers</a>.
  </p>

<h4 id="android-8x-lower">First API level for Android 8.x and lower</h4>

  <p>
    For devices launched on Android 8.x or lower, unset (remove) the property
    <code>ro.product.first_api_level</code> for the first build of the
    product. For all subsequent builds, set
    <code>ro.product.first_api_level</code> to the correct API level value.
    This allows the property to correctly identify a new product and preserves
    information about the first API level of the product. If the flag is
    unset, Android assigns <code>Build.VERSION.SDK_INT</code> to
    <code>ro.product.first_api_level</code>.
  </p>

<h3 id=cts-shim-apps>CTS Shim apps</h3>

<p> Android 7.0 includes the following pre-built apps (built from <a
href="https://android.googlesource.com/platform/frameworks/base/+/master/packages/CtsShim/build/">this
source</a>) which do not contain any code except for the manifest: </p>

<ul>
  <li><code><a href="https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r1/packages/CtsShim/CtsShim.apk">
  frameworks/base/packages/CtsShim/CtsShim.apk</a></code><br>
  This apk file is copied to <code>/system/app/CtsShimPrebuilt.apk</code>
  on the system image.
  <li><code><a href="https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r1/packages/CtsShim/CtsShimPriv.apk">
  frameworks/base/packages/CtsShim/CtsShimPriv.apk</a></code><br>
  This apk file is copied to <code>/system/priv-app/CtsShimPrivPrebuilt.apk</code>
  on the system image.</li>
</ul>

<p> CTS uses these apps to test privileges and permissions. To pass the tests, you must
preload the apps into the appropriate directories on the system image without
re-signing them.</p>

    <h3 id="sample-applet">Sample Applet</h3>
    <p>
      Android 9 introduced Open Mobile APIs. For devices that plan to report
      more than one secure element, CTS adds test cases to validate the
      behavior of the Open Mobile APIs. These test cases require the one-time
      installation of a sample applet into the embedded Secure Element (eSE)
      of the Device Under Test (DUT) or into the SIM card used by the DUT. The
      <a
        href="https://android.googlesource.com/platform/cts/+/master/tests/tests/secure_element/sample_applet/Google-eSE-test.cap" class="external">eSE
      sample applet</a> and the <a
        href="https://android.googlesource.com/platform/cts/+/master/tests/tests/secure_element/sample_applet/uicc/google-cardlet.cap" class="external">SIM
      sample applet</a> can be found in the AOSP repository.
    </p>

    <p>
      See <a href="/compatibility/cts/secure-element">CTS Test for Secure Element</a> for more
      detailed information on Open Mobile API Test cases and Access Control Test cases.</p>

<h3 id="storage_requirements">Storage requirements</h3>
<p>The CTS media stress tests require video clips to be on external storage
(<code>/sdcard</code>). Most of the clips are from <a
href="https://peach.blender.org/">Big Buck Bunny</a> which is copyrighted by
the Blender Foundation under the <a
href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 license.</a></p>
<p>The required space depends on the maximum video playback resolution supported
  by the device (See section 5 in the compatibility definition document for the
  platform version of the required resolutions.) Note that the video playback
  capabilities of the device under test will be checked via the <code>android.media.CamcorderProfile</code> APIs for earlier versions of Android and the <code>android.media.MediaCodecInfo.CodecCapabilities</code> APIs from Android 5.0.</p>
<p>Here are the storage requirements by maximum video playback resolution:</p>
<ul>
  <li>480x360: 98MB
  <li>720x480: 193MB
  <li>1280x720: 606MB
  <li>1920x1080: 1863MB
</ul>

<h3 id=screen_storage>Screen and storage</h3>
<ol>
<li>Any device that does not have an embedded screen needs to be connected to a screen.</li>
<li>If the device has a memory card slot, plug in an empty SD card. <em>Use an
SD card that supports Ultra High Speed (UHS) Bus with SDHC or SDXC capacity or
one with at least speed class 10 or higher to ensure it can pass the CTS.</em>
<p class="warning"><strong>Warning:</strong> CTS may modify/erase data on the SD card plugged into the device.</p>
</li>
<li>If the device has SIM card slots, plug in an activated SIM card to each slot. If the device
  supports SMS, each SIM card should have its own number field populated.</li>
</ol>

<h3 id=developer_uicc>Developer UICC</h3>

<p>In order to run CTS carrier API tests, the device needs to have a SIM card
with carrier privilege rules on it. See <a
href="/devices/tech/config/uicc.html#prepare_uicc">Preparing
the UICC</a>.</p>

<h2 id=config_device>Android device configuration</h2>
<ol>
  <li>Factory data reset the device: <strong>Settings > Backup &amp; reset > Factory data reset</strong>
    <p class="warning"><strong>Warning:</strong> This will erase all user data from the device.</p>
  <li>Set your device's language to English (<strong>United States</strong>) from: <strong>Settings > Language
    & input > Language</strong>
  <li>Turn on the location setting if there is a GPS or Wi-Fi / Cellular network
    feature on the device: <strong>Settings &gt; Location &gt; On</strong>
  <li>Connect to a Wi-Fi network that supports IPv6, can treat the Device
Under Test (DUT) as an <em>isolated client</em> (see the <a
href="#physical_environment">Physical Environment</a> section above), and has an
internet connection: <strong>Settings > Wi-Fi</strong>
  <li>Make sure no lock pattern or password is set on the device: <strong>Settings &gt; Security &gt; Screen
    lock &gt; None</strong>
  <li>Enable <strong>USB debugging</strong> on your device: <strong>Settings &gt; Developer options &gt; USB debugging</strong>.
       <p class="note"><strong>Note:</strong> On Android 4.2 and later, <strong>Developer
        options</strong> is hidden by default. To make them available, go
        to <strong>Settings &gt; About phone</strong> and tap <strong>Build number</strong>
        seven times. Return to the previous screen to find <strong>Developer
        options</strong>. See <a
        href="http://developer.android.com/studio/run/device.html#developer-device-options">Enabling
        On-device Developer Options</a> for additional details.</p>
       <li>Make sure the time is set to 12-hour format: <strong>Settings > Date & time > Use 24-hour format > Off</strong>
  <li>Select: <strong>Settings &gt; Developer options &gt; Stay Awake &gt; On</strong>
  <li>Select: <strong>Settings > Developer options > Allow mock locations &gt; On</strong>
    <p class="note"><strong>Note:</strong> This mock locations setting is applicable only in Android 5.x and 4.4.x.</p>
  <li>Select: <strong>Settings > Developer options > Verify apps over USB > Off</strong>
    <p class="note"><strong>Note:</strong> This verify apps step became required in Android 4.2.</p>
  <li>Launch the browser and dismiss any startup/setup screen.
  <li>Connect the desktop machine that will be used to test the device with a USB cable
    <p class="note"><strong>Note:</strong> When you connect a device running Android 4.2.2 or later
    to your computer, the system shows a dialog asking whether to accept an RSA key that allows
    debugging through this computer. Select <em>Allow USB debugging</em>.</p>
  <li> Install and configure helper apps on the device.
<p class="note"><strong>Note:</strong> For CTS versions 2.1 R2 through 4.2 R4</em>, set up your device (or emulator)
to run the accessibility tests with:<br>
<code>adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk</code><br>
On the device, enable: <strong>Settings > Accessibility > Accessibility >
Delegating Accessibility Service</strong></p>
<p class="note"><strong>Note:</strong> For CTS versions prior to 7.0, on devices that declare
<code>android.software.device_admin</code>, set up your device to run
the device administration test using:<br>
<code>adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk</code><br>
<p>
In Settings > Security > Select device administrators, enable the two
<code>android.deviceadmin.cts.CtsDeviceAdminReceiver*</code> device
administrators. Ensure the
<code>android.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver</code> and any
other preloaded device administrators remain disabled.
</p>
<li>Copy the CTS media files to the device as follows:
<p class="note"><strong>Note:</strong> For CTS 2.3 R12 and later, if the
device supports video codecs, the CTS media files must be copied to the
device.</p>
<ul>
  <li>Navigate (cd) to the path the media files are downloaded and unzipped to.
  <li>Change the file permissions: <code>chmod u+x copy_media.sh</code>
  <li>Run <code>copy_media.sh</code>:
    <ul>
      <li>To copy clips up to a resolution of 720x480, run: <code>./copy_media.sh 720x480</code>
      <li>If you are not sure about the maximum resolution, try <code>./copy_media.sh all</code> so that all files are copied.
      <li>If there are multiple devices under adb, add the -s (serial) option to the end.
        For example, to copy up to 720x480 to the device with serial 1234567, run: <code>./copy_media.sh 720x480 -s 1234567</code>
    </ul>
</ul>
</ol>

  </body>
</html>