Handle volume key events while in overview
- Normally this gets dispatched to an app's phone window to notify
the media session manager, but because the recents input consumer
routes to the launcher window bypassing phone window, the event
never gets processed.
Fixes: 185520916
Test: Open overview from an app, ensure volume dialog still shows
Change-Id: I8784a6211e56f320b8b9d688fa0568c583652725
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index fa9e0ec..4af6338 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -18,6 +18,8 @@
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
+import android.media.AudioManager;
+import android.media.session.MediaSessionManager;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -101,6 +103,17 @@
@Override
public void onKeyEvent(KeyEvent ev) {
if (LIVE_TILE.get()) {
+ switch (ev.getKeyCode()) {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ case KeyEvent.KEYCODE_VOLUME_MUTE:
+ MediaSessionManager mgr = mActivity.getSystemService(MediaSessionManager.class);
+ mgr.dispatchVolumeKeyEventAsSystemService(ev,
+ AudioManager.USE_DEFAULT_STREAM_TYPE);
+ break;
+ default:
+ break;
+ }
mActivity.dispatchKeyEvent(ev);
}
}