diff options
| author | 2017-09-28 18:00:46 -0700 | |
|---|---|---|
| committer | 2017-09-29 15:34:50 -0700 | |
| commit | d01f6eec20a19c36ec1af380770e4aedfd6723e1 (patch) | |
| tree | 86df40105f4dbad19a912414d9031bfdff783309 | |
| parent | 8078996f4a8b1718a2ca56ff52fd1f4d522e7720 (diff) | |
Decouple Content Name Locale from Content Language Locale
There was an assumption that content language Locale was
a 1:1 mapping with content locale name, which is not the
case. This change separates the two and provides a new
API for retreiving the set of Locales for content name.
Test: Manual
Change-Id: I44cb527ceb77fe321500f9d5fc00f6880ee52cb7
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/mbms/ServiceInfo.java | 20 |
4 files changed, 16 insertions, 7 deletions
diff --git a/api/current.txt b/api/current.txt index 63c65f7afdf3..b91affd02aaf 100644 --- a/api/current.txt +++ b/api/current.txt @@ -40523,6 +40523,7 @@ package android.telephony.mbms { public class ServiceInfo { method public java.util.List<java.util.Locale> getLocales(); method public java.lang.CharSequence getNameForLocale(java.util.Locale); + method public java.util.Set<java.util.Locale> getNamedContentLocales(); method public java.lang.String getServiceClassName(); method public java.lang.String getServiceId(); method public java.util.Date getSessionEndTime(); diff --git a/api/system-current.txt b/api/system-current.txt index 955fd6472ef8..72c2b3827fa2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -44049,6 +44049,7 @@ package android.telephony.mbms { public class ServiceInfo { method public java.util.List<java.util.Locale> getLocales(); method public java.lang.CharSequence getNameForLocale(java.util.Locale); + method public java.util.Set<java.util.Locale> getNamedContentLocales(); method public java.lang.String getServiceClassName(); method public java.lang.String getServiceId(); method public java.util.Date getSessionEndTime(); diff --git a/api/test-current.txt b/api/test-current.txt index 03c9bdb6b2ee..6b3371fa64d3 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -40745,6 +40745,7 @@ package android.telephony.mbms { public class ServiceInfo { method public java.util.List<java.util.Locale> getLocales(); method public java.lang.CharSequence getNameForLocale(java.util.Locale); + method public java.util.Set<java.util.Locale> getNamedContentLocales(); method public java.lang.String getServiceClassName(); method public java.lang.String getServiceId(); method public java.util.Date getSessionEndTime(); diff --git a/telephony/java/android/telephony/mbms/ServiceInfo.java b/telephony/java/android/telephony/mbms/ServiceInfo.java index 9a01ed00e0cd..8529f525e06f 100644 --- a/telephony/java/android/telephony/mbms/ServiceInfo.java +++ b/telephony/java/android/telephony/mbms/ServiceInfo.java @@ -23,6 +23,7 @@ import android.os.Parcelable; import android.text.TextUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -62,12 +63,6 @@ public class ServiceInfo { throw new RuntimeException("bad locales length " + newLocales.size()); } - for (Locale l : newLocales) { - if (!newNames.containsKey(l)) { - throw new IllegalArgumentException("A name must be provided for each locale"); - } - } - names = new HashMap(newNames.size()); names.putAll(newNames); className = newClassName; @@ -127,7 +122,7 @@ public class ServiceInfo { * Get the user-displayable name for this cell-broadcast service corresponding to the * provided {@link Locale}. * @param locale The {@link Locale} in which you want the name of the service. This must be a - * value from the list returned by {@link #getLocales()} -- an + * value from the set returned by {@link #getNamedContentLocales()} -- an * {@link java.util.NoSuchElementException} may be thrown otherwise. * @return The {@link CharSequence} providing the name of the service in the given * {@link Locale} @@ -140,6 +135,17 @@ public class ServiceInfo { } /** + * Return an unmodifiable set of the current {@link Locale}s that have a user-displayable name + * associated with them. The user-displayable name associated with any {@link Locale} in this + * set can be retrieved with {@link #getNameForLocale(Locale)}. + * @return An unmodifiable set of {@link Locale} objects corresponding to a user-displayable + * content name in that locale. + */ + public @NonNull Set<Locale> getNamedContentLocales() { + return Collections.unmodifiableSet(names.keySet()); + } + + /** * The class name for this service - used to categorize and filter */ public String getServiceClassName() { |