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

Commit 9c1c0e03 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Don't tear down a network unnecessarily." into nyc-mr1-dev

parents 9dab89f2 76c5a947
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -915,6 +915,17 @@ public class DcTracker extends Handler {
                if (apnContext.isConnectedOrConnecting() &&
                        apnContext.getApnSetting().isMetered(mPhone.getContext(),
                        mPhone.getSubId(), mPhone.getServiceState().getDataRoaming())) {

                    final DcAsyncChannel dataConnectionAc = apnContext.getDcAc();
                    if (dataConnectionAc != null) {
                        final NetworkCapabilities nc =
                                dataConnectionAc.getNetworkCapabilitiesSync();
                        if (nc != null && nc.hasCapability(NetworkCapabilities.
                              NET_CAPABILITY_NOT_RESTRICTED)) {
                            if (DBG) log("not tearing down unrestricted metered net:" + apnContext);
                            continue;
                        }
                    }
                    if (DBG) log("tearing down restricted metered net: " + apnContext);
                    apnContext.setReason(Phone.REASON_DATA_ENABLED);
                    cleanUpConnection(true, apnContext);