use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by crdroidandroid.
the class WifiSettingsUiTest method setupConnectedAccessPoint.
private void setupConnectedAccessPoint() {
WifiConfiguration config = new WifiConfiguration();
config.SSID = TEST_SSID;
config.BSSID = TEST_BSSID;
config.networkId = TEST_NETWORK_ID;
WifiInfo wifiInfo = new WifiInfo();
wifiInfo.setSSID(WifiSsid.createFromAsciiEncoded(TEST_UNQUOTED_SSID));
wifiInfo.setBSSID(TEST_BSSID);
wifiInfo.setRssi(TEST_RSSI);
wifiInfo.setNetworkId(TEST_NETWORK_ID);
NetworkInfo networkInfo = new NetworkInfo(ConnectivityManager.TYPE_WIFI, 0, null, null);
networkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null, null);
AccessPoint accessPoint = new AccessPoint(mContext, config);
accessPoint.update(config, wifiInfo, networkInfo);
assertThat(accessPoint.getSsidStr()).isEqualTo(TEST_UNQUOTED_SSID);
assertThat(accessPoint.getBssid()).isEqualTo(TEST_BSSID);
assertThat(accessPoint.getNetworkInfo()).isNotNull();
assertThat(accessPoint.isActive()).isTrue();
assertThat(accessPoint.getSettingsSummary()).isEqualTo(resourceString(WIFI_DISPLAY_STATUS_CONNECTED));
when(mWifiTracker.getAccessPoints()).thenReturn(Lists.asList(accessPoint, new AccessPoint[] {}));
}
use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by crdroidandroid.
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 android_packages_apps_Settings by SudaMod.
the class WifiDialogActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
final Intent intent = getIntent();
if (WizardManagerHelper.isSetupWizardIntent(intent)) {
setTheme(SetupWizardUtils.getTransparentTheme(intent));
}
super.onCreate(savedInstanceState);
final Bundle accessPointState = intent.getBundleExtra(KEY_ACCESS_POINT_STATE);
AccessPoint accessPoint = null;
if (accessPointState != null) {
accessPoint = new AccessPoint(this, accessPointState);
}
WifiDialog dialog = WifiDialog.createModal(this, this, accessPoint, WifiConfigUiBase.MODE_CONNECT);
dialog.show();
dialog.setOnDismissListener(this);
}
use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by SudaMod.
the class WifiSettings method onCreateDialog.
@Override
public Dialog onCreateDialog(int dialogId) {
switch(dialogId) {
case WIFI_DIALOG_ID:
if (mDlgAccessPoint == null && mAccessPointSavedState == null) {
// add new network
mDialog = WifiDialog.createFullscreen(getActivity(), this, mDlgAccessPoint, mDialogMode);
} 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, mDialogMode);
}
mSelectedAccessPoint = mDlgAccessPoint;
return mDialog;
case WPS_PBC_DIALOG_ID:
return new WpsDialog(getActivity(), WpsInfo.PBC);
case WPS_PIN_DIALOG_ID:
return new WpsDialog(getActivity(), WpsInfo.DISPLAY);
case WRITE_NFC_DIALOG_ID:
if (mSelectedAccessPoint != null) {
mWifiToNfcDialog = new WriteWifiConfigToNfcDialog(getActivity(), mSelectedAccessPoint.getSecurity(), new WifiManagerWrapper(mWifiManager));
} else if (mWifiNfcDialogSavedState != null) {
mWifiToNfcDialog = new WriteWifiConfigToNfcDialog(getActivity(), mWifiNfcDialogSavedState, new WifiManagerWrapper(mWifiManager));
}
return mWifiToNfcDialog;
}
return super.onCreateDialog(dialogId);
}
use of com.android.settingslib.wifi.AccessPoint in project android_packages_apps_Settings by SudaMod.
the class WifiNetworkDetailsFragment method onAttach.
@Override
public void onAttach(Context context) {
mWifiDetailActionBarObserver = new WifiDetailActionBarObserver(context, this);
getLifecycle().addObserver(mWifiDetailActionBarObserver);
mAccessPoint = new AccessPoint(context, getArguments());
super.onAttach(context);
}
Aggregations