summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorIhab Awad <ihab@google.com>2014-12-01 16:29:38 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-01 16:29:38 +0000
commit58a658e73efced50b0204df1237f7f93c19b099a (patch)
treea3c8e142aa6e2f2eeac3f9a8d9a2039a2afe9291 /InCallUI
parent066172350c412c6b901538caf304c92d24355105 (diff)
parent91c8043c43dc2fe2655717c5a4c2ec660e33b96f (diff)
am 737f5676: Telecom API updates (3/6)
* commit '737f56760b617688aac7218021a5e615ed750810': Telecom API updates (3/6)
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/AnswerPresenter.java6
-rw-r--r--InCallUI/src/com/android/incallui/AudioModeProvider.java4
-rw-r--r--InCallUI/src/com/android/incallui/Call.java11
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java33
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java15
-rw-r--r--InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java24
-rw-r--r--InCallUI/src/com/android/incallui/ConferenceParticipantListAdapter.java11
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java11
-rw-r--r--InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java2
-rw-r--r--InCallUI/src/com/android/incallui/TelecomAdapter.java10
10 files changed, 64 insertions, 63 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index 8aa8615da..339850a13 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -16,8 +16,6 @@
package com.android.incallui;
-import android.telecom.PhoneCapabilities;
-import android.app.KeyguardManager;
import android.content.Context;
import java.util.List;
@@ -178,7 +176,9 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
final Context context = getUi().getContext();
mHasTextMessages = textMsgs != null;
- boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && mHasTextMessages;
+ boolean withSms =
+ call.can(android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT)
+ && mHasTextMessages;
if (call.isVideoCall(context)) {
if (withSms) {
getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS);
diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java
index de22ccb0e..c823fda3c 100644
--- a/InCallUI/src/com/android/incallui/AudioModeProvider.java
+++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java
@@ -40,8 +40,8 @@ import java.util.List;
private Phone.Listener mPhoneListener = new Phone.Listener() {
@Override
public void onAudioStateChanged(Phone phone, AudioState audioState) {
- onAudioModeChange(audioState.route, audioState.isMuted);
- onSupportedAudioModeChange(audioState.supportedRouteMask);
+ onAudioModeChange(audioState.getRoute(), audioState.isMuted());
+ onSupportedAudioModeChange(audioState.getSupportedRouteMask());
}
};
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 36f6f4e2a..663c4120a 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.net.Uri;
import android.telecom.CallProperties;
import android.telecom.DisconnectCause;
-import android.telecom.PhoneCapabilities;
import android.telecom.GatewayInfo;
import android.telecom.InCallService.VideoCall;
import android.telecom.PhoneAccountHandle;
@@ -316,15 +315,16 @@ public final class Call {
public boolean can(int capabilities) {
int supportedCapabilities = mTelecommCall.getDetails().getCallCapabilities();
- if ((capabilities & PhoneCapabilities.MERGE_CONFERENCE) != 0) {
+ if ((capabilities & android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE) != 0) {
// We allow you to merge if the capabilities allow it or if it is a call with
// conferenceable calls.
if (mTelecommCall.getConferenceableCalls().isEmpty() &&
- ((PhoneCapabilities.MERGE_CONFERENCE & supportedCapabilities) == 0)) {
+ ((android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE
+ & supportedCapabilities) == 0)) {
// Cannot merge calls if there are no calls to merge with.
return false;
}
- capabilities &= ~PhoneCapabilities.MERGE_CONFERENCE;
+ capabilities &= ~android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE;
}
return (capabilities == (capabilities & mTelecommCall.getDetails().getCallCapabilities()));
}
@@ -405,7 +405,8 @@ public final class Call {
"videoState:%d]",
mId,
State.toString(getState()),
- PhoneCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()),
+ android.telecom.Call.Details
+ .capabilitiesToString(mTelecommCall.getDetails().getCallCapabilities()),
mChildCallIds,
getParentId(),
this.mTelecommCall.getConferenceableCalls(),
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 8c3829403..9897d3744 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.os.Bundle;
import android.telecom.AudioState;
import android.telecom.InCallService.VideoCall;
-import android.telecom.PhoneCapabilities;
import android.telecom.VideoProfile;
import com.android.incallui.AudioModeProvider.AudioModeListener;
@@ -329,7 +328,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
updateCallButtons(call, ui.getContext());
- ui.enableMute(call.can(PhoneCapabilities.MUTE));
+ ui.enableMute(call.can(android.telecom.Call.Details.CAPABILITY_MUTE));
}
/**
@@ -365,8 +364,8 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
ui.showSwitchCameraButton(true);
ui.showPauseVideoButton(true);
- final boolean supportHold = call.can(PhoneCapabilities.SUPPORT_HOLD);
- final boolean enableHoldOption = call.can(PhoneCapabilities.HOLD);
+ final boolean supportHold = call.can(android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD);
+ final boolean enableHoldOption = call.can(android.telecom.Call.Details.CAPABILITY_HOLD);
ui.showHoldButton(supportHold);
ui.enableHold(enableHoldOption);
ui.setHold(call.getState() == Call.State.ONHOLD);
@@ -385,30 +384,34 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
ui.showAudioButton(true);
ui.showDialpadButton(true);
- Log.v(this, "Show hold ", call.can(PhoneCapabilities.SUPPORT_HOLD));
- Log.v(this, "Enable hold", call.can(PhoneCapabilities.HOLD));
- Log.v(this, "Show merge ", call.can(PhoneCapabilities.MERGE_CONFERENCE));
- Log.v(this, "Show swap ", call.can(PhoneCapabilities.SWAP_CONFERENCE));
+ Log.v(this, "Show hold ", call.can(android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD));
+ Log.v(this, "Enable hold", call.can(android.telecom.Call.Details.CAPABILITY_HOLD));
+ Log.v(this, "Show merge ", call.can(
+ android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE));
+ Log.v(this, "Show swap ", call.can(
+ android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE));
Log.v(this, "Show add call ", TelecomAdapter.getInstance().canAddCall());
- Log.v(this, "Show mute ", call.can(PhoneCapabilities.MUTE));
+ Log.v(this, "Show mute ", call.can(android.telecom.Call.Details.CAPABILITY_MUTE));
final boolean canAdd = TelecomAdapter.getInstance().canAddCall();
- final boolean enableHoldOption = call.can(PhoneCapabilities.HOLD);
- final boolean supportHold = call.can(PhoneCapabilities.SUPPORT_HOLD);
+ final boolean enableHoldOption = call.can(android.telecom.Call.Details.CAPABILITY_HOLD);
+ final boolean supportHold = call.can(android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD);
final boolean isCallOnHold = call.getState() == Call.State.ONHOLD;
- boolean canVideoCall = call.can(PhoneCapabilities.SUPPORTS_VT_LOCAL)
- && call.can(PhoneCapabilities.SUPPORTS_VT_REMOTE);
+ boolean canVideoCall = call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL)
+ && call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE);
ui.showChangeToVideoButton(canVideoCall);
ui.enableChangeToVideoButton(!isCallOnHold);
- final boolean showMergeOption = call.can(PhoneCapabilities.MERGE_CONFERENCE);
+ final boolean showMergeOption = call.can(
+ android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
final boolean showAddCallOption = canAdd;
// Show either HOLD or SWAP, but not both. If neither HOLD or SWAP is available:
// (1) If the device normally can hold, show HOLD in a disabled state.
// (2) If the device doesn't have the concept of hold/swap, remove the button.
- final boolean showSwapOption = call.can(PhoneCapabilities.SWAP_CONFERENCE);
+ final boolean showSwapOption = call.can(
+ android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE);
final boolean showHoldOption = !showSwapOption && (enableHoldOption || supportHold);
ui.setHold(isCallOnHold);
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index b66f41791..07feb2950 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -25,7 +25,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.telecom.DisconnectCause;
-import android.telecom.PhoneCapabilities;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
@@ -268,8 +267,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
public void onDetailsChanged(Call call, android.telecom.Call.Details details) {
updatePrimaryCallState();
- if (call.can(PhoneCapabilities.MANAGE_CONFERENCE) != PhoneCapabilities.can(
- details.getCallCapabilities(), PhoneCapabilities.MANAGE_CONFERENCE)) {
+ if (call.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) !=
+ android.telecom.Call.Details.can(
+ details.getCallCapabilities(),
+ android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE)) {
maybeShowManageConferenceCallButton();
}
}
@@ -322,7 +323,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return false;
}
- return mPrimary.can(PhoneCapabilities.MANAGE_CONFERENCE);
+ return mPrimary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE);
}
private void setCallbackNumber() {
@@ -702,7 +703,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
private String getConferenceString(Call call) {
- boolean isGenericConference = call.can(PhoneCapabilities.GENERIC_CONFERENCE);
+ boolean isGenericConference = call.can(
+ android.telecom.Call.Details.CAPABILITY_GENERIC_CONFERENCE);
Log.v(this, "getConferenceString: " + isGenericConference);
final int resId = isGenericConference
@@ -711,7 +713,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
private Drawable getConferencePhoto(Call call) {
- boolean isGenericConference = call.can(PhoneCapabilities.GENERIC_CONFERENCE);
+ boolean isGenericConference = call.can(
+ android.telecom.Call.Details.CAPABILITY_GENERIC_CONFERENCE);
Log.v(this, "getConferencePhoto: " + isGenericConference);
final int resId = isGenericConference
diff --git a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java
index 40c2dcdaf..5640ad7b5 100644
--- a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java
+++ b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java
@@ -17,11 +17,7 @@
package com.android.incallui;
import android.content.Context;
-import android.net.Uri;
-import android.telecom.PhoneCapabilities;
-import android.text.TextUtils;
-import com.android.incallui.ContactInfoCache.ContactCacheEntry;
import com.android.incallui.InCallPresenter.InCallDetailsListener;
import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
@@ -76,18 +72,20 @@ public class ConferenceManagerPresenter
@Override
public void onDetailsChanged(Call call, android.telecom.Call.Details details) {
- boolean canDisconnect = PhoneCapabilities.can(
- details.getCallCapabilities(), PhoneCapabilities.DISCONNECT_FROM_CONFERENCE);
- boolean canSeparate = PhoneCapabilities.can(
- details.getCallCapabilities(), PhoneCapabilities.SEPARATE_FROM_CONFERENCE);
-
- if (call.can(PhoneCapabilities.DISCONNECT_FROM_CONFERENCE) != canDisconnect
- || call.can(PhoneCapabilities.SEPARATE_FROM_CONFERENCE) != canSeparate) {
+ boolean canDisconnect = details.can(
+ android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE);
+ boolean canSeparate = details.can(
+ android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE);
+
+ if (call.can(android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE)
+ != canDisconnect
+ || call.can(android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE)
+ != canSeparate) {
getUi().refreshCall(call);
}
- if (!PhoneCapabilities.can(
- details.getCallCapabilities(), PhoneCapabilities.MANAGE_CONFERENCE)) {
+ if (!details.can(
+ android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE)) {
getUi().setVisible(false);
}
}
diff --git a/InCallUI/src/com/android/incallui/ConferenceParticipantListAdapter.java b/InCallUI/src/com/android/incallui/ConferenceParticipantListAdapter.java
index 641261e0f..0d5977210 100644
--- a/InCallUI/src/com/android/incallui/ConferenceParticipantListAdapter.java
+++ b/InCallUI/src/com/android/incallui/ConferenceParticipantListAdapter.java
@@ -18,7 +18,6 @@ package com.android.incallui;
import android.content.Context;
import android.net.Uri;
-import android.telecom.PhoneCapabilities;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,7 +41,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
/**
* Adapter for a ListView containing conference call participant information.
@@ -336,11 +334,10 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
new ContactLookupCallback(this));
}
- int callCapabilities = call.getTelecommCall().getDetails().getCallCapabilities();
- boolean thisRowCanSeparate = mParentCanSeparate && PhoneCapabilities.can(
- callCapabilities, PhoneCapabilities.SEPARATE_FROM_CONFERENCE);
- boolean thisRowCanDisconnect = PhoneCapabilities.can(
- callCapabilities, PhoneCapabilities.DISCONNECT_FROM_CONFERENCE);
+ boolean thisRowCanSeparate = mParentCanSeparate && call.getTelecommCall().getDetails().can(
+ android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE);
+ boolean thisRowCanDisconnect = call.getTelecommCall().getDetails().can(
+ android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE);
setCallerInfoForRow(result, contactCache.name, contactCache.number, contactCache.label,
contactCache.lookupKey, contactCache.displayPhotoUri, thisRowCanSeparate,
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 4432018f8..d48225c41 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -22,7 +22,6 @@ import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.telecom.DisconnectCause;
import android.telecom.PhoneAccount;
-import android.telecom.PhoneCapabilities;
import android.telecom.Phone;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -750,8 +749,10 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
if (activeCall != null) {
// TODO: This logic is repeated from CallButtonPresenter.java. We should
// consolidate this logic.
- final boolean canMerge = activeCall.can(PhoneCapabilities.MERGE_CONFERENCE);
- final boolean canSwap = activeCall.can(PhoneCapabilities.SWAP_CONFERENCE);
+ final boolean canMerge = activeCall.can(
+ android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
+ final boolean canSwap = activeCall.can(
+ android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE);
Log.v(this, "activeCall: " + activeCall + ", canMerge: " + canMerge +
", canSwap: " + canSwap);
@@ -773,7 +774,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
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(PhoneCapabilities.HOLD);
+ final boolean canHold = heldCall.can(android.telecom.Call.Details.CAPABILITY_HOLD);
Log.v(this, "heldCall: " + heldCall + ", canHold: " + canHold);
@@ -1168,7 +1169,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
Call call = CallList.getInstance().getFirstCall();
TelecomManager tm = getTelecomManager();
- int highlightColor = PhoneAccount.NO_COLOR;
+ int highlightColor = PhoneAccount.NO_HIGHLIGHT_COLOR;
if (call != null && tm != null && tm.hasMultipleCallCapableAccounts()) {
PhoneAccount account = tm.getPhoneAccount(call.getAccountHandle());
diff --git a/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java b/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
index ca4f9b7ec..1f61070ed 100644
--- a/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
+++ b/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
@@ -28,7 +28,7 @@ public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils {
*/
@Override
public MaterialPalette calculatePrimaryAndSecondaryColor(int color) {
- if (color == PhoneAccount.NO_COLOR) {
+ if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
return getDefaultPrimaryAndSecondaryColors(mResources);
}
diff --git a/InCallUI/src/com/android/incallui/TelecomAdapter.java b/InCallUI/src/com/android/incallui/TelecomAdapter.java
index 291466ded..373bd7874 100644
--- a/InCallUI/src/com/android/incallui/TelecomAdapter.java
+++ b/InCallUI/src/com/android/incallui/TelecomAdapter.java
@@ -24,8 +24,6 @@ import android.telecom.InCallAdapter;
import android.telecom.Phone;
import android.telecom.PhoneAccountHandle;
-import android.telecom.PhoneCapabilities;
-
import com.google.common.base.Preconditions;
import java.util.List;
@@ -165,8 +163,8 @@ final class TelecomAdapter implements InCallPhoneListener {
if (!conferenceable.isEmpty()) {
call.conference(conferenceable.get(0));
} else {
- int capabilities = call.getDetails().getCallCapabilities();
- if (0 != (capabilities & PhoneCapabilities.MERGE_CONFERENCE)) {
+ if (call.getDetails().can(
+ android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE)) {
call.mergeConference();
}
}
@@ -178,8 +176,8 @@ final class TelecomAdapter implements InCallPhoneListener {
void swap(String callId) {
if (mPhone != null) {
android.telecom.Call call = getTelecommCallById(callId);
- int capabilities = call.getDetails().getCallCapabilities();
- if (0 != (capabilities & PhoneCapabilities.SWAP_CONFERENCE)) {
+ if (call.getDetails().can(
+ android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE)) {
call.swapConference();
}
} else {