summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2020-04-14 11:54:01 -0700
committerRoshan Pius <rpius@google.com>2020-04-15 08:23:15 -0700
commitf85ddd3f8f0f2cba9bf1194983424e98088c5e11 (patch)
tree3fcc26966d33b8b757db8261527ba7da3f94554f /service
parent7122a7bfaf34e4c50fee27a81f16b1372c29953f (diff)
HalDeviceManager: Allow NAN to bring down P2P iface
Assign P2P & NAN ifaces the same priority. So, they're able to bring each other down, but nothing else. Also, a) Fixed a bug in the proposal creation exposed by this change. The list of ifaces to be deleted for a proposal needs to be accumulated across all iface types. This bug was causing a failure in testInterfaceCreationFlowTestChipV2 because HalDevMgr was choosing a proposal which would delete 2 ifaces (NAN + 2nd STA for an AP) instead of choosing the best proposal which was to delete 1 iface (2nd STA for an AP). b) Few log message cleanups to make it more clearer (added a toString, Arrays.toSring, etc) c) Fixed all the unit tests to account for the new priority. Bug: 153842431 Test: atest com.android.server.wifi Change-Id: I06ca1f18347a8cbe8c495f4540365ed9c34ad009
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/HalDeviceManager.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java
index d85c4893b..e47a33efb 100644
--- a/service/java/com/android/server/wifi/HalDeviceManager.java
+++ b/service/java/com/android/server/wifi/HalDeviceManager.java
@@ -589,6 +589,11 @@ public class HalDeviceManager {
private class WifiIfaceInfo {
public String name;
public IWifiIface iface;
+
+ @Override
+ public String toString() {
+ return "{name=" + name + ", iface=" + iface + "}";
+ }
}
private class WifiChipInfo {
@@ -608,7 +613,7 @@ public class HalDeviceManager {
for (int type: IFACE_TYPES_BY_PRIORITY) {
sb.append(", ifaces[" + type + "].length=").append(ifaces[type].length);
}
- sb.append(")");
+ sb.append("}");
return sb.toString();
}
}
@@ -1579,7 +1584,8 @@ public class HalDeviceManager {
IWifiChip.ChipMode chipMode, int[] chipIfaceCombo, int ifaceType) {
if (VDBG) {
Log.d(TAG, "canIfaceComboSupportRequest: chipInfo=" + chipInfo + ", chipMode="
- + chipMode + ", chipIfaceCombo=" + chipIfaceCombo + ", ifaceType=" + ifaceType);
+ + chipMode + ", chipIfaceCombo=" + Arrays.toString(chipIfaceCombo)
+ + ", ifaceType=" + ifaceType);
}
// short-circuit: does the chipIfaceCombo even support the requested type?
@@ -1635,9 +1641,9 @@ public class HalDeviceManager {
return null;
}
- // delete the most recently created interfaces or LOW priority interfaces
- interfacesToBeRemovedFirst = selectInterfacesToDelete(tooManyInterfaces,
- chipInfo.ifaces[type]);
+ // delete the most recently created interfaces
+ interfacesToBeRemovedFirst.addAll(selectInterfacesToDelete(tooManyInterfaces,
+ chipInfo.ifaces[type]));
}
}
@@ -1715,7 +1721,7 @@ public class HalDeviceManager {
* Type-specific rules (but note that the general rules are appied first):
* 4. Request for AP or STA will destroy any other interface
* 5. Request for P2P will destroy NAN-only (but will destroy a second STA per #3)
- * 6. Request for NAN will not destroy any interface (but will destroy a second STA per #3)
+ * 6. Request for NAN will destroy P2P-only (but will destroy a second STA per #3)
*
* Note: the 'numNecessaryInterfaces' is used to specify how many interfaces would be needed to
* be deleted. This is used to determine whether there are that many low priority interfaces
@@ -1738,16 +1744,16 @@ public class HalDeviceManager {
return true;
}
- // rule 6
- if (requestedIfaceType == IfaceType.NAN) {
- return false;
- }
-
// rule 5
if (requestedIfaceType == IfaceType.P2P) {
return existingIfaceType == IfaceType.NAN;
}
+ // rule 6
+ if (requestedIfaceType == IfaceType.NAN) {
+ return existingIfaceType == IfaceType.P2P;
+ }
+
// rule 4, the requestIfaceType is either AP or STA
return true;
}