diff options
author | roldenburg <roldenburg@google.com> | 2017-08-18 12:02:13 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-30 15:46:14 +0000 |
commit | 8f136644f7ba29ee742719dcb766b49902ac3341 (patch) | |
tree | db8771a9c70c96e46f6c03e5cd449d06ce7e6ac6 | |
parent | eed5afa45b9da6c1532feb95bd8ffdb5ae48d219 (diff) |
Fix black screen issue on ODR
Regresses video scaling issues on video ringing screen for incoming and
outgoing video calls.
For some reason, calling savedSurfaceTexture.setDefaultBufferSize(surfaceDimensions.x, surfaceDimensions.y) on ODR causes the issue in the bug. Simply not calling it prevents the issue but does lead to the scaling regressions.
Bug: 64778100
Test: manual
PiperOrigin-RevId: 165734624
Change-Id: Ibdfd0039544a711a16fe562d0fa902e16a20d4e4
3 files changed, 25 insertions, 8 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 6c08c497b..9b1f674bd 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -80,7 +80,8 @@ import java.util.concurrent.atomic.AtomicBoolean; * of a state machine at this point. Consider renaming. */ public class InCallPresenter implements CallList.Listener { - + private static final String PIXEL2017_SYSTEM_FEATURE = + "com.google.android.feature.PIXEL_2017_EXPERIENCE"; private static final String EXTRA_FIRST_TIME_SHOWN = "com.android.incallui.intent.extra.FIRST_TIME_SHOWN"; @@ -1673,14 +1674,18 @@ public class InCallPresenter implements CallList.Listener { VideoSurfaceTexture getLocalVideoSurfaceTexture() { if (mLocalVideoSurfaceTexture == null) { - mLocalVideoSurfaceTexture = VideoSurfaceBindings.createLocalVideoSurfaceTexture(); + mLocalVideoSurfaceTexture = + VideoSurfaceBindings.createLocalVideoSurfaceTexture( + mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE)); } return mLocalVideoSurfaceTexture; } VideoSurfaceTexture getRemoteVideoSurfaceTexture() { if (mRemoteVideoSurfaceTexture == null) { - mRemoteVideoSurfaceTexture = VideoSurfaceBindings.createRemoteVideoSurfaceTexture(); + mRemoteVideoSurfaceTexture = + VideoSurfaceBindings.createRemoteVideoSurfaceTexture( + mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE)); } return mRemoteVideoSurfaceTexture; } diff --git a/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java b/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java index 96fccb451..1cb26bd40 100644 --- a/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java +++ b/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java @@ -24,12 +24,12 @@ import com.android.incallui.videosurface.protocol.VideoSurfaceTexture; /** Bindings for video surface module. */ public class VideoSurfaceBindings { - public static VideoSurfaceTexture createLocalVideoSurfaceTexture() { - return new VideoSurfaceTextureImpl(VideoSurfaceTexture.SURFACE_TYPE_LOCAL); + public static VideoSurfaceTexture createLocalVideoSurfaceTexture(boolean isPixel2017) { + return new VideoSurfaceTextureImpl(isPixel2017, VideoSurfaceTexture.SURFACE_TYPE_LOCAL); } - public static VideoSurfaceTexture createRemoteVideoSurfaceTexture() { - return new VideoSurfaceTextureImpl(VideoSurfaceTexture.SURFACE_TYPE_REMOTE); + public static VideoSurfaceTexture createRemoteVideoSurfaceTexture(boolean isPixel2017) { + return new VideoSurfaceTextureImpl(isPixel2017, VideoSurfaceTexture.SURFACE_TYPE_REMOTE); } public static void scaleVideoAndFillView( diff --git a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java index 8cac40229..6ce564a87 100644 --- a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java +++ b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java @@ -18,6 +18,8 @@ package com.android.incallui.videosurface.impl; import android.graphics.Point; import android.graphics.SurfaceTexture; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import android.view.Surface; import android.view.TextureView; import android.view.View; @@ -33,6 +35,8 @@ import java.util.Objects; */ public class VideoSurfaceTextureImpl implements VideoSurfaceTexture { @SurfaceType private final int surfaceType; + private final boolean isPixel2017; + private VideoSurfaceDelegate delegate; private TextureView textureView; private Surface savedSurface; @@ -41,7 +45,8 @@ public class VideoSurfaceTextureImpl implements VideoSurfaceTexture { private Point sourceVideoDimensions; private boolean isDoneWithSurface; - public VideoSurfaceTextureImpl(@SurfaceType int surfaceType) { + public VideoSurfaceTextureImpl(boolean isPixel2017, @SurfaceType int surfaceType) { + this.isPixel2017 = isPixel2017; this.surfaceType = surfaceType; } @@ -68,6 +73,13 @@ public class VideoSurfaceTextureImpl implements VideoSurfaceTexture { "surfaceDimensions: " + surfaceDimensions + " " + toString()); this.surfaceDimensions = surfaceDimensions; if (surfaceDimensions != null && savedSurfaceTexture != null) { + // Only do this on O (not at least O) because we expect this issue to be fixed in OMR1 + if (VERSION.SDK_INT == VERSION_CODES.O && isPixel2017) { + LogUtil.i( + "VideoSurfaceTextureImpl.setSurfaceDimensions", + "skip setting default buffer size on Pixel 2017 ODR"); + return; + } savedSurfaceTexture.setDefaultBufferSize(surfaceDimensions.x, surfaceDimensions.y); } } |