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

Commit be78b390 authored by Danesh M's avatar Danesh M Committed by Adnan Begovic
Browse files

Settings: Add proximity wake option

Ports and combines:

http://review.cyanogenmod.org/#/c/66658/
Settings : Add preference for proximity wake

http://review.cyanogenmod.org/#/c/69347/
Proximity Wake-Up : adjust strings

http://review.cyanogenmod.org/#/c/69803/
Settings : Make proximity opt-in

Change-Id: Iea0853eccf764438c7aaac76afd13c364fcea0ec
parent 0740704d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -409,4 +409,8 @@
    <!-- tap-to-sleep -->
    <string name="double_tap_to_sleep_title">Double-tap to sleep</string>
    <string name="double_tap_to_sleep_summary">Double tap status bar or lock screen slider to put the device to sleep</string>

    <!-- Proximity wake -->
    <string name="proximity_wake_title">Prevent accidental wake-up</string>
    <string name="proximity_wake_summary">Check the proximity sensor prior to waking up screen</string>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -105,6 +105,12 @@
                    android:key="double_tap_wake_gesture"
                    android:title="@string/double_tap_to_wake_title" />

                <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
                    android:key="proximity_on_wake"
                    android:title="@string/proximity_wake_title"
                    android:summary="@string/proximity_wake_summary"
                    android:defaultValue="true" />

                <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
                    android:key="double_tap_sleep_gesture"
                    android:title="@string/double_tap_to_sleep_title"
+8 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    private static final String KEY_AUTO_ROTATE = "auto_rotate";
    private static final String KEY_NIGHT_MODE = "night_mode";
    private static final String KEY_TAP_TO_WAKE = "double_tap_wake_gesture";
    private static final String KEY_PROXIMITY_WAKE = "proximity_on_wake";

    private static final String CATEGORY_ADVANCED = "advanced_display_prefs";

@@ -212,6 +213,13 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
            advancedPrefs.removePreference(mTapToWake);
            mTapToWake = null;
        }

        boolean proximityCheckOnWait = getResources().getBoolean(
                com.android.internal.R.bool.config_proximityCheckOnWake);
        if (!proximityCheckOnWait) {
            advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE));
            Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1);
        }
    }

    private static boolean allowAllRotations(Context context) {