use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by SudaMod.
the class WifiSettings method isDisabledByWrongPassword.
/**
* 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;
}
use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by SudaMod.
the class WifiSettings method configureConnectedAccessPointPreferenceCategory.
/**
* Configure the ConnectedAccessPointPreferenceCategory and return true if the Category was
* shown.
*/
private boolean configureConnectedAccessPointPreferenceCategory(List<AccessPoint> accessPoints) {
if (accessPoints.size() == 0) {
removeConnectedAccessPointPreference();
return false;
}
AccessPoint connectedAp = accessPoints.get(0);
if (!connectedAp.isActive()) {
removeConnectedAccessPointPreference();
return false;
}
// Is the preference category empty?
if (mConnectedAccessPointPreferenceCategory.getPreferenceCount() == 0) {
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Is the previous currently connected SSID different from the new one?
AccessPointPreference preference = (AccessPointPreference) (mConnectedAccessPointPreferenceCategory.getPreference(0));
// in the UI.
if (preference.getAccessPoint() != connectedAp) {
removeConnectedAccessPointPreference();
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Else same AP is connected, simply refresh the connected access point preference
// (first and only access point in this category).
((LongPressAccessPointPreference) mConnectedAccessPointPreferenceCategory.getPreference(0)).refresh();
return true;
}
use of com.android.settingslib.wifi.AccessPoint in project platform_packages_apps_Settings by BlissRoms.
the class SavedAccessPointsWifiSettings method onCreateDialog.
@Override
public Dialog onCreateDialog(int dialogId) {
switch(dialogId) {
case WifiSettings.WIFI_DIALOG_ID:
if (mDlgAccessPoint == null && mAccessPointSavedState == null) {
// Add new network
mDialog = WifiDialog.createFullscreen(getActivity(), this, null, WifiConfigUiBase.MODE_CONNECT);
} else {
// Modify network
if (mDlgAccessPoint == null) {
// Restore AP from save state
mDlgAccessPoint = new AccessPoint(getActivity(), mAccessPointSavedState);
// Reset the saved access point data
mAccessPointSavedState = null;
}
mDialog = WifiDialog.createModal(getActivity(), this, mDlgAccessPoint, WifiConfigUiBase.MODE_VIEW);
}
mSelectedAccessPoint = mDlgAccessPoint;
return mDialog;
}
return super.onCreateDialog(dialogId);
}
use of com.android.settingslib.wifi.AccessPoint in project platform_packages_apps_Settings by BlissRoms.
the class WifiSettings method configureConnectedAccessPointPreferenceCategory.
/**
* Configure the ConnectedAccessPointPreferenceCategory and return true if the Category was
* shown.
*/
private boolean configureConnectedAccessPointPreferenceCategory(List<AccessPoint> accessPoints) {
if (accessPoints.size() == 0) {
removeConnectedAccessPointPreference();
return false;
}
AccessPoint connectedAp = accessPoints.get(0);
if (!connectedAp.isActive()) {
removeConnectedAccessPointPreference();
return false;
}
// Is the preference category empty?
if (mConnectedAccessPointPreferenceCategory.getPreferenceCount() == 0) {
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Is the previous currently connected SSID different from the new one?
AccessPointPreference preference = (AccessPointPreference) (mConnectedAccessPointPreferenceCategory.getPreference(0));
// in the UI.
if (preference.getAccessPoint() != connectedAp) {
removeConnectedAccessPointPreference();
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Else same AP is connected, simply refresh the connected access point preference
// (first and only access point in this category).
((LongPressAccessPointPreference) mConnectedAccessPointPreferenceCategory.getPreference(0)).refresh();
return true;
}
use of com.android.settingslib.wifi.AccessPoint in project platform_packages_apps_Settings by BlissRoms.
the class WifiDialogActivity method onForget.
@Override
public void onForget(WifiDialog dialog) {
final WifiManager wifiManager = getSystemService(WifiManager.class);
final AccessPoint accessPoint = dialog.getController().getAccessPoint();
if (accessPoint != null) {
if (!accessPoint.isSaved()) {
if (accessPoint.getNetworkInfo() != null && accessPoint.getNetworkInfo().getState() != NetworkInfo.State.DISCONNECTED) {
// Network is active but has no network ID - must be ephemeral.
wifiManager.disableEphemeralNetwork(AccessPoint.convertToQuotedString(accessPoint.getSsidStr()));
} else {
// Should not happen, but a monkey seems to trigger it
Log.e(TAG, "Failed to forget invalid network " + accessPoint.getConfig());
}
} else {
wifiManager.forget(accessPoint.getConfig().networkId, null);
}
}
Intent resultData = new Intent();
if (accessPoint != null) {
Bundle accessPointState = new Bundle();
accessPoint.saveWifiState(accessPointState);
resultData.putExtra(KEY_ACCESS_POINT_STATE, accessPointState);
}
setResult(RESULT_FORGET);
finish();
}
Aggregations