From 46f7f5dce42d645353a0f3eb0dbdd25b3a6c72fb Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 6 Nov 2014 17:00:25 -0800 Subject: [PATCH] Replace onConferenceChanged with onConnectionAdded. This change is motivated by a desire to be able to adjust the phone capabilities of a conference depending on its connections. Turns out Connection is not a good place to do this, because when the conference is set, this code is only fired if the connection service already contains the conference. Conference makes more sense to do this anyways, at the end of the day. + Add onConnectionAdded function to Conference.java. - Remove onConferenceChanged function from Connection.java. Bug: 18241753 Change-Id: Ib9212a8483a7a7b542618697399bbab8b2701b04 --- api/current.txt | 2 +- telecomm/java/android/telecom/Conference.java | 8 ++++++++ telecomm/java/android/telecom/Connection.java | 7 ------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 8b577dd9afd16..d5a84ae71fba0 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28115,6 +28115,7 @@ package android.telecom { method public android.telecom.Connection getPrimaryConnection(); method public final int getState(); method public void onAudioStateChanged(android.telecom.AudioState); + method public void onConnectionAdded(android.telecom.Connection); method public void onDisconnect(); method public void onHold(); method public void onMerge(android.telecom.Connection); @@ -28153,7 +28154,6 @@ package android.telecom { method public void onAbort(); method public void onAnswer(); method public void onAudioStateChanged(android.telecom.AudioState); - method public void onConferenceChanged(); method public void onDisconnect(); method public void onHold(); method public void onPlayDtmfTone(char); diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 6480a8a19c2d6..32bdbe027f425 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -178,6 +178,13 @@ public abstract class Conference { */ public void onAudioStateChanged(AudioState state) {} + /** + * Notifies this conference that a connection has been added to it. + * + * @param connection The newly added connection. + */ + public void onConnectionAdded(Connection connection) {} + /** * Sets state to be on hold. */ @@ -238,6 +245,7 @@ public abstract class Conference { if (connection != null && !mChildConnections.contains(connection)) { if (connection.setConference(this)) { mChildConnections.add(connection); + onConnectionAdded(connection); for (Listener l : mListeners) { l.onConnectionAdded(this, connection); } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 34d066044345f..4135ec3595c29 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -921,7 +921,6 @@ public abstract class Connection { mConference = conference; if (mConnectionService != null && mConnectionService.containsConference(conference)) { fireConferenceChanged(); - onConferenceChanged(); } return true; } @@ -937,7 +936,6 @@ public abstract class Connection { Log.d(this, "Conference reset"); mConference = null; fireConferenceChanged(); - onConferenceChanged(); } } @@ -1030,11 +1028,6 @@ public abstract class Connection { */ public void onPostDialContinue(boolean proceed) {} - /** - * Notifies this Connection that the conference which is set on it has changed. - */ - public void onConferenceChanged() {} - static String toLogSafePhoneNumber(String number) { // For unknown number, log empty string. if (number == null) {