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/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device 385b4e4a
12-13 16:55:23 I/385b4e4a: Created result dir 2014.12.13_16.55.23
12-13 16:55:34 I/385b4e4a: Collecting device info
12-13 16:55:35 I/385b4e4a: -----------------------------------------
12-13 16:55:35 I/385b4e4a: Test package android.webkit started
12-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 setting
at 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)
提示没有相关的权限

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
如果在《开发者选项》中《允许模拟位置》的开关没有打开,即使加上也是会报错,这个开关的默认值是在/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.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);
而ro.allow.mock.location的值是以下配置文件中设置的

文件位于:/build/core.main.mk

## user/userdebug ##

user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
tags_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=0

else # !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_DE
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值