+ /** Helper method to return whether an AccessPoint is disabled due to a wrong password */
+ private static boolean isDisabledByWrongPassword(AccessPoint accessPoint) {
+ WifiConfiguration config = accessPoint.getConfig();
+ if (config == null) {
+ return false;
+ }
+ WifiConfiguration.NetworkSelectionStatus networkStatus =
+ config.getNetworkSelectionStatus();
+ if (networkStatus == null || networkStatus.isNetworkEnabled()) {
+ return false;
+ }
+ int reason = networkStatus.getNetworkSelectionDisableReason();
+ return WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WRONG_PASSWORD == reason;
+ }
+