Loading wifi/java/android/net/wifi/WifiInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,11 @@ package android.net.wifi; import android.os.Parcelable; import android.os.Parcel; import android.net.NetworkInfo.DetailedState; import android.net.NetworkUtils; import java.net.InetAddress; import java.net.Inet6Address; import java.net.UnknownHostException; import java.util.EnumMap; /** Loading Loading @@ -61,7 +65,7 @@ public class WifiInfo implements Parcelable { public static final String LINK_SPEED_UNITS = "Mbps"; private int mLinkSpeed; private int mIpAddress; private InetAddress mIpAddress; private String mMacAddress; Loading @@ -72,7 +76,6 @@ public class WifiInfo implements Parcelable { mSupplicantState = SupplicantState.UNINITIALIZED; mRssi = -9999; mLinkSpeed = -1; mIpAddress = 0; mHiddenSSID = false; } Loading Loading @@ -172,12 +175,13 @@ public class WifiInfo implements Parcelable { mSupplicantState = state; } void setIpAddress(int address) { void setInetAddress(InetAddress address) { mIpAddress = address; } public int getIpAddress() { return mIpAddress; if (mIpAddress == null || mIpAddress instanceof Inet6Address) return 0; return NetworkUtils.inetAddressToInt(mIpAddress); } /** Loading Loading @@ -251,7 +255,12 @@ public class WifiInfo implements Parcelable { dest.writeInt(mNetworkId); dest.writeInt(mRssi); dest.writeInt(mLinkSpeed); dest.writeInt(mIpAddress); if (mIpAddress != null) { dest.writeByte((byte)1); dest.writeByteArray(mIpAddress.getAddress()); } else { dest.writeByte((byte)0); } dest.writeString(getSSID()); dest.writeString(mBSSID); dest.writeString(mMacAddress); Loading @@ -266,7 +275,11 @@ public class WifiInfo implements Parcelable { info.setNetworkId(in.readInt()); info.setRssi(in.readInt()); info.setLinkSpeed(in.readInt()); info.setIpAddress(in.readInt()); if (in.readByte() == 1) { try { info.setInetAddress(InetAddress.getByAddress(in.createByteArray())); } catch (UnknownHostException e) {} } info.setSSID(in.readString()); info.mBSSID = in.readString(); info.mMacAddress = in.readString(); Loading wifi/java/android/net/wifi/WifiNative.java +0 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package android.net.wifi; import android.net.DhcpInfo; /** * Native calls for sending requests to the supplicant daemon, and for * receiving asynchronous events. All methods of the form "xxxxCommand()" Loading wifi/java/android/net/wifi/WifiStateMachine.java +3 −3 Original line number Diff line number Diff line Loading @@ -1393,7 +1393,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { sendNetworkStateChangeBroadcast(mLastBssid); /* Reset data structures */ mWifiInfo.setIpAddress(0); mWifiInfo.setInetAddress(null); mWifiInfo.setBSSID(null); mWifiInfo.setSSID(null); mWifiInfo.setNetworkId(-1); Loading Loading @@ -2543,7 +2543,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { synchronized (mDhcpInfoInternal) { addr = NetworkUtils.numericToInetAddress(mDhcpInfoInternal.ipAddress); } mWifiInfo.setIpAddress(NetworkUtils.inetAddressToInt(addr)); mWifiInfo.setInetAddress(addr); configureLinkProperties(); if (getNetworkDetailedState() == DetailedState.CONNECTED) { sendLinkConfigurationChangedBroadcast(); Loading @@ -2556,7 +2556,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { transitionTo(mConnectedState); break; case CMD_IP_CONFIG_FAILURE: mWifiInfo.setIpAddress(0); mWifiInfo.setInetAddress(null); Log.e(TAG, "IP configuration failed"); /** Loading Loading
wifi/java/android/net/wifi/WifiInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,11 @@ package android.net.wifi; import android.os.Parcelable; import android.os.Parcel; import android.net.NetworkInfo.DetailedState; import android.net.NetworkUtils; import java.net.InetAddress; import java.net.Inet6Address; import java.net.UnknownHostException; import java.util.EnumMap; /** Loading Loading @@ -61,7 +65,7 @@ public class WifiInfo implements Parcelable { public static final String LINK_SPEED_UNITS = "Mbps"; private int mLinkSpeed; private int mIpAddress; private InetAddress mIpAddress; private String mMacAddress; Loading @@ -72,7 +76,6 @@ public class WifiInfo implements Parcelable { mSupplicantState = SupplicantState.UNINITIALIZED; mRssi = -9999; mLinkSpeed = -1; mIpAddress = 0; mHiddenSSID = false; } Loading Loading @@ -172,12 +175,13 @@ public class WifiInfo implements Parcelable { mSupplicantState = state; } void setIpAddress(int address) { void setInetAddress(InetAddress address) { mIpAddress = address; } public int getIpAddress() { return mIpAddress; if (mIpAddress == null || mIpAddress instanceof Inet6Address) return 0; return NetworkUtils.inetAddressToInt(mIpAddress); } /** Loading Loading @@ -251,7 +255,12 @@ public class WifiInfo implements Parcelable { dest.writeInt(mNetworkId); dest.writeInt(mRssi); dest.writeInt(mLinkSpeed); dest.writeInt(mIpAddress); if (mIpAddress != null) { dest.writeByte((byte)1); dest.writeByteArray(mIpAddress.getAddress()); } else { dest.writeByte((byte)0); } dest.writeString(getSSID()); dest.writeString(mBSSID); dest.writeString(mMacAddress); Loading @@ -266,7 +275,11 @@ public class WifiInfo implements Parcelable { info.setNetworkId(in.readInt()); info.setRssi(in.readInt()); info.setLinkSpeed(in.readInt()); info.setIpAddress(in.readInt()); if (in.readByte() == 1) { try { info.setInetAddress(InetAddress.getByAddress(in.createByteArray())); } catch (UnknownHostException e) {} } info.setSSID(in.readString()); info.mBSSID = in.readString(); info.mMacAddress = in.readString(); Loading
wifi/java/android/net/wifi/WifiNative.java +0 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package android.net.wifi; import android.net.DhcpInfo; /** * Native calls for sending requests to the supplicant daemon, and for * receiving asynchronous events. All methods of the form "xxxxCommand()" Loading
wifi/java/android/net/wifi/WifiStateMachine.java +3 −3 Original line number Diff line number Diff line Loading @@ -1393,7 +1393,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { sendNetworkStateChangeBroadcast(mLastBssid); /* Reset data structures */ mWifiInfo.setIpAddress(0); mWifiInfo.setInetAddress(null); mWifiInfo.setBSSID(null); mWifiInfo.setSSID(null); mWifiInfo.setNetworkId(-1); Loading Loading @@ -2543,7 +2543,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { synchronized (mDhcpInfoInternal) { addr = NetworkUtils.numericToInetAddress(mDhcpInfoInternal.ipAddress); } mWifiInfo.setIpAddress(NetworkUtils.inetAddressToInt(addr)); mWifiInfo.setInetAddress(addr); configureLinkProperties(); if (getNetworkDetailedState() == DetailedState.CONNECTED) { sendLinkConfigurationChangedBroadcast(); Loading @@ -2556,7 +2556,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { transitionTo(mConnectedState); break; case CMD_IP_CONFIG_FAILURE: mWifiInfo.setIpAddress(0); mWifiInfo.setInetAddress(null); Log.e(TAG, "IP configuration failed"); /** Loading