diff options
author | Danesh M <daneshm90@gmail.com> | 2014-12-01 09:29:57 -0600 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:29 -0700 |
commit | be78b3901d14be044c35cf06d8efa9562441e131 (patch) | |
tree | bf6dbba601b92d84f2869d0a64f642496d5fd971 | |
parent | 0740704dcb93ae10b9925bb8555c043e356a9173 (diff) | |
download | packages_apps_Settings-be78b3901d14be044c35cf06d8efa9562441e131.zip packages_apps_Settings-be78b3901d14be044c35cf06d8efa9562441e131.tar.gz packages_apps_Settings-be78b3901d14be044c35cf06d8efa9562441e131.tar.bz2 |
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
-rw-r--r-- | res/values/cm_strings.xml | 4 | ||||
-rw-r--r-- | res/xml/display_settings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/DisplaySettings.java | 8 |
3 files changed, 18 insertions, 0 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index c1832d4..585541e 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -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> diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index 1cc0c00..6dfaac6 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -106,6 +106,12 @@ 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" android:summary="@string/double_tap_to_sleep_summary" diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 392e44d..ff2aad2 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -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) { |