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

Commit cf3a2925 authored by Pavel Zhamaitsiak's avatar Pavel Zhamaitsiak
Browse files

Add missing null checks to ImsPhoneCallTracker

Also use CODE_LOCAL_ILLEGAL_STATE instead of CODE_UNSPECIFIED when
ImsManager is null.

Bug: 29386303
Change-Id: I9fcaecf033b9f3363fb849b2d64b9c2b8db20035
parent 9890dbca
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -810,6 +810,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    //***** Called from ImsPhone

    public void setUiTTYMode(int uiTtyMode, Message onComplete) {
        if (mImsManager == null) {
            mPhone.sendErrorResponse(onComplete, getImsManagerIsNullException());
            return;
        }

        try {
            mImsManager.setUiTTYMode(mPhone.getContext(), mServiceId, uiTtyMode, onComplete);
        } catch (ImsException e) {
@@ -992,6 +997,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                return;
            }

            if (mImsManager == null) {
                mPhone.sendErrorResponse(response, getImsManagerIsNullException());
                return;
            }

            String[] callees = new String[] { ussdString };
            ImsCallProfile profile = mImsManager.createCallProfile(mServiceId,
                    ImsCallProfile.SERVICE_TYPE_NORMAL, ImsCallProfile.CALL_TYPE_VOICE);
@@ -1861,7 +1871,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {

    public ImsUtInterface getUtInterface() throws ImsException {
        if (mImsManager == null) {
            throw new ImsException("no ims manager", ImsReasonInfo.CODE_UNSPECIFIED);
            throw getImsManagerIsNullException();
        }

        ImsUtInterface ut = mImsManager.getSupplementaryServiceConfiguration(mServiceId);
@@ -2053,7 +2063,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    /* package */
    ImsEcbm getEcbmInterface() throws ImsException {
        if (mImsManager == null) {
            throw new ImsException("no ims manager", ImsReasonInfo.CODE_UNSPECIFIED);
            throw getImsManagerIsNullException();
        }

        ImsEcbm ecbm = mImsManager.getEcbmInterface(mServiceId);
@@ -2063,7 +2073,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    /* package */
    ImsMultiEndpoint getMultiEndpointInterface() throws ImsException {
        if (mImsManager == null) {
            throw new ImsException("no ims manager", ImsReasonInfo.CODE_UNSPECIFIED);
            throw getImsManagerIsNullException();
        }

        try {
@@ -2204,4 +2214,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            loge("pullExternalCall failed - " + e);
        }
    }

    private ImsException getImsManagerIsNullException() {
        return new ImsException("no ims manager", ImsReasonInfo.CODE_LOCAL_ILLEGAL_STATE);
    }
}