diff options
Diffstat (limited to 'telecomm/java/android/telecom/Connection.java')
-rw-r--r-- | telecomm/java/android/telecom/Connection.java | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 69cc3dedf256..322970544281 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -23,7 +23,6 @@ import com.android.internal.telecom.IVideoProvider; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.annotation.TestApi; import android.app.Notification; import android.bluetooth.BluetoothDevice; import android.content.Intent; @@ -36,6 +35,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; +import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import android.util.ArraySet; @@ -400,14 +400,11 @@ public abstract class Connection extends Conferenceable { /** * Set by the framework to indicate that a connection has an active RTT session associated with * it. - * @hide */ - @TestApi public static final int PROPERTY_IS_RTT = 1 << 8; /** * Set by the framework to indicate that a connection is using assisted dialing. - * @hide */ public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; @@ -796,6 +793,10 @@ public abstract class Connection extends Conferenceable { builder.append(isLong ? " PROPERTY_HAS_CDMA_VOICE_PRIVACY" : " priv"); } + if (can(properties, PROPERTY_IS_RTT)) { + builder.append(isLong ? " PROPERTY_IS_RTT" : " rtt"); + } + builder.append("]"); return builder.toString(); } @@ -843,9 +844,7 @@ public abstract class Connection extends Conferenceable { /** * Provides methods to read and write RTT data to/from the in-call app. - * @hide */ - @TestApi public static final class RttTextStream { private static final int READ_BUFFER_SIZE = 1000; private final InputStreamReader mPipeFromInCall; @@ -1696,6 +1695,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; @@ -2547,6 +2548,19 @@ public abstract class Connection extends Conferenceable { } /** + * Adds a parcelable extra to this {@code Connection}. + * + * @param key The extra key. + * @param value The value. + * @hide + */ + public final void putExtra(@NonNull String key, @NonNull Parcelable value) { + Bundle newExtras = new Bundle(); + newExtras.putParcelable(key, value); + putExtras(newExtras); + } + + /** * Removes extras from this {@code Connection}. * * @param keys The keys of the extras to remove. @@ -2618,10 +2632,8 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a previously requested RTT session via * {@link ConnectionRequest#isRequestingRtt()} or - * {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)} has succeeded. - * @hide + * {@link #onStartRtt(RttTextStream)} has succeeded. */ - @TestApi public final void sendRttInitiationSuccess() { setRttProperty(); mListeners.forEach((l) -> l.onRttInitiationSuccess(Connection.this)); @@ -2629,14 +2641,11 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a previously requested RTT session via - * {@link ConnectionRequest#isRequestingRtt()} or - * {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)} + * {@link ConnectionRequest#isRequestingRtt()} or {@link #onStartRtt(RttTextStream)} * has failed. * @param reason One of the reason codes defined in {@link RttModifyStatus}, with the * exception of {@link RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}. - * @hide */ - @TestApi public final void sendRttInitiationFailure(int reason) { unsetRttProperty(); mListeners.forEach((l) -> l.onRttInitiationFailure(Connection.this, reason)); @@ -2645,19 +2654,16 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a currently active RTT session has been terminated by the remote * side of the coll. - * @hide */ - @TestApi public final void sendRttSessionRemotelyTerminated() { + unsetRttProperty(); mListeners.forEach((l) -> l.onRttSessionRemotelyTerminated(Connection.this)); } /** * Informs listeners that the remote side of the call has requested an upgrade to include an * RTT session in the call. - * @hide */ - @TestApi public final void sendRemoteRttRequest() { mListeners.forEach((l) -> l.onRemoteRttRequest(Connection.this)); } @@ -2856,7 +2862,7 @@ public abstract class Connection extends Conferenceable { * Notifies this {@link Connection} that a handover has completed. * <p> * A handover is initiated with {@link android.telecom.Call#handoverTo(PhoneAccountHandle, int, - * Bundle)} on the initiating side of the handover, and on the receiving side with + * Bundle)} on the initiating side of the handover, and * {@link TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle)}. */ public void onHandoverComplete() {} @@ -2931,17 +2937,13 @@ public abstract class Connection extends Conferenceable { * request, respectively. * @param rttTextStream The object that should be used to send text to or receive text from * the in-call app. - * @hide */ - @TestApi public void onStartRtt(@NonNull RttTextStream rttTextStream) {} /** * Notifies this {@link Connection} that it should terminate any existing RTT communication * channel. No response to Telecom is needed for this method. - * @hide */ - @TestApi public void onStopRtt() {} /** @@ -2949,11 +2951,9 @@ public abstract class Connection extends Conferenceable { * request sent via {@link #sendRemoteRttRequest}. Acceptance of the request is * indicated by the supplied {@link RttTextStream} being non-null, and rejection is * indicated by {@code rttTextStream} being {@code null} - * @hide * @param rttTextStream The object that should be used to send text to or receive text from * the in-call app. */ - @TestApi public void handleRttUpgradeResponse(@Nullable RttTextStream rttTextStream) {} /** @@ -3168,6 +3168,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}. * <p> |