Merge "Added read phone state permission for getNetworkCountryIso"
This commit is contained in:
@@ -8884,7 +8884,7 @@ package android.telephony {
|
|||||||
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
|
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
|
||||||
method public int getMaxNumberOfSimultaneouslyActiveSims();
|
method public int getMaxNumberOfSimultaneouslyActiveSims();
|
||||||
method public static long getMaxNumberVerificationTimeoutMillis();
|
method public static long getMaxNumberVerificationTimeoutMillis();
|
||||||
method @NonNull public String getNetworkCountryIso(int);
|
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getNetworkCountryIso(int);
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
|
||||||
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();
|
||||||
|
|||||||
@@ -3041,7 +3041,7 @@ package android.telephony {
|
|||||||
method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
|
method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
|
||||||
method public int getEmergencyNumberDbVersion();
|
method public int getEmergencyNumberDbVersion();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
|
||||||
method @NonNull public String getNetworkCountryIso(int);
|
method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getNetworkCountryIso(int);
|
||||||
method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
|
method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
|
||||||
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
|
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
|
||||||
|
|||||||
@@ -2373,7 +2373,14 @@ public class TelephonyManager {
|
|||||||
* @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
|
* @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
|
||||||
*/
|
*/
|
||||||
public String getNetworkCountryIso() {
|
public String getNetworkCountryIso() {
|
||||||
return getNetworkCountryIso(getPhoneId());
|
try {
|
||||||
|
ITelephony telephony = getITelephony();
|
||||||
|
if (telephony == null) return "";
|
||||||
|
return telephony.getNetworkCountryIsoForPhone(getPhoneId(),
|
||||||
|
null /* no permission check */);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2401,6 +2408,7 @@ public class TelephonyManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@TestApi
|
@TestApi
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public String getNetworkCountryIso(int slotIndex) {
|
public String getNetworkCountryIso(int slotIndex) {
|
||||||
try {
|
try {
|
||||||
if (!SubscriptionManager.isValidSlotIndex(slotIndex)) {
|
if (!SubscriptionManager.isValidSlotIndex(slotIndex)) {
|
||||||
@@ -2409,7 +2417,7 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony == null) return "";
|
if (telephony == null) return "";
|
||||||
return telephony.getNetworkCountryIsoForPhone(slotIndex);
|
return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName());
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ interface ITelephony {
|
|||||||
* operator's MCC (Mobile Country Code).
|
* operator's MCC (Mobile Country Code).
|
||||||
* @see android.telephony.TelephonyManager#getNetworkCountryIso
|
* @see android.telephony.TelephonyManager#getNetworkCountryIso
|
||||||
*/
|
*/
|
||||||
String getNetworkCountryIsoForPhone(int phoneId);
|
String getNetworkCountryIsoForPhone(int phoneId, String callingPkg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the neighboring cell information of the device.
|
* Returns the neighboring cell information of the device.
|
||||||
|
|||||||
Reference in New Issue
Block a user