summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorLes Lee <lesl@google.com>2020-07-14 14:51:29 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-14 14:51:29 +0000
commitb276cac78ff7ab76c25c5c761c0cc41c6eb04f88 (patch)
tree5c2137b6112134c9ee51c5fc6a80dbf09e1bcda9 /service
parent3a524f8d1a4fcd7164652bab45a4d1935a40253e (diff)
parenta9d21f0ec9fe8d88fb0f0e770ad09219934bf04f (diff)
Merge "wifi: bypass randomized Mac set failure when hal not support" into rvc-dev am: c794cd4c5f am: a9d21f0ec9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12108426 Change-Id: I714f0e1f94c2a9f979334956e30eafec5565778e
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SoftApManager.java14
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java9
-rw-r--r--service/java/com/android/server/wifi/WifiVendorHal.java22
3 files changed, 41 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index ffbb388cc..9ef52e796 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -348,10 +348,16 @@ public class SoftApManager implements ActiveModeManager {
return SUCCESS;
}
- // We're configuring a random/custom MAC address. In this case, driver support is mandatory.
- if (!mWifiNative.setMacAddress(mApInterfaceName, mac)) {
- Log.e(TAG, "failed to set explicitly requested MAC address");
- return ERROR_GENERIC;
+
+ if (mWifiNative.isSetMacAddressSupported(mApInterfaceName)) {
+ if (!mWifiNative.setMacAddress(mApInterfaceName, mac)) {
+ Log.e(TAG, "failed to set explicitly requested MAC address");
+ return ERROR_GENERIC;
+ }
+ } else if (!mIsRandomizeBssid) {
+ // If hardware does not support MAC address setter,
+ // only report the error for non randomization.
+ return ERROR_UNSUPPORTED_CONFIGURATION;
}
return SUCCESS;
}
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 39d0fcc84..cf362d6a8 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1788,6 +1788,15 @@ public class WifiNative {
}
/**
+ * Returns true if Hal version supports setMacAddress, otherwise false.
+ *
+ * @param interfaceName Name of the interface
+ */
+ public boolean isSetMacAddressSupported(@NonNull String interfaceName) {
+ return mWifiVendorHal.isSetMacAddressSupported(interfaceName);
+ }
+
+ /**
* Get the factory MAC address of the given interface
* @param interfaceName Name of the interface.
* @return factory MAC address, or null on a failed call or if feature is unavailable.
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java
index ed6ac7fdd..fd90c35df 100644
--- a/service/java/com/android/server/wifi/WifiVendorHal.java
+++ b/service/java/com/android/server/wifi/WifiVendorHal.java
@@ -1332,6 +1332,28 @@ public class WifiVendorHal {
}
/**
+ * Returns true if Hal version supports setMacAddress, otherwise false.
+ *
+ * @param ifaceName Name of the interface
+ */
+ public boolean isSetMacAddressSupported(@NonNull String ifaceName) {
+ synchronized (sLock) {
+ android.hardware.wifi.V1_2.IWifiStaIface sta12 =
+ getWifiStaIfaceForV1_2Mockable(ifaceName);
+ if (sta12 != null) {
+ return true;
+ }
+
+ android.hardware.wifi.V1_4.IWifiApIface ap14 =
+ getWifiApIfaceForV1_4Mockable(ifaceName);
+ if (ap14 != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Get factory MAC address of the given interface
*
* @param ifaceName Name of the interface