Kill the NetworkInfo(int type) constructor. IT'S A TRAP!
This constructor does nothing, including doing nothing with its
only argument. This causes it to return a NetworkInfo for
TYPE_MOBILE no matter what was passed in.
Bug: 16610051
Change-Id: I4ccd5ec050f7824fb06496c00fcd7901defeb7bd
diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java
index d279412..7664c95 100644
--- a/core/java/android/net/NetworkInfo.java
+++ b/core/java/android/net/NetworkInfo.java
@@ -128,14 +128,6 @@
private boolean mIsAvailable;
/**
- * @param type network type
- * @deprecated
- * @hide because this constructor was only meant for internal use (and
- * has now been superseded by the package-private constructor below).
- */
- public NetworkInfo(int type) {}
-
- /**
* @hide
*/
public NetworkInfo(int type, int subtype, String typeName, String subtypeName) {
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index ef0b155..3bab1bf 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -4816,7 +4816,8 @@
result.setType(networkType);
return result;
} else {
- NetworkInfo result = new NetworkInfo(networkType);
+ NetworkInfo result = new NetworkInfo(
+ networkType, 0, ConnectivityManager.getNetworkTypeName(networkType), "");
result.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null, null);
return result;
}