Set presence capability based on carrier config.
For telephony phone accounts which support video calling, also turn on
the presence capability bit of the carrier config supports it.
Bug: 20257833
Change-Id: I1717f95471e0fae1cf96a1b5994bc82f6f943620
diff --git a/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java b/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
index ff3f6d2..f5b8719 100644
--- a/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
+++ b/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
@@ -98,8 +98,15 @@
PhoneAccount oldPhoneAccount = telecomMgr.getPhoneAccount(accountHandle);
PhoneAccount.Builder builder = new PhoneAccount.Builder(oldPhoneAccount);
+ int oldCapabilities = oldPhoneAccount.getCapabilities();
+ boolean wasVideoPresenceSupported =
+ (oldCapabilities & PhoneAccount.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)
+ != 0;
int capabilites = newCapabilities(oldPhoneAccount.getCapabilities(),
PhoneAccount.CAPABILITY_VIDEO_CALLING, isVideoCapable);
+ if (wasVideoPresenceSupported && isVideoCapable) {
+ capabilites |= PhoneAccount.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE;
+ }
builder.setCapabilities(capabilites);
telecomMgr.registerPhoneAccount(builder.build());
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 67223f2..f070572 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -66,6 +66,7 @@
private final PstnIncomingCallNotifier mIncomingCallNotifier;
private final PstnPhoneCapabilitiesNotifier mPhoneCapabilitiesNotifier;
private boolean mIsVideoCapable;
+ private boolean mIsVideoPresenceSupported;
private boolean mIsVideoPauseSupported;
private boolean mIsMergeCallSupported;
@@ -170,6 +171,12 @@
if (mIsVideoCapable) {
capabilities |= PhoneAccount.CAPABILITY_VIDEO_CALLING;
}
+
+ mIsVideoPresenceSupported = isCarrierVideoPresenceSupported();
+ if (mIsVideoCapable && mIsVideoPresenceSupported) {
+ capabilities |= PhoneAccount.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE;
+ }
+
mIsVideoPauseSupported = isCarrierVideoPauseSupported();
Bundle instantLetteringExtras = null;
if (isCarrierInstantLetteringSupported()) {
@@ -236,6 +243,18 @@
}
/**
+ * Determines from carrier configuration whether RCS presence indication for video calls is
+ * supported.
+ *
+ * @return {@code true} if RCS presence indication for video calls is supported.
+ */
+ private boolean isCarrierVideoPresenceSupported() {
+ PersistableBundle b =
+ PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
+ return b.getBoolean(CarrierConfigManager.KEY_USE_RCS_PRESENCE_BOOL);
+ }
+
+ /**
* Determines from carrier config whether instant lettering is supported.
*
* @return {@code true} if instant lettering is supported, {@code false} otherwise.