Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 105f6506 authored by Jack Yu's avatar Jack Yu
Browse files

Added read phone state permission for getNetworkCountryIso

The slot based version of getNetworkCountryIso is a system API.
So it needs to be gaurded by permission.

Bug: 141646066
Test: Telephony sanity tests
Change-Id: I810ff0b77b93870ae3f62769977c7094789d0a5a
parent 6c98b3a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8236,7 +8236,7 @@ package android.telephony {
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
    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(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
    method public int getSimApplicationState();
+1 −1
Original line number Diff line number Diff line
@@ -2914,7 +2914,7 @@ package android.telephony {
    method public int checkCarrierPrivilegesForPackage(String);
    method public int getCarrierIdListVersion();
    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 @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
    method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
+10 −2
Original line number Diff line number Diff line
@@ -2449,7 +2449,14 @@ public class TelephonyManager {
     * @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
     */
    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 "";
        }
    }

    /**
@@ -2475,11 +2482,12 @@ public class TelephonyManager {
    @SystemApi
    @TestApi
    @NonNull
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public String getNetworkCountryIso(int slotIndex) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) return "";
            return telephony.getNetworkCountryIsoForPhone(slotIndex);
            return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName());
        } catch (RemoteException ex) {
            return "";
        }
+1 −1
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ interface ITelephony {
     * operator's MCC (Mobile Country Code).
     * @see android.telephony.TelephonyManager#getNetworkCountryIso
     */
    String getNetworkCountryIsoForPhone(int phoneId);
    String getNetworkCountryIsoForPhone(int phoneId, String callingPkg);

    /**
     * Returns the neighboring cell information of the device.