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

Commit 8068cb8e authored by Mike J. Chen's avatar Mike J. Chen Committed by Android (Google) Code Review
Browse files

Merge "Handle always present wired ethernet interfaces at boot."

parents 9a67f261 c96a6671
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
    private Context mContext;

    private static EthernetDataTracker sInstance;
    private static String sIfaceMatch = "";
    private static String mIface = "";

    private static class InterfaceObserver extends INetworkManagementEventObserver.Stub {
@@ -96,7 +97,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
    }

    private void interfaceAdded(String iface) {
        if (!iface.matches("eth\\d"))
        if (!iface.matches(sIfaceMatch))
            return;

        Log.d(TAG, "Adding " + iface);
@@ -187,6 +188,22 @@ public class EthernetDataTracker implements NetworkStateTracker {
        } catch (RemoteException e) {
            Log.e(TAG, "Could not register InterfaceObserver " + e);
        }

        // connect to an ethernet interface that already exists
        sIfaceMatch = context.getResources().getString(
            com.android.internal.R.string.config_ethernet_iface_regex);
        try {
            final String[] ifaces = service.listInterfaces();
            for (String iface : ifaces) {
                if (iface.matches(sIfaceMatch)) {
                    mIface = iface;
                    reconnect();
                    break;
                }
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Could not get list of interfaces " + e);
        }
    }

    /**
+3 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@
    <string-array translatable="false" name="config_tether_upstream_regexs">
    </string-array>

    <!-- Regex of wired ethernet ifaces -->
    <string translatable="false" name="config_ethernet_iface_regex">eth\\d</string>

    <!-- Boolean indicating if we require the use of DUN on mobile for tethering.
         Note that this defaults to false so that if you move to a carrier that
         hasn't configured anything tethering will still work.  If you'd rather