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

Commit 8a7f6e5a authored by Stuart Scott's avatar Stuart Scott Committed by Android (Google) Code Review
Browse files

Merge "Better matching of PCO data to DataConnections" into nyc-mr1-dev

parents 6e457cb2 cda5b321
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -418,12 +418,10 @@ public class ApnContext {
            } else {
                mLocalLogs.add(log);
                mNetworkRequests.add(networkRequest);
                if (mNetworkRequests.size() == 1) {
                mDcTracker.setEnabled(apnIdForApnName(mApnType), true);
            }
        }
    }
    }

    public void releaseNetwork(NetworkRequest networkRequest, LocalLog log) {
        synchronized (mRefCountLock) {
+56 −23
Original line number Diff line number Diff line
@@ -2961,10 +2961,11 @@ public class DcTracker extends Handler {
                if (Build.IS_DEBUGGABLE) {
                    // adb shell setprop persist.radio.test.pco [pco_val]
                    String radioTestProperty = "persist.radio.test.pco";
                    int pcoVal = SystemProperties.getInt(radioTestProperty, 0);
                    int pcoVal = SystemProperties.getInt(radioTestProperty, -1);
                    if (pcoVal != -1) {
                        log("PCO testing: read pco value from persist.radio.test.pco " + pcoVal);
                    final byte[] value = new byte[4];
                    java.nio.ByteBuffer.wrap(value).putInt(pcoVal);
                        final byte[] value = new byte[1];
                        value[0] = (byte) pcoVal;
                        final Intent intent =
                                new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                        intent.putExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY, "default");
@@ -2974,6 +2975,7 @@ public class DcTracker extends Handler {
                        mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);
                    }
                }
            }
        } else {
            cause = (DcFailCause) (ar.result);
            if (DBG) {
@@ -4517,11 +4519,41 @@ public class DcTracker extends Handler {
            return;
        }
        PcoData pcoData = (PcoData)(ar.result);
        DataConnection dc = mDcc.getActiveDcByCid(pcoData.cid);
        if (dc == null || dc.mApnContexts.size() == 0) {
            Rlog.e(LOG_TAG, "PCO_DATA for unknown cid: " + pcoData.cid);
        ArrayList<DataConnection> dcList = new ArrayList<>();
        DataConnection temp = mDcc.getActiveDcByCid(pcoData.cid);
        if (temp != null) {
            dcList.add(temp);
        }
        if (dcList.size() == 0) {
            Rlog.e(LOG_TAG, "PCO_DATA for unknown cid: " + pcoData.cid + ", inferring");
            for (DataConnection dc : mDataConnections.values()) {
                final int cid = dc.getCid();
                if (cid == pcoData.cid) {
                    if (VDBG) Rlog.d(LOG_TAG, "  found " + dc);
                    dcList.clear();
                    dcList.add(dc);
                    break;
                }
                // check if this dc is still connecting
                if (cid == -1) {
                    for (ApnContext apnContext : dc.mApnContexts.keySet()) {
                        if (apnContext.getState() == DctConstants.State.CONNECTING) {
                            if (VDBG) Rlog.d(LOG_TAG, "  found potential " + dc);
                            dcList.add(dc);
                            break;
                        }
                    }
                }
            }
        }
        if (dcList.size() == 0) {
            Rlog.e(LOG_TAG, "PCO_DATA - couldn't infer cid");
            return;
        }
        for (DataConnection dc : dcList) {
            if (dc.mApnContexts.size() == 0) {
                break;
            }
            // send one out for each apn type in play
            for (ApnContext apnContext : dc.mApnContexts.keySet()) {
                String apnType = apnContext.getApnType();
@@ -4534,6 +4566,7 @@ public class DcTracker extends Handler {
                mPhone.getCarrierSignalAgent().notifyCarrierSignalReceivers(intent);
            }
        }
    }

    /**
     * Data-Stall