AOSP - networkAttributes中CSV的含义

时间:2017-11-24 12:15:25

标签: xml android-source

networkAttributes 的项目包含以逗号分隔的列表:

<string-array translatable="false" name="networkAttributes">  
  <item>"wifi,1,1,1,-1,true"</item>  
  <item>"ethernet,9,9,9,-1,true"</item>
</string-array>

值“wifi,X,Y,......”是什么意思?

1 个答案:

答案 0 :(得分:1)

构造函数接受这些值,位于此处: platform / frameworks / base / core / java / android / net / NetworkConfig.java

看起来像这样:

 /**
 * input string from config.xml resource.  Uses the form:
 * [Connection name],[ConnectivityManager connection type],
 * [associated radio-type],[priority],[dependencyMet]
 */
public NetworkConfig(String init) {
    String fragments[] = init.split(",");
    name = fragments[0].trim().toLowerCase(Locale.ROOT);
    type = Integer.parseInt(fragments[1]);
    radio = Integer.parseInt(fragments[2]);
    priority = Integer.parseInt(fragments[3]);
    restoreTime = Integer.parseInt(fragments[4]);
    dependencyMet = Boolean.parseBoolean(fragments[5]);
}

它在几个地方使用,例如: 方法private void initApnContexts() platform / frameworks / opt / telephony / src / java / com / android / internal / telephony / dataconnection / DcTracker.java >

问候!