diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 4 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 27 |
2 files changed, 22 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 47d43aa24..82ad5b986 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -1012,6 +1012,10 @@ public class WifiConfigManager { Log.e(TAG, "Cannot add/update network with null config"); return new NetworkUpdateResult(WifiConfiguration.INVALID_NETWORK_ID); } + if (mPendingStoreRead) { + Log.e(TAG, "Cannot add/update network before store is read!"); + return new NetworkUpdateResult(WifiConfiguration.INVALID_NETWORK_ID); + } NetworkUpdateResult result = addOrUpdateNetworkInternal(config, uid); if (!result.isSuccess()) { Log.e(TAG, "Failed to add/update network " + config.getPrintableSsid()); diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index f2bda6856..b8d7e6ab6 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3677,7 +3677,24 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss BluetoothAdapter.STATE_DISCONNECTED); break; case CMD_ENABLE_NETWORK: + boolean disableOthers = message.arg2 == 1; + int netId = message.arg1; + boolean ok = mWifiConfigManager.enableNetwork( + netId, disableOthers, message.sendingUid); + if (!ok) { + messageHandlingStatus = MESSAGE_HANDLING_STATUS_FAIL; + } + replyToMessage(message, message.what, ok ? SUCCESS : FAILURE); + break; case CMD_ADD_OR_UPDATE_NETWORK: + WifiConfiguration config = (WifiConfiguration) message.obj; + NetworkUpdateResult result = + mWifiConfigManager.addOrUpdateNetwork(config, message.sendingUid); + if (!result.isSuccess()) { + messageHandlingStatus = MESSAGE_HANDLING_STATUS_FAIL; + } + replyToMessage(message, message.what, result.getNetworkId()); + break; case CMD_SAVE_CONFIG: replyToMessage(message, message.what, FAILURE); break; @@ -3702,7 +3719,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } break; case CMD_INITIALIZE: - boolean ok = mWifiNative.initializeVendorHal(mVendorHalDeathRecipient); + ok = mWifiNative.initializeVendorHal(mVendorHalDeathRecipient); replyToMessage(message, message.what, ok ? SUCCESS : FAILURE); break; case CMD_BOOT_COMPLETED: @@ -4783,14 +4800,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss mTemporarilyDisconnectWifi = false; } break; - case CMD_ADD_OR_UPDATE_NETWORK: - config = (WifiConfiguration) message.obj; - result = mWifiConfigManager.addOrUpdateNetwork(config, message.sendingUid); - if (!result.isSuccess()) { - messageHandlingStatus = MESSAGE_HANDLING_STATUS_FAIL; - } - replyToMessage(message, message.what, result.getNetworkId()); - break; case CMD_REMOVE_NETWORK: if (!deleteNetworkConfigAndSendReply(message, false)) { // failed to remove the config and caller was notified |