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

Commit e7571aef authored by ziyiw's avatar ziyiw
Browse files

[framework] Handle more possible route string from service.

There are more possible values for routing status. Should only check if
the return value has these prefixes.

Bug: 356419585
Test: atest CtsNfcTestCases
Change-Id: I7626573dce4bcb59ee7ac6aa35dd162f60d2fbae
parent 9b60e84b
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -923,12 +923,15 @@ public final class NfcOemExtension {
    }

    private @CardEmulation.ProtocolAndTechnologyRoute int routeStringToInt(String route) {
        return switch (route) {
            case "DH" -> PROTOCOL_AND_TECHNOLOGY_ROUTE_DH;
            case "eSE" -> PROTOCOL_AND_TECHNOLOGY_ROUTE_ESE;
            case "SIM" -> PROTOCOL_AND_TECHNOLOGY_ROUTE_UICC;
            default -> throw new IllegalStateException("Unexpected value: " + route);
        };
        if (route.equals("DH")) {
            return PROTOCOL_AND_TECHNOLOGY_ROUTE_DH;
        } else if (route.startsWith("eSE")) {
            return PROTOCOL_AND_TECHNOLOGY_ROUTE_ESE;
        } else if (route.startsWith("SIM")) {
            return PROTOCOL_AND_TECHNOLOGY_ROUTE_UICC;
        } else {
            throw new IllegalStateException("Unexpected value: " + route);
        }
    }

    private class ReceiverWrapper<T> implements Consumer<T> {