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

Commit df3edc4d authored by Jack Yu's avatar Jack Yu
Browse files

Fail handover request if source data connection not in correct state

We should fail the handover request if the source data connection
is not in the right state. This can prevent sending unnecessary
handvoer requests to the modem.

Bug: 139702206
Test: Telephony sanity tests
Merged-In: Id28d6a57583c9ccb5cdc381ab7a2bfdc31752035
Change-Id: Id28d6a57583c9ccb5cdc381ab7a2bfdc31752035
(cherry picked from commit 782f5cde)
parent c292b197
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import com.android.internal.telephony.dataconnection.DcTracker.RequestNetworkTyp
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.nano.TelephonyProto.RilDataCall;
import com.android.internal.util.AsyncChannel;
import com.android.internal.util.CollectionUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Protocol;
import com.android.internal.util.State;
@@ -684,19 +685,26 @@ public class DataConnection extends StateMachine {
                return DataFailCause.HANDOVER_FAILED;
            }

            linkProperties = dc.getLinkProperties();
            // Preserve the potential network agent from the source data connection. The ownership
            // is not transferred at this moment.
            mHandoverLocalLog.log("Handover started. Preserved the agent.");
            mHandoverSourceNetworkAgent = dc.getNetworkAgent();
            log("Get the handover source network agent: " + mHandoverSourceNetworkAgent);
            dc.setHandoverState(HANDOVER_STATE_BEING_TRANSFERRED);
            if (linkProperties == null) {
            if (mHandoverSourceNetworkAgent == null) {
                loge("Cannot get network agent from the source dc " + dc.getName());
                return DataFailCause.HANDOVER_FAILED;
            }

            linkProperties = dc.getLinkProperties();
            if (linkProperties == null || CollectionUtils.isEmpty(
                    linkProperties.getLinkAddresses())) {
                loge("connect: Can't find link properties of handover data connection. dc="
                        + dc);
                return DataFailCause.HANDOVER_FAILED;
            }

            mHandoverLocalLog.log("Handover started. Preserved the agent.");
            log("Get the handover source network agent: " + mHandoverSourceNetworkAgent);

            dc.setHandoverState(HANDOVER_STATE_BEING_TRANSFERRED);
            reason = DataService.REQUEST_REASON_HANDOVER;
        }