diff options
Diffstat (limited to 'android/net/wifi/aware/SubscribeConfig.java')
-rw-r--r-- | android/net/wifi/aware/SubscribeConfig.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/android/net/wifi/aware/SubscribeConfig.java b/android/net/wifi/aware/SubscribeConfig.java index f6552a76..91f8e520 100644 --- a/android/net/wifi/aware/SubscribeConfig.java +++ b/android/net/wifi/aware/SubscribeConfig.java @@ -224,7 +224,7 @@ public final class SubscribeConfig implements Parcelable { * * @hide */ - public void assertValid(Characteristics characteristics) + public void assertValid(Characteristics characteristics, boolean rttSupported) throws IllegalArgumentException { WifiAwareUtils.validateServiceName(mServiceName); @@ -269,6 +269,10 @@ public final class SubscribeConfig implements Parcelable { throw new IllegalArgumentException( "Maximum distance must be greater than minimum distance"); } + + if (!rttSupported && (mMinDistanceMmSet || mMaxDistanceMmSet)) { + throw new IllegalArgumentException("Ranging is not supported"); + } } /** @@ -422,6 +426,9 @@ public final class SubscribeConfig implements Parcelable { * peer must enable ranging using * {@link PublishConfig.Builder#setRangingEnabled(boolean)}. Otherwise discovery will * never be triggered. + * <p> + * The device must support Wi-Fi RTT for this feature to be used. Feature support is checked + * as described in {@link android.net.wifi.rtt}. * * @param minDistanceMm Minimum distance, in mm, to the publisher above which to trigger * discovery. @@ -450,6 +457,9 @@ public final class SubscribeConfig implements Parcelable { * peer must enable ranging using * {@link PublishConfig.Builder#setRangingEnabled(boolean)}. Otherwise discovery will * never be triggered. + * <p> + * The device must support Wi-Fi RTT for this feature to be used. Feature support is checked + * as described in {@link android.net.wifi.rtt}. * * @param maxDistanceMm Maximum distance, in mm, to the publisher below which to trigger * discovery. |