diff options
Diffstat (limited to 'src/com/android/incallui/Call.java')
-rw-r--r-- | src/com/android/incallui/Call.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index f08653e6..01205ff1 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -30,6 +30,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; @@ -262,6 +263,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; /** * Used only to create mock calls for testing @@ -373,6 +381,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 = mTelecommCall.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) { @@ -477,6 +501,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) { |