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

Commit 48d69928 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I3c88dfff,I4c8a575b,Iecc9c8ce,I6303d49d

* changes:
  Cleanup DataStallRecoveryManager
  Add enterprise apn to data profile
  Retry setup after failed and preference changed
  Skip setupDataCall anomaly detection when poor signal
parents 9d7d9b64 5e1e2368
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1737,6 +1737,9 @@ public class DataNetwork extends StateMachine {
                    .map(DataUtils::apnTypeToNetworkCapability)
                    .filter(cap -> cap >= 0)
                    .forEach(builder::addCapability);
            if (apnSetting.getApnTypes().contains(ApnSetting.TYPE_ENTERPRISE)) {
                builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
            }
        }

        // If voice call is on-going, do not change MMTEL capability, which is an immutable
+18 −7
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.telephony.Annotation.NetworkType;
import android.telephony.Annotation.ValidationStatus;
import android.telephony.AnomalyReporter;
import android.telephony.CarrierConfigManager;
import android.telephony.CellSignalStrength;
import android.telephony.DataFailCause;
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.NetworkRegistrationInfo;
@@ -2452,6 +2453,11 @@ public class DataNetworkController extends Handler {
    private void trackSetupDataCallFailure(@TransportType int transport) {
        switch (transport) {
            case AccessNetworkConstants.TRANSPORT_TYPE_WWAN:
                // Skip when poor signal strength
                if (mPhone.getSignalStrength().getLevel()
                        <= CellSignalStrength.SIGNAL_STRENGTH_POOR) {
                    return;
                }
                if (mSetupDataCallWwanFailureCounter.addOccurrence()) {
                    reportAnomaly("RIL fails setup data call request "
                                    + mSetupDataCallWwanFailureCounter.getFrequencyString(),
@@ -2532,7 +2538,12 @@ public class DataNetworkController extends Handler {
                    + ". The preferred transport has switched to "
                    + AccessNetworkConstants.transportTypeToString(preferredTransport)
                    + ". " + dataSetupRetryEntry);
            // Cancel the retry since the preferred transport has already changed, but then
            // re-evaluate the unsatisfied network requests again so the new network can be brought
            // up on the new target transport later.
            dataSetupRetryEntry.setState(DataRetryEntry.RETRY_STATE_CANCELLED);
            sendMessage(obtainMessage(EVENT_REEVALUATE_UNSATISFIED_NETWORK_REQUESTS,
                    DataEvaluationReason.PREFERRED_TRANSPORT_CHANGED));
            return;
        }

@@ -2844,7 +2855,7 @@ public class DataNetworkController extends Handler {
    private void onEvaluatePreferredTransport(@NetCapability int capability) {
        int preferredTransport = mAccessNetworksManager
                .getPreferredTransportByNetworkCapability(capability);
        log("evaluatePreferredTransport: " + DataUtils.networkCapabilityToString(capability)
        log("onEvaluatePreferredTransport: " + DataUtils.networkCapabilityToString(capability)
                + " preferred on "
                + AccessNetworkConstants.transportTypeToString(preferredTransport));
        for (DataNetwork dataNetwork : mDataNetworkList) {
@@ -2852,7 +2863,7 @@ public class DataNetworkController extends Handler {
                // Check if the data network's current transport is different than from the
                // preferred transport. If it's different, then handover is needed.
                if (dataNetwork.getTransport() == preferredTransport) {
                    log("evaluatePreferredTransport:" + dataNetwork + " already on "
                    log("onEvaluatePreferredTransport:" + dataNetwork + " already on "
                            + AccessNetworkConstants.transportTypeToString(preferredTransport));
                    continue;
                }
@@ -2861,12 +2872,12 @@ public class DataNetworkController extends Handler {
                // succeeds or fails, preferred transport will be re-evaluate again. Handover will
                // be performed at that time if needed.
                if (dataNetwork.isHandoverInProgress()) {
                    log("evaluatePreferredTransport: " + dataNetwork + " handover in progress.");
                    log("onEvaluatePreferredTransport: " + dataNetwork + " handover in progress.");
                    continue;
                }

                DataEvaluation dataEvaluation = evaluateDataNetworkHandover(dataNetwork);
                log("evaluatePreferredTransport: " + dataEvaluation + ", " + dataNetwork);
                log("onEvaluatePreferredTransport: " + dataEvaluation + ", " + dataNetwork);
                if (!dataEvaluation.containsDisallowedReasons()) {
                    logl("Start handover " + dataNetwork + " to "
                            + AccessNetworkConstants.transportTypeToString(preferredTransport));
@@ -2874,7 +2885,7 @@ public class DataNetworkController extends Handler {
                } else if (dataEvaluation.containsAny(DataDisallowedReason.NOT_ALLOWED_BY_POLICY,
                        DataDisallowedReason.NOT_IN_SERVICE,
                        DataDisallowedReason.VOPS_NOT_SUPPORTED)) {
                    logl("evaluatePreferredTransport: Handover not allowed. Tear "
                    logl("onEvaluatePreferredTransport: Handover not allowed. Tear "
                            + "down " + dataNetwork + " so a new network can be setup on "
                            + AccessNetworkConstants.transportTypeToString(preferredTransport)
                            + ".");
@@ -2882,11 +2893,11 @@ public class DataNetworkController extends Handler {
                            DataNetwork.TEAR_DOWN_REASON_HANDOVER_NOT_ALLOWED);
                } else if (dataEvaluation.containsAny(DataDisallowedReason.ILLEGAL_STATE,
                        DataDisallowedReason.RETRY_SCHEDULED)) {
                    logl("evaluatePreferredTransport: Handover not allowed. " + dataNetwork
                    logl("onEvaluatePreferredTransport: Handover not allowed. " + dataNetwork
                            + " will remain on " + AccessNetworkConstants.transportTypeToString(
                                    dataNetwork.getTransport()));
                } else {
                    loge("evaluatePreferredTransport: Unexpected handover evaluation result.");
                    loge("onEvaluatePreferredTransport: Unexpected handover evaluation result.");
                }
            }
        }
+45 −2
Original line number Diff line number Diff line
@@ -198,6 +198,36 @@ public class DataProfileManager extends Handler {
        //TODO: more works needed to be done here.
    }

    /**
     * Check if there are any Enterprise APN configured by DPC and return a data profile
     * with the same.
     * @return data profile with enterprise ApnSetting if available, else null
     */
    @Nullable private DataProfile getEnterpriseDataProfile() {
        Cursor cursor = mPhone.getContext().getContentResolver().query(
                Telephony.Carriers.DPC_URI, null, null, null, null);
        if (cursor == null) {
            loge("Cannot access APN database through telephony provider.");
            return null;
        }

        DataProfile dataProfile = null;
        while (cursor.moveToNext()) {
            ApnSetting apn = ApnSetting.makeApnSetting(cursor);
            if (apn != null) {
                dataProfile = new DataProfile.Builder()
                        .setApnSetting(apn)
                        .setTrafficDescriptor(new TrafficDescriptor(apn.getApnName(), null))
                        .setPreferred(false)
                        .build();
                if (dataProfile.canSatisfy(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE)) {
                    break;
                }
            }
        }
        cursor.close();
        return dataProfile;
    }
    /**
     * Update all data profiles, including preferred data profile, and initial attach data profile.
     * Also send those profiles down to the modem if needed.
@@ -228,6 +258,20 @@ public class DataProfileManager extends Handler {
            cursor.close();
        }

        // Check if any of the profile already supports ENTERPRISE, if not, check if DPC has
        // configured one and retrieve the same.
        DataProfile dataProfile = profiles.stream()
                .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE))
                .findFirst()
                .orElse(null);
        if (dataProfile == null) {
            dataProfile = getEnterpriseDataProfile();
            if (dataProfile != null) {
                profiles.add(dataProfile);
                log("Added enterprise profile " + dataProfile);
            }
        }

        // Check if any of the profile already supports IMS, if not, add the default one.
        DataProfile dataProfile = profiles.stream()
                .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS))
@@ -565,8 +609,7 @@ public class DataProfileManager extends Handler {
        profileBuilder.setTrafficDescriptor(trafficDescriptor);

        DataProfile dataProfile = profileBuilder.build();
        log("Added a new data profile " + dataProfile + " for " + networkRequest);
        mAllDataProfiles.add(dataProfile);
        log("Created data profile " + dataProfile + " for " + networkRequest);
        return dataProfile;
    }

+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class DataStallRecoveryManager extends Handler {

    /**
     * Add the RECOVERY_ACTION_REREGISTER to align the RecoveryActions between
     * DataStallRecoveryManager and Westworld. In Android T, This action will not process because
     * DataStallRecoveryManager and atoms.proto. In Android T, This action will not process because
     * the boolean array for skip recovery action is default true in carrier config setting.
     *
     * @deprecated Do not use.
+12 −0
Original line number Diff line number Diff line
@@ -282,6 +282,18 @@ public class TelephonyNetworkRequest {
                    .map(DataUtils::networkCapabilityToApnType)
                    .filter(apnType -> apnType != ApnSetting.TYPE_NONE)
                    .collect(Collectors.toList());
            // In case of enterprise network request, the network request will have internet,
            // but APN type will not have default type as the enterprise apn should not be used
            // as default network. Ignore default type of the network request if it
            // has enterprise type as well. This will make sure the network request with
            // internet and enterprise will be satisfied with data profile with enterprise at the
            // same time default network request will not get satisfied with enterprise data
            // profile.
            // TODO b/232264746
            if (apnTypes.contains(ApnSetting.TYPE_ENTERPRISE)) {
                apnTypes.remove((Integer) ApnSetting.TYPE_DEFAULT);
            }

            return apnTypes.stream().allMatch(dataProfile.getApnSetting()::canHandleType);
        }
        return false;
Loading