From 6aecb98a627daa3f66c060ca5177a075e4e9bcca Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Fri, 9 Sep 2011 12:38:12 -0700 Subject: Make copies of NetworkInfo to give out. Otherwise we'll change it out from under those we've given it too. bug:5233462 Change-Id: Iffc886849edfa6ced3da1133f9d363e11b2733f8 --- wifi/java/android/net/wifi/WifiStateTracker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'wifi') diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index 338cb4d..33c02e1 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -160,7 +160,7 @@ public class WifiStateTracker implements NetworkStateTracker { * Fetch NetworkInfo for the network */ public NetworkInfo getNetworkInfo() { - return mNetworkInfo; + return new NetworkInfo(mNetworkInfo); } /** @@ -226,7 +226,8 @@ public class WifiStateTracker implements NetworkStateTracker { } else { mLastState = state; } - Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); + Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, + new NetworkInfo(mNetworkInfo)); msg.sendToTarget(); } else if (intent.getAction().equals(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION)) { mLinkProperties = (LinkProperties) intent.getParcelableExtra( -- cgit v1.1