Android4.4 CTS测试Fail项修改总结(三)
接上:Android4.4 CTS测试Fail项修改总结(二)
以下测试是在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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。