1. 程式人生 > >Android4.4 CTS測試Fail項修改總結(三)

Android4.4 CTS測試Fail項修改總結(三)

----------------------------------------------------------------------

add 2015.05.19

Android5.1上的CTS測試

1、android.net.http.cts.ApacheHttpClientTest#testExecute_withMobile  fail

testExecute_withMobile這個函式的測試需要連線Wifi和插入Sim卡開啟資料連線進行測試

cts-tf > run cts --class android.net.cts.ConnectivityManagerTest
05-19 15:36:11 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device QKRCWCVCKNJNGAIJ
05-19 15:36:11 I/QKRCWCVCKNJNGAIJ: Created result dir 2015.05.19_15.36.11
05-19 15:36:11 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
05-19 15:36:29 I/QKRCWCVCKNJNGAIJ: Collecting device info
05-19 15:36:32 I/CtsTest: Start test run of 2 packages, containing 22 tests
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: Test package arm64-v8a android.net started
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkSupported PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkTypeValid PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testRequestRouteToHost PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testSetNetworkPreference PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature_enableHipri PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testTest PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testAndroidTestCaseSetupProperly PASS 
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: arm64-v8a android.net package complete: Passed 11, Failed 0, Not Executed 0
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: Test package armeabi-v7a android.net started
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkSupported PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkTypeValid PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testRequestRouteToHost PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testSetNetworkPreference PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature_enableHipri PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testTest PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testAndroidTestCaseSetupProperly PASS 
05-19 15:37:00 I/QKRCWCVCKNJNGAIJ: Saved log device_logcat_7504433802013984617.zip
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: Saved log host_log_363833763968039640.zip
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: armeabi-v7a android.net package complete: Passed 11, Failed 0, Not Executed 0
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: XML test result file generated at 2015.05.19_15.36.11. Passed 22, Failed 0, Not Executed 0
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: Time: 52s


----------------------------------------------------------------------

add 2015.04.22

Android5.0上的CTS測試

1、android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL

測試結果

cts-tf > run cts -c android.security.cts.KernelSettingsTest -m testSELinuxEnforcing
04-22 17:20:24 I/TestInvocation: Starting invocation for 'cts' on build '5.0_r2' on device U4VWQSYDEIBAOBNR
04-22 17:20:24 I/U4VWQSYDEIBAOBNR: Created result dir 2015.04.22_17.20.24
04-22 17:20:24 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
04-22 17:20:31 I/U4VWQSYDEIBAOBNR: Collecting device info
04-22 17:20:33 I/CtsTest: Start test run of 2 packages, containing 2 tests
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: Test package arm64-v8a android.security started
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:42 I/U4VWQSYDEIBAOBNR: android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL 
junit.framework.ComparisonFailure: expected:<[1]> but was:<[0]>
at junit.framework.Assert.assertEquals(Assert.java:85)
at junit.framework.Assert.assertEquals(Assert.java:91)
at android.security.cts.KernelSettingsTest.testSELinuxEnforcing(KernelSettingsTest.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at junit.framework.TestResult.runProtected(TestResult.java:133)
at android.support.test.internal.runner.junit3.DelegatingTestResult.runProtected(DelegatingTestResult.java:90)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:52)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103)
at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:52)
at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:245)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1851)

04-22 17:20:45 I/U4VWQSYDEIBAOBNR: arm64-v8a android.security package complete: Passed 0, Failed 1, Not Executed 0
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: Test package armeabi-v7a android.security started
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:54 I/U4VWQSYDEIBAOBNR: android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL 
junit.framework.ComparisonFailure: expected:<[1]> but was:<[0]>
at junit.framework.Assert.assertEquals(Assert.java:85)
at junit.framework.Assert.assertEquals(Assert.java:91)
at android.security.cts.KernelSettingsTest.testSELinuxEnforcing(KernelSettingsTest.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at junit.framework.TestResult.runProtected(TestResult.java:133)
at android.support.test.internal.runner.junit3.DelegatingTestResult.runProtected(DelegatingTestResult.java:90)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:52)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103)
at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:52)
at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:245)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1851)

04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Saved log device_logcat_13978149336460647.zip
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Saved log host_log_1021717706747469289.zip
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: armeabi-v7a android.security package complete: Passed 0, Failed 1, Not Executed 0
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: XML test result file generated at 2015.04.22_17.20.24. Passed 0, Failed 2, Not Executed 0
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Time: 31s
原因:為了方便user版本除錯,開啟了MTK_BUILD_ROOT這個巨集,導致編出來的user版本,adb shell具有root許可權,同時,selinux的狀態變成permissive。

解決辦法:去掉MTK_BUILD_ROOT這個巨集

關於如何設定確認selinux 模式

[Description]
linux SELinux 分成Enforce 以及 Permissive 兩種模式,如何進行設定與確認當前SELinux模式?

[Keyword]
android, SELinux, Enforce, Permissive

[Solution]
在Android KK 4.4 版本後,Google 有正式有限制的啟用SELinux, 來增強android 的安全保護。
在ENG 版本中, 可以使用setenforce 命令進行設定:
adb shell setenforce 0 //設定成permissive 模式
adb shell setenforce 1 //設定成enforce 模式

在ENG/USER 版本中,都可以使用getenforce 命令進行查詢,如:

[email protected]_phone_720pv2:/ # getenforce
getenforce
Enforcing

如果想開機一啟動就設定模式,你可以用下面方式:
KK 版本:更新mediatek/custom/{platform}/lk/rules_platform.mk
L 版本: 更新bootable/bootloader/lk/platform/mt6xxx/rules.mk
# choose one of following value -> 1: disabled/ 2: permissive /3: enforcing
SELINUX_STATUS := 3
可直接調整這個SELINUX_STATUS這個的值為2或者1

注意的是, 在L 版本上, Google 要求強制性開啟enforcing mode, 前面的設定只針對userdebug, eng 版本有效, 如果要對user 版本有效, 需要修改system/core/init/Android.mk 新增
ifeq ($(strip $(TARGET_BUILD_VARIANT)),user)
LOCAL_CFLAGS += -DALLOW_DISABLE_SELINUX=1
endif


需要注意的是, Google 要求強制性開啟SELinux Enforcing Mode, 如果您關閉,將無法通過Google CTS. 

2、android.security.cts.KernelSettingsTest -- testSetuidDumpable Fail

[DESCRIPTION]
android.security.cts.KernelSettingsTest -- testSetuidDumpable Fail

[SOLUTION]
在eng build下testSetuidDumpable 會fail,
原因是AEE require this feature to do full memory dump (coredump) of NE processes。
請使用user build驗證,在user build下即可pass.

----------------------------------------------------------------------

以下測試是在Android4.4上

6、android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir fail

cts-tf > run cts --class android.provider.cts.ContactsContractIntentsTest
03-27 15:51:52 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-27 15:51:52 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.27_15.51.52
03-27 15:52:06 I/KZWOLBGURWWO4PNZ: Collecting device info
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: Test package android.provider started
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir FAIL 
junit.framework.AssertionFailedError: No ResolveInfo found for Intent { act=android.intent.action.GET_CONTENT dat=content://com.android.contacts/contacts }
at android.provider.cts.ContactsContractIntentsTest.assertCanBeHandled(ContactsContractIntentsTest.java:35)
at android.provider.cts.ContactsContractIntentsTest.testGetContentContactDir(ContactsContractIntentsTest.java:54)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testPickContactDir PASS 
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testViewContactDir PASS 
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testAndroidTestCaseSetupProperly PASS 
03-27 15:52:13 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_2628239777255878754.zip
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: Saved log host_log_1858793513168321780.zip
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 3, Failed 1, Not Executed 0
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.27_15.51.52. Passed 3, Failed 1, Not Executed 0
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: Time: 0s
由以上資訊可以看到需要Intent:act=android.intent.action.GET_CONTENT dat=content://com.android.contacts/contacts

檢視:frameworks/base/packages/DocumentsUI/AndroidManifest.xml檔案

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.documentsui">

    <uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
    <uses-permission android:name="android.permission.REMOVE_TASKS" />

    <application
        android:name=".DocumentsApplication"
        android:label="@string/app_label"
        android:supportsRtl="true">

        <!-- TODO: allow rotation when state saving is in better shape -->
        <activity
            android:name=".DocumentsActivity"
            android:theme="@style/Theme"
            android:icon="@drawable/ic_doc_text">
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.OPEN_DOCUMENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.CREATE_DOCUMENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
	    <!--
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
	    -->
            <intent-filter>
                <action android:name="android.provider.action.MANAGE_ROOT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.document/root" />
            </intent-filter>
        </activity>

        <activity
            android:name=".SettingsActivity"
            android:label="@string/menu_settings"
            android:theme="@android:style/Theme.Holo.Light.DialogWhenLarge"
            android:exported="false" />

        <provider
            android:name=".RecentsProvider"
            android:authorities="com.android.documentsui.recents"
            android:exported="false" />

        <receiver android:name=".PackageReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
                <action android:name="android.intent.action.PACKAGE_DATA_CLEARED" />
                <data android:scheme="package" />
            </intent-filter>
        </receiver>

        <!-- TODO: remove when we have real clients -->
        <activity android:name=".TestActivity" android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
相應的Intent已經被註釋了:action android:name="android.intent.action.GET_CONTENT"

去掉註釋

<intent-filter android:priority="100">
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>

編譯後重新測試
cts-tf > run cts --class android.provider.cts.ContactsContractIntentsTest
03-27 16:03:21 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-27 16:03:21 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.27_16.03.21
03-27 16:03:35 I/KZWOLBGURWWO4PNZ: Collecting device info
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: Test package android.provider started
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testPickContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testViewContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testAndroidTestCaseSetupProperly PASS 
03-27 16:03:44 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_574386922107803325.zip
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: Saved log host_log_9046918507764649358.zip
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 4, Failed 0, Not Executed 0
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.27_16.03.21. Passed 4, Failed 0, Not Executed 0
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: Time: 0s

7、android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes FAIL

cts-tf > run cts --class android.view.inputmethod.cts.InputMethodInfoTest
03-30 11:43:32 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-30 11:43:32 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.30_11.43.32
03-30 11:43:44 I/KZWOLBGURWWO4PNZ: Collecting device info
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: Test package android.view started
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testDump PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testEquals PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoProperties PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoWriteToParcel PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeProperties PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeWriteToParcel PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes FAIL 
junit.framework.AssertionFailedError
at android.view.inputmethod.cts.InputMethodInfoTest.testInputMethodSubtypesOfSystemImes(InputMethodInfoTest.java:210)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadIcon PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadLabel PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testAndroidTestCaseSetupProperly PASS 
03-30 11:43:52 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_8618331853760797617.zip
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: Saved log host_log_2921070573061312096.zip
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: android.view package complete: Passed 9, Failed 1, Not Executed 0
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.30_11.43.32. Passed 9, Failed 1, Not Executed 0
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: Time: 0s
由於InputMethodInfoTest是測試輸入法的,首先檢查下手機是否有預設安裝三方的輸入法,我的系統確實安裝了“訊飛輸入法”,解除安裝後可以Pass
cts-tf > run cts --class android.view.inputmethod.cts.InputMethodInfoTest
03-30 12:51:59 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-30 12:51:59 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.30_12.51.59
03-30 12:52:11 I/KZWOLBGURWWO4PNZ: Collecting device info
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: Test package android.view started
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testDump PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testEquals PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoProperties PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoWriteToParcel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeProperties PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeWriteToParcel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadIcon PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadLabel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testAndroidTestCaseSetupProperly PASS 
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_6078470193595290540.zip
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Saved log host_log_7433027168260089475.zip
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: android.view package complete: Passed 10, Failed 0, Not Executed 0
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.30_12.51.59. Passed 10, Failed 0, Not Executed 0
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Time: 0s

有一個小的問題

如果這個三方輸入法安裝到/system/app/目錄下,即使不把三方輸入法選為預設輸入法,該項測試也是Fail

如果是安裝到/data/app/目錄下,即使把三方輸入法選為預設輸入法,該項測試Pass

由於系統預置了訊飛輸入導致此問題Fail,在CTS中會檢查輸入法的subtypeCount > 0,有以下幾種解決辦法
1、去掉預置的訊飛輸入法或預置的訊飛輸入法不要安裝到/system/app/上,安裝到/data/app/
2、讓三方訊飛輸入法修改宣告自己支援的subtype

8、android.provider.cts.Contacts_PeopleTest#testAccessPhotoData FAIL

cts-tf > run cts -c android.provider.cts.Contacts_PeopleTest -m testAccessPhotoData 
04-25 11:42:53 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
04-25 11:42:53 I/KZWOLBGURWWO4PNZ: Created result dir 2015.04.25_11.42.53
04-25 11:43:05 I/KZWOLBGURWWO4PNZ: Collecting device info
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: Test package android.provider started
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-25 11:43:11 I/KZWOLBGURWWO4PNZ: android.provider.cts.Contacts_PeopleTest#testAccessPhotoData FAIL 
junit.framework.AssertionFailedError: expected:<96> but was:<150>
at android.provider.cts.Contacts_PeopleTest.testAccessPhotoData(Contacts_PeopleTest.java:265)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

04-25 11:43:15 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_6005936897661563832.zip
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: Saved log host_log_1931063194281753243.zip
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 0, Failed 1, Not Executed 0
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.04.25_11.42.53. Passed 0, Failed 1, Not Executed 0
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: Time: 0s
從上面打印出來的log可以看出值被修改了

找到providers/ContactsProvider/src/com/android/providers/contacts/PhotoProcessor.java檔案,這個類的關鍵程式碼如下:

 /**
 75      * The default sizes of a thumbnail/display picture. This is used in {@link #initialize()}
 76      */
 77     private interface PhotoSizes {
 78         /** Size of a thumbnail */
 79         public static final int DEFAULT_THUMBNAIL = 96;
 80 
 81         /**
 82          * Size of a display photo on memory constrained devices (those are devices with less than
 83          * {@link #DEFAULT_LARGE_RAM_THRESHOLD} of reported RAM
 84          */
 85         public static final int DEFAULT_DISPLAY_PHOTO_MEMORY_CONSTRAINED = 480;
 86 
 87         /**
 88          * Size of a display photo on devices with enough ram (those are devices with at least
 89          * {@link #DEFAULT_LARGE_RAM_THRESHOLD} of reported RAM
 90          */
 91         public static final int DEFAULT_DISPLAY_PHOTO_LARGE_MEMORY = 720;
 92 
 93         /**
 94          * If the device has less than this amount of RAM, it is considered RAM constrained for
 95          * photos
 96          */
 97         public static final int LARGE_RAM_THRESHOLD = 640 * 1024 * 1024;
 98 
 99         /** If present, overrides the size given in {@link #DEFAULT_THUMBNAIL} */
100         public static final String SYS_PROPERTY_THUMBNAIL_SIZE = "contacts.thumbnail_size";
101 
102         /** If present, overrides the size determined for the display photo */
103         public static final String SYS_PROPERTY_DISPLAY_PHOTO_SIZE = "contacts.display_photo_size";
104     }
static {
 61         final boolean isExpensiveDevice =
 62                 MemoryUtils.getTotalMemorySize() >= PhotoSizes.LARGE_RAM_THRESHOLD;
 63 
 64         sMaxThumbnailDim = SystemProperties.getInt(
 65                 PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE, PhotoSizes.DEFAULT_THUMBNAIL);
 66 
 67         sMaxDisplayPhotoDim = SystemProperties.getInt(
 68                 PhotoSizes.SYS_PROPERTY_DISPLAY_PHOTO_SIZE,
 69                 isExpensiveDevice
 70                         ? PhotoSizes.DEFAULT_DISPLAY_PHOTO_LARGE_MEMORY
 71                         : PhotoSizes.DEFAULT_DISPLAY_PHOTO_MEMORY_CONSTRAINED);
 72     }
縮圖的大小會從以下得到
sMaxThumbnailDim = SystemProperties.getInt(
                  PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE, PhotoSizes.DEFAULT_THUMBNAIL);
如果這個值PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE不存在,就會使用:public static final int DEFAULT_THUMBNAIL = 96,但從log看得到的值為150,說明那個屬性存在並且就是150,可以用以下方法驗證猜測

[email protected]:~$ adb shell getprop | grep size
[contacts.thumbnail_size]: [150]
可以手動修改這個值

adb shell setprop contacts.thumbnail_size 96

再驗證:

cts-tf > run cts -c android.provider.cts.Contacts_PeopleTest -m testAccessPhotoData
04-27 17:49:11 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
04-27 17:49:11 I/KZWOLBGURWWO4PNZ: Created result dir 2015.04.27_17.49.11
04-27 17:49:25 I/KZWOLBGURWWO4PNZ: Collecting device info
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: Test package android.provider started
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-27 17:49:31 I/KZWOLBGURWWO4PNZ: android.provider.cts.Contacts_PeopleTest#testAccessPhotoData PASS 
04-27 17:49:34 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_2708477654268554547.zip
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Saved log host_log_9065571898609841358.zip
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 1, Failed 0, Not Executed 0
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Created xml report file at file:///home/dzt/dzt/cts/4.4/android-cts/tools/./../../android-cts/repository/results/2015.04.27_17.49.11/testResult.xml
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.04.27_17.49.11. Passed 1, Failed 0, Not Executed 0
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Time: 0s
當然並不能用adb shell setprop contacts.thumbnail_size 96修改,需要找到定義的地方,一般是一些工程配置檔案上,如.mk檔案

相關推薦

Android4.4 CTS測試Fail修改總結

---------------------------------------------------------------------- add 2015.05.19 Android5.1上的CTS測試 1、android.net.http.cts.ApacheHt

Android4.4 CTS測試Fail修改總結

1、測試android.webkit.cts.GeolocationTest Fail 提示: cts-tf > run cts --class android.webkit.cts.GeolocationTest 12-13 16:55:23 I/TestInvo

Adroid 4.2 CTS測試 fail彙總

Adroid 4.2  CTS測試  fail項彙總             Compatibility Test Package: android.accessibilityservice             Test    Result    Details    

Android4.0設置界面改動總結

idg 手機 中新 pop istview _id 實例 cycle 系統應用 今年1月份的時候。有和大家分享給予Android4.0+系統設置的改動:Android4.0設置界面改動總結 時隔半年。回頭看看那個時候的改動。事實上是有非常多問題的,比方說

權限總結 shiro 授權

oge als 註解 沒有 概述 當前 http ade ava 概述 Authorization(授權):不難理解,授權就是用來控制當前訪問用戶在訪問系統資源權限。 這個詞也做證書的解釋,從證書這個角度來講,推斷是否擁有對資源訪問的權限時。當前用戶

SSF總結

變更 可能 檢測 說服力 結果 項目 總結 實時監控 毫無 作為項目經理,在把握需求變更上需要有高度的敏感,作為一個檢測器,實時監控,項目過程中與客戶方溝通的任何細小的變更,都應該記錄在案,同時 抄送給客戶方,註意這裏抄送給客戶方一定要做,目前項目上吃虧的地方有: 1,有的

基於大數據的電影網站目開發之階段性總結

字符 crc -c ... chown root per edi 第一個字符 一、基礎講解 1. 主機ping不同虛擬機   虛擬機要設置IP地址,ip段是vmware 編輯菜單-->虛擬網絡編輯器 網段, 網關:192.168.XXX.2

HTTP介面自動化經驗總結Okhttp3 介面測試框架搭建之資料處理

上篇文章寫了怎麼新建POST,GET方法。這篇文章介紹下該如何校驗。 因為我們在方法裡面都返回了String型別結果,String型別校驗起來比較麻煩。多數http介面返回的都是json形式。我們可以寫一個通用方法將String型別轉換為Map物件這樣校驗就比較方便準確了。廢話不多說直接上方法。

web測試方法總結

十二、介面和易用性測試 1、風格、樣式、顏色是否協調 2、介面佈局是否整齊、協調(保證全部顯示出來的,儘量不要使用滾動條 3、介面操作、標題描述是否恰當(描述有歧義、注意是否有錯別字) 4、操作是否符合人們的常規習慣(有沒有把相似的功能的控制元件放在一起,方便操作) 5、提

Android4.4.2原始碼分析之WiFi模組

已經寫了幾篇關於Android原始碼的,原始碼程式碼量太大,所以如果想分析某個模組可能不知如何下手,說一下思路 1,分析原始碼英文閱讀能力要夠,想要分析某個模組一般找模組對應的英文,就是模組 2,找到之後首先檢視清單配置檔案Androidmani.fest,找到程式主介面activity 3,通過檢視配置檔

測試開發工程師面試總結——Java基礎篇

本文面向物件:測試開發工程師(服務端自動化方向)。 隨手百度一下都能找到**崗位面試總結,但是有關測開崗位的面試總結卻寥寥無幾。總體原因可能是這兩個:1 測試行業整體水平參差不齊,導致不同公司面試的問題不能抽象出來寫概覽。2 很多做測開的人可能內心對

VS專案屬性的一些配置總結important

以下內容為“原創”+“轉載” 首先,解決方案和專案資料夾包含關係(c++專案): VS解決方案和各個專案資料夾以及解決方案和各個專案對應的配置檔案包含關係,假設新建一個專案ssyy,解決方案起名fangan,注意解決方案包括專案,此時生成的最外層目錄為fangan代表

python3.5+selenium3.4自動化測試7_selenium的Webdriver_API整理

7.設定等待時間 #匯入time包 import time #新增智慧等待 driver.implicitly_wait(30) #新增固定休眠時間 time.sleep(5)

Android4.4.2原始碼分析之WiFi模組

接著上一篇繼續對WiFi原始碼的分析 onResume方法中 6>,首先是呼叫WiFiEnabler的resume方法對switch進行管理 接下來註冊廣播 getActivity().registerReceiver(mReceiver, mFilter);

測試開發工程師面試總結——演算法篇

演算法也屬於常見面試內容之一,但基本不會超過《劍指offer》的範圍,在此附上一篇簡書上整理的內容: 第二版java解法 常見的面試題包括以下幾類:字串操作,檔案輸入輸出流及統計,矩陣操作,單例模式等。 1.針對字串的操作:如字串反轉、

遠程協助開發總結

線程終止 判斷 call 主動 exce div 一個 解釋 tex 這裏主要總結一下這段時間對Socket編程的總結 1.如何正確的接收數據和如何正確的關閉連接 接收數據要配合正確的關閉連接來使用,關閉連接的時候要先Shutdown本地套接字,這樣遠程套接字就會Recei

css基礎知識的復習總結

網頁 元素 ati 塊元素 isp 方式 一半 浮動 .cn 1.定位的盒子居中顯示 案例一:(定位的盒子居中顯示) 預期效果 實現步驟: 設置父盒子為相對定位 設置子盒子left值為父盒子寬度一半設置子盒子左邊距為自己寬度一半 總結:margin:0 auto 只能讓在

Vue2+VueRouter2+webpack 構建目實戰:配置路由,運行頁面

margin not found sans product mage -a nod targe fig 制作.vue模板文件 通過前面的兩篇博文的學習,我們已經建立好了一個項目。問題是,我們還沒有開始制作頁面。下面,我們要來做頁面了。 我們還是利用 http://cno

I/O流操做總結

div nta 利用 buffer 實現 als 覆蓋 字符 not 說實話,其實我並不是很喜歡Java這門語言,盡管它很強大,有很多現成的API可以調用 但我總感覺它把簡單的事情弄得太過復雜,甚至有時候會讓人迷失 弄不清到底是為了寫出東西,還是為了語言本身 我學習的第一門

[轉載] java多線程總結

java多線程 home gif 結果 訪問 關系 .com mon 問題 轉載自: http://www.cnblogs.com/lwbqqyumidi/p/3821389.html 作者:Windstep 本文主要接著前面多線程的兩篇文章總結Java多線程中的線程安全問