Merge "new SystemAPI to getSimLocale"
This commit is contained in:
@@ -6294,6 +6294,7 @@ package android.telephony {
|
|||||||
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
|
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 getSimApplicationState();
|
||||||
method public int getSimCardState();
|
method public int getSimCardState();
|
||||||
|
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimLocale();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSupportedRadioAccessFamily();
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSupportedRadioAccessFamily();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
|
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.UiccCardInfo[] getUiccCardsInfo();
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccCardInfo[] getUiccCardsInfo();
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -8440,18 +8441,47 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @hide */
|
/**
|
||||||
public String getLocaleFromDefaultSim() {
|
* 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.
|
||||||
|
*
|
||||||
|
* <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() {
|
||||||
try {
|
try {
|
||||||
final ITelephony telephony = getITelephony();
|
final ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.getLocaleFromDefaultSim();
|
return telephony.getSimLocaleForSubscriber(getSubId());
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO delete after SuW migrates to new API.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public String getLocaleFromDefaultSim() {
|
||||||
|
try {
|
||||||
|
final ITelephony telephony = getITelephony();
|
||||||
|
if (telephony != null) {
|
||||||
|
return telephony.getSimLocaleForSubscriber(getSubId());
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests the modem activity info. The recipient will place the result
|
* Requests the modem activity info. The recipient will place the result
|
||||||
* in `result`.
|
* in `result`.
|
||||||
|
|||||||
@@ -1178,12 +1178,12 @@ interface ITelephony {
|
|||||||
void factoryReset(int subId);
|
void factoryReset(int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An estimate of the users's current locale based on the default SIM.
|
* Returns users's current locale based on the SIM.
|
||||||
*
|
*
|
||||||
* The returned string will be a well formed BCP-47 language tag, or {@code null}
|
* The returned string will be a well formed BCP-47 language tag, or {@code null}
|
||||||
* if no locale could be derived.
|
* if no locale could be derived.
|
||||||
*/
|
*/
|
||||||
String getLocaleFromDefaultSim();
|
String getSimLocaleForSubscriber(int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests the modem activity info asynchronously.
|
* Requests the modem activity info asynchronously.
|
||||||
|
|||||||
Reference in New Issue
Block a user