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

Commit 4790c776 authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Expand ImsPhoneCall logging and add updatePhoneState check.

am: 9cf07ae6

Change-Id: I272c3cf6628ce060590772bf2f9b6c5f91847510
parents da1f98ed 9cf07ae6
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -191,6 +191,10 @@ public class ImsPhoneCall extends Call {

            if (hasOnlyDisconnectedConnections) {
                mState = State.DISCONNECTED;
                if (VDBG) {
                    Rlog.v(LOG_TAG, "connectionDisconnected : " + mCallContext + " state = " +
                            mState);
                }
                return true;
            }
        }
@@ -228,6 +232,9 @@ public class ImsPhoneCall extends Call {
            cn.onHangupLocal();
        }
        mState = State.DISCONNECTING;
        if (VDBG) {
            Rlog.v(LOG_TAG, "onHangupLocal : " + mCallContext + " state = " + mState);
        }
    }

    /*package*/ ImsPhoneConnection
@@ -300,8 +307,8 @@ public class ImsPhoneCall extends Call {
    }

    public boolean update (ImsPhoneConnection conn, ImsCall imsCall, State state) {
        State newState = state;
        boolean changed = false;
        State oldState = mState;

        //ImsCall.Listener.onCallProgressing can be invoked several times
        //and ringback tone mode can be changed during the call setup procedure
@@ -320,13 +327,17 @@ public class ImsPhoneCall extends Call {
            }
        }

        if ((newState != mState) && (state != State.DISCONNECTED)) {
            mState = newState;
        if ((state != mState) && (state != State.DISCONNECTED)) {
            mState = state;
            changed = true;
        } else if (state == State.DISCONNECTED) {
            changed = true;
        }

        if (VDBG) {
            Rlog.v(LOG_TAG, "update : " + mCallContext + " state: " + oldState + " --> " + mState);
        }

        return changed;
    }

+18 −12
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.util.ArrayMap;
import android.util.Log;
import android.util.Pair;

import com.android.ims.ImsCall;
@@ -90,6 +91,7 @@ import com.android.internal.telephony.gsm.SuppServiceNotification;
 */
public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    static final String LOG_TAG = "ImsPhoneCallTracker";
    static final String VERBOSE_STATE_TAG = "IPCTState";

    public interface PhoneStateListener {
        void onPhoneStateChanged(PhoneConstants.State oldState, PhoneConstants.State newState);
@@ -98,14 +100,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private static final boolean DBG = true;

    // When true, dumps the state of ImsPhoneCallTracker after changes to foreground and background
    // calls.  This is helpful for debugging.
    private static final boolean VERBOSE_STATE_LOGGING = false; /* stopship if true */

    /**
     * Shared preferences key used to track whether the user has been notified of the fact that a
     * video call has been handed over from WIFI to LTE.
     */
    public static final String NOTIFIED_HANDOVER_TO_LTE_KEY = "notified_handover_video_to_lte_key";
    // calls.  This is helpful for debugging.  It is also possible to enable this at runtime by
    // setting the IPCTState log tag to VERBOSE.
    private static final boolean FORCE_VERBOSE_STATE_LOGGING = false; /* stopship if true */
    private static final boolean VERBOSE_STATE_LOGGING = FORCE_VERBOSE_STATE_LOGGING ||
            Rlog.isLoggable(VERBOSE_STATE_TAG, Log.VERBOSE);

    //Indices map to ImsConfig.FeatureConstants
    private boolean[] mImsFeatureEnabled = {false, false, false, false, false, false};
@@ -905,10 +904,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    updatePhoneState() {
        PhoneConstants.State oldState = mState;

        boolean isPendingMOIdle = mPendingMO == null || !mPendingMO.getState().isAlive();

        if (mRingingCall.isRinging()) {
            mState = PhoneConstants.State.RINGING;
        } else if (mPendingMO != null ||
                !(mForegroundCall.isIdle() && mBackgroundCall.isIdle())) {
        } else if (!isPendingMOIdle || !mForegroundCall.isIdle() || !mBackgroundCall.isIdle()) {
            // There is a non-idle call, so we're off the hook.
            mState = PhoneConstants.State.OFFHOOK;
        } else {
            mState = PhoneConstants.State.IDLE;
@@ -922,7 +923,13 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    new AsyncResult(null, null, null));
        }

        if (DBG) log("updatePhoneState oldState=" + oldState + ", newState=" + mState);
        if (DBG) {
            log("updatePhoneState pendingMo = " + (mPendingMO == null ? "null"
                    : mPendingMO.getState()) + ", fg= " + mForegroundCall.getState() + "("
                    + mForegroundCall.getConnections().size() + "), bg= " + mBackgroundCall
                    .getState() + "(" + mBackgroundCall.getConnections().size() + ")");
            log("updatePhoneState oldState=" + oldState + ", newState=" + mState);
        }

        if (mState != oldState) {
            mPhone.notifyPhoneStateChanged();
@@ -1500,7 +1507,6 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        public void onCallTerminated(ImsCall imsCall, ImsReasonInfo reasonInfo) {
            if (DBG) log("onCallTerminated reasonCode=" + reasonInfo.getCode());

            ImsPhoneCall.State oldState = mForegroundCall.getState();
            int cause = getDisconnectCauseFromReasonInfo(reasonInfo);
            ImsPhoneConnection conn = findConnection(imsCall);
            if (DBG) log("cause = " + cause + " conn = " + conn);