@@ -70,6 +70,8 @@ public class StatusBarWindowView extends FrameLayout {
7070
7171 private int mStatusBarHeaderHeight ;
7272
73+ private boolean mDozeWakeupDoubleTap ;
74+ private GestureDetector mDozeWakeupDoubleTapGesture ;
7375 private boolean mDoubleTapToSleepEnabled ;
7476 private boolean mDoubleTapToSleepLockScreen ;
7577 private GestureDetector mDoubleTapGesture ;
@@ -119,6 +121,15 @@ public boolean onDoubleTap(MotionEvent e) {
119121 }
120122 });
121123
124+ mDozeWakeupDoubleTapGesture = new GestureDetector (mContext ,
125+ new GestureDetector .SimpleOnGestureListener () {
126+ @ Override
127+ public boolean onDoubleTap (MotionEvent e ) {
128+ mService .wakeUpIfDozing (e .getEventTime (), e );
129+ return true ;
130+ }
131+ });
132+
122133 // We really need to be able to animate while window animations are going on
123134 // so that activities may be started asynchronously from panel animations
124135 final ViewRootImpl root = getViewRootImpl ();
@@ -224,10 +235,16 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
224235 && mStackScrollLayout .getVisibility () == View .VISIBLE
225236 && mService .getBarState () == StatusBarState .KEYGUARD
226237 && !mService .isBouncerShowing ()) {
227- intercept = mDragDownHelper .onInterceptTouchEvent (ev );
238+ if (!mDozeWakeupDoubleTap || (mDozeWakeupDoubleTap && !mService .isDozing ())) {
239+ intercept = mDragDownHelper .onInterceptTouchEvent (ev );
240+ }
228241 // wake up on a touch down event, if dozing
229- if (ev .getActionMasked () == MotionEvent .ACTION_DOWN ) {
230- mService .wakeUpIfDozing (ev .getEventTime (), ev );
242+ if (mDozeWakeupDoubleTap ) {
243+ mDozeWakeupDoubleTapGesture .onTouchEvent (ev );
244+ } else {
245+ if (ev .getActionMasked () == MotionEvent .ACTION_DOWN ) {
246+ mService .wakeUpIfDozing (ev .getEventTime (), ev );
247+ }
231248 }
232249 }
233250 if (!intercept ) {
@@ -322,6 +339,8 @@ void observe() {
322339 CMSettings .System .DOUBLE_TAP_SLEEP_GESTURE ), false , this );
323340 resolver .registerContentObserver (Settings .System .getUriFor (
324341 Settings .System .DOUBLE_TAP_SLEEP_LOCK_SCREEN ), false , this );
342+ resolver .registerContentObserver (Settings .System .getUriFor (
343+ Settings .System .DOZE_WAKEUP_DOUBLETAP ), false , this );
325344 update ();
326345 }
327346
@@ -346,6 +365,8 @@ public void update() {
346365 .getInt (resolver , CMSettings .System .DOUBLE_TAP_SLEEP_GESTURE , 1 ) == 1 ;
347366 mDoubleTapToSleepLockScreen = Settings .System .getIntForUser (resolver ,
348367 Settings .System .DOUBLE_TAP_SLEEP_LOCK_SCREEN , 0 , UserHandle .USER_CURRENT ) == 1 ;
368+ mDozeWakeupDoubleTap = Settings .System .getInt (
369+ resolver , Settings .System .DOZE_WAKEUP_DOUBLETAP , 0 ) == 1 ;
349370 }
350371 }
351372}
0 commit comments