summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-build-prod@system.gserviceaccount.com>2022-02-25 22:16:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-02-25 22:16:13 +0000
commit2fb5300bcc90a2799a52d105aac4b4f5cb3beae5 (patch)
treea71e1582f9d33f02aa09b6b2623413aa90028807
parent3e2abcb11d3e916877d9d105e54e54929ad189c2 (diff)
parent285fd3f171168d49e8f83929686c5d702b185a86 (diff)
Merge "IMS : Fix for Unknown Phone account issue" into s-keystone-qcom-dev
-rw-r--r--src/com/android/services/telephony/TelecomAccountRegistry.java40
1 files changed, 29 insertions, 11 deletions
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);
+ }
}
}