1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wifi;
18 
19 import static com.android.server.wifi.util.InformationElementUtil.BssLoad.CHANNEL_UTILIZATION_SCALE;
20 
21 import android.content.Context;
22 import android.os.Handler;
23 import android.provider.DeviceConfig;
24 import android.util.ArraySet;
25 
26 import com.android.internal.annotations.VisibleForTesting;
27 
28 import java.util.Collections;
29 import java.util.Set;
30 import java.util.concurrent.TimeUnit;
31 
32 /**
33  * This class allows getting all configurable flags from DeviceConfig.
34  */
35 public class DeviceConfigFacade {
36     private Context mContext;
37     private final WifiMetrics mWifiMetrics;
38 
39     private static final String NAMESPACE = "wifi";
40 
41     // Default values of fields
42     @VisibleForTesting
43     protected static final int DEFAULT_ABNORMAL_CONNECTION_DURATION_MS =
44             (int) TimeUnit.SECONDS.toMillis(30);
45     // Default duration for evaluating Wifi condition to trigger a data stall
46     // measured in milliseconds
47     public static final int DEFAULT_DATA_STALL_DURATION_MS = 1500;
48     // Default threshold of Tx throughput below which to trigger a data stall measured in Kbps
49     public static final int DEFAULT_DATA_STALL_TX_TPUT_THR_KBPS = 2000;
50     // Default threshold of Rx throughput below which to trigger a data stall measured in Kbps
51     public static final int DEFAULT_DATA_STALL_RX_TPUT_THR_KBPS = 2000;
52     // Default threshold of Tx packet error rate above which to trigger a data stall in percentage
53     public static final int DEFAULT_DATA_STALL_TX_PER_THR = 90;
54     // Default threshold of CCA level above which to trigger a data stall
55     public static final int DEFAULT_DATA_STALL_CCA_LEVEL_THR = CHANNEL_UTILIZATION_SCALE;
56     // Default low threshold of L2 sufficient Tx throughput in Kbps
57     public static final int DEFAULT_TX_TPUT_SUFFICIENT_THR_LOW_KBPS = 1000;
58     // Default high threshold of L2 sufficient Tx throughput in Kbps
59     public static final int DEFAULT_TX_TPUT_SUFFICIENT_THR_HIGH_KBPS = 4000;
60     // Default low threshold of L2 sufficient Rx throughput in Kbps
61     public static final int DEFAULT_RX_TPUT_SUFFICIENT_THR_LOW_KBPS = 1000;
62     // Default high threshold of L2 sufficient Rx throughput in Kbps
63     public static final int DEFAULT_RX_TPUT_SUFFICIENT_THR_HIGH_KBPS = 4000;
64     // Numerator part of default threshold of L2 throughput over L3 throughput ratio
65     public static final int DEFAULT_TPUT_SUFFICIENT_RATIO_THR_NUM = 2;
66     // Denominator part of default threshold of L2 throughput over L3 throughput ratio
67     public static final int DEFAULT_TPUT_SUFFICIENT_RATIO_THR_DEN = 1;
68     // Default threshold of Tx packet per second
69     public static final int DEFAULT_TX_PACKET_PER_SECOND_THR = 2;
70     // Default threshold of Rx packet per second
71     public static final int DEFAULT_RX_PACKET_PER_SECOND_THR = 1;
72     // Default high threshold values for various connection/disconnection cases
73     // All of them are in percent with respect to connection attempts
74     static final int DEFAULT_CONNECTION_FAILURE_HIGH_THR_PERCENT = 40;
75     static final int DEFAULT_ASSOC_REJECTION_HIGH_THR_PERCENT = 30;
76     static final int DEFAULT_ASSOC_TIMEOUT_HIGH_THR_PERCENT = 30;
77     static final int DEFAULT_AUTH_FAILURE_HIGH_THR_PERCENT = 30;
78     static final int DEFAULT_SHORT_CONNECTION_NONLOCAL_HIGH_THR_PERCENT = 20;
79     static final int DEFAULT_DISCONNECTION_NONLOCAL_HIGH_THR_PERCENT = 25;
80     // Default health monitor abnormal count minimum for various cases
81     static final int DEFAULT_CONNECTION_FAILURE_COUNT_MIN = 6;
82     static final int DEFAULT_ASSOC_REJECTION_COUNT_MIN  = 3;
83     static final int DEFAULT_ASSOC_TIMEOUT_COUNT_MIN  = 3;
84     static final int DEFAULT_AUTH_FAILURE_COUNT_MIN  = 3;
85     static final int DEFAULT_SHORT_CONNECTION_NONLOCAL_COUNT_MIN  = 3;
86     static final int DEFAULT_DISCONNECTION_NONLOCAL_COUNT_MIN  = 3;
87     // Numerator part of default ratio threshold values for all cases
88     static final int DEFAULT_HEALTH_MONITOR_RATIO_THR_NUMERATOR = 4;
89     // Denominator part of ratio threshold for all cases
90     static final int HEALTH_MONITOR_RATIO_THR_DENOMINATOR = 2;
91     // Minimum RSSI in dBm for connection stats collection
92     // Connection or disconnection events with RSSI below this threshold are not
93     // included in connection stats collection.
94     static final int DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM = -68;
95     // Default minimum number of connection attempts to qualify daily detection
96     static final int DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT = 10;
97     // Default minimum wait time between two bug report captures
98     static final int DEFAULT_BUG_REPORT_MIN_WINDOW_MS = 3_600_000;
99     // Default report-high threshold to take-bug-report threshold ratio.
100     // It should be larger than 1 since the bar to take bugreport should be higher.
101     static final int DEFAULT_BUG_REPORT_THRESHOLD_EXTRA_RATIO = 2;
102     // Default overlapping connection duration threshold in ms to trigger bug report
103     static final int DEFAULT_OVERLAPPING_CONNECTION_DURATION_THRESHOLD_MS = 75_000;
104     // At low traffic, Tx link speed values below the following threshold
105     // are ignored because it could be due to low rate management frames
106     static final int DEFAULT_TX_LINK_SPEED_LOW_THRESHOLD_MBPS = 9;
107     // At low traffic, Rx link speed values below the following threshold
108     // are ignored because it could be due to low rate management frames
109     static final int DEFAULT_RX_LINK_SPEED_LOW_THRESHOLD_MBPS = 9;
110     // Default health monitor short connection duration threshold in ms
111     static final int DEFAULT_HEALTH_MONITOR_SHORT_CONNECTION_DURATION_THR_MS = 20_000;
112 
113     // Default mask for abnormal disconnection reason codes.
114     // Each bit of mask corresponds to a reason code defined in 802.11 standard section 9.4.1.7
115     // For example, b0 for reason code 0, b1 for reason code 1, etc.
116     // Bits below are abnormal disconnection reasons and thus are set to 1
117     // b0: reserved (e.g., STA heartbeat failure)
118     // b2: invalid auth
119     // b4: disassociated due to inactivity
120     // b6 and b7: invalid class 2 and 3 frames
121     // b34: disassociated due to missing ACKs
122     static final long DEFAULT_ABNORMAL_DISCONNECTION_REASON_CODE_MASK = 0x4_0000_00d5L;
123     // Default maximum interval between last RSSI poll and disconnection
124     static final int DEFAULT_HEALTH_MONITOR_RSSI_POLL_VALID_TIME_MS = 2_100;
125     // Default maximum interval between scan and connection attempt in non-stationary state
126     static final int DEFAULT_NONSTATIONARY_SCAN_RSSI_VALID_TIME_MS = 5_000;
127     // Default maximum interval between scan and connection attempt in stationary state
128     static final int DEFAULT_STATIONARY_SCAN_RSSI_VALID_TIME_MS = 8_000;
129     // Default health monitor firmware alert valid time.
130     // -1 disables firmware alert time check
131     static final int DEFAULT_HEALTH_MONITOR_FW_ALERT_VALID_TIME_MS = -1;
132     // Cached values of fields updated via updateDeviceConfigFlags()
133     private boolean mIsAbnormalConnectionBugreportEnabled;
134     private int mAbnormalConnectionDurationMs;
135     private int mDataStallDurationMs;
136     private int mDataStallTxTputThrKbps;
137     private int mDataStallRxTputThrKbps;
138     private int mDataStallTxPerThr;
139     private int mDataStallCcaLevelThr;
140     private int mTxTputSufficientLowThrKbps;
141     private int mTxTputSufficientHighThrKbps;
142     private int mRxTputSufficientLowThrKbps;
143     private int mRxTputSufficientHighThrKbps;
144     private int mTputSufficientRatioThrNum;
145     private int mTputSufficientRatioThrDen;
146     private int mTxPktPerSecondThr;
147     private int mRxPktPerSecondThr;
148     private int mConnectionFailureHighThrPercent;
149     private int mConnectionFailureCountMin;
150     private int mAssocRejectionHighThrPercent;
151     private int mAssocRejectionCountMin;
152     private int mAssocTimeoutHighThrPercent;
153     private int mAssocTimeoutCountMin;
154     private int mAuthFailureHighThrPercent;
155     private int mAuthFailureCountMin;
156     private int mShortConnectionNonlocalHighThrPercent;
157     private int mShortConnectionNonlocalCountMin;
158     private int mDisconnectionNonlocalHighThrPercent;
159     private int mDisconnectionNonlocalCountMin;
160     private int mHealthMonitorRatioThrNumerator;
161     private int mHealthMonitorMinRssiThrDbm;
162     private Set<String> mRandomizationFlakySsidHotlist;
163     private Set<String> mAggressiveMacRandomizationSsidAllowlist;
164     private Set<String> mAggressiveMacRandomizationSsidBlocklist;
165     private boolean mIsAbnormalConnectionFailureBugreportEnabled;
166     private boolean mIsAbnormalDisconnectionBugreportEnabled;
167     private int mHealthMonitorMinNumConnectionAttempt;
168     private int mBugReportMinWindowMs;
169     private int mBugReportThresholdExtraRatio;
170     private boolean mIsOverlappingConnectionBugreportEnabled;
171     private int mOverlappingConnectionDurationThresholdMs;
172     private int mTxLinkSpeedLowThresholdMbps;
173     private int mRxLinkSpeedLowThresholdMbps;
174     private int mHealthMonitorShortConnectionDurationThrMs;
175     private long mAbnormalDisconnectionReasonCodeMask;
176     private int mHealthMonitorRssiPollValidTimeMs;
177     private int mNonstationaryScanRssiValidTimeMs;
178     private int mStationaryScanRssiValidTimeMs;
179     private int mHealthMonitorFwAlertValidTimeMs;
180 
DeviceConfigFacade(Context context, Handler handler, WifiMetrics wifiMetrics)181     public DeviceConfigFacade(Context context, Handler handler, WifiMetrics wifiMetrics) {
182         mContext = context;
183         mWifiMetrics = wifiMetrics;
184 
185         updateDeviceConfigFlags();
186         DeviceConfig.addOnPropertiesChangedListener(
187                 NAMESPACE,
188                 command -> handler.post(command),
189                 properties -> {
190                     updateDeviceConfigFlags();
191                 });
192     }
193 
updateDeviceConfigFlags()194     private void updateDeviceConfigFlags() {
195         mIsAbnormalConnectionBugreportEnabled = DeviceConfig.getBoolean(NAMESPACE,
196                 "abnormal_connection_bugreport_enabled", false);
197         mAbnormalConnectionDurationMs = DeviceConfig.getInt(NAMESPACE,
198                 "abnormal_connection_duration_ms",
199                 DEFAULT_ABNORMAL_CONNECTION_DURATION_MS);
200 
201         mDataStallDurationMs = DeviceConfig.getInt(NAMESPACE,
202                 "data_stall_duration_ms", DEFAULT_DATA_STALL_DURATION_MS);
203         mDataStallTxTputThrKbps = DeviceConfig.getInt(NAMESPACE,
204                 "data_stall_tx_tput_thr_kbps", DEFAULT_DATA_STALL_TX_TPUT_THR_KBPS);
205         mDataStallRxTputThrKbps = DeviceConfig.getInt(NAMESPACE,
206                 "data_stall_rx_tput_thr_kbps", DEFAULT_DATA_STALL_RX_TPUT_THR_KBPS);
207         mDataStallTxPerThr = DeviceConfig.getInt(NAMESPACE,
208                 "data_stall_tx_per_thr", DEFAULT_DATA_STALL_TX_PER_THR);
209         mDataStallCcaLevelThr = DeviceConfig.getInt(NAMESPACE,
210                 "data_stall_cca_level_thr", DEFAULT_DATA_STALL_CCA_LEVEL_THR);
211         mWifiMetrics.setDataStallDurationMs(mDataStallDurationMs);
212         mWifiMetrics.setDataStallTxTputThrKbps(mDataStallTxTputThrKbps);
213         mWifiMetrics.setDataStallRxTputThrKbps(mDataStallRxTputThrKbps);
214         mWifiMetrics.setDataStallTxPerThr(mDataStallTxPerThr);
215         mWifiMetrics.setDataStallCcaLevelThr(mDataStallCcaLevelThr);
216 
217         mTxTputSufficientLowThrKbps = DeviceConfig.getInt(NAMESPACE,
218                 "tput_sufficient_low_thr_kbps", DEFAULT_TX_TPUT_SUFFICIENT_THR_LOW_KBPS);
219         mTxTputSufficientHighThrKbps = DeviceConfig.getInt(NAMESPACE,
220                 "tput_sufficient_high_thr_kbps", DEFAULT_TX_TPUT_SUFFICIENT_THR_HIGH_KBPS);
221         mRxTputSufficientLowThrKbps = DeviceConfig.getInt(NAMESPACE,
222                 "rx_tput_sufficient_low_thr_kbps", DEFAULT_RX_TPUT_SUFFICIENT_THR_LOW_KBPS);
223         mRxTputSufficientHighThrKbps = DeviceConfig.getInt(NAMESPACE,
224                 "rx_tput_sufficient_high_thr_kbps", DEFAULT_RX_TPUT_SUFFICIENT_THR_HIGH_KBPS);
225         mTputSufficientRatioThrNum = DeviceConfig.getInt(NAMESPACE,
226                 "tput_sufficient_ratio_thr_num", DEFAULT_TPUT_SUFFICIENT_RATIO_THR_NUM);
227         mTputSufficientRatioThrDen = DeviceConfig.getInt(NAMESPACE,
228                 "tput_sufficient_ratio_thr_den", DEFAULT_TPUT_SUFFICIENT_RATIO_THR_DEN);
229         mTxPktPerSecondThr = DeviceConfig.getInt(NAMESPACE,
230                 "tx_pkt_per_second_thr", DEFAULT_TX_PACKET_PER_SECOND_THR);
231         mRxPktPerSecondThr = DeviceConfig.getInt(NAMESPACE,
232                 "rx_pkt_per_second_thr", DEFAULT_RX_PACKET_PER_SECOND_THR);
233 
234         mConnectionFailureHighThrPercent = DeviceConfig.getInt(NAMESPACE,
235                 "connection_failure_high_thr_percent",
236                 DEFAULT_CONNECTION_FAILURE_HIGH_THR_PERCENT);
237         mConnectionFailureCountMin = DeviceConfig.getInt(NAMESPACE,
238                 "connection_failure_count_min",
239                 DEFAULT_CONNECTION_FAILURE_COUNT_MIN);
240         mAssocRejectionHighThrPercent = DeviceConfig.getInt(NAMESPACE,
241                 "assoc_rejection_high_thr_percent",
242                 DEFAULT_ASSOC_REJECTION_HIGH_THR_PERCENT);
243         mAssocRejectionCountMin = DeviceConfig.getInt(NAMESPACE,
244                 "assoc_rejection_count_min",
245                 DEFAULT_ASSOC_REJECTION_COUNT_MIN);
246         mAssocTimeoutHighThrPercent = DeviceConfig.getInt(NAMESPACE,
247                 "assoc_timeout_high_thr_percent",
248                 DEFAULT_ASSOC_TIMEOUT_HIGH_THR_PERCENT);
249         mAssocTimeoutCountMin = DeviceConfig.getInt(NAMESPACE,
250                 "assoc_timeout_count_min",
251                 DEFAULT_ASSOC_TIMEOUT_COUNT_MIN);
252         mAuthFailureHighThrPercent = DeviceConfig.getInt(NAMESPACE,
253                 "auth_failure_high_thr_percent",
254                 DEFAULT_AUTH_FAILURE_HIGH_THR_PERCENT);
255         mAuthFailureCountMin = DeviceConfig.getInt(NAMESPACE,
256                 "auth_failure_count_min",
257                 DEFAULT_AUTH_FAILURE_COUNT_MIN);
258         mShortConnectionNonlocalHighThrPercent = DeviceConfig.getInt(NAMESPACE,
259                 "short_connection_nonlocal_high_thr_percent",
260                 DEFAULT_SHORT_CONNECTION_NONLOCAL_HIGH_THR_PERCENT);
261         mShortConnectionNonlocalCountMin = DeviceConfig.getInt(NAMESPACE,
262                 "short_connection_nonlocal_count_min",
263                 DEFAULT_SHORT_CONNECTION_NONLOCAL_COUNT_MIN);
264         mDisconnectionNonlocalHighThrPercent = DeviceConfig.getInt(NAMESPACE,
265                 "disconnection_nonlocal_high_thr_percent",
266                 DEFAULT_DISCONNECTION_NONLOCAL_HIGH_THR_PERCENT);
267         mDisconnectionNonlocalCountMin = DeviceConfig.getInt(NAMESPACE,
268                 "disconnection_nonlocal_count_min",
269                 DEFAULT_DISCONNECTION_NONLOCAL_COUNT_MIN);
270         mHealthMonitorRatioThrNumerator = DeviceConfig.getInt(NAMESPACE,
271                 "health_monitor_ratio_thr_numerator",
272                 DEFAULT_HEALTH_MONITOR_RATIO_THR_NUMERATOR);
273         mHealthMonitorMinRssiThrDbm = DeviceConfig.getInt(NAMESPACE,
274                 "health_monitor_min_rssi_thr_dbm",
275                 DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM);
276 
277         mRandomizationFlakySsidHotlist =
278                 getUnmodifiableSetQuoted("randomization_flaky_ssid_hotlist");
279         mAggressiveMacRandomizationSsidAllowlist =
280                 getUnmodifiableSetQuoted("aggressive_randomization_ssid_allowlist");
281         mAggressiveMacRandomizationSsidBlocklist =
282                 getUnmodifiableSetQuoted("aggressive_randomization_ssid_blocklist");
283 
284         mIsAbnormalConnectionFailureBugreportEnabled = DeviceConfig.getBoolean(NAMESPACE,
285                 "abnormal_connection_failure_bugreport_enabled", false);
286         mIsAbnormalDisconnectionBugreportEnabled = DeviceConfig.getBoolean(NAMESPACE,
287                 "abnormal_disconnection_bugreport_enabled", false);
288         mHealthMonitorMinNumConnectionAttempt = DeviceConfig.getInt(NAMESPACE,
289                 "health_monitor_min_num_connection_attempt",
290                 DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT);
291         mBugReportMinWindowMs = DeviceConfig.getInt(NAMESPACE,
292                 "bug_report_min_window_ms",
293                 DEFAULT_BUG_REPORT_MIN_WINDOW_MS);
294         mBugReportThresholdExtraRatio = DeviceConfig.getInt(NAMESPACE,
295                 "report_bug_report_threshold_extra_ratio",
296                 DEFAULT_BUG_REPORT_THRESHOLD_EXTRA_RATIO);
297         mIsOverlappingConnectionBugreportEnabled = DeviceConfig.getBoolean(NAMESPACE,
298                 "overlapping_connection_bugreport_enabled", false);
299         mOverlappingConnectionDurationThresholdMs = DeviceConfig.getInt(NAMESPACE,
300                 "overlapping_connection_duration_threshold_ms",
301                 DEFAULT_OVERLAPPING_CONNECTION_DURATION_THRESHOLD_MS);
302         mTxLinkSpeedLowThresholdMbps = DeviceConfig.getInt(NAMESPACE,
303                 "tx_link_speed_low_threshold_mbps",
304                 DEFAULT_TX_LINK_SPEED_LOW_THRESHOLD_MBPS);
305         mRxLinkSpeedLowThresholdMbps = DeviceConfig.getInt(NAMESPACE,
306                 "rx_link_speed_low_threshold_mbps",
307                 DEFAULT_RX_LINK_SPEED_LOW_THRESHOLD_MBPS);
308         mHealthMonitorShortConnectionDurationThrMs = DeviceConfig.getInt(NAMESPACE,
309                 "health_monitor_short_connection_duration_thr_ms",
310                 DEFAULT_HEALTH_MONITOR_SHORT_CONNECTION_DURATION_THR_MS);
311         mAbnormalDisconnectionReasonCodeMask = DeviceConfig.getLong(NAMESPACE,
312                 "abnormal_disconnection_reason_code_mask",
313                 DEFAULT_ABNORMAL_DISCONNECTION_REASON_CODE_MASK);
314         mHealthMonitorRssiPollValidTimeMs = DeviceConfig.getInt(NAMESPACE,
315                 "health_monitor_rssi_poll_valid_time_ms",
316                 DEFAULT_HEALTH_MONITOR_RSSI_POLL_VALID_TIME_MS);
317         mNonstationaryScanRssiValidTimeMs = DeviceConfig.getInt(NAMESPACE,
318                 "nonstationary_scan_rssi_valid_time_ms",
319                 DEFAULT_NONSTATIONARY_SCAN_RSSI_VALID_TIME_MS);
320         mStationaryScanRssiValidTimeMs = DeviceConfig.getInt(NAMESPACE,
321                 "stationary_scan_rssi_valid_time_ms",
322                 DEFAULT_STATIONARY_SCAN_RSSI_VALID_TIME_MS);
323         mHealthMonitorFwAlertValidTimeMs = DeviceConfig.getInt(NAMESPACE,
324                 "health_monitor_fw_alert_valid_time_ms",
325                 DEFAULT_HEALTH_MONITOR_FW_ALERT_VALID_TIME_MS);
326         mWifiMetrics.setHealthMonitorRssiPollValidTimeMs(mHealthMonitorRssiPollValidTimeMs);
327 
328     }
329 
getUnmodifiableSetQuoted(String key)330     private Set<String> getUnmodifiableSetQuoted(String key) {
331         String rawList = DeviceConfig.getString(NAMESPACE, key, "");
332         Set<String> result = new ArraySet<>();
333         String[] list = rawList.split(",");
334         for (String cur : list) {
335             if (cur.length() == 0) {
336                 continue;
337             }
338             result.add("\"" + cur + "\"");
339         }
340         return Collections.unmodifiableSet(result);
341     }
342 
343     /**
344      * Gets the feature flag for reporting abnormally long connections.
345      */
isAbnormalConnectionBugreportEnabled()346     public boolean isAbnormalConnectionBugreportEnabled() {
347         return mIsAbnormalConnectionBugreportEnabled;
348     }
349 
350     /**
351      * Gets the threshold for classifying abnormally long connections.
352      */
getAbnormalConnectionDurationMs()353     public int getAbnormalConnectionDurationMs() {
354         return mAbnormalConnectionDurationMs;
355     }
356 
357     /**
358      * Gets the duration of evaluating Wifi condition to trigger a data stall.
359      */
getDataStallDurationMs()360     public int getDataStallDurationMs() {
361         return mDataStallDurationMs;
362     }
363 
364     /**
365      * Gets the threshold of Tx throughput below which to trigger a data stall.
366      */
getDataStallTxTputThrKbps()367     public int getDataStallTxTputThrKbps() {
368         return mDataStallTxTputThrKbps;
369     }
370 
371     /**
372      * Gets the threshold of Rx throughput below which to trigger a data stall.
373      */
getDataStallRxTputThrKbps()374     public int getDataStallRxTputThrKbps() {
375         return mDataStallRxTputThrKbps;
376     }
377 
378     /**
379      * Gets the threshold of Tx packet error rate above which to trigger a data stall.
380      */
getDataStallTxPerThr()381     public int getDataStallTxPerThr() {
382         return mDataStallTxPerThr;
383     }
384 
385     /**
386      * Gets the threshold of CCA level above which to trigger a data stall.
387      */
getDataStallCcaLevelThr()388     public int getDataStallCcaLevelThr() {
389         return mDataStallCcaLevelThr;
390     }
391 
392     /**
393      * Gets the low threshold of L2 throughput below which L2 throughput is always insufficient
394      */
getTxTputSufficientLowThrKbps()395     public int getTxTputSufficientLowThrKbps() {
396         return mTxTputSufficientLowThrKbps;
397     }
398 
399     /**
400      * Gets the high threshold of L2 throughput above which L2 throughput is always sufficient
401      */
getTxTputSufficientHighThrKbps()402     public int getTxTputSufficientHighThrKbps() {
403         return mTxTputSufficientHighThrKbps;
404     }
405 
406     /**
407      * Gets the low threshold of L2 throughput below which L2 Rx throughput is always insufficient
408      */
getRxTputSufficientLowThrKbps()409     public int getRxTputSufficientLowThrKbps() {
410         return mRxTputSufficientLowThrKbps;
411     }
412 
413     /**
414      * Gets the high threshold of L2 throughput above which L2 Rx throughput is always sufficient
415      */
getRxTputSufficientHighThrKbps()416     public int getRxTputSufficientHighThrKbps() {
417         return mRxTputSufficientHighThrKbps;
418     }
419 
420     /**
421      * Gets the numerator part of L2 throughput over L3 throughput ratio sufficiency threshold
422      * above which L2 throughput is sufficient
423      */
getTputSufficientRatioThrNum()424     public int getTputSufficientRatioThrNum() {
425         return mTputSufficientRatioThrNum;
426     }
427 
428     /**
429      * Gets the denominator part of L2 throughput over L3 throughput ratio sufficiency threshold
430      * above which L2 throughput is sufficient
431      */
getTputSufficientRatioThrDen()432     public int getTputSufficientRatioThrDen() {
433         return mTputSufficientRatioThrDen;
434     }
435 
436     /**
437      * Gets the threshold of Tx packet per second
438      * below which Tx throughput sufficiency check will always pass
439      */
getTxPktPerSecondThr()440     public int getTxPktPerSecondThr() {
441         return mTxPktPerSecondThr;
442     }
443 
444     /**
445      * Gets the threshold of Rx packet per second
446      * below which Rx throughput sufficiency check will always pass
447      */
getRxPktPerSecondThr()448     public int getRxPktPerSecondThr() {
449         return mRxPktPerSecondThr;
450     }
451 
452     /**
453      * Gets the high threshold of connection failure rate in percent
454      */
getConnectionFailureHighThrPercent()455     public int getConnectionFailureHighThrPercent() {
456         return mConnectionFailureHighThrPercent;
457     }
458 
459     /**
460      * Gets connection failure min count
461      */
getConnectionFailureCountMin()462     public int getConnectionFailureCountMin() {
463         return mConnectionFailureCountMin;
464     }
465 
466     /**
467      * Gets the high threshold of association rejection rate in percent
468      */
getAssocRejectionHighThrPercent()469     public int getAssocRejectionHighThrPercent() {
470         return mAssocRejectionHighThrPercent;
471     }
472 
473     /**
474      * Gets association rejection min count
475      */
getAssocRejectionCountMin()476     public int getAssocRejectionCountMin() {
477         return mAssocRejectionCountMin;
478     }
479 
480     /**
481      * Gets the high threshold of association timeout rate in percent
482      */
getAssocTimeoutHighThrPercent()483     public int getAssocTimeoutHighThrPercent() {
484         return mAssocTimeoutHighThrPercent;
485     }
486 
487     /**
488      * Gets association timeout min count
489      */
getAssocTimeoutCountMin()490     public int getAssocTimeoutCountMin() {
491         return mAssocTimeoutCountMin;
492     }
493 
494 
495     /**
496      * Gets the high threshold of authentication failure rate in percent
497      */
getAuthFailureHighThrPercent()498     public int getAuthFailureHighThrPercent() {
499         return mAuthFailureHighThrPercent;
500     }
501 
502     /**
503      * Gets authentication failure min count
504      */
getAuthFailureCountMin()505     public int getAuthFailureCountMin() {
506         return mAuthFailureCountMin;
507     }
508 
509     /**
510      * Gets the high threshold of nonlocal short connection rate in percent
511      */
getShortConnectionNonlocalHighThrPercent()512     public int getShortConnectionNonlocalHighThrPercent() {
513         return mShortConnectionNonlocalHighThrPercent;
514     }
515 
516     /**
517      * Gets nonlocal short connection min count
518      */
getShortConnectionNonlocalCountMin()519     public int getShortConnectionNonlocalCountMin() {
520         return mShortConnectionNonlocalCountMin;
521     }
522 
523     /**
524      * Gets the high threshold of nonlocal disconnection rate in percent
525      */
getDisconnectionNonlocalHighThrPercent()526     public int getDisconnectionNonlocalHighThrPercent() {
527         return mDisconnectionNonlocalHighThrPercent;
528     }
529 
530     /**
531      * Gets nonlocal disconnection min count
532      */
getDisconnectionNonlocalCountMin()533     public int getDisconnectionNonlocalCountMin() {
534         return mDisconnectionNonlocalCountMin;
535     }
536 
537     /**
538      * Gets health monitor ratio threshold, numerator part
539      */
getHealthMonitorRatioThrNumerator()540     public int getHealthMonitorRatioThrNumerator() {
541         return mHealthMonitorRatioThrNumerator;
542     }
543 
544     /**
545      * Gets health monitor min RSSI threshold in dBm
546      */
getHealthMonitorMinRssiThrDbm()547     public int getHealthMonitorMinRssiThrDbm() {
548         return mHealthMonitorMinRssiThrDbm;
549     }
550 
551     /**
552      * Gets the Set of SSIDs in the flaky SSID hotlist.
553      */
getRandomizationFlakySsidHotlist()554     public Set<String> getRandomizationFlakySsidHotlist() {
555         return mRandomizationFlakySsidHotlist;
556     }
557 
558     /**
559      * Gets the list of SSIDs for aggressive MAC randomization.
560      */
getAggressiveMacRandomizationSsidAllowlist()561     public Set<String> getAggressiveMacRandomizationSsidAllowlist() {
562         return mAggressiveMacRandomizationSsidAllowlist;
563     }
564 
565     /**
566      * Gets the list of SSIDs that aggressive MAC randomization should not be used for.
567      */
getAggressiveMacRandomizationSsidBlocklist()568     public Set<String> getAggressiveMacRandomizationSsidBlocklist() {
569         return mAggressiveMacRandomizationSsidBlocklist;
570     }
571     /**
572      * Gets the feature flag for reporting abnormal connection failure.
573      */
isAbnormalConnectionFailureBugreportEnabled()574     public boolean isAbnormalConnectionFailureBugreportEnabled() {
575         return mIsAbnormalConnectionFailureBugreportEnabled;
576     }
577 
578     /**
579      * Gets the feature flag for reporting abnormal disconnection.
580      */
isAbnormalDisconnectionBugreportEnabled()581     public boolean isAbnormalDisconnectionBugreportEnabled() {
582         return mIsAbnormalDisconnectionBugreportEnabled;
583     }
584 
585     /**
586      * Gets health monitor min number of connection attempt threshold
587      */
getHealthMonitorMinNumConnectionAttempt()588     public int getHealthMonitorMinNumConnectionAttempt() {
589         return mHealthMonitorMinNumConnectionAttempt;
590     }
591 
592     /**
593      * Gets minimum wait time between two bug report captures
594      */
getBugReportMinWindowMs()595     public int getBugReportMinWindowMs() {
596         return mBugReportMinWindowMs;
597     }
598 
599     /**
600      * Gets the extra ratio of threshold to trigger bug report.
601      */
getBugReportThresholdExtraRatio()602     public int getBugReportThresholdExtraRatio() {
603         return mBugReportThresholdExtraRatio;
604     }
605 
606     /**
607      * Gets the feature flag for reporting overlapping connection.
608      */
isOverlappingConnectionBugreportEnabled()609     public boolean isOverlappingConnectionBugreportEnabled() {
610         return mIsOverlappingConnectionBugreportEnabled;
611     }
612 
613     /**
614      * Gets overlapping connection duration threshold in ms
615      */
getOverlappingConnectionDurationThresholdMs()616     public int getOverlappingConnectionDurationThresholdMs() {
617         return mOverlappingConnectionDurationThresholdMs;
618     }
619 
620     /**
621      * Gets the threshold of link speed below which Tx link speed is ignored at low traffic
622      */
getTxLinkSpeedLowThresholdMbps()623     public int getTxLinkSpeedLowThresholdMbps() {
624         return mTxLinkSpeedLowThresholdMbps;
625     }
626 
627     /**
628      * Gets the threshold of link speed below which Rx link speed is ignored at low traffic
629      */
getRxLinkSpeedLowThresholdMbps()630     public int getRxLinkSpeedLowThresholdMbps() {
631         return mRxLinkSpeedLowThresholdMbps;
632     }
633 
634     /**
635      * Gets health monitor short connection duration threshold in ms
636      */
getHealthMonitorShortConnectionDurationThrMs()637     public int getHealthMonitorShortConnectionDurationThrMs() {
638         return mHealthMonitorShortConnectionDurationThrMs;
639     }
640 
641     /**
642      * Gets abnormal disconnection reason code mask
643      */
getAbnormalDisconnectionReasonCodeMask()644     public long getAbnormalDisconnectionReasonCodeMask() {
645         return mAbnormalDisconnectionReasonCodeMask;
646     }
647 
648     /**
649      * Gets health monitor RSSI poll valid time in ms
650      */
getHealthMonitorRssiPollValidTimeMs()651     public int getHealthMonitorRssiPollValidTimeMs() {
652         return mHealthMonitorRssiPollValidTimeMs;
653     }
654 
655     /**
656      * Gets scan rssi valid time in ms when device is in non-stationary state
657      */
getNonstationaryScanRssiValidTimeMs()658     public int getNonstationaryScanRssiValidTimeMs() {
659         return mNonstationaryScanRssiValidTimeMs;
660     }
661 
662     /**
663      * Gets scan rssi valid time in ms when device is in stationary state
664      */
getStationaryScanRssiValidTimeMs()665     public int getStationaryScanRssiValidTimeMs() {
666         return mStationaryScanRssiValidTimeMs;
667     }
668 
669     /**
670      * Gets health monitor firmware alert valid time in ms,
671      * -1 disables firmware alert time check
672      */
getHealthMonitorFwAlertValidTimeMs()673     public int getHealthMonitorFwAlertValidTimeMs() {
674         return mHealthMonitorFwAlertValidTimeMs;
675     }
676 }
677