From 10798dcaff8ac060af5956906602c2c24f11aa09 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Fri, 8 Aug 2014 14:00:25 -0700 Subject: Add extras for outgoing call To be able to pass information from dialer to incallui, telecomm.Call needs to hold extra information. Add this extra bundle to the intent. Bug: 15284651 Change-Id: Ie462c35ece41647c7104c657cc1de947ff284729 --- telecomm/java/android/telecomm/Call.java | 22 ++++++++++++++++++---- telecomm/java/android/telecomm/ParcelableCall.java | 19 +++++++++++++++++-- .../java/android/telecomm/TelecommManager.java | 11 +++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) (limited to 'telecomm/java/android') diff --git a/telecomm/java/android/telecomm/Call.java b/telecomm/java/android/telecomm/Call.java index a292587..f988ac8 100644 --- a/telecomm/java/android/telecomm/Call.java +++ b/telecomm/java/android/telecomm/Call.java @@ -18,6 +18,7 @@ package android.telecomm; import android.app.PendingIntent; import android.net.Uri; +import android.os.Bundle; import android.telephony.DisconnectCause; import java.lang.String; @@ -91,6 +92,7 @@ public final class Call { private final GatewayInfo mGatewayInfo; private final int mVideoState; private final StatusHints mStatusHints; + private final Bundle mExtras; /** * @return The handle (e.g., phone number) to which the {@code Call} is currently @@ -186,6 +188,13 @@ public final class Call { return mStatusHints; } + /** + * @return A bundle extras to pass with the call + */ + public Bundle getExtras() { + return mExtras; + } + @Override public boolean equals(Object o) { if (o instanceof Details) { @@ -203,7 +212,8 @@ public final class Call { Objects.equals(mConnectTimeMillis, d.mConnectTimeMillis) && Objects.equals(mGatewayInfo, d.mGatewayInfo) && Objects.equals(mVideoState, d.mVideoState) && - Objects.equals(mStatusHints, d.mStatusHints); + Objects.equals(mStatusHints, d.mStatusHints) && + Objects.equals(mExtras, d.mExtras); } return false; } @@ -222,7 +232,8 @@ public final class Call { Objects.hashCode(mConnectTimeMillis) + Objects.hashCode(mGatewayInfo) + Objects.hashCode(mVideoState) + - Objects.hashCode(mStatusHints); + Objects.hashCode(mStatusHints) + + Objects.hashCode(mExtras); } /** {@hide} */ @@ -238,7 +249,8 @@ public final class Call { long connectTimeMillis, GatewayInfo gatewayInfo, int videoState, - StatusHints statusHints) { + StatusHints statusHints, + Bundle extras) { mHandle = handle; mHandlePresentation = handlePresentation; mCallerDisplayName = callerDisplayName; @@ -251,6 +263,7 @@ public final class Call { mGatewayInfo = gatewayInfo; mVideoState = videoState; mStatusHints = statusHints; + mExtras = extras; } } @@ -607,7 +620,8 @@ public final class Call { parcelableCall.getConnectTimeMillis(), parcelableCall.getGatewayInfo(), parcelableCall.getVideoState(), - parcelableCall.getStatusHints()); + parcelableCall.getStatusHints(), + parcelableCall.getExtras()); boolean detailsChanged = !Objects.equals(mDetails, details); if (detailsChanged) { mDetails = details; diff --git a/telecomm/java/android/telecomm/ParcelableCall.java b/telecomm/java/android/telecomm/ParcelableCall.java index 2a9a63a..8098b94 100644 --- a/telecomm/java/android/telecomm/ParcelableCall.java +++ b/telecomm/java/android/telecomm/ParcelableCall.java @@ -17,6 +17,7 @@ package android.telecomm; import android.net.Uri; +import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; @@ -53,6 +54,7 @@ public final class ParcelableCall implements Parcelable { private final StatusHints mStatusHints; private final int mVideoState; private final List mConferenceableCallIds; + private final Bundle mExtras; public ParcelableCall( String id, @@ -73,7 +75,8 @@ public final class ParcelableCall implements Parcelable { List childCallIds, StatusHints statusHints, int videoState, - List conferenceableCallIds) { + List conferenceableCallIds, + Bundle extras) { mId = id; mState = state; mDisconnectCauseCode = disconnectCauseCode; @@ -93,6 +96,7 @@ public final class ParcelableCall implements Parcelable { mStatusHints = statusHints; mVideoState = videoState; mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds); + mExtras = extras; } /** The unique ID of the call. */ @@ -220,6 +224,15 @@ public final class ParcelableCall implements Parcelable { return mVideoState; } + /** + * Any extras to pass with the call + * + * @return a bundle of extras + */ + public Bundle getExtras() { + return mExtras; + } + /** Responsible for creating ParcelableCall objects for deserialized Parcels. */ public static final Parcelable.Creator CREATOR = new Parcelable.Creator () { @@ -249,11 +262,12 @@ public final class ParcelableCall implements Parcelable { int videoState = source.readInt(); List conferenceableCallIds = new ArrayList<>(); source.readList(conferenceableCallIds, classLoader); + Bundle extras = source.readParcelable(classLoader); return new ParcelableCall(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses, capabilities, connectTimeMillis, handle, handlePresentation, callerDisplayName, callerDisplayNamePresentation, gatewayInfo, accountHandle, videoCallProvider, parentCallId, childCallIds, statusHints, - videoState, conferenceableCallIds); + videoState, conferenceableCallIds, extras); } @Override @@ -291,6 +305,7 @@ public final class ParcelableCall implements Parcelable { destination.writeParcelable(mStatusHints, 0); destination.writeInt(mVideoState); destination.writeList(mConferenceableCallIds); + destination.writeParcelable(mExtras, 0); } @Override diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java index 6d14fa8..5192b0f 100644 --- a/telecomm/java/android/telecomm/TelecommManager.java +++ b/telecomm/java/android/telecomm/TelecommManager.java @@ -101,6 +101,17 @@ public class TelecommManager { "android.intent.extra.INCOMING_CALL_EXTRAS"; /** + * Optional extra for {@link android.content.Intent#ACTION_CALL} and + * {@link android.content.Intent#ACTION_DIAL} {@code Intent} containing a {@link Bundle} + * which contains metadata about the call. This {@link Bundle} will be saved into + * {@code Call.Details}. + * + * @hide + */ + public static final String EXTRA_OUTGOING_CALL_EXTRAS = + "android.intent.extra.OUTGOING_CALL_EXTRAS"; + + /** * Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED} * containing the disconnect code. */ -- cgit v1.1