Loading core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -3694,6 +3694,12 @@ public final class Settings { * the setting value. See an example above. */ /** * Enable statusbar double tap gesture on to put device to sleep * @hide */ public static final String DOUBLE_TAP_SLEEP_GESTURE = "double_tap_sleep_gesture"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +22 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.GestureDetector; import android.os.PowerManager; import android.provider.Settings; import com.android.systemui.DejankUtils; import com.android.systemui.EventLogTags; Loading @@ -48,11 +51,26 @@ public class PhoneStatusBarView extends PanelBar { } } }; private GestureDetector mDoubleTapGesture; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); mBarTransitions = new PhoneStatusBarTransitions(this); mDoubleTapGesture = new GestureDetector(mContext, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onDoubleTap(MotionEvent e) { PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); Log.d(TAG, "Gesture!!"); if(pm != null) pm.goToSleep(e.getEventTime()); else Log.d(TAG, "getSystemService returned null PowerManager"); return true; } }); } public BarTransitions getBarTransitions() { Loading Loading @@ -131,6 +149,10 @@ public class PhoneStatusBarView extends PanelBar { } } if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.DOUBLE_TAP_SLEEP_GESTURE, 0) == 1) mDoubleTapGesture.onTouchEvent(event); return barConsumedEvent || super.onTouchEvent(event); } Loading Loading
core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -3694,6 +3694,12 @@ public final class Settings { * the setting value. See an example above. */ /** * Enable statusbar double tap gesture on to put device to sleep * @hide */ public static final String DOUBLE_TAP_SLEEP_GESTURE = "double_tap_sleep_gesture"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +22 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.GestureDetector; import android.os.PowerManager; import android.provider.Settings; import com.android.systemui.DejankUtils; import com.android.systemui.EventLogTags; Loading @@ -48,11 +51,26 @@ public class PhoneStatusBarView extends PanelBar { } } }; private GestureDetector mDoubleTapGesture; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); mBarTransitions = new PhoneStatusBarTransitions(this); mDoubleTapGesture = new GestureDetector(mContext, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onDoubleTap(MotionEvent e) { PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); Log.d(TAG, "Gesture!!"); if(pm != null) pm.goToSleep(e.getEventTime()); else Log.d(TAG, "getSystemService returned null PowerManager"); return true; } }); } public BarTransitions getBarTransitions() { Loading Loading @@ -131,6 +149,10 @@ public class PhoneStatusBarView extends PanelBar { } } if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.DOUBLE_TAP_SLEEP_GESTURE, 0) == 1) mDoubleTapGesture.onTouchEvent(event); return barConsumedEvent || super.onTouchEvent(event); } Loading