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
This commit is contained in:
TreeHugger Robot
2017-06-23 18:18:58 +00:00
committed by Android (Google) Code Review
3 changed files with 23 additions and 2 deletions

View File

@@ -703,6 +703,9 @@ public class AccessPoint implements Comparable<AccessPoint> {
case WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE: case WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_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.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_DHCP_FAILURE:
case WifiConfiguration.NetworkSelectionStatus.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));

View File

@@ -417,6 +417,19 @@ public class AccessPointTest {
assertThat(ap.getSummary()).isEqualTo(expectedString); 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() { private ScoredNetwork buildScoredNetworkWithMockBadgeCurve() {
Bundle attr1 = new Bundle(); Bundle attr1 = new Bundle();
attr1.putParcelable(ScoredNetwork.ATTRIBUTES_KEY_BADGING_CURVE, mockBadgeCurve); attr1.putParcelable(ScoredNetwork.ATTRIBUTES_KEY_BADGING_CURVE, mockBadgeCurve);

View File

@@ -890,10 +890,14 @@ public class WifiConfiguration implements Parcelable {
* This network is disabled due to user switching * This network is disabled due to user switching
*/ */
public static final int DISABLED_DUE_TO_USER_SWITCH = 11; 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 * 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) * 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_AUTHENTICATION_NO_CREDENTIALS",
"NETWORK_SELECTION_DISABLED_NO_INTERNET", "NETWORK_SELECTION_DISABLED_NO_INTERNET",
"NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER", "NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER",
"NETWORK_SELECTION_DISABLED_BY_USER_SWITCH" "NETWORK_SELECTION_DISABLED_BY_USER_SWITCH",
"NETWORK_SELECTION_DISABLED_BY_WRONG_PASSWORD"
}; };
/** /**