summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2017-03-29 17:03:41 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-29 17:03:42 +0000
commitb899ef2490b0c772822c606bd04bcb2f20e88db0 (patch)
treeb3611f2121a34d5bed82bb311b1026a677853851
parenta301a4cf0537a396e26b9cb5dc80ac053c86f342 (diff)
parent16b00750e1d3c41ce9b4ccae9f07e0586e8ca2d0 (diff)
Merge "[AWARE] Restrict publish/subscribe count configuration API"
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareServiceImplTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java12
3 files changed, 8 insertions, 12 deletions
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
index afe6db13a..8d99befdd 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
@@ -302,7 +302,7 @@ public class WifiAwareNativeApi {
req.baseConfigs.sessionId = 0;
req.baseConfigs.ttlSec = (short) publishConfig.mTtlSec;
req.baseConfigs.discoveryWindowPeriod = 1;
- req.baseConfigs.discoveryCount = (byte) publishConfig.mPublishCount;
+ req.baseConfigs.discoveryCount = 0;
convertNativeByteArrayToArrayList(publishConfig.mServiceName, req.baseConfigs.serviceName);
// TODO: what's the right value on publish?
req.baseConfigs.discoveryMatchIndicator = NanMatchAlg.MATCH_ONCE;
@@ -364,7 +364,7 @@ public class WifiAwareNativeApi {
req.baseConfigs.sessionId = 0;
req.baseConfigs.ttlSec = (short) subscribeConfig.mTtlSec;
req.baseConfigs.discoveryWindowPeriod = 1;
- req.baseConfigs.discoveryCount = (byte) subscribeConfig.mSubscribeCount;
+ req.baseConfigs.discoveryCount = 0;
convertNativeByteArrayToArrayList(subscribeConfig.mServiceName,
req.baseConfigs.serviceName);
req.baseConfigs.discoveryMatchIndicator = subscribeConfig.mMatchStyle;
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareServiceImplTest.java
index 91fe87510..0ffb04bd2 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareServiceImplTest.java
@@ -585,7 +585,7 @@ public class WifiAwareServiceImplTest {
// caught by the Builder. Want to test whether service side will catch invalidly
// constructed configs.
PublishConfig publishConfig = new PublishConfig(serviceName.getBytes(), ssi, matchFilter,
- PublishConfig.PUBLISH_TYPE_UNSOLICITED, 0, 0, true);
+ PublishConfig.PUBLISH_TYPE_UNSOLICITED, 0, true);
int clientId = doConnect();
IWifiAwareDiscoverySessionCallback mockCallback = mock(
IWifiAwareDiscoverySessionCallback.class);
@@ -601,7 +601,7 @@ public class WifiAwareServiceImplTest {
// caught by the Builder. Want to test whether service side will catch invalidly
// constructed configs.
SubscribeConfig subscribeConfig = new SubscribeConfig(serviceName.getBytes(), ssi,
- matchFilter, SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE, 0, 0,
+ matchFilter, SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE, 0,
SubscribeConfig.MATCH_STYLE_ALL, true);
int clientId = doConnect();
IWifiAwareDiscoverySessionCallback mockCallback = mock(
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
index 13870c03b..2797c0e06 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
@@ -1035,7 +1035,6 @@ public class WifiAwareStateManagerTest {
final String callingPackage = "com.google.somePackage";
final String serviceName = "some-service-name";
final String ssi = "some much longer and more arbitrary data";
- final int subscribeCount = 7;
final int reasonFail = NanStatusType.INTERNAL_FAILURE;
final int subscribeId = 15;
final int requestorId = 22;
@@ -1050,7 +1049,7 @@ public class WifiAwareStateManagerTest {
SubscribeConfig subscribeConfig = new SubscribeConfig.Builder().setServiceName(serviceName)
.setServiceSpecificInfo(ssi.getBytes())
.setSubscribeType(SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE)
- .setSubscribeCount(subscribeCount).build();
+ .build();
IWifiAwareEventCallback mockCallback = mock(IWifiAwareEventCallback.class);
IWifiAwareDiscoverySessionCallback mockSessionCallback = mock(
@@ -1909,7 +1908,6 @@ public class WifiAwareStateManagerTest {
final String callingPackage = "com.google.somePackage";
final String serviceName = "some-service-name";
final String ssi = "some much longer and more arbitrary data";
- final int subscribeCount = 7;
final int subscribeId = 15;
final int requestorId = 22;
final byte[] peerMac = HexEncoding.decode("060708090A0B".toCharArray(), false);
@@ -1921,7 +1919,7 @@ public class WifiAwareStateManagerTest {
SubscribeConfig subscribeConfig = new SubscribeConfig.Builder().setServiceName(serviceName)
.setServiceSpecificInfo(ssi.getBytes())
.setSubscribeType(SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE)
- .setSubscribeCount(subscribeCount).build();
+ .build();
IWifiAwareEventCallback mockCallback = mock(IWifiAwareEventCallback.class);
IWifiAwareDiscoverySessionCallback mockSessionCallback = mock(
@@ -2312,7 +2310,6 @@ public class WifiAwareStateManagerTest {
final int masterPref = 111;
final String serviceName = "some-service-name";
final String ssi = "some much longer and more arbitrary data";
- final int publishCount = 7;
final int publishId = 22;
ConfigRequest configRequest = new ConfigRequest.Builder().setClusterLow(clusterLow)
@@ -2320,7 +2317,7 @@ public class WifiAwareStateManagerTest {
PublishConfig publishConfig = new PublishConfig.Builder().setServiceName(
serviceName).setServiceSpecificInfo(ssi.getBytes()).setPublishType(
- PublishConfig.PUBLISH_TYPE_UNSOLICITED).setPublishCount(publishCount).build();
+ PublishConfig.PUBLISH_TYPE_UNSOLICITED).build();
ArgumentCaptor<Short> transactionId = ArgumentCaptor.forClass(Short.class);
IWifiAwareEventCallback mockCallback = mock(IWifiAwareEventCallback.class);
@@ -2388,14 +2385,13 @@ public class WifiAwareStateManagerTest {
final int masterPref = 234;
final String serviceName = "some-service-name";
final String ssi = "some much longer and more arbitrary data";
- final int publishCount = 15;
ConfigRequest configRequest = new ConfigRequest.Builder().setClusterLow(clusterLow)
.setClusterHigh(clusterHigh).setMasterPreference(masterPref).build();
PublishConfig publishConfig = new PublishConfig.Builder().setServiceName(
serviceName).setServiceSpecificInfo(ssi.getBytes()).setPublishType(
- PublishConfig.PUBLISH_TYPE_UNSOLICITED).setPublishCount(publishCount).build();
+ PublishConfig.PUBLISH_TYPE_UNSOLICITED).build();
ArgumentCaptor<Short> transactionId = ArgumentCaptor.forClass(Short.class);
IWifiAwareEventCallback mockCallback = mock(IWifiAwareEventCallback.class);