Skip to content

Commit

Permalink
SystemUI: Double tap to sleep anywhere on the lock screen (1/2)
Browse files Browse the repository at this point in the history
Change-Id: I0959678a89e47328fe2180c7fdc9970aa9bafb38
  • Loading branch information
Altaf-Mahdi authored and akhilnarang committed Jun 10, 2017
1 parent 097c984 commit fdf2b56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Expand Up @@ -3757,6 +3757,12 @@ public boolean validate(String value) {
*/ */
public static final String MEDIA_SCANNER_ON_BOOT = "media_scanner_on_boot"; 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 * Whether or not volume button music controls should be enabled to seek media tracks
* @hide * @hide
Expand Down
Expand Up @@ -219,6 +219,7 @@ public void run() {
}; };
private NotificationGroupManager mGroupManager; private NotificationGroupManager mGroupManager;


private boolean mDoubleTapToSleepAnywhere;
private boolean mDoubleTapToSleepEnabled; private boolean mDoubleTapToSleepEnabled;
private int mStatusBarHeaderHeight; private int mStatusBarHeaderHeight;
private GestureDetector mDoubleTapGesture; private GestureDetector mDoubleTapGesture;
Expand Down Expand Up @@ -779,6 +780,9 @@ public boolean onTouchEvent(MotionEvent event) {
&& mStatusBarState == StatusBarState.KEYGUARD && mStatusBarState == StatusBarState.KEYGUARD
&& event.getY() < mStatusBarHeaderHeight) { && event.getY() < mStatusBarHeaderHeight) {
mDoubleTapGesture.onTouchEvent(event); mDoubleTapGesture.onTouchEvent(event);
} else if (mDoubleTapToSleepAnywhere
&& mStatusBarState == StatusBarState.KEYGUARD) {
mDoubleTapGesture.onTouchEvent(event);
} }
initDownStates(event); initDownStates(event);
if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp() if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
Expand Down Expand Up @@ -2426,6 +2430,8 @@ void observe() {
Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN), false, this); Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN), false, this);
resolver.registerContentObserver(Settings.System.getUriFor( resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.DOUBLE_TAP_SLEEP_GESTURE), false, this, UserHandle.USER_ALL); 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(); update();
} }


Expand All @@ -2450,6 +2456,8 @@ public void update() {
resolver, Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 1) == 1; resolver, Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 1) == 1;
mDoubleTapToSleepEnabled = Settings.System.getIntForUser(resolver, mDoubleTapToSleepEnabled = Settings.System.getIntForUser(resolver,
Settings.System.DOUBLE_TAP_SLEEP_GESTURE, 0, UserHandle.USER_CURRENT) == 1; 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.