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

Commit b9a22393 authored by Muralidhar Reddy Mule's avatar Muralidhar Reddy Mule Committed by Android (Google) Code Review
Browse files

Merge "Add API support to perform slot switching on 2pSIM+1eSIM configured devices" into main

parents 0c2f9135 8fec4de6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16625,6 +16625,9 @@ package android.telephony {
    field public static final int SIM_ACTIVATION_STATE_UNKNOWN = 0; // 0x0
    field public static final int SIM_STATE_LOADED = 10; // 0xa
    field public static final int SIM_STATE_PRESENT = 11; // 0xb
    field @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public static final int SIM_TYPE_EMBEDDED = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public static final int SIM_TYPE_PHYSICAL = 1; // 0x1
    field @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public static final int SIM_TYPE_UNKNOWN = -1; // 0xffffffff
    field public static final int SRVCC_STATE_HANDOVER_CANCELED = 3; // 0x3
    field public static final int SRVCC_STATE_HANDOVER_COMPLETED = 1; // 0x1
    field public static final int SRVCC_STATE_HANDOVER_FAILED = 2; // 0x2
@@ -16739,6 +16742,8 @@ package android.telephony {
    method public boolean getIsExtendedApduSupported();
    method @Deprecated public int getLogicalSlotIdx();
    method @NonNull public java.util.Collection<android.telephony.UiccPortInfo> getPorts();
    method @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public int getSimType();
    method @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") @NonNull public int[] getSupportedSimTypes();
    method public boolean isRemovable();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1
@@ -16750,10 +16755,12 @@ package android.telephony {
  public final class UiccSlotMapping implements android.os.Parcelable {
    ctor public UiccSlotMapping(int, int, int);
    ctor @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public UiccSlotMapping(int, int, int, int);
    method public int describeContents();
    method @IntRange(from=0) public int getLogicalSlotIndex();
    method @IntRange(from=0) public int getPhysicalSlotIndex();
    method @IntRange(from=0) public int getPortIndex();
    method @FlaggedApi("com.android.internal.telephony.flags.support_slot_switching_2psim_1esim_config") public int getSimType();
    method public void writeToParcel(@Nullable android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccSlotMapping> CREATOR;
  }
+54 −0
Original line number Diff line number Diff line
@@ -4635,6 +4635,23 @@ public class TelephonyManager {
     * slotMapping[0] = UiccSlotMapping{0, 1, 0} and slotMapping[1] = UiccSlotMapping{1, 1, 1} or
     * slotMapping[0] = UiccSlotMapping{1, 1, 0} and slotMapping[1] = UiccSlotMapping{0, 1, 1}
     *
     * <p>Starting API level 37 along with supported HAL version, this API can be used to set the
     * support sim type {@link SimType} corresponding to the physical slot.
     * Example: Some hardware configurations support more than one sim type on physical slot and
     * at a time only one of the supported sim types can be mapped to the physical slot.
     *
     * Assume no. of logical slots 2, physical slots 2 and consider both slots are non MEP.Also
     * assume 2nd physical slot supports either a pSIM or eSIM sim type. To map the physical slot
     * to one of the supported sim types,available mappings are:
     *
     * slotMapping[0] = UiccSlotMapping{0 //port, 0 //physical slot, 0 //logical slot, 1 //simType}
     * slotMapping[1] = UiccSlotMapping{0 //port, 1 //physical slot, 1 //logical slot, 1 //simType}
     *
     * or
     *
     * slotMapping[0] = UiccSlotMapping{0 //port, 0 //physical slot, 0 //logical slot, 1 //simType}
     * slotMapping[1] = UiccSlotMapping{0 //port, 1 //physical slot, 1 //logical slot, 2 //simType}
     *
     * @param slotMapping Logical to physical slot and port mapping.
     * @throws IllegalStateException if telephony service is null or slot mapping was sent when the
     *         radio in middle of a silent restart or other invalid states to handle the command
@@ -19971,4 +19988,41 @@ public class TelephonyManager {
        }
        return UNKNOWN_CARRIER_ID;
    }
    /**
     * Sim Type mounted on each physical slot.
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"SIM_TYPE_"},
            value = {
                    SIM_TYPE_UNKNOWN,
                    SIM_TYPE_PHYSICAL,
                    SIM_TYPE_EMBEDDED,
            })
    public @interface SimType {}
    /**
     * Sim Type: type is not known.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    @SystemApi
    public static final int SIM_TYPE_UNKNOWN = -1;
    /**
     * Sim Type: physical sim.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    @SystemApi
    public static final int SIM_TYPE_PHYSICAL = 1;
    /**
     * Sim Type: embedded sim.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    @SystemApi
    public static final int SIM_TYPE_EMBEDDED = 2;
}
+69 −6
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.telephony;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -22,10 +23,14 @@ import android.annotation.SystemApi;
import android.content.pm.PackageManager;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.TelephonyManager.SimType;

import com.android.internal.telephony.flags.Flags;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -71,6 +76,9 @@ public class UiccSlotInfo implements Parcelable {
    private final boolean mIsRemovable;
    private final List<UiccPortInfo> mPortList;
    private boolean mLogicalSlotAccessRestricted = false;
    private final @SimType int mSimType;
    private final @SimType int[] mSupportedSimTypes;


    public static final @NonNull Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() {
        @Override
@@ -95,6 +103,8 @@ public class UiccSlotInfo implements Parcelable {
        mPortList = new ArrayList<UiccPortInfo>();
        in.readTypedList(mPortList, UiccPortInfo.CREATOR);
        mLogicalSlotAccessRestricted = in.readBoolean();
        mSimType = in.readInt();
        mSupportedSimTypes = in.createIntArray();
    }

    @Override
@@ -108,6 +118,8 @@ public class UiccSlotInfo implements Parcelable {
        dest.writeBoolean(mIsRemovable);
        dest.writeTypedList(mPortList, flags);
        dest.writeBoolean(mLogicalSlotAccessRestricted);
        dest.writeInt(mSimType);
        dest.writeIntArray(mSupportedSimTypes);
    }

    @Override
@@ -130,6 +142,8 @@ public class UiccSlotInfo implements Parcelable {
        this.mIsExtendedApduSupported = isExtendedApduSupported;
        this.mIsRemovable = false;
        this.mPortList = new ArrayList<UiccPortInfo>();
        this.mSimType = TelephonyManager.SIM_TYPE_UNKNOWN;
        this.mSupportedSimTypes = new int[] {TelephonyManager.SIM_TYPE_UNKNOWN};
    }

    /**
@@ -149,6 +163,31 @@ public class UiccSlotInfo implements Parcelable {
        this.mLogicalSlotIdx = portList.isEmpty()
                ? SubscriptionManager.INVALID_PHONE_INDEX
                : portList.get(0).getLogicalSlotIndex();
        this.mSimType = TelephonyManager.SIM_TYPE_UNKNOWN;
        this.mSupportedSimTypes = new int[] {TelephonyManager.SIM_TYPE_UNKNOWN};
    }

    /**
     * Construct a UiccSlotInfo.
     * @hide
     */
    public UiccSlotInfo(boolean isEuicc, String cardId,
            @CardStateInfo int cardStateInfo, boolean isExtendedApduSupported,
            boolean isRemovable, @NonNull List<UiccPortInfo> portList,
            @SimType int simType, @NonNull @SimType int[] supportedSimTypes) {
        // TODO(b/428312829): Instead of multiple constructors, migrate to builder.
        this.mIsEuicc = isEuicc;
        this.mCardId = cardId;
        this.mCardStateInfo = cardStateInfo;
        this.mIsExtendedApduSupported = isExtendedApduSupported;
        this.mIsRemovable = isRemovable;
        this.mPortList = portList;
        this.mIsActive = !portList.isEmpty() && portList.get(0).isActive();
        this.mLogicalSlotIdx = portList.isEmpty()
                ? SubscriptionManager.INVALID_PHONE_INDEX
                : portList.get(0).getLogicalSlotIndex();
        this.mSimType = simType;
        this.mSupportedSimTypes = supportedSimTypes;
    }

    /**
@@ -247,6 +286,22 @@ public class UiccSlotInfo implements Parcelable {
        this.mLogicalSlotAccessRestricted = logicalSlotAccessRestricted;
    }

    /**
     * Returns the currently active sim type on the physical slot.
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    public @SimType int getSimType() {
        return mSimType;
    }

    /**
     * Returns an array of the supported sim types on the physical slot.
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    public @NonNull @SimType int[] getSupportedSimTypes() {
        return mSupportedSimTypes;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
@@ -264,20 +319,23 @@ public class UiccSlotInfo implements Parcelable {
                && (mLogicalSlotIdx == that.mLogicalSlotIdx)
                && (mIsExtendedApduSupported == that.mIsExtendedApduSupported)
                && (mIsRemovable == that.mIsRemovable)
                && (Objects.equals(mPortList, that.mPortList));
                && (Objects.equals(mPortList, that.mPortList))
                && (mSimType == that.mSimType)
                && (Arrays.equals(mSupportedSimTypes, that.mSupportedSimTypes));
    }

    @Override
    public int hashCode() {
        return Objects.hash(mIsActive, mIsEuicc, mCardId, mCardStateInfo, mLogicalSlotIdx,
                mIsExtendedApduSupported, mIsRemovable, mPortList);
                mIsExtendedApduSupported, mIsRemovable, mPortList, mSimType,
                Arrays.hashCode(mSupportedSimTypes));
    }

    @NonNull
    @Override
    public String toString() {
        return "UiccSlotInfo ("
                + ", mIsEuicc="
        StringBuilder sb = new StringBuilder("UiccSlotInfo ("
                + "mIsEuicc="
                + mIsEuicc
                + ", mCardId="
                + SubscriptionInfo.getPrintableId(mCardId)
@@ -290,7 +348,12 @@ public class UiccSlotInfo implements Parcelable {
                + ", mPortList="
                + mPortList
                + ", mLogicalSlotAccessRestricted="
                + mLogicalSlotAccessRestricted
                + ")";
                + mLogicalSlotAccessRestricted);
        if (Flags.supportSlotSwitching2psim1esimConfig()) {
            sb.append(", mSimType=").append(mSimType)
                    .append(", mSupportedSimTypes=").append(Arrays.toString(mSupportedSimTypes));
        }
        sb.append(")");
        return sb.toString();
    }
}
+52 −8
Original line number Diff line number Diff line
@@ -16,20 +16,26 @@

package android.telephony;

import android.annotation.FlaggedApi;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.TelephonyManager.SimType;

import com.android.internal.telephony.flags.Flags;

import java.util.Objects;

/**
 * <p>Provides information for a SIM slot mapping, which establishes a unique mapping between a
 * logical SIM slot and a physical SIM slot and port index.  A logical SIM slot represents a
 * potentially active SIM slot, where a physical SIM slot and port index represent a hardware SIM
 * slot and port (capable of having an active profile) which can be mapped to a logical sim slot.
 * logical SIM slot and a physical SIM slot and port index. It also includes the
 * {@link android.telephony.TelephonyManager.SimType} mapped to the physical slot.
 * A logical SIM slot represents a potentially active SIM slot, where a physical SIM slot and
 * port index represent a hardware SIM slot and port (capable of having an active profile) which
 * can be mapped to a logical sim slot.
 * <p>It contains the following parameters:
 * <ul>
 * <li>Port index: unique index referring to a port belonging to the physical SIM slot.
@@ -44,6 +50,9 @@ import java.util.Objects;
 * and go up depending on the number of supported active slots on a device.
 * For example, a dual-SIM device typically has slot 0 and slot 1. If a device has multiple physical
 * slots but only supports one active slot, it will have only the logical slot ID 0</li>
 * <li>Sim type: {@link android.telephony.TelephonyManager.SimType} mapped to the physical slot.
 * For example, some hardware configurations support more than one sim type on the physical slot
 * but only one sim type can be mapped at a time.</li>
 * </ul>
 *
 * <p> This configurations tells a specific logical slot is mapped to a port from an actual physical
@@ -56,6 +65,7 @@ public final class UiccSlotMapping implements Parcelable {
    private final int mPortIndex;
    private final int mPhysicalSlotIndex;
    private final int mLogicalSlotIndex;
    private final @SimType int mSimType;

    public static final @NonNull Creator<UiccSlotMapping> CREATOR =
            new Creator<UiccSlotMapping>() {
@@ -74,6 +84,7 @@ public final class UiccSlotMapping implements Parcelable {
        mPortIndex = in.readInt();
        mPhysicalSlotIndex = in.readInt();
        mLogicalSlotIndex = in.readInt();
        mSimType = in.readInt();
    }

    @Override
@@ -81,6 +92,7 @@ public final class UiccSlotMapping implements Parcelable {
        dest.writeInt(mPortIndex);
        dest.writeInt(mPhysicalSlotIndex);
        dest.writeInt(mLogicalSlotIndex);
        dest.writeInt(mSimType);
    }

    @Override
@@ -99,6 +111,22 @@ public final class UiccSlotMapping implements Parcelable {
        this.mPortIndex = portIndex;
        this.mPhysicalSlotIndex = physicalSlotIndex;
        this.mLogicalSlotIndex = logicalSlotIndex;
        this.mSimType = TelephonyManager.SIM_TYPE_UNKNOWN;
    }

    /**
     * @param portIndex The port index is an enumeration of the ports available on the UICC.
     * @param physicalSlotIndex is unique index referring to a physical SIM slot.
     * @param logicalSlotIndex is unique index referring to a logical SIM slot.
     * @param simType SIM type mapped to the corresponding physical slot.
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    public UiccSlotMapping(int portIndex, int physicalSlotIndex, int logicalSlotIndex,
            @SimType int simType) {
        this.mPortIndex = portIndex;
        this.mPhysicalSlotIndex = physicalSlotIndex;
        this.mLogicalSlotIndex = logicalSlotIndex;
        this.mSimType = simType;
    }

    /**
@@ -133,6 +161,16 @@ public final class UiccSlotMapping implements Parcelable {
        return mLogicalSlotIndex;
    }

    /**
     * Gets the sim type connected to the corresponding physical slot.
     *
     * @return sim type;
     */
    @FlaggedApi(Flags.FLAG_SUPPORT_SLOT_SWITCHING_2PSIM_1ESIM_CONFIG)
    public @SimType int getSimType() {
        return mSimType;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
@@ -145,23 +183,29 @@ public final class UiccSlotMapping implements Parcelable {
        UiccSlotMapping that = (UiccSlotMapping) obj;
        return (mPortIndex == that.mPortIndex)
                && (mPhysicalSlotIndex == that.mPhysicalSlotIndex)
                && (mLogicalSlotIndex == that.mLogicalSlotIndex);
                && (mLogicalSlotIndex == that.mLogicalSlotIndex)
                && (mSimType == that.mSimType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mPortIndex, mPhysicalSlotIndex, mLogicalSlotIndex);
        return Objects.hash(mPortIndex, mPhysicalSlotIndex, mLogicalSlotIndex, mSimType);
    }

    @NonNull
    @Override
    public String toString() {
        return "UiccSlotMapping (mPortIndex="
        StringBuilder sb = new StringBuilder("UiccSlotMapping ("
                + "mPortIndex="
                + mPortIndex
                + ", mPhysicalSlotIndex="
                + mPhysicalSlotIndex
                + ", mLogicalSlotIndex="
                + mLogicalSlotIndex
                + ")";
                + mLogicalSlotIndex);
        if (Flags.supportSlotSwitching2psim1esimConfig()) {
            sb.append(", mSimType=").append(mSimType);
        }
        sb.append(")");
        return sb.toString();
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -1805,6 +1805,8 @@ interface ITelephony {
     *
     * @return {@code true} if the switch succeeds, {@code false} if the switch fails.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
                      + "android.Manifest.permission.MODIFY_PHONE_STATE)")
    boolean setSimSlotMapping(in List<UiccSlotMapping> slotMapping);

    /**
Loading