summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIhab Awad <ihab@google.com>2014-11-13 09:35:03 -0800
committerDivya Sharma <c_shard@codeaurora.org>2015-03-10 03:42:32 -0700
commit616a44cbdfda78ed7a52066c7de342d63062799f (patch)
treee495b7b01d5af7c0428959fbb5e36166a0d509d1
parent16ac4886ef0186a53fe0101c0d54a87d61bb7501 (diff)
downloadpackages_apps_InCallUI-616a44cbdfda78ed7a52066c7de342d63062799f.tar.gz
packages_apps_InCallUI-616a44cbdfda78ed7a52066c7de342d63062799f.tar.bz2
packages_apps_InCallUI-616a44cbdfda78ed7a52066c7de342d63062799f.zip
Telecom API updates (3/6)
Bug: 18292176 Conflicts: src/com/android/incallui/Call.java src/com/android/incallui/CallButtonPresenter.java src/com/android/incallui/CallCardPresenter.java src/com/android/incallui/InCallPresenter.java src/com/android/incallui/InCallUIMaterialColorMapUtils.java Change-Id: I6dae81a4eb23b1e98d3769d6f991ed8840aa7c33
-rw-r--r--src/com/android/incallui/AnswerPresenter.java8
-rw-r--r--src/com/android/incallui/AudioModeProvider.java4
-rw-r--r--src/com/android/incallui/Call.java14
-rw-r--r--src/com/android/incallui/CallButtonPresenter.java41
-rw-r--r--src/com/android/incallui/CallCardPresenter.java16
-rw-r--r--src/com/android/incallui/ConferenceManagerPresenter.java24
-rw-r--r--src/com/android/incallui/ConferenceParticipantListAdapter.java11
-rw-r--r--src/com/android/incallui/InCallPresenter.java10
-rw-r--r--src/com/android/incallui/TelecomAdapter.java10
9 files changed, 70 insertions, 68 deletions
diff --git a/src/com/android/incallui/AnswerPresenter.java b/src/com/android/incallui/AnswerPresenter.java
index 6dbdd694..ebe997c3 100644
--- a/src/com/android/incallui/AnswerPresenter.java
+++ b/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 android.os.SystemProperties;
import android.telecom.VideoProfile;
@@ -345,7 +343,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);
@@ -382,7 +382,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
call.getId());
getUi().showAnswerUi(true);
- boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && textMsgs != null;
+ boolean withSms = call.can(android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT) && textMsgs != null;
if (call.isVideoCall(getUi().getContext())) {
if (withSms) {
getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS);
diff --git a/src/com/android/incallui/AudioModeProvider.java b/src/com/android/incallui/AudioModeProvider.java
index de22ccb0..c823fda3 100644
--- a/src/com/android/incallui/AudioModeProvider.java
+++ b/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/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java
index 70a223e2..00348ff8 100644
--- a/src/com/android/incallui/Call.java
+++ b/src/com/android/incallui/Call.java
@@ -24,7 +24,6 @@ import android.hardware.camera2.CameraCharacteristics;
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;
@@ -387,7 +386,7 @@ 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 (CallList.getInstance().isDsdaEnabled()) {
@@ -407,16 +406,18 @@ public final class Call {
}
}
if (!hasConfenceableCall &&
- ((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;
}
} else 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()));
}
@@ -564,7 +565,8 @@ public final class Call {
+ "VideoSettings:%s]",
mId,
State.toString(getState()),
- PhoneCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()),
+ android.telecom.Call.Details
+ .capabilitiesToString(mTelecommCall.getDetails().getCallCapabilities()),
mChildCallIds,
getParentId(),
mTelecommCall.getDetails().getVideoState(), mIsActiveSub,
diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java
index 06aaa7ca..8a1c750a 100644
--- a/src/com/android/incallui/CallButtonPresenter.java
+++ b/src/com/android/incallui/CallButtonPresenter.java
@@ -20,7 +20,6 @@ import android.app.AlertDialog;
import android.content.Context;
import android.telecom.AudioState;
import android.telecom.InCallService.VideoCall;
-import android.telecom.PhoneCapabilities;
import android.telecom.VideoProfile;
import com.android.incallui.AudioModeProvider.AudioModeListener;
@@ -351,7 +350,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));
}
private static int toInteger(boolean b) {
@@ -395,34 +394,38 @@ 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 video call local:", call.can(PhoneCapabilities.SUPPORTS_VT_LOCAL)
- + " remote: " + call.can(PhoneCapabilities.SUPPORTS_VT_REMOTE));
+ Log.v(this, "Show mute ", call.can(android.telecom.Call.Details.CAPABILITY_MUTE));
+ Log.v(this, "Show video call local:", call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL)
+ + " remote: " + call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE));
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);
- boolean canVideoCall = call.can(PhoneCapabilities.SUPPORTS_VT_LOCAL)
- && call.can(PhoneCapabilities.SUPPORTS_VT_REMOTE)
- && call.can(PhoneCapabilities.CALL_TYPE_MODIFIABLE);
+ boolean canVideoCall = call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL)
+ && call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE)
+ && call.can(android.telecom.Call.Details.CAPABILITY_CALL_TYPE_MODIFIABLE);
ui.showChangeToVideoButton(canVideoCall);
- final boolean showMergeOption = call.can(PhoneCapabilities.MERGE_CONFERENCE);
+ final boolean showMergeOption = call.can(
+ android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
final boolean showAddCallOption = canAdd;
- final boolean showAddParticipantOption = call.can(PhoneCapabilities.ADD_PARTICIPANT);
+ final boolean showAddParticipantOption = call.can(android.telecom.Call.Details.CAPABILITY_ADD_PARTICIPANT);
final boolean showManageVideoCallConferenceOption = call.can(
- PhoneCapabilities.MANAGE_CONFERENCE) && CallUtils.isVideoCall(call);
+ android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) && CallUtils.isVideoCall(call);
// 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(call.getState() == Call.State.ONHOLD);
@@ -435,7 +438,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
buttonCount += toInteger(showAddParticipantOption);
buttonCount += toInteger(showHoldOption);
buttonCount += toInteger(showSwapOption);
- buttonCount += toInteger(call.can(PhoneCapabilities.MUTE));
+ buttonCount += toInteger(call.can(android.telecom.Call.Details.CAPABILITY_MUTE));
buttonCount += toInteger(showManageVideoCallConferenceOption);
Log.v(this, "show AddParticipant: " + showAddParticipantOption +
diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java
index 10f0042c..256ea04d 100644
--- a/src/com/android/incallui/CallCardPresenter.java
+++ b/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;
@@ -267,8 +266,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();
}
}
@@ -320,7 +321,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return false;
}
- return mPrimary.can(PhoneCapabilities.MANAGE_CONFERENCE) && !mPrimary.isVideoCall(mContext);
+ return mPrimary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE)
+ && !mPrimary.isVideoCall(mContext);
}
private void setCallbackNumber() {
@@ -721,7 +723,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
@@ -730,7 +733,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/src/com/android/incallui/ConferenceManagerPresenter.java b/src/com/android/incallui/ConferenceManagerPresenter.java
index 7acd94e3..c61b1017 100644
--- a/src/com/android/incallui/ConferenceManagerPresenter.java
+++ b/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/src/com/android/incallui/ConferenceParticipantListAdapter.java b/src/com/android/incallui/ConferenceParticipantListAdapter.java
index 641261e0..0d597721 100644
--- a/src/com/android/incallui/ConferenceParticipantListAdapter.java
+++ b/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/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java
index 600b0a45..92414c27 100644
--- a/src/com/android/incallui/InCallPresenter.java
+++ b/src/com/android/incallui/InCallPresenter.java
@@ -23,7 +23,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;
@@ -780,8 +779,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);
@@ -803,7 +804,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);
@@ -1261,7 +1262,6 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
View.LAYOUT_DIRECTION_RTL;
}
-
/**
* @return An instance of TelecomManager.
*/
diff --git a/src/com/android/incallui/TelecomAdapter.java b/src/com/android/incallui/TelecomAdapter.java
index a64efcdc..c9c80d57 100644
--- a/src/com/android/incallui/TelecomAdapter.java
+++ b/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;
@@ -181,8 +179,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();
}
}
@@ -194,8 +192,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 {