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

来源:互联网 发布:淘宝信用卡哪个好 编辑:程序博客网 时间:2024/05/01 07:09

修改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,1,-1,true"</item>        <item>"mobile,0,0,0,-1,true"</item>        <item>"mobile_mms,2,0,2,60000,true"</item>        <item>"mobile_supl,3,0,2,60000,true"</item>        <item>"mobile_hipri,5,0,3,60000,true"</item>        <item>"mobile_fota,10,0,2,60000,true"</item>        <item>"mobile_ims,11,0,2,60000,true"</item>        <item>"mobile_cbs,12,0,2,60000,true"</item>        <item>"wifi_p2p,13,1,0,-1,true"</item>        <item>"mobile_ia,14,0,2,-1,true"</item><item>"mobile,1000,0,0,-1,true"</item>        <item>"mobile_mms,1002,0,2,60000,true"</item>        <item>"mobile_supl,1003,0,2,60000,true"</item>        <item>"mobile_hipri,1005,0,3,60000,true"</item>        <item>"mobile_fota,1010,0,2,60000,true"</item>        <item>"mobile_ims,1011,0,2,60000,true"</item>        <item>"mobile_cbs,1012,0,2,60000,true"</item>        <item>"wifi_p2p,1013,1,0,-1,true"</item>        <item>"mobile_ia,1014,0,2,-1,true"</item>......自定义的网络类型等...    </string-array>


CTS测试报错:

9-24 14:26:25 I/7731G110248210367: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo FAILjunit.framework.AssertionFailedError: Unexpected foundCount of 0 for type 16at 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.txtindex 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.xmlindex 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> 



0 0
原创粉丝点击