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

Commit 91f71e17 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Renamed name source to display name source am: 32982caa

parents 9e289cda 32982caa
Loading
Loading
Loading
Loading
+28 −29
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.text.TextUtils.formatSimple;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
@@ -34,7 +33,6 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.ParcelUuid;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -105,10 +103,10 @@ public class SubscriptionInfo implements Parcelable {
    private final int mCarrierId;
    private final int mCarrierId;


    /**
    /**
     * The source of the {@link #mCarrierName}.
     * The source of the {@link #mDisplayName}.
     */
     */
    @SimDisplayNameSource
    @SimDisplayNameSource
    private final int mNameSource;
    private final int mDisplayNameSource;


    /**
    /**
     * The color to be used for tinting the icon when displaying to the user.
     * The color to be used for tinting the icon when displaying to the user.
@@ -319,14 +317,14 @@ public class SubscriptionInfo implements Parcelable {
    // TODO: Clean up after external usages moved to builder model.
    // TODO: Clean up after external usages moved to builder model.
    @Deprecated
    @Deprecated
    public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
    public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
            CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
            CharSequence carrierName, int displayNameSource, int iconTint, String number,
            Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
            int roaming, Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
            @Nullable UiccAccessRule[] nativeAccessRules, String cardString, int cardId,
            @Nullable UiccAccessRule[] nativeAccessRules, String cardString, int cardId,
            boolean isOpportunistic, @Nullable String groupUUID, boolean isGroupDisabled,
            boolean isOpportunistic, @Nullable String groupUUID, boolean isGroupDisabled,
            int carrierId, int profileClass, int subType, @Nullable String groupOwner,
            int carrierId, int profileClass, int subType, @Nullable String groupOwner,
            @Nullable UiccAccessRule[] carrierConfigAccessRules,
            @Nullable UiccAccessRule[] carrierConfigAccessRules,
            boolean areUiccApplicationsEnabled, int portIndex) {
            boolean areUiccApplicationsEnabled, int portIndex) {
        this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
        this(id, iccId, simSlotIndex, displayName, carrierName, displayNameSource, iconTint, number,
                roaming, icon, mcc, mnc, countryIso, isEmbedded, nativeAccessRules, cardString,
                roaming, icon, mcc, mnc, countryIso, isEmbedded, nativeAccessRules, cardString,
                cardId, isOpportunistic, groupUUID, isGroupDisabled, carrierId, profileClass,
                cardId, isOpportunistic, groupUUID, isGroupDisabled, carrierId, profileClass,
                subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled,
                subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled,
@@ -353,7 +351,7 @@ public class SubscriptionInfo implements Parcelable {
        this.mSimSlotIndex = simSlotIndex;
        this.mSimSlotIndex = simSlotIndex;
        this.mDisplayName =  displayName;
        this.mDisplayName =  displayName;
        this.mCarrierName = carrierName;
        this.mCarrierName = carrierName;
        this.mNameSource = nameSource;
        this.mDisplayNameSource = nameSource;
        this.mIconTint = iconTint;
        this.mIconTint = iconTint;
        this.mNumber = number;
        this.mNumber = number;
        this.mDataRoaming = roaming;
        this.mDataRoaming = roaming;
@@ -391,7 +389,7 @@ public class SubscriptionInfo implements Parcelable {
        this.mSimSlotIndex = builder.mSimSlotIndex;
        this.mSimSlotIndex = builder.mSimSlotIndex;
        this.mDisplayName = builder.mDisplayName;
        this.mDisplayName = builder.mDisplayName;
        this.mCarrierName = builder.mCarrierName;
        this.mCarrierName = builder.mCarrierName;
        this.mNameSource = builder.mNameSource;
        this.mDisplayNameSource = builder.mDisplayNameSource;
        this.mIconTint = builder.mIconTint;
        this.mIconTint = builder.mIconTint;
        this.mNumber = builder.mNumber;
        this.mNumber = builder.mNumber;
        this.mDataRoaming = builder.mDataRoaming;
        this.mDataRoaming = builder.mDataRoaming;
@@ -481,14 +479,13 @@ public class SubscriptionInfo implements Parcelable {
    }
    }


    /**
    /**
     * @return The source of the {@link #getCarrierName()}.
     * @return The source of the {@link #getDisplayName()}.
     *
     *
     * @hide
     * @hide
     */
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @SimDisplayNameSource
    @SimDisplayNameSource
    public int getNameSource() {
    public int getDisplayNameSource() {
        return mNameSource;
        return mDisplayNameSource;
    }
    }


    /**
    /**
@@ -863,7 +860,7 @@ public class SubscriptionInfo implements Parcelable {
                    .setSimSlotIndex(source.readInt())
                    .setSimSlotIndex(source.readInt())
                    .setDisplayName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
                    .setDisplayName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
                    .setCarrierName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
                    .setCarrierName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
                    .setNameSource(source.readInt())
                    .setDisplayNameSource(source.readInt())
                    .setIconTint(source.readInt())
                    .setIconTint(source.readInt())
                    .setNumber(source.readString())
                    .setNumber(source.readString())
                    .setDataRoaming(source.readInt())
                    .setDataRoaming(source.readInt())
@@ -904,7 +901,7 @@ public class SubscriptionInfo implements Parcelable {
        dest.writeInt(mSimSlotIndex);
        dest.writeInt(mSimSlotIndex);
        TextUtils.writeToParcel(mDisplayName, dest, 0);
        TextUtils.writeToParcel(mDisplayName, dest, 0);
        TextUtils.writeToParcel(mCarrierName, dest, 0);
        TextUtils.writeToParcel(mCarrierName, dest, 0);
        dest.writeInt(mNameSource);
        dest.writeInt(mDisplayNameSource);
        dest.writeInt(mIconTint);
        dest.writeInt(mIconTint);
        dest.writeString(mNumber);
        dest.writeString(mNumber);
        dest.writeInt(mDataRoaming);
        dest.writeInt(mDataRoaming);
@@ -962,7 +959,7 @@ public class SubscriptionInfo implements Parcelable {
        String cardStringToPrint = givePrintableIccid(mCardString);
        String cardStringToPrint = givePrintableIccid(mCardString);
        return "{id=" + mId + " iccId=" + iccIdToPrint + " simSlotIndex=" + mSimSlotIndex
        return "{id=" + mId + " iccId=" + iccIdToPrint + " simSlotIndex=" + mSimSlotIndex
                + " carrierId=" + mCarrierId + " displayName=" + mDisplayName
                + " carrierId=" + mCarrierId + " displayName=" + mDisplayName
                + " carrierName=" + mCarrierName + " nameSource=" + mNameSource
                + " carrierName=" + mCarrierName + " nameSource=" + mDisplayNameSource
                + " iconTint=" + mIconTint
                + " iconTint=" + mIconTint
                + " number=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, mNumber)
                + " number=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, mNumber)
                + " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc=" + mMcc
                + " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc=" + mMcc
@@ -984,11 +981,11 @@ public class SubscriptionInfo implements Parcelable {


    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
        return Objects.hash(mId, mSimSlotIndex, mDisplayNameSource, mIconTint, mDataRoaming,
                mIsOpportunistic, mGroupUuid, mIccId, mNumber, mMcc, mMnc, mCountryIso, mCardString,
                mIsEmbedded, mIsOpportunistic, mGroupUuid, mIccId, mNumber, mMcc, mMnc, mCountryIso,
                mCardId, mDisplayName, mCarrierName, Arrays.hashCode(mNativeAccessRules),
                mCardString, mCardId, mDisplayName, mCarrierName,
                mIsGroupDisabled, mCarrierId, mProfileClass, mGroupOwner,
                Arrays.hashCode(mNativeAccessRules), mIsGroupDisabled, mCarrierId, mProfileClass,
                mAreUiccApplicationsEnabled, mPortIndex, mUsageSetting);
                mGroupOwner, mAreUiccApplicationsEnabled, mPortIndex, mUsageSetting);
    }
    }


    @Override
    @Override
@@ -998,7 +995,7 @@ public class SubscriptionInfo implements Parcelable {
        SubscriptionInfo toCompare = (SubscriptionInfo) obj;
        SubscriptionInfo toCompare = (SubscriptionInfo) obj;
        return mId == toCompare.mId
        return mId == toCompare.mId
                && mSimSlotIndex == toCompare.mSimSlotIndex
                && mSimSlotIndex == toCompare.mSimSlotIndex
                && mNameSource == toCompare.mNameSource
                && mDisplayNameSource == toCompare.mDisplayNameSource
                && mIconTint == toCompare.mIconTint
                && mIconTint == toCompare.mIconTint
                && mDataRoaming == toCompare.mDataRoaming
                && mDataRoaming == toCompare.mDataRoaming
                && mIsEmbedded == toCompare.mIsEmbedded
                && mIsEmbedded == toCompare.mIsEmbedded
@@ -1064,10 +1061,10 @@ public class SubscriptionInfo implements Parcelable {
        private CharSequence mCarrierName = "";
        private CharSequence mCarrierName = "";


        /**
        /**
         * The source of the carrier name.
         * The source of the display name.
         */
         */
        @SimDisplayNameSource
        @SimDisplayNameSource
        private int mNameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;
        private int mDisplayNameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;


        /**
        /**
         * The color to be used for tinting the icon when displaying to the user.
         * The color to be used for tinting the icon when displaying to the user.
@@ -1233,7 +1230,7 @@ public class SubscriptionInfo implements Parcelable {
            mSimSlotIndex = info.mSimSlotIndex;
            mSimSlotIndex = info.mSimSlotIndex;
            mDisplayName = info.mDisplayName;
            mDisplayName = info.mDisplayName;
            mCarrierName = info.mCarrierName;
            mCarrierName = info.mCarrierName;
            mNameSource = info.mNameSource;
            mDisplayNameSource = info.mDisplayNameSource;
            mIconTint = info.mIconTint;
            mIconTint = info.mIconTint;
            mNumber = info.mNumber;
            mNumber = info.mNumber;
            mDataRoaming = info.mDataRoaming;
            mDataRoaming = info.mDataRoaming;
@@ -1324,14 +1321,16 @@ public class SubscriptionInfo implements Parcelable {
        }
        }


        /**
        /**
         * Set the source of the carrier name.
         * Set the source of the display name.
         *
         *
         * @param nameSource The source of the carrier name.
         * @param displayNameSource The source of the display name.
         * @return The builder.
         * @return The builder.
         *
         * @see SubscriptionInfo#getDisplayName()
         */
         */
        @NonNull
        @NonNull
        public Builder setNameSource(@SimDisplayNameSource int nameSource) {
        public Builder setDisplayNameSource(@SimDisplayNameSource int displayNameSource) {
            mNameSource = nameSource;
            mDisplayNameSource = displayNameSource;
            return this;
            return this;
        }
        }