Android CTS keynotes

Android CTS keynotes

  1. Factory data reset the device: Settings > Backup & reset > Factory data reset

    Warning: This will erase all user data from the device.

  2. Set your device’s language to English (United States) from: Settings > Language & input > Language
  3. Turn on the location setting if there is a GPS or Wi-Fi / Cellular network feature on the device: Settings > Location > On
  4. Connect to a Wi-Fi network that supports IPv6, can treat the Device Under Test (DUT) as an isolated client (see the Physical Environment section above), and has an internet connection: Settings > Wi-Fi
  5. Make sure no lock pattern or password is set on the device: Settings > Security > Screen lock > None
  6. Enable USB debugging on your device: Settings > Developer options > USB debugging.

    Note: On Android 4.2 and later, Developer options is hidden by default. To make them available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options. See Enabling On-device Developer Options for additional details.

  7. Select: Settings > Developer options > Stay Awake > On
  8. Select: Settings > Developer options > Allow mock locations > On

    Note: This mock locations setting is applicable only in Android 5.x and 4.4.x.

  9. Select: Settings > Developer options > Verify apps over USB > Off

    Note: This verify apps step became required in Android 4.2.

  10. Launch the browser and dismiss any startup/setup screen.
  11. Connect the desktop machine that will be used to test the device with a USB cable

    Note: 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 Allow USB debugging.

  12. Install and configure helper apps on the device.

    Note: For CTS versions 2.1 R2 through 4.2 R4, set up your device (or emulator) to run the accessibility tests with:
    adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk
    On the device, enable: Settings > Accessibility > Accessibility > Delegating Accessibility Service

    Note: For CTS 2.3 R4 through CTS 6.0 on devices that declare the feature, set up your device to run the device administration tests with:
    adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk
    On the device, enable only the two android.deviceadmin.cts.CtsDeviceAdminReceiver* device administrators under: Settings > Security > Select device administrators. Make sure theandroid.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver and any other preloaded device administrators stay disabled in the same menu.

  13. Copy the CTS media files to the device as follows:

    Note: For CTS 2.3 R12 and beyond, if the device supports video codecs, the CTS media files must be copied to the device.

    • Navigate (cd) to the path the media files are downloaded and unzipped to.
    • Change the file permissions: chmod u+x
    • Run
      • To copy clips up to a resolution of 720×480, run: ./ 720x480
      • If you are not sure about the maximum resolution, try ./ all so that all files are copied.
      • If there are multiple devices under adb, add the -s (serial) option to the end. For example, to copy up to 720×480 to the device with serial 1234567, run: ./ 720x480 -s 1234567
说明 操作
全部开始测试 cts-tf > run cts –plan CTS –disable-reboot
cts-tf > l r
cts-tf > add derivedplan –plan xgf0305 –session 0 -r fail (或者[pass/fail/notExecuted/timeout])
cts-tf > run cts –plan xgf0305 –disable-reboot
l r
run cts –continue-session session_id (session编号)–disable-reboot
这是一个包的测试: run cts –package/-p :
这个是如果我们电脑同进有连接多台手机测试时,我们指定手机的serial id来跑CTS run cts [options] –serial/-s device_ID
l d
l packages
l p:
l r
l/list d/devices:
list connected devices and their state
l/list packages:
list CTS test packages
l/list p/plans:
list CTS test plans
l/list r/results:
list CTS results currently present in the repository
这个命令有用,是直接跳过前期的检查工作,直接强制运行相关的测试。特别是android 6.0后,CTS测试如果不加这个,会进行前期的wifi,网络,视频,location等等的检查。是否忽略检查和下载视频

Whether to skip precondition checks and automation Default: false.
Whether to skip verifying/downloading media files Default: false.
-d, –[no-]skip-device-info
flag to control whether to collect info from device. Providing this flag will speed up test execution for short test runs but will result in required data being omitted from the test report. Default: false.
3.1,signature running:  
java -Xmx2048m -jar out/host/linux-x86/framework/signapk.jar -w build/target/product/security/testkey.x509.pem build/target/product/security/testkey.pk8 /tmp/tmpsOokXv out/target/product/k200/


+# Just for CTS
+    ro.config.max_starting_bg=3


Amlogic Platform 使能KeyguardService,即锁屏模块
xugangfeng@LETV-U0:~/sc/letv/U4/device/letv/U4/overlay$ git diff
diff –git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml
index bda91ec..56d9fd5 100644
— a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml
+++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml
@@ -1,5 +1,5 @@
 <?xml version=”1.0″ encoding=”utf-8″?>
–    <bool name=”config_enableKeyguardService”>false</bool>
–    <string name=”config_statusBarComponent” translatable=”false”></string>
+    <bool name=”config_enableKeyguardService”>true</bool>
+    <string name=”config_statusBarComponent” translatable=”false”></string>

这个是google的CTS code地址,需要翻墙看到。提供了一个方法,克隆得到CTS:
git clone
如果为6.0 r8版本可以看到tag是:android-cts-6.0_r8
想要得到正确的code, 必须执行:
git checkout android-cts-6.0_r8
把步骤1中下载的整个cts目录替换到当前编译环境下,source、lunch后,直接make cts 就可以在out目录下生成cts的整套测试工具了。


(1)参考报告中的Details 一栏信息。 
(2)可以执行 run cts -c className -m methodName 并通过adb logcat 查看测试某个methodName时,参考具体的log信息,重点看log.e的信息,然后去android源码中跟踪相关代码。 
(3)参考运行run cts -c className -m methodName 之后的打印信息,例如下图 

从图中可以发现异常是从AudioTrackTest.Java 中的1959行报出来的,可以进入android的源码中cts目录,执行命令: 
$find -name 
找到AudioTrackTest.java文件,并vim 打开查看1959行代码,了解具体测试方法测的是什么,以及异常是什么。 
(5)常见fail信息如:expected:<96000> but was:<95851> at 






         run cts -c –m testLocationFeatures