From f27342bc5d594dfc32dc2bfafe109dcaa6b6d506 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Tue, 1 Apr 2014 14:50:40 -0700 Subject: InCallUI: Use Telecomm CallCapabilites Change-Id: I4236543da5648d2cf6ba525c8fc87a93000f50a7 --- .../src/com/android/incallui/AnswerPresenter.java | 4 +++- InCallUI/src/com/android/incallui/Call.java | 25 ++----------------- .../com/android/incallui/CallButtonPresenter.java | 28 +++++++++++----------- .../com/android/incallui/CallCardPresenter.java | 4 ++-- .../src/com/android/incallui/InCallPresenter.java | 15 ++++++------ .../com/android/incallui/InCallServiceImpl.java | 3 ++- 6 files changed, 30 insertions(+), 49 deletions(-) (limited to 'InCallUI/src/com/android') diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 44485e9a5..1488d6a4c 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -16,6 +16,8 @@ package com.android.incallui; +import android.telecomm.CallCapabilities; + import java.util.List; /** @@ -91,7 +93,7 @@ public class AnswerPresenter extends Presenter final List textMsgs = CallList.getInstance().getTextResponses(call.getCallId()); getUi().showAnswerUi(true); - if (call.can(Call.Capabilities.RESPOND_VIA_TEXT) && textMsgs != null) { + if (call.can(CallCapabilities.RESPOND_VIA_TEXT) && textMsgs != null) { getUi().showTextButton(true); getUi().configureMessageDialog(textMsgs); } else { diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 7dd357914..947cb37e8 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.telecomm.CallCapabilities; import android.telecomm.CallNumberPresentation; import android.telecomm.GatewayInfo; import android.telephony.DisconnectCause; @@ -101,28 +102,6 @@ public final class Call { } } - /** - * Defines a set of capabilities that a call can have as a bit mask. - * TODO: Should some of these be capabilities of the Phone instead of the call? - * TODO: This is starting to be a mix of capabilities and call properties. Capabilities - * and properties should be separated. - */ - public static class Capabilities { - public static final int HOLD = 0x00000001; /* has ability to hold the call */ - public static final int SUPPORT_HOLD = 0x00000002; /* can show the hold button */ - public static final int MERGE_CALLS = 0x00000004; /* has ability to merge calls */ - public static final int SWAP_CALLS = 0x00000008; /* swap with a background call */ - public static final int ADD_CALL = 0x00000010; /* add another call to this one */ - public static final int RESPOND_VIA_TEXT = 0x00000020; /* has respond via text option */ - public static final int MUTE = 0x00000040; /* can mute the call */ - public static final int GENERIC_CONFERENCE = 0x00000080; /* generic conference mode */ - public static final int VIDEO_HANDOFF = 0x00000100; /* handoff to video */ - public static final int CONNECTION_HANDOFF = 0x00000200; /* handoff between wifi and cell */ - - public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CALLS | SWAP_CALLS | ADD_CALL - | RESPOND_VIA_TEXT | MUTE | GENERIC_CONFERENCE | VIDEO_HANDOFF | CONNECTION_HANDOFF; - } - // Unique identifier for the call private String mCallId; @@ -201,7 +180,7 @@ public final class Call { } public void setCapabilities(int capabilities) { - mCapabilities = (Capabilities.ALL & capabilities); + mCapabilities = (CallCapabilities.ALL & capabilities); } public boolean can(int capabilities) { diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 7eabe7a18..555aab3a0 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -18,11 +18,11 @@ package com.android.incallui; import android.content.Context; import android.graphics.drawable.Drawable; +import android.telecomm.CallCapabilities; import com.android.contacts.common.util.PhoneNumberHelper; import com.android.contacts.common.util.TelephonyManagerUtils; import com.android.incallui.AudioModeProvider.AudioModeListener; -import com.android.incallui.Call.Capabilities; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; @@ -259,16 +259,16 @@ public class CallButtonPresenter extends Presenter } private static boolean isGenericConference(Call call) { - return call != null && call.can(Capabilities.GENERIC_CONFERENCE); + return call != null && call.can(CallCapabilities.GENERIC_CONFERENCE); } private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary, diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index a114d708e..ac6835367 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -16,13 +16,12 @@ package com.android.incallui; -import com.google.common.collect.Sets; -import com.google.common.base.Preconditions; - import android.content.Context; import android.content.Intent; +import android.telecomm.CallCapabilities; -import com.android.incallui.Call.Capabilities; +import com.google.common.base.Preconditions; +import com.google.common.collect.Sets; import com.google.common.collect.Lists; import java.util.ArrayList; @@ -492,9 +491,9 @@ public class InCallPresenter implements CallList.Listener { if (activeCall != null) { // TODO: This logic is repeated from CallButtonPresenter.java. We should // consolidate this logic. - final boolean isGeneric = activeCall.can(Capabilities.GENERIC_CONFERENCE); - final boolean canMerge = activeCall.can(Capabilities.MERGE_CALLS); - final boolean canSwap = activeCall.can(Capabilities.SWAP_CALLS); + final boolean isGeneric = activeCall.can(CallCapabilities.GENERIC_CONFERENCE); + final boolean canMerge = activeCall.can(CallCapabilities.MERGE_CALLS); + final boolean canSwap = activeCall.can(CallCapabilities.SWAP_CALLS); Log.v(this, "activeCall: " + activeCall + ", isGeneric: " + isGeneric + ", canMerge: " + canMerge + ", canSwap: " + canSwap); @@ -524,7 +523,7 @@ public class InCallPresenter implements CallList.Listener { if (heldCall != null) { // We have a hold call so presumeable it will always support HOLD...but // there is no harm in double checking. - final boolean canHold = heldCall.can(Capabilities.HOLD); + final boolean canHold = heldCall.can(CallCapabilities.HOLD); Log.v(this, "heldCall: " + heldCall + ", canHold: " + canHold); diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index 6b9d9b152..5ea3c47f8 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -17,6 +17,7 @@ package com.android.incallui; import android.telecomm.CallAudioState; +import android.telecomm.CallCapabilities; import android.telecomm.CallInfo; import android.telecomm.GatewayInfo; import android.telecomm.InCallAdapter; @@ -83,7 +84,7 @@ public class InCallServiceImpl extends android.telecomm.InCallService { } call.setGatewayInfo(callInfo.getGatewayInfo()); - call.addCapabilities(Call.Capabilities.HOLD | Call.Capabilities.MUTE); + call.addCapabilities(CallCapabilities.HOLD | CallCapabilities.MUTE); if (call.getState() == Call.State.INCOMING) { CallList.getInstance().onIncoming(call, EMPTY_RESPONSE_TEXTS); -- cgit v1.2.3