Handoff: Implement handoff in Telecomm
See the following CLs for more info on how handoff is enabled and
triggered: changeid - I94c28b10c0e0a253450f14d31ecdc416d5b44ca4
Once a Call is handoff enabled it will have a non-null mHandoffHandle.
When handoff is triggered we create a new Call object and set
mOriginalCall.
At this point we have two call objects.
1st call: Call1
- mHandoffHandle: non-null
- mOriginalCall: null
2nd (invisible) call: Call2
- mHandoffHandle: null
- mOriginalCall: non-null
Once the new call's state changes to active we do the following:
call1.disconnect() // hangup on the old call
removeCall(call2) // stop tracking the new call
// merge into call1
call1.setCallService(call2.getCallService());
call1.setState(call2.State());
At this point call2 is deleted and call1 has been fully handed off.
Bug: 13643568
Change-Id: I94c28b10c0e0a253450f14d31ecdc416d5b44ca4
diff --git a/src/com/android/telecomm/InCallAdapter.java b/src/com/android/telecomm/InCallAdapter.java
index 14669c6..da7cf18 100644
--- a/src/com/android/telecomm/InCallAdapter.java
+++ b/src/com/android/telecomm/InCallAdapter.java
@@ -35,8 +35,9 @@
private static final int MSG_DISCONNECT_CALL = 5;
private static final int MSG_HOLD_CALL = 6;
private static final int MSG_UNHOLD_CALL = 7;
- private static final int MSG_MUTE = 8;
- private static final int MSG_SET_AUDIO_ROUTE = 9;
+ private static final int MSG_HANDOFF_CALL = 8;
+ private static final int MSG_MUTE = 9;
+ private static final int MSG_SET_AUDIO_ROUTE = 10;
private final class InCallAdapterHandler extends Handler {
@Override
@@ -75,6 +76,9 @@
case MSG_UNHOLD_CALL:
mCallsManager.unholdCall(call);
break;
+ case MSG_HANDOFF_CALL:
+ mCallsManager.startHandoffForCall(call);
+ break;
case MSG_MUTE:
mCallsManager.mute(msg.arg1 == 1 ? true : false);
break;
@@ -160,6 +164,13 @@
/** {@inheritDoc} */
@Override
+ public void handoffCall(String callId) {
+ mCallIdMapper.checkValidCallId(callId);
+ mHandler.obtainMessage(MSG_HANDOFF_CALL, callId).sendToTarget();
+ }
+
+ /** {@inheritDoc} */
+ @Override
public void mute(boolean shouldMute) {
mHandler.obtainMessage(MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget();
}