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

Commit 702d4d56 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

* changes:
  SettingsLib: set network status for wrong password error
  wifi: add "wrong password" network disabled reason
parents f79158f5 9c4c6ad6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -703,6 +703,9 @@ public class AccessPoint implements Comparable<AccessPoint> {
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE:
                    summary.append(mContext.getString(R.string.wifi_disabled_password_failure));
                    break;
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WRONG_PASSWORD:
                    summary.append(mContext.getString(R.string.wifi_check_password_try_again));
                    break;
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_DHCP_FAILURE:
                case WifiConfiguration.NetworkSelectionStatus.DISABLED_DNS_FAILURE:
                    summary.append(mContext.getString(R.string.wifi_disabled_network_failure));
+13 −0
Original line number Diff line number Diff line
@@ -417,6 +417,19 @@ public class AccessPointTest {
        assertThat(ap.getSummary()).isEqualTo(expectedString);
    }

    @Test
    public void testSummaryString_showsWrongPasswordLabel() {
        WifiConfiguration configuration = createWifiConfiguration();
        configuration.getNetworkSelectionStatus().setNetworkSelectionStatus(
                WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_PERMANENTLY_DISABLED);
        configuration.getNetworkSelectionStatus().setNetworkSelectionDisableReason(
                WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WRONG_PASSWORD);
        AccessPoint ap = new AccessPoint(mContext, configuration);

        assertThat(ap.getSummary()).isEqualTo(mContext.getString(
                R.string.wifi_check_password_try_again));
    }

    private ScoredNetwork buildScoredNetworkWithMockBadgeCurve() {
        Bundle attr1 = new Bundle();
        attr1.putParcelable(ScoredNetwork.ATTRIBUTES_KEY_BADGING_CURVE, mockBadgeCurve);
+7 −2
Original line number Diff line number Diff line
@@ -890,10 +890,14 @@ public class WifiConfiguration implements Parcelable {
         * This network is disabled due to user switching
         */
        public static final int DISABLED_DUE_TO_USER_SWITCH = 11;
        /**
         * This network is disabled due to wrong password
         */
        public static final int DISABLED_BY_WRONG_PASSWORD = 12;
        /**
         * This Maximum disable reason value
         */
        public static final int NETWORK_SELECTION_DISABLED_MAX = 12;
        public static final int NETWORK_SELECTION_DISABLED_MAX = 13;

        /**
         * Quality network selection disable reason String (for debug purpose)
@@ -910,7 +914,8 @@ public class WifiConfiguration implements Parcelable {
                "NETWORK_SELECTION_DISABLED_AUTHENTICATION_NO_CREDENTIALS",
                "NETWORK_SELECTION_DISABLED_NO_INTERNET",
                "NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER",
                "NETWORK_SELECTION_DISABLED_BY_USER_SWITCH"
                "NETWORK_SELECTION_DISABLED_BY_USER_SWITCH",
                "NETWORK_SELECTION_DISABLED_BY_WRONG_PASSWORD"
        };

        /**