OSDN Git Service

Fix overactive media routing
authorSungsoo Lim <sungsoo@google.com>
Wed, 18 Oct 2017 05:54:59 +0000 (14:54 +0900)
committerSungsoo Lim <sungsoo@google.com>
Tue, 31 Oct 2017 00:18:19 +0000 (09:18 +0900)
commit18341301443d0c8e1bd4fc1ba9a7c909593eb918
tree8c9556290e913963146b50d592c69c0b4b82ad97
parente439d72170c14e0b92cc906307010606f3d71521
Fix overactive media routing

For MediaRouterService,
- Delay route restoration to BT for 0.5s in case the app plays
  more audio

For AudioPlaybackMonitor,
- Rename to AudioPlayerStateMonitor.
- Combine two listeners into one.
- Take a handler for the looper of the callback methods.
- Move the registration of playback callback into audio service
  from the constructor to the caller.

Bug: 65376604
Test: manual tests as follows
1. Checked that the lastly played app receives the media key events
although the app's media session doesn't report its playback state.
2. Checked that the lastly played app receives the media key events
although the app's media session is released.
3. Confirmed that this mitigates the issue.
Change-Id: I52e3719cd962f5d92c2f0e547309ce1314cc0926
services/core/java/com/android/server/media/AudioPlaybackMonitor.java [deleted file]
services/core/java/com/android/server/media/AudioPlayerStateMonitor.java [new file with mode: 0644]
services/core/java/com/android/server/media/MediaRouterService.java
services/core/java/com/android/server/media/MediaSessionService.java
services/core/java/com/android/server/media/MediaSessionStack.java