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

Commit 1760dc38 authored by rambowang's avatar rambowang Committed by Rambo Wang
Browse files

Allow caller with READ_BASIC_PHONE_STATE to retrieve basic UiccCardInfo

This change updates the javadoc of API TelephonyManager.getUiccCardsInfo
- Allow caller with READ_BASIC_PHONE_STATE permission to get basic info
- Re-phase javadoc to explict the behavior tied to caller's permission
- Annotate explictly all the allowed permission for the API

Bug: 401006757
Test: atest CtsTelephony2TestCases CtsTelephonyTestCases
Flag: com.android.internal.telephony.flags.macro_based_opportunistic_networks
Change-Id: I86602fe454cff5c9a0afe261ac61d96e5ee6df7e
parent 367d0f9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47635,7 +47635,7 @@ package android.telephony {
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public long getSupportedRadioAccessFamily();
    method @Nullable public String getTypeAllocationCode();
    method @Nullable public String getTypeAllocationCode(int);
    method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
    method @FlaggedApi("com.android.internal.telephony.flags.macro_based_opportunistic_networks") @NonNull @RequiresPermission(anyOf={android.Manifest.permission.READ_BASIC_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE", "carrier privileges"}) public java.util.List<android.telephony.UiccCardInfo> 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();
+36 −18
Original line number Diff line number Diff line
@@ -4428,29 +4428,47 @@ public class TelephonyManager {
    }
    /**
     * Gets information about currently inserted UICCs and eUICCs.
     * Gets information about currently inserted UICCs (Universal Integrated Circuit Cards)
     * and eUICCs (embedded UICCs).
     * <p>
     * Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
     * <p>
     * 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 physical slot index where the card is
     * inserted ({@link UiccCardInfo#getPhysicalSlotIndex()}.
     * <p>
     * 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.
     * The details returned for each {@link android.telephony.UiccCardInfo UiccCardInfo} object
     * depend on the permissions held by the calling application.
     * The specific fields populated within each {@code UiccCardInfo} are determined as follows:
     * <ul>
     * <li>With {@link android.Manifest.permission#READ_BASIC_PHONE_STATE READ_BASIC_PHONE_STATE}:
     * The {@code UiccCardInfo} will include whether the card is an eUICC
     * ({@link android.telephony.UiccCardInfo#isEuicc()}) and its
     * {@link android.telephony.UiccCardInfo#getPhysicalSlotIndex() physical slot index}.</li>
     * <li>With carrier privileges on any active subscription (see
     * {@link TelephonyManager#hasCarrierPrivileges()}):
     * The {@code UiccCardInfo} will include the card ID
     * ({@link android.telephony.UiccCardInfo#getCardId()}), whether it's an
     * eUICC ({@link android.telephony.UiccCardInfo#isEuicc()}), and its
     * {@link android.telephony.UiccCardInfo#getPhysicalSlotIndex() physical slot index}.</li>
     * <li>With carrier privileges on the specific UICC or eUICC card:
     * Sensitive identifiers like the EID ({@link android.telephony.UiccCardInfo#getEid()}) and
     * ICCID ({@link android.telephony.UiccCardInfo#getIccId()}) for that particular card
     * can be accessed.</li>
     * </ul>
     * If an application lacks the necessary permissions for certain details of a card (e.g.,the EID
     * due to missing specific carrier privileges for that card), those fields will not be populated
     * in the {@code UiccCardInfo} object for that card.
     * <p>
     * See {@link UiccCardInfo} for more details on the kind of information available.
     * See {@link android.telephony.UiccCardInfo} for a comprehensive description of all possible
     * card attributes and their individual data protection considerations.
     *
     * @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.
     * @return A list of {@code UiccCardInfo} objects, representing the currently inserted
     * UICCs and eUICCs. Each object contains information filtered according to the
     * caller's permissions for that specific card. Returns an empty list if no
     * cards are present or accessible.
     *
     * @throws UnsupportedOperationException If the device does not have
     *          {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}.
     * @throws UnsupportedOperationException If the device does not declare the
     * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION} feature.
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @FlaggedApi(Flags.FLAG_MACRO_BASED_OPPORTUNISTIC_NETWORKS)
    @RequiresPermission(anyOf = {android.Manifest.permission.READ_BASIC_PHONE_STATE,
            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
            "carrier privileges"})
    @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)
    @NonNull
    public List<UiccCardInfo> getUiccCardsInfo() {