summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author chen xu <fionaxu@google.com> 2019-02-21 23:08:47 -0800
committer Chen Xu <fionaxu@google.com> 2019-02-25 18:33:08 +0000
commitf98efc3961bf008232f974544ca646c38962d5e3 (patch)
tree3534130e1b29242e2e7d403cea39e135f6e26bf0
parent1c2c11990ca27b9a470ac8f178dbeace7dadb51f (diff)
getSimLocale should return locale rather than string tag
Bug: 124767220 Test: Build Change-Id: Ib4938652f2e6541b44894ae1a2b0cb2ea4c899be Merged-in: I850108ce0905d16e538e46ccd4bbf92a2bcfba42
-rw-r--r--api/system-current.txt2
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java12
2 files changed, 8 insertions, 6 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index d8859b8d5663..0b77556a5db0 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6358,7 +6358,7 @@ package android.telephony {
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
method public int getSimCardState();
- method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimLocale();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Locale getSimLocale();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getSupportedRadioAccessFamily();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 6704473dfe3e..2c87e62e2b32 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -8640,24 +8640,26 @@ public class TelephonyManager {
/**
- * Returns a well-formed IETF BCP 47 language tag representing the locale from the SIM, e.g,
- * en-US. Returns {@code null} if no locale could be derived from subscriptions.
+ * Returns a locale based on the country and language from the SIM. Returns {@code null} if
+ * no locale could be derived from subscriptions.
*
* <p>Requires Permission:
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
*
* @see Locale#toLanguageTag()
- * @see Locale#forLanguageTag(String)
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- @Nullable public String getSimLocale() {
+ @Nullable public Locale getSimLocale() {
try {
final ITelephony telephony = getITelephony();
if (telephony != null) {
- return telephony.getSimLocaleForSubscriber(getSubId());
+ String languageTag = telephony.getSimLocaleForSubscriber(getSubId());
+ if (!TextUtils.isEmpty(languageTag)) {
+ return Locale.forLanguageTag(languageTag);
+ }
}
} catch (RemoteException ex) {
}