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

Commit 47b078c2 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add onDisconnect callback in root radio connection class.

From CDMA/GSM and IMS connections, notify listeners of the disconnects.
This is used as a replacement for the traditional phone.notifyDisconnect
method.  This ensures that a more reliable direct path is used to notify
of disconnects in the underlying connections.

Test: Manual
Bug: 70389936
Change-Id: Id1809bc9deb7675e94341664dc08707dc81b304c
parent ae466994
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public abstract class Connection {
        public void onConnectionEvent(String event, Bundle extras);
        public void onRttModifyRequestReceived();
        public void onRttModifyResponseReceived(int status);
        public void onDisconnect(int cause);
    }

    /**
@@ -143,6 +144,8 @@ public abstract class Connection {
        public void onRttModifyRequestReceived() {}
        @Override
        public void onRttModifyResponseReceived(int status) {}
        @Override
        public void onDisconnect(int cause) {}
    }

    public static final int AUDIO_QUALITY_STANDARD = 1;
@@ -1054,6 +1057,18 @@ public abstract class Connection {
        }
    }

    /**
     * Notify interested parties that this connection disconnected.
     * {@code TelephonyConnection}, for example, uses this.
     * @param reason the disconnect code, per {@link DisconnectCause}.
     */
    protected void notifyDisconnect(int reason) {
        Rlog.i(TAG, "notifyDisconnect: callId=" + getTelecomCallId() + ", reason=" + reason);
        for (Listener l : mListeners) {
            l.onDisconnect(reason);
        }
    }

    /**
     *
     */
+1 −0
Original line number Diff line number Diff line
@@ -583,6 +583,7 @@ public class GsmCdmaConnection extends Connection {
            if (DBG) Rlog.d(LOG_TAG, "onDisconnect: cause=" + cause);

            mOwner.getPhone().notifyDisconnect(this);
            notifyDisconnect(cause);

            if (mParent != null) {
                changed = mParent.connectionDisconnected(this);
+1 −0
Original line number Diff line number Diff line
@@ -428,6 +428,7 @@ public class ImsPhoneConnection extends Connection implements
            mDisconnected = true;

            mOwner.mPhone.notifyDisconnect(this);
            notifyDisconnect(mCause);

            if (mParent != null) {
                changed = mParent.connectionDisconnected(this);