diff options
author | Roshan Pius <rpius@google.com> | 2017-03-21 10:25:34 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-21 20:24:06 +0000 |
commit | 7395d73fb33a6ad5e234f8fc2832810ec8109af9 (patch) | |
tree | ac3c47e2f1f448a675c1dd744def7de2b4e10cc8 /service | |
parent | 163f9765f9e4c3f868b1e0d630b6adeaa115fb4a (diff) |
SupplicantP2pIfaceHal: Fix pin sending for connect
Send the pin for all types of WPS connect requests to wpa_supplicant.
Bug: 36475029
Test: Unit tests
Change-Id: I4965d59c88ea976255b141056224fb46570c2e92
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java index 6464a4c13..117dff6c0 100644 --- a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java +++ b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java @@ -640,6 +640,11 @@ public class SupplicantP2pIfaceHal { return null; } + if (config.wps.setup == WpsInfo.PBC && !TextUtils.isEmpty(config.wps.pin)) { + Log.e(TAG, "Expected empty pin for PBC."); + return null; + } + byte[] peerAddress = null; try { peerAddress = NativeUtil.macAddressToByteArray(config.deviceAddress); @@ -653,17 +658,8 @@ public class SupplicantP2pIfaceHal { Log.e(TAG, "Invalid WPS config method: " + config.wps.setup); return null; } - // NOTE: preSelectedPin cannot be null, otherwise hal would crash. - String preSelectedPin = ""; - if (provisionMethod == ISupplicantP2pIface.WpsProvisionMethod.DISPLAY) { - preSelectedPin = config.wps.pin; - if (preSelectedPin == null) { - Log.e(TAG, "PIN must be supplied when provision method is DISPLAY."); - return null; - } - } - + String preSelectedPin = TextUtils.isEmpty(config.wps.pin) ? "" : config.wps.pin; boolean persistent = (config.netId == WifiP2pGroup.PERSISTENT_NET_ID); int goIntent = 0; |