summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-03-16 14:36:50 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-16 14:36:50 +0000
commit15d4e32d0b4ae41eb582aeef9e9c97792e25f703 (patch)
treea48ad6aec44216f5d0400d02cd7c83e913f73c6c /service
parent586197ab0ed6d1c9d76c7b461a19ab8733ce9b3a (diff)
parentd19743b66ba214a8c4a5166d1fe7d938f97a3f03 (diff)
Merge "SupplicantHal: Fix Wps PBC/Display setup"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SupplicantP2pIfaceHal.java8
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaIfaceHal.java6
-rw-r--r--service/java/com/android/server/wifi/util/NativeUtil.java9
3 files changed, 10 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantP2pIfaceHal.java b/service/java/com/android/server/wifi/SupplicantP2pIfaceHal.java
index 72cce457b..ba7064b4d 100644
--- a/service/java/com/android/server/wifi/SupplicantP2pIfaceHal.java
+++ b/service/java/com/android/server/wifi/SupplicantP2pIfaceHal.java
@@ -1468,11 +1468,11 @@ public class SupplicantP2pIfaceHal {
* AP/Registrar at about the same time (2 minute window).
*
* @param groupIfName Group interface name to use.
- * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+ * @param bssid BSSID of the AP. Use empty bssid to indicate wildcard.
* @return true, if operation was successful.
*/
public boolean startWpsPbc(String groupIfName, String bssid) {
- if (TextUtils.isEmpty(groupIfName) || TextUtils.isEmpty(bssid)) return false;
+ if (TextUtils.isEmpty(groupIfName)) return false;
synchronized (mLock) {
if (!checkSupplicantP2pIfaceAndLogFailure("startWpsPbc")) return false;
if (groupIfName == null) {
@@ -1543,11 +1543,11 @@ public class SupplicantP2pIfaceHal {
* Initiate WPS Pin Display setup.
*
* @param groupIfName Group interface name to use.
- * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+ * @param bssid BSSID of the AP. Use empty bssid to indicate wildcard.
* @return generated pin if operation was successful, null otherwise.
*/
public String startWpsPinDisplay(String groupIfName, String bssid) {
- if (TextUtils.isEmpty(groupIfName) || TextUtils.isEmpty(bssid)) return null;
+ if (TextUtils.isEmpty(groupIfName)) return null;
synchronized (mLock) {
if (!checkSupplicantP2pIfaceAndLogFailure("startWpsPinDisplay")) return null;
if (groupIfName == null) {
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
index 66bda1e64..9d063d247 100644
--- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
@@ -1334,11 +1334,10 @@ public class SupplicantStaIfaceHal {
/**
* Start WPS pin display operation with the specified peer.
*
- * @param bssidStr BSSID of the peer.
+ * @param bssidStr BSSID of the peer. Use empty bssid to indicate wildcard.
* @return true if request is sent successfully, false otherwise.
*/
public boolean startWpsPbc(String bssidStr) {
- if (TextUtils.isEmpty(bssidStr)) return false;
return startWpsPbc(NativeUtil.macAddressToByteArray(bssidStr));
}
@@ -1381,11 +1380,10 @@ public class SupplicantStaIfaceHal {
/**
* Start WPS pin display operation with the specified peer.
*
- * @param bssidStr BSSID of the peer.
+ * @param bssidStr BSSID of the peer. Use empty bssid to indicate wildcard.
* @return new pin generated on success, null otherwise.
*/
public String startWpsPinDisplay(String bssidStr) {
- if (TextUtils.isEmpty(bssidStr)) return null;
return startWpsPinDisplay(NativeUtil.macAddressToByteArray(bssidStr));
}
diff --git a/service/java/com/android/server/wifi/util/NativeUtil.java b/service/java/com/android/server/wifi/util/NativeUtil.java
index 4abb0f4ea..50f32fa4d 100644
--- a/service/java/com/android/server/wifi/util/NativeUtil.java
+++ b/service/java/com/android/server/wifi/util/NativeUtil.java
@@ -16,6 +16,8 @@
package com.android.server.wifi.util;
+import android.text.TextUtils;
+
import libcore.util.HexEncoding;
import java.nio.ByteBuffer;
@@ -102,14 +104,11 @@ public class NativeUtil {
*
* @param macStr string of format: "XX:XX:XX:XX:XX:XX" or "XXXXXXXXXXXX", where X is any
* hexadecimal digit.
- * Passing "any" is the same as 00:00:00:00:00:00
+ * Passing null, empty string or "any" is the same as 00:00:00:00:00:00
* @throws IllegalArgumentException for various malformed inputs.
*/
public static byte[] macAddressToByteArray(String macStr) {
- if (macStr == null) {
- throw new IllegalArgumentException("null mac string");
- }
- if (ANY_MAC_STR.equals(macStr)) return ANY_MAC_BYTES;
+ if (TextUtils.isEmpty(macStr) || ANY_MAC_STR.equals(macStr)) return ANY_MAC_BYTES;
String cleanMac = macStr.replace(":", "");
if (cleanMac.length() != MAC_LENGTH * 2) {
throw new IllegalArgumentException("invalid mac string length: " + cleanMac);