Permalink
Browse files

SystemUI: Double tap to sleep anywhere on the lock screen (1/2)

Change-Id: I0959678a89e47328fe2180c7fdc9970aa9bafb38
  • Loading branch information...
Altaf-Mahdi authored and akhilnarang committed Nov 11, 2015
1 parent 097c984 commit fdf2b56f91ba17e5b1a4089e8a8414e0df7f9237
@@ -3757,6 +3757,12 @@ public boolean validate(String value) {
*/
public static final String MEDIA_SCANNER_ON_BOOT = "media_scanner_on_boot";
/**
* Enable double tap gesture anywhere on the lock screen put device to sleep
* @hide
*/
public static final String DOUBLE_TAP_SLEEP_ANYWHERE = "double_tap_sleep_anywhere";
/**
* Whether or not volume button music controls should be enabled to seek media tracks
* @hide
@@ -219,6 +219,7 @@ public void run() {
};
private NotificationGroupManager mGroupManager;
private boolean mDoubleTapToSleepAnywhere;
private boolean mDoubleTapToSleepEnabled;
private int mStatusBarHeaderHeight;
private GestureDetector mDoubleTapGesture;
@@ -779,6 +780,9 @@ public boolean onTouchEvent(MotionEvent event) {
&& mStatusBarState == StatusBarState.KEYGUARD
&& event.getY() < mStatusBarHeaderHeight) {
mDoubleTapGesture.onTouchEvent(event);
} else if (mDoubleTapToSleepAnywhere
&& mStatusBarState == StatusBarState.KEYGUARD) {
mDoubleTapGesture.onTouchEvent(event);
}
initDownStates(event);
if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
@@ -2426,6 +2430,8 @@ void observe() {
Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN), false, this);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.DOUBLE_TAP_SLEEP_GESTURE), false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.DOUBLE_TAP_SLEEP_ANYWHERE), false, this, UserHandle.USER_ALL);
update();
}
@@ -2450,6 +2456,8 @@ public void update() {
resolver, Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 1) == 1;
mDoubleTapToSleepEnabled = Settings.System.getIntForUser(resolver,
Settings.System.DOUBLE_TAP_SLEEP_GESTURE, 0, UserHandle.USER_CURRENT) == 1;
mDoubleTapToSleepAnywhere = Settings.System.getIntForUser(resolver,
Settings.System.DOUBLE_TAP_SLEEP_ANYWHERE, 0, UserHandle.USER_CURRENT) == 1;
}
}
}

0 comments on commit fdf2b56

Please sign in to comment.