diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-11-09 01:58:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-11-09 01:58:36 +0000 |
commit | d11a226fd95ae690746e1eef985fda6f9fc213b9 (patch) | |
tree | d49612f369bd0b5cdfbc6f846718eb8ea6e9229e /service | |
parent | c6e972fb9f86cdd7bb597a4badd1eddaffcc48e4 (diff) | |
parent | 88a742d479748d1fa248f7814591b76c436f8648 (diff) |
Merge "[WifiRtt] add check to verify bw and preamble combination valid" into qt-qpr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/rtt/RttNative.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/rtt/RttNative.java b/service/java/com/android/server/wifi/rtt/RttNative.java index eaf947062..ffbf5bef9 100644 --- a/service/java/com/android/server/wifi/rtt/RttNative.java +++ b/service/java/com/android/server/wifi/rtt/RttNative.java @@ -311,6 +311,7 @@ public class RttNative extends IWifiRttControllerEventCallback.Stub { config.channel.centerFreq1 = responder.centerFreq1; config.bw = halRttChannelBandwidthFromResponderChannelWidth(responder.channelWidth); config.preamble = halRttPreambleFromResponderPreamble(responder.preamble); + validateBwAndPreambleCombination(config.bw, config.preamble); if (config.peer == RttPeerType.NAN) { config.mustRequestLci = false; @@ -349,6 +350,20 @@ public class RttNative extends IWifiRttControllerEventCallback.Stub { return rttConfigs; } + private static void validateBwAndPreambleCombination(int bw, int preamble) { + if (bw <= RttBw.BW_20MHZ) { + return; + } + if (bw == RttBw.BW_40MHZ && preamble >= RttPreamble.HT) { + return; + } + if (bw >= RttBw.BW_80MHZ && preamble >= RttPreamble.VHT) { + return; + } + throw new IllegalArgumentException( + "bw and preamble combination is invalid, bw: " + bw + " preamble: " + preamble); + } + private static int halRttPeerTypeFromResponderType(int responderType) { switch (responderType) { case ResponderConfig.RESPONDER_AP: |