diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-26 11:07:13 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-26 11:07:13 +0000 |
commit | ab59d55d1457ddeec4bc70267e044c1aea846368 (patch) | |
tree | a71e1582f9d33f02aa09b6b2623413aa90028807 | |
parent | d1cd7d1019f891efc93d020dc5e9dfe291cf9d55 (diff) | |
parent | 2fb5300bcc90a2799a52d105aac4b4f5cb3beae5 (diff) |
Snap for 8227169 from 2fb5300bcc90a2799a52d105aac4b4f5cb3beae5 to s-keystone-qcom-release
Change-Id: Iac8e4a308d0efeb831bbd1a5077de4a563286179
-rw-r--r-- | src/com/android/services/telephony/TelecomAccountRegistry.java | 40 |
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); + } } } |