diff options
| -rw-r--r-- | api/current.txt | 3 | ||||
| -rw-r--r-- | api/system-current.txt | 3 | ||||
| -rw-r--r-- | api/test-current.txt | 3 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/aware/SubscribeConfig.java | 67 | ||||
| -rw-r--r-- | wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java | 18 |
5 files changed, 8 insertions, 86 deletions
diff --git a/api/current.txt b/api/current.txt index 8baca126033a..2316d41fa559 100644 --- a/api/current.txt +++ b/api/current.txt @@ -26795,8 +26795,6 @@ package android.net.wifi.aware { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.wifi.aware.SubscribeConfig> CREATOR; - field public static final int MATCH_STYLE_ALL = 1; // 0x1 - field public static final int MATCH_STYLE_FIRST_ONLY = 0; // 0x0 field public static final int SUBSCRIBE_TYPE_ACTIVE = 1; // 0x1 field public static final int SUBSCRIBE_TYPE_PASSIVE = 0; // 0x0 } @@ -26805,7 +26803,6 @@ package android.net.wifi.aware { ctor public SubscribeConfig.Builder(); method public android.net.wifi.aware.SubscribeConfig build(); method public android.net.wifi.aware.SubscribeConfig.Builder setMatchFilter(java.util.List<byte[]>); - method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]); method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int); diff --git a/api/system-current.txt b/api/system-current.txt index bb653fe6478c..3e42e8395cb3 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -29540,8 +29540,6 @@ package android.net.wifi.aware { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.wifi.aware.SubscribeConfig> CREATOR; - field public static final int MATCH_STYLE_ALL = 1; // 0x1 - field public static final int MATCH_STYLE_FIRST_ONLY = 0; // 0x0 field public static final int SUBSCRIBE_TYPE_ACTIVE = 1; // 0x1 field public static final int SUBSCRIBE_TYPE_PASSIVE = 0; // 0x0 } @@ -29550,7 +29548,6 @@ package android.net.wifi.aware { ctor public SubscribeConfig.Builder(); method public android.net.wifi.aware.SubscribeConfig build(); method public android.net.wifi.aware.SubscribeConfig.Builder setMatchFilter(java.util.List<byte[]>); - method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]); method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int); diff --git a/api/test-current.txt b/api/test-current.txt index eac5b8028f99..e1ad7ac3a1f2 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -26903,8 +26903,6 @@ package android.net.wifi.aware { method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.wifi.aware.SubscribeConfig> CREATOR; - field public static final int MATCH_STYLE_ALL = 1; // 0x1 - field public static final int MATCH_STYLE_FIRST_ONLY = 0; // 0x0 field public static final int SUBSCRIBE_TYPE_ACTIVE = 1; // 0x1 field public static final int SUBSCRIBE_TYPE_PASSIVE = 0; // 0x0 } @@ -26913,7 +26911,6 @@ package android.net.wifi.aware { ctor public SubscribeConfig.Builder(); method public android.net.wifi.aware.SubscribeConfig build(); method public android.net.wifi.aware.SubscribeConfig.Builder setMatchFilter(java.util.List<byte[]>); - method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String); method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]); method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int); diff --git a/wifi/java/android/net/wifi/aware/SubscribeConfig.java b/wifi/java/android/net/wifi/aware/SubscribeConfig.java index 97a6a3f91e86..6c1fcce5c0b7 100644 --- a/wifi/java/android/net/wifi/aware/SubscribeConfig.java +++ b/wifi/java/android/net/wifi/aware/SubscribeConfig.java @@ -61,27 +61,6 @@ public final class SubscribeConfig implements Parcelable { public static final int SUBSCRIBE_TYPE_ACTIVE = 1; /** @hide */ - @IntDef({ - MATCH_STYLE_FIRST_ONLY, MATCH_STYLE_ALL }) - @Retention(RetentionPolicy.SOURCE) - public @interface MatchStyles { - } - - /** - * Specifies that only the first match of a set of identical matches (same - * publish) will be reported to the subscriber. Configuration is done using - * {@link SubscribeConfig.Builder#setMatchStyle(int)}. - */ - public static final int MATCH_STYLE_FIRST_ONLY = 0; - - /** - * Specifies that all matches of a set of identical matches (same publish) - * will be reported to the subscriber. Configuration is done using - * {@link SubscribeConfig.Builder#setMatchStyle(int)}. - */ - public static final int MATCH_STYLE_ALL = 1; - - /** @hide */ public final byte[] mServiceName; /** @hide */ @@ -97,21 +76,17 @@ public final class SubscribeConfig implements Parcelable { public final int mTtlSec; /** @hide */ - public final int mMatchStyle; - - /** @hide */ public final boolean mEnableTerminateNotification; /** @hide */ public SubscribeConfig(byte[] serviceName, byte[] serviceSpecificInfo, byte[] matchFilter, - int subscribeType, int ttlSec, int matchStyle, + int subscribeType, int ttlSec, boolean enableTerminateNotification) { mServiceName = serviceName; mServiceSpecificInfo = serviceSpecificInfo; mMatchFilter = matchFilter; mSubscribeType = subscribeType; mTtlSec = ttlSec; - mMatchStyle = matchStyle; mEnableTerminateNotification = enableTerminateNotification; } @@ -121,8 +96,8 @@ public final class SubscribeConfig implements Parcelable { (mServiceSpecificInfo == null) ? "null" : HexEncoding.encode(mServiceSpecificInfo)) + ", mMatchFilter=" + (new TlvBufferUtils.TlvIterable(0, 1, mMatchFilter)).toString() + ", mSubscribeType=" + mSubscribeType - + ", mTtlSec=" + mTtlSec + ", mMatchType=" - + mMatchStyle + ", mEnableTerminateNotification=" + mEnableTerminateNotification + + ", mTtlSec=" + mTtlSec + + ", mEnableTerminateNotification=" + mEnableTerminateNotification + "]"; } @@ -138,7 +113,6 @@ public final class SubscribeConfig implements Parcelable { dest.writeByteArray(mMatchFilter); dest.writeInt(mSubscribeType); dest.writeInt(mTtlSec); - dest.writeInt(mMatchStyle); dest.writeInt(mEnableTerminateNotification ? 1 : 0); } @@ -155,11 +129,10 @@ public final class SubscribeConfig implements Parcelable { byte[] matchFilter = in.createByteArray(); int subscribeType = in.readInt(); int ttlSec = in.readInt(); - int matchStyle = in.readInt(); boolean enableTerminateNotification = in.readInt() != 0; return new SubscribeConfig(serviceName, ssi, matchFilter, subscribeType, - ttlSec, matchStyle, enableTerminateNotification); + ttlSec, enableTerminateNotification); } }; @@ -178,7 +151,7 @@ public final class SubscribeConfig implements Parcelable { return Arrays.equals(mServiceName, lhs.mServiceName) && Arrays.equals(mServiceSpecificInfo, lhs.mServiceSpecificInfo) && Arrays.equals(mMatchFilter, lhs.mMatchFilter) && mSubscribeType == lhs.mSubscribeType - && mTtlSec == lhs.mTtlSec && mMatchStyle == lhs.mMatchStyle + && mTtlSec == lhs.mTtlSec && mEnableTerminateNotification == lhs.mEnableTerminateNotification; } @@ -191,7 +164,6 @@ public final class SubscribeConfig implements Parcelable { result = 31 * result + Arrays.hashCode(mMatchFilter); result = 31 * result + mSubscribeType; result = 31 * result + mTtlSec; - result = 31 * result + mMatchStyle; result = 31 * result + (mEnableTerminateNotification ? 1 : 0); return result; @@ -217,10 +189,6 @@ public final class SubscribeConfig implements Parcelable { if (mTtlSec < 0) { throw new IllegalArgumentException("Invalid ttlSec - must be non-negative"); } - if (mMatchStyle != MATCH_STYLE_FIRST_ONLY && mMatchStyle != MATCH_STYLE_ALL) { - throw new IllegalArgumentException( - "Invalid matchType - must be MATCH_FIRST_ONLY or MATCH_ALL"); - } if (characteristics != null) { int maxServiceNameLength = characteristics.getMaxServiceNameLength(); @@ -252,7 +220,6 @@ public final class SubscribeConfig implements Parcelable { private byte[] mMatchFilter; private int mSubscribeType = SUBSCRIBE_TYPE_PASSIVE; private int mTtlSec = 0; - private int mMatchStyle = MATCH_STYLE_ALL; private boolean mEnableTerminateNotification = true; /** @@ -363,28 +330,6 @@ public final class SubscribeConfig implements Parcelable { } /** - * Sets the match style of the subscription - how are matches from a - * single match session (corresponding to the same publish action on the - * peer) reported to the host (using the - * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], - * java.util.List)}). The options are: only report the first match and ignore the rest - * {@link SubscribeConfig#MATCH_STYLE_FIRST_ONLY} or report every single - * match {@link SubscribeConfig#MATCH_STYLE_ALL} (the default). - * - * @param matchStyle The reporting style for the discovery match. - * @return The builder to facilitate chaining - * {@code builder.setXXX(..).setXXX(..)}. - */ - public Builder setMatchStyle(@MatchStyles int matchStyle) { - if (matchStyle != MATCH_STYLE_FIRST_ONLY && matchStyle != MATCH_STYLE_ALL) { - throw new IllegalArgumentException( - "Invalid matchType - must be MATCH_FIRST_ONLY or MATCH_ALL"); - } - mMatchStyle = matchStyle; - return this; - } - - /** * Configure whether a subscribe terminate notification * {@link DiscoverySessionCallback#onSessionTerminated()} is reported * back to the callback. @@ -406,7 +351,7 @@ public final class SubscribeConfig implements Parcelable { */ public SubscribeConfig build() { return new SubscribeConfig(mServiceName, mServiceSpecificInfo, mMatchFilter, - mSubscribeType, mTtlSec, mMatchStyle, + mSubscribeType, mTtlSec, mEnableTerminateNotification); } } diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java index 72a6a7a7b46b..14c43fb60599 100644 --- a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java +++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java @@ -687,8 +687,6 @@ public class WifiAwareManagerTest { collector.checkThat("mSubscribeType", subscribeConfig.mSubscribeType, equalTo(SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE)); collector.checkThat("mTtlSec", subscribeConfig.mTtlSec, equalTo(0)); - collector.checkThat("mMatchStyle", subscribeConfig.mMatchStyle, - equalTo(SubscribeConfig.MATCH_STYLE_ALL)); collector.checkThat("mEnableTerminateNotification", subscribeConfig.mEnableTerminateNotification, equalTo(true)); } @@ -701,14 +699,13 @@ public class WifiAwareManagerTest { final int subscribeType = SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE; final int subscribeCount = 10; final int subscribeTtl = 15; - final int matchStyle = SubscribeConfig.MATCH_STYLE_FIRST_ONLY; final boolean enableTerminateNotification = false; SubscribeConfig subscribeConfig = new SubscribeConfig.Builder().setServiceName(serviceName) .setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter( new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList()) .setSubscribeType(subscribeType) - .setTtlSec(subscribeTtl).setMatchStyle(matchStyle) + .setTtlSec(subscribeTtl) .setTerminateNotificationEnabled(enableTerminateNotification).build(); collector.checkThat("mServiceName", serviceName.getBytes(), @@ -719,7 +716,6 @@ public class WifiAwareManagerTest { collector.checkThat("mSubscribeType", subscribeType, equalTo(subscribeConfig.mSubscribeType)); collector.checkThat("mTtlSec", subscribeTtl, equalTo(subscribeConfig.mTtlSec)); - collector.checkThat("mMatchStyle", matchStyle, equalTo(subscribeConfig.mMatchStyle)); collector.checkThat("mEnableTerminateNotification", enableTerminateNotification, equalTo(subscribeConfig.mEnableTerminateNotification)); } @@ -730,16 +726,14 @@ public class WifiAwareManagerTest { final String serviceSpecificInfo = "long arbitrary string with some info"; final byte[] matchFilter = { 1, 16, 1, 22 }; final int subscribeType = SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE; - final int subscribeCount = 10; final int subscribeTtl = 15; - final int matchStyle = SubscribeConfig.MATCH_STYLE_FIRST_ONLY; final boolean enableTerminateNotification = true; SubscribeConfig subscribeConfig = new SubscribeConfig.Builder().setServiceName(serviceName) .setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter( new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList()) .setSubscribeType(subscribeType) - .setTtlSec(subscribeTtl).setMatchStyle(matchStyle) + .setTtlSec(subscribeTtl) .setTerminateNotificationEnabled(enableTerminateNotification).build(); Parcel parcelW = Parcel.obtain(); @@ -765,14 +759,6 @@ public class WifiAwareManagerTest { new SubscribeConfig.Builder().setTtlSec(-100); } - /** - * Validate that a bad match style configuration throws an exception. - */ - @Test(expected = IllegalArgumentException.class) - public void testSubscribeConfigBuilderBadMatchStyle() { - new SubscribeConfig.Builder().setMatchStyle(10); - } - /* * PublishConfig Tests */ |