summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java74
1 files changed, 30 insertions, 44 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 3d7371088..a1d6d65b6 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -72,7 +72,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
});
}
-
public void init(Context context, Call call) {
mContext = Preconditions.checkNotNull(context);
@@ -196,7 +195,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
callState = mPrimary.getState();
getUi().setCallState(callState, mPrimary.getDisconnectCause(), getConnectionLabel(),
- getConnectionIcon(), getGatewayNumber());
+ getCallProviderIcon(mPrimary), getGatewayNumber());
String currentNumber = getNumberFromHandle(mPrimary.getHandle());
if (PhoneNumberUtils.isEmergencyNumber(currentNumber)) {
@@ -465,7 +464,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
final boolean nameIsNumber = nameForCall != null && nameForCall.equals(
mSecondaryContactInfo.number);
ui.setSecondary(true /* show */, nameForCall, nameIsNumber, mSecondaryContactInfo.label,
- getSecondaryCallProviderLabel(), getSecondaryCallProviderIcon(),
+ getCallProviderLabel(mSecondary), getCallProviderIcon(mSecondary),
isConference, isGenericConf);
} else {
// reset to nothing so that it starts off blank next time we use it.
@@ -473,6 +472,18 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
}
+
+ /**
+ * Gets the phone account to display for a call.
+ */
+ private PhoneAccount getAccountForCall(Call call) {
+ PhoneAccountHandle accountHandle = call.getAccountHandle();
+ if (accountHandle == null) {
+ return null;
+ }
+ return getTelecommManager().getPhoneAccount(accountHandle);
+ }
+
/**
* Returns the gateway number for any existing outgoing call.
*/
@@ -486,13 +497,21 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
/**
* Return the Drawable object of the icon to display to the left of the connection label.
*/
- private Drawable getConnectionIcon() {
- PhoneAccountHandle accountHandle = mPrimary.getAccountHandle();
- if (accountHandle != null) {
- PhoneAccount account = getTelecommManager().getPhoneAccount(accountHandle);
- if (account != null) {
- return account.getIcon(mContext);
- }
+ private Drawable getCallProviderIcon(Call call) {
+ PhoneAccount account = getAccountForCall(call);
+ if (account != null && getTelecommManager().hasMultipleEnabledAccounts()) {
+ return account.getIcon(mContext);
+ }
+ return null;
+ }
+
+ /**
+ * Return the string label to represent the call provider
+ */
+ private String getCallProviderLabel(Call call) {
+ PhoneAccount account = getAccountForCall(call);
+ if (account != null && getTelecommManager().hasMultipleEnabledAccounts()) {
+ return account.getLabel().toString();
}
return null;
}
@@ -514,36 +533,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return null;
}
}
- PhoneAccountHandle accountHandle = mPrimary.getAccountHandle();
- if (accountHandle != null) {
- PhoneAccount account = getTelecommManager().getPhoneAccount(accountHandle);
- if (account != null) {
- return getAccountLabel(account);
- }
- }
- return null;
- }
-
- private String getSecondaryCallProviderLabel() {
- PhoneAccountHandle accountHandle = mSecondary.getAccountHandle();
- if (accountHandle != null) {
- PhoneAccount account = getTelecommManager().getPhoneAccount(accountHandle);
- if (account != null) {
- return getAccountLabel(account);
- }
- }
- return null;
- }
-
- private Drawable getSecondaryCallProviderIcon() {
- PhoneAccountHandle accountHandle = mSecondary.getAccountHandle();
- if (accountHandle != null) {
- PhoneAccount account = getTelecommManager().getPhoneAccount(accountHandle);
- if (account != null) {
- return account.getIcon(mContext);
- }
- }
- return null;
+ return getCallProviderLabel(mPrimary);
}
private boolean hasOutgoingGatewayCall() {
@@ -604,10 +594,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return handle == null ? "" : handle.getSchemeSpecificPart();
}
- private String getAccountLabel(PhoneAccount account) {
- return account.getLabel() == null ? null : account.getLabel().toString();
- }
-
public interface CallCardUi extends Ui {
void setVisible(boolean on);
void setPrimary(String number, String name, boolean nameIsNumber, String label,