Merge "Add tap to wake setting" into mnc-dev
This commit is contained in:
@@ -6467,6 +6467,12 @@
|
|||||||
LIMIT=45] -->
|
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>
|
<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] -->
|
<!-- Label for the Domain URLs list that shows domain urls per App [CHAR LIMIT=30] -->
|
||||||
<string name="domain_urls_title">Domain URLs</string>
|
<string name="domain_urls_title">Domain URLs</string>
|
||||||
|
|
||||||
|
@@ -72,6 +72,12 @@
|
|||||||
android:summary="@string/doze_summary"
|
android:summary="@string/doze_summary"
|
||||||
android:persistent="false" />
|
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
|
<com.android.settings.WarnedListPreference
|
||||||
android:key="font_size"
|
android:key="font_size"
|
||||||
android:title="@string/title_font_size"
|
android:title="@string/title_font_size"
|
||||||
|
@@ -22,6 +22,7 @@ import com.android.settings.DropDownPreference.Callback;
|
|||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
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.DOZE_ENABLED;
|
||||||
import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
|
import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
|
||||||
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
|
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_SCREEN_SAVER = "screensaver";
|
||||||
private static final String KEY_LIFT_TO_WAKE = "lift_to_wake";
|
private static final String KEY_LIFT_TO_WAKE = "lift_to_wake";
|
||||||
private static final String KEY_DOZE = "doze";
|
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_BRIGHTNESS = "auto_brightness";
|
||||||
private static final String KEY_AUTO_ROTATE = "auto_rotate";
|
private static final String KEY_AUTO_ROTATE = "auto_rotate";
|
||||||
private static final String KEY_NIGHT_MODE = "night_mode";
|
private static final String KEY_NIGHT_MODE = "night_mode";
|
||||||
@@ -84,6 +86,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private Preference mScreenSaverPreference;
|
private Preference mScreenSaverPreference;
|
||||||
private SwitchPreference mLiftToWakePreference;
|
private SwitchPreference mLiftToWakePreference;
|
||||||
private SwitchPreference mDozePreference;
|
private SwitchPreference mDozePreference;
|
||||||
|
private SwitchPreference mTapToWakePreference;
|
||||||
private SwitchPreference mAutoBrightnessPreference;
|
private SwitchPreference mAutoBrightnessPreference;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,6 +142,13 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
removePreference(KEY_DOZE);
|
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)) {
|
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
|
||||||
DropDownPreference rotatePreference =
|
DropDownPreference rotatePreference =
|
||||||
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
|
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
|
||||||
@@ -201,6 +211,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
return !TextUtils.isEmpty(name);
|
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) {
|
private static boolean isAutomaticBrightnessAvailable(Resources res) {
|
||||||
return res.getBoolean(com.android.internal.R.bool.config_automatic_brightness_available);
|
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);
|
int value = Settings.Secure.getInt(getContentResolver(), DOZE_ENABLED, 1);
|
||||||
mDozePreference.setChecked(value != 0);
|
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() {
|
private void updateScreenSaverSummary() {
|
||||||
@@ -396,6 +416,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
boolean value = (Boolean) objValue;
|
boolean value = (Boolean) objValue;
|
||||||
Settings.Secure.putInt(getContentResolver(), DOZE_ENABLED, value ? 1 : 0);
|
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) {
|
if (preference == mNightModePreference) {
|
||||||
try {
|
try {
|
||||||
final int value = Integer.parseInt((String) objValue);
|
final int value = Integer.parseInt((String) objValue);
|
||||||
|
Reference in New Issue
Block a user