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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java

Issue 2291163002: Let MediaSession store duck state instead of volume multiplier (Closed)
Patch Set: addressed Anton's comments Created 4 years, 4 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 | « content/browser/media/session/media_session_delegate_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java b/content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java
index af648e329564d70b178e2787597b851748272875..c76facaf11b078ba7af4a08778d598ecb95b5d40 100644
--- a/content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java
+++ b/content/public/android/java/src/org/chromium/content/browser/MediaSessionDelegate.java
@@ -26,10 +26,6 @@ import org.chromium.base.annotations.JNINamespace;
public class MediaSessionDelegate implements AudioManager.OnAudioFocusChangeListener {
private static final String TAG = "MediaSession";
- // These need to match the values in native apps.
- public static final double DUCKING_VOLUME_MULTIPLIER = 0.2f;
- public static final double DEFAULT_VOLUME_MULTIPLIER = 1.0f;
-
private Context mContext;
private int mFocusType;
private boolean mIsDucking = false;
@@ -82,8 +78,7 @@ public class MediaSessionDelegate implements AudioManager.OnAudioFocusChangeList
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
if (mIsDucking) {
- nativeOnSetVolumeMultiplier(mNativeMediaSessionDelegateAndroid,
- DEFAULT_VOLUME_MULTIPLIER);
+ nativeOnStopDucking(mNativeMediaSessionDelegateAndroid);
mIsDucking = false;
} else {
nativeOnResume(mNativeMediaSessionDelegateAndroid);
@@ -95,8 +90,7 @@ public class MediaSessionDelegate implements AudioManager.OnAudioFocusChangeList
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
mIsDucking = true;
nativeRecordSessionDuck(mNativeMediaSessionDelegateAndroid);
- nativeOnSetVolumeMultiplier(mNativeMediaSessionDelegateAndroid,
- DUCKING_VOLUME_MULTIPLIER);
+ nativeOnStartDucking(mNativeMediaSessionDelegateAndroid);
break;
case AudioManager.AUDIOFOCUS_LOSS:
abandonAudioFocus();
@@ -110,7 +104,7 @@ public class MediaSessionDelegate implements AudioManager.OnAudioFocusChangeList
private native void nativeOnSuspend(long nativeMediaSessionDelegateAndroid, boolean temporary);
private native void nativeOnResume(long nativeMediaSessionDelegateAndroid);
- private native void nativeOnSetVolumeMultiplier(long nativeMediaSessionDelegateAndroid,
- double volumeMultiplier);
+ private native void nativeOnStartDucking(long nativeMediaSessionDelegateAndroid);
+ private native void nativeOnStopDucking(long nativeMediaSessionDelegateAndroid);
private native void nativeRecordSessionDuck(long nativeMediaSessionDelegateAndroid);
}
« no previous file with comments | « content/browser/media/session/media_session_delegate_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698