Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59611421 authored by xin He's avatar xin He Committed by Android Partner Code Review
Browse files

Merge "Initial codes for Quality network selection [DO NOT MERGE]" into mm-wireless-dev

parents 831e401c 8d106780
Loading
Loading
Loading
Loading
+14 −10
Original line number Original line Diff line number Diff line
@@ -409,22 +409,26 @@
    <!-- Boolean indicating whether or not wifi firmware debugging is enabled -->
    <!-- Boolean indicating whether or not wifi firmware debugging is enabled -->
    <bool translatable="false" name="config_wifi_enable_wifi_firmware_debugging">true</bool>
    <bool translatable="false" name="config_wifi_enable_wifi_firmware_debugging">true</bool>


    <!-- Integer specifying the basic autojoin parameters -->
    <!-- Integer specifying the basic Quality Network Selection parameters -->
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_boost_threshold">-65</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_boost_threshold">-65</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_boost_factor">5</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_boost_factor">40</integer>
    <integer translatable="false" name="config_wifi_framework_current_association_hysteresis_high">16</integer>
    <integer translatable="false" name="config_wifi_framework_current_association_hysteresis_high">16</integer>
    <integer translatable="false" name="config_wifi_framework_current_association_hysteresis_low">10</integer>
    <integer translatable="false" name="config_wifi_framework_current_association_hysteresis_low">10</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_penalty_threshold">-75</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_penalty_threshold">-75</integer>
    <integer translatable="false" name="config_wifi_framework_5GHz_preference_penalty_factor">2</integer>
    <integer translatable="false" name="config_wifi_framework_RSSI_SCORE_OFFSET">85</integer>

    <integer translatable="false" name="config_wifi_framework_RSSI_SCORE_SLOPE">4</integer>
    <integer translatable="false" name="config_wifi_framework_SAME_BSSID_AWARD">24</integer>
    <integer translatable="false" name="config_wifi_framework_LAST_SELECTION_AWARD">480</integer>
    <integer translatable="false" name="config_wifi_framework_PASSPOINT_SECURITY_AWARD">40</integer>
    <integer translatable="false" name="config_wifi_framework_SECURITY_AWARD">80</integer>
    <!-- Integer parameters of the wifi to cellular handover feature
    <!-- Integer parameters of the wifi to cellular handover feature
         wifi should not stick to bad networks -->
         wifi should not stick to bad networks -->
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz">-82</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz">-82</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_5GHz">-72</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_5GHz">-70</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_5GHz">-60</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_5GHz">-57</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_24GHz">-87</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_rssi_threshold_24GHz">-85</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_24GHz">-77</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_low_rssi_threshold_24GHz">-73</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_24GHz">-65</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_rssi_threshold_24GHz">-60</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_24">6</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_24">6</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_5">12</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_bad_link_speed_5">12</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_link_speed_24">24</integer>
    <integer translatable="false" name="config_wifi_framework_wifi_score_good_link_speed_24">24</integer>
@@ -498,7 +502,7 @@
    <integer translatable="false" name="config_wifi_framework_network_black_list_min_time_milli">120000</integer>
    <integer translatable="false" name="config_wifi_framework_network_black_list_min_time_milli">120000</integer>


    <!-- Integer indicating RSSI boost given to current network -->
    <!-- Integer indicating RSSI boost given to current network -->
    <integer translatable="false" name="config_wifi_framework_current_network_boost">25</integer>
    <integer translatable="false" name="config_wifi_framework_current_network_boost">16</integer>


    <!-- Integer indicating how to handle beacons with uninitialized RSSI value of 0 -->
    <!-- Integer indicating how to handle beacons with uninitialized RSSI value of 0 -->
    <integer translatable="false" name="config_wifi_framework_scan_result_rssi_level_patchup_value">-85</integer>
    <integer translatable="false" name="config_wifi_framework_scan_result_rssi_level_patchup_value">-85</integer>
+6 −1
Original line number Original line Diff line number Diff line
@@ -316,7 +316,12 @@
  <java-symbol type="integer" name="config_wifi_framework_current_association_hysteresis_high" />
  <java-symbol type="integer" name="config_wifi_framework_current_association_hysteresis_high" />
  <java-symbol type="integer" name="config_wifi_framework_current_association_hysteresis_low" />
  <java-symbol type="integer" name="config_wifi_framework_current_association_hysteresis_low" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_factor" />
  <java-symbol type="integer" name="config_wifi_framework_RSSI_SCORE_OFFSET" />
  <java-symbol type="integer" name="config_wifi_framework_RSSI_SCORE_SLOPE" />
  <java-symbol type="integer" name="config_wifi_framework_SAME_BSSID_AWARD" />
  <java-symbol type="integer" name="config_wifi_framework_LAST_SELECTION_AWARD" />
  <java-symbol type="integer" name="config_wifi_framework_PASSPOINT_SECURITY_AWARD" />
  <java-symbol type="integer" name="config_wifi_framework_SECURITY_AWARD" />
  <java-symbol type="integer" name="config_wifi_disconnected_short_scan_interval" />
  <java-symbol type="integer" name="config_wifi_disconnected_short_scan_interval" />
  <java-symbol type="integer" name="config_wifi_disconnected_long_scan_interval" />
  <java-symbol type="integer" name="config_wifi_disconnected_long_scan_interval" />
  <java-symbol type="integer" name="config_wifi_associated_short_scan_interval" />
  <java-symbol type="integer" name="config_wifi_associated_short_scan_interval" />
+30 −59
Original line number Original line Diff line number Diff line
@@ -394,34 +394,21 @@ public class AccessPoint implements Comparable<AccessPoint> {
            summary.append(String.format(format, mConfig.providerFriendlyName));
            summary.append(String.format(format, mConfig.providerFriendlyName));
        } else if (mConfig != null && mConfig.hasNoInternetAccess()) {
        } else if (mConfig != null && mConfig.hasNoInternetAccess()) {
            summary.append(mContext.getString(R.string.wifi_no_internet));
            summary.append(mContext.getString(R.string.wifi_no_internet));
        } else if (mConfig != null && ((mConfig.status == WifiConfiguration.Status.DISABLED &&
        } else if (mConfig != null && !mConfig.getNetworkSelectionStatus().isNetworkEnabled()) {
                mConfig.disableReason != WifiConfiguration.DISABLED_UNKNOWN_REASON)
            WifiConfiguration.NetworkSelectionStatus networkStatus =
               || mConfig.autoJoinStatus
                    mConfig.getNetworkSelectionStatus();
                >= WifiConfiguration.AUTO_JOIN_DISABLED_ON_AUTH_FAILURE)) {
            switch (networkStatus.getNetworkSelectionDisableReason()) {
            if (mConfig.autoJoinStatus
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE:
                    >= WifiConfiguration.AUTO_JOIN_DISABLED_ON_AUTH_FAILURE) {
                if (mConfig.disableReason == WifiConfiguration.DISABLED_DHCP_FAILURE) {
                    summary.append(mContext.getString(R.string.wifi_disabled_network_failure));
                } else if (mConfig.disableReason == WifiConfiguration.DISABLED_AUTH_FAILURE) {
                    summary.append(mContext.getString(R.string.wifi_disabled_password_failure));
                } else {
                    summary.append(mContext.getString(R.string.wifi_disabled_wifi_failure));
                }
            } else {
                switch (mConfig.disableReason) {
                    case WifiConfiguration.DISABLED_AUTH_FAILURE:
                    summary.append(mContext.getString(R.string.wifi_disabled_password_failure));
                    summary.append(mContext.getString(R.string.wifi_disabled_password_failure));
                    break;
                    break;
                    case WifiConfiguration.DISABLED_DHCP_FAILURE:
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_DHCP_FAILURE:
                    case WifiConfiguration.DISABLED_DNS_FAILURE:
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_DNS_FAILURE:
                    summary.append(mContext.getString(R.string.wifi_disabled_network_failure));
                    summary.append(mContext.getString(R.string.wifi_disabled_network_failure));
                    break;
                    break;
                    case WifiConfiguration.DISABLED_UNKNOWN_REASON:
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_ASSOCIATION_REJECTION:
                    case WifiConfiguration.DISABLED_ASSOCIATION_REJECT:
                    summary.append(mContext.getString(R.string.wifi_disabled_generic));
                    summary.append(mContext.getString(R.string.wifi_disabled_generic));
                    break;
                    break;
            }
            }
            }
        } else if (mRssi == Integer.MAX_VALUE) { // Wifi out of range
        } else if (mRssi == Integer.MAX_VALUE) { // Wifi out of range
            summary.append(mContext.getString(R.string.wifi_not_in_range));
            summary.append(mContext.getString(R.string.wifi_not_in_range));
        } else { // In range, not disabled.
        } else { // In range, not disabled.
@@ -437,11 +424,11 @@ public class AccessPoint implements Comparable<AccessPoint> {
                summary.append(" f=" + Integer.toString(mInfo.getFrequency()));
                summary.append(" f=" + Integer.toString(mInfo.getFrequency()));
            }
            }
            summary.append(" " + getVisibilityStatus());
            summary.append(" " + getVisibilityStatus());
            if (mConfig != null && mConfig.autoJoinStatus > 0) {
            if (mConfig != null && !mConfig.getNetworkSelectionStatus().isNetworkEnabled()) {
                summary.append(" (" + mConfig.autoJoinStatus);
                summary.append(" (" + mConfig.getNetworkSelectionStatus().getNetworkStatusString());
                if (mConfig.blackListTimestamp > 0) {
                if (mConfig.getNetworkSelectionStatus().getDisableTime() > 0) {
                    long now = System.currentTimeMillis();
                    long now = System.currentTimeMillis();
                    long diff = (now - mConfig.blackListTimestamp)/1000;
                    long diff = (now - mConfig.getNetworkSelectionStatus().getDisableTime()) / 1000;
                    long sec = diff%60; //seconds
                    long sec = diff%60; //seconds
                    long min = (diff/60)%60; //minutes
                    long min = (diff/60)%60; //minutes
                    long hour = (min/60)%60; //hours
                    long hour = (min/60)%60; //hours
@@ -452,17 +439,19 @@ public class AccessPoint implements Comparable<AccessPoint> {
                }
                }
                summary.append(")");
                summary.append(")");
            }
            }
            if (mConfig != null && mConfig.numIpConfigFailures > 0) {

                summary.append(" ipf=").append(mConfig.numIpConfigFailures);
            if (mConfig != null) {
            }
                WifiConfiguration.NetworkSelectionStatus networkStatus =
            if (mConfig != null && mConfig.numConnectionFailures > 0) {
                        mConfig.getNetworkSelectionStatus();
                summary.append(" cf=").append(mConfig.numConnectionFailures);
                for (int index = WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLE;
                        index < WifiConfiguration.NetworkSelectionStatus
                        .NETWORK_SELECTION_DISABLED_MAX; index++) {
                    if (networkStatus.getDisableReasonCounter(index) != 0) {
                        summary.append(" " + WifiConfiguration.NetworkSelectionStatus
                                .getNetworkDisableReasonString(index) + "="
                                + networkStatus.getDisableReasonCounter(index));
                    }
                    }
            if (mConfig != null && mConfig.numAuthFailures > 0) {
                summary.append(" authf=").append(mConfig.numAuthFailures);
                }
                }
            if (mConfig != null && mConfig.numNoInternetAccessReports > 0) {
                summary.append(" noInt=").append(mConfig.numNoInternetAccessReports);
            }
            }
        }
        }
        return summary.toString();
        return summary.toString();
@@ -508,10 +497,6 @@ public class AccessPoint implements Comparable<AccessPoint> {
        Map<String, ScanResult> list = mScanResultCache.snapshot();
        Map<String, ScanResult> list = mScanResultCache.snapshot();
        // TODO: sort list by RSSI or age
        // TODO: sort list by RSSI or age
        for (ScanResult result : list.values()) {
        for (ScanResult result : list.values()) {
            if (result.seen == 0)
                continue;

            if (result.autoJoinStatus != ScanResult.ENABLED) numBlackListed++;


            if (result.frequency >= LOWER_FREQ_5GHZ
            if (result.frequency >= LOWER_FREQ_5GHZ
                    && result.frequency <= HIGHER_FREQ_5GHZ) {
                    && result.frequency <= HIGHER_FREQ_5GHZ) {
@@ -525,8 +510,6 @@ public class AccessPoint implements Comparable<AccessPoint> {
                num24 = num24 + 1;
                num24 = num24 + 1;
            }
            }


            // Ignore results seen, older than 20 seconds
            if (now - result.seen > VISIBILITY_OUTDATED_AGE_IN_MILLI) continue;


            if (result.frequency >= LOWER_FREQ_5GHZ
            if (result.frequency >= LOWER_FREQ_5GHZ
                    && result.frequency <= HIGHER_FREQ_5GHZ) {
                    && result.frequency <= HIGHER_FREQ_5GHZ) {
@@ -539,12 +522,6 @@ public class AccessPoint implements Comparable<AccessPoint> {
                    if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
                    if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
                    scans5GHz.append("=").append(result.frequency);
                    scans5GHz.append("=").append(result.frequency);
                    scans5GHz.append(",").append(result.level);
                    scans5GHz.append(",").append(result.level);
                    if (result.autoJoinStatus != 0) {
                        scans5GHz.append(",st=").append(result.autoJoinStatus);
                    }
                    if (result.numIpConfigFailures != 0) {
                        scans5GHz.append(",ipf=").append(result.numIpConfigFailures);
                    }
                    scans5GHz.append("}");
                    scans5GHz.append("}");
                    n5++;
                    n5++;
                }
                }
@@ -559,12 +536,6 @@ public class AccessPoint implements Comparable<AccessPoint> {
                    if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
                    if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
                    scans24GHz.append("=").append(result.frequency);
                    scans24GHz.append("=").append(result.frequency);
                    scans24GHz.append(",").append(result.level);
                    scans24GHz.append(",").append(result.level);
                    if (result.autoJoinStatus != 0) {
                        scans24GHz.append(",st=").append(result.autoJoinStatus);
                    }
                    if (result.numIpConfigFailures != 0) {
                        scans24GHz.append(",ipf=").append(result.numIpConfigFailures);
                    }
                    scans24GHz.append("}");
                    scans24GHz.append("}");
                    n24++;
                    n24++;
                }
                }
+396 −259

File changed.

Preview size limit exceeded, changes collapsed.