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

Commit ac1defab authored by fionaxu's avatar fionaxu Committed by Chen Xu
Browse files

address carrier id api review feedback

1. improve comments
2. change returned carrier name from String to CharSequence
3. change to AndroidCarrierId

Bug: 64131637
Bug: 71584605
Test: Manual
Change-Id: I412d53bb9d4955e1267300692e90ebfffd6818df
Merged-in: I412d53bb9d4955e1267300692e90ebfffd6818df
parent 6cb33a1b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -40736,6 +40736,8 @@ package android.telephony {
    method public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
    method public android.telephony.TelephonyManager createForSubscriptionId(int);
    method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
    method public int getAndroidCarrierIdForSubscription();
    method public java.lang.CharSequence getAndroidCarrierNameForSubscription();
    method public int getCallState();
    method public android.os.PersistableBundle getCarrierConfig();
    method public deprecated android.telephony.CellLocation getCellLocation();
@@ -40772,8 +40774,6 @@ package android.telephony {
    method public int getSimState();
    method public int getSimState(int);
    method public java.lang.String getSubscriberId();
    method public int getSubscriptionCarrierId();
    method public java.lang.String getSubscriptionCarrierName();
    method public java.lang.String getVisualVoicemailPackageName();
    method public java.lang.String getVoiceMailAlphaTag();
    method public java.lang.String getVoiceMailNumber();
+16 −10
Original line number Diff line number Diff line
@@ -993,8 +993,8 @@ public class TelephonyManager {

    /**
     * An int extra used with {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} which indicates
     * the updated carrier id {@link TelephonyManager#getSubscriptionCarrierId()} of the current
     * subscription.
     * the updated carrier id {@link TelephonyManager#getAndroidCarrierIdForSubscription()} of
     * the current subscription.
     * <p>Will be {@link TelephonyManager#UNKNOWN_CARRIER_ID} if the subscription is unavailable or
     * the carrier cannot be identified.
     */
@@ -6627,14 +6627,19 @@ public class TelephonyManager {

    /**
     * Returns carrier id of the current subscription.
     * <p>To recognize a carrier (including MVNO) as a first class identity, assign each carrier
     * with a canonical integer a.k.a carrier id.
     * <p>To recognize a carrier (including MVNO) as a first-class identity, Android assigns each
     * carrier with a canonical integer a.k.a. android carrier id. The Android carrier ID is an
     * Android platform-wide identifier for a carrier. AOSP maintains carrier ID assignments in
     * <a href="https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/master/assets/carrier_list.textpb">here</a>
     *
     * <p>Apps which have carrier-specific configurations or business logic can use the carrier id
     * as an Android platform-wide identifier for carriers.
     *
     * @return Carrier id of the current subscription. Return {@link #UNKNOWN_CARRIER_ID} if the
     * subscription is unavailable or the carrier cannot be identified.
     * @throws IllegalStateException if telephony service is unavailable.
     */
    public int getSubscriptionCarrierId() {
    public int getAndroidCarrierIdForSubscription() {
        try {
            ITelephony service = getITelephony();
            return service.getSubscriptionCarrierId(getSubId());
@@ -6650,17 +6655,18 @@ public class TelephonyManager {

    /**
     * Returns carrier name of the current subscription.
     * <p>Carrier name is a user-facing name of carrier id {@link #getSubscriptionCarrierId()},
     * usually the brand name of the subsidiary (e.g. T-Mobile). Each carrier could configure
     * multiple {@link #getSimOperatorName() SPN} but should have a single carrier name.
     * Carrier name is not a canonical identity, use {@link #getSubscriptionCarrierId()} instead.
     * <p>Carrier name is a user-facing name of carrier id
     * {@link #getAndroidCarrierIdForSubscription()}, usually the brand name of the subsidiary
     * (e.g. T-Mobile). Each carrier could configure multiple {@link #getSimOperatorName() SPN} but
     * should have a single carrier name. Carrier name is not a canonical identity,
     * use {@link #getAndroidCarrierIdForSubscription()} instead.
     * <p>The returned carrier name is unlocalized.
     *
     * @return Carrier name of the current subscription. Return {@code null} if the subscription is
     * unavailable or the carrier cannot be identified.
     * @throws IllegalStateException if telephony service is unavailable.
     */
    public String getSubscriptionCarrierName() {
    public CharSequence getAndroidCarrierNameForSubscription() {
        try {
            ITelephony service = getITelephony();
            return service.getSubscriptionCarrierName(getSubId());