Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
index 76ec4c5ede1d1bae2fc50b3ef540a92bb9777eb7..24b8ab834051885c3ed6912f40e700f92e14b412 100644 |
--- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
+++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java |
@@ -20,7 +20,6 @@ |
import android.os.Build; |
import java.util.Timer; |
import java.util.TimerTask; |
-import org.webrtc.ContextUtils; |
import org.webrtc.Logging; |
// WebRtcAudioManager handles tasks that uses android.media.AudioManager. |
@@ -136,6 +135,7 @@ |
} |
private final long nativeAudioManager; |
+ private final Context context; |
private final AudioManager audioManager; |
private boolean initialized = false; |
@@ -156,11 +156,11 @@ |
private final VolumeLogger volumeLogger; |
- WebRtcAudioManager(long nativeAudioManager) { |
+ WebRtcAudioManager(Context context, long nativeAudioManager) { |
Logging.d(TAG, "ctor" + WebRtcAudioUtils.getThreadInfo()); |
+ this.context = context; |
this.nativeAudioManager = nativeAudioManager; |
- audioManager = |
- (AudioManager) ContextUtils.getApplicationContext().getSystemService(Context.AUDIO_SERVICE); |
+ audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); |
if (DEBUG) { |
WebRtcAudioUtils.logDeviceInfo(TAG); |
} |
@@ -224,14 +224,12 @@ |
// Gets the current earpiece state. |
private boolean hasEarpiece() { |
- return ContextUtils.getApplicationContext().getPackageManager().hasSystemFeature( |
- PackageManager.FEATURE_TELEPHONY); |
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY); |
} |
// Returns true if low-latency audio output is supported. |
private boolean isLowLatencyOutputSupported() { |
- return ContextUtils.getApplicationContext().getPackageManager().hasSystemFeature( |
- PackageManager.FEATURE_AUDIO_LOW_LATENCY); |
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY); |
} |
// Returns true if low-latency audio input is supported. |
@@ -250,8 +248,7 @@ |
@TargetApi(23) |
private boolean isProAudioSupported() { |
return WebRtcAudioUtils.runningOnMarshmallowOrHigher() |
- && ContextUtils.getApplicationContext().getPackageManager().hasSystemFeature( |
- PackageManager.FEATURE_AUDIO_PRO); |
+ && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_PRO); |
} |
// Returns the native output sample rate for this device's output stream. |