diff options
author | Roshan Pius <rpius@google.com> | 2017-04-05 02:58:48 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-05 02:58:48 +0000 |
commit | 81d73518dbbfbbfdf6a2d6c08a3101088fd5e722 (patch) | |
tree | 8cff0f7c006d5088e4cfd02f669e4caf410515b3 /service | |
parent | 7b8a36d10b5f8b855854cbf344774c1d0a12a6ab (diff) | |
parent | 24ee320f5ef7359514bd5167a4a11e31813e5019 (diff) |
Merge "WSM: Support add/update/enable network in any state" into oc-dev
am: 24ee320f5e
Change-Id: I619924b8ba11fbc8186c11d2d0e127bd8ef37083
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 |