summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorOmkar Kolangade <omkark@codeaurora.org>2016-04-07 09:23:18 -0700
committerTyler Gunn <tgunn@google.com>2016-04-07 09:25:55 -0700
commitc0388bfd7d50b93be45fdd86de31f7b8bfb9949f (patch)
tree57f069eec9879f1a90465a6a9601356c1da005ba /InCallUI
parent48d780c4be36bc325be92f1f7b7d971d1d1209a0 (diff)
IMS-VT: Fix race-condition causing preview freeze.
The VideoCall object is made of two binders - one for sending requests to telecomm and another one for receiving notifications from telecom. The initialization of the latter is delayed since a message is posted on a handler and initialization is done in the handler. getVideoCall() of InCallUi's Call class deligates the call to telecom's getVideoCall() function. Since UI events are asynchronous request to open the camera is sent, however, if the response is received before the initialization is complete in the handler the response will be dropped and camera initialization will fail. Modify the getVideoCall() function of the InCallUI's call to return valid VideoCall object only when the object is fully constructed. BUG=27810744 Change-Id: Id864892bf8452161f2c6f526edd6e4ecc39bf5cd
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/Call.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 54ec52829..447c34c88 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -374,6 +374,7 @@ public class Call {
private int mRequestedVideoState = VideoProfile.STATE_AUDIO_ONLY;
private InCallVideoCallCallback mVideoCallCallback;
+ private boolean mIsVideoCallCallbackRegistered;
private String mChildNumber;
private String mLastForwardedNumber;
private String mCallSubject;
@@ -448,6 +449,7 @@ public class Call {
mVideoCallCallback = new InCallVideoCallCallback(this);
}
mTelecomCall.getVideoCall().registerCallback(mVideoCallCallback);
+ mIsVideoCallCallbackRegistered = true;
}
mChildCallIds.clear();
@@ -754,8 +756,14 @@ public class Call {
return mTelecomCall == null ? null : mTelecomCall.getDetails().getAccountHandle();
}
+ /**
+ * @return The {@link VideoCall} instance associated with the {@link android.telecom.Call}.
+ * Will return {@code null} until {@link #updateFromTelecomCall()} has registered a valid
+ * callback on the {@link VideoCall}.
+ */
public VideoCall getVideoCall() {
- return mTelecomCall == null ? null : mTelecomCall.getVideoCall();
+ return mTelecomCall == null || !mIsVideoCallCallbackRegistered ? null
+ : mTelecomCall.getVideoCall();
}
public List<String> getChildCallIds() {