OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.media.AudioManager; | 8 import android.media.AudioManager; |
9 | 9 |
10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
(...skipping 11 matching lines...) Expand all Loading... |
22 * counterpart and will resume its play using the same type if it were to | 22 * counterpart and will resume its play using the same type if it were to |
23 * happen, for example, when it got temporarily suspended by a transient sound | 23 * happen, for example, when it got temporarily suspended by a transient sound |
24 * like a notification. | 24 * like a notification. |
25 */ | 25 */ |
26 @JNINamespace("content") | 26 @JNINamespace("content") |
27 public class AudioFocusDelegate implements AudioManager.OnAudioFocusChangeListen
er { | 27 public class AudioFocusDelegate implements AudioManager.OnAudioFocusChangeListen
er { |
28 private static final String TAG = "MediaSession"; | 28 private static final String TAG = "MediaSession"; |
29 | 29 |
30 private Context mContext; | 30 private Context mContext; |
31 private int mFocusType; | 31 private int mFocusType; |
32 private boolean mIsDucking = false; | 32 private boolean mIsDucking; |
33 | 33 |
34 // Native pointer to C++ content::AudioFocusDelegateAndroid. | 34 // Native pointer to C++ content::AudioFocusDelegateAndroid. |
35 // It will be set to 0 when the native AudioFocusDelegateAndroid object is d
estroyed. | 35 // It will be set to 0 when the native AudioFocusDelegateAndroid object is d
estroyed. |
36 private long mNativeAudioFocusDelegateAndroid; | 36 private long mNativeAudioFocusDelegateAndroid; |
37 | 37 |
38 private AudioFocusDelegate(final Context context, long nativeAudioFocusDeleg
ateAndroid) { | 38 private AudioFocusDelegate(final Context context, long nativeAudioFocusDeleg
ateAndroid) { |
39 mContext = context; | 39 mContext = context; |
40 mNativeAudioFocusDelegateAndroid = nativeAudioFocusDelegateAndroid; | 40 mNativeAudioFocusDelegateAndroid = nativeAudioFocusDelegateAndroid; |
41 } | 41 } |
42 | 42 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 break; | 106 break; |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 private native void nativeOnSuspend(long nativeAudioFocusDelegateAndroid, bo
olean temporary); | 110 private native void nativeOnSuspend(long nativeAudioFocusDelegateAndroid, bo
olean temporary); |
111 private native void nativeOnResume(long nativeAudioFocusDelegateAndroid); | 111 private native void nativeOnResume(long nativeAudioFocusDelegateAndroid); |
112 private native void nativeOnStartDucking(long nativeAudioFocusDelegateAndroi
d); | 112 private native void nativeOnStartDucking(long nativeAudioFocusDelegateAndroi
d); |
113 private native void nativeOnStopDucking(long nativeAudioFocusDelegateAndroid
); | 113 private native void nativeOnStopDucking(long nativeAudioFocusDelegateAndroid
); |
114 private native void nativeRecordSessionDuck(long nativeAudioFocusDelegateAnd
roid); | 114 private native void nativeRecordSessionDuck(long nativeAudioFocusDelegateAnd
roid); |
115 } | 115 } |
OLD | NEW |