From e14843e2ce456ffca91ae83d0ccff722ca222e5d Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 17 Dec 2013 17:56:08 -0800 Subject: Add handoff buttons This CL adds two buttons to the in call UI: - video handoff - switch to video mode - connection handoff - switch between wifi and cell Change-Id: I42a36d22dc0a37d1ed00f1a3ab1ebcb53c35864c --- .../com/android/incallui/CallButtonFragment.java | 13 +++++++++++ .../com/android/incallui/CallButtonPresenter.java | 8 ++++++- .../src/com/android/incallui/CallCardFragment.java | 19 ++++++++++++++-- .../com/android/incallui/CallCardPresenter.java | 10 +++++++++ .../com/android/incallui/CallCommandClient.java | 25 ++++++++++++++++++++++ 5 files changed, 72 insertions(+), 3 deletions(-) (limited to 'InCallUI/src/com/android/incallui') diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index ed7690334..536680c5a 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -48,6 +48,8 @@ public class CallButtonFragment private ImageButton mMergeButton; private ImageButton mAddCallButton; private ImageButton mSwapButton; + private ImageButton mVideoHandoffButton; + private View mVideoHandoffSpacer; private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; @@ -141,6 +143,9 @@ public class CallButtonFragment mMergeButton.setOnClickListener(this); mSwapButton = (ImageButton) parent.findViewById(R.id.swapButton); mSwapButton.setOnClickListener(this); + mVideoHandoffButton = (ImageButton) parent.findViewById(R.id.videoHandoffButton); + mVideoHandoffButton.setOnClickListener(this); + mVideoHandoffSpacer = parent.findViewById(R.id.videoHandoffSpacer); return parent; } @@ -183,6 +188,9 @@ public class CallButtonFragment case R.id.dialpadButton: getPresenter().showDialpadClicked(mShowDialpadButton.isChecked()); break; + case R.id.videoHandoffButton: + getPresenter().videoHandoffClicked(); + break; default: Log.wtf(this, "onClick: unexpected"); break; @@ -526,6 +534,11 @@ public class CallButtonFragment } } + @Override + public void showVideoHandoff(boolean show) { + mVideoHandoffButton.setVisibility(show ? View.VISIBLE : View.GONE); + mVideoHandoffSpacer.setVisibility(show ? View.VISIBLE : View.GONE); + } @Override public void showManageConferenceCallButton() { diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 67a642b06..0a0330629 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -219,6 +219,10 @@ public class CallButtonPresenter extends Presenter } else { ui.setCallState(Call.State.IDLE, Call.DisconnectCause.UNKNOWN, false, null, null, null); } + + ui.setShowConnectionHandoff(mPrimary != null && mPrimary.can( + Capabilities.CONNECTION_HANDOFF)); } @Override @@ -469,6 +472,12 @@ public class CallCardPresenter extends Presenter CallCommandClient.getInstance().swap(); } + public void connectionHandoffClicked() { + if (mPrimary != null) { + CallCommandClient.getInstance().connectionHandoff(mPrimary.getCallId()); + } + } + public interface CallCardUi extends Ui { void setVisible(boolean on); void setPrimary(String number, String name, boolean nameIsNumber, String label, @@ -483,5 +492,6 @@ public class CallCardPresenter extends Presenter void setPrimaryImage(Drawable image); void setPrimaryPhoneNumber(String phoneNumber); void setPrimaryLabel(String label); + void setShowConnectionHandoff(boolean showConnectionHandoff); } } diff --git a/InCallUI/src/com/android/incallui/CallCommandClient.java b/InCallUI/src/com/android/incallui/CallCommandClient.java index 52d2100c8..234c518de 100644 --- a/InCallUI/src/com/android/incallui/CallCommandClient.java +++ b/InCallUI/src/com/android/incallui/CallCommandClient.java @@ -243,4 +243,29 @@ public class CallCommandClient { } } + public void videoHandoff(int callId) { + Log.i(this, "video handoff"); + if (mCommandService == null) { + Log.e(this, "Cannot perform video handoff; CallCommandService == null"); + return; + } + try { + mCommandService.videoHandoff(callId); + } catch (RemoteException e) { + Log.e(this, "Error performing video handoff.", e); + } + } + + public void connectionHandoff(int callId) { + Log.i(this, "connection handoff"); + if (mCommandService == null) { + Log.e(this, "Cannot perform connection handoff; CallCommandService == null"); + return; + } + try { + mCommandService.connectionHandoff(callId); + } catch (RemoteException e) { + Log.e(this, "Error performing connection handoff.", e); + } + } } -- cgit v1.2.3