diff options
author | Yorke Lee <yorkelee@google.com> | 2014-03-14 21:53:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-14 21:53:55 +0000 |
commit | d885b5c9b3405dbb0cd9487f41f8ccbe066253e2 (patch) | |
tree | 09118d87411f5ab92be5578dabfd0af40886b3cc /telecomm | |
parent | 4309121311fc252720d196518c37d422ee172d69 (diff) | |
parent | 81ccaaa25cc90c576c7df7c2cccb8a232e8536a1 (diff) | |
download | frameworks_base-d885b5c9b3405dbb0cd9487f41f8ccbe066253e2.zip frameworks_base-d885b5c9b3405dbb0cd9487f41f8ccbe066253e2.tar.gz frameworks_base-d885b5c9b3405dbb0cd9487f41f8ccbe066253e2.tar.bz2 |
Merge "Add hold support to frameworks/base/telecomm" into master-nova
Diffstat (limited to 'telecomm')
9 files changed, 142 insertions, 2 deletions
diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java index 52b2599..395bcc1 100644 --- a/telecomm/java/android/telecomm/CallService.java +++ b/telecomm/java/android/telecomm/CallService.java @@ -86,6 +86,12 @@ public abstract class CallService extends Service { case MSG_DISCONNECT: disconnect((String) msg.obj); break; + case MSG_HOLD: + hold((String) msg.obj); + break; + case MSG_UNHOLD: + unhold((String) msg.obj); + break; default: break; } @@ -139,6 +145,16 @@ public abstract class CallService extends Service { public void disconnect(String callId) { mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget(); } + + @Override + public void hold(String callId) { + mMessageHandler.obtainMessage(MSG_HOLD, callId).sendToTarget(); + } + + @Override + public void unhold(String callId) { + mMessageHandler.obtainMessage(MSG_UNHOLD, callId).sendToTarget(); + } } // Only used internally by this class. @@ -154,7 +170,9 @@ public abstract class CallService extends Service { MSG_SET_INCOMING_CALL_ID = 5, MSG_ANSWER = 6, MSG_REJECT = 7, - MSG_DISCONNECT = 8; + MSG_DISCONNECT = 8, + MSG_HOLD = 9, + MSG_UNHOLD = 10; /** * Message handler for consolidating binder callbacks onto a single thread. @@ -258,4 +276,18 @@ public abstract class CallService extends Service { * @param callId The ID of the call to disconnect. */ public abstract void disconnect(String callId); + + /** + * Puts the specified call on hold. + * + * @param callId The ID of the call to put on hold. + */ + public abstract void hold(String callId); + + /** + * Removes the specified call from hold. + * + * @param callId The ID of the call to unhold. + */ + public abstract void unhold(String callId); } diff --git a/telecomm/java/android/telecomm/CallServiceAdapter.java b/telecomm/java/android/telecomm/CallServiceAdapter.java index a391f34..0527a6d 100644 --- a/telecomm/java/android/telecomm/CallServiceAdapter.java +++ b/telecomm/java/android/telecomm/CallServiceAdapter.java @@ -140,4 +140,18 @@ public final class CallServiceAdapter { } catch (RemoteException e) { } } + + /** + * Sets a call's state to be on hold. + * + * @param callId - The unique ID of the call whose state is changing to be on hold. + */ + public void setOnHold(String callId) { + try { + mAdapter.setOnHold(callId); + } catch (RemoteException e) { + } + } + + } diff --git a/telecomm/java/android/telecomm/CallState.java b/telecomm/java/android/telecomm/CallState.java index d699fbd..3937b08 100644 --- a/telecomm/java/android/telecomm/CallState.java +++ b/telecomm/java/android/telecomm/CallState.java @@ -56,6 +56,14 @@ public enum CallState { ACTIVE, /** + * Indicates that the call is currently on hold. In this state, the call is not terminated + * but no communication is allowed until the call is no longer on hold. The typical transition + * to this state is by the user putting an {@link #ACTIVE} call on hold by explicitly performing + * an action, such as clicking the hold button. + */ + ON_HOLD, + + /** * Indicates that a call is currently disconnected. All states can transition to this state * by the call service giving notice that the connection has been severed. When the user * explicitly ends a call, it will not transition to this state until the call service confirms diff --git a/telecomm/java/android/telecomm/InCallAdapter.java b/telecomm/java/android/telecomm/InCallAdapter.java index c9bd8c2..6649ef7 100644 --- a/telecomm/java/android/telecomm/InCallAdapter.java +++ b/telecomm/java/android/telecomm/InCallAdapter.java @@ -78,4 +78,28 @@ public final class InCallAdapter { } catch (RemoteException e) { } } + + /** + * Instructs Telecomm to put the specified call on hold. + * + * @param callId The identifier of the call to put on hold. + */ + public void holdCall(String callId) { + try { + mAdapter.holdCall(callId); + } catch (RemoteException e) { + } + } + + /** + * Instructs Telecomm to release the specified call from hold. + * + * @param callId The identifier of the call to release from hold. + */ + public void unholdCall(String callId) { + try { + mAdapter.unholdCall(callId); + } catch (RemoteException e) { + } + } } diff --git a/telecomm/java/android/telecomm/InCallService.java b/telecomm/java/android/telecomm/InCallService.java index 7819d44..cd6a882 100644 --- a/telecomm/java/android/telecomm/InCallService.java +++ b/telecomm/java/android/telecomm/InCallService.java @@ -39,6 +39,7 @@ public abstract class InCallService extends Service { private static final int MSG_ADD_CALL = 2; private static final int MSG_SET_ACTIVE = 3; private static final int MSG_SET_DISCONNECTED = 4; + private static final int MSG_SET_HOLD = 5; /** Default Handler used to consolidate binder method calls onto a single thread. */ private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -58,6 +59,8 @@ public abstract class InCallService extends Service { case MSG_SET_DISCONNECTED: setDisconnected((String) msg.obj); break; + case MSG_SET_HOLD: + setOnHold((String) msg.obj); default: break; } @@ -89,6 +92,12 @@ public abstract class InCallService extends Service { public void setDisconnected(String callId) { mHandler.obtainMessage(MSG_SET_DISCONNECTED, callId).sendToTarget(); } + + /** {@inheritDoc} */ + @Override + public void setOnHold(String callId) { + mHandler.obtainMessage(MSG_SET_HOLD, callId).sendToTarget(); + } } private final InCallServiceBinder mBinder; @@ -136,4 +145,12 @@ public abstract class InCallService extends Service { * @param callId The identifier of the call that was disconnected. */ protected abstract void setDisconnected(String callId); + + /** + * Indicates to the in-call app that a call has been moved to the + * {@link android.telecomm.CallState#ON_HOLD} state and the user should be notified. + * + * @param callId The identifier of the call that was put on hold. + */ + protected abstract void setOnHold(String callId); } diff --git a/telecomm/java/com/android/internal/telecomm/ICallService.aidl b/telecomm/java/com/android/internal/telecomm/ICallService.aidl index 1df3f80..d05a3e0 100644 --- a/telecomm/java/com/android/internal/telecomm/ICallService.aidl +++ b/telecomm/java/com/android/internal/telecomm/ICallService.aidl @@ -39,7 +39,7 @@ oneway interface ICallService { /** * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls * and communicate state changes of existing calls. This is the first method that is called - * after a the framework binds to the call service. + * after the framework binds to the call service. * * @param callServiceAdapter Interface to CallsManager for adding and updating calls. */ @@ -120,4 +120,20 @@ oneway interface ICallService { * @param callId The identifier of the call to disconnect. */ void disconnect(String callId); + + /** + * Puts the call identified by callId on hold. Telecomm invokes this method when a call should + * be placed on hold per user request or because a different call was made active. + * + * @param callId The identifier of the call to put on hold. + */ + void hold(String callId); + + /** + * Removes the call identified by callId from hold. Telecomm invokes this method when a call + * should be removed on hold per user request or because a different call was put on hold. + * + * @param callId The identifier of the call to remove from hold. + */ + void unhold(String callId); } diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl index 7920b64..e96defe 100644 --- a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl @@ -91,4 +91,11 @@ oneway interface ICallServiceAdapter { * @param callId The unique ID of the call whose state is changing to disconnected. */ void setDisconnected(String callId); + + /** + * Sets a call's state to be on hold. + * + * @param callId The unique ID of the call whose state is changing to be on hold. + */ + void setOnHold(String callId); } diff --git a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl index d4e67fc..6ae055d 100644 --- a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl @@ -53,4 +53,18 @@ oneway interface IInCallAdapter { * @param callId The identifier of the call to disconnect. */ void disconnectCall(String callId); + + /** + * Instructs Telecomm to put the specified call on hold. + * + * @param callId The identifier of the call to put on hold. + */ + void holdCall(String callId); + + /** + * Instructs Telecomm to release the specified call from hold. + * + * @param callId The identifier of the call to release from hold. + */ + void unholdCall(String callId); } diff --git a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl index 05b0d20..b3bd0a6 100644 --- a/telecomm/java/com/android/internal/telecomm/IInCallService.aidl +++ b/telecomm/java/com/android/internal/telecomm/IInCallService.aidl @@ -66,4 +66,12 @@ oneway interface IInCallService { * @param callId The identifier of the call that was disconnected. */ void setDisconnected(String callId); + + /** + * Indicates to the in-call app that a call has been moved to the + * {@link android.telecomm.CallState#HOLD} state and the user should be notified. + * + * @param callId The identifier of the call that was put on hold. + */ + void setOnHold(String callId); } |