Search in sources :

Example 6 with AmbientDisplayConfiguration

use of com.android.internal.hardware.AmbientDisplayConfiguration in project android_packages_apps_Settings by SudaMod.

the class DisplaySettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    // controllers.add(new AutoRotatePreferenceController(context, lifecycle));
    controllers.add(new CameraGesturePreferenceController(context));
    controllers.add(new FontSizePreferenceController(context));
    controllers.add(new LiftToWakePreferenceController(context));
    controllers.add(new NightDisplayPreferenceController(context));
    controllers.add(new NightModePreferenceController(context));
    controllers.add(new ScreenSaverPreferenceController(context));
    controllers.add(new AmbientDisplayPreferenceController(context, new AmbientDisplayConfiguration(context), KEY_AMBIENT_DISPLAY));
    controllers.add(new TapToWakePreferenceController(context));
    controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new VrDisplayPreferenceController(context));
    controllers.add(new WallpaperPreferenceController(context));
    // controllers.add(new ThemePreferenceController(context));
    controllers.add(new BrightnessLevelPreferenceController(context, lifecycle));
    controllers.add(new ColorModePreferenceController(context));
    return controllers;
}
Also used : ScreenSaverPreferenceController(com.android.settings.display.ScreenSaverPreferenceController) AutoBrightnessPreferenceController(com.android.settings.display.AutoBrightnessPreferenceController) BrightnessLevelPreferenceController(com.android.settings.display.BrightnessLevelPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) VrDisplayPreferenceController(com.android.settings.display.VrDisplayPreferenceController) ArrayList(java.util.ArrayList) CameraGesturePreferenceController(com.android.settings.display.CameraGesturePreferenceController) TimeoutPreferenceController(com.android.settings.display.TimeoutPreferenceController) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration) TapToWakePreferenceController(com.android.settings.display.TapToWakePreferenceController) AmbientDisplayPreferenceController(com.android.settings.display.AmbientDisplayPreferenceController) LiftToWakePreferenceController(com.android.settings.display.LiftToWakePreferenceController) NightModePreferenceController(com.android.settings.display.NightModePreferenceController) ColorModePreferenceController(com.android.settings.display.ColorModePreferenceController) FontSizePreferenceController(com.android.settings.display.FontSizePreferenceController) WallpaperPreferenceController(com.android.settings.display.WallpaperPreferenceController) NightDisplayPreferenceController(com.android.settings.display.NightDisplayPreferenceController)

Example 7 with AmbientDisplayConfiguration

use of com.android.internal.hardware.AmbientDisplayConfiguration in project platform_packages_apps_Settings by BlissRoms.

the class DisplaySettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    controllers.add(new AutoRotatePreferenceController(context, lifecycle));
    controllers.add(new CameraGesturePreferenceController(context));
    controllers.add(new FontSizePreferenceController(context));
    controllers.add(new LiftToWakePreferenceController(context));
    controllers.add(new NightDisplayPreferenceController(context));
    controllers.add(new NightModePreferenceController(context));
    controllers.add(new ScreenSaverPreferenceController(context));
    controllers.add(new AmbientDisplayPreferenceController(context, new AmbientDisplayConfiguration(context), KEY_AMBIENT_DISPLAY));
    controllers.add(new TapToWakePreferenceController(context));
    controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new VrDisplayPreferenceController(context));
    controllers.add(new WallpaperPreferenceController(context));
    controllers.add(new ThemePreferenceController(context));
    controllers.add(new BrightnessLevelPreferenceController(context, lifecycle));
    controllers.add(new ColorModePreferenceController(context));
    return controllers;
}
Also used : ScreenSaverPreferenceController(com.android.settings.display.ScreenSaverPreferenceController) AutoBrightnessPreferenceController(com.android.settings.display.AutoBrightnessPreferenceController) BrightnessLevelPreferenceController(com.android.settings.display.BrightnessLevelPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) VrDisplayPreferenceController(com.android.settings.display.VrDisplayPreferenceController) ArrayList(java.util.ArrayList) CameraGesturePreferenceController(com.android.settings.display.CameraGesturePreferenceController) TimeoutPreferenceController(com.android.settings.display.TimeoutPreferenceController) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration) AutoRotatePreferenceController(com.android.settings.display.AutoRotatePreferenceController) ThemePreferenceController(com.android.settings.display.ThemePreferenceController) TapToWakePreferenceController(com.android.settings.display.TapToWakePreferenceController) AmbientDisplayPreferenceController(com.android.settings.display.AmbientDisplayPreferenceController) LiftToWakePreferenceController(com.android.settings.display.LiftToWakePreferenceController) NightModePreferenceController(com.android.settings.display.NightModePreferenceController) ColorModePreferenceController(com.android.settings.display.ColorModePreferenceController) FontSizePreferenceController(com.android.settings.display.FontSizePreferenceController) WallpaperPreferenceController(com.android.settings.display.WallpaperPreferenceController) NightDisplayPreferenceController(com.android.settings.display.NightDisplayPreferenceController)

Example 8 with AmbientDisplayConfiguration

use of com.android.internal.hardware.AmbientDisplayConfiguration in project android_frameworks_base by DirtyUnicorns.

the class DozeService method onCreate.

@Override
public void onCreate() {
    if (DEBUG)
        Log.d(mTag, "onCreate");
    super.onCreate();
    if (getApplication() instanceof SystemUIApplication) {
        final SystemUIApplication app = (SystemUIApplication) getApplication();
        mHost = app.getComponent(DozeHost.class);
    }
    if (mHost == null)
        Log.w(TAG, "No doze service host found.");
    setWindowless(true);
    mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
    mConfig = new AmbientDisplayConfiguration(mContext);
    mSensors = new TriggerSensor[] { new TriggerSensor(mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION), null, /* setting */
    mDozeParameters.getPulseOnSigMotion(), mDozeParameters.getVibrateOnSigMotion(), DozeLog.PULSE_REASON_SENSOR_SIGMOTION), mPickupSensor = new TriggerSensor(mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE), Settings.Secure.DOZE_PULSE_ON_PICK_UP, mConfig.pulseOnPickupAvailable(), mDozeParameters.getVibrateOnPickup(), DozeLog.PULSE_REASON_SENSOR_PICKUP), new TriggerSensor(findSensorWithType(mConfig.doubleTapSensorType()), Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, true, mDozeParameters.getVibrateOnPickup(), DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP) };
    mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
    mWakeLock.setReferenceCounted(true);
    mDisplayStateSupported = mDozeParameters.getDisplayStateSupported();
    mUiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE);
    turnDisplayOff();
}
Also used : SystemUIApplication(com.android.systemui.SystemUIApplication) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration)

Example 9 with AmbientDisplayConfiguration

use of com.android.internal.hardware.AmbientDisplayConfiguration in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class GestureSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.gesture_settings);
    Context context = getActivity();
    mPreferences = new ArrayList();
    // Double tap power for camera
    if (isCameraDoubleTapPowerGestureAvailable(getResources())) {
        int cameraDisabled = Secure.getInt(getContentResolver(), Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
        addPreference(PREF_KEY_DOUBLE_TAP_POWER, cameraDisabled == 0);
    } else {
        removePreference(PREF_KEY_DOUBLE_TAP_POWER);
    }
    // Ambient Display
    mAmbientConfig = new AmbientDisplayConfiguration(context);
    if (mAmbientConfig.pulseOnPickupAvailable()) {
        boolean pickup = mAmbientConfig.pulseOnPickupEnabled(UserHandle.myUserId());
        addPreference(PREF_KEY_PICK_UP, pickup);
    } else {
        removePreference(PREF_KEY_PICK_UP);
    }
    if (mAmbientConfig.pulseOnDoubleTapAvailable()) {
        boolean doubleTap = mAmbientConfig.pulseOnDoubleTapEnabled(UserHandle.myUserId());
        addPreference(PREF_KEY_DOUBLE_TAP_SCREEN, doubleTap);
    } else {
        removePreference(PREF_KEY_DOUBLE_TAP_SCREEN);
    }
    // Fingerprint slide for notifications
    if (isSystemUINavigationAvailable(context)) {
        addPreference(PREF_KEY_SWIPE_DOWN_FINGERPRINT, isSystemUINavigationEnabled(context));
    } else {
        removePreference(PREF_KEY_SWIPE_DOWN_FINGERPRINT);
    }
    // Double twist for camera mode
    if (isDoubleTwistAvailable(context)) {
        int doubleTwistEnabled = Secure.getInt(getContentResolver(), Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1);
        addPreference(PREF_KEY_DOUBLE_TWIST, doubleTwistEnabled != 0);
    } else {
        removePreference(PREF_KEY_DOUBLE_TWIST);
    }
}
Also used : Context(android.content.Context) ArrayList(java.util.ArrayList) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration)

Example 10 with AmbientDisplayConfiguration

use of com.android.internal.hardware.AmbientDisplayConfiguration in project android_packages_apps_Settings by LineageOS.

the class PowerUsageSummary method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    mBatteryHeaderPreferenceController = new BatteryHeaderPreferenceController(context, getActivity(), this, /* host */
    getLifecycle());
    controllers.add(mBatteryHeaderPreferenceController);
    controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new BatterySaverController(context, getLifecycle()));
    controllers.add(new BatteryPercentagePreferenceController(context));
    controllers.add(new AmbientDisplayPreferenceController(context, new AmbientDisplayConfiguration(context), KEY_AMBIENT_DISPLAY));
    return controllers;
}
Also used : AutoBrightnessPreferenceController(com.android.settings.display.AutoBrightnessPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) AmbientDisplayPreferenceController(com.android.settings.display.AmbientDisplayPreferenceController) ArrayList(java.util.ArrayList) TimeoutPreferenceController(com.android.settings.display.TimeoutPreferenceController) BatteryPercentagePreferenceController(com.android.settings.display.BatteryPercentagePreferenceController) AmbientDisplayConfiguration(com.android.internal.hardware.AmbientDisplayConfiguration)

Aggregations

AmbientDisplayConfiguration (com.android.internal.hardware.AmbientDisplayConfiguration)13 ArrayList (java.util.ArrayList)9 AmbientDisplayPreferenceController (com.android.settings.display.AmbientDisplayPreferenceController)8 AutoBrightnessPreferenceController (com.android.settings.display.AutoBrightnessPreferenceController)8 TimeoutPreferenceController (com.android.settings.display.TimeoutPreferenceController)8 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)8 BrightnessLevelPreferenceController (com.android.settings.display.BrightnessLevelPreferenceController)5 CameraGesturePreferenceController (com.android.settings.display.CameraGesturePreferenceController)5 ColorModePreferenceController (com.android.settings.display.ColorModePreferenceController)5 FontSizePreferenceController (com.android.settings.display.FontSizePreferenceController)5 LiftToWakePreferenceController (com.android.settings.display.LiftToWakePreferenceController)5 NightDisplayPreferenceController (com.android.settings.display.NightDisplayPreferenceController)5 NightModePreferenceController (com.android.settings.display.NightModePreferenceController)5 ScreenSaverPreferenceController (com.android.settings.display.ScreenSaverPreferenceController)5 TapToWakePreferenceController (com.android.settings.display.TapToWakePreferenceController)5 VrDisplayPreferenceController (com.android.settings.display.VrDisplayPreferenceController)5 WallpaperPreferenceController (com.android.settings.display.WallpaperPreferenceController)5 SystemUIApplication (com.android.systemui.SystemUIApplication)4 BatteryPercentagePreferenceController (com.android.settings.display.BatteryPercentagePreferenceController)3 AutoRotatePreferenceController (com.android.settings.display.AutoRotatePreferenceController)2