diff options
author | Danny Baumann <dannybaumann@web.de> | 2014-11-13 14:28:53 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-12-15 04:43:19 -0800 |
commit | 9427c1ab15ce6a4c74dabbc63c52c28825a53128 (patch) | |
tree | d1421d2d46d89f66964704f97ba3b5e56edc4781 | |
parent | 39f4239dd85cf0dc8bc222b9656c098fb3b131d9 (diff) | |
download | frameworks_base-9427c1ab15ce6a4c74dabbc63c52c28825a53128.zip frameworks_base-9427c1ab15ce6a4c74dabbc63c52c28825a53128.tar.gz frameworks_base-9427c1ab15ce6a4c74dabbc63c52c28825a53128.tar.bz2 |
Proper supplementary service notification handling (1/5).
Change-Id: I4fa94d4ba68a1570d3f822be569ae124882c0e66
13 files changed, 375 insertions, 7 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 66e8b3e..36de974 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -260,8 +260,38 @@ public final class Call { */ public static final int PROPERTY_HIGH_DEF_AUDIO = 0x00000010; + /** + * Whether the call was forwarded from another party (GSM only) + * @hide + */ + public static final int PROPERTY_WAS_FORWARDED = 0x00000020; + + /** + * Whether the call is held remotely + * @hide + */ + public static final int PROPERTY_HELD_REMOTELY = 0x00000040; + + /** + * Whether the dialing state is waiting for the busy remote side + * @hide + */ + public static final int PROPERTY_DIALING_IS_WAITING = 0x00000080; + + /** + * Whether an additional call came in and was forwarded while the call was active + * @hide + */ + public static final int PROPERTY_ADDITIONAL_CALL_FORWARDED = 0x00000100; + + /** + * Whether incoming calls are barred at the remote side + * @hide + */ + public static final int PROPERTY_REMOTE_INCOMING_CALLS_BARRED = 0x00000200; + //****************************************************************************************** - // Next PROPERTY value: 0x00000020 + // Next PROPERTY value: 0x00000400 //****************************************************************************************** private final Uri mHandle; @@ -419,6 +449,22 @@ public final class Call { if (hasProperty(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) { builder.append(" PROPERTY_EMERGENCY_CALLBACK_MODE"); } + if (hasProperty(properties, PROPERTY_WAS_FORWARDED)) { + builder.append(" PROPERTY_WAS_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_HELD_REMOTELY)) { + builder.append(" PROPERTY_HELD_REMOTELY"); + } + if (hasProperty(properties, PROPERTY_DIALING_IS_WAITING)) { + builder.append(" PROPERTY_DIALING_IS_WAITING"); + } + if (hasProperty(properties, PROPERTY_ADDITIONAL_CALL_FORWARDED)) { + builder.append(" PROPERTY_ADDITIONAL_CALL_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_REMOTE_INCOMING_CALLS_BARRED)) { + builder.append(" PROPERTY_REMOTE_INCOMING_CALLS_BARRED"); + } + builder.append("]"); return builder.toString(); } diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index f6a6dcc..046e615 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -51,6 +51,8 @@ public abstract class Conference extends Conferenceable { public void onDestroyed(Conference conference) {} public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) {} + public void onConnectionPropertiesChanged( + Conference conference, int connectionProperties) {} public void onVideoStateChanged(Conference c, int videoState) { } public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {} public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {} @@ -70,6 +72,7 @@ public abstract class Conference extends Conferenceable { private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; private int mConnectionCapabilities; + private int mConnectionProperties; private String mDisconnectMessage; private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED; private StatusHints mStatusHints; @@ -180,6 +183,32 @@ public abstract class Conference extends Conferenceable { } /** + * Returns a bit mask of this conference's properties. See the {@code PROPERTY_*} constants + * in the {@link Connection} class. + * @hide + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + + /** + * Sets this conference's properties as a bit mask of the {@code PROPERTY_*} constants + * in the {@link Connection} class. + * + * @param connectionProperties The new connection properties. + * @hide + */ + public final void setConnectionProperties(int connectionProperties) { + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (Listener l : mListeners) { + l.onConnectionPropertiesChanged(this, mConnectionProperties); + } + } + } + + /** * @return The audio state of the conference, describing how its audio is currently * being routed by the system. This is {@code null} if this Conference * does not directly know about its audio state. @@ -600,9 +629,11 @@ public abstract class Conference extends Conferenceable { @Override public String toString() { return String.format(Locale.US, - "[State: %s,Capabilites: %s, VideoState: %s, VideoProvider: %s, ThisObject %s]", + "[State: %s, Capabilites: %s, Properties: %s, " + + "VideoState: %s, VideoProvider: %s, ThisObject %s]", Connection.stateToString(mState), Call.Details.capabilitiesToString(mConnectionCapabilities), + Call.Details.propertiesToString(mConnectionProperties), getVideoState(), getVideoProvider(), super.toString()); diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index f025955..1f3a906 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -277,6 +277,40 @@ public abstract class Connection extends Conferenceable { //********************************************************************************************** /** + * Whether the call was forwarded from another party (GSM only) + * @hide + */ + public static final int PROPERTY_WAS_FORWARDED = 0x00000001; + + /** + * Whether the call is held remotely + * @hide + */ + public static final int PROPERTY_HELD_REMOTELY = 0x00000002; + + /** + * Whether the dialing state is waiting for the busy remote side + * @hide + */ + public static final int PROPERTY_DIALING_IS_WAITING = 0x00000004; + + /** + * Whether an additional call came in and was forwarded while the call was active + * @hide + */ + public static final int PROPERTY_ADDITIONAL_CALL_FORWARDED = 0x00000008; + + /** + * Whether incoming calls are barred at the remote side + * @hide + */ + public static final int PROPERTY_REMOTE_INCOMING_CALLS_BARRED = 0x00000010; + + //****************************************************************************************** + // Next PROPERTY value: 0x00000020 + //****************************************************************************************** + + /** * Connection extra key used to store the last forwarded number associated with the current * connection. Used to communicate to the user interface that the connection was forwarded via * the specified number. @@ -352,7 +386,6 @@ public abstract class Connection extends Conferenceable { mConnectionCapabilities |= capability; } - public static String capabilitiesToString(int capabilities) { StringBuilder builder = new StringBuilder(); builder.append("[Capabilities:"); @@ -429,6 +462,72 @@ public abstract class Connection extends Conferenceable { return builder.toString(); } + /** + * Whether the given properties include the specified property. + * + * @param properties A property bit field. + * @param property The property to check properties for. + * @return Whether the specified property is present. + * @hide + */ + public static boolean hasProperty(int properties, int property) { + return (properties & property) != 0; + } + + /** + * Whether the properties of this {@code Connection} include the specified property. + * + * @param property The property to look for. + * @return Whether the specified property is present. + * @hide + */ + public boolean hasProperty(int property) { + return hasProperty(mConnectionProperties, property); + } + + /** + * Removes the specified property from the set of properties of this {@code Connection}. + * + * @param property The property to remove from the set. + * @hide + */ + public void removeProperty(int property) { + mConnectionProperties &= ~property; + } + + /** + * Adds the specified property to the set of propertes of this {@code Connection}. + * + * @param property The property to add to the set. + * @hide + */ + public void addProperty(int property) { + mConnectionProperties |= property; + } + + public static String propertiesToString(int properties) { + StringBuilder builder = new StringBuilder(); + builder.append("[Properties:"); + + if (hasProperty(properties, PROPERTY_WAS_FORWARDED)) { + builder.append(" PROPERTY_WAS_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_HELD_REMOTELY)) { + builder.append(" PROPERTY_HELD_REMOTELY"); + } + if (hasProperty(properties, PROPERTY_DIALING_IS_WAITING)) { + builder.append(" PROPERTY_DIALING_IS_WAITING"); + } + if (hasProperty(properties, PROPERTY_ADDITIONAL_CALL_FORWARDED)) { + builder.append(" PROPERTY_ADDITIONAL_CALL_FORWARDED"); + } + if (hasProperty(properties, PROPERTY_REMOTE_INCOMING_CALLS_BARRED)) { + builder.append(" PROPERTY_REMOTE_INCOMING_CALLS_BARRED"); + } + builder.append("]"); + return builder.toString(); + } + /** @hide */ public abstract static class Listener { public void onStateChanged(Connection c, int state) {} @@ -442,6 +541,7 @@ public abstract class Connection extends Conferenceable { public void onRingbackRequested(Connection c, boolean ringback) {} public void onDestroyed(Connection c) {} public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {} + public void onConnectionPropertiesChanged(Connection c, int properties) {} public void onVideoProviderChanged( Connection c, VideoProvider videoProvider) {} public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {} @@ -1109,6 +1209,7 @@ public abstract class Connection extends Conferenceable { private int mCallerDisplayNamePresentation; private boolean mRingbackRequested = false; private int mConnectionCapabilities; + private int mConnectionProperties; private VideoProvider mVideoProvider; private boolean mAudioModeIsVoip; private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; @@ -1333,6 +1434,14 @@ public abstract class Connection extends Conferenceable { } /** + * Returns the connection's properties, as a bit mask of the {@code PROPERTY_*} constants. + * @hide + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Sets the value of the {@link #getAddress()} property. * * @param address The new address. @@ -1529,6 +1638,22 @@ public abstract class Connection extends Conferenceable { } /** + * Sets the connection's properties as a bit mask of the {@code PROPERTY_*} constants. + * + * @param connectionProperties The new connection properties. + * @hide + */ + public final void setConnectionProperties(int connectionProperties) { + checkImmutable(); + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (Listener l : mListeners) { + l.onConnectionPropertiesChanged(this, mConnectionProperties); + } + } + } + + /** * Tears down the Connection object. */ public final void destroy() { diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 1560af8..9e4f9bb 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -455,6 +455,16 @@ public abstract class ConnectionService extends Service { } @Override + public void onConnectionPropertiesChanged( + Conference conference, + int connectionProperties) { + String id = mIdByConference.get(conference); + Log.d(this, "call properties: conference: %s", + Connection.propertiesToString(connectionProperties)); + mAdapter.setConnectionProperties(id, connectionProperties); + } + + @Override public void onVideoStateChanged(Conference c, int videoState) { String id = mIdByConference.get(c); Log.d(this, "onVideoStateChanged set video state %d", videoState); @@ -571,6 +581,14 @@ public abstract class ConnectionService extends Service { } @Override + public void onConnectionPropertiesChanged(Connection c, int properties) { + String id = mIdByConnection.get(c); + Log.d(this, "properties: parcelableconnection: %s", + Connection.propertiesToString(properties)); + mAdapter.setConnectionProperties(id, properties); + } + + @Override public void onVideoProviderChanged(Connection c, Connection.VideoProvider videoProvider) { String id = mIdByConnection.get(c); Log.d(this, "onVideoProviderChanged: Connection: %s, VideoProvider: %s", c, @@ -676,10 +694,11 @@ public abstract class ConnectionService extends Service { Uri address = connection.getAddress(); String number = address == null ? "null" : address.getSchemeSpecificPart(); - Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s", + Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s, properties: %s", Connection.toLogSafePhoneNumber(number), Connection.stateToString(connection.getState()), - Connection.capabilitiesToString(connection.getConnectionCapabilities())); + Connection.capabilitiesToString(connection.getConnectionCapabilities()), + Connection.propertiesToString(connection.getConnectionProperties())); Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId); mAdapter.handleCreateConnectionComplete( @@ -689,6 +708,7 @@ public abstract class ConnectionService extends Service { request.getAccountHandle(), connection.getState(), connection.getConnectionCapabilities(), + connection.getConnectionProperties(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), @@ -997,6 +1017,7 @@ public abstract class ConnectionService extends Service { conference.getPhoneAccountHandle(), conference.getState(), conference.getConnectionCapabilities(), + conference.getConnectionProperties(), connectionIds, conference.getVideoProvider() == null ? null : conference.getVideoProvider().getInterface(), @@ -1037,6 +1058,7 @@ public abstract class ConnectionService extends Service { phoneAccountHandle, connection.getState(), connection.getConnectionCapabilities(), + connection.getConnectionProperties(), connection.getAddress(), connection.getAddressPresentation(), connection.getCallerDisplayName(), diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 30bd373..f4bf835 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -196,6 +196,15 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } + void setConnectionProperties(String callId, int properties) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + adapter.setConnectionProperties(callId, properties); + } catch (RemoteException ignored) { + } + } + } + /** * Indicates whether or not the specified call is currently conferenced into the specified * conference call. diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index b8e7c22..f167fc1 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -62,6 +62,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_ON_POST_DIAL_CHAR = 22; private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; private static final int MSG_SET_EXTRAS = 24; + private static final int MSG_SET_CONNECTION_PROPERTIES = 25; private final IConnectionServiceAdapter mDelegate; @@ -116,6 +117,9 @@ final class ConnectionServiceAdapterServant { case MSG_SET_CONNECTION_CAPABILITIES: mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1); break; + case MSG_SET_CONNECTION_PROPERTIES: + mDelegate.setConnectionProperties((String) msg.obj, msg.arg1); + break; case MSG_SET_IS_CONFERENCED: { SomeArgs args = (SomeArgs) msg.obj; try { @@ -300,6 +304,13 @@ final class ConnectionServiceAdapterServant { } @Override + public void setConnectionProperties(String connectionId, int connectionProperties) { + mHandler.obtainMessage( + MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId) + .sendToTarget(); + } + + @Override public void setConferenceMergeFailed(String callId) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId; diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java index 870f5ee..8da5734 100644 --- a/telecomm/java/android/telecom/ParcelableConference.java +++ b/telecomm/java/android/telecom/ParcelableConference.java @@ -34,6 +34,7 @@ public final class ParcelableConference implements Parcelable { private PhoneAccountHandle mPhoneAccount; private int mState; private int mConnectionCapabilities; + private int mConnectionProperties; private List<String> mConnectionIds; private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; private final IVideoProvider mVideoProvider; @@ -45,6 +46,7 @@ public final class ParcelableConference implements Parcelable { PhoneAccountHandle phoneAccount, int state, int connectionCapabilities, + int connectionProperties, List<String> connectionIds, IVideoProvider videoProvider, int videoState, @@ -54,6 +56,7 @@ public final class ParcelableConference implements Parcelable { mPhoneAccount = phoneAccount; mState = state; mConnectionCapabilities = connectionCapabilities; + mConnectionProperties = connectionProperties; mConnectionIds = connectionIds; mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; mVideoProvider = videoProvider; @@ -72,6 +75,8 @@ public final class ParcelableConference implements Parcelable { .append(Connection.stateToString(mState)) .append(", capabilities: ") .append(Connection.capabilitiesToString(mConnectionCapabilities)) + .append(", properties: ") + .append(Connection.propertiesToString(mConnectionProperties)) .append(", connectTime: ") .append(mConnectTimeMillis) .append(", children: ") @@ -95,6 +100,10 @@ public final class ParcelableConference implements Parcelable { return mConnectionCapabilities; } + public int getConnectionProperties() { + return mConnectionProperties; + } + public List<String> getConnectionIds() { return mConnectionIds; } @@ -126,6 +135,7 @@ public final class ParcelableConference implements Parcelable { PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); int state = source.readInt(); int capabilities = source.readInt(); + int properties = source.readInt(); List<String> connectionIds = new ArrayList<>(2); source.readList(connectionIds, classLoader); long connectTimeMillis = source.readLong(); @@ -135,8 +145,9 @@ public final class ParcelableConference implements Parcelable { StatusHints statusHints = source.readParcelable(classLoader); Bundle extras = source.readBundle(classLoader); - return new ParcelableConference(phoneAccount, state, capabilities, connectionIds, - videoCallProvider, videoState, connectTimeMillis, statusHints, extras); + return new ParcelableConference(phoneAccount, state, capabilities, properties, + connectionIds, videoCallProvider, videoState, + connectTimeMillis, statusHints, extras); } @Override @@ -157,6 +168,7 @@ public final class ParcelableConference implements Parcelable { destination.writeParcelable(mPhoneAccount, 0); destination.writeInt(mState); destination.writeInt(mConnectionCapabilities); + destination.writeInt(mConnectionProperties); destination.writeList(mConnectionIds); destination.writeLong(mConnectTimeMillis); destination.writeStrongBinder( diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java index fe0a4d8..eca06af 100644 --- a/telecomm/java/android/telecom/ParcelableConnection.java +++ b/telecomm/java/android/telecom/ParcelableConnection.java @@ -36,6 +36,7 @@ public final class ParcelableConnection implements Parcelable { private final PhoneAccountHandle mPhoneAccount; private final int mState; private final int mConnectionCapabilities; + private final int mConnectionProperties; private final Uri mAddress; private final int mAddressPresentation; private final String mCallerDisplayName; @@ -55,6 +56,7 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount, int state, int capabilities, + int properties, Uri address, int addressPresentation, String callerDisplayName, @@ -71,6 +73,7 @@ public final class ParcelableConnection implements Parcelable { mPhoneAccount = phoneAccount; mState = state; mConnectionCapabilities = capabilities; + mConnectionProperties = properties; mAddress = address; mAddressPresentation = addressPresentation; mCallerDisplayName = callerDisplayName; @@ -99,6 +102,10 @@ public final class ParcelableConnection implements Parcelable { return mConnectionCapabilities; } + public int getConnectionProperties() { + return mConnectionProperties; + } + public Uri getHandle() { return mAddress; } @@ -160,6 +167,8 @@ public final class ParcelableConnection implements Parcelable { .append(mState) .append(", capabilities:") .append(Connection.capabilitiesToString(mConnectionCapabilities)) + .append(", properties:") + .append(Connection.propertiesToString(mConnectionProperties)) .append(", extras:") .append(mExtras) .toString(); @@ -174,6 +183,7 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); int state = source.readInt(); int capabilities = source.readInt(); + int properties = source.readInt(); Uri address = source.readParcelable(classLoader); int addressPresentation = source.readInt(); String callerDisplayName = source.readString(); @@ -194,6 +204,7 @@ public final class ParcelableConnection implements Parcelable { phoneAccount, state, capabilities, + properties, address, addressPresentation, callerDisplayName, @@ -227,6 +238,7 @@ public final class ParcelableConnection implements Parcelable { destination.writeParcelable(mPhoneAccount, 0); destination.writeInt(mState); destination.writeInt(mConnectionCapabilities); + destination.writeInt(mConnectionProperties); destination.writeParcelable(mAddress, 0); destination.writeInt(mAddressPresentation); destination.writeString(mCallerDisplayName); diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java index ae5cd46..bdce033 100644 --- a/telecomm/java/android/telecom/RemoteConference.java +++ b/telecomm/java/android/telecom/RemoteConference.java @@ -92,6 +92,17 @@ public final class RemoteConference { int connectionCapabilities) {} /** + * Indicates that the call properties of this {@code RemoteConference} have changed. + * See {@link #getConnectionProperties()}. + * + * @param conference The {@code RemoteConference} invoking this method. + * @param connectionProperties The new properties of the {@code RemoteConference}. + */ + public void onConnectionPropertiesChanged( + RemoteConference conference, + int connectionProperties) {} + + /** * Invoked when the set of {@link RemoteConnection}s which can be added to this conference * call have changed. * @@ -133,6 +144,7 @@ public final class RemoteConference { private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; private int mConnectionCapabilities; + private int mConnectionProperties; private Bundle mExtras; /** @hide */ @@ -243,6 +255,24 @@ public final class RemoteConference { } } + /** {@hide} */ + void setConnectionProperties(final int connectionProperties) { + if (mConnectionProperties != connectionProperties) { + mConnectionProperties = connectionProperties; + for (CallbackRecord<Callback> record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionPropertiesChanged( + conference, mConnectionProperties); + } + }); + } + } + } + /** @hide */ void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) { mConferenceableConnections.clear(); @@ -322,6 +352,16 @@ public final class RemoteConference { } /** + * Returns the properties of the conference. See {@code PROPERTY_*} constants in class + * {@link Connection} for valid values. + * + * @return A bitmask of the properties of the conference call. + */ + public final int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Obtain the extras associated with this {@code RemoteConnection}. * * @return The extras for this connection. diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index f960959..4371367 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -90,6 +90,18 @@ public final class RemoteConnection { int connectionCapabilities) {} /** + * Indicates that the call properties of this {@code RemoteConnection} have changed. + * See {@link #getConnectionProperties()}. + * + * @param connection The {@code RemoteConnection} invoking this method. + * @param connectionProperties The new properties of the {@code RemoteConnection}. + * @hide + */ + public void onConnectionPropertiesChanged( + RemoteConnection connection, + int connectionProperties) {} + + /** * Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a * pause character. This causes the post-dial signals to stop pending user confirmation. An * implementation should present this choice to the user and invoke @@ -577,6 +589,7 @@ public final class RemoteConnection { private boolean mRingbackRequested; private boolean mConnected; private int mConnectionCapabilities; + private int mConnectionProperties; private int mVideoState; private VideoProvider mVideoProvider; private boolean mIsVoipAudioMode; @@ -613,6 +626,7 @@ public final class RemoteConnection { mDisconnectCause = connection.getDisconnectCause(); mRingbackRequested = connection.isRingbackRequested(); mConnectionCapabilities = connection.getConnectionCapabilities(); + mConnectionProperties = connection.getConnectionProperties(); mVideoState = connection.getVideoState(); mVideoProvider = new RemoteConnection.VideoProvider(connection.getVideoProvider()); mIsVoipAudioMode = connection.getIsVoipAudioMode(); @@ -708,6 +722,15 @@ public final class RemoteConnection { } /** + * @return A bitmask of the properties of the {@code RemoteConnection}, as defined in + * the {@code PROPERTY_*} constants in class {@link Connection}. + * @hide + */ + public int getConnectionProperties() { + return mConnectionProperties; + } + + /** * Determines if the audio mode of this {@code RemoteConnection} is VOIP. * * @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP. @@ -1089,6 +1112,23 @@ public final class RemoteConnection { /** * @hide */ + void setConnectionProperties(final int connectionProperties) { + mConnectionProperties = connectionProperties; + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionPropertiesChanged(connection, connectionProperties); + } + }); + } + } + + /** + * @hide + */ void setDestroyed() { if (!mCallbackRecords.isEmpty()) { // Make sure that the callbacks are notified that the call is destroyed first. diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index 372d736..0045915 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -61,6 +61,7 @@ final class RemoteConnectionService { mPendingConnections.remove(connection); // Unconditionally initialize the connection ... connection.setConnectionCapabilities(parcel.getConnectionCapabilities()); + connection.setConnectionProperties(parcel.getConnectionProperties()); if (parcel.getHandle() != null || parcel.getState() != Connection.STATE_DISCONNECTED) { connection.setAddress(parcel.getHandle(), parcel.getHandlePresentation()); @@ -156,6 +157,17 @@ final class RemoteConnectionService { } @Override + public void setConnectionProperties(String callId, int connectionProperties) { + if (mConnectionById.containsKey(callId)) { + findConnectionForAction(callId, "setConnectionProperties") + .setConnectionProperties(connectionProperties); + } else { + findConferenceForAction(callId, "setConnectionProperties") + .setConnectionProperties(connectionProperties); + } + } + + @Override public void setIsConferenced(String callId, String conferenceCallId) { // Note: callId should not be null; conferenceCallId may be null RemoteConnection connection = @@ -206,6 +218,7 @@ final class RemoteConnectionService { conference.setState(parcel.getState()); conference.setConnectionCapabilities(parcel.getConnectionCapabilities()); + conference.setConnectionProperties(parcel.getConnectionProperties()); mConferenceById.put(callId, conference); conference.registerCallback(new RemoteConference.Callback() { @Override diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index ef4915c..1853f5a 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -55,6 +55,8 @@ oneway interface IConnectionServiceAdapter { void setConnectionCapabilities(String callId, int connectionCapabilities); + void setConnectionProperties(String callId, int connectionProperties); + void setIsConferenced(String callId, String conferenceCallId); void setConferenceMergeFailed(String callId); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6e371a45..3f0d5b2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -651,6 +651,11 @@ public class TelephonyManager { */ public static final String VVM_TYPE_CVVM = "vvm_type_cvvm"; + /* + * @hide + */ + public static final String EXTRA_IS_FORWARDED = "is_forwarded"; + // // // Device Info |