diff --git a/api/current.txt b/api/current.txt index 6d9c3c7a2a60a..981c3632892a3 100755 --- a/api/current.txt +++ b/api/current.txt @@ -42882,6 +42882,7 @@ package android.telephony { public class SubscriptionInfo implements android.os.Parcelable { method public android.graphics.Bitmap createIconBitmap(android.content.Context); method public int describeContents(); + method public int getCardId(); method public int getCarrierId(); method public CharSequence getCarrierName(); method public String getCountryIso(); @@ -42998,6 +42999,7 @@ package android.telephony { method public android.telephony.TelephonyManager createForSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public java.util.List getAllCellInfo(); method public int getCallState(); + method public int getCardIdForDefaultEuicc(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @WorkerThread public android.os.PersistableBundle getCarrierConfig(); method public int getCarrierIdFromSimMccMnc(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.CellLocation getCellLocation(); @@ -43045,6 +43047,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getSubscriberId(); method public String getTypeAllocationCode(); method public String getTypeAllocationCode(int); + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List getUiccCardsInfo(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVisualVoicemailPackageName(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailAlphaTag(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(); @@ -43136,6 +43139,7 @@ package android.telephony { field public static final String EXTRA_STATE_RINGING; field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID"; field public static final String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER"; + field public static final int INVALID_CARD_ID = -1; // 0xffffffff field public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU"; field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7 field public static final int NETWORK_TYPE_CDMA = 4; // 0x4 @@ -43203,6 +43207,18 @@ package android.telephony { method public void onResults(java.util.List); } + public final class UiccCardInfo implements android.os.Parcelable { + ctor public UiccCardInfo(boolean, int, String, String, int); + method public int describeContents(); + method public int getCardId(); + method public String getEid(); + method public String getIccId(); + method public int getSlotIndex(); + method public boolean isEuicc(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + public abstract class VisualVoicemailService extends android.app.Service { ctor public VisualVoicemailService(); method public android.os.IBinder onBind(android.content.Intent); diff --git a/api/system-current.txt b/api/system-current.txt index fd43d5ebb2f2f..ad8802838cb18 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6226,7 +6226,6 @@ package android.telephony { public class SubscriptionInfo implements android.os.Parcelable { method @Nullable public java.util.List getAccessRules(); - method public int getCardId(); method public int getProfileClass(); } @@ -6286,7 +6285,6 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int); method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List getAllowedCarriers(int); - method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getCardIdForDefaultEuicc(); method public java.util.List getCarrierPackageNamesForIntent(android.content.Intent); method public java.util.List getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CarrierRestrictionRules getCarrierRestrictionRules(); @@ -6309,7 +6307,6 @@ package android.telephony { method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimLocale(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSupportedRadioAccessFamily(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public java.util.List getTelephonyHistograms(); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccCardInfo[] getUiccCardsInfo(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccSlotInfo[] getUiccSlotsInfo(); method @Nullable public android.os.Bundle getVisualVoicemailSettings(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoiceActivationState(); @@ -6357,7 +6354,6 @@ package android.telephony { field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE"; field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; - field public static final int INVALID_CARD_ID = -1; // 0xffffffff field public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000L; // 0xea60L field public static final int NETWORK_TYPE_BITMASK_1xRTT = 128; // 0x80 field public static final int NETWORK_TYPE_BITMASK_CDMA = 16; // 0x10 @@ -6409,18 +6405,6 @@ package android.telephony { field public static final android.os.Parcelable.Creator CREATOR; } - public class UiccCardInfo implements android.os.Parcelable { - ctor public UiccCardInfo(boolean, int, String, String, int); - method public int describeContents(); - method public int getCardId(); - method public String getEid(); - method public String getIccId(); - method public int getSlotIndex(); - method public boolean isEuicc(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - } - public class UiccSlotInfo implements android.os.Parcelable { ctor public UiccSlotInfo(boolean, boolean, String, int, int, boolean); method public int describeContents(); diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 4e4ef4d6c236c..443f90844c50b 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -577,10 +577,10 @@ public class SubscriptionInfo implements Parcelable { } /** - * @return the cardId of the SIM card which contains the subscription. - * @hide + * Returns the card ID of the SIM card which contains the subscription (see + * {@link UiccCardInfo#getCardId()}. + * @return the cardId */ - @SystemApi public int getCardId() { return this.mCardId; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 03668faca445c..b9731f3e9eae0 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -227,10 +227,9 @@ public class TelephonyManager { public static final int SRVCC_STATE_HANDOVER_CANCELED = 3; /** - * An invalid card identifier. - * @hide + * An invalid UICC card identifier. See {@link #getCardIdForDefaultEuicc()} and + * {@link UiccCardInfo#getCardId()}. */ - @SystemApi public static final int INVALID_CARD_ID = -1; /** @hide */ @@ -3118,14 +3117,8 @@ public class TelephonyManager { * unique to a device, and always refer to the same UICC or eUICC card unless the device goes * through a factory reset. * - *

Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} - * * @return card ID of the default eUICC card. - * @hide */ - @SystemApi - @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges - @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getCardIdForDefaultEuicc() { try { ITelephony telephony = getITelephony(); @@ -3139,25 +3132,37 @@ public class TelephonyManager { } /** - * Gets information about currently inserted UICCs and eUICCs. See {@link UiccCardInfo} for more - * details on the kind of information available. + * Gets information about currently inserted UICCs and enabled eUICCs. + *

+ * Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + *

+ * If the caller has carrier priviliges on any active subscription, then they have permission to + * get simple information like the card ID ({@link UiccCardInfo#getCardId()}), whether the card + * is an eUICC ({@link UiccCardInfo#isEuicc()}), and the slot index where the card is inserted + * ({@link UiccCardInfo#getSlotIndex()}). + *

+ * To get private information such as the EID ({@link UiccCardInfo#getEid()}) or ICCID + * ({@link UiccCardInfo#getIccId()}), the caller must have carrier priviliges on that specific + * UICC or eUICC card. + *

+ * See {@link UiccCardInfo} for more details on the kind of information available. * - * @return UiccCardInfo an array of UiccCardInfo objects, representing information on the - * currently inserted UICCs and eUICCs. - * - * @hide + * @return a list of UiccCardInfo objects, representing information on the currently inserted + * UICCs and eUICCs. Each UiccCardInfo in the list will have private information filtered out if + * the caller does not have adequate permissions for that card. */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - public UiccCardInfo[] getUiccCardsInfo() { + public List getUiccCardsInfo() { try { ITelephony telephony = getITelephony(); if (telephony == null) { - return null; + Log.e(TAG, "Error in getUiccCardsInfo: unable to connect to Telephony service."); + return new ArrayList(); } - return telephony.getUiccCardsInfo(); + return telephony.getUiccCardsInfo(mContext.getOpPackageName()); } catch (RemoteException e) { - return null; + Log.e(TAG, "Error in getUiccCardsInfo: " + e); + return new ArrayList(); } } diff --git a/telephony/java/android/telephony/UiccCardInfo.java b/telephony/java/android/telephony/UiccCardInfo.java index 45e4704e8894a..19f357a14687d 100644 --- a/telephony/java/android/telephony/UiccCardInfo.java +++ b/telephony/java/android/telephony/UiccCardInfo.java @@ -15,7 +15,6 @@ */ package android.telephony; -import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -23,10 +22,8 @@ import java.util.Objects; /** * The UiccCardInfo represents information about a currently inserted UICC or embedded eUICC. - * @hide */ -@SystemApi -public class UiccCardInfo implements Parcelable { +public final class UiccCardInfo implements Parcelable { private final boolean mIsEuicc; private final int mCardId; @@ -95,6 +92,9 @@ public class UiccCardInfo implements Parcelable { /** * Get the embedded ID (EID) of the eUICC. If the UiccCardInfo is not an eUICC * (see {@link #isEuicc()}), returns null. + *

+ * Note that this field may be omitted if the caller does not have the correct permissions + * (see {@link TelephonyManager#getUiccCardsInfo()}). */ public String getEid() { if (!mIsEuicc) { @@ -105,6 +105,9 @@ public class UiccCardInfo implements Parcelable { /** * Get the ICCID of the UICC. + *

+ * Note that this field may be omitted if the caller does not have the correct permissions + * (see {@link TelephonyManager#getUiccCardsInfo()}). */ public String getIccId() { return mIccId; @@ -117,6 +120,16 @@ public class UiccCardInfo implements Parcelable { return mSlotIndex; } + /** + * Returns a copy of the UiccCardinfo with the clears the EID and ICCID set to null. These + * values are generally private and require carrier privileges to view. + * + * @hide + */ + public UiccCardInfo getUnprivileged() { + return new UiccCardInfo(mIsEuicc, mCardId, null, null, mSlotIndex); + } + @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 9a32e1dc375cb..2d11ae2e3423d 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1492,25 +1492,34 @@ interface ITelephony { * Get the card ID of the default eUICC card. If there is no eUICC, returns * {@link #INVALID_CARD_ID}. * - *

Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} - * * @param subId subscription ID used for authentication * @param callingPackage package making the call * @return card ID of the default eUICC card. - * @hide */ - int getCardIdForDefaultEuicc(int subId, String callingPackage); + int getCardIdForDefaultEuicc(int subId, String callingPackage); /** - * Gets information about currently inserted UICCs and eUICCs. See {@link UiccCardInfo} for more - * details on the kind of information available. + * Gets information about currently inserted UICCs and enabled eUICCs. + *

+ * Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + *

+ * If the caller has carrier priviliges on any active subscription, then they have permission to + * get simple information like the card ID ({@link UiccCardInfo#getCardId()}), whether the card + * is an eUICC ({@link UiccCardInfo#isEuicc()}), and the slot index where the card is inserted + * ({@link UiccCardInfo#getSlotIndex()}). + *

+ * To get private information such as the EID ({@link UiccCardInfo#getEid()}) or ICCID + * ({@link UiccCardInfo#getIccId()}), the caller must have carrier priviliges on that specific + * UICC or eUICC card. + *

+ * See {@link UiccCardInfo} for more details on the kind of information available. * - * @return UiccCardInfo an array of UiccCardInfo objects, representing information on the - * currently inserted UICCs and eUICCs. - * - * @hide + * @param callingPackage package making the call, used to evaluate carrier privileges + * @return a list of UiccCardInfo objects, representing information on the currently inserted + * UICCs and eUICCs. Each UiccCardInfo in the list will have private information filtered out if + * the caller does not have adequate permissions for that card. */ - UiccCardInfo[] getUiccCardsInfo(); + List getUiccCardsInfo(String callingPackage); /** * Get slot info for all the UICC slots.