Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java

Issue 2714993002: [Media>UI] Fix a media notification update issue when audio focus changes between tabs (Closed)
Patch Set: fixed test and addressed nits Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
index a83e0f314b87724a7d4bf8f4b308e0871d9bb403..5cfed32bba2c70b3c9f85a0046e5c1ea9d6777d2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
@@ -408,7 +408,8 @@ public class MediaNotificationManager {
/**
* Shows the notification with media controls with the specified media info. Replaces/updates
* the current notification if already showing. Does nothing if |mediaNotificationInfo| hasn't
- * changed from the last one.
+ * changed from the last one. If |mediaNotificationInfo.isPaused| is true and the tabId
+ * mismatches |mMediaNotificationInfo.isPaused|, it is also no-op.
*
* @param applicationContext context to create the notification with
* @param notificationInfo information to show in the notification
@@ -654,6 +655,10 @@ public class MediaNotificationManager {
private void showNotification(MediaNotificationInfo mediaNotificationInfo) {
if (mediaNotificationInfo.equals(mMediaNotificationInfo)) return;
+ if (mediaNotificationInfo.isPaused && mMediaNotificationInfo != null
+ && mediaNotificationInfo.tabId != mMediaNotificationInfo.tabId) {
+ return;
+ }
mMediaNotificationInfo = mediaNotificationInfo;
mContext.startService(createIntent(mContext));
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698