use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class DisabledSubscriptionControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
if (Looper.myLooper() == null) {
Looper.prepare();
}
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mCategory = new PreferenceCategory(mContext);
mCategory.setKey(KEY);
mScreen.addPreference(mCategory);
mController = new DisabledSubscriptionController(mContext, KEY);
mController.init(mLifecycle, SUB_ID);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class CarrierWifiTogglePreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = spy(ApplicationProvider.getApplicationContext());
mController = new CarrierWifiTogglePreferenceController(mContext, CarrierWifiTogglePreferenceController.CARRIER_WIFI_TOGGLE_PREF_KEY);
mController.init(mock(Lifecycle.class), SUB_ID);
mController.mIsProviderModelEnabled = true;
mController.mIsCarrierProvisionWifiEnabled = true;
doReturn(true).when(mWifiPickerTrackerHelper).isCarrierNetworkActive();
doReturn(SSID).when(mWifiPickerTrackerHelper).getCarrierNetworkSsid();
mController.mWifiPickerTrackerHelper = mWifiPickerTrackerHelper;
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
mTogglePreference = new Preference(mContext);
mTogglePreference.setKey(CarrierWifiTogglePreferenceController.CARRIER_WIFI_TOGGLE_PREF_KEY);
mScreen.addPreference(mTogglePreference);
mNetworkPreference = new Preference(mContext);
mNetworkPreference.setKey(CarrierWifiTogglePreferenceController.CARRIER_WIFI_NETWORK_PREF_KEY);
mScreen.addPreference(mNetworkPreference);
mController.mCarrierNetworkPreference = mNetworkPreference;
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class MobileNetworkPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
if (Looper.myLooper() == null) {
Looper.prepare();
}
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(MobileNetworkPreferenceController.KEY_MOBILE_NETWORK_SETTINGS);
mLifecycleRegistry = new LifecycleRegistry(mLifecycleOwner);
when(mLifecycleOwner.getLifecycle()).thenReturn(mLifecycleRegistry);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class DefaultSubscriptionControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubMgr);
when(mContext.getSystemService(TelecomManager.class)).thenReturn(mTelecomManager);
final String key = "prefkey";
mController = new TestDefaultSubscriptionController(mContext, key);
if (Looper.myLooper() == null) {
Looper.prepare();
}
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mListPreference = new ListPreference(mContext);
mListPreference.setKey(key);
mScreen.addPreference(mListPreference);
}
use of androidx.preference.PreferenceManager in project android_packages_apps_Settings by omnirom.
the class InternetPreferenceControllerTest method setUp.
@Before
public void setUp() {
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
when(mContext.getSystemService(NetworkScoreManager.class)).thenReturn(mock(NetworkScoreManager.class));
final WifiManager wifiManager = mock(WifiManager.class);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(wifiManager);
when(wifiManager.getWifiState()).thenReturn(WifiManager.WIFI_STATE_DISABLED);
mController = new InternetPreferenceController(mContext, mock(Lifecycle.class));
mController.sIconMap.put(INTERNET_WIFI, 0);
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(InternetPreferenceController.KEY);
mScreen.addPreference(mPreference);
}
Aggregations