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

Commit c0bbfb95 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge "Migrated DataServiceManager to the new package"

parents 5ef3c085 aa2edbe7
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;
import android.util.SparseArray;

import com.android.internal.telephony.Phone;
import com.android.internal.util.State;
@@ -90,6 +91,8 @@ public class DataNetwork extends StateMachine {
    /** The current transport of the data network. Could be WWAN or WLAN. */
    private @TransportType int mTransport;

    private final @NonNull SparseArray<DataServiceManager> mDataServiceManagers;

    /** The network agent associated with this data network. */
    private final TelephonyNetworkAgent mNetworkAgent;

@@ -114,17 +117,20 @@ public class DataNetwork extends StateMachine {
     * @param phone The phone instance.
     * @param looper The looper to be used by the state machine. Currently the handler thread is the
     * phone process's main thread.
     * @param dataServiceManagers Data service managers.
     * @param transport The initial transport.
     * @param dataProfile The data profile for establishing the data network.
     */
    public DataNetwork(@NonNull Phone phone, @NonNull Looper looper, @TransportType int transport,
            @NonNull DataProfile dataProfile) {
    public DataNetwork(@NonNull Phone phone, @NonNull Looper looper,
            @NonNull SparseArray<DataServiceManager> dataServiceManagers,
            @TransportType int transport, @NonNull DataProfile dataProfile) {
        super("DataNetwork", looper);
        mPhone = phone;
        mTransport = transport;
        mLogTag = "DN-" + sId.incrementAndGet() + "-"
                + ((transport == TRANSPORT_TYPE_WWAN) ? "C" : "I");

        mDataServiceManagers = dataServiceManagers;
        mDataProfile = dataProfile;
        mNetworkAgent = new TelephonyNetworkAgent(mPhone, looper, this);

+68 −0
Original line number Diff line number Diff line
@@ -17,17 +17,24 @@
package com.android.internal.telephony.data;

import android.annotation.NonNull;
import android.annotation.StringDef;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemProperties;
import android.telephony.AccessNetworkConstants;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;
import android.util.SparseArray;

import com.android.internal.telephony.Phone;
import com.android.internal.telephony.RIL;
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.List;

@@ -36,6 +43,36 @@ import java.util.List;
 * create and manage all the mobile data networks.
 */
public class DataNetworkController extends Handler {
    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";

    private final Phone mPhone;
    private final String mLogTag;
    private final LocalLog mLocalLog = new LocalLog(128);
@@ -45,6 +82,8 @@ public class DataNetworkController extends Handler {
    private final @NonNull DataProfileManager mDataProfileManager;
    private final @NonNull DataStallMonitor mDataStallMonitor;
    private final @NonNull DataScheduler mDataScheduler;
    private final @NonNull SparseArray<DataServiceManager> mDataServiceManagers =
            new SparseArray<>();

    /**
     * The current data network list, including the ones that are connected, connecting, or
@@ -69,6 +108,13 @@ public class DataNetworkController extends Handler {
        mPhone = phone;
        mLogTag = "DNC-" + mPhone.getPhoneId();

        mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                new DataServiceManager(mPhone, looper, AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
        if (!isIwlanLegacyMode()) {
            mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WLAN,
                    new DataServiceManager(mPhone, looper,
                            AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
        }
        mDataConfigManager = new DataConfigManager(mPhone, looper);
        mDataSettingsManager = new DataSettingsManager(mPhone, looper);
        mDataProfileManager = new DataProfileManager(mPhone, looper);
@@ -88,6 +134,26 @@ public class DataNetworkController extends Handler {
        return mDataConfigManager;
    }

    /**
     * @return {@code true} if the device operates in IWLAN legacy mode, otherwise {@code false}. In
     * legacy mode, IWLAN registration state is reported through cellular
     * {@link android.telephony.NetworkRegistrationInfo}.
     */
    public boolean isIwlanLegacyMode() {
        // 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().less(RIL.RADIO_HAL_VERSION_1_4);
    }

    /**
     * Log debug messages.
     * @param s debug messages
@@ -124,6 +190,8 @@ public class DataNetworkController extends Handler {
        IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, "  ");
        pw.println(DataNetworkController.class.getSimpleName() + "-" + mPhone.getPhoneId() + ":");
        pw.increaseIndent();
        pw.println("IWLAN operation mode="
                + SystemProperties.get(SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE));
        pw.println("Current data networks:");
        pw.increaseIndent();
        for (DataNetwork dn : mDataNetworkList) {
+959 −0

File added.

Preview size limit exceeded, changes collapsed.