From 33aaae4a07fdcce223fe74d96d751f4bffa6723a Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Mon, 7 Jul 2014 22:49:44 -0700 Subject: [PATCH] Add Connection.setAudioModeIsVoip This API will be used by Telecomm to set the call's audio mode. Change-Id: I29028e614c598d1f2501c4dfdcdbfc929b09f925 --- api/current.txt | 4 ++++ telecomm/java/android/telecomm/Connection.java | 24 ++++++++++++++++++++++ .../java/android/telecomm/ConnectionService.java | 6 ++++++ .../android/telecomm/ConnectionServiceAdapter.java | 15 ++++++++++++++ .../java/android/telecomm/RemoteConnection.java | 14 +++++++++++++ .../android/telecomm/RemoteConnectionService.java | 8 ++++++++ .../telecomm/IConnectionServiceAdapter.aidl | 2 ++ 7 files changed, 73 insertions(+) diff --git a/api/current.txt b/api/current.txt index 352815e5c3a1..06b2cad393c6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -27626,6 +27626,7 @@ package android.telecomm { public abstract class Connection { ctor protected Connection(); + method public final boolean getAudioModeIsVoip(); method public final android.telecomm.CallAudioState getCallAudioState(); method public final java.util.List getChildConnections(); method public final int getFeatures(); @@ -27650,6 +27651,7 @@ package android.telecomm { method protected void onStopDtmfTone(); method protected void onUnhold(); method public final void setActive(); + method public final void setAudioModeIsVoip(boolean); method public final void setCallVideoProvider(android.telecomm.CallVideoProvider); method public final void setDestroyed(); method public final void setDialing(); @@ -27810,6 +27812,7 @@ package android.telecomm { method public void addListener(android.telecomm.RemoteConnection.Listener); method public void answer(); method public void disconnect(); + method public boolean getAudioModeIsVoip(); method public int getDisconnectCause(); method public java.lang.String getDisconnectMessage(); method public int getFeatures(); @@ -27830,6 +27833,7 @@ package android.telecomm { method public abstract void onFeaturesChanged(android.telecomm.RemoteConnection, int); method public abstract void onPostDialWait(android.telecomm.RemoteConnection, java.lang.String); method public abstract void onRequestingRingback(android.telecomm.RemoteConnection, boolean); + method public abstract void onSetAudioModeIsVoip(android.telecomm.RemoteConnection, boolean); method public abstract void onStateChanged(android.telecomm.RemoteConnection, int); } diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index c55e5abde20d..213c3c5c55d9 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -44,6 +44,7 @@ public abstract class Connection { void onConferenceCapableChanged(Connection c, boolean isConferenceCapable); void onParentConnectionChanged(Connection c, Connection parent); void onSetCallVideoProvider(Connection c, CallVideoProvider callVideoProvider); + void onSetAudioModeIsVoip(Connection c, boolean isVoip); } /** @hide */ @@ -81,6 +82,9 @@ public abstract class Connection { @Override public void onSetCallVideoProvider(Connection c, CallVideoProvider callVideoProvider) {} + + @Override + public void onSetAudioModeIsVoip(Connection c, boolean isVoip) {} } public final class State { @@ -104,6 +108,7 @@ public abstract class Connection { private boolean mRequestingRingback = false; private boolean mIsConferenceCapable = false; private Connection mParentConnection; + private boolean mAudioModeIsVoip; /** * Create a new Connection. @@ -165,6 +170,13 @@ public abstract class Connection { } /** + * @return True if the connection's audio mode is VOIP. + */ + public final boolean getAudioModeIsVoip() { + return mAudioModeIsVoip; + } + + /** * Assign a listener to be notified of state changes. * * @param l A listener. @@ -408,6 +420,18 @@ public abstract class Connection { } /** + * Requests that the framework use VOIP audio mode for this connection. + * + * @param isVoip True if the audio mode is VOIP. + */ + public final void setAudioModeIsVoip(boolean isVoip) { + mAudioModeIsVoip = isVoip; + for (Listener l : mListeners) { + l.onSetAudioModeIsVoip(this, isVoip); + } + } + + /** * Notifies this Connection and listeners that the {@link #getCallAudioState()} property * has a new value. * diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index 3b76395781b2..ba71c06320fd 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -364,6 +364,12 @@ public abstract class ConnectionService extends Service { String id = mIdByConnection.get(c); mAdapter.setCallVideoProvider(id, callVideoProvider); } + + @Override + public void onSetAudioModeIsVoip(Connection c, boolean isVoip) { + String id = mIdByConnection.get(c); + mAdapter.setAudioModeIsVoip(id, isVoip); + } }; /** {@inheritDoc} */ diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java index 1d21888cbe2b..8733316eaed5 100644 --- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java @@ -321,6 +321,21 @@ final class ConnectionServiceAdapter implements DeathRecipient { } /** + * Requests that the framework use VOIP audio mode for this connection. + * + * @param callId The unique ID of the call to set with the given call video provider. + * @param isVoip True if the audio mode is VOIP. + */ + void setAudioModeIsVoip(String callId, boolean isVoip) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + adapter.setAudioModeIsVoip(callId, isVoip); + } catch (RemoteException e) { + } + } + } + + /** * Set the features associated with the given call. * Features are defined in {@link android.telecomm.CallFeatures} and are passed in as a * bit-mask. diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java index 18df37d4863c..2213abef2002 100644 --- a/telecomm/java/android/telecomm/RemoteConnection.java +++ b/telecomm/java/android/telecomm/RemoteConnection.java @@ -37,6 +37,7 @@ public final class RemoteConnection { void onRequestingRingback(RemoteConnection connection, boolean ringback); void onPostDialWait(RemoteConnection connection, String remainingDigits); void onFeaturesChanged(RemoteConnection connection, int features); + void onSetAudioModeIsVoip(RemoteConnection connection, boolean isVoip); void onDestroyed(RemoteConnection connection); } @@ -50,6 +51,7 @@ public final class RemoteConnection { private boolean mRequestingRingback; private boolean mConnected; private int mFeatures; + private boolean mAudioModeIsVoip; /** * @hide @@ -85,6 +87,10 @@ public final class RemoteConnection { return mFeatures; } + public boolean getAudioModeIsVoip() { + return mAudioModeIsVoip; + } + public void abort() { try { if (mConnected) { @@ -252,4 +258,12 @@ public final class RemoteConnection { l.onFeaturesChanged(this, features); } } + + /** @hide */ + void setAudioModeIsVoip(boolean isVoip) { + mAudioModeIsVoip = isVoip; + for (Listener l : mListeners) { + l.onSetAudioModeIsVoip(this, isVoip); + } + } } diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java index 4f4941d41b5e..0b95f5294161 100644 --- a/telecomm/java/android/telecomm/RemoteConnectionService.java +++ b/telecomm/java/android/telecomm/RemoteConnectionService.java @@ -193,6 +193,14 @@ final class RemoteConnectionService implements DeathRecipient { mConnection.setFeatures(features); } } + + /** ${inheritDoc} */ + @Override + public final void setAudioModeIsVoip(String connectionId, boolean isVoip) { + if (isCurrentConnection(connectionId)) { + mConnection.setAudioModeIsVoip(isVoip); + } + } }; RemoteConnectionService(ComponentName componentName, IConnectionService connectionService) diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl index 9acc92094d6e..29f62b45cfad 100644 --- a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl @@ -64,4 +64,6 @@ oneway interface IConnectionServiceAdapter { void setCallVideoProvider(String callId, ICallVideoProvider callVideoProvider); void setFeatures(String callId, int features); + + void setAudioModeIsVoip(String callId, boolean isVoip); } -- 2.11.0