diff options
author | Etan Cohen <etancohen@google.com> | 2017-03-29 20:14:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-03-29 20:15:03 +0000 |
commit | ace82ee060e3e7408cdbba195eab9d0309769ef4 (patch) | |
tree | 83da379b37750230fede25ec5005475e20c162b5 | |
parent | 21a4d8928152444035c8549c508e4e154ae3d890 (diff) | |
parent | 0b74b795587b6aada97c7c63f0febf94c76633e2 (diff) |
Merge "[AWARE] Restrict publish/subscribe count configuration API" into oc-dev
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); |