From 4dda7bbd0feee1ec8ec5ff35790d1f2a25825c63 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Thu, 28 May 2015 15:47:06 -0700 Subject: Fix NullPointerException in VideoCallImpl. There were instances of NPEs due to a null mHandler in the VideoCallImpl. Traced the problem down to InCallService implementations which do not register a VideoCall Callback (e.g. gearhead). Added null checks for uses of mHandler. Bug: 21474154 Change-Id: I44dffde5e46529cc62912d417ad23c7b7dd1a1ba --- telecomm/java/android/telecom/VideoCallImpl.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'telecomm') diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index c8072d1..93484cd 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -57,13 +57,20 @@ public class VideoCallImpl extends VideoCall { private final class VideoCallListenerBinder extends IVideoCallback.Stub { @Override public void receiveSessionModifyRequest(VideoProfile videoProfile) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_REQUEST, videoProfile).sendToTarget(); + } @Override public void receiveSessionModifyResponse(int status, VideoProfile requestProfile, VideoProfile responseProfile) { + if (mHandler == null) { + return; + } SomeArgs args = SomeArgs.obtain(); args.arg1 = status; args.arg2 = requestProfile; @@ -74,12 +81,18 @@ public class VideoCallImpl extends VideoCall { @Override public void handleCallSessionEvent(int event) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_HANDLE_CALL_SESSION_EVENT, event) .sendToTarget(); } @Override public void changePeerDimensions(int width, int height) { + if (mHandler == null) { + return; + } SomeArgs args = SomeArgs.obtain(); args.arg1 = width; args.arg2 = height; @@ -88,18 +101,27 @@ public class VideoCallImpl extends VideoCall { @Override public void changeVideoQuality(int videoQuality) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0) .sendToTarget(); } @Override public void changeCallDataUsage(long dataUsage) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CALL_DATA_USAGE, dataUsage) .sendToTarget(); } @Override public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) { + if (mHandler == null) { + return; + } mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CAMERA_CAPABILITIES, cameraCapabilities).sendToTarget(); } -- cgit v1.1