From ab83ab09b554e4012af5cf439efe081504a29b88 Mon Sep 17 00:00:00 2001 From: Peter Qiu Date: Mon, 3 Apr 2017 13:14:26 -0700 Subject: hotspot2: fix parsing of IMSI from legacy Passpoint config file The parsing of IMSI form the legacy Passpoint config file is incorrect. The IMSI field is under "Credential/SIM" node instead of "Credential" node. Bug: 36531896 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: manual upgrade device with EAP-SIM Passpoint profile from N to O Change-Id: If6ff9facfb380def84818a4c03c80c0bad4c08a9 --- .../wifi/hotspot2/LegacyPasspointConfigParser.java | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'service') 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; } } -- cgit v1.2.3