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

Commit 450f9047 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Creating connections for conference event package participants." into lmp-mr1-dev

parents ba910dfa 4a57b9b5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -28093,6 +28093,7 @@ package android.telecom {
    method public final java.util.List<android.telecom.Connection> getConferenceableConnections();
    method public final java.util.List<android.telecom.Connection> getConnections();
    method public final android.telecom.PhoneAccountHandle getPhoneAccountHandle();
    method public android.telecom.Connection getPrimaryConnection();
    method public final int getState();
    method public void onAudioStateChanged(android.telecom.AudioState);
    method public void onDisconnect();
@@ -28182,6 +28183,7 @@ package android.telecom {
  public abstract class ConnectionService extends android.app.Service {
    ctor public ConnectionService();
    method public final void addConference(android.telecom.Conference);
    method public final void addExistingConnection(android.telecom.PhoneAccountHandle, android.telecom.Connection);
    method public final void conferenceRemoteConnections(android.telecom.RemoteConnection, android.telecom.RemoteConnection);
    method public final android.telecom.RemoteConnection createRemoteIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
    method public final android.telecom.RemoteConnection createRemoteOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
@@ -28191,6 +28193,7 @@ package android.telecom {
    method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
    method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
    method public void onRemoteConferenceAdded(android.telecom.RemoteConference);
    method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection);
    field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService";
  }
+13 −0
Original line number Diff line number Diff line
@@ -333,6 +333,19 @@ public abstract class Conference {
        return this;
    }

    /**
     * Retrieves the primary connection associated with the conference.  The primary connection is
     * the connection from which the conference will retrieve its current state.
     *
     * @return The primary connection.
     */
    public Connection getPrimaryConnection() {
        if (mUnmodifiableChildConnections == null || mUnmodifiableChildConnections.isEmpty()) {
            return null;
        }
        return mUnmodifiableChildConnections.get(0);
    }

    /**
     * Inform this Conference that the state of its audio output has been changed externally.
     *
+57 −0
Original line number Diff line number Diff line
@@ -821,6 +821,40 @@ public abstract class ConnectionService extends Service {
        }
    }

    /**
     * Adds a connection created by the {@link ConnectionService} and informs telecom of the new
     * connection.
     *
     * @param phoneAccountHandle The phone account handle for the connection.
     * @param connection The connection to add.
     */
    public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
            Connection connection) {

        String id = addExistingConnectionInternal(connection);
        if (id != null) {
            List<String> emptyList = new ArrayList<>(0);

            ParcelableConnection parcelableConnection = new ParcelableConnection(
                    phoneAccountHandle,
                    connection.getState(),
                    connection.getCallCapabilities(),
                    connection.getAddress(),
                    connection.getAddressPresentation(),
                    connection.getCallerDisplayName(),
                    connection.getCallerDisplayNamePresentation(),
                    connection.getVideoProvider() == null ?
                            null : connection.getVideoProvider().getInterface(),
                    connection.getVideoState(),
                    connection.isRingbackRequested(),
                    connection.getAudioModeIsVoip(),
                    connection.getStatusHints(),
                    connection.getDisconnectCause(),
                    emptyList);
            mAdapter.addExistingConnection(id, parcelableConnection);
        }
    }

    /**
     * Returns all the active {@code Connection}s for which this {@code ConnectionService}
     * has taken responsibility.
@@ -905,6 +939,12 @@ public abstract class ConnectionService extends Service {

    public void onRemoteConferenceAdded(RemoteConference conference) {}

    /**
     * Called when an existing connection is added remotely.
     * @param connection The existing connection which was added.
     */
    public void onRemoteExistingConnectionAdded(RemoteConnection connection) {}

    /**
     * @hide
     */
@@ -917,6 +957,11 @@ public abstract class ConnectionService extends Service {
        onRemoteConferenceAdded(remoteConference);
    }

    /** {@hide} */
    void addRemoteExistingConnection(RemoteConnection remoteConnection) {
        onRemoteExistingConnectionAdded(remoteConnection);
    }

    private void onAccountsInitialized() {
        mAreAccountsInitialized = true;
        for (Runnable r : mPreInitializationConnectionRequests) {
@@ -925,6 +970,18 @@ public abstract class ConnectionService extends Service {
        mPreInitializationConnectionRequests.clear();
    }

    /**
     * Adds an existing connection to the list of connections, identified by a new UUID.
     *
     * @param connection The connection.
     * @return The UUID of the connection (e.g. the call-id).
     */
    private String addExistingConnectionInternal(Connection connection) {
        String id = UUID.randomUUID().toString();
        addConnection(id, connection);
        return id;
    }

    private void addConnection(String callId, Connection connection) {
        mConnectionById.put(callId, connection);
        mIdByConnection.put(connection, callId);
+16 −0
Original line number Diff line number Diff line
@@ -344,4 +344,20 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    /**
     * Informs telecom of an existing connection which was added by the {@link ConnectionService}.
     *
     * @param callId The unique ID of the call being added.
     * @param connection The connection.
     */
    void addExistingConnection(String callId, ParcelableConnection connection) {
        Log.v(this, "addExistingConnection: %s", callId);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.addExistingConnection(callId, connection);
            } catch (RemoteException ignored) {
            }
        }
    }
}
+20 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_SET_ADDRESS = 18;
    private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_ADD_EXISTING_CONNECTION = 21;

    private final IConnectionServiceAdapter mDelegate;

@@ -199,6 +200,16 @@ final class ConnectionServiceAdapterServant {
                    }
                    break;
                }
                case MSG_ADD_EXISTING_CONNECTION: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        mDelegate.addExistingConnection(
                                (String) args.arg1, (ParcelableConnection) args.arg2);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
            }
        }
    };
@@ -345,6 +356,15 @@ final class ConnectionServiceAdapterServant {
            args.arg2 = conferenceableConnectionIds;
            mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
        }

        @Override
        public final void addExistingConnection(
                String connectionId, ParcelableConnection connection) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = connectionId;
            args.arg2 = connection;
            mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
Loading