summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-11-09 14:20:47 -0800
committerTyler Gunn <tgunn@google.com>2015-11-09 14:20:47 -0800
commitedf496040d42e16909ffdbf4810dc9b1e5b026f8 (patch)
tree19eb315703067f942b6800d2e1d53be3e7807069 /InCallUI
parentdd38cb8f6bf0b82ece971f45091537206865d253 (diff)
DO NOT MERGE Ensure call subject is hidden if disabled for carrier.
Even if the carrier config is set to disable call subjects for a carrier, the RIL will still send any incoming call subjects to the InCall UI. We cannot suppress this lower down as the RIL is using the same extra to report caller id presentation reasons. Bug: 22779583 Change-Id: Ic349408014a47e25d62100886ea59b73e4f76709
Diffstat (limited to 'InCallUI')
-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.java5
3 files changed, 39 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index d1cb62374..c82b7a5c9 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;
@@ -368,6 +369,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;
@@ -488,6 +496,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) {
@@ -600,6 +624,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 28311c9d6..58722a185 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -1031,7 +1031,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..43fc95ef4 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;
@@ -439,7 +440,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();
}