am: 2dbac6c
* commit '2dbac6cee58c343682ebf6590ae170c2acd067e4':
Update scan and last network info in the WorkThread
Change-Id: I1068111b96b907f9f3c839fc497e9d06e1254d26
This commit is contained in:
@@ -504,20 +504,7 @@ public class WifiTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateWifiState(int state) {
|
private void updateWifiState(int state) {
|
||||||
if (state == WifiManager.WIFI_STATE_ENABLED) {
|
mWorkHandler.obtainMessage(WorkHandler.MSG_UPDATE_WIFI_STATE, state, 0).sendToTarget();
|
||||||
if (mScanner != null) {
|
|
||||||
// We only need to resume if mScanner isn't null because
|
|
||||||
// that means we want to be scanning.
|
|
||||||
mScanner.resume();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mLastInfo = null;
|
|
||||||
mLastNetworkInfo = null;
|
|
||||||
if (mScanner != null) {
|
|
||||||
mScanner.pause();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mMainHandler.obtainMessage(MainHandler.MSG_WIFI_STATE_CHANGED, state, 0).sendToTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AccessPoint> getCurrentAccessPoints(Context context, boolean includeSaved,
|
public static List<AccessPoint> getCurrentAccessPoints(Context context, boolean includeSaved,
|
||||||
@@ -609,6 +596,7 @@ public class WifiTracker {
|
|||||||
private static final int MSG_UPDATE_ACCESS_POINTS = 0;
|
private static final int MSG_UPDATE_ACCESS_POINTS = 0;
|
||||||
private static final int MSG_UPDATE_NETWORK_INFO = 1;
|
private static final int MSG_UPDATE_NETWORK_INFO = 1;
|
||||||
private static final int MSG_RESUME = 2;
|
private static final int MSG_RESUME = 2;
|
||||||
|
private static final int MSG_UPDATE_WIFI_STATE = 3;
|
||||||
|
|
||||||
public WorkHandler(Looper looper) {
|
public WorkHandler(Looper looper) {
|
||||||
super(looper);
|
super(looper);
|
||||||
@@ -626,6 +614,23 @@ public class WifiTracker {
|
|||||||
case MSG_RESUME:
|
case MSG_RESUME:
|
||||||
handleResume();
|
handleResume();
|
||||||
break;
|
break;
|
||||||
|
case MSG_UPDATE_WIFI_STATE:
|
||||||
|
if (msg.arg1 == WifiManager.WIFI_STATE_ENABLED) {
|
||||||
|
if (mScanner != null) {
|
||||||
|
// We only need to resume if mScanner isn't null because
|
||||||
|
// that means we want to be scanning.
|
||||||
|
mScanner.resume();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mLastInfo = null;
|
||||||
|
mLastNetworkInfo = null;
|
||||||
|
if (mScanner != null) {
|
||||||
|
mScanner.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mMainHandler.obtainMessage(MainHandler.MSG_WIFI_STATE_CHANGED, msg.arg1, 0)
|
||||||
|
.sendToTarget();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user