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

Commit b8717121 authored by Scott Mertz's avatar Scott Mertz Committed by Jessica Wagantall
Browse files

Revert audio speedup on mt call patches from qcom

AOSP has their own implementation now in 5.1.1_r37

Revert "Fix to set initial audio state"

This reverts commit 0c332db7.

Revert "Fix to prevent null pointer exception"

This reverts commit 899b590e.

Revert "Set audio mode after accepting the call"

This reverts commit 3048f13e.

CYNGNOS-2213

Change-Id: Ia16a2f1d475b44d6ce3ad07f1f31d807b0c3d8ca
(cherry picked from commit 32d4c49b)
parent 97d268fc
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -46,8 +46,4 @@

    <!-- DTMF key to be used for LCH hold tone -->
    <string name="Lch_dtmf_key" translatable="false">D</string>

    <!-- Flag indicating if the speed up audio on mt call code should be executed -->
    <bool name="config_speed_up_audio_on_mt_calls">false</bool>

</resources>
+3 −30
Original line number Diff line number Diff line
@@ -44,9 +44,6 @@ final class CallAudioManager extends CallsManagerListenerBase
    private boolean mIsTonePlaying;
    private boolean mWasSpeakerOn;
    private int mMostRecentlyUsedMode = AudioManager.MODE_IN_CALL;
    private boolean mSpeedUpAudioForMtCall = false;
    private Context mContext;
    private String mSubId;

    CallAudioManager(Context context, StatusBarNotifier statusBarNotifier,
            WiredHeadsetManager wiredHeadsetManager) {
@@ -58,7 +55,6 @@ final class CallAudioManager extends CallsManagerListenerBase

        saveAudioState(getInitialAudioState(null));
        mAudioFocusStreamType = STREAM_NONE;
        mContext = context;
    }

    AudioState getAudioState() {
@@ -110,21 +106,6 @@ final class CallAudioManager extends CallsManagerListenerBase
        }

        setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask());

        if (mContext == null) {
            Log.d(this, "Speedup Audio Path enhancement: Context is null");
        } else if (mContext.getResources().getBoolean(
                com.android.server.telecom.R.bool.config_speed_up_audio_on_mt_calls)) {
            Log.d(this, "Speedup Audio Path enhancement");
            mSpeedUpAudioForMtCall = true;
            mSubId = call.getTargetPhoneAccount().getId();
            if (mIsRinging) {
                setIsRinging(false);
            } else {
                updateAudioStreamAndMode();
                setInitialAudioState(call, true /* force */);
            }
        }
    }

    @Override
@@ -302,12 +283,7 @@ final class CallAudioManager extends CallsManagerListenerBase
    private void onCallUpdated(Call call) {
        boolean wasNotVoiceCall = mAudioFocusStreamType != AudioManager.STREAM_VOICE_CALL;
        updateAudioStreamAndMode();
        if ((call != null) && (call.getState() == CallState.ACTIVE) &&
                (call.getTargetPhoneAccount() != null) &&
                call.getTargetPhoneAccount().getId().equals(mSubId) && mSpeedUpAudioForMtCall) {
            Log.d(this,"Reset mSpeedUpAudioForMtCall");
            mSpeedUpAudioForMtCall = false;
        }

        // If we transition from not voice call to voice call, we need to set an initial state.
        if (wasNotVoiceCall && mAudioFocusStreamType == AudioManager.STREAM_VOICE_CALL) {
            setInitialAudioState(call, true /* force */);
@@ -381,8 +357,7 @@ final class CallAudioManager extends CallsManagerListenerBase
    private void updateAudioStreamAndMode() {
        Log.i(this, "updateAudioStreamAndMode, mIsRinging: %b, mIsTonePlaying: %b", mIsRinging,
                mIsTonePlaying);
        Log.v(this, "updateAudioStreamAndMode, mSpeedUpAudioForMtCall: %b", mSpeedUpAudioForMtCall);
        if (mIsRinging && !mSpeedUpAudioForMtCall) {
        if (mIsRinging) {
            requestAudioFocusAndSetMode(AudioManager.STREAM_RING, AudioManager.MODE_RINGTONE);
        } else {
            Call foregroundCall = getForegroundCall();
@@ -439,7 +414,6 @@ final class CallAudioManager extends CallsManagerListenerBase
            Log.v(this, "abandoning audio focus");
            mAudioManager.abandonAudioFocusForCall();
            mAudioFocusStreamType = STREAM_NONE;
            mSpeedUpAudioForMtCall = false;
        }
    }

@@ -459,7 +433,6 @@ final class CallAudioManager extends CallsManagerListenerBase
                mAudioManager.setMode(AudioManager.MODE_NORMAL);
            }
            mAudioManager.setMode(newMode);
            Log.d(this, "SetMode Done");
            mMostRecentlyUsedMode = newMode;
        }
    }
@@ -546,7 +519,7 @@ final class CallAudioManager extends CallsManagerListenerBase

        // We ignore any foreground call that is in the ringing state because we deal with ringing
        // calls exclusively through the mIsRinging variable set by {@link Ringer}.
        if (call != null && call.getState() == CallState.RINGING && !mSpeedUpAudioForMtCall ) {
        if (call != null && call.getState() == CallState.RINGING) {
            call = null;
        }