diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 01c3b11..295e4b3 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -30,6 +30,7 @@ @string/touchscreen_gesture_action_next_track @string/touchscreen_gesture_action_volume_down @string/touchscreen_gesture_action_volume_up + @string/touchscreen_gesture_action_ambient_display 0 @@ -44,6 +45,7 @@ 9 10 11 + 12 diff --git a/res/values/strings.xml b/res/values/strings.xml index 2a1df43..26c7c4f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -41,6 +41,7 @@ Draw the letter \"V\" Draw the letter \"W\" Draw the letter \"Z\" + Single tap Swipe up with the stylus @@ -62,5 +63,6 @@ Play the next music track Lower media volume Raise media volume + Show ambient display diff --git a/src/com/android/touch/gestures/KeyHandler.java b/src/com/android/touch/gestures/KeyHandler.java index 458862e..fdbb129 100644 --- a/src/com/android/touch/gestures/KeyHandler.java +++ b/src/com/android/touch/gestures/KeyHandler.java @@ -58,6 +58,7 @@ public class KeyHandler implements DeviceKeyHandler { private static final String TAG = KeyHandler.class.getSimpleName(); private static final String GESTURE_WAKEUP_REASON = "touchscreen-gesture-wakeup"; + private static final String PULSE_ACTION = "com.android.systemui.doze.pulse"; private static final int GESTURE_REQUEST = 0; private static final int GESTURE_WAKELOCK_DURATION = 3000; private static final int EVENT_PROCESS_WAKELOCK_DURATION = 500; @@ -230,6 +231,9 @@ public void handleMessage(final Message msg) { case TouchscreenGestureConstants.ACTION_VOLUME_UP: volumeUp(); break; + case TouchscreenGestureConstants.ACTION_AMBIENT_DISPLAY: + launchDozePulse(); + break; } } } @@ -318,6 +322,17 @@ private void volumeUp() { doHapticFeedback(); } + private void launchDozePulse() { + final boolean dozeEnabled = Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.DOZE_ENABLED, 1) != 0; + if (dozeEnabled) { + mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); + final Intent intent = new Intent(PULSE_ACTION); + mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); + doHapticFeedback(); + } + } + private void dispatchMediaKeyWithWakeLockToMediaSession(final int keycode) { final MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); if (helper == null) { diff --git a/src/com/android/touch/gestures/TouchscreenGestureConstants.java b/src/com/android/touch/gestures/TouchscreenGestureConstants.java index f720024..50978ce 100644 --- a/src/com/android/touch/gestures/TouchscreenGestureConstants.java +++ b/src/com/android/touch/gestures/TouchscreenGestureConstants.java @@ -37,4 +37,5 @@ class TouchscreenGestureConstants { static final int ACTION_NEXT_TRACK = 9; static final int ACTION_VOLUME_DOWN = 10; static final int ACTION_VOLUME_UP = 11; + static final int ACTION_AMBIENT_DISPLAY = 12; }