Loading wifi/java/android/net/wifi/WifiStateTracker.java +27 −24 Original line number Diff line number Diff line Loading @@ -1483,18 +1483,19 @@ public class WifiStateTracker extends NetworkStateTracker { * disconnect or stop command was initiated. */ public synchronized boolean disconnectAndStop() { boolean ret = true;; if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) { // Take down any open network notifications setNotificationVisible(false, 0, false, 0); mRunState = RUN_STATE_STOPPING; if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) { return stopDriver(); ret = stopDriver(); } else { return disconnect(); ret = disconnect(); } mRunState = RUN_STATE_STOPPING; } return true; return ret; } public synchronized boolean restart() { Loading Loading @@ -1605,7 +1606,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean scan(boolean forceActive) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.scanCommand(forceActive); Loading @@ -1621,7 +1622,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setScanResultHandling(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED) { return false; } return WifiNative.setScanResultHandlingCommand(mode); Loading @@ -1635,7 +1636,7 @@ public class WifiStateTracker extends NetworkStateTracker { * 00:bb:cc:dd:cc:ff 2412 165 [WPA-EAP-TKIP][WPA2-EAP-CCMP] Net2 */ public synchronized String scanResults() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return null; } return WifiNative.scanResultsCommand(); Loading @@ -1647,7 +1648,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setScanMode(boolean isScanModeActive) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } if (mIsScanModeActive != isScanModeActive) { Loading @@ -1662,7 +1663,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean disconnect() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.disconnectCommand(); Loading @@ -1674,7 +1675,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean reconnectCommand() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.reconnectCommand(); Loading Loading @@ -1738,7 +1739,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean reassociate() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.reassociateCommand(); Loading Loading @@ -1837,7 +1838,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return RSSI value, -1 on failure */ public synchronized int getRssi() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getRssiApproxCommand(); Loading @@ -1849,7 +1850,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return RSSI value, -1 on failure */ public synchronized int getRssiApprox() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getRssiApproxCommand(); Loading @@ -1861,7 +1862,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return link speed, -1 on failure */ public synchronized int getLinkSpeed() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getLinkSpeedCommand(); Loading @@ -1873,7 +1874,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return MAC address, null on failure */ public synchronized String getMacAddress() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return null; } return WifiNative.getMacAddressCommand(); Loading @@ -1897,7 +1898,9 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean stopDriver() { if (mWifiState.get() != WIFI_STATE_ENABLED) { /* Driver stop should not happen only when supplicant event * DRIVER_STOPPED has already been handled */ if (mWifiState.get() != WIFI_STATE_ENABLED || mRunState == RUN_STATE_STOPPED) { return false; } return WifiNative.stopDriverCommand(); Loading @@ -1909,7 +1912,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean startPacketFiltering() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.startPacketFiltering(); Loading @@ -1921,7 +1924,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean stopPacketFiltering() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.stopPacketFiltering(); Loading @@ -1946,7 +1949,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setPowerMode(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.setPowerModeCommand(mode); Loading @@ -1959,7 +1962,7 @@ public class WifiStateTracker extends NetworkStateTracker { * the number of channels is invalid. */ public synchronized boolean setNumAllowedChannels() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } try { Loading @@ -1984,7 +1987,7 @@ public class WifiStateTracker extends NetworkStateTracker { * {@code numChannels} is outside the valid range. */ public synchronized boolean setNumAllowedChannels(int numChannels) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } mNumAllowedChannels = numChannels; Loading @@ -1997,7 +2000,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return channel count, -1 on failure */ public synchronized int getNumAllowedChannels() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getNumAllowedChannelsCommand(); Loading @@ -2013,7 +2016,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setBluetoothCoexistenceMode(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.setBluetoothCoexistenceModeCommand(mode); Loading @@ -2027,7 +2030,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @param isBluetoothPlaying whether to enable or disable this mode */ public synchronized void setBluetoothScanMode(boolean isBluetoothPlaying) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return; } WifiNative.setBluetoothCoexistenceScanModeCommand(isBluetoothPlaying); Loading Loading
wifi/java/android/net/wifi/WifiStateTracker.java +27 −24 Original line number Diff line number Diff line Loading @@ -1483,18 +1483,19 @@ public class WifiStateTracker extends NetworkStateTracker { * disconnect or stop command was initiated. */ public synchronized boolean disconnectAndStop() { boolean ret = true;; if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) { // Take down any open network notifications setNotificationVisible(false, 0, false, 0); mRunState = RUN_STATE_STOPPING; if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) { return stopDriver(); ret = stopDriver(); } else { return disconnect(); ret = disconnect(); } mRunState = RUN_STATE_STOPPING; } return true; return ret; } public synchronized boolean restart() { Loading Loading @@ -1605,7 +1606,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean scan(boolean forceActive) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.scanCommand(forceActive); Loading @@ -1621,7 +1622,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setScanResultHandling(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED) { return false; } return WifiNative.setScanResultHandlingCommand(mode); Loading @@ -1635,7 +1636,7 @@ public class WifiStateTracker extends NetworkStateTracker { * 00:bb:cc:dd:cc:ff 2412 165 [WPA-EAP-TKIP][WPA2-EAP-CCMP] Net2 */ public synchronized String scanResults() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return null; } return WifiNative.scanResultsCommand(); Loading @@ -1647,7 +1648,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setScanMode(boolean isScanModeActive) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } if (mIsScanModeActive != isScanModeActive) { Loading @@ -1662,7 +1663,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean disconnect() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.disconnectCommand(); Loading @@ -1674,7 +1675,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean reconnectCommand() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.reconnectCommand(); Loading Loading @@ -1738,7 +1739,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean reassociate() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.reassociateCommand(); Loading Loading @@ -1837,7 +1838,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return RSSI value, -1 on failure */ public synchronized int getRssi() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getRssiApproxCommand(); Loading @@ -1849,7 +1850,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return RSSI value, -1 on failure */ public synchronized int getRssiApprox() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getRssiApproxCommand(); Loading @@ -1861,7 +1862,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return link speed, -1 on failure */ public synchronized int getLinkSpeed() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getLinkSpeedCommand(); Loading @@ -1873,7 +1874,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return MAC address, null on failure */ public synchronized String getMacAddress() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return null; } return WifiNative.getMacAddressCommand(); Loading @@ -1897,7 +1898,9 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean stopDriver() { if (mWifiState.get() != WIFI_STATE_ENABLED) { /* Driver stop should not happen only when supplicant event * DRIVER_STOPPED has already been handled */ if (mWifiState.get() != WIFI_STATE_ENABLED || mRunState == RUN_STATE_STOPPED) { return false; } return WifiNative.stopDriverCommand(); Loading @@ -1909,7 +1912,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean startPacketFiltering() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.startPacketFiltering(); Loading @@ -1921,7 +1924,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean stopPacketFiltering() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.stopPacketFiltering(); Loading @@ -1946,7 +1949,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setPowerMode(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.setPowerModeCommand(mode); Loading @@ -1959,7 +1962,7 @@ public class WifiStateTracker extends NetworkStateTracker { * the number of channels is invalid. */ public synchronized boolean setNumAllowedChannels() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } try { Loading @@ -1984,7 +1987,7 @@ public class WifiStateTracker extends NetworkStateTracker { * {@code numChannels} is outside the valid range. */ public synchronized boolean setNumAllowedChannels(int numChannels) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } mNumAllowedChannels = numChannels; Loading @@ -1997,7 +2000,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return channel count, -1 on failure */ public synchronized int getNumAllowedChannels() { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return -1; } return WifiNative.getNumAllowedChannelsCommand(); Loading @@ -2013,7 +2016,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @return {@code true} if the operation succeeds, {@code false} otherwise */ public synchronized boolean setBluetoothCoexistenceMode(int mode) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return false; } return WifiNative.setBluetoothCoexistenceModeCommand(mode); Loading @@ -2027,7 +2030,7 @@ public class WifiStateTracker extends NetworkStateTracker { * @param isBluetoothPlaying whether to enable or disable this mode */ public synchronized void setBluetoothScanMode(boolean isBluetoothPlaying) { if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) { if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) { return; } WifiNative.setBluetoothCoexistenceScanModeCommand(isBluetoothPlaying); Loading