diff options
author | Narayan Kamath <narayan@google.com> | 2013-10-10 11:51:39 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2013-10-11 10:11:14 +0000 |
commit | 6e86fa8a6b69dfb8c8117791dc0f100b80fb616f (patch) | |
tree | 413e38aedeb4b61136f6ca8dd56332c70725614a /wifi | |
parent | 81a80651b41e3c5f46b5b28c83f564521d9119d8 (diff) | |
download | frameworks_base-6e86fa8a6b69dfb8c8117791dc0f100b80fb616f.zip frameworks_base-6e86fa8a6b69dfb8c8117791dc0f100b80fb616f.tar.gz frameworks_base-6e86fa8a6b69dfb8c8117791dc0f100b80fb616f.tar.bz2 |
Fix WifiInfo#getHiddenSSID
The method would previously always return false.
Note that this is the simplest fix, and not the most
optimal fix. That said, in this change, a call to
WifiInfo#getHiddenSSID costs the same as a call to
WifiInfo#getSSID, so it isn't that bad.
bug: 10705138
Change-Id: I980563fd8a5bafe8c58c586449e778a0aa8b58a4
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 12 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiSsid.java | 13 |
2 files changed, 9 insertions, 16 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index 5d130c6..dea0c6c 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -62,7 +62,6 @@ public class WifiInfo implements Parcelable { private String mBSSID; private WifiSsid mWifiSsid; private int mNetworkId; - private boolean mHiddenSSID; /** Received Signal Strength Indicator */ private int mRssi; @@ -86,7 +85,6 @@ public class WifiInfo implements Parcelable { mSupplicantState = SupplicantState.UNINITIALIZED; mRssi = -9999; mLinkSpeed = -1; - mHiddenSSID = false; } /** @@ -99,7 +97,6 @@ public class WifiInfo implements Parcelable { mBSSID = source.mBSSID; mWifiSsid = source.mWifiSsid; mNetworkId = source.mNetworkId; - mHiddenSSID = source.mHiddenSSID; mRssi = source.mRssi; mLinkSpeed = source.mLinkSpeed; mIpAddress = source.mIpAddress; @@ -110,8 +107,6 @@ public class WifiInfo implements Parcelable { void setSSID(WifiSsid wifiSsid) { mWifiSsid = wifiSsid; - // network is considered not hidden by default - mHiddenSSID = false; } /** @@ -244,12 +239,7 @@ public class WifiInfo implements Parcelable { * SSID-specific probe request must be used for scans. */ public boolean getHiddenSSID() { - return mHiddenSSID; - } - - /** {@hide} */ - public void setHiddenSSID(boolean hiddenSSID) { - mHiddenSSID = hiddenSSID; + return mWifiSsid.isHidden(); } /** diff --git a/wifi/java/android/net/wifi/WifiSsid.java b/wifi/java/android/net/wifi/WifiSsid.java index a35a34b..f8ba95d 100644 --- a/wifi/java/android/net/wifi/WifiSsid.java +++ b/wifi/java/android/net/wifi/WifiSsid.java @@ -16,9 +16,8 @@ package android.net.wifi; -import android.os.Parcelable; import android.os.Parcel; -import android.util.Log; +import android.os.Parcelable; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; @@ -42,7 +41,7 @@ import java.util.Locale; public class WifiSsid implements Parcelable { private static final String TAG = "WifiSsid"; - public ByteArrayOutputStream octets = new ByteArrayOutputStream(32); + public final ByteArrayOutputStream octets = new ByteArrayOutputStream(32); private static final int HEX_RADIX = 16; public static final String NONE = "<unknown ssid>"; @@ -58,7 +57,6 @@ public class WifiSsid implements Parcelable { public static WifiSsid createFromHex(String hexStr) { WifiSsid a = new WifiSsid(); - int length = 0; if (hexStr == null) return a; if (hexStr.startsWith("0x") || hexStr.startsWith("0X")) { @@ -191,8 +189,13 @@ public class WifiSsid implements Parcelable { } /** @hide */ + public boolean isHidden() { + return isArrayAllZeroes(octets.toByteArray()); + } + + /** @hide */ public byte[] getOctets() { - return octets.toByteArray(); + return octets.toByteArray(); } /** @hide */ |