summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-04-04 20:25:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-04-04 20:25:15 +0000
commit140de55c011751c1add7644425d4bd87fa3e0e68 (patch)
treeeb64d9648dac369cc4543af3b7d995f632becd02 /service
parente87ca83103d68c0b9d0166069ccbfa52da533d88 (diff)
parentab83ab09b554e4012af5cf439efe081504a29b88 (diff)
Merge "hotspot2: fix parsing of IMSI from legacy Passpoint config file" into oc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/hotspot2/LegacyPasspointConfigParser.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/LegacyPasspointConfigParser.java b/service/java/com/android/server/wifi/hotspot2/LegacyPasspointConfigParser.java
index 01607b2bf..31795f126 100644
--- a/service/java/com/android/server/wifi/hotspot2/LegacyPasspointConfigParser.java
+++ b/service/java/com/android/server/wifi/hotspot2/LegacyPasspointConfigParser.java
@@ -85,6 +85,7 @@ public class LegacyPasspointConfigParser {
private static final String TAG_ROAMING_CONSORTIUM_OI = "RoamingConsortiumOI";
private static final String TAG_CREDENTIAL = "Credential";
private static final String TAG_REALM = "Realm";
+ private static final String TAG_SIM = "SIM";
private static final String TAG_IMSI = "IMSI";
private static final String LONG_ARRAY_SEPARATOR = ",";
@@ -274,7 +275,7 @@ public class LegacyPasspointConfigParser {
*/
private static LegacyPasspointConfig processPpsNode(Node ppsNode) throws IOException {
if (ppsNode.getChildren() == null || ppsNode.getChildren().size() != 1) {
- throw new IOException("PerProviderSubscription node should contained "
+ throw new IOException("PerProviderSubscription node should contain "
+ "one instance node");
}
@@ -319,7 +320,7 @@ public class LegacyPasspointConfigParser {
private static void processHomeSPNode(Node homeSpNode, LegacyPasspointConfig config)
throws IOException {
if (homeSpNode.getChildren() == null) {
- throw new IOException("HomeSP node should contained at least one child node");
+ throw new IOException("HomeSP node should contain at least one child node");
}
for (Node node : homeSpNode.getChildren()) {
@@ -351,7 +352,7 @@ public class LegacyPasspointConfigParser {
LegacyPasspointConfig config)
throws IOException {
if (credentialNode.getChildren() == null) {
- throw new IOException("Credential node should contained at least one child node");
+ throw new IOException("Credential node should contain at least one child node");
}
for (Node node : credentialNode.getChildren()) {
@@ -359,11 +360,36 @@ public class LegacyPasspointConfigParser {
case TAG_REALM:
config.mRealm = getValue(node);
break;
+ case TAG_SIM:
+ processSimNode(node, config);
+ break;
+ default:
+ Log.d(TAG, "Ignore uninterested field under Credential: " + node.getName());
+ break;
+ }
+ }
+ }
+
+ /**
+ * Process a SIM node to retrieve configuration data into the given |config|.
+ *
+ * @param simNode The SIM node to process
+ * @param config The config object to fill in the data
+ * @throws IOException
+ */
+ private static void processSimNode(Node simNode, LegacyPasspointConfig config)
+ throws IOException {
+ if (simNode.getChildren() == null) {
+ throw new IOException("SIM node should contain at least one child node");
+ }
+
+ for (Node node : simNode.getChildren()) {
+ switch (node.getName()) {
case TAG_IMSI:
config.mImsi = getValue(node);
break;
default:
- Log.d(TAG, "Ignore uninterested field under Credential: " + node.getName());
+ Log.d(TAG, "Ignore uninterested field under SIM: " + node.getName());
break;
}
}