summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java6
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java11
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareStateManager.java13
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java8
4 files changed, 25 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
index 0535512fe..01cf7e375 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
@@ -311,14 +311,14 @@ public class WifiAwareDataPathStateManager {
if (DBG) {
Log.d(TAG, "onDataPathRequest: network request cache = " + mNetworkRequestsCache);
}
- mMgr.respondToDataPathRequest(false, ndpId, "", null, null);
+ mMgr.respondToDataPathRequest(false, ndpId, "", null, null, false);
return null;
}
if (nnri.state != AwareNetworkRequestInformation.STATE_RESPONDER_WAIT_FOR_REQUEST) {
Log.w(TAG, "onDataPathRequest: request " + networkSpecifier + " is incorrect state="
+ nnri.state);
- mMgr.respondToDataPathRequest(false, ndpId, "", null, null);
+ mMgr.respondToDataPathRequest(false, ndpId, "", null, null, false);
mNetworkRequestsCache.remove(networkSpecifier);
return null;
}
@@ -327,7 +327,7 @@ public class WifiAwareDataPathStateManager {
nnri.ndpId = ndpId;
nnri.interfaceName = selectInterfaceForRequest(nnri);
mMgr.respondToDataPathRequest(true, ndpId, nnri.interfaceName, nnri.networkSpecifier.pmk,
- nnri.networkSpecifier.passphrase);
+ nnri.networkSpecifier.passphrase, nnri.networkSpecifier.isOutOfBand());
return networkSpecifier;
}
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
index 14ce22fb2..fb7a144e8 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
@@ -754,10 +754,13 @@ public class WifiAwareNativeApi implements WifiAwareShellCommand.DelegatedShellC
* request callback.
* @param pmk Pairwise master key (PMK - see IEEE 802.11i) for the data-path.
* @param passphrase Passphrase for the data-path.
+ * @param isOutOfBand Is the data-path out-of-band (i.e. without a corresponding Aware discovery
+ * session).
* @param capabilities The capabilities of the firmware.
*/
public boolean respondToDataPathRequest(short transactionId, boolean accept, int ndpId,
- String interfaceName, byte[] pmk, String passphrase, Capabilities capabilities) {
+ String interfaceName, byte[] pmk, String passphrase, boolean isOutOfBand,
+ Capabilities capabilities) {
if (VDBG) {
Log.v(TAG, "respondToDataPathRequest: transactionId=" + transactionId + ", accept="
+ accept + ", int ndpId=" + ndpId + ", interfaceName=" + interfaceName);
@@ -790,6 +793,12 @@ public class WifiAwareNativeApi implements WifiAwareShellCommand.DelegatedShellC
capabilities.supportedCipherSuites);
req.securityConfig.securityType = NanDataPathSecurityType.PASSPHRASE;
convertNativeByteArrayToArrayList(passphrase.getBytes(), req.securityConfig.passphrase);
+
+ if (isOutOfBand) { // only relevant when using passphrase
+ convertNativeByteArrayToArrayList(
+ SERVICE_NAME_FOR_OOB_DATA_PATH.getBytes(StandardCharsets.UTF_8),
+ req.serviceNameOutOfBand);
+ }
}
try {
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
index c2f6a79ed..fa57d17b5 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
@@ -603,7 +603,7 @@ public class WifiAwareStateManager implements WifiAwareShellCommand.DelegatedShe
* Command to respond to the data-path request (executed by the responder).
*/
public void respondToDataPathRequest(boolean accept, int ndpId, String interfaceName,
- byte[] pmk, String passphrase) {
+ byte[] pmk, String passphrase, boolean isOutOfBand) {
Message msg = mSm.obtainMessage(MESSAGE_TYPE_COMMAND);
msg.arg1 = COMMAND_TYPE_RESPOND_TO_DATA_PATH_SETUP_REQUEST;
msg.arg2 = ndpId;
@@ -611,6 +611,7 @@ public class WifiAwareStateManager implements WifiAwareShellCommand.DelegatedShe
msg.getData().putString(MESSAGE_BUNDLE_KEY_INTERFACE_NAME, interfaceName);
msg.getData().putByteArray(MESSAGE_BUNDLE_KEY_PMK, pmk);
msg.getData().putString(MESSAGE_BUNDLE_KEY_PASSPHRASE, passphrase);
+ msg.getData().putBoolean(MESSAGE_BUNDLE_KEY_OOB, isOutOfBand);
mSm.sendMessage(msg);
}
@@ -1521,9 +1522,10 @@ public class WifiAwareStateManager implements WifiAwareShellCommand.DelegatedShe
String interfaceName = data.getString(MESSAGE_BUNDLE_KEY_INTERFACE_NAME);
byte[] pmk = data.getByteArray(MESSAGE_BUNDLE_KEY_PMK);
String passphrase = data.getString(MESSAGE_BUNDLE_KEY_PASSPHRASE);
+ boolean isOutOfBand = data.getBoolean(MESSAGE_BUNDLE_KEY_OOB);
waitForResponse = respondToDataPathRequestLocal(mCurrentTransactionId, accept,
- ndpId, interfaceName, pmk, passphrase);
+ ndpId, interfaceName, pmk, passphrase, isOutOfBand);
break;
}
@@ -2246,16 +2248,17 @@ public class WifiAwareStateManager implements WifiAwareShellCommand.DelegatedShe
}
private boolean respondToDataPathRequestLocal(short transactionId, boolean accept,
- int ndpId, String interfaceName, byte[] pmk, String passphrase) {
+ int ndpId, String interfaceName, byte[] pmk, String passphrase, boolean isOutOfBand) {
if (VDBG) {
Log.v(TAG,
"respondToDataPathRequestLocal(): transactionId=" + transactionId + ", accept="
+ accept + ", ndpId=" + ndpId + ", interfaceName=" + interfaceName
- + ", pmk=" + pmk + ", passphrase=" + passphrase);
+ + ", pmk=" + pmk + ", passphrase=" + passphrase + ", isOutOfBand="
+ + isOutOfBand);
}
boolean success = mWifiAwareNativeApi.respondToDataPathRequest(transactionId, accept, ndpId,
- interfaceName, pmk, passphrase, mCapabilities);
+ interfaceName, pmk, passphrase, isOutOfBand, mCapabilities);
if (!success) {
mDataPathMgr.onRespondToDataPathRequest(ndpId, false);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
index f0758934a..37dd86b84 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
@@ -149,7 +149,7 @@ public class WifiAwareDataPathStateManagerTest {
any(), any(), any(), any(), anyBoolean(),
any())).thenReturn(true);
when(mMockNative.respondToDataPathRequest(anyShort(), anyBoolean(), anyInt(), any(),
- any(), any(), any())).thenReturn(true);
+ any(), any(), anyBoolean(), any())).thenReturn(true);
when(mMockNative.endDataPath(anyShort(), anyInt())).thenReturn(true);
when(mMockNetworkInterface.configureAgentProperties(any(), any(), anyInt(), any(), any(),
@@ -495,7 +495,7 @@ public class WifiAwareDataPathStateManagerTest {
mDut.onDataPathRequestNotification(pubSubId, peerDiscoveryMac, ndpId);
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).respondToDataPathRequest(anyShort(), eq(false),
- eq(ndpId), eq(""), eq(null), eq(null), any());
+ eq(ndpId), eq(""), eq(null), eq(null), anyBoolean(), any());
}
verifyNoMoreInteractions(mMockNative, mMockCm);
@@ -551,7 +551,7 @@ public class WifiAwareDataPathStateManagerTest {
mDut.onDataPathRequestNotification(pubSubId, peerDiscoveryMac, ndpId);
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).respondToDataPathRequest(anyShort(), eq(false),
- eq(ndpId), eq(""), eq(null), eq(null), any());
+ eq(ndpId), eq(""), eq(null), eq(null), anyBoolean(), any());
}
verifyNoMoreInteractions(mMockNative, mMockCm);
@@ -691,7 +691,7 @@ public class WifiAwareDataPathStateManagerTest {
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).respondToDataPathRequest(transactionId.capture(), eq(true),
eq(ndpId), eq(sAwareInterfacePrefix + "0"), eq(providePmk ? pmk : null), eq(null),
- any());
+ eq(useDirect), any());
mDut.onRespondToDataPathSetupRequestResponse(transactionId.getValue(), true, 0);
mMockLooper.dispatchAll();