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

Commit 65cd1559 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add workaround for modem issue where pause bit is not set when on hold.

When a call is remotely held, the modem is not setting the pause bit on
the video state as it should.  This causes a cascading failure where the
user cannot turn the camera on/off (because another video pause hack is
not able to detect that the video is paused and thus activate the hack).

Test: Manual
Change-Id: I2a83b73df5488454b7030d7e4f7c78f360a27eda
Merged-In: Id30c5839b1e8c0d419ebcf03045ad1bcfe3b7d57
Fixes: 63153661
parent eb140d53
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -2331,10 +2331,21 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    mPhone.stopOnHoldTone(conn);
                    mOnHoldToneStarted = false;
                }

                conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_UNHELD, null);
            }

            boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(
                    com.android.internal.R.bool.config_useVideoPauseWorkaround);
            if (useVideoPauseWorkaround && mSupportPauseVideo &&
                    VideoProfile.isVideo(conn.getVideoState())) {
                // If we are using the video pause workaround, the vendor IMS code has issues
                // with video pause signalling.  In this case, when a call is remotely
                // held, the modem does not reliably change the video state of the call to be
                // paused.
                // As a workaround, we will turn on that bit now.
                conn.changeToUnPausedState();
            }

            SuppServiceNotification supp = new SuppServiceNotification();
            // Type of notification: 0 = MO; 1 = MT
            // Refer SuppServiceNotification class documentation.
@@ -2356,8 +2367,19 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    mOnHoldToneStarted = true;
                    mOnHoldToneId = System.identityHashCode(conn);
                }

                conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_HELD, null);

                boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(
                        com.android.internal.R.bool.config_useVideoPauseWorkaround);
                if (useVideoPauseWorkaround && mSupportPauseVideo &&
                        VideoProfile.isVideo(conn.getVideoState())) {
                    // If we are using the video pause workaround, the vendor IMS code has issues
                    // with video pause signalling.  In this case, when a call is remotely
                    // held, the modem does not reliably change the video state of the call to be
                    // paused.
                    // As a workaround, we will turn on that bit now.
                    conn.changeToPausedState();
                }
            }

            SuppServiceNotification supp = new SuppServiceNotification();
+22 −4
Original line number Diff line number Diff line
@@ -828,10 +828,7 @@ public class ImsPhoneConnection extends Connection implements
                    }

                    if (!mShouldIgnoreVideoStateChanges) {
                        if (mImsVideoCallProviderWrapper != null) {
                            mImsVideoCallProviderWrapper.onVideoStateChanged(newVideoState);
                        }
                        setVideoState(newVideoState);
                        updateVideoState(newVideoState);
                        changed = true;
                    } else {
                        Rlog.d(LOG_TAG, "updateMediaCapabilities - ignoring video state change " +
@@ -894,6 +891,13 @@ public class ImsPhoneConnection extends Connection implements
        return changed;
    }

    private void updateVideoState(int newVideoState) {
        if (mImsVideoCallProviderWrapper != null) {
            mImsVideoCallProviderWrapper.onVideoStateChanged(newVideoState);
        }
        setVideoState(newVideoState);
    }

    public void sendRttModifyRequest(android.telecom.Connection.RttTextStream textStream) {
        getImsCall().sendRttModifyRequest();
        setCurrentRttTextStream(textStream);
@@ -1175,4 +1179,18 @@ public class ImsPhoneConnection extends Connection implements

        return mImsVideoCallProviderWrapper.wasVideoPausedFromSource(source);
    }

    public void changeToPausedState() {
        int newVideoState = getVideoState() | VideoProfile.STATE_PAUSED;
        Rlog.i(LOG_TAG, "ImsPhoneConnection: changeToPausedState - setting paused bit; "
                + "newVideoState=" + VideoProfile.videoStateToString(newVideoState));
        updateVideoState(newVideoState);
    }

    public void changeToUnPausedState() {
        int newVideoState = getVideoState() & ~VideoProfile.STATE_PAUSED;
        Rlog.i(LOG_TAG, "ImsPhoneConnection: changeToUnPausedState - unsetting paused bit; "
                + "newVideoState=" + VideoProfile.videoStateToString(newVideoState));
        updateVideoState(newVideoState);
    }
}