Merge changes from topic 'do_not_roam_on_traffic' into oc-dr1-dev

* changes:
  Add traffic thresholds to prevent wifi network changes
  WifiInfo: Add getters for success tx/rx rate
This commit is contained in:
TreeHugger Robot
2017-08-02 22:09:15 +00:00
committed by Android (Google) Code Review
3 changed files with 27 additions and 5 deletions

View File

@@ -490,6 +490,9 @@
<!-- Integers specifying the max packet Tx/Rx rates for full scan -->
<integer translatable="false" name="config_wifi_framework_max_tx_rate_for_full_scan">8</integer>
<integer translatable="false" name="config_wifi_framework_max_rx_rate_for_full_scan">16</integer>
<!-- Integers specifying the min packet Tx/Rx rates in packets per second for staying on the same network -->
<integer translatable="false" name="config_wifi_framework_min_tx_rate_for_staying_on_network">16</integer>
<integer translatable="false" name="config_wifi_framework_min_rx_rate_for_staying_on_network">16</integer>
<!-- Integer parameters of the wifi to cellular handover feature
wifi should not stick to bad networks -->
<integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz">-82</integer>

View File

@@ -375,6 +375,8 @@
<java-symbol type="string" name="config_wifi_framework_sap_2G_channel_list" />
<java-symbol type="integer" name="config_wifi_framework_max_tx_rate_for_full_scan" />
<java-symbol type="integer" name="config_wifi_framework_max_rx_rate_for_full_scan" />
<java-symbol type="integer" name="config_wifi_framework_min_tx_rate_for_staying_on_network" />
<java-symbol type="integer" name="config_wifi_framework_min_rx_rate_for_staying_on_network" />
<java-symbol type="bool" name="config_wifi_framework_cellular_handover_enable_user_triggered_adjustment" />
<java-symbol type="integer" name="config_wifi_framework_associated_full_scan_tx_packet_threshold" />

View File

@@ -151,8 +151,9 @@ public class WifiInfo implements Parcelable {
/**
* This factor is used to adjust the rate output under the new algorithm
* such that the result is comparable to the previous algorithm.
* This actually converts from unit 'packets per second' to 'packets per 5 seconds'.
*/
private static final long OUTPUT_SCALE_FACTOR = 5000;
private static final long OUTPUT_SCALE_FACTOR = 5;
private long mLastPacketCountUpdateTimeStamp;
/**
@@ -198,16 +199,16 @@ public class WifiInfo implements Parcelable {
double currentSampleWeight = 1.0 - lastSampleWeight;
txBadRate = txBadRate * lastSampleWeight
+ (txbad - txBad) * OUTPUT_SCALE_FACTOR / timeDelta
+ (txbad - txBad) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta
* currentSampleWeight;
txSuccessRate = txSuccessRate * lastSampleWeight
+ (txgood - txSuccess) * OUTPUT_SCALE_FACTOR / timeDelta
+ (txgood - txSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta
* currentSampleWeight;
rxSuccessRate = rxSuccessRate * lastSampleWeight
+ (rxgood - rxSuccess) * OUTPUT_SCALE_FACTOR / timeDelta
+ (rxgood - rxSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta
* currentSampleWeight;
txRetriesRate = txRetriesRate * lastSampleWeight
+ (txretries - txRetries) * OUTPUT_SCALE_FACTOR / timeDelta
+ (txretries - txRetries) * OUTPUT_SCALE_FACTOR * 1000/ timeDelta
* currentSampleWeight;
} else {
txBadRate = 0;
@@ -446,6 +447,22 @@ public class WifiInfo implements Parcelable {
return ScanResult.is5GHz(mFrequency);
}
/**
* @hide
* This returns txSuccessRate in packets per second.
*/
public double getTxSuccessRatePps() {
return txSuccessRate / OUTPUT_SCALE_FACTOR;
}
/**
* @hide
* This returns rxSuccessRate in packets per second.
*/
public double getRxSuccessRatePps() {
return rxSuccessRate / OUTPUT_SCALE_FACTOR;
}
/**
* Record the MAC address of the WLAN interface
* @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form