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

Commit 4d7f24f0 authored by Nathan Harold's avatar Nathan Harold
Browse files

Keep redacted port info with READ_BASIC_PHONE_STATE permission

This change fixes the issue that empty PortInfo list is returned when
caller retrieves UiccCardInfo with READ_BASIC_PHONE_STATE permission.

Even without carrier privileges, caller was able to retrieve the
non-sensitive port info (port index to logical slot index mapping).This
behavior was broken when relaxed permission function was introduced.

Bug: 401006757
Fix: 425988249
Test: atest CtsTelephony2TestCases CtsTelephonyTestCases
Flag: com.android.internal.telephony.flags.macro_based_opportunistic_networks
Change-Id: Ib2edd646f38775c647034a9de84f8ff56dba9236
parent 9c1a92d5
Loading
Loading
Loading
Loading
+13 −24
Original line number Diff line number Diff line
@@ -237,30 +237,19 @@ public final class UiccCardInfo implements Parcelable {
     * @hide
     */
    public UiccCardInfo createSensitiveInfoSanitizedCopy(boolean hasCarrierPrivileges) {
        if (hasCarrierPrivileges) {
            List<UiccPortInfo> portInfos = new  ArrayList<>();
            for (UiccPortInfo portInfo : this.getPorts()) {
                portInfos.add(portInfo.createSensitiveInfoSanitizedCopy());
        final List<UiccPortInfo> redactedPortInfos = new  ArrayList<>();
        for (UiccPortInfo portInfo : mPortList) {
            redactedPortInfos.add(portInfo.createSensitiveInfoSanitizedCopy());
        }

        return new UiccCardInfo(
                    this.isEuicc(),
                    this.getCardId(),
                    null,
                    this.getPhysicalSlotIndex(),
                    this.isRemovable(),
                    this.isMultipleEnabledProfilesSupported(),
                    portInfos);
        } else {
            // Without carrier privileges, treat it as READ_BASIC_PHONE_STATE, copy minimum info
            return new UiccCardInfo(
                    this.isEuicc(),
                    TelephonyManager.UNINITIALIZED_CARD_ID,
                mIsEuicc,
                hasCarrierPrivileges ? mCardId : TelephonyManager.UNINITIALIZED_CARD_ID,
                null,
                    this.getPhysicalSlotIndex(),
                    this.isRemovable(),
                    this.isMultipleEnabledProfilesSupported(),
                    List.of());
        }
                mPhysicalSlotIndex,
                mIsRemovable,
                mIsMultipleEnabledProfilesSupported,
                redactedPortInfos);
    }

    @Override