From 753904d60efa39c4aed3c3a3688ceee8d8d730e5 Mon Sep 17 00:00:00 2001 From: wangqi Date: Tue, 25 Jul 2017 16:08:11 -0700 Subject: Fix bug that cannot add call if there are multiple calling account. Repro steps: 1. setup multiple calling account (multi-sim or sip etc.) 2. make a ongoing call 3. click "Add call" 4. make another call in dialer This is caused by recreating incall activity when adding new call that will go through its lifecycle thus disconnecting the call with account selection states automatically. It's a regression caused by cl/162562378. Bug: 64014929 Test: manual PiperOrigin-RevId: 163138094 Change-Id: Ia979f7d63bd85cfaa6550c58e552759d66ec937c --- java/com/android/incallui/InCallActivityCommon.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java index f7d858389..94fe6ec4f 100644 --- a/java/com/android/incallui/InCallActivityCommon.java +++ b/java/com/android/incallui/InCallActivityCommon.java @@ -106,6 +106,8 @@ public class InCallActivityCommon { private boolean animateDialpadOnShow; private String dtmfTextToPreopulate; @DialpadRequestType private int showDialpadRequest = DIALPAD_REQUEST_NONE; + // If activity is going to be recreated. This is usually happening in {@link onNewIntent}. + private boolean isRecreating; private final SelectPhoneAccountListener selectAccountListener = new SelectPhoneAccountListener() { @@ -324,7 +326,8 @@ public class InCallActivityCommon { // This is necessary otherwise the pending call will stuck on account choose and no new call // will be able to create. See b/63600434 for more details. // Skip this on locked screen since the activity may go over life cycle and start again. - if (!inCallActivity.getSystemService(KeyguardManager.class).isKeyguardLocked()) { + if (!isRecreating + && !inCallActivity.getSystemService(KeyguardManager.class).isKeyguardLocked()) { DialerCall waitingForAccountCall = CallList.getInstance().getWaitingForAccountCall(); if (waitingForAccountCall != null) { waitingForAccountCall.disconnect(); @@ -343,6 +346,7 @@ public class InCallActivityCommon { void onNewIntent(Intent intent, boolean isRecreating) { LogUtil.i("InCallActivityCommon.onNewIntent", ""); + this.isRecreating = isRecreating; // We're being re-launched with a new Intent. Since it's possible for a // single InCallActivity instance to persist indefinitely (even if we -- cgit v1.2.3