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/InCallController.java b/src/com/android/telecomm/InCallController.java
index d975b0b..beac0d5 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.telecomm.CallAudioState;
@@ -136,6 +137,17 @@
}
@Override
+ public void onCallHandoffHandleChanged(Call call, Uri oldHandle, Uri newHandle) {
+ if (mInCallService != null) {
+ try {
+ mInCallService.setHandoffEnabled(mCallIdMapper.getCallId(call), newHandle != null);
+ } catch (RemoteException e) {
+ Log.e(this, e, "Exception attempting to call setHandoffEnabled.");
+ }
+ }
+ }
+
+ @Override
public void onAudioStateChanged(CallAudioState oldAudioState, CallAudioState newAudioState) {
if (mInCallService != null) {
Log.i(this, "Calling onAudioStateChanged, audioState: %s -> %s", oldAudioState,
@@ -207,6 +219,7 @@
if (!calls.isEmpty()) {
for (Call call : calls) {
onCallAdded(call);
+ onCallHandoffHandleChanged(call, null, call.getHandoffHandle());
}
onAudioStateChanged(null, CallsManager.getInstance().getAudioState());
} else {