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

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

Merge "Removed IWLAN legacy mode support"

parents 3a3263b1 d8d3ed41
Loading
Loading
Loading
Loading
+12 −53
Original line number Diff line number Diff line
@@ -665,7 +665,7 @@ public class ServiceStateTracker extends Handler {

        mAccessNetworksManager = mPhone.getAccessNetworksManager();
        mOutOfServiceSS = new ServiceState();
        mOutOfServiceSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
        mOutOfServiceSS.setOutOfService(false);

        for (int transportType : mAccessNetworksManager.getAvailableTransports()) {
            mRegStateManagers.append(transportType, new NetworkRegistrationManager(
@@ -766,9 +766,9 @@ public class ServiceStateTracker extends Handler {
        }

        mSS = new ServiceState();
        mSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
        mSS.setOutOfService(false);
        mNewSS = new ServiceState();
        mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
        mNewSS.setOutOfService(false);
        mLastCellInfoReqTime = 0;
        mLastCellInfoList = null;
        mStartedGprsRegCheck = false;
@@ -3300,7 +3300,7 @@ public class ServiceStateTracker extends Handler {
                nri = mNewSS.getNetworkRegistrationInfo(
                        NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
                mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
                mNewSS.setOutOfService(false);
                // Add the IWLAN registration info back to service state.
                if (nri != null) {
                    mNewSS.addNetworkRegistrationInfo(nri);
@@ -3317,7 +3317,7 @@ public class ServiceStateTracker extends Handler {
                nri = mNewSS.getNetworkRegistrationInfo(
                        NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
                mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), true);
                mNewSS.setOutOfService(true);
                // Add the IWLAN registration info back to service state.
                if (nri != null) {
                    mNewSS.addNetworkRegistrationInfo(nri);
@@ -3444,14 +3444,10 @@ public class ServiceStateTracker extends Handler {
                mSS.getState() == ServiceState.STATE_POWER_OFF
                        && mNewSS.getState() != ServiceState.STATE_POWER_OFF;

        SparseBooleanArray hasDataAttached = new SparseBooleanArray(
                mAccessNetworksManager.getAvailableTransports().length);
        SparseBooleanArray hasDataDetached = new SparseBooleanArray(
                mAccessNetworksManager.getAvailableTransports().length);
        SparseBooleanArray hasRilDataRadioTechnologyChanged = new SparseBooleanArray(
                mAccessNetworksManager.getAvailableTransports().length);
        SparseBooleanArray hasDataRegStateChanged = new SparseBooleanArray(
                mAccessNetworksManager.getAvailableTransports().length);
        SparseBooleanArray hasDataAttached = new SparseBooleanArray();
        SparseBooleanArray hasDataDetached = new SparseBooleanArray();
        SparseBooleanArray hasRilDataRadioTechnologyChanged = new SparseBooleanArray();
        SparseBooleanArray hasDataRegStateChanged = new SparseBooleanArray();
        boolean anyDataRegChanged = false;
        boolean anyDataRatChanged = false;
        boolean hasAlphaRawChanged =
@@ -3640,7 +3636,7 @@ public class ServiceStateTracker extends Handler {
        ServiceState oldMergedSS = new ServiceState(mPhone.getServiceState());
        mSS = new ServiceState(mNewSS);

        mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
        mNewSS.setOutOfService(false);

        mCellIdentity = primaryCellIdentity;
        if (mSS.getState() == ServiceState.STATE_IN_SERVICE && primaryCellIdentity != null) {
@@ -5513,8 +5509,7 @@ public class ServiceStateTracker extends Handler {
    }

    /**
     * This method adds IWLAN registration info for legacy mode devices camped on IWLAN. It also
     * makes some adjustments when the device camps on IWLAN in airplane mode.
     * This method makes some adjustments when the device camps on IWLAN in airplane mode.
     */
    private void processIwlanRegistrationInfo() {
        if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_OFF) {
@@ -5528,7 +5523,7 @@ public class ServiceStateTracker extends Handler {
            }
            // operator info should be kept in SS
            String operator = mNewSS.getOperatorAlphaLong();
            mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), true);
            mNewSS.setOutOfService(true);
            if (resetIwlanRatVal) {
                mNewSS.setDataRegState(ServiceState.STATE_IN_SERVICE);
                NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
@@ -5538,17 +5533,6 @@ public class ServiceStateTracker extends Handler {
                        .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
                        .build();
                mNewSS.addNetworkRegistrationInfo(nri);
                if (mAccessNetworksManager.isInLegacyMode()) {
                    // If in legacy mode, simulate the behavior that IWLAN registration info
                    // is reported through WWAN transport.
                    nri = new NetworkRegistrationInfo.Builder()
                            .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                            .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                            .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
                            .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
                            .build();
                    mNewSS.addNetworkRegistrationInfo(nri);
                }
                mNewSS.setOperatorAlphaLong(operator);
                // Since it's in airplane mode, cellular must be out of service. The only possible
                // transport for data to go through is the IWLAN transport. Setting this to true
@@ -5558,31 +5542,6 @@ public class ServiceStateTracker extends Handler {
            }
            return;
        }

        // If the device operates in legacy mode and camps on IWLAN, modem reports IWLAN as a RAT
        // through WWAN registration info. To be consistent with the behavior with AP-assisted mode,
        // we manually make a WLAN registration info for clients to consume. In this scenario,
        // both WWAN and WLAN registration info are the IWLAN registration info and that's the
        // unfortunate limitation we have when the device operates in legacy mode. In AP-assisted
        // mode, the WWAN registration will correctly report the actual cellular registration info
        // when the device camps on IWLAN.
        if (mAccessNetworksManager.isInLegacyMode()) {
            NetworkRegistrationInfo wwanNri = mNewSS.getNetworkRegistrationInfo(
                    NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
            if (wwanNri != null && wwanNri.getAccessNetworkTechnology()
                    == TelephonyManager.NETWORK_TYPE_IWLAN) {
                NetworkRegistrationInfo wlanNri = new NetworkRegistrationInfo.Builder()
                        .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                        .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                        .setRegistrationState(wwanNri.getInitialRegistrationState())
                        .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
                        .setRejectCause(wwanNri.getRejectCause())
                        .setEmergencyOnly(wwanNri.isEmergencyEnabled())
                        .setAvailableServices(wwanNri.getAvailableServices())
                        .build();
                mNewSS.addNetworkRegistrationInfo(wlanNri);
            }
        }
    }

    /**
+15 −90
Original line number Diff line number Diff line
@@ -16,12 +16,9 @@

package com.android.internal.telephony.data;

import static android.telephony.TelephonyManager.HAL_SERVICE_DATA;

import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringDef;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -36,7 +33,6 @@ import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
@@ -58,14 +54,11 @@ import android.util.LocalLog;
import android.util.SparseArray;

import com.android.internal.telephony.Phone;
import com.android.internal.telephony.RIL;
import com.android.internal.telephony.SlidingWindowEventCounter;
import com.android.telephony.Rlog;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -83,35 +76,6 @@ import java.util.stream.Collectors;
 */
public class AccessNetworksManager extends Handler {
    private static final boolean DBG = false;
    public static final String SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE =
            "ro.telephony.iwlan_operation_mode";

    @Retention(RetentionPolicy.SOURCE)
    @StringDef(prefix = {"IWLAN_OPERATION_MODE_"},
            value = {
                    IWLAN_OPERATION_MODE_DEFAULT,
                    IWLAN_OPERATION_MODE_LEGACY,
                    IWLAN_OPERATION_MODE_AP_ASSISTED})
    public @interface IwlanOperationMode {}

    /**
     * IWLAN default mode. On device that has IRadio 1.4 or above, it means
     * {@link #IWLAN_OPERATION_MODE_AP_ASSISTED}. On device that has IRadio 1.3 or below, it means
     * {@link #IWLAN_OPERATION_MODE_LEGACY}.
     */
    public static final String IWLAN_OPERATION_MODE_DEFAULT = "default";

    /**
     * IWLAN legacy mode. IWLAN is completely handled by the modem, and when the device is on
     * IWLAN, modem reports IWLAN as a RAT.
     */
    public static final String IWLAN_OPERATION_MODE_LEGACY = "legacy";

    /**
     * IWLAN application processor assisted mode. IWLAN is handled by the bound IWLAN data service
     * and network service separately.
     */
    public static final String IWLAN_OPERATION_MODE_AP_ASSISTED = "AP-assisted";

    /**
     * The counters to detect frequent QNS attempt to change preferred network transport by ApnType.
@@ -368,14 +332,6 @@ public class AccessNetworksManager extends Handler {
                Context.CARRIER_CONFIG_SERVICE);
        mLogTag = "ANM-" + mPhone.getPhoneId();
        mApnTypeToQnsChangeNetworkCounter = new SparseArray<>();

        if (isInLegacyMode()) {
            log("operates in legacy mode.");
            // For legacy mode, WWAN is the only transport to handle all data connections, even
            // the IWLAN ones.
            mAvailableTransports = new int[]{AccessNetworkConstants.TRANSPORT_TYPE_WWAN};
        } else {
            log("operates in AP-assisted mode.");
        mAvailableTransports = new int[]{AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                AccessNetworkConstants.TRANSPORT_TYPE_WLAN};
        IntentFilter intentFilter = new IntentFilter();
@@ -389,7 +345,6 @@ public class AccessNetworksManager extends Handler {
            loge("Package name not found: ", e);
        }
        bindQualifiedNetworksService();
        }

        // Using post to delay the registering because data retry manager and data config
        // manager instances are created later than access networks manager.
@@ -492,8 +447,7 @@ public class AccessNetworksManager extends Handler {
    /**
     * Get the qualified network service package.
     *
     * @return package name of the qualified networks service package. Return empty string when in
     * legacy mode (i.e. Dedicated IWLAN data/network service is not supported).
     * @return package name of the qualified networks service package.
     */
    private String getQualifiedNetworksServicePackageName() {
        // Read package name from the resource
@@ -570,30 +524,9 @@ public class AccessNetworksManager extends Handler {
    }

    /**
     * @return {@code true} if the device operates in legacy mode, otherwise {@code false}.
     * @return The available transports.
     */
    public boolean isInLegacyMode() {
        // Get IWLAN operation mode from the system property. If the system property is configured
        // to default or not configured, the mode is tied to IRadio version. For 1.4 or above, it's
        // AP-assisted mode, for 1.3 or below, it's legacy mode.
        String mode = SystemProperties.get(SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE);

        if (mode.equals(IWLAN_OPERATION_MODE_AP_ASSISTED)) {
            return false;
        } else if (mode.equals(IWLAN_OPERATION_MODE_LEGACY)) {
            return true;
        }

        return mPhone.getHalVersion(HAL_SERVICE_DATA).less(RIL.RADIO_HAL_VERSION_1_4);
    }

    /**
     * @return The available transports. Note that on legacy devices, the only available transport
     * would be WWAN only. If the device is configured as AP-assisted mode, the available transport
     * will always be WWAN and WLAN (even if the device is not camped on IWLAN).
     * See {@link #isInLegacyMode()} for mode details.
     */
    public synchronized @NonNull int[] getAvailableTransports() {
    public @NonNull int[] getAvailableTransports() {
        return mAvailableTransports;
    }

@@ -628,11 +561,6 @@ public class AccessNetworksManager extends Handler {
     * @return The preferred transport.
     */
    public @TransportType int getPreferredTransport(@ApnType int apnType) {
        // In legacy mode, always preferred on cellular.
        if (isInLegacyMode()) {
            return AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
        }

        return mPreferredTransports.get(apnType) == null
                ? AccessNetworkConstants.TRANSPORT_TYPE_WWAN : mPreferredTransports.get(apnType);
    }
@@ -735,9 +663,6 @@ public class AccessNetworksManager extends Handler {
        }

        pw.decreaseIndent();
        pw.println("isInLegacy=" + isInLegacyMode());
        pw.println("IWLAN operation mode="
                + SystemProperties.get(SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE));
        pw.println("Local logs=");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
+3 −2
Original line number Diff line number Diff line
@@ -898,8 +898,9 @@ public class DataNetwork extends StateMachine {
        mDataAllowedReason = dataAllowedReason;
        dataProfile.setLastSetupTimestamp(SystemClock.elapsedRealtime());
        mAttachedNetworkRequestList.addAll(networkRequestList);
        mCid.put(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, INVALID_CID);
        mCid.put(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, INVALID_CID);
        for (int transportType : mAccessNetworksManager.getAvailableTransports()) {
            mCid.put(transportType, INVALID_CID);
        }
        mTcpBufferSizes = mDataConfigManager.getDefaultTcpConfigString();
        mTelephonyDisplayInfo = mPhone.getDisplayInfoController().getTelephonyDisplayInfo();

+8 −12
Original line number Diff line number Diff line
@@ -780,13 +780,11 @@ public class DataNetworkController extends Handler {
        log("DataNetworkController created.");

        mAccessNetworksManager = phone.getAccessNetworksManager();
        mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                new DataServiceManager(mPhone, looper, AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
        if (!mAccessNetworksManager.isInLegacyMode()) {
            mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WLAN,
                    new DataServiceManager(mPhone, looper,
                            AccessNetworkConstants.TRANSPORT_TYPE_WLAN));
        for (int transport : mAccessNetworksManager.getAvailableTransports()) {
            mDataServiceManagers.put(transport, new DataServiceManager(mPhone, looper,
                    AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
        }

        mDataConfigManager = new DataConfigManager(mPhone, looper);

        // ========== Anomaly counters ==========
@@ -989,12 +987,10 @@ public class DataNetworkController extends Handler {
        mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .registerForServiceBindingChanged(this, EVENT_DATA_SERVICE_BINDING_CHANGED);

        if (!mAccessNetworksManager.isInLegacyMode()) {
        mPhone.getServiceStateTracker().registerForServiceStateChanged(this,
                EVENT_SERVICE_STATE_CHANGED, null);
        mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                .registerForServiceBindingChanged(this, EVENT_DATA_SERVICE_BINDING_CHANGED);
        }

        mPhone.getContext().getSystemService(TelephonyRegistryManager.class)
                .addOnSubscriptionsChangedListener(new OnSubscriptionsChangedListener() {
+3 −4
Original line number Diff line number Diff line
@@ -958,10 +958,9 @@ public class DataRetryManager extends Handler {
                DataRetryManager.this.onCarrierConfigUpdated();
            }
        });
        mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .registerForApnUnthrottled(this, EVENT_DATA_PROFILE_UNTHROTTLED);
        if (!mPhone.getAccessNetworksManager().isInLegacyMode()) {
            mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)

        for (int transport : mPhone.getAccessNetworksManager().getAvailableTransports()) {
            mDataServiceManagers.get(transport)
                    .registerForApnUnthrottled(this, EVENT_DATA_PROFILE_UNTHROTTLED);
        }
        mDataProfileManager.registerCallback(new DataProfileManagerCallback(this::post) {
Loading