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

Commit 7a14b319 authored by Pengquan Meng's avatar Pengquan Meng Committed by Android (Google) Code Review
Browse files

Merge "[Telecom] Improve hold capability signal"

parents b8c621ab 70c98853
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1684,6 +1684,8 @@ public abstract class Connection extends Conferenceable {

    // The internal telecom call ID associated with this connection.
    private String mTelecomCallId;
    // The PhoneAccountHandle associated with this connection.
    private PhoneAccountHandle mPhoneAccountHandle;
    private int mState = STATE_NEW;
    private CallAudioState mCallAudioState;
    private Uri mAddress;
@@ -3098,6 +3100,27 @@ public abstract class Connection extends Conferenceable {
        }
    }

    /**
     * Sets the {@link PhoneAccountHandle} associated with this connection.
     *
     * @hide
     */
    public void setPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
        if (mPhoneAccountHandle != phoneAccountHandle) {
            mPhoneAccountHandle = phoneAccountHandle;
            notifyPhoneAccountChanged(phoneAccountHandle);
        }
    }

    /**
     * Returns the {@link PhoneAccountHandle} associated with this connection.
     *
     * @hide
     */
    public PhoneAccountHandle getPhoneAccountHandle() {
        return mPhoneAccountHandle;
    }

    /**
     * Sends an event associated with this {@code Connection} with associated event extras to the
     * {@link InCallService}.
+33 −3
Original line number Diff line number Diff line
@@ -1382,7 +1382,7 @@ public abstract class ConnectionService extends Service {

        connection.setTelecomCallId(callId);
        if (connection.getState() != Connection.STATE_DISCONNECTED) {
            addConnection(callId, connection);
            addConnection(request.getAccountHandle(), callId, connection);
        }

        Uri address = connection.getAddress();
@@ -1846,6 +1846,7 @@ public abstract class ConnectionService extends Service {
                    mAdapter.setIsConferenced(connectionId, id);
                }
            }
            onConferenceAdded(conference);
        }
    }

@@ -2055,6 +2056,30 @@ public abstract class ConnectionService extends Service {
     */
    public void onConference(Connection connection1, Connection connection2) {}

    /**
     * Called when a connection is added.
     * @hide
     */
    public void onConnectionAdded(Connection connection) {}

    /**
     * Called when a connection is removed.
     * @hide
     */
    public void onConnectionRemoved(Connection connection) {}

    /**
     * Called when a conference is added.
     * @hide
     */
    public void onConferenceAdded(Conference conference) {}

    /**
     * Called when a conference is removed.
     * @hide
     */
    public void onConferenceRemoved(Conference conference) {}

    /**
     * Indicates that a remote conference has been created for existing {@link RemoteConnection}s.
     * When this method is invoked, this {@link ConnectionService} should create its own
@@ -2122,16 +2147,18 @@ public abstract class ConnectionService extends Service {
            // prefix for a unique incremental call ID.
            id = handle.getComponentName().getClassName() + "@" + getNextCallId();
        }
        addConnection(id, connection);
        addConnection(handle, id, connection);
        return id;
    }

    private void addConnection(String callId, Connection connection) {
    private void addConnection(PhoneAccountHandle handle, String callId, Connection connection) {
        connection.setTelecomCallId(callId);
        mConnectionById.put(callId, connection);
        mIdByConnection.put(connection, callId);
        connection.addConnectionListener(mConnectionListener);
        connection.setConnectionService(this);
        connection.setPhoneAccountHandle(handle);
        onConnectionAdded(connection);
    }

    /** {@hide} */
@@ -2143,6 +2170,7 @@ public abstract class ConnectionService extends Service {
            mConnectionById.remove(id);
            mIdByConnection.remove(connection);
            mAdapter.removeCall(id);
            onConnectionRemoved(connection);
        }
    }

@@ -2179,6 +2207,8 @@ public abstract class ConnectionService extends Service {
            mConferenceById.remove(id);
            mIdByConference.remove(conference);
            mAdapter.removeCall(id);

            onConferenceRemoved(conference);
        }
    }