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

Commit abe5d249 authored by Daniel Bright's avatar Daniel Bright
Browse files

Added onCallInitiating

* Add onCallInitiating which occurs as the first event after a session
begins to be established.
* onCallInitiating clears mPendingMO and purposely does not trigger an
extra state change since the state should already be in Dialing
* Added checks that initiating is called before progressing and that
each of them are called only once

Bug: 161218980
Test: FrameworksTelephonyTests
Change-Id: I0f73dbe150d69d36c05f1dab7006572868a79ec1
parent 4e6f9a75
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2774,10 +2774,33 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private ImsCall.Listener mImsCallListener = new ImsCall.Listener() {
        boolean mOnCallInitiatingCalled = false;
        boolean mOnCallProgressingCalled = false;

        @Override
        public void onCallInitiating(ImsCall imsCall) {
            if (DBG) log("onCallInitiating");

            if (mOnCallInitiatingCalled) {
                throw new IllegalStateException("onCallInitiating cannot be called twice.");
            } else if (mOnCallProgressingCalled) {
                throw new IllegalStateException("onCallInitiating cannot be called after "
                        + "onCallProgressing has been called.");
            }
            mOnCallInitiatingCalled = true;

            mPendingMO = null;
            processCallStateChange(imsCall, ImsPhoneCall.State.DIALING,
                    DisconnectCause.NOT_DISCONNECTED, true);
            mMetrics.writeOnImsCallInitiating(mPhone.getPhoneId(), imsCall.getCallSession());
        }

        @Override
        public void onCallProgressing(ImsCall imsCall) {
            if (DBG) log("onCallProgressing");

            mOnCallProgressingCalled = true;

            mPendingMO = null;
            processCallStateChange(imsCall, ImsPhoneCall.State.ALERTING,
                    DisconnectCause.NOT_DISCONNECTED);
@@ -4200,6 +4223,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        Rlog.e(LOG_TAG, "[" + mPhone.getPhoneId() + "] " + msg);
    }

    void logw(String msg) {
        Rlog.w(LOG_TAG, "[" + mPhone.getPhoneId() + "] " + msg);
    }

    void logi(String msg) {
        Rlog.i(LOG_TAG, "[" + mPhone.getPhoneId() + "] " + msg);
    }
+1 −0
Original line number Diff line number Diff line
@@ -2782,6 +2782,7 @@ public class TelephonyMetrics {
    }

    //TODO: Expand the proto in the future
    public void writeOnImsCallInitiating(int phoneId, ImsCallSession session) {}
    public void writeOnImsCallProgressing(int phoneId, ImsCallSession session) {}
    public void writeOnImsCallStarted(int phoneId, ImsCallSession session) {}
    public void writeOnImsCallStartFailed(int phoneId, ImsCallSession session,