summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-03-14 07:54:50 -0700
committerLinux Build Service Account <lnxbuild@localhost>2022-03-14 07:54:50 -0700
commit596be8a64e17a5262bd4d4bc73fc891f072c7dbc (patch)
treeadc96c128837368166ad95ebe6be1a603fe9c662
parent9172ebf478d3f986444187f48f32e81e68d0ee25 (diff)
parent6c3dfa76ab344e1a7aa0f3c5cdc64bdb1f3d6e61 (diff)
Merge 6c3dfa76ab344e1a7aa0f3c5cdc64bdb1f3d6e61 on remote branch
Change-Id: Ibb51d6963a880f3ccb7f02ecad862381a9e688fa
-rw-r--r--src/com/android/phone/PhoneUtils.java2
-rwxr-xr-xsrc/com/android/services/telephony/ImsConference.java29
-rw-r--r--src/com/android/services/telephony/ImsConferenceController.java2
-rw-r--r--src/com/android/services/telephony/TelecomAccountRegistry.java40
-rw-r--r--src/com/android/services/telephony/TelephonyConnection.java24
-rw-r--r--src/com/android/services/telephony/TelephonyConnectionService.java4
6 files changed, 76 insertions, 25 deletions
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 98090ab14f..e4d0af4c51 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -771,7 +771,7 @@ public class PhoneUtils {
// TODO: Should use some sort of special hidden flag to decorate this account as
// an emergency-only account
String id = isEmergency ? EMERGENCY_ACCOUNT_HANDLE_ID : prefix +
- String.valueOf(phone.getFullIccSerialNumber());
+ String.valueOf((phone != null) ? phone.getFullIccSerialNumber() : null);
return makePstnPhoneAccountHandleWithPrefix(id, prefix, isEmergency);
}
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 98b0840e3f..1e39fb0335 100755
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -488,8 +488,17 @@ public class ImsConference extends TelephonyConferenceBase implements Holdable {
// Specify the connection time of the conference to be the connection time of the original
// connection.
- long connectTime = conferenceHost.getOriginalConnection().getConnectTime();
- long connectElapsedTime = conferenceHost.getOriginalConnection().getConnectTimeReal();
+ com.android.internal.telephony.Connection originalConnection =
+ conferenceHost.getOriginalConnection();
+ //In MT IMS conference call, it will cleanup TelephonyConnection which backed the original
+ //connection and remove from telecom, originalConnection will become null, so initialize
+ //'connectTime' and 'connectElapsedTime' when new ImsConference.
+ long connectTime = 0;
+ long connectElapsedTime = 0;
+ if (originalConnection != null ) {
+ connectTime = originalConnection.getConnectTime();
+ connectElapsedTime = originalConnection.getConnectTimeReal();
+ }
setConnectionTime(connectTime);
setConnectionStartElapsedRealtimeMillis(connectElapsedTime);
// Set the connectTime in the connection as well.
@@ -1533,13 +1542,19 @@ public class ImsConference extends TelephonyConferenceBase implements Holdable {
if (mConferenceHost == null) {
disconnectCause = new DisconnectCause(DisconnectCause.CANCELED);
} else {
+ com.android.internal.telephony.Connection originalConnection =
+ mConferenceHost.getOriginalConnection();
if (mConferenceHost.getPhone() != null) {
- disconnectCause = DisconnectCauseUtil.toTelecomDisconnectCause(
- mConferenceHost.getOriginalConnection().getDisconnectCause(),
- null, mConferenceHost.getPhone().getPhoneId());
+ disconnectCause = originalConnection != null ?
+ DisconnectCauseUtil.toTelecomDisconnectCause(
+ originalConnection.getDisconnectCause(),
+ null, mConferenceHost.getPhone().getPhoneId())
+ : new DisconnectCause(DisconnectCause.UNKNOWN);
} else {
- disconnectCause = DisconnectCauseUtil.toTelecomDisconnectCause(
- mConferenceHost.getOriginalConnection().getDisconnectCause());
+ disconnectCause = originalConnection != null ?
+ DisconnectCauseUtil.toTelecomDisconnectCause(
+ originalConnection.getDisconnectCause())
+ : new DisconnectCause(DisconnectCause.UNKNOWN);
}
}
setDisconnected(disconnectCause);
diff --git a/src/com/android/services/telephony/ImsConferenceController.java b/src/com/android/services/telephony/ImsConferenceController.java
index 7d374381a5..8a013db173 100644
--- a/src/com/android/services/telephony/ImsConferenceController.java
+++ b/src/com/android/services/telephony/ImsConferenceController.java
@@ -448,6 +448,8 @@ public class ImsConferenceController {
conferenceHostConnection.setVideoPauseSupported(connection.getVideoPauseSupported());
conferenceHostConnection.setManageImsConferenceCallSupported(
connection.isManageImsConferenceCallSupported());
+ conferenceHostConnection.setTelephonyConnectionService(
+ connection.getTelephonyConnectionService());
// WARNING: do not try to copy the video provider from connection to
// conferenceHostConnection here. In connection.cloneConnection, part of the clone
// process is to set the original connection so it's already set:
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 1722ddf15a..513072019a 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -874,21 +874,39 @@ public class TelecomAccountRegistry {
}
public void updateRttCapability() {
- boolean isRttEnabled = isRttCurrentlySupported();
- if (isRttEnabled != mIsRttCapable) {
- Log.i(this, "updateRttCapability - changed, new value: " + isRttEnabled);
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
+ synchronized (mAccountsLock) {
+ if (!mAccounts.contains(this)) {
+ // Account has already been torn down, don't try to register it again.
+ // This handles the case where teardown has already happened, and we got an rtt
+ // update that lost the race for the mAccountsLock. In such a scenario by the
+ // time we get here, the original phone account could have been torn down.
+ return;
+ }
+ boolean isRttEnabled = isRttCurrentlySupported();
+ if (isRttEnabled != mIsRttCapable) {
+ Log.i(this, "updateRttCapability - changed, new value: " + isRttEnabled);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
+ }
}
}
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);
+ synchronized (mAccountsLock) {
+ if (!mAccounts.contains(this)) {
+ // Account has already been torn down, don't try to register it again.
+ // This handles the case where teardown has already happened, and we got a call
+ // composer update that lost the race for the mAccountsLock. In such a scenario
+ // by the time we get here, the original phone account could have been torn down.
+ return;
+ }
+ 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);
+ }
}
}
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 35abf056df..a011837336 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -1997,15 +1997,29 @@ abstract class TelephonyConnection extends Connection implements Holdable,
boolean isCurrentVideoCall = false;
boolean wasVideoCall = false;
boolean isVowifiEnabled = false;
+ boolean isCurrentBgVideoCall = false;
+ boolean wasBgVideoCall = false;
if (phone instanceof ImsPhone) {
ImsPhone imsPhone = (ImsPhone) phone;
ImsCall call = null;
if (imsPhone.getForegroundCall() != null
&& imsPhone.getForegroundCall().getImsCall() != null) {
call = imsPhone.getForegroundCall().getImsCall();
- } else if (imsPhone.getBackgroundCall() != null
- && imsPhone.getBackgroundCall().getImsCall() != null) {
- call = imsPhone.getBackgroundCall().getImsCall();
+ } else if (imsPhone.getBackgroundCall() != null) {
+ if (TelephonyManager.isConcurrentCallsPossible()) {
+ ArrayList<com.android.internal.telephony.Connection> connections =
+ imsPhone.getBackgroundCall().getConnections();
+ for (com.android.internal.telephony.Connection conn : connections) {
+ if (conn instanceof ImsPhoneConnection) {
+ ImsCall bgCall = ((ImsPhoneConnection)conn).getImsCall();
+ isCurrentBgVideoCall |= bgCall.isVideoCall();
+ wasBgVideoCall |= bgCall.wasVideoCall();
+ }
+ }
+
+ } else if (imsPhone.getBackgroundCall().getImsCall() != null) {
+ call = imsPhone.getBackgroundCall().getImsCall();
+ }
} else if (imsPhone.getRingingCall() != null
&& imsPhone.getRingingCall().getImsCall() != null) {
call = imsPhone.getRingingCall().getImsCall();
@@ -2018,9 +2032,9 @@ abstract class TelephonyConnection extends Connection implements Holdable,
isVowifiEnabled = isWfcEnabled(phone);
}
- if (isCurrentVideoCall) {
+ if (isCurrentVideoCall || isCurrentBgVideoCall) {
return true;
- } else if (wasVideoCall && isWifi() && !isVowifiEnabled) {
+ } else if ((wasVideoCall || wasBgVideoCall) && isWifi() && !isVowifiEnabled) {
return true;
}
return false;
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 116e13b9c0..0abbce756e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -672,7 +672,6 @@ public class TelephonyConnectionService extends ConnectionService {
}
TelephonyConnection connection = (TelephonyConnection)conn;
-
ImsConference conference = new ImsConference(TelecomAccountRegistry.getInstance(this),
mTelephonyConnectionServiceProxy, connection,
phoneAccountHandle, () -> true,
@@ -2827,6 +2826,9 @@ public class TelephonyConnectionService extends ConnectionService {
// when we go between CDMA and GSM we should replace the TelephonyConnection.
if (connection.isImsConnection()) {
Log.d(this, "Adding IMS connection to conference controller: " + connection);
+ if (connection.getTelephonyConnectionService() == null) {
+ connection.setTelephonyConnectionService(this);
+ }
mImsConferenceController.add(connection);
mTelephonyConferenceController.remove(connection);
if (connection instanceof CdmaConnection) {