修改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)
修改方案:在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>