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

Commit 118354f7 authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "rename precise carrier id to specific carrier id"

parents e17575c0 2b0139ca
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -37321,13 +37321,13 @@ package android.provider {
  }
  public static final class Telephony.CarrierId implements android.provider.BaseColumns {
    method @NonNull public static android.net.Uri getPreciseCarrierIdUriForSubscriptionId(int);
    method @NonNull public static android.net.Uri getSpecificCarrierIdUriForSubscriptionId(int);
    method public static android.net.Uri getUriForSubscriptionId(int);
    field public static final String CARRIER_ID = "carrier_id";
    field public static final String CARRIER_NAME = "carrier_name";
    field public static final android.net.Uri CONTENT_URI;
    field public static final String PRECISE_CARRIER_ID = "precise_carrier_id";
    field public static final String PRECISE_CARRIER_ID_NAME = "precise_carrier_id_name";
    field public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
    field public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
  }
  public static final class Telephony.Carriers implements android.provider.BaseColumns {
@@ -39449,7 +39449,7 @@ package android.service.carrier {
    method @Nullable public String getImsi();
    method public String getMcc();
    method public String getMnc();
    method public int getPreciseCarrierId();
    method public int getSpecificCarrierId();
    method @Nullable public String getSpn();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
@@ -43069,9 +43069,9 @@ package android.telephony {
    method public String getSimCountryIso();
    method public String getSimOperator();
    method public String getSimOperatorName();
    method public int getSimPreciseCarrierId();
    method @Nullable public CharSequence getSimPreciseCarrierIdName();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getSimSerialNumber();
    method public int getSimSpecificCarrierId();
    method @Nullable public CharSequence getSimSpecificCarrierIdName();
    method public int getSimState();
    method public int getSimState(int);
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getSubscriberId();
@@ -43131,7 +43131,7 @@ package android.telephony {
    field public static final String ACTION_SECRET_CODE = "android.telephony.action.SECRET_CODE";
    field public static final String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION";
    field public static final String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED";
    field public static final String ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED";
    field public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED";
    field public static final int APPTYPE_CSIM = 4; // 0x4
    field public static final int APPTYPE_ISIM = 5; // 0x5
    field public static final int APPTYPE_RUIM = 3; // 0x3
@@ -43166,8 +43166,8 @@ package android.telephony {
    field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY";
    field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT";
    field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telephony.extra.PHONE_ACCOUNT_HANDLE";
    field public static final String EXTRA_PRECISE_CARRIER_ID = "android.telephony.extra.PRECISE_CARRIER_ID";
    field public static final String EXTRA_PRECISE_CARRIER_NAME = "android.telephony.extra.PRECISE_CARRIER_NAME";
    field public static final String EXTRA_SPECIFIC_CARRIER_ID = "android.telephony.extra.SPECIFIC_CARRIER_ID";
    field public static final String EXTRA_SPECIFIC_CARRIER_NAME = "android.telephony.extra.SPECIFIC_CARRIER_NAME";
    field public static final String EXTRA_STATE = "state";
    field public static final String EXTRA_STATE_IDLE;
    field public static final String EXTRA_STATE_OFFHOOK;
+20 −14
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public class CarrierIdentifier implements Parcelable {
    private @Nullable String mGid1;
    private @Nullable String mGid2;
    private int mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
    private int mPreciseCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
    private int mSpecificCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;

    public CarrierIdentifier(String mcc, String mnc, @Nullable String spn, @Nullable String imsi,
            @Nullable String gid1, @Nullable String gid2) {
@@ -72,12 +72,12 @@ public class CarrierIdentifier implements Parcelable {
     * @param gid2 group id level 2
     * @param carrierid carrier unique identifier {@link TelephonyManager#getSimCarrierId()}, used
     *                  to uniquely identify the carrier and look up the carrier configurations.
     * @param preciseCarrierId precise carrier identifier
     * {@link TelephonyManager#getSimPreciseCarrierId()}
     * @param specificCarrierId specific carrier identifier
     * {@link TelephonyManager#getSimSpecificCarrierId()}
     */
    public CarrierIdentifier(@NonNull String mcc, @NonNull String mnc, @Nullable String spn,
                             @Nullable String imsi, @Nullable String gid1, @Nullable String gid2,
                             int carrierid, int preciseCarrierId) {
                             int carrierid, int specificCarrierId) {
        mMcc = mcc;
        mMnc = mnc;
        mSpn = spn;
@@ -85,7 +85,7 @@ public class CarrierIdentifier implements Parcelable {
        mGid1 = gid1;
        mGid2 = gid2;
        mCarrierId = carrierid;
        mPreciseCarrierId = preciseCarrierId;
        mSpecificCarrierId = specificCarrierId;
    }

    /**
@@ -162,11 +162,17 @@ public class CarrierIdentifier implements Parcelable {
    }

    /**
     * Returns the precise carrier id.
     * @see TelephonyManager#getSimPreciseCarrierId()
     * A specific carrier ID returns the fine-grained carrier ID of the current subscription.
     * It can represent the fact that a carrier may be in effect an aggregation of other carriers
     * (ie in an MVNO type scenario) where each of these specific carriers which are used to make
     * up the actual carrier service may have different carrier configurations.
     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
     * different carrier configuration for different service offering such as a prepaid plan.
     *
     * @see TelephonyManager#getSimSpecificCarrierId()
     */
    public int getPreciseCarrierId() {
        return mPreciseCarrierId;
    public int getSpecificCarrierId() {
        return mSpecificCarrierId;
    }

    @Override
@@ -186,12 +192,12 @@ public class CarrierIdentifier implements Parcelable {
                && Objects.equals(mGid1, that.mGid1)
                && Objects.equals(mGid2, that.mGid2)
                && Objects.equals(mCarrierId, that.mCarrierId)
                && Objects.equals(mPreciseCarrierId, that.mPreciseCarrierId);
                && Objects.equals(mSpecificCarrierId, that.mSpecificCarrierId);
    }

    @Override
    public int hashCode(){
        return Objects.hash(mMcc, mMnc, mSpn, mImsi, mGid1, mGid2, mCarrierId, mPreciseCarrierId);
        return Objects.hash(mMcc, mMnc, mSpn, mImsi, mGid1, mGid2, mCarrierId, mSpecificCarrierId);
    }

    @Override
@@ -208,7 +214,7 @@ public class CarrierIdentifier implements Parcelable {
        out.writeString(mGid1);
        out.writeString(mGid2);
        out.writeInt(mCarrierId);
        out.writeInt(mPreciseCarrierId);
        out.writeInt(mSpecificCarrierId);
    }

    @Override
@@ -221,7 +227,7 @@ public class CarrierIdentifier implements Parcelable {
              + ",gid1=" + mGid1
              + ",gid2=" + mGid2
              + ",carrierid=" + mCarrierId
              + ",mPreciseCarrierId=" + mPreciseCarrierId
              + ",specificCarrierId=" + mSpecificCarrierId
              + "}";
    }

@@ -234,7 +240,7 @@ public class CarrierIdentifier implements Parcelable {
        mGid1 = in.readString();
        mGid2 = in.readString();
        mCarrierId = in.readInt();
        mPreciseCarrierId = in.readInt();
        mSpecificCarrierId = in.readInt();
    }

    /** @hide */
+21 −17
Original line number Diff line number Diff line
@@ -4309,24 +4309,24 @@ public final class Telephony {
        }

        /**
         * Generates a content {@link Uri} used to receive updates on precise carrier identity
         * Generates a content {@link Uri} used to receive updates on specific carrier identity
         * change on the given subscriptionId returned by
         * {@link TelephonyManager#getSimPreciseCarrierId()}.
         * @see TelephonyManager#ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED
         * {@link TelephonyManager#getSimSpecificCarrierId()}.
         * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
         * <p>
         * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
         * precise carrier identity {@link TelephonyManager#getSimPreciseCarrierId()}
         * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()}
         * while your app is running. You can also use a {@link JobService} to ensure your app
         * is notified of changes to the {@link Uri} even when it is not running.
         * Note, however, that using a {@link JobService} does not guarantee timely delivery of
         * updates to the {@link Uri}.
         *
         * @param subscriptionId the subscriptionId to receive updates on
         * @return the Uri used to observe precise carrier identity changes
         * @return the Uri used to observe specific carrier identity changes
         */
        @NonNull
        public static Uri getPreciseCarrierIdUriForSubscriptionId(int subscriptionId) {
            return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "precise"),
        public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) {
            return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"),
                    String.valueOf(subscriptionId));
        }

@@ -4346,26 +4346,30 @@ public final class Telephony {

        /**
         * A fine-grained carrier id.
         * @see TelephonyManager#getSimPreciseCarrierId()
         * The specific carrier ID would be used for configuration purposes, but apps wishing to
         * know about the carrier itself should use the regular carrier ID returned by
         * {@link TelephonyManager#getSimCarrierId()}.
         *
         * @see TelephonyManager#getSimSpecificCarrierId()
         * This is not a database column, only used to notify content observers for
         * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
         * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
         */
        public static final String PRECISE_CARRIER_ID = "precise_carrier_id";
        public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";

        /**
         * A user facing carrier name for precise carrier id {@link #PRECISE_CARRIER_ID}.
         * @see TelephonyManager#getSimPreciseCarrierIdName()
         * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}.
         * @see TelephonyManager#getSimSpecificCarrierIdName()
         * This is not a database column, only used to notify content observers for
         * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
         * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
         */
        public static final String PRECISE_CARRIER_ID_NAME = "precise_carrier_id_name";
        public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";

        /**
         * A unique parent carrier id. The parent-child
         * relationship can be used to further differentiate a single carrier by different networks,
         * by prepaid v.s. postpaid or even by 4G v.s. 3G plan. It's an optional field.
         * A carrier id with a valid parent_carrier_id is considered fine-grained carrier id, will
         * not be returned as {@link #CARRIER_ID} but {@link #PRECISE_CARRIER_ID}.
         * by prepaid v.s. postpaid. It's an optional field.
         * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier
         * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}.
         * <P>Type: INTEGER </P>
         * @hide
         */
+2 −2
Original line number Diff line number Diff line
@@ -72,10 +72,10 @@ public class CarrierConfigManager {
     * one is available for the slot index. An optional int extra
     * {@link TelephonyManager#EXTRA_CARRIER_ID} is included to indicate the carrier id for the
     * changed carrier configuration. An optional int extra
     * {@link TelephonyManager#EXTRA_PRECISE_CARRIER_ID} is included to indicate the precise
     * {@link TelephonyManager#EXTRA_SPECIFIC_CARRIER_ID} is included to indicate the precise
     * carrier id for the changed carrier configuration.
     * @see TelephonyManager#getSimCarrierId()
     * @see TelephonyManager#getSimPreciseCarrierId()
     * @see TelephonyManager#getSimSpecificCarrierId()
     */
    public static final String
            ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+56 −42
Original line number Diff line number Diff line
@@ -1246,30 +1246,34 @@ public class TelephonyManager {
    public static final String EXTRA_CARRIER_NAME = "android.telephony.extra.CARRIER_NAME";

    /**
     * Broadcast Action: The subscription precise carrier identity has changed.
     * The precise carrier id can be used to further differentiate a carrier by different
     * networks, by prepaid v.s.postpaid or even by 4G v.s.3G plan. Each carrier has a unique
     * carrier id returned by {@link #getSimCarrierId()} but could have multiple precise carrier id.
     * e.g, {@link #getSimCarrierId()} will always return Tracfone (id 2022) for a Tracfone SIM,
     * while {@link #getSimPreciseCarrierId()} can return Tracfone AT&T or Tracfone T-Mobile based
     * on the current subscription IMSI. For carriers without any fine-grained ids, precise carrier
     * id is same as carrier id.
     * Broadcast Action: The subscription specific carrier identity has changed.
     *
     * A specific carrier ID returns the fine-grained carrier ID of the current subscription.
     * It can represent the fact that a carrier may be in effect an aggregation of other carriers
     * (ie in an MVNO type scenario) where each of these specific carriers which are used to make
     * up the actual carrier service may have different carrier configurations.
     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
     * different carrier configuration for different service offering such as a prepaid plan.
     *
     * the specific carrier ID would be used for configuration purposes, but apps wishing to know
     * about the carrier itself should use the regular carrier ID returned by
     * {@link #getSimCarrierId()}.
     *
     * <p>Similar like {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED}, this intent will be
     * sent on the event of {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} while its also
     * possible to be sent without {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} when
     * precise carrier id changes with the same carrier id.
     * specific carrier ID changes while carrier ID remains the same.
     * e.g, the same subscription switches to different IMSI could potentially change its
     * precise carrier id while carrier id remains the same.
     * @see #getSimPreciseCarrierId()
     * specific carrier ID while carrier id remains the same.
     * @see #getSimSpecificCarrierId()
     * @see #getSimCarrierId()
     *
     * The intent will have the following extra values:
     * <ul>
     *   <li>{@link #EXTRA_PRECISE_CARRIER_ID} The up-to-date precise carrier id of the
     *   <li>{@link #EXTRA_SPECIFIC_CARRIER_ID} The up-to-date specific carrier id of the
     *   current subscription.
     *   </li>
     *   <li>{@link #EXTRA_PRECISE_CARRIER_NAME} The up-to-date name of the precise carrier id.
     *   <li>{@link #EXTRA_SPECIFIC_CARRIER_NAME} The up-to-date name of the specific carrier id.
     *   </li>
     *   <li>{@link #EXTRA_SUBSCRIPTION_ID} The subscription id associated with the changed carrier
     *   identity.
@@ -1278,30 +1282,30 @@ public class TelephonyManager {
     * <p class="note">This is a protected intent that can only be sent by the system.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED =
            "android.telephony.action.SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED";
    public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED =
            "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED";

    /**
     * An int extra used with {@link #ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED} which
     * indicates the updated precise carrier id returned by
     * {@link TelephonyManager#getSimPreciseCarrierId()}. Note, its possible precise carrier id
     * An int extra used with {@link #ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED} which
     * indicates the updated specific carrier id returned by
     * {@link TelephonyManager#getSimSpecificCarrierId()}. Note, its possible specific carrier id
     * changes while {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} remains the same
     * e.g, when subscription switch to different IMSIs.
     * <p>Will be {@link TelephonyManager#UNKNOWN_CARRIER_ID} if the subscription is unavailable or
     * the carrier cannot be identified.
     */
    public static final String EXTRA_PRECISE_CARRIER_ID =
            "android.telephony.extra.PRECISE_CARRIER_ID";
    public static final String EXTRA_SPECIFIC_CARRIER_ID =
            "android.telephony.extra.SPECIFIC_CARRIER_ID";

    /**
     * An string extra used with {@link #ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED} which
     * indicates the updated precise carrier name returned by
     * {@link TelephonyManager#getSimPreciseCarrierIdName()}.
     * <p>it's a user-facing name of the precise carrier id {@link #EXTRA_PRECISE_CARRIER_ID}, e.g,
     * Tracfone-AT&T.
     * An string extra used with {@link #ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED}
     * which indicates the updated specific carrier name returned by
     * {@link TelephonyManager#getSimSpecificCarrierIdName()}.
     * <p>it's a user-facing name of the specific carrier id {@link #EXTRA_SPECIFIC_CARRIER_ID}
     * e.g, Tracfone-AT&T
     */
    public static final String EXTRA_PRECISE_CARRIER_NAME =
            "android.telephony.extra.PRECISE_CARRIER_NAME";
    public static final String EXTRA_SPECIFIC_CARRIER_NAME =
            "android.telephony.extra.SPECIFIC_CARRIER_NAME";

    /**
     * An int extra used with {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} to indicate the
@@ -8913,17 +8917,23 @@ public class TelephonyManager {
    }

    /**
     * Returns fine-grained carrier id of the current subscription.
     * Returns fine-grained carrier ID of the current subscription.
     *
     * A specific carrier ID can represent the fact that a carrier may be in effect an aggregation
     * of other carriers (ie in an MVNO type scenario) where each of these specific carriers which
     * are used to make up the actual carrier service may have different carrier configurations.
     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
     * different carrier configuration for different service offering such as a prepaid plan.
     *
     * <p>The precise carrier id can be used to further differentiate a carrier by different
     * networks, by prepaid v.s.postpaid or even by 4G v.s.3G plan. Each carrier has a unique
     * carrier id returned by {@link #getSimCarrierId()} but could have multiple precise carrier id.
     * e.g, {@link #getSimCarrierId()} will always return Tracfone (id 2022) for a Tracfone SIM,
     * while {@link #getSimPreciseCarrierId()} can return Tracfone AT&T or Tracfone T-Mobile based
     * on the current subscription IMSI.
     * the specific carrier ID would be used for configuration purposes, but apps wishing to know
     * about the carrier itself should use the regular carrier ID returned by
     * {@link #getSimCarrierId()}.
     *
     * <p>For carriers without any fine-grained carrier ids, return {@link #getSimCarrierId()}
     * <p>Precise carrier ids are defined in the same way as carrier id
     * e.g, Tracfone SIMs could return different specific carrier ID based on IMSI from current
     * subscription while carrier ID remains the same.
     *
     * <p>For carriers without fine-grained specific carrier ids, return {@link #getSimCarrierId()}
     * <p>Specific carrier ids are defined in the same way as carrier id
     * <a href="https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/master/assets/carrier_list.textpb">here</a>
     * except each with a "parent" id linking to its top-level carrier id.
     *
@@ -8931,11 +8941,11 @@ public class TelephonyManager {
     * Return {@link #UNKNOWN_CARRIER_ID} if the subscription is unavailable or the carrier cannot
     * be identified.
     */
    public int getSimPreciseCarrierId() {
    public int getSimSpecificCarrierId() {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.getSubscriptionPreciseCarrierId(getSubId());
                return service.getSubscriptionSpecificCarrierId(getSubId());
            }
        } catch (RemoteException ex) {
            // This could happen if binder process crashes.
@@ -8945,18 +8955,22 @@ public class TelephonyManager {

    /**
     * Similar like {@link #getSimCarrierIdName()}, returns user-facing name of the
     * precise carrier id returned by {@link #getSimPreciseCarrierId()}.
     * specific carrier id returned by {@link #getSimSpecificCarrierId()}.
     *
     * The specific carrier ID would be used for configuration purposes, but apps wishing to know
     * about the carrier itself should use the regular carrier ID returned by
     * {@link #getSimCarrierIdName()}.
     *
     * <p>The returned name is unlocalized.
     *
     * @return user-facing name of the subscription precise carrier id. Return {@code null} if the
     * @return user-facing name of the subscription specific carrier id. Return {@code null} if the
     * subscription is unavailable or the carrier cannot be identified.
     */
    public @Nullable CharSequence getSimPreciseCarrierIdName() {
    public @Nullable CharSequence getSimSpecificCarrierIdName() {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.getSubscriptionPreciseCarrierName(getSubId());
                return service.getSubscriptionSpecificCarrierName(getSubId());
            }
        } catch (RemoteException ex) {
            // This could happen if binder process crashes.
Loading