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

Commit 578bb132 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed the data switch issue" into main

parents 0447b4b0 e3515e45
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -1394,9 +1394,15 @@ public class DataNetwork extends StateMachine {
                }
                case EVENT_DETACH_ALL_NETWORK_REQUESTS: {
                    for (TelephonyNetworkRequest networkRequest : mAttachedNetworkRequestList) {
                        networkRequest.setState(TelephonyNetworkRequest.REQUEST_STATE_UNSATISFIED);
                        // Check if the network request still belongs to this network, because
                        // during data switch, the network request can be attached to other network
                        // on a different SIM.
                        if (networkRequest.getAttachedNetwork() == DataNetwork.this) {
                            networkRequest.setState(
                                    TelephonyNetworkRequest.REQUEST_STATE_UNSATISFIED);
                            networkRequest.setAttachedNetwork(null);
                        }
                    }
                    log("All network requests detached.");
                    mAttachedNetworkRequestList.clear();
                    break;
@@ -2141,14 +2147,19 @@ public class DataNetwork extends StateMachine {
    private void onDetachNetworkRequest(@NonNull TelephonyNetworkRequest networkRequest,
            boolean shouldRetry) {
        mAttachedNetworkRequestList.remove(networkRequest);
        // Check if the network request still belongs to this network, because
        // during data switch, the network request can be attached to other network
        // on a different SIM.
        if (networkRequest.getAttachedNetwork() == DataNetwork.this) {
            networkRequest.setState(TelephonyNetworkRequest.REQUEST_STATE_UNSATISFIED);
            networkRequest.setAttachedNetwork(null);

            if (shouldRetry) {
                // Inform DataNetworkController that a network request was detached and should be
                // scheduled to retry.
            mDataNetworkCallback.invokeFromExecutor(
                    () -> mDataNetworkCallback.onRetryUnsatisfiedNetworkRequest(networkRequest));
                mDataNetworkCallback.invokeFromExecutor(() ->
                        mDataNetworkCallback.onRetryUnsatisfiedNetworkRequest(networkRequest));
            }
        }

        if (mAttachedNetworkRequestList.isEmpty()) {