From 7395d73fb33a6ad5e234f8fc2832810ec8109af9 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 21 Mar 2017 10:25:34 -0700 Subject: 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 --- .../android/server/wifi/p2p/SupplicantP2pIfaceHal.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'service') 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; -- cgit v1.2.3