From edc625f52e5db5d0cb3d60387218f8f8365167f7 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 14 Apr 2015 13:38:12 -0700 Subject: Add StatusHints to Conference object. + Consolidated ParcelableConference constructors; only one is used. Bug: 20181703 Change-Id: Iad49f10404e1c1eedc4ef68525bde0f10a8dfc97 --- telecomm/java/android/telecom/Conference.java | 21 +++++++++++++++++ .../java/android/telecom/ConnectionService.java | 9 +++++++- .../java/android/telecom/ParcelableConference.java | 26 +++++++++++----------- 3 files changed, 42 insertions(+), 14 deletions(-) (limited to 'telecomm') diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 33bbb29..8c3b066 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -49,6 +49,7 @@ public abstract class Conference implements IConferenceable { public void onDestroyed(Conference conference) {} public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) {} + public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {} } private final Set mListeners = new CopyOnWriteArraySet<>(); @@ -66,6 +67,7 @@ public abstract class Conference implements IConferenceable { private int mConnectionCapabilities; private String mDisconnectMessage; private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED; + private StatusHints mStatusHints; private final Connection.Listener mConnectionDeathListener = new Connection.Listener() { @Override @@ -484,4 +486,23 @@ public abstract class Conference implements IConferenceable { } mConferenceableConnections.clear(); } + + /** + * Sets the label and icon status to display in the InCall UI. + * + * @param statusHints The status label and icon to set. + */ + public final void setStatusHints(StatusHints statusHints) { + mStatusHints = statusHints; + for (Listener l : mListeners) { + l.onStatusHintsChanged(this, statusHints); + } + } + + /** + * @return The status hints for this conference. + */ + public final StatusHints getStatusHints() { + return mStatusHints; + } } diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index dfdc3e1..6ec3fa3 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -415,6 +415,12 @@ public abstract class ConnectionService extends Service { Connection.capabilitiesToString(connectionCapabilities)); mAdapter.setConnectionCapabilities(id, connectionCapabilities); } + + @Override + public void onStatusHintsChanged(Conference conference, StatusHints statusHints) { + String id = mIdByConference.get(conference); + mAdapter.setStatusHints(id, statusHints); + } }; private final Connection.Listener mConnectionListener = new Connection.Listener() { @@ -884,7 +890,8 @@ public abstract class ConnectionService extends Service { conference.getState(), conference.getConnectionCapabilities(), connectionIds, - conference.getConnectTimeMillis()); + conference.getConnectTimeMillis(), + conference.getStatusHints()); mAdapter.addConferenceCall(id, parcelableConference); // Go through any child calls and set the parent. diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java index dcc2713..d127855 100644 --- a/telecomm/java/android/telecom/ParcelableConference.java +++ b/telecomm/java/android/telecom/ParcelableConference.java @@ -32,28 +32,22 @@ public final class ParcelableConference implements Parcelable { private int mState; private int mConnectionCapabilities; private List mConnectionIds; - private long mConnectTimeMillis; + private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; + private StatusHints mStatusHints; public ParcelableConference( PhoneAccountHandle phoneAccount, int state, int connectionCapabilities, - List connectionIds) { + List connectionIds, + long connectTimeMillis, + StatusHints statusHints) { mPhoneAccount = phoneAccount; mState = state; mConnectionCapabilities = connectionCapabilities; mConnectionIds = connectionIds; - mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; - } - - public ParcelableConference( - PhoneAccountHandle phoneAccount, - int state, - int connectionCapabilities, - List connectionIds, - long connectTimeMillis) { - this(phoneAccount, state, connectionCapabilities, connectionIds); mConnectTimeMillis = connectTimeMillis; + mStatusHints = statusHints; } @Override @@ -92,6 +86,10 @@ public final class ParcelableConference implements Parcelable { return mConnectTimeMillis; } + public StatusHints getStatusHints() { + return mStatusHints; + } + public static final Parcelable.Creator CREATOR = new Parcelable.Creator () { @Override @@ -103,9 +101,10 @@ public final class ParcelableConference implements Parcelable { List connectionIds = new ArrayList<>(2); source.readList(connectionIds, classLoader); long connectTimeMillis = source.readLong(); + StatusHints statusHints = source.readParcelable(classLoader); return new ParcelableConference(phoneAccount, state, capabilities, connectionIds, - connectTimeMillis); + connectTimeMillis, statusHints); } @Override @@ -128,5 +127,6 @@ public final class ParcelableConference implements Parcelable { destination.writeInt(mConnectionCapabilities); destination.writeList(mConnectionIds); destination.writeLong(mConnectTimeMillis); + destination.writeParcelable(mStatusHints, 0); } } -- cgit v1.1