diff options
author | roldenburg <roldenburg@google.com> | 2017-09-01 14:41:19 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-07 15:48:52 +0000 |
commit | 12b50c650c4fc61ff9f59670e3edf08a0bdb3620 (patch) | |
tree | a8fc2a8fc85fb6dd391f5736ae3ddf08ec851436 /java | |
parent | 97fee1cd45fa46448b07b219d5e6f2e911d4f5f0 (diff) |
Fix crash when Context is null in InCallPresenter
We need to use the Context to check if the device is a ODR device for a workaround (http://cl/165734624). It turns out the Context can be null (rarely). In those cases, we should not crash.
Bug: 64954483
Test: manual
PiperOrigin-RevId: 167326838
Change-Id: I4d8d8de86b5e3a4eca165a562f2ddc6106052c6e
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 3f87a592d..4cc03f3dd 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -1682,18 +1682,23 @@ public class InCallPresenter implements CallList.Listener { VideoSurfaceTexture getLocalVideoSurfaceTexture() { if (mLocalVideoSurfaceTexture == null) { - mLocalVideoSurfaceTexture = - VideoSurfaceBindings.createLocalVideoSurfaceTexture( - mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE)); + boolean isPixel2017 = false; + if (mContext != null) { + isPixel2017 = mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE); + } + mLocalVideoSurfaceTexture = VideoSurfaceBindings.createLocalVideoSurfaceTexture(isPixel2017); } return mLocalVideoSurfaceTexture; } VideoSurfaceTexture getRemoteVideoSurfaceTexture() { if (mRemoteVideoSurfaceTexture == null) { + boolean isPixel2017 = false; + if (mContext != null) { + isPixel2017 = mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE); + } mRemoteVideoSurfaceTexture = - VideoSurfaceBindings.createRemoteVideoSurfaceTexture( - mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE)); + VideoSurfaceBindings.createRemoteVideoSurfaceTexture(isPixel2017); } return mRemoteVideoSurfaceTexture; } |