CW on Master: Disable CaptivePortalTracker, EthernetService
BUG: 15143878
Change-Id: I6c534a28c1fcd475982ae70e7f3af69f3a219e24
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f1e3b0c..625005b 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1446,6 +1446,14 @@
public static final String FEATURE_WEBVIEW = "android.software.webview";
/**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: This device supports ethernet.
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
+
+ /**
* Action to external storage service to clean out removed apps.
* @hide
*/
diff --git a/core/java/android/net/EthernetManager.java b/core/java/android/net/EthernetManager.java
index 5df4baf..608ca28 100644
--- a/core/java/android/net/EthernetManager.java
+++ b/core/java/android/net/EthernetManager.java
@@ -51,6 +51,11 @@
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
*/
public IpConfiguration getConfiguration() {
+ if (mService == null) {
+ return new IpConfiguration(IpAssignment.UNASSIGNED,
+ ProxySettings.UNASSIGNED,
+ new LinkProperties());
+ }
try {
return mService.getConfiguration();
} catch (RemoteException e) {
@@ -64,6 +69,9 @@
* Set Ethernet configuration.
*/
public void setConfiguration(IpConfiguration config) {
+ if (mService == null) {
+ return;
+ }
try {
mService.setConfiguration(config);
} catch (RemoteException e) {
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 {