summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-09-28 10:44:54 -0700
committerEric Erfanian <erfanian@google.com>2017-09-29 10:43:32 -0700
commit385a5a1e620bf1ecf465d9f60b13b98482bc5c53 (patch)
tree9aed27cb8ebacbcf24cbc6bd8b9d12a58de94cc6 /java
parentea2f430dd5f5f5f08bb5c9438696112f44423abe (diff)
Fix crash on incoming video call when video upgrade call is pending.
This is a upstream fix from AOSP: https://android-review.googlesource.com/#/c/platform/packages/apps/Dialer/+/475598/ Bug: 63608380 Test: none PiperOrigin-RevId: 170365033 Change-Id: Id58cf4c67a3b0144521622a14997a83403017bee
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/CallCardPresenter.java6
-rw-r--r--java/com/android/incallui/VideoCallPresenter.java25
2 files changed, 19 insertions, 12 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index 15b04eaaf..be9b3ef6c 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -142,7 +142,7 @@ public class CallCardPresenter
};
public CallCardPresenter(Context context) {
- LogUtil.i("CallCardController.constructor", null);
+ LogUtil.i("CallCardPresenter.constructor", null);
mContext = Assert.isNotNull(context).getApplicationContext();
callLocation = CallLocationComponent.get(mContext).getCallLocation();
}
@@ -179,7 +179,7 @@ public class CallCardPresenter
@Override
public void onInCallScreenReady() {
- LogUtil.i("CallCardController.onInCallScreenReady", null);
+ LogUtil.i("CallCardPresenter.onInCallScreenReady", null);
Assert.checkState(!isInCallScreenReady);
if (mContactsPreferences != null) {
mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
@@ -222,7 +222,7 @@ public class CallCardPresenter
@Override
public void onInCallScreenUnready() {
- LogUtil.i("CallCardController.onInCallScreenUnready", null);
+ LogUtil.i("CallCardPresenter.onInCallScreenUnready", null);
Assert.checkState(isInCallScreenReady);
// stop getting call state changes
diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java
index 89cddb9c4..ab02c3b86 100644
--- a/java/com/android/incallui/VideoCallPresenter.java
+++ b/java/com/android/incallui/VideoCallPresenter.java
@@ -60,14 +60,14 @@ import java.util.Objects;
* layer:
*
* <ul>
- * <li>{@code VideoCallPresenter} creates and informs telephony of the display surface.
- * <li>{@code VideoCallPresenter} creates the preview surface.
- * <li>{@code VideoCallPresenter} informs telephony of the currently selected camera.
- * <li>Telephony layer sends {@link CameraCapabilities}, including the dimensions of the video for
- * the current camera.
- * <li>{@code VideoCallPresenter} adjusts size of the preview surface to match the aspect ratio of
- * the camera.
- * <li>{@code VideoCallPresenter} informs telephony of the new preview surface.
+ * <li>{@code VideoCallPresenter} creates and informs telephony of the display surface.
+ * <li>{@code VideoCallPresenter} creates the preview surface.
+ * <li>{@code VideoCallPresenter} informs telephony of the currently selected camera.
+ * <li>Telephony layer sends {@link CameraCapabilities}, including the dimensions of the video for
+ * the current camera.
+ * <li>{@code VideoCallPresenter} adjusts size of the preview surface to match the aspect ratio of
+ * the camera.
+ * <li>{@code VideoCallPresenter} informs telephony of the new preview surface.
* </ul>
*
* <p>When downgrading to an audio-only video state, the {@code VideoCallPresenter} nulls both
@@ -169,7 +169,7 @@ public class VideoCallPresenter
boolean isPaused = VideoProfile.isPaused(videoState);
boolean isCallActive = callState == DialerCall.State.ACTIVE;
- //Show incoming Video for dialing calls to support early media
+ // Show incoming Video for dialing calls to support early media
boolean isCallOutgoingPending =
DialerCall.State.isDialing(callState) || callState == DialerCall.State.CONNECTING;
@@ -455,6 +455,13 @@ public class VideoCallPresenter
@Override
public void onIncomingCall(
InCallPresenter.InCallState oldState, InCallPresenter.InCallState newState, DialerCall call) {
+ // If video call screen ui is already destroyed, this shouldn't be called. But the UI may be
+ // updated synchronized by {@link CallCardPresenter#onIncomingCall} before this is called, this
+ // could still be called. Thus just do nothing in this case.
+ if (!isVideoCallScreenUiReady) {
+ LogUtil.i("VideoCallPresenter.onIncomingCall", "UI is not ready");
+ return;
+ }
// same logic should happen as with onStateChange()
onStateChange(oldState, newState, CallList.getInstance());
}