Android4.4 CTS test Fail item modification Summary (1), android4.4cts
1. Test android. webkit. cts. GeolocationTest Fail.
Tip:
cts-tf > run cts --class android.webkit.cts.GeolocationTest12-13 16:55:23 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a12-13 16:55:23 I/385b4e4a: Created result dir 2014.12.13_16.55.2312-13 16:55:34 I/385b4e4a: Collecting device info12-13 16:55:35 I/385b4e4a: -----------------------------------------12-13 16:55:35 I/385b4e4a: Test package android.webkit started12-13 16:55:35 I/385b4e4a: -----------------------------------------12-13 16:55:38 I/385b4e4a: android.webkit.cts.GeolocationTest#testGeolocationPermissions FAIL java.lang.SecurityException: Requires ACCESS_MOCK_LOCATION secure settingat android.os.Parcel.readException(Parcel.java:1480)at android.os.Parcel.readException(Parcel.java:1429)at android.location.ILocationManager$Stub$Proxy.addTestProvider(ILocationManager.java:944)at android.location.LocationManager.addTestProvider(LocationManager.java:1205)at android.webkit.cts.GeolocationTest.addTestProviders(GeolocationTest.java:188)at android.webkit.cts.GeolocationTest.setUp(GeolocationTest.java:166)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:1701)
Prompt NO related Permissions
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
If the switch "allow simulated location" in "Developer options" is not enabled, an error is reported even if it is added, the default value of this switch is in/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper. set in java
// Allow mock locations default, based on build loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0);
The ro. allow. mock. location value is set in the following configuration file.
The file is located at:/build/core. main. mk.
## user/userdebug ##user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))enable_target_debugging := truetags_to_install :=ifneq (,$(user_variant)) # Target is secure in user builds. ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 ifeq ($(user_variant),userdebug) # Pick up some extra useful tools tags_to_install += debug # Enable Dalvik lock contention logging for userdebug builds. ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500 else # Disable debugging in plain user builds. enable_target_debugging := endif # Turn on Dalvik preoptimization for libdvm.so user builds, but only if not # explicitly disabled and the build is running on Linux (since host # Dalvik isn't built for non-Linux hosts). ifeq (,$(WITH_DEXPREOPT)) ifeq ($(DALVIK_VM_LIB),libdvm.so) ifeq ($(user_variant),user) ifeq ($(HOST_OS),linux) WITH_DEXPREOPT := true endif endif endif endif # Disallow mock locations by default for user builds ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0else # !user_variant # Turn on checkjni for non-user builds. ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1 # Set device insecure for non-user builds. ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 # Allow mock locations by default for non user builds ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1endif # !user_variant
Of course, there are two ways to modify this CTS Fail:
1. Modify the DatabaseHelper. java File
loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, 1);
2. Modify the main. mk File
# Disallow mock locations by default for user builds ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
You can enable it manually if you need verification.
2. Test android. webkit. cts. GeolocationTest Fail.
cts-tf > run cts --class android.webkit.cts.GeolocationTest12-13 20:00:44 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a12-13 20:00:44 I/385b4e4a: Created result dir 2014.12.13_20.00.4412-13 20:00:54 I/385b4e4a: Collecting device info12-13 20:00:55 I/385b4e4a: -----------------------------------------12-13 20:00:55 I/385b4e4a: Test package android.webkit started12-13 20:00:55 I/385b4e4a: -----------------------------------------12-13 20:00:58 I/385b4e4a: android.webkit.cts.GeolocationTest#testGeolocationPermissions PASS 12-13 20:01:59 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptAlways FAIL junit.framework.AssertionFailedError: JS didn't get positionat android.cts.util.PollingCheck.check(PollingCheck.java:70)at android.webkit.cts.GeolocationTest.testSimpleGeolocationRequestAcceptAlways(GeolocationTest.java:389)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.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)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:1701)12-13 20:03:00 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptOnce FAIL junit.framework.AssertionFailedError: JS didn't get positionat android.cts.util.PollingCheck.check(PollingCheck.java:70)at android.webkit.cts.GeolocationTest.testSimpleGeolocationRequestAcceptOnce(GeolocationTest.java:298)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.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)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:1701)12-13 20:03:01 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestReject PASS 12-13 20:03:07 I/385b4e4a: Saved log device_logcat_2697676003348178928.zip12-13 20:03:09 I/385b4e4a: Saved log host_log_5151173227187455527.zip12-13 20:03:09 I/385b4e4a: android.webkit package complete: Passed 2, Failed 2, Not Executed 012-13 20:03:09 I/385b4e4a: Created xml report file at file:///home/dzt/D/dzt/xxxxxxxxx/xuna/android-cts-4.4_r3-linux_x86-arm/android-cts/tools/./../../android-cts/repository/results/2014.12.13_20.00.44/testResult.xml12-13 20:03:09 I/385b4e4a: XML test result file generated at 2014.12.13_20.00.44. Passed 2, Failed 2, Not Executed 012-13 20:03:09 I/385b4e4a: Time: 0s
Because Settings> Location access is not enabled, You need to select High accuracy in Mode after enabling. If you can select Device only outside, if you have an indoor network, you can choose Battery saving, but High accuracy is the most comprehensive.
You can modify the file/frameworks/base/packages/SettingsProvider/res/values/defaults. xml.
<bool name="def_bluetooth_on">false</bool> <bool name="def_wifi_display_on">false</bool> <bool name="def_install_non_market_apps">false</bool> <bool name="def_package_verifier_enable">true</bool> <!-- Comma-separated list of location providers. Network location is off by default because it requires user opt-in via Setup Wizard or Settings. --> <!-- 20141213 modify start --> <string name="def_location_providers_allowed" translatable="false">network</string> <!-- 20141213 modify end --> <bool name="assisted_gps_enabled">true</bool> <bool name="def_netstats_enabled">true</bool> <bool name="def_usb_mass_storage_enabled">true</bool>
Def_location_providers_allowed can be set to the following values:
<String name = "def_location_providers_allowed" translatable = "false"> network </string>
<String name = "def_location_providers_allowed" translatable = "false"> gps </string>
<String name = "def_location_providers_allowed" translatable = "false"> gps, network </string>
<String name = "def_location_providers_allowed" translatable = "false"> </string>
Retest
cts-tf > run cts --class android.webkit.cts.GeolocationTest12-13 20:37:39 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a12-13 20:37:39 I/385b4e4a: Created result dir 2014.12.13_20.37.3912-13 20:37:52 I/385b4e4a: Collecting device info12-13 20:37:53 I/385b4e4a: -----------------------------------------12-13 20:37:53 I/385b4e4a: Test package android.webkit started12-13 20:37:53 I/385b4e4a: -----------------------------------------12-13 20:37:57 I/385b4e4a: android.webkit.cts.GeolocationTest#testGeolocationPermissions PASS 12-13 20:37:58 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptAlways PASS 12-13 20:37:59 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptOnce PASS 12-13 20:38:00 I/385b4e4a: android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestReject PASS 12-13 20:38:03 I/385b4e4a: Saved log device_logcat_3654799606164162994.zip12-13 20:38:03 I/385b4e4a: Saved log host_log_8685761807888118162.zip12-13 20:38:03 I/385b4e4a: android.webkit package complete: Passed 4, Failed 0, Not Executed 012-13 20:38:03 I/385b4e4a: Created xml report file at file:///home/dzt/D/dzt/xxxxxxxxx/xuna/android-cts-4.4_r3-linux_x86-arm/android-cts/tools/./../../android-cts/repository/results/2014.12.13_20.37.39/testResult.xml12-13 20:38:03 I/385b4e4a: XML test result file generated at 2014.12.13_20.37.39. Passed 4, Failed 0, Not Executed 012-13 20:38:03 I/385b4e4a: Time: 0s
3. Test android. content. pm. cts. ResolveInfo_DisplayNameComparatorTest FAIL.
cts-tf > run cts --class android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest12-13 18:55:28 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a12-13 18:55:28 I/385b4e4a: Created result dir 2014.12.13_18.55.2812-13 18:55:40 I/385b4e4a: Collecting device info12-13 18:55:41 I/385b4e4a: -----------------------------------------12-13 18:55:41 I/385b4e4a: Test package android.content started12-13 18:55:41 I/385b4e4a: -----------------------------------------12-13 18:55:43 I/385b4e4a: android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest#testDisplayNameComparator FAIL junit.framework.AssertionFailedErrorat android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest.testDisplayNameComparator(ResolveInfo_DisplayNameComparatorTest.java:40)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:1701)12-13 18:55:43 I/385b4e4a: android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest#testAndroidTestCaseSetupProperly PASS 12-13 18:55:46 I/385b4e4a: Saved log device_logcat_19588081496169516.zip12-13 18:55:47 I/385b4e4a: Saved log host_log_6056597035559363496.zip12-13 18:55:47 I/385b4e4a: android.content package complete: Passed 1, Failed 1, Not Executed 012-13 18:55:47 I/385b4e4a: Created xml report file at file:///home/android-cts-4.4_r3-linux_x86-arm/android-cts/tools/./../../android-cts/repository/results/2014.12.13_18.55.28/testResult.xml12-13 18:55:47 I/385b4e4a: XML test result file generated at 2014.12.13_18.55.28. Passed 1, Failed 1, Not Executed 012-13 18:55:47 I/385b4e4a: Time: 0s
The test code is located at:./cts/tests/content/src/android/content/pm/cts/ResolveInfo_DisplayNameComparatorTest.java
/* * Copyright (C) 2008 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. */package com.example.cts_8609.pm;import android.content.Intent;import android.content.pm.PackageManager;import android.content.pm.ResolveInfo;import android.content.pm.ResolveInfo.DisplayNameComparator;import android.test.AndroidTestCase;import android.util.Log;public class ResolveInfo_DisplayNameComparatorTest extends AndroidTestCase {private static final String MAIN_ACTION_NAME = "android.intent.action.MAIN";private static final String SERVICE_NAME = "android.content.pm.cts.activity.PMTEST_SERVICE";public void testDisplayNameComparator() {PackageManager pm = getContext().getPackageManager();DisplayNameComparator dnc = new DisplayNameComparator(pm);Intent intent = new Intent(MAIN_ACTION_NAME);ResolveInfo activityInfo = pm.resolveActivity(intent, 0);intent = new Intent(SERVICE_NAME);ResolveInfo serviceInfo = pm.resolveService(intent,PackageManager.GET_RESOLVED_FILTER);assertTrue(dnc.compare(activityInfo, serviceInfo) < 0);assertTrue(dnc.compare(activityInfo, activityInfo) == 0);assertTrue(dnc.compare(serviceInfo, activityInfo) > 0);}}
It is very simple, that is, comparing two intents
The two Intent
Private static final String MAIN_ACTION_NAME = "android. intent. action. MAIN ";
Private static final String SERVICE_NAME = "android. content. pm. cts. activity. PMTEST_SERVICE ";
Registered in./cts/tests/AndroidManifest. xml
<activity android:name="android.content.pm.cts.TestPmCompare"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.INFO" /> </intent-filter> </activity> <!--Test for PackageManager--> <service android:name="android.content.pm.cts.TestPmService"> <intent-filter> <action android:name="android.content.pm.cts.activity.PMTEST_SERVICE" /> </intent-filter> </service>
This item is related to the default language. My machine fails in English and can Pass in Chinese.
cts-tf > run cts --class android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest12-13 19:29:41 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a12-13 19:29:41 I/385b4e4a: Created result dir 2014.12.13_19.29.4112-13 19:29:52 I/385b4e4a: Collecting device info12-13 19:29:53 I/385b4e4a: -----------------------------------------12-13 19:29:53 I/385b4e4a: Test package android.content started12-13 19:29:53 I/385b4e4a: -----------------------------------------12-13 19:29:55 I/385b4e4a: android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest#testDisplayNameComparator PASS 12-13 19:29:55 I/385b4e4a: android.content.pm.cts.ResolveInfo_DisplayNameComparatorTest#testAndroidTestCaseSetupProperly PASS 12-13 19:29:58 I/385b4e4a: Saved log device_logcat_2031267185637801005.zip12-13 19:29:58 I/385b4e4a: Saved log host_log_2145996889870614720.zip12-13 19:29:58 I/385b4e4a: android.content package complete: Passed 2, Failed 0, Not Executed 012-13 19:29:58 I/385b4e4a: Created xml report file at file:///home/android-cts-4.4_r3-linux_x86-arm/android-cts/tools/./../../android-cts/repository/results/2014.12.13_19.29.41/testResult.xml12-13 19:29:58 I/385b4e4a: XML test result file generated at 2014.12.13_19.29.41. Passed 2, Failed 0, Not Executed 012-13 19:29:58 I/385b4e4a: Time: 0s