Temp work around for audio bugs
As a temporary work around for audio bugs this CL does the following:
- request audio focus
- set audio mode
- disable speaker phone
- unmute microphone
Bug: 13375268
Change-Id: Ibf3cda9e99463669d15804708f080b6c7efc5d5c
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 5cb879f..23de67b 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -17,7 +17,9 @@
package com.android.telecomm;
import android.Manifest;
+import android.content.Context;
import android.content.Intent;
+import android.media.AudioManager;
import android.os.Bundle;
import android.telecomm.CallService;
import android.telecomm.CallServiceDescriptor;
@@ -237,6 +239,12 @@
call.disconnect();
}
+ // TODO(sail): Replace with CallAudioManager.
+ Log.v(this, "disconnectCall, abandoning audio focus");
+ Context context = TelecommApp.getInstance().getApplicationContext();
+ AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ audioManager.setMode(AudioManager.MODE_NORMAL);
+ audioManager.abandonAudioFocusForCall();
}
void markCallAsRinging(String callId) {
@@ -251,6 +259,16 @@
setCallState(callId, CallState.ACTIVE);
removeFromUnansweredCalls(callId);
mInCallController.markCallAsActive(callId);
+
+ // TODO(sail): Replace with CallAudioManager.
+ Log.v(this, "markCallAsActive, requesting audio focus");
+ Context context = TelecommApp.getInstance().getApplicationContext();
+ AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ audioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL,
+ AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
+ audioManager.setMode(AudioManager.MODE_IN_CALL);
+ audioManager.setMicrophoneMute(false);
+ audioManager.setSpeakerphoneOn(false);
}
/**