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

Commit 46dbee08 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed anomaly detector for IP type mismatch

1. Fixed incorrect bugreport title.
2. Fixed the in service detection logic by getting the correct
   network registration info from the correct transport.

Test: Basic testing + manual testing
Fix: 247172186
Change-Id: I0052dfab50dee8cf3a3a0452e83d0b19f03b3713
parent fd4ad0e8
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -2451,26 +2451,31 @@ public class DataNetwork extends StateMachine {
                reportAnomaly("Invalid DataCallResponse detected",
                        "1f273e9d-b09c-46eb-ad1c-421d01f61164");
            }
            if (mDataProfile.getApnSetting() != null && mPhone.getServiceState().getDataRegState()
                    == ServiceState.STATE_IN_SERVICE) {
            NetworkRegistrationInfo nri = getNetworkRegistrationInfo();
            if (mDataProfile.getApnSetting() != null && nri != null && nri.isInService()) {
                boolean isRoaming = mPhone.getServiceState().getDataRoamingFromRegistration();
                int protocol = isRoaming ? mDataProfile.getApnSetting().getRoamingProtocol()
                        : mDataProfile.getApnSetting().getProtocol();
                String underlyingDataService = mTransport
                        == AccessNetworkConstants.TRANSPORT_TYPE_WWAN
                        ? "RIL" : "IWLAN data service";
                if (protocol == ApnSetting.PROTOCOL_IP) {
                    if (response.getAddresses().stream().anyMatch(
                            la -> la.getAddress() instanceof java.net.Inet6Address)) {
                        loge("Invalid DataCallResponse. Requested IPv4 but got IPv6 address. "
                                + response);
                        reportAnomaly("RIL reported mismatched IP type. Requested IPv6 "
                                + "but got IPv4 address.", "7744f920-fb64-4db0-ba47-de0eae485a7f");
                        reportAnomaly(underlyingDataService + " reported mismatched IP "
                                + "type. Requested IPv4 but got IPv6 address.",
                                "7744f920-fb64-4db0-ba47-de0eae485a80");
                    }
                } else if (protocol == ApnSetting.PROTOCOL_IPV6) {
                    if (response.getAddresses().stream().anyMatch(
                            la -> la.getAddress() instanceof java.net.Inet4Address)) {
                        loge("Invalid DataCallResponse. Requested IPv6 but got IPv4 address. "
                                + response);
                        reportAnomaly("RIL reported mismatched IP type. Requested IPv4 "
                                + "but got IPv6 address.", "7744f920-fb64-4db0-ba47-de0eae485a7f");
                        reportAnomaly(underlyingDataService + " reported mismatched IP "
                                        + "type. Requested IPv6 but got IPv4 address.",
                                "7744f920-fb64-4db0-ba47-de0eae485a80");
                    }
                }
            }