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

Commit be2d2aeb authored by Nathan Harold's avatar Nathan Harold
Browse files

Migrate LTE_CA flag to NRI from DSRI

-Migrate carrier aggregation info to NetworkRegistrationInfo
 from DataSpecificRegisrationInfo.
-Simplify Ratcheting logica and add ratchet support for Voice
 to report LTE_CA.

Bug: 156676862
Test: atest FrameworksTelephonyTests
Change-Id: Ie92e6d75cbabc9778a6f41570ef949b669378dfc
parent 17b05cb6
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -228,9 +228,6 @@ public class CellularNetworkService extends NetworkService {
                        (android.hardware.radio.V1_0.VoiceRegStateResult) result;
                int regState = getRegStateFromHalRegState(voiceRegState.regState);
                int networkType = ServiceState.rilRadioTechnologyToNetworkType(voiceRegState.rat);
                if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                    networkType = TelephonyManager.NETWORK_TYPE_LTE;
                }
                int reasonForDenial = voiceRegState.reasonForDenial;
                boolean emergencyOnly = isEmergencyOnly(voiceRegState.regState);
                boolean cssSupported = voiceRegState.cssSupported;
@@ -251,9 +248,6 @@ public class CellularNetworkService extends NetworkService {
                        (android.hardware.radio.V1_2.VoiceRegStateResult) result;
                int regState = getRegStateFromHalRegState(voiceRegState.regState);
                int networkType = ServiceState.rilRadioTechnologyToNetworkType(voiceRegState.rat);
                if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                    networkType = TelephonyManager.NETWORK_TYPE_LTE;
                }
                int reasonForDenial = voiceRegState.reasonForDenial;
                boolean emergencyOnly = isEmergencyOnly(voiceRegState.regState);
                boolean cssSupported = voiceRegState.cssSupported;
@@ -281,7 +275,6 @@ public class CellularNetworkService extends NetworkService {
            int regState = NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
            int reasonForDenial = 0;
            boolean isUsingCarrierAggregation = false;
            boolean emergencyOnly = false;
            int maxDataCalls = 0;
            CellIdentity cellIdentity;
@@ -355,15 +348,10 @@ public class CellularNetworkService extends NetworkService {
            List<Integer> availableServices = getAvailableServices(
                    regState, domain, emergencyOnly);

            if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                isUsingCarrierAggregation = true;
                networkType = TelephonyManager.NETWORK_TYPE_LTE;
            }

            return new NetworkRegistrationInfo(domain, transportType, regState, networkType,
                    reasonForDenial, emergencyOnly, availableServices, cellIdentity, rplmn,
                    maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable,
                    lteVopsSupportInfo, isUsingCarrierAggregation);
                    lteVopsSupportInfo);
        }

        private @NonNull NetworkRegistrationInfo getNetworkRegistrationInfo(
@@ -380,16 +368,10 @@ public class CellularNetworkService extends NetworkService {
            final String rplmn = regResult.registeredPlmn;
            final int reasonForDenial = regResult.reasonForDenial;

            // Network Type fixup for carrier aggregation
            int networkType = ServiceState.rilRadioTechnologyToNetworkType(regResult.rat);
            // In earlier versions of the HAL, LTE_CA was allowed to indicate that the device
            // is on CA; however, that has been superseded by the PHYSICAL_CHANNEL_CONFIG signal.
            // Because some vendors provide both NETWORK_TYPE_LTE_CA *and* PHYSICAL_CHANNEL_CONFIG,
            // this tweak is left for compatibility; however, the network type is no longer allowed
            // to be used to declare that carrier aggregation is in effect, because the other
            // signal provides a much richer information set, and we want to mitigate confusion in
            // how CA information is being provided.
            if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                // In Radio HAL v1.5, NETWORK_TYPE_LTE_CA is ignored. Callers should use
                // PhysicalChannelConfig.
                networkType = TelephonyManager.NETWORK_TYPE_LTE;
            }

@@ -448,7 +430,7 @@ public class CellularNetworkService extends NetworkService {
                    return new NetworkRegistrationInfo(domain, transportType, regState, networkType,
                            reasonForDenial, isEmergencyOnly, availableServices, cellIdentity,
                            rplmn, MAX_DATA_CALLS, isDcNrRestricted, isNrAvailable, isEndcAvailable,
                            vopsInfo, false /* isUsingCarrierAggregation */);
                            vopsInfo);
            }
        }

+2 −5
Original line number Diff line number Diff line
@@ -136,9 +136,6 @@ public class RatRatcheter {

        updateBandwidths(oldSS.getCellBandwidths(), newSS);

        boolean newUsingCA = oldSS.isUsingCarrierAggregation()
                || newSS.isUsingCarrierAggregation()
                || newSS.getCellBandwidths().length > 1;
        NetworkRegistrationInfo oldCsNri = oldSS.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        NetworkRegistrationInfo newCsNri = newSS.getNetworkRegistrationInfo(
@@ -148,6 +145,7 @@ public class RatRatcheter {
                    newCsNri.getAccessNetworkTechnology());
            newCsNri.setAccessNetworkTechnology(newPsNetworkType);
            newSS.addNetworkRegistrationInfo(newCsNri);
            if (oldCsNri.isUsingCarrierAggregation()) newCsNri.setIsUsingCarrierAggregation(true);
        } else if (oldCsNri.getAccessNetworkTechnology() != oldCsNri.getAccessNetworkTechnology()) {
            // resume rat ratchet on following rat change within the same location
            mVoiceRatchetEnabled = true;
@@ -162,12 +160,11 @@ public class RatRatcheter {
                    newPsNri.getAccessNetworkTechnology());
            newPsNri.setAccessNetworkTechnology(newPsNetworkType);
            newSS.addNetworkRegistrationInfo(newPsNri);
            if (oldPsNri.isUsingCarrierAggregation()) newPsNri.setIsUsingCarrierAggregation(true);
        } else if (oldPsNri.getAccessNetworkTechnology() != newPsNri.getAccessNetworkTechnology()) {
            // resume rat ratchet on following rat change within the same location
            mDataRatchetEnabled = true;
        }

        newSS.setIsUsingCarrierAggregation(newUsingCA);
    }

    private boolean isSameRatFamily(ServiceState ss1, ServiceState ss2) {
+2 −4
Original line number Diff line number Diff line
@@ -3243,10 +3243,8 @@ public class ServiceStateTracker extends Handler {
            int newRAT = newNrs != null ? newNrs.getAccessNetworkTechnology()
                    : TelephonyManager.NETWORK_TYPE_UNKNOWN;

            boolean isOldCA = oldNrs != null ? (oldNrs.getDataSpecificInfo() != null
                    ? oldNrs.getDataSpecificInfo().isUsingCarrierAggregation() : false) : false;
            boolean isNewCA = newNrs!= null ? (newNrs. getDataSpecificInfo() != null
                    ? newNrs. getDataSpecificInfo().isUsingCarrierAggregation() : false) : false;
            boolean isOldCA = oldNrs != null ? oldNrs.isUsingCarrierAggregation() : false;
            boolean isNewCA = newNrs != null ? newNrs.isUsingCarrierAggregation() : false;

            // If the carrier enable KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING and the operator name
            // match this pattern, the data rat display LteAdvanced indicator.
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ public class CellularNetworkServiceTest extends TelephonyTest {
                domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState,
                ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial,
                false, availableServices, null, "", maxDataCalls, false, false, false,
                lteVopsSupportInfo, false);
                lteVopsSupportInfo);

        try {
            verify(mCallback, timeout(1000).times(1)).onRequestNetworkRegistrationInfoComplete(
+1 −2
Original line number Diff line number Diff line
@@ -104,8 +104,7 @@ public class RatRatcheterTest extends TelephonyTest {
                false,  // isDcNrRestricted
                false,  // isNrAvailable
                false,  // isEndcAvailable
                lteVopsSupportInfo,  // lteVopsSupportInfo
                isUsingCarrierAggregation);  // isUsingCarrierAggregation
                lteVopsSupportInfo);  // lteVopsSupportInfo
    }

    private void setNetworkRegistrationInfo(ServiceState ss, int accessNetworkTechnology) {
Loading