Search in sources :

Example 1 with AddWifiNetworkPreference

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);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference) DataUsagePreference(com.android.settings.datausage.DataUsagePreference) LayoutPreference(com.android.settingslib.widget.LayoutPreference) ConnectedWifiEntryPreference(com.android.settings.wifi.ConnectedWifiEntryPreference) AddWifiNetworkPreference(com.android.settings.wifi.AddWifiNetworkPreference) Preference(androidx.preference.Preference) LongPressWifiEntryPreference(com.android.settingslib.wifi.LongPressWifiEntryPreference) AddWifiNetworkPreference(com.android.settings.wifi.AddWifiNetworkPreference) FooterPreference(com.android.settingslib.widget.FooterPreference) Before(org.junit.Before)

Example 2 with AddWifiNetworkPreference

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);
}
Also used : AddWifiNetworkPreference(com.android.settings.wifi.AddWifiNetworkPreference)

Aggregations

AddWifiNetworkPreference (com.android.settings.wifi.AddWifiNetworkPreference)2 Preference (androidx.preference.Preference)1 DataUsagePreference (com.android.settings.datausage.DataUsagePreference)1 ConnectedWifiEntryPreference (com.android.settings.wifi.ConnectedWifiEntryPreference)1 FooterPreference (com.android.settingslib.widget.FooterPreference)1 LayoutPreference (com.android.settingslib.widget.LayoutPreference)1 LongPressWifiEntryPreference (com.android.settingslib.wifi.LongPressWifiEntryPreference)1 Before (org.junit.Before)1