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

Commit e7c38252 authored by Ling Ma's avatar Ling Ma
Browse files

Refine QNS anomaly report

ignore report if the specified apn type is absent from the existing network requests.

Fix: 235390516
Test: basic manual phone call + data browsing
Change-Id: I5e6a222611232dae89ee0d7dc5905d3a0530bd64
parent 77091437
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -433,6 +433,9 @@ public class AccessNetworksManager extends Handler {
     * @param apnType The requested apnType.
     */
    private void trackFrequentApnTypeChange(@ApnSetting.ApnType int apnType) {
        DataNetworkController dnc = mPhone.getDataNetworkController();
        // ignore the report when no existing network request
        if (!dnc.isCapabilityRequestExisting(DataUtils.apnTypeToNetworkCapability(apnType))) return;
        SlidingWindowEventCounter counter = mApnTypeToQnsChangeNetworkCounter.get(apnType);
        if (counter == null) {
            counter = new SlidingWindowEventCounter(
@@ -444,7 +447,7 @@ public class AccessNetworksManager extends Handler {
            reportAnomaly("QNS requested network change for "
                            + ApnSetting.getApnTypeString(apnType) + " "
                            + counter.getFrequencyString(),
                    "3e89a3df-3524-45fa-b5f2-b8911abc7d57");
                    "3e89a3df-3524-45fa-b5f2-b8911abc7d56");
        }
    }

+12 −0
Original line number Diff line number Diff line
@@ -2085,6 +2085,18 @@ public class DataNetworkController extends Handler {
        return mAllNetworkRequestList.contains(networkRequest);
    }

    /**
     * Check if a request for the capability currently exists. Note this method id not thread safe
     * so can be only called within the modules in {@link com.android.internal.telephony.data}.
     *
     * @param capability Network capability to check
     * @return {@code true} if the request for the capability exists.
     */
    public boolean isCapabilityRequestExisting(@NetCapability int capability) {
        return mAllNetworkRequestList.stream()
                .anyMatch(request -> request.hasCapability(capability));
    }

    /**
     * Check if there are existing networks having the same interface name.
     *