修改framework中config.xml的networkAttributes网络资源后导致CTS testGetAllNetworkInfo失败

修改framework中config.xml的networkAttributes网络资源后导致CTS testGetAllNetworkInfo失败

例如:

   <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
         Please don't copy them,copy anything else. -->

    <!-- This string array should be overridden by the device to present a list of network
         attributes.  This is used by the connectivity manager to decide which networks can coexist
         based on the hardware -->
    <!-- An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx],[associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet]  -->
    <!-- the 5th element "resore-time" indicates the number of milliseconds to delay
         before automatically restore the default connection.  Set -1 if the connection
         does not require auto-restore. -->
    <!-- the 6th element indicates boot-time dependency-met value. -->
    <string-array translatable="false" name="networkAttributes">
        <item>"wifi,1,-1,true"</item>
        <item>"mobile,true"</item>
        <item>"mobile_mms,2,60000,true"</item>
        <item>"mobile_supl,3,true"</item>
        <item>"mobile_hipri,5,true"</item>
        <item>"mobile_fota,10,true"</item>
        <item>"mobile_ims,11,true"</item>
        <item>"mobile_cbs,12,true"</item>
        <item>"wifi_p2p,13,true"</item>
        <item>"mobile_ia,14,true"</item>
	<item>"mobile,1000,1002,1003,1005,1010,1011,1012,1013,1014,true"</item>
		...
		...自定义的网络类型等
		...
    </string-array>


CTS测试报错:

9-24 14:26:25 I/7731G110248210367: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo FAIL
junit.framework.AssertionFailedError: Unexpected foundCount of 0 for type 16
at android.net.cts.ConnectivityManagerTest.testGetAllNetworkInfo(ConnectivityManagerTest.java:184)
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:1756)



原因:修改了framework资源的config.xml的networkAttributes网络资源后,比如添加新的网络类型后,编译的时候资源ID发生了变化,导致通过ID获取的资源不正确,导致此项CTS case失败。



修改方案:在current.txt和public.xml固定这个ID,不随平台资源修改变化:


 api/current.txt                |    2 ++
 core/res/res/values/public.xml |    6 ++++++
 2 files changed,8 insertions(+),0 deletions(-) 

diff --git a/api/current.txt b/api/current.txt
index b079ed6..100b288 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -219,6 +219,7 @@ package android {
     ctor public R.array();
     field public static final int emailAddresstypes = 17235968; // 0x1070000
     field public static final int imProtocols = 17235969; // 0x1070001
+    field public static final int networkAttributes = 17235979; // 0x107000b
     field public static final int organizationTypes = 17235970; // 0x1070002
     field public static final int phoneTypes = 17235971; // 0x1070003
     field public static final int postalAddresstypes = 17235972; // 0x1070004
@@ -1236,6 +1237,7 @@ package android {
 
   public static final class R.bool {
     ctor public R.bool();
+    field public static final int config_useFixedVolume = 17891414; // 0x1110056  //视current.txt资源对比后而定
   }
 
   public static final class R.color {
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 62c3237..b3561f6 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2087,4 +2087,10 @@
   <public type="style" name="Theme.DeviceDefault.NoActionBar.TranslucentDecor" id="0x010301e3" />
   <public type="style" name="Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor" id="0x010301e4" />
 
+  <!-- CTS tests reference these resources,but fail because we added
+       new ones,changing the order,and Google didn't declare these
+       as public resources. This fixes it for the 4.4_r1 CTS release. -->
+  <public type="bool" name="config_useFixedVolume" id="0x1110056" />  //<span style="font-family: Arial,Helvetica,sans-serif;">视current.txt资源对比后而定</span>

+  <public type="array" name="networkAttributes" id="0x107000b" />
+
 </resources> 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念
xml文件介绍及使用
xml编程(一)-xml语法
XML文件结构和基本语法
第2章 包装类
XML入门的常见问题(二)
Java对象的强、软、弱和虚引用
JS解析XML文件和XML字符串详解
java中枚举的详细使用介绍
了解Xml格式
XML入门的常见问题(四)
深入SQLite多线程的使用总结详解
PlayFramework完整实现一个APP(一)
XML和YAML的使用方法
XML轻松学习总节篇