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

Commit 159faa2b authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge changes Ide60679b,Ie2e41c1c,I5523f49f into tm-dev

* changes:
  Update the SignalStrengthControllerTest UT to use valid threshold
  Allowing the wrong PDN deactivation behavior on old HAL
  Switch data profile when handover
parents 60643f51 02e20131
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class DataEvaluation {
        RETRY_AFTER_DISCONNECTED,
        /** Data setup retry. */
        DATA_RETRY,
        /** Handover between IWLAN and cellular. */
        /** For handover evaluation, or for network tearing down after handover succeeds/fails. */
        DATA_HANDOVER,
        /** Preferred transport changed. */
        PREFERRED_TRANSPORT_CHANGED,
+38 −5
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RIL;
import com.android.internal.telephony.data.DataEvaluation.DataAllowedReason;
import com.android.internal.telephony.data.DataNetworkController.NetworkRequestList;
import com.android.internal.telephony.data.DataRetryManager.DataHandoverRetryEntry;
@@ -542,7 +543,13 @@ public class DataNetwork extends StateMachine {
    private @Nullable KeepaliveTracker mKeepaliveTracker;

    /** The data profile used to establish this data network. */
    private final @NonNull DataProfile mDataProfile;
    private @NonNull DataProfile mDataProfile;

    /**
     * The data profile used for data handover. Some carriers might use different data profile
     * between IWLAN and cellular. Only set before handover started.
     */
    private @Nullable DataProfile mHandoverDataProfile;

    /** The network capabilities of this data network. */
    private @NonNull NetworkCapabilities mNetworkCapabilities;
@@ -2291,6 +2298,11 @@ public class DataNetwork extends StateMachine {
            log("Remove network since deactivate request returned an error.");
            mFailCause = DataFailCause.RADIO_NOT_AVAILABLE;
            transitionTo(mDisconnectedState);
        } else if (mPhone.getHalVersion().less(RIL.RADIO_HAL_VERSION_2_0)) {
            log("Remove network on deactivate data response on old HAL "
                    + mPhone.getHalVersion());
            mFailCause = DataFailCause.LOST_CONNECTION;
            transitionTo(mDisconnectedState);
        }
    }

@@ -2872,17 +2884,35 @@ public class DataNetwork extends StateMachine {
        // state in framework, we should set this flag to true as well so the modem will not reject
        // the data call setup (because the modem actually thinks the device is roaming).
        boolean allowRoaming = mPhone.getDataRoamingEnabled()
                || (isModemRoaming && (!mPhone.getServiceState().getDataRoaming()
                /*|| isUnmeteredUseOnly()*/));
                || (isModemRoaming && (!mPhone.getServiceState().getDataRoaming()));

        mHandoverDataProfile = mDataProfile;
        int targetNetworkType = getDataNetworkType(targetTransport);
        if (targetNetworkType != TelephonyManager.NETWORK_TYPE_UNKNOWN
                && !mAttachedNetworkRequestList.isEmpty()) {
            TelephonyNetworkRequest networkRequest = mAttachedNetworkRequestList.get(0);
            DataProfile dataProfile = mDataNetworkController.getDataProfileManager()
                    .getDataProfileForNetworkRequest(networkRequest, targetNetworkType);
            // Some carriers have different profiles between cellular and IWLAN. We need to
            // dynamically switch profile, but only when those profiles have same APN name.
            if (dataProfile != null && dataProfile.getApnSetting() != null
                    && mDataProfile.getApnSetting() != null
                    && TextUtils.equals(dataProfile.getApnSetting().getApnName(),
                    mDataProfile.getApnSetting().getApnName())
                    && !dataProfile.equals(mDataProfile)) {
                mHandoverDataProfile = dataProfile;
                log("Used different data profile for handover. " + mDataProfile);
            }
        }

        logl("Start handover from " + AccessNetworkConstants.transportTypeToString(mTransport)
                + " to " + AccessNetworkConstants.transportTypeToString(targetTransport));
        // Send the handover request to the target transport data service.
        mDataServiceManagers.get(targetTransport).setupDataCall(
                DataUtils.networkTypeToAccessNetworkType(getDataNetworkType(targetTransport)),
                mDataProfile, isModemRoaming, allowRoaming,
                mHandoverDataProfile, isModemRoaming, allowRoaming,
                DataService.REQUEST_REASON_HANDOVER, mLinkProperties, mPduSessionId,
                mNetworkSliceInfo, mDataProfile.getTrafficDescriptor(), true,
                mNetworkSliceInfo, mHandoverDataProfile.getTrafficDescriptor(), true,
                obtainMessage(EVENT_HANDOVER_RESPONSE, retryEntry));
        transitionTo(mHandoverState);
    }
@@ -2911,6 +2941,9 @@ public class DataNetwork extends StateMachine {
            // Update the logging tag
            mLogTag = "DN-" + mInitialNetworkAgentId + "-"
                    + ((mTransport == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) ? "C" : "I");
            // Switch the data profile. This is no-op in most of the case since almost all carriers
            // use same data profile between IWLAN and cellular.
            mDataProfile = mHandoverDataProfile;
            updateDataNetwork(response);
            if (mTransport != AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
                // Handover from WWAN to WLAN
+10 −0
Original line number Diff line number Diff line
@@ -2700,6 +2700,11 @@ public class DataNetworkController extends Handler {
        // manager.
        sendMessage(obtainMessage(EVENT_EVALUATE_PREFERRED_TRANSPORT,
                dataNetwork.getApnTypeNetworkCapability(), 0));

        // There might be network we didn't tear down in the last evaluation due to handover in
        // progress. We should evaluate again.
        sendMessage(obtainMessage(EVENT_REEVALUATE_EXISTING_DATA_NETWORKS,
                DataEvaluationReason.DATA_HANDOVER));
    }

    /**
@@ -2720,6 +2725,11 @@ public class DataNetworkController extends Handler {
        logl("Handover failed. " + dataNetwork + ", cause=" + DataFailCause.toString(cause)
                + ", retryDelayMillis=" + retryDelayMillis + "ms, handoverFailureMode="
                + DataCallResponse.failureModeToString(handoverFailureMode));
        // There might be network we didn't tear down in the last evaluation due to handover in
        // progress. We should evaluate again.
        sendMessage(obtainMessage(EVENT_REEVALUATE_EXISTING_DATA_NETWORKS,
                DataEvaluationReason.DATA_HANDOVER));

        if (dataNetwork.getAttachedNetworkRequestList().isEmpty()) {
            log("onDataNetworkHandoverFailed: No network requests attached to " + dataNetwork
                    + ". No need to retry since the network will be torn down soon.");
+5 −5
Original line number Diff line number Diff line
@@ -589,7 +589,7 @@ public class SignalStrengthControllerTest extends TelephonyTest {
                        -139, /** csiRsrp NONE */
                        -20, /** csiRsrq NONE */
                        -23, /** CsiSinr NONE */
                        -44, /** SsRsrp SIGNAL_STRENGTH_GREAT */
                        -64, /** SsRsrp SIGNAL_STRENGTH_GREAT */
                        -20, /** SsRsrq NONE */
                        -23) /** SsSinr NONE */
        );
@@ -604,10 +604,10 @@ public class SignalStrengthControllerTest extends TelephonyTest {
        assertEquals(CellSignalStrength.SIGNAL_STRENGTH_GREAT, mSsc.getSignalStrength().getLevel());

        int[] nrSsRsrpThresholds = {
                -45, // SIGNAL_STRENGTH_POOR
                -40, // SIGNAL_STRENGTH_MODERATE
                -37, // SIGNAL_STRENGTH_GOOD
                -34,  // SIGNAL_STRENGTH_GREAT
                -110, /* SIGNAL_STRENGTH_POOR */
                -60, /* SIGNAL_STRENGTH_MODERATE */
                -55, /* SIGNAL_STRENGTH_GOOD */
                -45,  /* SIGNAL_STRENGTH_GREAT */
        };
        mBundle.putIntArray(CarrierConfigManager.KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY,
                nrSsRsrpThresholds);
+1 −1
Original line number Diff line number Diff line
@@ -745,7 +745,7 @@ public abstract class TelephonyTest {
        doReturn(true).when(mDataSettingsManager).isDataEnabled();
        doReturn(mNetworkRegistrationInfo).when(mServiceState).getNetworkRegistrationInfo(
                anyInt(), anyInt());
        doReturn(new HalVersion(1, 4)).when(mPhone).getHalVersion();
        doReturn(RIL.RADIO_HAL_VERSION_2_0).when(mPhone).getHalVersion();
        doReturn(2).when(mSignalStrength).getLevel();

        // WiFi
Loading