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/java/android | |
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/java/android')
-rw-r--r-- | telecomm/java/android/telecomm/CallService.java | 34 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallServiceAdapter.java | 14 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallState.java | 8 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/InCallAdapter.java | 24 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/InCallService.java | 17 |
5 files changed, 96 insertions, 1 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); } |