use of com.android.settings.wifi.AddWifiNetworkPreference in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mNetworkProviderSettings = spy(new NetworkProviderSettings());
doReturn(mContext).when(mNetworkProviderSettings).getContext();
doReturn(mPreferenceManager).when(mNetworkProviderSettings).getPreferenceManager();
doReturn(mPowerManager).when(mContext).getSystemService(PowerManager.class);
doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class);
doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
doReturn(mLocationManager).when(mContext).getSystemService(LocationManager.class);
when(mUserManager.hasBaseUserRestriction(any(), any())).thenReturn(true);
doReturn(mContext).when(mPreferenceManager).getContext();
mNetworkProviderSettings.mAddWifiNetworkPreference = new AddWifiNetworkPreference(mContext);
mNetworkProviderSettings.mSavedNetworksPreference = new Preference(mContext);
mNetworkProviderSettings.mConfigureWifiSettingsPreference = new Preference(mContext);
mNetworkProviderSettings.mWifiPickerTracker = mMockWifiPickerTracker;
mNetworkProviderSettings.mWifiManager = mWifiManager;
mNetworkProviderSettings.mResetInternetPreference = mResetInternetPreference;
mNetworkProviderSettings.mAirplaneModeMsgPreference = mAirplaneModeMsgPreference;
mNetworkProviderSettings.mAirplaneModeEnabler = mAirplaneModeEnabler;
mNetworkProviderSettings.mInternetUpdater = mInternetUpdater;
mNetworkProviderSettings.mWifiStatusMessagePreference = new FooterPreference(mContext);
doReturn(NetworkProviderSettings.PREF_KEY_CONNECTED_ACCESS_POINTS).when(mConnectedWifiEntryPreferenceCategory).getKey();
mNetworkProviderSettings.mConnectedWifiEntryPreferenceCategory = mConnectedWifiEntryPreferenceCategory;
doReturn(NetworkProviderSettings.PREF_KEY_FIRST_ACCESS_POINTS).when(mFirstWifiEntryPreferenceCategory).getKey();
mNetworkProviderSettings.mFirstWifiEntryPreferenceCategory = mFirstWifiEntryPreferenceCategory;
FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL, false);
}
use of com.android.settings.wifi.AddWifiNetworkPreference in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettings method addPreferences.
private void addPreferences() {
addPreferencesFromResource(R.xml.network_provider_settings);
mAirplaneModeMsgPreference = findPreference(PREF_KEY_AIRPLANE_MODE_MSG);
updateAirplaneModeMsgPreference(mAirplaneModeEnabler.isAirplaneModeOn());
mConnectedWifiEntryPreferenceCategory = findPreference(PREF_KEY_CONNECTED_ACCESS_POINTS);
mFirstWifiEntryPreferenceCategory = findPreference(PREF_KEY_FIRST_ACCESS_POINTS);
mWifiEntryPreferenceCategory = findPreference(PREF_KEY_ACCESS_POINTS);
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_WIFI_SETTINGS);
mSavedNetworksPreference = findPreference(PREF_KEY_SAVED_NETWORKS);
mAddWifiNetworkPreference = new AddWifiNetworkPreference(getPrefContext());
mDataUsagePreference = findPreference(PREF_KEY_DATA_USAGE);
mDataUsagePreference.setVisible(DataUsageUtils.hasWifiRadio(getContext()));
mDataUsagePreference.setTemplate(NetworkTemplate.buildTemplateWifi(NetworkTemplate.WIFI_NETWORKID_ALL, null), 0, /*subId*/
null);
mResetInternetPreference = findPreference(PREF_KEY_RESET_INTERNET);
if (mResetInternetPreference != null) {
mResetInternetPreference.setVisible(false);
}
addNetworkMobileProviderController();
addConnectedEthernetNetworkController();
addWifiSwitchPreferenceController();
mWifiStatusMessagePreference = findPreference(PREF_KEY_WIFI_STATUS_MESSAGE);
}
Aggregations