summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI/src/com/android')
-rw-r--r--InCallUI/src/com/android/incallui/Call.java32
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java12
3 files changed, 42 insertions, 6 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 9d9e7bf24..7b2724a37 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -33,6 +33,7 @@ import android.telecom.GatewayInfo;
import android.telecom.InCallService.VideoCall;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -372,6 +373,13 @@ public class Call {
private String mChildNumber;
private String mLastForwardedNumber;
private String mCallSubject;
+ private PhoneAccountHandle mPhoneAccountHandle;
+
+ /**
+ * Indicates whether the phone account associated with this call supports specifying a call
+ * subject.
+ */
+ private boolean mIsCallSubjectSupported;
private long mTimeAddedMs;
@@ -497,6 +505,22 @@ public class Call {
mHandle = newHandle;
updateEmergencyCallState();
}
+
+ // If the phone account handle of the call is set, cache capability bit indicating whether
+ // the phone account supports call subjects.
+ PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle();
+ if (!Objects.equals(mPhoneAccountHandle, newPhoneAccountHandle)) {
+ mPhoneAccountHandle = newPhoneAccountHandle;
+
+ if (mPhoneAccountHandle != null) {
+ TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
+ PhoneAccount phoneAccount = mgr.getPhoneAccount(mPhoneAccountHandle);
+ if (phoneAccount != null) {
+ mIsCallSubjectSupported = phoneAccount.hasCapabilities(
+ PhoneAccount.CAPABILITY_CALL_SUBJECT);
+ }
+ }
+ }
}
private static int translateState(int state) {
@@ -609,6 +633,14 @@ public class Call {
return mCallSubject;
}
+ /**
+ * @return {@code true} if the call's phone account supports call subjects, {@code false}
+ * otherwise.
+ */
+ public boolean isCallSubjectSupported() {
+ return mIsCallSubjectSupported;
+ }
+
/** Returns call disconnect cause, defined by {@link DisconnectCause}. */
public DisconnectCause getDisconnectCause() {
if (mState == State.DISCONNECTED || mState == State.IDLE) {
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index bccde6eb1..ba5823d5a 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -1033,7 +1033,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
boolean isIncomingOrWaiting = mPrimary.getState() == Call.State.INCOMING ||
mPrimary.getState() == Call.State.CALL_WAITING;
- return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject());
+ return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) &&
+ call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED &&
+ call.isCallSubjectSupported();
}
/**
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 79a0b2cac..4b57278c4 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -29,6 +29,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.telecom.Call.Details;
import android.telecom.PhoneAccount;
+import android.telecom.TelecomManager;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
@@ -224,9 +225,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
final String contentTitle = getContentTitle(contactInfo, call);
final int notificationType;
- if ((state == Call.State.INCOMING
- || state == Call.State.CALL_WAITING) &&
- !InCallPresenter.getInstance().isShowingInCallUi()) {
+ if (state == Call.State.INCOMING || state == Call.State.CALL_WAITING) {
notificationType = NOTIFICATION_INCOMING_CALL;
} else {
notificationType = NOTIFICATION_IN_CALL;
@@ -251,7 +250,8 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
builder.setContentIntent(inCallPendingIntent);
// Set the intent as a full screen intent as well if a call is incoming
- if (notificationType == NOTIFICATION_INCOMING_CALL) {
+ if (notificationType == NOTIFICATION_INCOMING_CALL
+ && !InCallPresenter.getInstance().isShowingInCallUi()) {
configureFullScreenIntent(builder, inCallPendingIntent, call);
// Set the notification category for incoming calls
builder.setCategory(Notification.CATEGORY_CALL);
@@ -439,7 +439,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
boolean isIncomingOrWaiting = call.getState() == Call.State.INCOMING ||
call.getState() == Call.State.CALL_WAITING;
- if (isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject())) {
+ if (isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) &&
+ call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED &&
+ call.isCallSubjectSupported()) {
return call.getCallSubject();
}