diff options
-rw-r--r-- | services/java/com/android/server/WifiService.java | 20 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 8 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 15 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 100 |
4 files changed, 43 insertions, 100 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 59846b9..9f8557f 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -362,11 +362,10 @@ public class WifiService extends IWifiManager.Stub { /** * see {@link android.net.wifi.WifiManager#startScan()} - * @return {@code true} if the operation succeeds */ - public boolean startScan(boolean forceActive) { + public void startScan(boolean forceActive) { enforceChangePermission(); - return mWifiStateMachine.startScan(forceActive); + mWifiStateMachine.startScan(forceActive); } private void enforceAccessPermission() { @@ -528,29 +527,26 @@ public class WifiService extends IWifiManager.Stub { /** * see {@link android.net.wifi.WifiManager#disconnect()} - * @return {@code true} if the operation succeeds */ - public boolean disconnect() { + public void disconnect() { enforceChangePermission(); - return mWifiStateMachine.disconnectCommand(); + mWifiStateMachine.disconnectCommand(); } /** * see {@link android.net.wifi.WifiManager#reconnect()} - * @return {@code true} if the operation succeeds */ - public boolean reconnect() { + public void reconnect() { enforceChangePermission(); - return mWifiStateMachine.reconnectCommand(); + mWifiStateMachine.reconnectCommand(); } /** * see {@link android.net.wifi.WifiManager#reassociate()} - * @return {@code true} if the operation succeeds */ - public boolean reassociate() { + public void reassociate() { enforceChangePermission(); - return mWifiStateMachine.reassociateCommand(); + mWifiStateMachine.reassociateCommand(); } /** diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index cd07f0e..1913fa0 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -40,15 +40,15 @@ interface IWifiManager boolean pingSupplicant(); - boolean startScan(boolean forceActive); + void startScan(boolean forceActive); List<ScanResult> getScanResults(); - boolean disconnect(); + void disconnect(); - boolean reconnect(); + void reconnect(); - boolean reassociate(); + void reassociate(); WifiInfo getConnectionInfo(); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 9156358..21671f1 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -524,7 +524,8 @@ public class WifiManager { */ public boolean disconnect() { try { - return mService.disconnect(); + mService.disconnect(); + return true; } catch (RemoteException e) { return false; } @@ -538,7 +539,8 @@ public class WifiManager { */ public boolean reconnect() { try { - return mService.reconnect(); + mService.reconnect(); + return true; } catch (RemoteException e) { return false; } @@ -552,7 +554,8 @@ public class WifiManager { */ public boolean reassociate() { try { - return mService.reassociate(); + mService.reassociate(); + return true; } catch (RemoteException e) { return false; } @@ -581,7 +584,8 @@ public class WifiManager { */ public boolean startScan() { try { - return mService.startScan(false); + mService.startScan(false); + return true; } catch (RemoteException e) { return false; } @@ -599,7 +603,8 @@ public class WifiManager { */ public boolean startScanActive() { try { - return mService.startScan(true); + mService.startScan(true); + return true; } catch (RemoteException e) { return false; } diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 360b642..1a5492d 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -495,9 +495,9 @@ public class WifiStateMachine extends HierarchicalStateMachine { /** * TODO: doc */ - public boolean startScan(boolean forceActive) { - return sendSyncMessage(obtainMessage(CMD_START_SCAN, forceActive ? - SCAN_ACTIVE : SCAN_PASSIVE, 0)).boolValue; + public void startScan(boolean forceActive) { + sendMessage(obtainMessage(CMD_START_SCAN, forceActive ? + SCAN_ACTIVE : SCAN_PASSIVE, 0)); } /** @@ -642,22 +642,22 @@ public class WifiStateMachine extends HierarchicalStateMachine { /** * Disconnect from Access Point */ - public boolean disconnectCommand() { - return sendSyncMessage(CMD_DISCONNECT).boolValue; + public void disconnectCommand() { + sendMessage(CMD_DISCONNECT); } /** * Initiate a reconnection to AP */ - public boolean reconnectCommand() { - return sendSyncMessage(CMD_RECONNECT).boolValue; + public void reconnectCommand() { + sendMessage(CMD_RECONNECT); } /** * Initiate a re-association to AP */ - public boolean reassociateCommand() { - return sendSyncMessage(CMD_REASSOCIATE).boolValue; + public void reassociateCommand() { + sendMessage(CMD_REASSOCIATE); } /** @@ -2056,10 +2056,6 @@ public class WifiStateMachine extends HierarchicalStateMachine { switch (message.what) { /* Synchronous call returns */ case CMD_PING_SUPPLICANT: - case CMD_START_SCAN: - case CMD_DISCONNECT: - case CMD_RECONNECT: - case CMD_REASSOCIATE: case CMD_REMOVE_NETWORK: case CMD_ENABLE_NETWORK: case CMD_DISABLE_NETWORK: @@ -2093,6 +2089,10 @@ public class WifiStateMachine extends HierarchicalStateMachine { case CMD_STOP_DRIVER: case CMD_START_AP: case CMD_STOP_AP: + case CMD_START_SCAN: + case CMD_DISCONNECT: + case CMD_RECONNECT: + case CMD_REASSOCIATE: case CMD_RECONFIGURE_IP: case SUP_CONNECTION_EVENT: case SUP_DISCONNECTION_EVENT: @@ -2647,16 +2647,11 @@ public class WifiStateMachine extends HierarchicalStateMachine { case CMD_SET_NUM_ALLOWED_CHANNELS: case CMD_START_PACKET_FILTERING: case CMD_STOP_PACKET_FILTERING: - deferMessage(message); - break; - /* Queue the asynchronous version of these commands */ case CMD_START_SCAN: case CMD_DISCONNECT: case CMD_REASSOCIATE: case CMD_RECONNECT: - if (message.arg2 != SYNCHRONOUS_CALL) { - deferMessage(message); - } + deferMessage(message); break; default: return NOT_HANDLED; @@ -2781,16 +2776,11 @@ public class WifiStateMachine extends HierarchicalStateMachine { case CMD_SET_NUM_ALLOWED_CHANNELS: case CMD_START_PACKET_FILTERING: case CMD_STOP_PACKET_FILTERING: - deferMessage(message); - break; - /* Queue the asynchronous version of these commands */ case CMD_START_SCAN: case CMD_DISCONNECT: case CMD_REASSOCIATE: case CMD_RECONNECT: - if (message.arg2 != SYNCHRONOUS_CALL) { - deferMessage(message); - } + deferMessage(message); break; default: return NOT_HANDLED; @@ -2836,15 +2826,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { } break; case CMD_START_SCAN: - if (message.arg2 == SYNCHRONOUS_CALL) { - syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.scanCommand( - message.arg1 == SCAN_ACTIVE); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.scanCommand(message.arg1 == SCAN_ACTIVE); - } + WifiNative.scanCommand(message.arg1 == SCAN_ACTIVE); break; /* Ignore */ case CMD_DISCONNECT: @@ -2882,11 +2864,6 @@ public class WifiStateMachine extends HierarchicalStateMachine { mSupplicantStateTracker.handleEvent(stateChangeResult); break; case CMD_START_SCAN: - if (message.arg2 == SYNCHRONOUS_CALL) { - syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = true; - notifyOnMsgObject(message); - } /* We need to set scan type in completed state */ Message newMsg = obtainMessage(); newMsg.copyFrom(message); @@ -2894,34 +2871,13 @@ public class WifiStateMachine extends HierarchicalStateMachine { break; /* Do a redundant disconnect without transition */ case CMD_DISCONNECT: - if (message.arg2 == SYNCHRONOUS_CALL) { - syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.disconnectCommand(); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.disconnectCommand(); - } + WifiNative.disconnectCommand(); break; case CMD_RECONNECT: - if (message.arg2 == SYNCHRONOUS_CALL) { - syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.reconnectCommand(); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.reconnectCommand(); - } + WifiNative.reconnectCommand(); break; case CMD_REASSOCIATE: - if (message.arg2 == SYNCHRONOUS_CALL) { - syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.reassociateCommand(); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.reassociateCommand(); - } + WifiNative.reassociateCommand(); break; case CMD_CONNECT_NETWORK: int netId = message.arg1; @@ -3125,14 +3081,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { transitionTo(mDisconnectingState); break; case CMD_DISCONNECT: - if (message.arg2 == SYNCHRONOUS_CALL) { - SyncParams syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.disconnectCommand(); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.disconnectCommand(); - } + WifiNative.disconnectCommand(); transitionTo(mDisconnectingState); break; /* Ignore */ @@ -3187,14 +3136,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { if (DBG) Log.d(TAG, getName() + message.toString() + "\n"); switch (message.what) { case CMD_DISCONNECT: - if (message.arg2 == SYNCHRONOUS_CALL) { - SyncParams syncParams = (SyncParams) message.obj; - syncParams.mSyncReturn.boolValue = WifiNative.disconnectCommand(); - notifyOnMsgObject(message); - } else { - /* asynchronous handling */ - WifiNative.disconnectCommand(); - } + WifiNative.disconnectCommand(); transitionTo(mDisconnectingState); break; case CMD_RECONFIGURE_IP: |