From 0b99ea94f02b1002ef65aa64363d396a8876b583 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Wed, 1 Oct 2014 15:32:22 -0400 Subject: [PATCH] Doze: Route volume keys to music only while pulsing. Avoid waking up the device on hw vol key presses during a doze pulse. Instead, behave as if the screen was off for these keys, namely forwarding them over to the session manager. Bug:17672775 Change-Id: I566b93f0bdea79253ac3eca41d3876b271c61306 --- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 4 ++++ .../systemui/statusbar/phone/StatusBarWindowView.java | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 222740871bd22..d0f73b166facc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -2135,6 +2135,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, return onKeyguard && (isMethodInsecure || mDozing || mScreenOnComingFromTouch); } + public boolean isDozing() { + return mDozing; + } + @Override // NotificationData.Environment public String getCurrentMediaNotificationKey() { return mMediaNotificationKey; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 242f1b729d645..f0c599d044e32 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -23,6 +23,7 @@ import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; +import android.media.session.MediaSessionLegacyHelper; import android.os.IBinder; import android.util.AttributeSet; import android.view.KeyEvent; @@ -133,11 +134,14 @@ public class StatusBarWindowView extends FrameLayout { if (!down) { return mService.onSpacePressed(); } + break; case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: - if (down) { - mService.wakeUpIfDozing(event.getEventTime(), false); + if (mService.isDozing()) { + MediaSessionLegacyHelper.getHelper(mContext).sendVolumeKeyEvent(event, true); + return true; } + break; } if (mService.interceptMediaKey(event)) { return true;