use of com.android.anqp.I18Name in project android_frameworks_base by DirtyUnicorns.
the class SPVerifier method checkName.
private void checkName(Asn1Constructed altName) throws IOException {
Map<String, I18Name> friendlyNames = new HashMap<>();
for (Asn1Object name : altName.getChildren()) {
if (name.getAsn1Class() == Asn1Class.Context && name.getTag() == OtherName) {
Asn1Constructed otherName = (Asn1Constructed) name;
Iterator<Asn1Object> children = otherName.getChildren().iterator();
if (children.hasNext()) {
Asn1Object oidObject = children.next();
if (OidMappings.sIdWfaHotspotFriendlyName.equals(oidObject) && children.hasNext()) {
Asn1Constructed value = castObject(children.next(), Asn1Constructed.class);
String text = castObject(value.getChildren().iterator().next(), Asn1String.class).getString();
I18Name friendlyName = new I18Name(text);
friendlyNames.put(friendlyName.getLanguage(), friendlyName);
}
}
}
}
Log.d(OSUManager.TAG, "Friendly names: " + friendlyNames.values());
for (I18Name osuName : mOSUInfo.getOSUProvider().getNames()) {
I18Name friendlyName = friendlyNames.get(osuName.getLanguage());
if (!osuName.equals(friendlyName)) {
throw new IOException("Friendly name '" + osuName + " not in certificate");
}
}
}
use of com.android.anqp.I18Name in project android_frameworks_base by AOSPA.
the class OSUInfo method getServiceDescription.
public String getServiceDescription(Locale locale) {
List<ScoreEntry<String>> scoreList = new ArrayList<>();
for (I18Name service : mOSUProvider.getServiceDescriptions()) {
if (locale == null || service.getLocale().equals(locale)) {
return service.getText();
}
scoreList.add(new ScoreEntry<>(service.getText(), languageScore(service.getLanguage(), locale)));
}
Collections.sort(scoreList);
return scoreList.isEmpty() ? null : scoreList.iterator().next().getData();
}
use of com.android.anqp.I18Name in project android_frameworks_base by AOSPA.
the class OSUInfo method getName.
public String getName(Locale locale) {
List<ScoreEntry<String>> scoreList = new ArrayList<>();
for (I18Name name : mOSUProvider.getNames()) {
if (locale == null || name.getLocale().equals(locale)) {
return name.getText();
}
scoreList.add(new ScoreEntry<String>(name.getText(), languageScore(name.getLanguage(), locale)));
}
Collections.sort(scoreList);
return scoreList.isEmpty() ? null : scoreList.iterator().next().getData();
}
use of com.android.anqp.I18Name in project platform_frameworks_base by android.
the class OSUInfo method getName.
public String getName(Locale locale) {
List<ScoreEntry<String>> scoreList = new ArrayList<>();
for (I18Name name : mOSUProvider.getNames()) {
if (locale == null || name.getLocale().equals(locale)) {
return name.getText();
}
scoreList.add(new ScoreEntry<String>(name.getText(), languageScore(name.getLanguage(), locale)));
}
Collections.sort(scoreList);
return scoreList.isEmpty() ? null : scoreList.iterator().next().getData();
}
use of com.android.anqp.I18Name in project platform_frameworks_base by android.
the class OSUInfo method getServiceDescription.
public String getServiceDescription(Locale locale) {
List<ScoreEntry<String>> scoreList = new ArrayList<>();
for (I18Name service : mOSUProvider.getServiceDescriptions()) {
if (locale == null || service.getLocale().equals(locale)) {
return service.getText();
}
scoreList.add(new ScoreEntry<>(service.getText(), languageScore(service.getLanguage(), locale)));
}
Collections.sort(scoreList);
return scoreList.isEmpty() ? null : scoreList.iterator().next().getData();
}
Aggregations