summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@cyngn.com>2016-10-06 18:50:30 (GMT)
committerJessica Wagantall <jwagantall@cyngn.com>2016-10-06 18:50:30 (GMT)
commite9e7aedfb2b136b1576bd89d365704d5f76b8816 (patch)
tree106ed4355db835714d46ce6ae041c7d3ecb68733
parent19adf4868804c246816504493c7d08b224258150 (diff)
parent47c5adba752a951243ee696ce5f1ee3f302a42ab (diff)
downloadandroid_frameworks_opt_net_wifi-e9e7aedfb2b136b1576bd89d365704d5f76b8816.zip
android_frameworks_opt_net_wifi-e9e7aedfb2b136b1576bd89d365704d5f76b8816.tar.gz
android_frameworks_opt_net_wifi-e9e7aedfb2b136b1576bd89d365704d5f76b8816.tar.bz2
Merge tag 'android-6.0.1_r72' into HEAD
Android 6.0.1 Release 72 (M4B30X) # gpg: Signature made Tue 04 Oct 2016 09:47:41 AM PDT using DSA key ID 9AB10E78 # gpg: Can't check signature: public key not found
-rw-r--r--service/java/com/android/server/wifi/anqp/ANQPFactory.java158
-rw-r--r--service/java/com/android/server/wifi/anqp/VenueNameElement.java8
2 files changed, 91 insertions, 75 deletions
diff --git a/service/java/com/android/server/wifi/anqp/ANQPFactory.java b/service/java/com/android/server/wifi/anqp/ANQPFactory.java
index 55f6310..deca9c6 100644
--- a/service/java/com/android/server/wifi/anqp/ANQPFactory.java
+++ b/service/java/com/android/server/wifi/anqp/ANQPFactory.java
@@ -158,83 +158,99 @@ public class ANQPFactory {
public static ANQPElement buildElement(ByteBuffer payload, Constants.ANQPElementType infoID,
int length) throws ProtocolException {
- ByteBuffer elementPayload = payload.duplicate().order(ByteOrder.LITTLE_ENDIAN);
- payload.position(payload.position() + length);
- elementPayload.limit(elementPayload.position() + length);
-
- switch (infoID) {
- case ANQPCapabilityList:
- return new CapabilityListElement(infoID, elementPayload);
- case ANQPVenueName:
- return new VenueNameElement(infoID, elementPayload);
- case ANQPEmergencyNumber:
- return new EmergencyNumberElement(infoID, elementPayload);
- case ANQPNwkAuthType:
- return new NetworkAuthenticationTypeElement(infoID, elementPayload);
- case ANQPRoamingConsortium:
- return new RoamingConsortiumElement(infoID, elementPayload);
- case ANQPIPAddrAvailability:
- return new IPAddressTypeAvailabilityElement(infoID, elementPayload);
- case ANQPNAIRealm:
- return new NAIRealmElement(infoID, elementPayload);
- case ANQP3GPPNetwork:
- return new ThreeGPPNetworkElement(infoID, elementPayload);
- case ANQPGeoLoc:
- return new GEOLocationElement(infoID, elementPayload);
- case ANQPCivicLoc:
- return new CivicLocationElement(infoID, elementPayload);
- case ANQPLocURI:
- return new GenericStringElement(infoID, elementPayload);
- case ANQPDomName:
- return new DomainNameElement(infoID, elementPayload);
- case ANQPEmergencyAlert:
- return new GenericStringElement(infoID, elementPayload);
- case ANQPTDLSCap:
- return new GenericBlobElement(infoID, elementPayload);
- case ANQPEmergencyNAI:
- return new GenericStringElement(infoID, elementPayload);
- case ANQPNeighborReport:
- return new GenericBlobElement(infoID, elementPayload);
- case ANQPVendorSpec:
- if (elementPayload.remaining() > 5) {
- int oi = elementPayload.getInt();
- if (oi != Constants.HS20_PREFIX) {
- return null;
- }
- int subType = elementPayload.get() & Constants.BYTE_MASK;
- Constants.ANQPElementType hs20ID = Constants.mapHS20Element(subType);
- if (hs20ID == null) {
- throw new ProtocolException("Bad HS20 info ID: " + subType);
- }
- elementPayload.get(); // Skip the reserved octet
- return buildHS20Element(hs20ID, elementPayload);
- } else {
+ try {
+ ByteBuffer elementPayload = payload.duplicate().order(ByteOrder.LITTLE_ENDIAN);
+ payload.position(payload.position() + length);
+ elementPayload.limit(elementPayload.position() + length);
+
+ switch (infoID) {
+ case ANQPCapabilityList:
+ return new CapabilityListElement(infoID, elementPayload);
+ case ANQPVenueName:
+ return new VenueNameElement(infoID, elementPayload);
+ case ANQPEmergencyNumber:
+ return new EmergencyNumberElement(infoID, elementPayload);
+ case ANQPNwkAuthType:
+ return new NetworkAuthenticationTypeElement(infoID, elementPayload);
+ case ANQPRoamingConsortium:
+ return new RoamingConsortiumElement(infoID, elementPayload);
+ case ANQPIPAddrAvailability:
+ return new IPAddressTypeAvailabilityElement(infoID, elementPayload);
+ case ANQPNAIRealm:
+ return new NAIRealmElement(infoID, elementPayload);
+ case ANQP3GPPNetwork:
+ return new ThreeGPPNetworkElement(infoID, elementPayload);
+ case ANQPGeoLoc:
+ return new GEOLocationElement(infoID, elementPayload);
+ case ANQPCivicLoc:
+ return new CivicLocationElement(infoID, elementPayload);
+ case ANQPLocURI:
+ return new GenericStringElement(infoID, elementPayload);
+ case ANQPDomName:
+ return new DomainNameElement(infoID, elementPayload);
+ case ANQPEmergencyAlert:
+ return new GenericStringElement(infoID, elementPayload);
+ case ANQPTDLSCap:
return new GenericBlobElement(infoID, elementPayload);
- }
- default:
- throw new ProtocolException("Unknown element ID: " + infoID);
+ case ANQPEmergencyNAI:
+ return new GenericStringElement(infoID, elementPayload);
+ case ANQPNeighborReport:
+ return new GenericBlobElement(infoID, elementPayload);
+ case ANQPVendorSpec:
+ if (elementPayload.remaining() > 5) {
+ int oi = elementPayload.getInt();
+ if (oi != Constants.HS20_PREFIX) {
+ return null;
+ }
+ int subType = elementPayload.get() & Constants.BYTE_MASK;
+ Constants.ANQPElementType hs20ID = Constants.mapHS20Element(subType);
+ if (hs20ID == null) {
+ throw new ProtocolException("Bad HS20 info ID: " + subType);
+ }
+ elementPayload.get(); // Skip the reserved octet
+ return buildHS20Element(hs20ID, elementPayload);
+ } else {
+ return new GenericBlobElement(infoID, elementPayload);
+ }
+ default:
+ throw new ProtocolException("Unknown element ID: " + infoID);
+ }
+ } catch (ProtocolException e) {
+ throw e;
+ } catch (Exception e) {
+ // TODO: remove this catch-all for exceptions, once the element parsing code
+ // has been thoroughly unit tested. b/30562650
+ throw new ProtocolException("Unknown parsing error", e);
}
}
public static ANQPElement buildHS20Element(Constants.ANQPElementType infoID,
ByteBuffer payload) throws ProtocolException {
- switch (infoID) {
- case HSCapabilityList:
- return new HSCapabilityListElement(infoID, payload);
- case HSFriendlyName:
- return new HSFriendlyNameElement(infoID, payload);
- case HSWANMetrics:
- return new HSWanMetricsElement(infoID, payload);
- case HSConnCapability:
- return new HSConnectionCapabilityElement(infoID, payload);
- case HSOperatingclass:
- return new GenericBlobElement(infoID, payload);
- case HSOSUProviders:
- return new HSOsuProvidersElement(infoID, payload);
- case HSIconFile:
- return new HSIconFileElement(infoID, payload);
- default:
- return null;
+ try {
+ switch (infoID) {
+ case HSCapabilityList:
+ return new HSCapabilityListElement(infoID, payload);
+ case HSFriendlyName:
+ return new HSFriendlyNameElement(infoID, payload);
+ case HSWANMetrics:
+ return new HSWanMetricsElement(infoID, payload);
+ case HSConnCapability:
+ return new HSConnectionCapabilityElement(infoID, payload);
+ case HSOperatingclass:
+ return new GenericBlobElement(infoID, payload);
+ case HSOSUProviders:
+ return new HSOsuProvidersElement(infoID, payload);
+ case HSIconFile:
+ return new HSIconFileElement(infoID, payload);
+ default:
+ return null;
+ }
+ } catch (ProtocolException e) {
+ throw e;
+ } catch (Exception e) {
+ // TODO: remove this catch-all for exceptions, once the element parsing code
+ // has been thoroughly unit tested. b/30562650
+ throw new ProtocolException("Unknown parsing error", e);
}
}
}
diff --git a/service/java/com/android/server/wifi/anqp/VenueNameElement.java b/service/java/com/android/server/wifi/anqp/VenueNameElement.java
index f0b27dd..f944c40 100644
--- a/service/java/com/android/server/wifi/anqp/VenueNameElement.java
+++ b/service/java/com/android/server/wifi/anqp/VenueNameElement.java
@@ -29,13 +29,13 @@ public class VenueNameElement extends ANQPElement {
int group = payload.get() & Constants.BYTE_MASK;
int type = payload.get() & Constants.BYTE_MASK;
- if (group >= VenueGroup.values().length) {
+ if (group >= VenueGroup.Reserved.ordinal()) {
mGroup = VenueGroup.Reserved;
mType = VenueType.Reserved;
} else {
mGroup = VenueGroup.values()[group];
type += sGroupBases.get(mGroup);
- if (type >= VenueType.values().length) {
+ if (type >= VenueType.Reserved.ordinal()) {
mType = VenueType.Reserved;
} else {
mType = VenueType.values()[type];
@@ -82,7 +82,7 @@ public class VenueNameElement extends ANQPElement {
UtilityMiscellaneous,
Vehicular,
Outdoor,
- Reserved
+ Reserved // Note: this must be the last enum constant
}
public enum VenueType {
@@ -164,7 +164,7 @@ public class VenueNameElement extends ANQPElement {
BusStop,
Kiosk,
- Reserved
+ Reserved // Note: this must be the last enum constant
}
private static final VenueType[] PerGroup =