Search in sources :

Example 6 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class ResetDashboardFragment method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new NetworkResetPreferenceController(context));
    controllers.add(new FactoryResetPreferenceController(context));
    controllers.add(new ResetAppPrefPreferenceController(context, lifecycle));
    return controllers;
}
Also used : NetworkResetPreferenceController(com.android.settings.network.NetworkResetPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) ResetAppPrefPreferenceController(com.android.settings.applications.ResetAppPrefPreferenceController)

Example 7 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class NetworkDashboardFragment method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle, MetricsFeatureProvider metricsFeatureProvider, Fragment fragment, MobilePlanPreferenceHost mobilePlanHost) {
    final AirplaneModePreferenceController airplaneModePreferenceController = new AirplaneModePreferenceController(context, fragment);
    final MobilePlanPreferenceController mobilePlanPreferenceController = new MobilePlanPreferenceController(context, mobilePlanHost);
    final WifiMasterSwitchPreferenceController wifiPreferenceController = new WifiMasterSwitchPreferenceController(context, metricsFeatureProvider);
    final MobileNetworkPreferenceController mobileNetworkPreferenceController = new MobileNetworkPreferenceController(context);
    final VpnPreferenceController vpnPreferenceController = new VpnPreferenceController(context);
    if (lifecycle != null) {
        lifecycle.addObserver(airplaneModePreferenceController);
        lifecycle.addObserver(mobilePlanPreferenceController);
        lifecycle.addObserver(wifiPreferenceController);
        lifecycle.addObserver(mobileNetworkPreferenceController);
        lifecycle.addObserver(vpnPreferenceController);
    }
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(airplaneModePreferenceController);
    controllers.add(mobileNetworkPreferenceController);
    controllers.add(new TetherPreferenceController(context, lifecycle));
    controllers.add(vpnPreferenceController);
    controllers.add(new ProxyPreferenceController(context));
    controllers.add(mobilePlanPreferenceController);
    controllers.add(wifiPreferenceController);
    return controllers;
}
Also used : WifiMasterSwitchPreferenceController(com.android.settings.wifi.WifiMasterSwitchPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList)

Example 8 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class AmbientDisplaySettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle, AmbientDisplayConfiguration config, MetricsFeatureProvider metricsFeatureProvider, AmbientDisplayAlwaysOnPreferenceController.OnPreferenceChangedCallback aodCallback) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new AmbientDisplayNotificationsPreferenceController(context, config, metricsFeatureProvider));
    controllers.add(new AmbientDisplayAlwaysOnPreferenceController(context, config, aodCallback));
    controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle, config, MY_USER_ID, KEY_AMBIENT_DISPLAY_DOUBLE_TAP));
    controllers.add(new PickupGesturePreferenceController(context, lifecycle, config, MY_USER_ID, KEY_AMBIENT_DISPLAY_PICK_UP));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) DoubleTapScreenPreferenceController(com.android.settings.gestures.DoubleTapScreenPreferenceController) PickupGesturePreferenceController(com.android.settings.gestures.PickupGesturePreferenceController)

Example 9 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DisplaySettingsTest method testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen.

@Test
@Config(shadows = ShadowPowerManagerWrapper.class)
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
    final Context context = RuntimeEnvironment.application;
    // PowerManager wrapper = mock(PowerManager.class);
    // doReturn(wrapper).when(context).getSystemService(Context.POWER_SERVICE);
    final DisplaySettings fragment = new DisplaySettings();
    final List<String> preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context, fragment.getPreferenceScreenResId());
    final List<String> preferenceKeys = new ArrayList<>();
    for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
        preferenceKeys.add(controller.getPreferenceKey());
    }
    // Nightmode is currently hidden
    preferenceKeys.remove("night_mode");
    assertThat(preferenceScreenKeys).containsAllIn(preferenceKeys);
}
Also used : Context(android.content.Context) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 10 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = new LockScreenNotificationPreferenceController(context, KEY_LOCK_SCREEN_NOTIFICATON, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
    lifecycle.addObserver(notificationController);
    controllers.add(notificationController);
    final AddUserWhenLockedPreferenceController addUserWhenLockedController = new AddUserWhenLockedPreferenceController(context);
    lifecycle.addObserver(addUserWhenLockedController);
    controllers.add(addUserWhenLockedController);
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) AddUserWhenLockedPreferenceController(com.android.settings.accounts.AddUserWhenLockedPreferenceController)

Aggregations

AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)344 ArrayList (java.util.ArrayList)245 Test (org.junit.Test)86 UserInfo (android.content.pm.UserInfo)33 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)33 Context (android.content.Context)31 SettingsActivity (com.android.settings.SettingsActivity)18 StorageManager (android.os.storage.StorageManager)16 StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)16 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)16 AdditionalSystemUpdatePreferenceController (com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController)12 Activity (android.app.Activity)11 BasePreferenceController (com.android.settings.core.BasePreferenceController)11 PreferenceScreen (android.support.v7.preference.PreferenceScreen)10 UserManager (android.os.UserManager)9 PreferenceControllerMixin (com.android.settings.core.PreferenceControllerMixin)9 TimeoutPreferenceController (com.android.settings.display.TimeoutPreferenceController)9 Intent (android.content.Intent)8 AmbientDisplayConfiguration (com.android.internal.hardware.AmbientDisplayConfiguration)8 PreferenceScreen (androidx.preference.PreferenceScreen)7