summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml6
-rw-r--r--res/xml/display_settings.xml6
-rw-r--r--src/com/android/settings/DisplaySettings.java24
3 files changed, 36 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0b98428..40f124a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6454,6 +6454,12 @@
LIMIT=45] -->
<string name="app_permissions_group_summary"><xliff:g id="count" example="10">%d</xliff:g> of <xliff:g id="count" example="10">%d</xliff:g> apps allowed</string>
+ <!-- Label for tap to wake setting [CHAR LIMIT=30] -->
+ <string name="tap_to_wake">Tap to wake</string>
+
+ <!-- Summary for take to wake setting [CHAR LIMIT=90] -->
+ <string name="tap_to_wake_summary">Double-tap anywhere on the screen to wake device</string>
+
<!-- Label for the Domain URLs list that shows domain urls per App [CHAR LIMIT=30] -->
<string name="domain_urls_title">Domain URLs</string>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 70dcb9a..304a77b 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -72,6 +72,12 @@
android:summary="@string/doze_summary"
android:persistent="false" />
+ <SwitchPreference
+ android:key="tap_to_wake"
+ android:title="@string/tap_to_wake"
+ android:summary="@string/tap_to_wake_summary"
+ android:persistent="false" />
+
<com.android.settings.WarnedListPreference
android:key="font_size"
android:title="@string/title_font_size"
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 7ad3832..d9b6447 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -22,6 +22,7 @@ import com.android.settings.DropDownPreference.Callback;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
import static android.provider.Settings.Secure.DOZE_ENABLED;
import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
@@ -69,6 +70,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private static final String KEY_SCREEN_SAVER = "screensaver";
private static final String KEY_LIFT_TO_WAKE = "lift_to_wake";
private static final String KEY_DOZE = "doze";
+ private static final String KEY_TAP_TO_WAKE = "tap_to_wake";
private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness";
private static final String KEY_AUTO_ROTATE = "auto_rotate";
private static final String KEY_NIGHT_MODE = "night_mode";
@@ -84,6 +86,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private Preference mScreenSaverPreference;
private SwitchPreference mLiftToWakePreference;
private SwitchPreference mDozePreference;
+ private SwitchPreference mTapToWakePreference;
private SwitchPreference mAutoBrightnessPreference;
@Override
@@ -139,6 +142,13 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
removePreference(KEY_DOZE);
}
+ if (isTapToWakeAvailable(getResources())) {
+ mTapToWakePreference = (SwitchPreference) findPreference(KEY_TAP_TO_WAKE);
+ mTapToWakePreference.setOnPreferenceChangeListener(this);
+ } else {
+ removePreference(KEY_TAP_TO_WAKE);
+ }
+
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
DropDownPreference rotatePreference =
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
@@ -201,6 +211,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
return !TextUtils.isEmpty(name);
}
+ private static boolean isTapToWakeAvailable(Resources res) {
+ return res.getBoolean(com.android.internal.R.bool.config_supportDoubleTapWake);
+ }
+
private static boolean isAutomaticBrightnessAvailable(Resources res) {
return res.getBoolean(com.android.internal.R.bool.config_automatic_brightness_available);
}
@@ -345,6 +359,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
int value = Settings.Secure.getInt(getContentResolver(), DOZE_ENABLED, 1);
mDozePreference.setChecked(value != 0);
}
+
+ // Update tap to wake if it is available.
+ if (mTapToWakePreference != null) {
+ int value = Settings.Secure.getInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, 0);
+ mTapToWakePreference.setChecked(value != 0);
+ }
}
private void updateScreenSaverSummary() {
@@ -396,6 +416,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
boolean value = (Boolean) objValue;
Settings.Secure.putInt(getContentResolver(), DOZE_ENABLED, value ? 1 : 0);
}
+ if (preference == mTapToWakePreference) {
+ boolean value = (Boolean) objValue;
+ Settings.Secure.putInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
+ }
if (preference == mNightModePreference) {
try {
final int value = Integer.parseInt((String) objValue);