summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/callcomposer/CallComposerActivity.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java
index b02e32543..83fe2d9de 100644
--- a/java/com/android/dialer/callcomposer/CallComposerActivity.java
+++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java
@@ -528,12 +528,18 @@ public class CallComposerActivity extends AppCompatActivity
@Override
public void onBackPressed() {
+ LogUtil.enterBlock("CallComposerActivity.onBackPressed");
if (!isSendAndCallHidingOrHidden) {
((CallComposerFragment) adapter.instantiateItem(pager, currentIndex)).clearComposer();
} else if (!runningExitAnimation) {
// Unregister first to avoid receiving a callback when the session closes
getEnrichedCallManager().unregisterStateChangedListener(this);
- getEnrichedCallManager().endCallComposerSession(sessionId);
+
+ // If the user presses the back button when the session fails, there's a race condition here
+ // since we clean up failed sessions.
+ if (getEnrichedCallManager().getSession(sessionId) != null) {
+ getEnrichedCallManager().endCallComposerSession(sessionId);
+ }
runExitAnimation();
}
}