Merge changes from topics "rename_display_name_source", "sdbm"

* changes:
  Improved debug message
  Fixed equals and hashCode
  Renamed name source to display name source
This commit is contained in:
Treehugger Robot
2023-02-28 04:25:42 +00:00
committed by Gerrit Code Review
5 changed files with 332 additions and 122 deletions

View File

@@ -53,6 +53,7 @@ import com.android.internal.telephony.SmsApplication;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -4353,6 +4354,12 @@ public final class Telephony {
*/
public static final String COLUMN_NAME_SOURCE = "name_source";
/**
* The name source is unknown.
* @hide
*/
public static final int NAME_SOURCE_UNKNOWN = -1;
/** The name_source is from the carrier id. {@hide} */
public static final int NAME_SOURCE_CARRIER_ID = 0;
@@ -4834,5 +4841,86 @@ public final class Telephony {
* @hide
*/
public static final String COLUMN_USER_HANDLE = "user_handle";
/** All columns in {@link SimInfo} table. */
private static final List<String> ALL_COLUMNS = List.of(
COLUMN_UNIQUE_KEY_SUBSCRIPTION_ID,
COLUMN_ICC_ID,
COLUMN_SIM_SLOT_INDEX,
COLUMN_DISPLAY_NAME,
COLUMN_CARRIER_NAME,
COLUMN_NAME_SOURCE,
COLUMN_COLOR,
COLUMN_NUMBER,
COLUMN_DISPLAY_NUMBER_FORMAT,
COLUMN_DATA_ROAMING,
COLUMN_MCC,
COLUMN_MNC,
COLUMN_MCC_STRING,
COLUMN_MNC_STRING,
COLUMN_EHPLMNS,
COLUMN_HPLMNS,
COLUMN_SIM_PROVISIONING_STATUS,
COLUMN_IS_EMBEDDED,
COLUMN_CARD_ID,
COLUMN_ACCESS_RULES,
COLUMN_ACCESS_RULES_FROM_CARRIER_CONFIGS,
COLUMN_IS_REMOVABLE,
COLUMN_CB_EXTREME_THREAT_ALERT,
COLUMN_CB_SEVERE_THREAT_ALERT,
COLUMN_CB_AMBER_ALERT,
COLUMN_CB_EMERGENCY_ALERT,
COLUMN_CB_ALERT_SOUND_DURATION,
COLUMN_CB_ALERT_REMINDER_INTERVAL,
COLUMN_CB_ALERT_VIBRATE,
COLUMN_CB_ALERT_SPEECH,
COLUMN_CB_ETWS_TEST_ALERT,
COLUMN_CB_CHANNEL_50_ALERT,
COLUMN_CB_CMAS_TEST_ALERT,
COLUMN_CB_OPT_OUT_DIALOG,
COLUMN_ENHANCED_4G_MODE_ENABLED,
COLUMN_VT_IMS_ENABLED,
COLUMN_WFC_IMS_ENABLED,
COLUMN_WFC_IMS_MODE,
COLUMN_WFC_IMS_ROAMING_MODE,
COLUMN_WFC_IMS_ROAMING_ENABLED,
COLUMN_IS_OPPORTUNISTIC,
COLUMN_GROUP_UUID,
COLUMN_IS_METERED,
COLUMN_ISO_COUNTRY_CODE,
COLUMN_CARRIER_ID,
COLUMN_PROFILE_CLASS,
COLUMN_SUBSCRIPTION_TYPE,
COLUMN_GROUP_OWNER,
COLUMN_DATA_ENABLED_OVERRIDE_RULES,
COLUMN_ENABLED_MOBILE_DATA_POLICIES,
COLUMN_IMSI,
COLUMN_UICC_APPLICATIONS_ENABLED,
COLUMN_ALLOWED_NETWORK_TYPES,
COLUMN_IMS_RCS_UCE_ENABLED,
COLUMN_CROSS_SIM_CALLING_ENABLED,
COLUMN_RCS_CONFIG,
COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS,
COLUMN_D2D_STATUS_SHARING,
COLUMN_VOIMS_OPT_IN_STATUS,
COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS,
COLUMN_NR_ADVANCED_CALLING_ENABLED,
COLUMN_PHONE_NUMBER_SOURCE_CARRIER,
COLUMN_PHONE_NUMBER_SOURCE_IMS,
COLUMN_PORT_INDEX,
COLUMN_USAGE_SETTING,
COLUMN_TP_MESSAGE_REF,
COLUMN_USER_HANDLE
);
/**
* @return All columns in {@link SimInfo} table.
*
* @hide
*/
@NonNull
public static List<String> getAllColumns() {
return ALL_COLUMNS;
}
}
}

View File

@@ -192,4 +192,22 @@ public final class TelephonyUtils {
// This is the error case. The well-defined value for UNKNOWN is -1.
return "UNKNOWN(" + state + ")";
}
/**
* Convert mobile data policy to string.
*
* @param mobileDataPolicy The mobile data policy.
* @return The mobile data policy in string format.
*/
public static @NonNull String mobileDataPolicyToString(
@TelephonyManager.MobileDataPolicy int mobileDataPolicy) {
switch (mobileDataPolicy) {
case TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL:
return "DATA_ON_NON_DEFAULT_DURING_VOICE_CALL";
case TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED:
return "MMS_ALWAYS_ALLOWED";
default:
return "UNKNOWN(" + mobileDataPolicy + ")";
}
}
}

View File

@@ -21,7 +21,6 @@ import static android.text.TextUtils.formatSimple;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -34,7 +33,6 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.Parcelable;
@@ -98,17 +96,10 @@ public class SubscriptionInfo implements Parcelable {
private final CharSequence mCarrierName;
/**
* The subscription carrier id.
*
* @see TelephonyManager#getSimCarrierId()
*/
private final int mCarrierId;
/**
* The source of the {@link #mCarrierName}.
* The source of the {@link #mDisplayName}.
*/
@SimDisplayNameSource
private final int mNameSource;
private final int mDisplayNameSource;
/**
* The color to be used for tinting the icon when displaying to the user.
@@ -128,12 +119,6 @@ public class SubscriptionInfo implements Parcelable {
*/
private final int mDataRoaming;
/**
* SIM icon bitmap cache.
*/
@Nullable
private Bitmap mIconBitmap;
/**
* Mobile Country Code.
*/
@@ -158,17 +143,18 @@ public class SubscriptionInfo implements Parcelable {
@NonNull
private final String[] mHplmns;
/**
* ISO Country code for the subscription's provider.
*/
@NonNull
private final String mCountryIso;
/**
* Whether the subscription is from eSIM.
*/
private final boolean mIsEmbedded;
/**
* The string ID of the SIM card. It is the ICCID of the active profile for a UICC card and the
* EID for an eUICC card.
*/
@NonNull
private final String mCardString;
/**
* The access rules for this subscription, if it is embedded and defines any. This does not
* include access rules for non-embedded subscriptions.
@@ -183,18 +169,6 @@ public class SubscriptionInfo implements Parcelable {
@Nullable
private final UiccAccessRule[] mCarrierConfigAccessRules;
/**
* The string ID of the SIM card. It is the ICCID of the active profile for a UICC card and the
* EID for an eUICC card.
*/
@NonNull
private final String mCardString;
/**
* The card ID of the SIM card. This maps uniquely to {@link #mCardString}.
*/
private final int mCardId;
/**
* Whether the subscription is opportunistic.
*/
@@ -209,18 +183,17 @@ public class SubscriptionInfo implements Parcelable {
private final ParcelUuid mGroupUuid;
/**
* A package name that specifies who created the group. Empty if not available.
* ISO Country code for the subscription's provider.
*/
@NonNull
private final String mGroupOwner;
private final String mCountryIso;
/**
* Whether group of the subscription is disabled. This is only useful if it's a grouped
* opportunistic subscription. In this case, if all primary (non-opportunistic) subscriptions
* in the group are deactivated (unplugged pSIM or deactivated eSIM profile), we should disable
* this opportunistic subscription.
* The subscription carrier id.
*
* @see TelephonyManager#getSimCarrierId()
*/
private final boolean mIsGroupDisabled;
private final int mCarrierId;
/**
* The profile class populated from the profile metadata if present. Otherwise,
@@ -237,6 +210,12 @@ public class SubscriptionInfo implements Parcelable {
@SubscriptionType
private final int mType;
/**
* A package name that specifies who created the group. Empty if not available.
*/
@NonNull
private final String mGroupOwner;
/**
* Whether uicc applications are configured to enable or disable.
* By default it's true.
@@ -254,6 +233,27 @@ public class SubscriptionInfo implements Parcelable {
@UsageSetting
private final int mUsageSetting;
// Below are the fields that do not exist in the database.
/**
* SIM icon bitmap cache.
*/
@Nullable
private Bitmap mIconBitmap;
/**
* The card ID of the SIM card. This maps uniquely to {@link #mCardString}.
*/
private final int mCardId;
/**
* Whether group of the subscription is disabled. This is only useful if it's a grouped
* opportunistic subscription. In this case, if all primary (non-opportunistic) subscriptions
* in the group are deactivated (unplugged pSIM or deactivated eSIM profile), we should disable
* this opportunistic subscription.
*/
private final boolean mIsGroupDisabled;
/**
* @hide
*
@@ -319,14 +319,14 @@ public class SubscriptionInfo implements Parcelable {
// TODO: Clean up after external usages moved to builder model.
@Deprecated
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
CharSequence carrierName, int displayNameSource, int iconTint, String number,
int roaming, Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] nativeAccessRules, String cardString, int cardId,
boolean isOpportunistic, @Nullable String groupUUID, boolean isGroupDisabled,
int carrierId, int profileClass, int subType, @Nullable String groupOwner,
@Nullable UiccAccessRule[] carrierConfigAccessRules,
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,
cardId, isOpportunistic, groupUUID, isGroupDisabled, carrierId, profileClass,
subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled,
@@ -353,7 +353,7 @@ public class SubscriptionInfo implements Parcelable {
this.mSimSlotIndex = simSlotIndex;
this.mDisplayName = displayName;
this.mCarrierName = carrierName;
this.mNameSource = nameSource;
this.mDisplayNameSource = nameSource;
this.mIconTint = iconTint;
this.mNumber = number;
this.mDataRoaming = roaming;
@@ -391,7 +391,7 @@ public class SubscriptionInfo implements Parcelable {
this.mSimSlotIndex = builder.mSimSlotIndex;
this.mDisplayName = builder.mDisplayName;
this.mCarrierName = builder.mCarrierName;
this.mNameSource = builder.mNameSource;
this.mDisplayNameSource = builder.mDisplayNameSource;
this.mIconTint = builder.mIconTint;
this.mNumber = builder.mNumber;
this.mDataRoaming = builder.mDataRoaming;
@@ -481,14 +481,13 @@ public class SubscriptionInfo implements Parcelable {
}
/**
* @return The source of the {@link #getCarrierName()}.
* @return The source of the {@link #getDisplayName()}.
*
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@SimDisplayNameSource
public int getNameSource() {
return mNameSource;
public int getDisplayNameSource() {
return mDisplayNameSource;
}
/**
@@ -668,7 +667,8 @@ public class SubscriptionInfo implements Parcelable {
*/
@NonNull
public List<String> getEhplmns() {
return mEhplmns == null ? Collections.emptyList() : Arrays.asList(mEhplmns);
return Collections.unmodifiableList(mEhplmns == null
? Collections.emptyList() : Arrays.asList(mEhplmns));
}
/**
@@ -676,7 +676,8 @@ public class SubscriptionInfo implements Parcelable {
*/
@NonNull
public List<String> getHplmns() {
return mHplmns == null ? Collections.emptyList() : Arrays.asList(mHplmns);
return Collections.unmodifiableList(mHplmns == null
? Collections.emptyList() : Arrays.asList(mHplmns));
}
/**
@@ -780,7 +781,7 @@ public class SubscriptionInfo implements Parcelable {
if (mCarrierConfigAccessRules != null) {
merged.addAll(Arrays.asList(mCarrierConfigAccessRules));
}
return merged.isEmpty() ? null : merged;
return merged.isEmpty() ? null : Collections.unmodifiableList(merged);
}
/**
@@ -863,7 +864,7 @@ public class SubscriptionInfo implements Parcelable {
.setSimSlotIndex(source.readInt())
.setDisplayName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
.setCarrierName(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source))
.setNameSource(source.readInt())
.setDisplayNameSource(source.readInt())
.setIconTint(source.readInt())
.setNumber(source.readString())
.setDataRoaming(source.readInt())
@@ -904,7 +905,7 @@ public class SubscriptionInfo implements Parcelable {
dest.writeInt(mSimSlotIndex);
TextUtils.writeToParcel(mDisplayName, dest, 0);
TextUtils.writeToParcel(mCarrierName, dest, 0);
dest.writeInt(mNameSource);
dest.writeInt(mDisplayNameSource);
dest.writeInt(mIconTint);
dest.writeString(mNumber);
dest.writeInt(mDataRoaming);
@@ -960,69 +961,75 @@ public class SubscriptionInfo implements Parcelable {
public String toString() {
String iccIdToPrint = givePrintableIccid(mIccId);
String cardStringToPrint = givePrintableIccid(mCardString);
return "{id=" + mId + " iccId=" + iccIdToPrint + " simSlotIndex=" + mSimSlotIndex
+ " carrierId=" + mCarrierId + " displayName=" + mDisplayName
+ " carrierName=" + mCarrierName + " nameSource=" + mNameSource
return "[SubscriptionInfo: id=" + mId
+ " iccId=" + iccIdToPrint
+ " simSlotIndex=" + mSimSlotIndex
+ " portIndex=" + mPortIndex
+ " isEmbedded=" + mIsEmbedded
+ " carrierId=" + mCarrierId
+ " displayName=" + mDisplayName
+ " carrierName=" + mCarrierName
+ " isOpportunistic=" + mIsOpportunistic
+ " groupUuid=" + mGroupUuid
+ " groupOwner=" + mGroupOwner
+ " isGroupDisabled=" + mIsGroupDisabled
+ " displayNameSource="
+ SubscriptionManager.displayNameSourceToString(mDisplayNameSource)
+ " iconTint=" + mIconTint
+ " number=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, mNumber)
+ " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc=" + mMcc
+ " mnc=" + mMnc + " countryIso=" + mCountryIso + " isEmbedded=" + mIsEmbedded
+ " nativeAccessRules=" + Arrays.toString(mNativeAccessRules)
+ " cardString=" + cardStringToPrint + " cardId=" + mCardId
+ " portIndex=" + mPortIndex
+ " isOpportunistic=" + mIsOpportunistic + " groupUuid=" + mGroupUuid
+ " isGroupDisabled=" + mIsGroupDisabled
+ " profileClass=" + mProfileClass
+ " dataRoaming=" + mDataRoaming
+ " mcc=" + mMcc
+ " mnc=" + mMnc
+ " ehplmns=" + Arrays.toString(mEhplmns)
+ " hplmns=" + Arrays.toString(mHplmns)
+ " mType=" + mType
+ " groupOwner=" + mGroupOwner
+ " cardString=" + cardStringToPrint
+ " cardId=" + mCardId
+ " nativeAccessRules=" + Arrays.toString(mNativeAccessRules)
+ " carrierConfigAccessRules=" + Arrays.toString(mCarrierConfigAccessRules)
+ " countryIso=" + mCountryIso
+ " profileClass=" + mProfileClass
+ " mType=" + SubscriptionManager.subscriptionTypeToString(mType)
+ " areUiccApplicationsEnabled=" + mAreUiccApplicationsEnabled
+ " usageSetting=" + mUsageSetting + "}";
+ " usageSetting=" + SubscriptionManager.usageSettingToString(mUsageSetting)
+ "]";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SubscriptionInfo that = (SubscriptionInfo) o;
return mId == that.mId && mSimSlotIndex == that.mSimSlotIndex
&& mDisplayNameSource == that.mDisplayNameSource && mIconTint == that.mIconTint
&& mDataRoaming == that.mDataRoaming && mIsEmbedded == that.mIsEmbedded
&& mIsOpportunistic == that.mIsOpportunistic && mCarrierId == that.mCarrierId
&& mProfileClass == that.mProfileClass && mType == that.mType
&& mAreUiccApplicationsEnabled == that.mAreUiccApplicationsEnabled
&& mPortIndex == that.mPortIndex && mUsageSetting == that.mUsageSetting
&& mCardId == that.mCardId && mIsGroupDisabled == that.mIsGroupDisabled
&& mIccId.equals(that.mIccId) && mDisplayName.equals(that.mDisplayName)
&& mCarrierName.equals(that.mCarrierName) && mNumber.equals(that.mNumber)
&& Objects.equals(mMcc, that.mMcc) && Objects.equals(mMnc,
that.mMnc) && Arrays.equals(mEhplmns, that.mEhplmns)
&& Arrays.equals(mHplmns, that.mHplmns) && mCardString.equals(
that.mCardString) && Arrays.equals(mNativeAccessRules,
that.mNativeAccessRules) && Arrays.equals(mCarrierConfigAccessRules,
that.mCarrierConfigAccessRules) && Objects.equals(mGroupUuid, that.mGroupUuid)
&& mCountryIso.equals(that.mCountryIso) && mGroupOwner.equals(that.mGroupOwner);
}
@Override
public int hashCode() {
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
mIsOpportunistic, mGroupUuid, mIccId, mNumber, mMcc, mMnc, mCountryIso, mCardString,
mCardId, mDisplayName, mCarrierName, Arrays.hashCode(mNativeAccessRules),
mIsGroupDisabled, mCarrierId, mProfileClass, mGroupOwner,
mAreUiccApplicationsEnabled, mPortIndex, mUsageSetting);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
SubscriptionInfo toCompare = (SubscriptionInfo) obj;
return mId == toCompare.mId
&& mSimSlotIndex == toCompare.mSimSlotIndex
&& mNameSource == toCompare.mNameSource
&& mIconTint == toCompare.mIconTint
&& mDataRoaming == toCompare.mDataRoaming
&& mIsEmbedded == toCompare.mIsEmbedded
&& mIsOpportunistic == toCompare.mIsOpportunistic
&& mIsGroupDisabled == toCompare.mIsGroupDisabled
&& mAreUiccApplicationsEnabled == toCompare.mAreUiccApplicationsEnabled
&& mCarrierId == toCompare.mCarrierId
&& Objects.equals(mGroupUuid, toCompare.mGroupUuid)
&& Objects.equals(mIccId, toCompare.mIccId)
&& Objects.equals(mNumber, toCompare.mNumber)
&& Objects.equals(mMcc, toCompare.mMcc)
&& Objects.equals(mMnc, toCompare.mMnc)
&& Objects.equals(mCountryIso, toCompare.mCountryIso)
&& Objects.equals(mCardString, toCompare.mCardString)
&& Objects.equals(mCardId, toCompare.mCardId)
&& mPortIndex == toCompare.mPortIndex
&& Objects.equals(mGroupOwner, toCompare.mGroupOwner)
&& TextUtils.equals(mDisplayName, toCompare.mDisplayName)
&& TextUtils.equals(mCarrierName, toCompare.mCarrierName)
&& Arrays.equals(mNativeAccessRules, toCompare.mNativeAccessRules)
&& mProfileClass == toCompare.mProfileClass
&& Arrays.equals(mEhplmns, toCompare.mEhplmns)
&& Arrays.equals(mHplmns, toCompare.mHplmns)
&& mUsageSetting == toCompare.mUsageSetting;
int result = Objects.hash(mId, mIccId, mSimSlotIndex, mDisplayName, mCarrierName,
mDisplayNameSource, mIconTint, mNumber, mDataRoaming, mMcc, mMnc, mIsEmbedded,
mCardString, mIsOpportunistic, mGroupUuid, mCountryIso, mCarrierId, mProfileClass,
mType, mGroupOwner, mAreUiccApplicationsEnabled, mPortIndex, mUsageSetting, mCardId,
mIsGroupDisabled);
result = 31 * result + Arrays.hashCode(mEhplmns);
result = 31 * result + Arrays.hashCode(mHplmns);
result = 31 * result + Arrays.hashCode(mNativeAccessRules);
result = 31 * result + Arrays.hashCode(mCarrierConfigAccessRules);
return result;
}
/**
@@ -1034,7 +1041,7 @@ public class SubscriptionInfo implements Parcelable {
/**
* The subscription id.
*/
private int mId = 0;
private int mId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
/**
* The ICCID of the SIM that is associated with this subscription, empty if unknown.
@@ -1064,10 +1071,10 @@ public class SubscriptionInfo implements Parcelable {
private CharSequence mCarrierName = "";
/**
* The source of the carrier name.
* The source of the display name.
*/
@SimDisplayNameSource
private int mNameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;
private int mDisplayNameSource = SubscriptionManager.NAME_SOURCE_UNKNOWN;
/**
* The color to be used for tinting the icon when displaying to the user.
@@ -1144,7 +1151,7 @@ public class SubscriptionInfo implements Parcelable {
/**
* The card ID of the SIM card which contains the subscription.
*/
private int mCardId = -1;
private int mCardId = TelephonyManager.UNINITIALIZED_CARD_ID;
/**
* Whether the subscription is opportunistic or not.
@@ -1208,7 +1215,7 @@ public class SubscriptionInfo implements Parcelable {
/**
* the port index of the Uicc card.
*/
private int mPortIndex = 0;
private int mPortIndex = TelephonyManager.INVALID_PORT_INDEX;
/**
* Subscription's preferred usage setting.
@@ -1233,7 +1240,7 @@ public class SubscriptionInfo implements Parcelable {
mSimSlotIndex = info.mSimSlotIndex;
mDisplayName = info.mDisplayName;
mCarrierName = info.mCarrierName;
mNameSource = info.mNameSource;
mDisplayNameSource = info.mDisplayNameSource;
mIconTint = info.mIconTint;
mNumber = info.mNumber;
mDataRoaming = info.mDataRoaming;
@@ -1324,14 +1331,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.
*
* @see SubscriptionInfo#getDisplayName()
*/
@NonNull
public Builder setNameSource(@SimDisplayNameSource int nameSource) {
mNameSource = nameSource;
public Builder setDisplayNameSource(@SimDisplayNameSource int displayNameSource) {
mDisplayNameSource = displayNameSource;
return this;
}
@@ -1434,9 +1443,9 @@ public class SubscriptionInfo implements Parcelable {
}
/**
* Set the ISO Country code for the subscription's provider.
* Set the ISO country code for the subscription's provider.
*
* @param countryIso The ISO Country code for the subscription's provider.
* @param countryIso The ISO country code for the subscription's provider.
* @return The builder.
*/
@NonNull
@@ -1593,7 +1602,7 @@ public class SubscriptionInfo implements Parcelable {
* Set the carrier certificates for this subscription that are saved in carrier configs.
* This does not include access rules from the Uicc, whether embedded or non-embedded.
*
* @param carrierConfigAccessRules The carrier certificates for this subscription
* @param carrierConfigAccessRules The carrier certificates for this subscription.
* @return The builder.
*/
@NonNull

View File

@@ -565,6 +565,12 @@ public class SubscriptionManager {
*/
public static final String NAME_SOURCE = SimInfo.COLUMN_NAME_SOURCE;
/**
* The name_source is unknown. (for initialization)
* @hide
*/
public static final int NAME_SOURCE_UNKNOWN = SimInfo.NAME_SOURCE_UNKNOWN;
/**
* The name_source is from the carrier id.
* @hide
@@ -600,6 +606,7 @@ public class SubscriptionManager {
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"NAME_SOURCE_"},
value = {
NAME_SOURCE_UNKNOWN,
NAME_SOURCE_CARRIER_ID,
NAME_SOURCE_SIM_SPN,
NAME_SOURCE_USER_INPUT,
@@ -4129,5 +4136,66 @@ public class SubscriptionManager {
(iSub)-> iSub.setUsageSetting(
usageSetting, subscriptionId, mContext.getOpPackageName()));
}
/**
* Convert display name source to string.
*
* @param source The display name source.
* @return The display name source in string format.
*
* @hide
*/
@NonNull
public static String displayNameSourceToString(
@SubscriptionManager.SimDisplayNameSource int source) {
switch (source) {
case SubscriptionManager.NAME_SOURCE_UNKNOWN: return "UNKNOWN";
case SubscriptionManager.NAME_SOURCE_CARRIER_ID: return "CARRIER_ID";
case SubscriptionManager.NAME_SOURCE_SIM_SPN: return "SIM_SPN";
case SubscriptionManager.NAME_SOURCE_USER_INPUT: return "USER_INPUT";
case SubscriptionManager.NAME_SOURCE_CARRIER: return "CARRIER";
case SubscriptionManager.NAME_SOURCE_SIM_PNN: return "SIM_PNN";
default:
return "UNKNOWN(" + source + ")";
}
}
/**
* Convert subscription type to string.
*
* @param type The subscription type.
* @return The subscription type in string format.
*
* @hide
*/
@NonNull
public static String subscriptionTypeToString(@SubscriptionManager.SubscriptionType int type) {
switch (type) {
case SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM: return "LOCAL_SIM";
case SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM: return "REMOTE_SIM";
default:
return "UNKNOWN(" + type + ")";
}
}
/**
* Convert usage setting to string.
*
* @param usageSetting Usage setting.
* @return The usage setting in string format.
*
* @hide
*/
@NonNull
public static String usageSettingToString(@SubscriptionManager.UsageSetting int usageSetting) {
switch (usageSetting) {
case SubscriptionManager.USAGE_SETTING_UNKNOWN: return "UNKNOWN";
case SubscriptionManager.USAGE_SETTING_DEFAULT: return "DEFAULT";
case SubscriptionManager.USAGE_SETTING_VOICE_CENTRIC: return "VOICE_CENTRIC";
case SubscriptionManager.USAGE_SETTING_DATA_CENTRIC: return "DATA_CENTRIC";
default:
return "UNKNOWN(" + usageSetting + ")";
}
}
}

View File

@@ -72,12 +72,19 @@ public class ImsMmTelManager implements RegistrationManager {
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "WIFI_MODE_", value = {
WIFI_MODE_UNKNOWN,
WIFI_MODE_WIFI_ONLY,
WIFI_MODE_CELLULAR_PREFERRED,
WIFI_MODE_WIFI_PREFERRED
})
public @interface WiFiCallingMode {}
/**
* Wifi calling mode is unknown. This is for initialization only.
* @hide
*/
public static final int WIFI_MODE_UNKNOWN = -1;
/**
* Register for IMS over IWLAN if WiFi signal quality is high enough. Do not hand over to LTE
* registration if signal quality degrades.
@@ -1581,4 +1588,24 @@ public class ImsMmTelManager implements RegistrationManager {
.get());
return binder;
}
/**
* Convert Wi-Fi calling mode to string.
*
* @param mode Wi-Fi calling mode.
* @return The Wi-Fi calling mode in string format.
*
* @hide
*/
@NonNull
public static String wifiCallingModeToString(@ImsMmTelManager.WiFiCallingMode int mode) {
switch (mode) {
case ImsMmTelManager.WIFI_MODE_UNKNOWN: return "UNKNOWN";
case ImsMmTelManager.WIFI_MODE_WIFI_ONLY: return "WIFI_ONLY";
case ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED: return "CELLULAR_PREFERRED";
case ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED: return "WIFI_PREFERRED";
default:
return "UNKNOWN(" + mode + ")";
}
}
}