Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11ed4324 authored by Venkata Narendra Kumar Gutta's avatar Venkata Narendra Kumar Gutta Committed by Steve Kondik
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
parent c58e035f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -463,6 +463,8 @@ public class AudioService extends IAudioService.Stub {

    private PowerManager.WakeLock mAudioEventWakeLock;

    private TelephonyManager mTelephonyManager;

    private final MediaFocusControl mMediaFocusControl;

    // Reference to BluetoothA2dp to query for AbsoluteVolume.
@@ -488,7 +490,6 @@ public class AudioService extends IAudioService.Stub {

        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 class AudioService extends IAudioService.Stub {
                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 class AudioService extends IAudioService.Stub {
            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