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

Commit 77793b1d authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Added slot index version of getNetworkCountryIso"

am: 4d854986

Change-Id: I79362cea8c0361ad1d767cc4a01a49e446c65d38
parents 44d0c2a7 4d854986
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44925,6 +44925,7 @@ package android.telephony {
    field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
    field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
    field public static final int DEFAULT_SUBSCRIPTION_ID = 2147483647; // 0x7fffffff
    field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
    field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
    field public static final int INVALID_SIM_SLOT_INDEX = -1; // 0xffffffff
    field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
+1 −0
Original line number Diff line number Diff line
@@ -8190,6 +8190,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 @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 −0
Original line number Diff line number Diff line
@@ -2900,6 +2900,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 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);
+6 −0
Original line number Diff line number Diff line
@@ -895,6 +895,11 @@ public class SubscriptionManager {
     */
    public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";

    /**
     * Integer extra to specify SIM slot index.
     */
    public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";

    private final Context mContext;
    private volatile INetworkPolicyManager mNetworkPolicy;

@@ -2122,6 +2127,7 @@ public class SubscriptionManager {
        if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
        intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId);
        intent.putExtra(EXTRA_SLOT_INDEX, phoneId);
        intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
    }

+18 −22
Original line number Diff line number Diff line
@@ -2499,41 +2499,37 @@ public class TelephonyManager {
     * @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
     */
    public String getNetworkCountryIso() {
        return getNetworkCountryIsoForPhone(getPhoneId());
        return getNetworkCountryIso(getPhoneId());
    }

    /**
     * Returns the ISO 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.
     * <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
     * if on a CDMA network).
     *
     * @param subId for which Network CountryIso is returned
     * @hide
     */
    @UnsupportedAppUsage
    public String getNetworkCountryIso(int subId) {
        return getNetworkCountryIsoForPhone(getPhoneId(subId));
    }

    /**
     * Returns the ISO country code equivalent of the current registered
     * operator's MCC (Mobile Country Code) of a subscription.
     * <p>
     * Availability: Only when user is registered to a network. Result may be
     * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
     * on a CDMA network).
     *
     * @param phoneId for which Network CountryIso is returned
     * @param slotIndex the SIM slot index to get network country ISO.
     *
     * @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
     *
     * {@hide}
     */
    /** {@hide} */
    @UnsupportedAppUsage
    public String getNetworkCountryIsoForPhone(int phoneId) {
    @SystemApi
    @TestApi
    @NonNull
    public String getNetworkCountryIso(int slotIndex) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) return "";
            return telephony.getNetworkCountryIsoForPhone(phoneId);
            return telephony.getNetworkCountryIsoForPhone(slotIndex);
        } catch (RemoteException ex) {
            return "";
        }