Permalink
Browse files

audio: Inform audio HAL if it is a voice call initiated by Telephony

setMode() API with IN_CALL mode can be called by any of the Apps.
In HAL, it is required to distinguish if it is a real voice call
or not. Inform to audio HAL if it is a voice call by checking
getPhonestate() updated by telephony.

CRs-Fixed: 662804
Change-Id: I20a661f49f6566bdd1e23d6de18b509e2728ef19
  • Loading branch information...
1 parent c58e035 commit 11ed43242a0fa20f4ef514562514e1bdfb33199e Venkata Narendra Kumar Gutta committed with cyanogen May 28, 2014
Showing with 10 additions and 1 deletion.
  1. +10 −1 media/java/android/media/AudioService.java
@@ -463,6 +463,8 @@ public void onError(int error) {
private PowerManager.WakeLock mAudioEventWakeLock;
+ private TelephonyManager mTelephonyManager;
+
private final MediaFocusControl mMediaFocusControl;
// Reference to BluetoothA2dp to query for AbsoluteVolume.
@@ -488,7 +490,6 @@ public AudioService(Context context) {
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mAudioEventWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "handleAudioEvent");
-
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
mHasVibrator = vibrator == null ? false : vibrator.hasVibrator();
@@ -501,6 +502,9 @@ public AudioService(Context context) {
com.android.internal.R.integer.config_soundEffectVolumeDb);
mVolumePanel = new VolumePanel(context, this);
+
+ mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+
mForcedUseForComm = AudioSystem.FORCE_NONE;
createAudioSystemThread();
@@ -1651,6 +1655,11 @@ public void setMode(int mode, IBinder cb) {
if (mode == AudioSystem.MODE_CURRENT) {
mode = mMode;
}
+
+ if ((mode == AudioSystem.MODE_IN_CALL) &&
+ (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) {
+ AudioSystem.setParameters("in_call=true");
+ }
newModeOwnerPid = setModeInt(mode, cb, Binder.getCallingPid());
}
// when entering RINGTONE, IN_CALL or IN_COMMUNICATION mode, clear all

0 comments on commit 11ed432

Please sign in to comment.