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

Commit 91c028b0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[IRadioConfig] ClassCastException fix" am: 559bf020 am: 9b8c38a6

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1897763

Change-Id: If75be2b8ba81fadf914d0b6ffd5049e502064810
parents 63a2ec62 9b8c38a6
Loading
Loading
Loading
Loading
+26 −17
Original line number Diff line number Diff line
@@ -4378,7 +4378,7 @@ public class RILUtils {
     */
    public static ArrayList<IccSlotStatus> convertHalSlotStatus(Object o) {
        ArrayList<IccSlotStatus> response = new ArrayList<>();
        if (o instanceof android.hardware.radio.config.SimSlotStatus[]) {
        try {
            final android.hardware.radio.config.SimSlotStatus[] halSlotStatusArray =
                    (android.hardware.radio.config.SimSlotStatus[]) o;
            for (android.hardware.radio.config.SimSlotStatus slotStatus : halSlotStatusArray) {
@@ -4391,22 +4391,14 @@ public class RILUtils {
                iccSlotStatus.eid = slotStatus.eid;
                response.add(iccSlotStatus);
            }
        } else if (o instanceof ArrayList) {
            final ArrayList<android.hardware.radio.config.V1_0.SimSlotStatus> halSlotStatusArray =
                    (ArrayList<android.hardware.radio.config.V1_0.SimSlotStatus>) o;
            for (android.hardware.radio.config.V1_0.SimSlotStatus slotStatus : halSlotStatusArray) {
                IccSlotStatus iccSlotStatus = new IccSlotStatus();
                iccSlotStatus.setCardState(slotStatus.cardState);
                iccSlotStatus.setSlotState(slotStatus.slotState);
                iccSlotStatus.logicalSlotIndex = slotStatus.logicalSlotId;
                iccSlotStatus.atr = slotStatus.atr;
                iccSlotStatus.iccid = slotStatus.iccid;
                response.add(iccSlotStatus);
            }
        } else if (o instanceof ArrayList) {
            final ArrayList<android.hardware.radio.config.V1_2.SimSlotStatus> halSlotStatusArray =
            return response;
        } catch (ClassCastException ignore) { }
        try {
            final ArrayList<android.hardware.radio.config.V1_2.SimSlotStatus>
                    halSlotStatusArray =
                    (ArrayList<android.hardware.radio.config.V1_2.SimSlotStatus>) o;
            for (android.hardware.radio.config.V1_2.SimSlotStatus slotStatus : halSlotStatusArray) {
            for (android.hardware.radio.config.V1_2.SimSlotStatus slotStatus :
                    halSlotStatusArray) {
                IccSlotStatus iccSlotStatus = new IccSlotStatus();
                iccSlotStatus.setCardState(slotStatus.base.cardState);
                iccSlotStatus.setSlotState(slotStatus.base.slotState);
@@ -4416,8 +4408,25 @@ public class RILUtils {
                iccSlotStatus.eid = slotStatus.eid;
                response.add(iccSlotStatus);
            }
            return response;
        } catch (ClassCastException ignore) { }
        try {
            final ArrayList<android.hardware.radio.config.V1_0.SimSlotStatus>
                    halSlotStatusArray =
                    (ArrayList<android.hardware.radio.config.V1_0.SimSlotStatus>) o;
            for (android.hardware.radio.config.V1_0.SimSlotStatus slotStatus :
                    halSlotStatusArray) {
                IccSlotStatus iccSlotStatus = new IccSlotStatus();
                iccSlotStatus.setCardState(slotStatus.cardState);
                iccSlotStatus.setSlotState(slotStatus.slotState);
                iccSlotStatus.logicalSlotIndex = slotStatus.logicalSlotId;
                iccSlotStatus.atr = slotStatus.atr;
                iccSlotStatus.iccid = slotStatus.iccid;
                response.add(iccSlotStatus);
            }
            return response;
        } catch (ClassCastException ignore) { }
        return response;
    }

    /**