From 3d923ad2394156cc067247ef247f3578828b7fef Mon Sep 17 00:00:00 2001 From: zhangshuxiao Date: Wed, 13 Jan 2016 10:35:01 +0800 Subject: [PATCH] When wifi ssid is empty, return WifiSsid.NONE Issue 199610 When WifistateMachine enter Roaming State, WifiInfo getSSID will return 0x, statusbar show "0x", because roaming State do not update WifiInfo mWifiSsid. Change-Id: I241f8e9c11dc16db26cadde133043745f2f19573 Signed-off-by: zhangshuxiao --- wifi/java/android/net/wifi/WifiInfo.java | 3 ++- wifi/java/android/net/wifi/WifiSsid.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index e25b38cc8175..c3fc9151bef8 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -320,7 +320,8 @@ public String getSSID() { if (!TextUtils.isEmpty(unicode)) { return "\"" + unicode + "\""; } else { - return mWifiSsid.getHexString(); + String hex = mWifiSsid.getHexString(); + return (hex != null) ? hex : WifiSsid.NONE; } } return WifiSsid.NONE; diff --git a/wifi/java/android/net/wifi/WifiSsid.java b/wifi/java/android/net/wifi/WifiSsid.java index f8ba95dc07de..c53cd3c6454e 100644 --- a/wifi/java/android/net/wifi/WifiSsid.java +++ b/wifi/java/android/net/wifi/WifiSsid.java @@ -205,7 +205,7 @@ public String getHexString() { for (int i = 0; i < octets.size(); i++) { out += String.format(Locale.US, "%02x", ssidbytes[i]); } - return out; + return (octets.size() > 0) ? out : null; } /** Implement the Parcelable interface {@hide} */