blob: 4d532fd3ad7db728fd44ef716da2d9a25d9030c6 [file] [log] [blame]
<html devsite><head>
<title>使用 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.
-->
<p>Android 兼容性测试套件验证程序(CTS 验证程序)是对兼容性测试套件 (CTS) 的补充。CTS 可以对具备测试自动化功能的 API 和功能进行测试,而 CTS 验证程序则可以针对一些必须依赖于手动操作才能在固定设备上进行测试的 API 和功能(例如音频质量、触摸屏、加速度计、相机等)提供测试。</p>
<h2 id="test_preparation">测试前的准备</h2>
<p>设备必须成功地通过“兼容性测试套件”测试,才能验证其 Android API 兼容性。</p>
<h3 id="hardware_requirements">硬件要求</h3>
<ul>
<li>一台具有 USB 2.0 兼容端口的 Linux 计算机</li><li>具有已知可兼容蓝牙、WLAN 直连和 NFC 主机卡模拟 (HCE) 功能的第二台 Android 设备</li></ul>
<h3 id="setup">设置</h3>
<ul>
<li>在 Linux 计算机上安装 <a href="http://developer.android.com/sdk/index.html">Android SDK</a></li><li>下载与被测 Android 版本对应的 <a href="downloads.html">CTS Verifier.apk</a></li><li>将 CTS Verifier.apk 安装到被测设备 (DUT)。<em></em>
<pre class="devsite-terminal devsite-click-to-copy">adb install -r -g CtsVerifier.apk</pre>
</li><li>确保设备的系统数据和时间均已正确设置。
</li></ul>
<h2 id="cts_test_procedure">CTS 验证程序测试程序</h2>
<ol>
<li>在安装 CTS Verifier.apk 之后,启动 CTS 验证程序应用:<img src="/compatibility/cts/images/cts-verifier-icon.png" alt="启动器中的 CTS 验证程序图标" id="figure1"/>
<p class="img-caption">
<strong>图 1.</strong> CTS 验证程序图标</p>
</li><li>打开后,CTS 验证程序会显示适用于手动验证的所有测试集的列表:<img src="/compatibility/cts/images/cts-verifier-menu.png" alt="CTS 验证程序测试菜单" id="figure2"/>
<p class="img-caption">
<strong>图 2.</strong> CTS 验证程序测试菜单</p>
</li><li>每项测试均包含一组常用元素(在某些测试中,系统会自动确认测试结果为通过/失败):<ul>
<li><em></em>信息 - 用于运行测试的一组说明。首次打开每个测试或每当按<strong>信息</strong>按钮 (?) 时,此信息都会以弹出窗口的形式显示。
</li><li><em></em>通过 - 如果 DUT 符合“信息”中的说明规定的测试要求,请按<strong>通过</strong>按钮 (✓)。
</li><li><em></em>失败 - 如果 DUT 不符合“信息”中的说明规定的测试要求,请按<strong>失败</strong>按钮 (!)。
</li></ul>
<img src="/compatibility/cts/images/video-verifier.png" alt="流式视频品质验证程序" id="figure3"/>
<p class="img-caption">
<strong>图 3.</strong> 视频品质验证程序</p>
</li></ol>
<h2 id="specific_test_requirements">具体测试要求</h2>
<h3 id="usb_accessory">USB 配件</h3>
<p>为了运行 USB 配件测试,您需要一台 Linux 计算机来运行 USB 台式机(主机)程序。</p>
<ol>
<li>将 DUT 连接到计算机。
</li><li>在计算机上执行 cts-usb-accessory 程序(存放在 CTS 验证程序包中)。
<pre class="devsite-terminal devsite-click-to-copy">./cts-usb-accessory</pre>
</li><li>DUT 上将显示一条弹出消息。选择 <strong>OK</strong> 进入 CTS 验证程序应用中的 USB 配件测试。
<br />
<img src="/compatibility/cts/images/screen-lock-test.png" alt="CTS 验证程序屏幕锁定测试" id="figure4"/>
<p class="img-caption">
<strong>图 4.</strong> 屏幕锁定测试</p>
</li><li>在计算机的控制台上,您将看到类似以下内容的输出内容。
</li></ol>
<pre class="devsite-click-to-copy">
CTS USB Accessory Tester
Found possible Android device (413c:2106) - attempting to switch to accessory
mode...
Failed to read protocol version
Found Android device in accessory mode (18d1:2d01)...
[RECV] Message from Android device #0
[SENT] Message from Android accessory #0
[RECV] Message from Android device #1
[SENT] Message from Android accessory #1
[RECV] Message from Android device #2
[SENT] Message from Android accessory #2
[RECV] Message from Android device #3
[SENT] Message from Android accessory #3
[RECV] Message from Android device #4
[SENT] Message from Android accessory #4
[RECV] Message from Android device #5
[SENT] Message from Android accessory #5
[RECV] Message from Android device #6
[SENT] Message from Android accessory #6
[RECV] Message from Android device #7
[SENT] Message from Android accessory #7
[RECV] Message from Android device #8
[SENT] Message from Android accessory #8
[RECV] Message from Android device #9
[SENT] Message from Android accessory #9
[RECV] Message from Android device #10
[SENT] Message from Android accessory #10
</pre>
<h3 id="camera_field_of_view_calibration">相机视野校准</h3>
<p>这种视野校准程序主要用于快速确定具备适中精确度的设备视野。
</p><p><strong>设置</strong> - 打印 <a href="/compatibility/calibration-pattern.pdf">calibration-pattern.pdf</a> 目标文件,并将它贴在一个硬材质底板上。打印尺寸为 11“x 17” 或 A3。将相机设备和打印出来的图纸按如下位置和方向摆放:</p>
<img src="/compatibility/cts/images/camera-printed-target.png" alt="相机打印目标" id="figure5"/>
<p class="img-caption">
<strong>图 5.</strong> 相机打印目标</p>
<p><strong>设置目标宽度</strong> - 测量目标图案上两条实线之间的距离(以厘米为单位),以考虑打印误差(约 38 厘米)。</p>
<ol>
<li>启动校准应用。
</li><li>按设置按钮,然后选择“Marker distance”输入距离。
</li><li>测量并输入到目标图案的距离(大约 100 厘米)。
</li><li>按后退按钮返回到校准预览。
</li></ol>
<p><strong>校准过程</strong> - 检查设备和目标是否均放在图中所示的位置,以及是否在设置对话框中输入了正确的距离。在预览中,图片上会叠加显示一条垂直线。该垂直线应与目标图案的中心线对齐。透明网格可与其他垂直线配合使用,以确保光轴与目标正交。</p>
<ol>
<li>从左下角的选择器中选择要测试的图片分辨率。</li><li>点按屏幕以拍摄照片并进入校准模式(如下所述)。
</li><li>按后退按钮,并为所有支持的图片分辨率重复上述操作。
</li></ol>
<p><strong>校准测试(按分辨率)</strong>在校准模式下,照片将显示叠加在图片上的两条垂直线。这两条线应与目标图案上的垂直线对齐(误差控制在几个像素内)。如果没有对齐,则针对该模式报告的视野将不准确(假设设置正确)。调整屏幕底部的滑块,直到叠加层尽可能紧密地与目标图案对齐。当叠加层和目标图案图片对齐时,所显示的视野将近似于正确的值。报告的视野应在校准值的 +/- 1 度范围内。</p>
<h2 id="exporting_test_reports">导出测试报告</h2>
<ol>
<li>完成所有测试后,点按<strong>保存(磁盘)</strong>图标。
<br />
<img src="/compatibility/cts/images/verifier-save-icon.png" alt="CTS 验证程序保存图标" id="figure6"/>
<p class="img-caption">
<strong>图 6.</strong> CTS 验证程序保存图标。<em></em>注意:Android 7.0 及更高版本中已移除预览功能:<img src="/compatibility/cts/images/verifier-preview-icon.png" width="24" height="24"/>
</p>
</li>
<li>
已保存报告的路径将显示在弹出窗口中(例如 <code>/sdcard/verifierReports/ctsVerifierReport-date-time.zip</code>)。记录该路径。
<br />
<img src="images/path-saved-report.png" alt="CTS 验证程序保存报告的路径" id="figure7"/>
<p class="img-caption">
<strong>图 7.</strong> CTS 验证程序保存报告的路径</p>
</li>
<li>
通过 USB 将设备连接到安装了 SDK 的计算机。
</li>
<li>
从计算机的 SDK 安装中,运行 <code>adb pull CTSVerifierReportPath</code> 以从设备中下载报告。
<ul>
<li>
要下载所有报告,请运行:
<pre class="devsite-terminal devsite-click-to-copy">adb pull /sdcard/verifierReports</pre>
对于 Android 6.0 及更早版本,请运行:
<pre class="devsite-terminal devsite-click-to-copy">adb pull /mnt/sdcard/ctsVerifierReports/</pre>
</li>
<li>
报告的名称会加上时间戳(基于 DUT 的系统时间)。
</li>
<li>
要清除选择的结果,请依次选择 <strong>Menu &gt; Clear</strong>。该操作将清除通过/失败结果。
</li>
</ul>
</li>
</ol>
</body></html>