CW on Master: Disable CaptivePortalTracker, EthernetService

BUG: 15143878

Change-Id: I6c534a28c1fcd475982ae70e7f3af69f3a219e24
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 13ad5d2..1083c4c 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -256,7 +256,10 @@
      */
     private NetworkStateTracker mNetTrackers[];
 
-    /* Handles captive portal check on a network */
+    /*
+     * Handles captive portal check on a network.
+     * Only set if device has {@link PackageManager#FEATURE_WIFI}.
+     */
     private CaptivePortalTracker mCaptivePortalTracker;
 
     /**
@@ -2337,7 +2340,9 @@
     }
 
     void systemReady() {
-        mCaptivePortalTracker = CaptivePortalTracker.makeCaptivePortalTracker(mContext, this);
+        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
+            mCaptivePortalTracker = CaptivePortalTracker.makeCaptivePortalTracker(mContext, this);
+        }
         loadGlobalProxy();
 
         synchronized(this) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 52ca098..b63bbe7 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -648,21 +648,13 @@
                 }
 
                 mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS);
-
                 mSystemServiceManager.startService(WIFI_PASSPOINT_SERVICE_CLASS);
-
                 mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
-
                 mSystemServiceManager.startService(
                             "com.android.server.wifi.WifiScanningService");
 
-                if (!isEmulator) {
+                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET)) {
                     mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
-                } else {
-                    // Don't start the Ethernet service on the emulator because
-                    // it interferes with qemu's SLIRP emulation, which uses
-                    // IPv4 over eth0. http://b/15341003 .
-                    Slog.i(TAG, "Not starting Ethernet service (emulator)");
                 }
 
                 try {