use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiDialogActivity method onSubmit.
@Override
public void onSubmit(WifiDialog2 dialog) {
final WifiEntry wifiEntry = dialog.getController().getWifiEntry();
final WifiConfiguration config = dialog.getController().getConfig();
if (getIntent().getBooleanExtra(KEY_CONNECT_FOR_CALLER, true)) {
if (config == null && wifiEntry != null && wifiEntry.canConnect()) {
wifiEntry.connect(null);
} else {
getSystemService(WifiManager.class).connect(config, null);
}
}
final Intent resultData = new Intent();
if (config != null) {
resultData.putExtra(KEY_WIFI_CONFIGURATION, config);
}
setResult(RESULT_CONNECTED, resultData);
finish();
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiDialogActivity method onForget.
@Override
public void onForget(WifiDialog2 dialog) {
final WifiEntry wifiEntry = dialog.getController().getWifiEntry();
if (wifiEntry != null && wifiEntry.canForget()) {
wifiEntry.forget(null);
}
setResult(RESULT_FORGET);
finish();
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiConnectionPreferenceController method update.
private void update() {
final WifiEntry connectedWifiEntry = mWifiPickerTracker.getConnectedWifiEntry();
if (connectedWifiEntry == null) {
updatePreference(null);
} else {
if (mPreference == null || !mPreference.getWifiEntry().equals(connectedWifiEntry)) {
updatePreference(connectedWifiEntry);
} else if (mPreference != null) {
mPreference.refresh();
}
}
mUpdateListener.onChildrenUpdated();
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class NetworkProviderWorkerTest method getWifiEntry_connectedWifiKey_shouldGetConnectedWifi.
@Test
@UiThreadTest
public void getWifiEntry_connectedWifiKey_shouldGetConnectedWifi() {
final String key = "key";
final WifiEntry connectedWifiEntry = mock(WifiEntry.class);
when(connectedWifiEntry.getKey()).thenReturn(key);
when(mMockWifiPickerTracker.getConnectedWifiEntry()).thenReturn(connectedWifiEntry);
assertThat(mMockNetworkProviderWorker.getWifiEntry(key)).isEqualTo(connectedWifiEntry);
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class NetworkProviderWorkerTest method getWifiEntry_reachableWifiKey_shouldGetReachableWifi.
@Test
@UiThreadTest
public void getWifiEntry_reachableWifiKey_shouldGetReachableWifi() {
final String key = "key";
final WifiEntry reachableWifiEntry = mock(WifiEntry.class);
when(reachableWifiEntry.getKey()).thenReturn(key);
when(mMockWifiPickerTracker.getWifiEntries()).thenReturn(Arrays.asList(reachableWifiEntry));
assertThat(mMockNetworkProviderWorker.getWifiEntry(key)).isEqualTo(reachableWifiEntry);
}
Aggregations