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

Commit 1fc1c3f6 authored by Nivedita Sarkar's avatar Nivedita Sarkar
Browse files

Propagate the call substate changed message to the UI

Change-Id: I2e2b0dd5722ab9d340d10044ad52ba8fee2effe2
CRs-Fixed: 749824
parent fac995bf
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public final class Call {
        private final int mVideoState;
        private final StatusHints mStatusHints;
        private final Bundle mExtras;
        private final int mCallSubstate;

        /**
         * @return The handle (e.g., phone number) to which the {@code Call} is currently
@@ -212,6 +213,13 @@ public final class Call {
            return mExtras;
        }

        /**
         * @return The substate of the {@code Call}.
         */
        public int getCallSubstate() {
            return mCallSubstate;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Details) {
@@ -230,7 +238,8 @@ public final class Call {
                        Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
                        Objects.equals(mVideoState, d.mVideoState) &&
                        Objects.equals(mStatusHints, d.mStatusHints) &&
                        Objects.equals(mExtras, d.mExtras);
                        Objects.equals(mExtras, d.mExtras) &&
                        Objects.equals(mCallSubstate, d.mCallSubstate);
            }
            return false;
        }
@@ -250,7 +259,8 @@ public final class Call {
                    Objects.hashCode(mGatewayInfo) +
                    Objects.hashCode(mVideoState) +
                    Objects.hashCode(mStatusHints) +
                    Objects.hashCode(mExtras);
                    Objects.hashCode(mExtras) +
                    Objects.hashCode(mCallSubstate);
        }

        /** {@hide} */
@@ -267,7 +277,8 @@ public final class Call {
                GatewayInfo gatewayInfo,
                int videoState,
                StatusHints statusHints,
                Bundle extras) {
                Bundle extras,
                int callSubstate) {
            mHandle = handle;
            mHandlePresentation = handlePresentation;
            mCallerDisplayName = callerDisplayName;
@@ -281,6 +292,7 @@ public final class Call {
            mVideoState = videoState;
            mStatusHints = statusHints;
            mExtras = extras;
            mCallSubstate = callSubstate;
        }
    }

@@ -686,7 +698,8 @@ public final class Call {
                parcelableCall.getGatewayInfo(),
                parcelableCall.getVideoState(),
                parcelableCall.getStatusHints(),
                parcelableCall.getExtras());
                parcelableCall.getExtras(),
                parcelableCall.getCallSubstate());
        boolean detailsChanged = !Objects.equals(mDetails, details);
        if (detailsChanged) {
            mDetails = details;
+55 −0
Original line number Diff line number Diff line
@@ -63,6 +63,25 @@ public abstract class Connection {

    public static final int STATE_DISCONNECTED = 6;

    /**
     * Call substate bitmask values
     */

    /* Default case */
    public static final int CALL_SUBSTATE_NONE = 0;

    /* Indicates that the call is connected but audio attribute is suspended */
    public static final int CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED = 0x1;

    /* Indicates that the call is connected but video attribute is suspended */
    public static final int CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED = 0x2;

    /* Indicates that the call is established but media retry is needed */
    public static final int CALL_SUBSTATE_AVP_RETRY = 0x4;

    /* Indicates that the call is multitasking */
    public static final int CALL_SUBSTATE_MEDIA_PAUSED = 0x8;

    // Flag controlling whether PII is emitted into the logs
    private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);

@@ -87,6 +106,7 @@ public abstract class Connection {
                Connection c, List<Connection> conferenceableConnections) {}
        public void onConferenceChanged(Connection c, Conference conference) {}
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
        public void onCallSubstateChanged(Connection c, int substate) {}
    }

    /** @hide */
@@ -501,6 +521,7 @@ public abstract class Connection {
    private Conference mConference;
    private ConnectionService mConnectionService;
    private PhoneAccountHandle mPhoneAccountHandle = null;
    private int mCallSubstate;

    /**
     * Create a new Connection.
@@ -558,6 +579,21 @@ public abstract class Connection {
        return mVideoState;
    }

    /**
     * Returns the call substate of the call.
     * Valid values: {@link Connection#CALL_SUBSTATE_NONE},
     * {@link Connection#CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_AVP_RETRY},
     * {@link Connection#CALL_SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callSubstate The new call substate.
     * @hide
     */
    public final int getCallSubstate() {
        return mCallSubstate;
    }

    /**
     * @return The audio state of the call, describing how its audio is currently
     *         being routed by the system. This is {@code null} if this Connection
@@ -727,6 +763,25 @@ public abstract class Connection {
        }
    }

    /**
     * Set the call substate for the connection.
     * Valid values: {@link Connection#CALL_SUBSTATE_NONE},
     * {@link Connection#CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_AVP_RETRY},
     * {@link Connection#CALL_SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callSubstate The new call substate.
     * @hide
     */
    public final void setCallSubstate(int callSubstate) {
        Log.d(this, "setCallSubstate %d", callSubstate);
        mCallSubstate = callSubstate;
        for (Listener l : mListeners) {
            l.onCallSubstateChanged(this, mCallSubstate);
        }
    }

    /**
     * Sets state to active (e.g., an ongoing call where two or more parties can actively
     * communicate).
+9 −1
Original line number Diff line number Diff line
@@ -577,6 +577,13 @@ public abstract class ConnectionService extends Service {
            Log.i(this, "Adapter onPhoneAccountChanged %s, %s", c, pHandle);
            mAdapter.setPhoneAccountHandle(id, pHandle);
        }

        @Override
        public void onCallSubstateChanged(Connection c, int callSubstate) {
            String id = mIdByConnection.get(c);
            Log.d(this, "Adapter set call substate %d", callSubstate);
            mAdapter.setCallSubstate(id, callSubstate);
        }
    };

    /** {@inheritDoc} */
@@ -646,7 +653,8 @@ public abstract class ConnectionService extends Service {
                        connection.getAudioModeIsVoip(),
                        connection.getStatusHints(),
                        connection.getDisconnectCause(),
                        createConnectionIdList(connection.getConferenceableConnections())));
                        createConnectionIdList(connection.getConferenceableConnections()),
                        connection.getCallSubstate()));
    }

    /** @hide */
+22 −0
Original line number Diff line number Diff line
@@ -375,4 +375,26 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    /**
     * Set the call substate for the connection.
     * Valid values: {@link Connection#CALL_SUBSTATE_NONE},
     * {@link Connection#CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
     * {@link Connection#CALL_SUBSTATE_AVP_RETRY},
     * {@link Connection#CALL_SUBSTATE_MEDIA_PAUSED}.
     *
     * @param callId The unique ID of the call to set the substate for.
     * @param callSubstate The new call substate.
     * @hide
     */
    public final void setCallSubstate(String callId, int callSubstate) {
        Log.v(this, "setCallSubstate: %d", callSubstate);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setCallSubstate(callId, callSubstate);
            } catch (RemoteException ignored) {
            }
        }
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 21;
    private static final int MSG_SET_PHONE_ACCOUNT = 22;
    private static final int MSG_SET_CALL_SUBSTATE = 23;

    private final IConnectionServiceAdapter mDelegate;

@@ -222,6 +223,10 @@ final class ConnectionServiceAdapterServant {
                    }
                    break;
                }
                case MSG_SET_CALL_SUBSTATE: {
                    mDelegate.setCallSubstate((String) msg.obj, msg.arg1);
                    break;
                }
            }
        }
    };
@@ -390,6 +395,12 @@ final class ConnectionServiceAdapterServant {
            args.arg2 = pHandle;
            mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget();
        }

        @Override
        public void setCallSubstate(String connectionId, int callSubstate) {
            mHandler.obtainMessage(MSG_SET_CALL_SUBSTATE, callSubstate, 0,
                connectionId).sendToTarget();
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
Loading