Merge "Connect Call Composer Extras for incoming call"
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e24d2f8..b8f87ea 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6525,6 +6525,49 @@
}
@Override
+ public void setCallComposerStatus(int subId, int status) {
+ enforceModifyPermission();
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ Phone defaultPhone = phone.getImsPhone();
+ if (defaultPhone != null && defaultPhone.getPhoneType() == PHONE_TYPE_IMS) {
+ ImsPhone imsPhone = (ImsPhone) defaultPhone;
+ imsPhone.setCallComposerStatus(status);
+ ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
+ .updateImsServiceConfig();
+ }
+ }
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ @Override
+ public int getCallComposerStatus(int subId) {
+ enforceReadPrivilegedPermission("getCallComposerStatus");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ Phone defaultPhone = phone.getImsPhone();
+ if (defaultPhone != null && defaultPhone.getPhoneType() == PHONE_TYPE_IMS) {
+ ImsPhone imsPhone = (ImsPhone) defaultPhone;
+ return imsPhone.getCallComposerStatus();
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ return TelephonyManager.CALL_COMPOSER_STATUS_OFF;
+ }
+
+ @Override
public boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag,
String number) {
TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(mApp,
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 7096de8..016da87 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -120,6 +120,7 @@
private final PstnPhoneCapabilitiesNotifier mPhoneCapabilitiesNotifier;
private boolean mIsEmergency;
private boolean mIsRttCapable;
+ private boolean mIsCallComposerCapable;
private boolean mIsAdhocConfCapable;
private boolean mIsEmergencyPreferred;
private MmTelFeature.MmTelCapabilities mMmTelCapabilities;
@@ -173,6 +174,7 @@
MmTelFeature.MmTelCapabilities capabilities) {
mMmTelCapabilities = capabilities;
updateRttCapability();
+ updateCallComposerCapability(capabilities);
}
};
registerMmTelCapabilityCallback();
@@ -367,6 +369,10 @@
mIsRttCapable = false;
}
+ if (mIsCallComposerCapable) {
+ capabilities |= PhoneAccount.CAPABILITY_CALL_COMPOSER;
+ }
+
mIsVideoCapable = mPhone.isVideoEnabled();
boolean isVideoEnabledByPlatform = ImsManager.getInstance(mPhone.getContext(),
mPhone.getPhoneId()).isVtEnabledByPlatform();
@@ -826,6 +832,17 @@
}
}
+ public void updateCallComposerCapability(MmTelFeature.MmTelCapabilities capabilities) {
+ boolean isCallComposerCapable = capabilities.isCapable(
+ MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_CALL_COMPOSER);
+ if (isCallComposerCapable != mIsCallComposerCapable) {
+ mIsCallComposerCapable = isCallComposerCapable;
+ Log.i(this, "updateCallComposerCapability - changed, new value: "
+ + isCallComposerCapable);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
+ }
+ }
+
public void updateDefaultDataSubId(int activeDataSubId) {
boolean isEmergencyPreferred = isEmergencyPreferredAccount(mPhone.getSubId(),
activeDataSubId);