diff options
author | Sailesh Nepal <sail@google.com> | 2014-05-14 19:36:26 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-14 19:36:26 +0000 |
commit | ece678e33aca03753b59d534e789e5f6075750a1 (patch) | |
tree | fb5bddcd19c25885d725a0ebba1abd9f9e2712ef | |
parent | 89997ad9918b9b15e7dfc022ce9230f67a1aa6e2 (diff) | |
parent | f27342bc5d594dfc32dc2bfafe109dcaa6b6d506 (diff) |
am b48e2280: InCallUI: Use Telecomm CallCapabilites
* commit 'b48e2280930b5ed0b04dd34d59dc5980b379a475':
InCallUI: Use Telecomm CallCapabilites
6 files changed, 30 insertions, 49 deletions
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<AnswerPresenter.AnswerUi> final List<String> 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 c78703250..9602d3cc4 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<CallButtonPresenter.CallButto Log.d(this, "Updating call UI for call: ", call); if (isEnabled) { - Log.v(this, "Show hold ", call.can(Capabilities.SUPPORT_HOLD)); - Log.v(this, "Enable hold", call.can(Capabilities.HOLD)); - Log.v(this, "Show merge ", call.can(Capabilities.MERGE_CALLS)); - Log.v(this, "Show swap ", call.can(Capabilities.SWAP_CALLS)); - Log.v(this, "Show add call ", call.can(Capabilities.ADD_CALL)); - Log.v(this, "Show mute ", call.can(Capabilities.MUTE)); + Log.v(this, "Show hold ", call.can(CallCapabilities.SUPPORT_HOLD)); + Log.v(this, "Enable hold", call.can(CallCapabilities.HOLD)); + Log.v(this, "Show merge ", call.can(CallCapabilities.MERGE_CALLS)); + Log.v(this, "Show swap ", call.can(CallCapabilities.SWAP_CALLS)); + Log.v(this, "Show add call ", call.can(CallCapabilities.ADD_CALL)); + Log.v(this, "Show mute ", call.can(CallCapabilities.MUTE)); - final boolean canMerge = call.can(Capabilities.MERGE_CALLS); - final boolean canAdd = call.can(Capabilities.ADD_CALL); - final boolean isGenericConference = call.can(Capabilities.GENERIC_CONFERENCE); + final boolean canMerge = call.can(CallCapabilities.MERGE_CALLS); + final boolean canAdd = call.can(CallCapabilities.ADD_CALL); + final boolean isGenericConference = call.can(CallCapabilities.GENERIC_CONFERENCE); final boolean showMerge = !isGenericConference && canMerge; @@ -282,9 +282,9 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto ui.enableAddCall(canAdd); } - final boolean canHold = call.can(Capabilities.HOLD); - final boolean canSwap = call.can(Capabilities.SWAP_CALLS); - final boolean supportHold = call.can(Capabilities.SUPPORT_HOLD); + final boolean canHold = call.can(CallCapabilities.HOLD); + final boolean canSwap = call.can(CallCapabilities.SWAP_CALLS); + final boolean supportHold = call.can(CallCapabilities.SUPPORT_HOLD); if (canHold) { ui.showHold(true); @@ -316,7 +316,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } } - ui.enableMute(call.can(Capabilities.MUTE)); + ui.enableMute(call.can(CallCapabilities.MUTE)); // Finally, update the "extra button row": It's displayed above the // "End" button, but only if necessary. Also, it's never displayed diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index eca4dbfc8..ab62af5be 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -23,13 +23,13 @@ import android.graphics.drawable.Drawable; import android.graphics.Bitmap; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; +import android.telecomm.CallCapabilities; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.text.format.DateUtils; import com.android.incallui.AudioModeProvider.AudioModeListener; -import com.android.incallui.Call.Capabilities; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallState; @@ -292,7 +292,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } 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); |