Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26c3b25a authored by John Spurlock's avatar John Spurlock
Browse files

Remove rotation-lock from Display settings.

Ability to lock device to natural orientation is still available
under Accessibility.

Bug:11062710
Change-Id: I2045e16cfc676ee75d4d42b0cd652433b2f12715
parent 1bb86183
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@
                android:title="@string/wallpaper_settings_title"
                android:fragment="com.android.settings.WallpaperTypeSettings" />

        <CheckBoxPreference
            android:key="accelerometer"
            android:title="@string/accelerometer_title"/>

        <ListPreference
                android:key="screen_timeout"
                android:title="@string/screen_timeout"
+1 −42
Original line number Diff line number Diff line
@@ -49,14 +49,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;

    private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
    private static final String KEY_ACCELEROMETER = "accelerometer";
    private static final String KEY_FONT_SIZE = "font_size";
    private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
    private static final String KEY_SCREEN_SAVER = "screensaver";

    private static final int DLG_GLOBAL_CHANGE_WARNING = 1;

    private CheckBoxPreference mAccelerometer;
    private WarnedListPreference mFontSizePref;
    private CheckBoxPreference mNotificationPulse;

@@ -65,14 +63,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    private ListPreference mScreenTimeoutPreference;
    private Preference mScreenSaverPreference;

    private final RotationPolicy.RotationPolicyListener mRotationPolicyListener =
            new RotationPolicy.RotationPolicyListener() {
        @Override
        public void onChange() {
            updateAccelerometerRotationCheckbox();
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -80,16 +70,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements

        addPreferencesFromResource(R.xml.display_settings);

        mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
        mAccelerometer.setPersistent(false);
        if (!RotationPolicy.isRotationSupported(getActivity())
                || RotationPolicy.isRotationLockToggleSupported(getActivity())) {
            // If rotation lock is supported, then we do not provide this option in
            // Display settings.  However, is still available in Accessibility settings,
            // if the device supports rotation.
            getPreferenceScreen().removePreference(mAccelerometer);
        }

        mScreenSaverPreference = findPreference(KEY_SCREEN_SAVER);
        if (mScreenSaverPreference != null
                && getResources().getBoolean(
@@ -226,20 +206,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    public void onResume() {
        super.onResume();

        RotationPolicy.registerRotationPolicyListener(getActivity(),
                mRotationPolicyListener);

        updateState();
    }

    @Override
    public void onPause() {
        super.onPause();

        RotationPolicy.unregisterRotationPolicyListener(getActivity(),
                mRotationPolicyListener);
    }

    @Override
    public Dialog onCreateDialog(int dialogId) {
        if (dialogId == DLG_GLOBAL_CHANGE_WARNING) {
@@ -255,7 +224,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    }

    private void updateState() {
        updateAccelerometerRotationCheckbox();
        readFontSizePreference(mFontSizePref);
        updateScreenSaverSummary();
    }
@@ -267,12 +235,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
        }
    }

    private void updateAccelerometerRotationCheckbox() {
        if (getActivity() == null) return;

        mAccelerometer.setChecked(!RotationPolicy.isRotationLocked(getActivity()));
    }

    public void writeFontSizePreference(Object objValue) {
        try {
            mCurConfig.fontScale = Float.parseFloat(objValue.toString());
@@ -284,10 +246,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements

    @Override
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (preference == mAccelerometer) {
            RotationPolicy.setRotationLockForAccessibility(
                    getActivity(), !mAccelerometer.isChecked());
        } else if (preference == mNotificationPulse) {
        if (preference == mNotificationPulse) {
            boolean value = mNotificationPulse.isChecked();
            Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE,
                    value ? 1 : 0);