From 45f662139190df65f15d57a6e415c9559b580efe Mon Sep 17 00:00:00 2001 From: chen xu Date: Wed, 6 Mar 2019 14:43:40 -0800 Subject: [PATCH] rename precise carrier id to specific carrier id Bug: 126727010 Test: atest CtsTelephonyTestCases Change-Id: I4561ae8c15c429912695e0753b2ab3137a4e1e44 --- api/current.txt | 18 ++-- .../service/carrier/CarrierIdentifier.java | 34 ++++--- .../java/android/provider/Telephony.java | 38 +++---- .../telephony/CarrierConfigManager.java | 4 +- .../android/telephony/TelephonyManager.java | 98 +++++++++++-------- .../internal/telephony/ITelephony.aidl | 10 +- 6 files changed, 113 insertions(+), 89 deletions(-) diff --git a/api/current.txt b/api/current.txt index 9fad6caa36deb..08a9f8de83672 100644 --- a/api/current.txt +++ b/api/current.txt @@ -39249,13 +39249,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 { @@ -41399,7 +41399,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 @NonNull public static final android.os.Parcelable.Creator CREATOR; @@ -45169,9 +45169,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.permission.READ_PRIVILEGED_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.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId(); @@ -45232,7 +45232,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 @@ -45267,8 +45267,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; diff --git a/core/java/android/service/carrier/CarrierIdentifier.java b/core/java/android/service/carrier/CarrierIdentifier.java index 3a57e3ad42391..df1186e5f2aa1 100644 --- a/core/java/android/service/carrier/CarrierIdentifier.java +++ b/core/java/android/service/carrier/CarrierIdentifier.java @@ -54,7 +54,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) { @@ -71,12 +71,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(String mcc, 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; @@ -84,7 +84,7 @@ public class CarrierIdentifier implements Parcelable { mGid1 = gid1; mGid2 = gid2; mCarrierId = carrierid; - mPreciseCarrierId = preciseCarrierId; + mSpecificCarrierId = specificCarrierId; } /** @@ -161,11 +161,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 @@ -185,12 +191,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 @@ -207,7 +213,7 @@ public class CarrierIdentifier implements Parcelable { out.writeString(mGid1); out.writeString(mGid2); out.writeInt(mCarrierId); - out.writeInt(mPreciseCarrierId); + out.writeInt(mSpecificCarrierId); } @Override @@ -220,7 +226,7 @@ public class CarrierIdentifier implements Parcelable { + ",gid1=" + mGid1 + ",gid2=" + mGid2 + ",carrierid=" + mCarrierId - + ",mPreciseCarrierId=" + mPreciseCarrierId + + ",specificCarrierId=" + mSpecificCarrierId + "}"; } @@ -233,7 +239,7 @@ public class CarrierIdentifier implements Parcelable { mGid1 = in.readString(); mGid2 = in.readString(); mCarrierId = in.readInt(); - mPreciseCarrierId = in.readInt(); + mSpecificCarrierId = in.readInt(); } /** @hide */ diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java index 67477cf811099..3106e40e076e6 100644 --- a/telephony/java/android/provider/Telephony.java +++ b/telephony/java/android/provider/Telephony.java @@ -4372,24 +4372,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 *

* 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)); } @@ -4409,26 +4409,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}. *

Type: INTEGER

* @hide */ diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index c0444bb17ac75..dcc1c6f71aa8e 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -71,10 +71,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"; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 0b003dc528aa6..f9c8a8675ee83 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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()}. * *

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: *