Skip to content

Commit 0b99ea9

Browse files
author
John Spurlock
committed
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
1 parent c909e1b commit 0b99ea9

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,10 @@ public boolean isFalsingThresholdNeeded() {
21352135
return onKeyguard && (isMethodInsecure || mDozing || mScreenOnComingFromTouch);
21362136
}
21372137

2138+
public boolean isDozing() {
2139+
return mDozing;
2140+
}
2141+
21382142
@Override // NotificationData.Environment
21392143
public String getCurrentMediaNotificationKey() {
21402144
return mMediaNotificationKey;

packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import android.graphics.PorterDuff;
2424
import android.graphics.PorterDuffXfermode;
2525
import android.graphics.Rect;
26+
import android.media.session.MediaSessionLegacyHelper;
2627
import android.os.IBinder;
2728
import android.util.AttributeSet;
2829
import android.view.KeyEvent;
@@ -133,11 +134,14 @@ public boolean dispatchKeyEvent(KeyEvent event) {
133134
if (!down) {
134135
return mService.onSpacePressed();
135136
}
137+
break;
136138
case KeyEvent.KEYCODE_VOLUME_DOWN:
137139
case KeyEvent.KEYCODE_VOLUME_UP:
138-
if (down) {
139-
mService.wakeUpIfDozing(event.getEventTime(), false);
140+
if (mService.isDozing()) {
141+
MediaSessionLegacyHelper.getHelper(mContext).sendVolumeKeyEvent(event, true);
142+
return true;
140143
}
144+
break;
141145
}
142146
if (mService.interceptMediaKey(event)) {
143147
return true;

0 commit comments

Comments
 (0)