android wifi RSSI达到阈值自动断开

设置wifi的RSSI达到阈值之后自动断开。

wifi状态改变,会更新状态栏,在状态栏中更改。

--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
@@ -106,6 +106,13 @@ public class WifiSignalController extends
         mCurrentState.ssid = mWifiTracker.ssid;
         mCurrentState.rssi = mWifiTracker.rssi;
         mCurrentState.level = mWifiTracker.level;
+               if (mCurrentState.connected && mCurrentState.rssi < -80)
+                       mWifiManager.disconnect();
         notifyListenersIfNecessary();
     } 

2018-6-14

posted @ 2018-06-14 17:02  SuperTao1024  阅读(2548)  评论(2编辑  收藏  举报