Merge "Removed permission check" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-02-25 18:51:58 +00:00
committed by Android (Google) Code Review
5 changed files with 11 additions and 33 deletions

View File

@@ -48146,6 +48146,7 @@ package android.telephony {
method public String getMmsUserAgent(); method public String getMmsUserAgent();
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getNai(); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getNai();
method public String getNetworkCountryIso(); method public String getNetworkCountryIso();
method @NonNull public String getNetworkCountryIso(int);
method public String getNetworkOperator(); method public String getNetworkOperator();
method public String getNetworkOperatorName(); method public String getNetworkOperatorName();
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode();

View File

@@ -11738,7 +11738,6 @@ package android.telephony {
method public int getMaxNumberOfSimultaneouslyActiveSims(); method public int getMaxNumberOfSimultaneouslyActiveSims();
method public static long getMaxNumberVerificationTimeoutMillis(); method public static long getMaxNumberVerificationTimeoutMillis();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup(); method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
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();

View File

@@ -3769,7 +3769,6 @@ package android.telephony {
method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context); method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
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 @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 public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting); method public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();

View File

@@ -2788,39 +2788,22 @@ public class TelephonyManager {
/** /**
* Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current
* registered operator or the cell nearby, if available. * registered operator or the cell nearby, if available.
* <p> *
* The ISO-3166 country code is provided in lowercase 2 character format.
* <p>
* Note: In multi-sim, this returns a shared emergency network country iso from other
* subscription if the subscription used to create the TelephonyManager doesn't camp on
* a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding
* slot.
* Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
* if on a CDMA network). * if on a CDMA network).
* <p> * <p>
* @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() {
try { return getNetworkCountryIso(getSlotIndex());
ITelephony telephony = getITelephony();
if (telephony == null) return "";
return telephony.getNetworkCountryIsoForPhone(getPhoneId(),
null /* no permission check */, null);
} catch (RemoteException ex) {
return "";
}
} }
/** /**
* Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current
* registered operator or the cell nearby, if available. * registered operator or the cell nearby, if available. This is same as
* <p> * {@link #getNetworkCountryIso()} but allowing specifying the SIM slot index. This is used for
* The ISO-3166 country code is provided in lowercase 2 character format. * accessing network country info from the SIM slot that does not have SIM inserted.
* <p> *
* Note: In multi-sim, this returns a shared emergency network country iso from other
* subscription if the subscription used to create the TelephonyManager doesn't camp on
* a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding
* slot.
* Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
* if on a CDMA network). * if on a CDMA network).
* <p> * <p>
@@ -2831,22 +2814,18 @@ public class TelephonyManager {
* *
* @throws IllegalArgumentException when the slotIndex is invalid. * @throws IllegalArgumentException when the slotIndex is invalid.
* *
* {@hide}
*/ */
@SystemApi
@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 (slotIndex != SubscriptionManager.DEFAULT_SIM_SLOT_INDEX
&& !SubscriptionManager.isValidSlotIndex(slotIndex)) {
throw new IllegalArgumentException("invalid slot index " + slotIndex); throw new IllegalArgumentException("invalid slot index " + slotIndex);
} }
ITelephony telephony = getITelephony(); ITelephony telephony = getITelephony();
if (telephony == null) return ""; if (telephony == null) return "";
return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName(), return telephony.getNetworkCountryIsoForPhone(slotIndex);
getFeatureId());
} catch (RemoteException ex) { } catch (RemoteException ex) {
return ""; return "";
} }

View File

@@ -281,7 +281,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 callingPkg, String callingFeatureId); String getNetworkCountryIsoForPhone(int phoneId);
/** /**
* Returns the neighboring cell information of the device. * Returns the neighboring cell information of the device.