summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2018-05-26 19:10:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-05-26 19:10:04 +0000
commit7321b5dc86ba9f9de31588bf726008bf8a13138a (patch)
tree096cc762a502e4d2349775e0288064f5b8a27dc4 /service
parentc231fb2d5b30ef8faa41399d0feed9b6448e85f9 (diff)
parent5a2a9e11a8f3f4d82e9d451a2fe06eba9e8b39fc (diff)
Merge "[HDM] Add API to check for STA+AP concurrency" into pi-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/HalDeviceManager.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java
index 3c61217d7..f570ffcb5 100644
--- a/service/java/com/android/server/wifi/HalDeviceManager.java
+++ b/service/java/com/android/server/wifi/HalDeviceManager.java
@@ -204,6 +204,16 @@ public class HalDeviceManager {
return getSupportedIfaceTypesInternal(chip);
}
+ /**
+ * Checks whether the device (the combination of all Wi-Fi chips on the device) supports a
+ * concurrent combination of 1 or more STAs and 1 or more APs.
+ *
+ * @return true if STA+AP concurrency is supported, false otherwise.
+ */
+ public boolean isConcurrentStaPlusApSupported() {
+ return isConcurrentStaPlusApSupportedInternal();
+ }
+
// interface-specific behavior
/**
@@ -1313,6 +1323,49 @@ public class HalDeviceManager {
return results;
}
+ private boolean isConcurrentStaPlusApSupportedInternal() {
+ if (mDbg) Log.d(TAG, "isConcurrentStaPlusApSupportedInternal");
+
+ synchronized (mLock) {
+ WifiChipInfo[] chipInfos = getAllChipInfo();
+ if (chipInfos == null) {
+ Log.e(TAG, "isConcurrentStaPlusApSupportedInternal: no chip info found");
+ stopWifi(); // major error: shutting down
+ return false;
+ }
+
+ if (!validateInterfaceCache(chipInfos)) {
+ Log.e(TAG, "isConcurrentStaPlusApSupportedInternal: local cache is invalid!");
+ stopWifi(); // major error: shutting down
+ return false;
+ }
+
+ // check whether any chip individually supports AP+STA
+ // TODO b/80270202: this does not fully handle multi-chip behavior
+ for (WifiChipInfo chipInfo : chipInfos) {
+ for (IWifiChip.ChipMode chipMode : chipInfo.availableModes) {
+ for (IWifiChip.ChipIfaceCombination chipIfaceCombo : chipMode
+ .availableCombinations) {
+ int[][] expandedIfaceCombos = expandIfaceCombos(chipIfaceCombo);
+ if (VDBG) {
+ Log.d(TAG, chipIfaceCombo + " expands to " + Arrays.deepToString(
+ expandedIfaceCombos));
+ }
+
+ for (int[] expandedIfaceCombo : expandedIfaceCombos) {
+ if (expandedIfaceCombo[IfaceType.STA] > 0
+ && expandedIfaceCombo[IfaceType.AP] > 0) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
private IWifiIface createIface(int ifaceType, boolean lowPriority,
InterfaceDestroyedListener destroyedListener, Handler handler) {
if (mDbg) {