| <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>在运行 CTS 验证程序之前,请确保您具有以下设备:</p> |
| <ul> |
| <li>一台已验证其 Android API 兼容性(成功地通过了 CTS 测试)的 Android 设备。该设备将作为被测设备 (DUT)。</li> |
| <li>一台具有 USB 2.0 兼容端口的 Linux 计算机。与 DUT 之间的所有连接都将通过此端口。</li> |
| <li>另一台具有已知可兼容蓝牙、Wi-Fi 直连和 NFC 主机卡模拟 (HCE) 功能的 Android 设备。</li> |
| <li>一台配置了接入点名称和密码的 Wi-Fi 路由器。该路由器应该能够断开与互联网的连接,但未关机。</li> |
| </ul> |
| |
| <h2 id="setup">设置</h2> |
| <p>要设置 CTS 验证程序测试环境,请执行以下操作:</p> |
| <ol> |
| <li>在 Linux 计算机上:<ul> |
| <li>安装 <a href="http://developer.android.com/sdk/index.html">Android SDK</a>。</li> |
| <li>下载与被测 Android 版本对应的 <a href="/compatibility/cts/downloads.html">CTS 验证程序 APK</a>。</li> |
| </ul> |
| </li> |
| <li>将 DUT 连接到 Linux 计算机。 |
| </li><li>通过 Linux 计算机上的终端,在 DUT 上安装 <code>CtsVerifier.apk</code>。 |
| <pre class="devsite-terminal devsite-click-to-copy"> |
| adb install -r -g CtsVerifier.apk |
| </pre> |
| </li> |
| <li>确保 DUT 的系统数据和时间均已正确设置。</li> |
| </ol> |
| |
| <h2 id="cts_test_procedure">运行</h2> |
| <p>点按 DUT 上的 CTS 图标,启动 CTS 验证程序应用:</p> |
| <img src="/compatibility/cts/images/cts-verifier-icon.png" alt="启动器中的 CTS 验证程序图标" id="figure1"/> |
| <figcaption><strong>图 1.</strong> CTS 验证程序图标</figcaption> |
| |
| <p>该应用会显示适用于手动验证的多个测试集:</p> |
| <img src="/compatibility/cts/images/cts-verifier-menu.png" alt="CTS 验证程序测试菜单" id="figure2"/> |
| <figcaption><strong>图 2.</strong> CTS 验证程序测试菜单。</figcaption> |
| |
| <p>每项测试均包含一组共同元素(信息、通过、失败):</p> |
| <img src="/compatibility/cts/images/video-verifier.png" alt="流式视频品质验证程序" id="figure3"/> |
| <figcaption><strong>图 3.</strong> 测试元素。</figcaption> |
| |
| <ul> |
| <li><strong>信息</strong> (?)。点按即可显示测试说明。首次打开测试时,系统也会自动显示此按钮。</li> |
| <li><strong>通过</strong> (✓)。如果 DUT 符合“信息”中规定的测试要求,请点按此按钮。</li> |
| <li><strong>失败</strong> (!)。如果 DUT 不符合“信息”中规定的测试要求,请点按此按钮。</li> |
| </ul> |
| |
| <aside class="note"><strong>注意</strong>:在某些测试中,系统会自动确认测试结果为通过/失败。</aside> |
| |
| <p>一些测试(例如 USB 配件模式和相机校准测试)需要额外的测试设置和说明(详见以下各部分)。</p> |
| |
| <h3 id="usb_accessory">测试 USB 配件模式</h3> |
| <p>为了运行 USB 配件测试,您需要一台 Linux 计算机来运行 USB 台式机(主机)程序。</p> |
| <ol> |
| <li>将 DUT 连接到 Linux 计算机。</li> |
| <li>在计算机上执行 <code>cts-usb-accessory</code> 程序(存放在 CTS 验证程序包中):<pre class="devsite-terminal devsite-click-to-copy">./cts-usb-accessory</pre> |
| </li> |
| <li>等待 DUT 上显示弹出消息,然后选择<strong>确定</strong>。<br /> |
| <img src="/compatibility/cts/images/screen-lock-test.png" alt="CTS 验证程序 USB 配件测试" id="figure4"/> |
| <figcaption><strong>图 4.</strong> USB 配件测试。</figcaption> |
| </li> |
| <li>转到 CTS 验证程序应用中的 USB 配件测试。</li> |
| <li>在计算机上,查看控制台的输出。输出示例: |
| <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> |
| </li> |
| </ol> |
| |
| <h3 id="camera_field_of_view_calibration">校准相机视野</h3> |
| <p>使用视野校准程序以适中的精确度快速确定设备的视野。</p> |
| |
| <ol> |
| <li>设置测试环境: |
| <ol> |
| <li>在尺寸为 11” x 17”或 A3 的纸张上打印 <a href="/compatibility/calibration-pattern.pdf">calibration-pattern.pdf</a> 目标文件。</li> |
| <li>将打印出来的图案贴在一个硬材质底板上。</li> |
| <li>将相机设备和打印出来的图纸按如下位置和方向摆放:<br /> |
| <img src="/compatibility/cts/images/camera-printed-target.png" alt="相机与打印目标" id="figure5"/> |
| <figcaption><strong>图 5.</strong> 相机与打印目标</figcaption> |
| </li> |
| </ol> |
| </li> |
| <li>设置目标宽度: |
| <ol> |
| <li>测量目标图案上两条实线之间的距离(以厘米为单位),以考虑打印误差(约 38 厘米)。</li> |
| <li>启动校准应用。</li> |
| <li>按设置按钮,然后选择“Marker distance”<em></em>。</li> |
| <li>测量并输入到目标图案的距离(大约 100 厘米)。</li> |
| <li>按后退按钮返回到校准预览。</li> |
| </ol> |
| </li> |
| <li>检查设备和目标是否均放在图中所示的位置,以及是否在设置对话框中输入了正确的距离。在预览中,图片上会叠加显示一条垂直线;该垂直线应与目标图案的中心线对齐。透明网格可与其他垂直线配合使用,以确保光轴与目标正交。</li> |
| <li>运行校准测试: |
| <ol> |
| <li>选择图片分辨率(使用左下角的选择器),然后点按屏幕拍摄照片。测试会进入校准模式,并且照片将显示叠加在图片上的两条垂直线。</li> |
| <li>确定准确度: |
| <ul> |
| <li>如果这两条线与目标图案上的垂直线是对齐的(误差控制在几个像素内),则针对选定分辨率报告的视野是准确的。 |
| </li> |
| <li>如果没有对齐,则意味着所报告的视野不准确。要进行更正,请调整屏幕底部的滑块,直到叠加显示的垂直线尽可能与目标图案对齐。当叠加显示的垂直线和目标图案图片对齐时,所显示的视野将近似于正确的值。报告的视野与校准值的误差应在 +/- 1 度范围内。</li> |
| </ul> |
| </li> |
| <li>按后退按钮,对 DUT 所支持的所有图片分辨率执行上述校准测试操作。</li> |
| </ol> |
| </li> |
| </ol> |
| |
| <h2 id="exporting_test_reports">导出结果</h2> |
| <p>完成所有测试后,您可以将结果另存为报告并下载到计算机上。报告名称会自动加上时间戳(基于 DUT 系统时间)。</p> |
| |
| <ol> |
| <li>点按<strong>保存(磁盘)</strong>图标。<br /> |
| <img src="/compatibility/cts/images/verifier-save-icon.png" alt="CTS 验证程序保存图标" id="figure6"/> |
| <figcaption><strong>图 6.</strong> CTS 验证程序保存图标。</figcaption> |
| <aside class="note"><strong>注意</strong>:Android 7.0 及更高版本不包含预览功能。</aside> |
| </li> |
| <li>等待弹出消息显示报告保存的路径(例如 <code>/sdcard/verifierReports/ctsVerifierReport-date-time.zip</code>),然后记录该路径。<br /> |
| <img src="images/path-saved-report.png" alt="CTS 验证程序报告保存的路径" id="figure7"/> |
| <figcaption><strong>图 7.</strong> CTS 验证程序报告保存的路径。</figcaption> |
| </li> |
| <li>将 DUT 连接到 Linux 计算机。</li> |
| <li>通过在 Linux 计算机上安装的 Android SDK,使用 <code>adb pull CTSVerifierReportPath</code> 在已连接的设备中下载报告。 |
| <ul> |
| <li>对于 Android 7.x 及更高版本,请使用以下命令下载所有报告:<pre class="devsite-terminal devsite-click-to-copy"> |
| adb pull /sdcard/verifierReports |
| </pre> |
| </li> |
| <li>对于 Android 6.0 及更早版本,请使用以下命令下载所有报告:<pre class="devsite-terminal devsite-click-to-copy"> |
| adb pull /mnt/sdcard/ctsVerifierReports/ |
| </pre> |
| </li> |
| </ul> |
| </li> |
| <li><em></em>要清除通过/失败结果,请在 CTS 验证程序应用中选择这些结果,然后依次选择“菜单”>“清除”。</li> |
| </ol> |
| |
| </body></html> |