From 842a9777de13bebb1c82f9d57222c52f9ddec558 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 22 Jun 2017 09:39:08 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/159771812. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/159428781 (6/19/2017) to cl/159771812 (6/22/2017). These changes track the dialer V11 release. This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Merged-In: I39aba7e972bac6e5864e70ed693849d90ecd7e08 Change-Id: Ia87877f7ae67c5b56078477b8b08082de1355315 --- .../incallui/video/impl/VideoCallFragment.java | 76 ++++++++++++---------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'java/com/android/incallui/video/impl') diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java index 609cb691e..f9b5d45fa 100644 --- a/java/com/android/incallui/video/impl/VideoCallFragment.java +++ b/java/com/android/incallui/video/impl/VideoCallFragment.java @@ -100,8 +100,8 @@ public class VideoCallFragment extends Fragment @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) static final String ARG_CALL_ID = "call_id"; - private static final float BLUR_PREVIEW_RADIUS = 16.0f; - private static final float BLUR_PREVIEW_SCALE_FACTOR = 1.0f; + @VisibleForTesting static final float BLUR_PREVIEW_RADIUS = 16.0f; + @VisibleForTesting static final float BLUR_PREVIEW_SCALE_FACTOR = 1.0f; private static final float BLUR_REMOTE_RADIUS = 25.0f; private static final float BLUR_REMOTE_SCALE_FACTOR = 0.25f; private static final float ASPECT_RATIO_MATCH_THRESHOLD = 0.2f; @@ -1106,52 +1106,58 @@ public class VideoCallFragment extends Fragment BLUR_REMOTE_SCALE_FACTOR); } - private void updateBlurredImageView( + @VisibleForTesting + void updateBlurredImageView( TextureView textureView, ImageView blurredImageView, boolean isVideoEnabled, float blurRadius, float scaleFactor) { - boolean didBlur = false; - long startTimeMillis = SystemClock.elapsedRealtime(); - if (!isVideoEnabled) { - int width = Math.round(textureView.getWidth() * scaleFactor); - int height = Math.round(textureView.getHeight() * scaleFactor); - // This call takes less than 10 milliseconds. - Bitmap bitmap = textureView.getBitmap(width, height); - if (bitmap != null) { - // TODO: When the view is first displayed after a rotation the bitmap is empty - // and thus this blur has no effect. - // This call can take 100 milliseconds. - blur(getContext(), bitmap, blurRadius); - - // TODO: Figure out why only have to apply the transform in landscape mode - if (width > height) { - bitmap = - Bitmap.createBitmap( - bitmap, - 0, - 0, - bitmap.getWidth(), - bitmap.getHeight(), - textureView.getTransform(null), - true); - } + Context context = getContext(); - blurredImageView.setImageBitmap(bitmap); - blurredImageView.setVisibility(View.VISIBLE); - didBlur = true; - } + if (isVideoEnabled || context == null) { + blurredImageView.setImageBitmap(null); + blurredImageView.setVisibility(View.GONE); + return; } - if (!didBlur) { + + long startTimeMillis = SystemClock.elapsedRealtime(); + int width = Math.round(textureView.getWidth() * scaleFactor); + int height = Math.round(textureView.getHeight() * scaleFactor); + + // This call takes less than 10 milliseconds. + Bitmap bitmap = textureView.getBitmap(width, height); + + if (bitmap == null) { blurredImageView.setImageBitmap(null); blurredImageView.setVisibility(View.GONE); + return; } + // TODO: When the view is first displayed after a rotation the bitmap is empty + // and thus this blur has no effect. + // This call can take 100 milliseconds. + blur(getContext(), bitmap, blurRadius); + + // TODO: Figure out why only have to apply the transform in landscape mode + if (width > height) { + bitmap = + Bitmap.createBitmap( + bitmap, + 0, + 0, + bitmap.getWidth(), + bitmap.getHeight(), + textureView.getTransform(null), + true); + } + + blurredImageView.setImageBitmap(bitmap); + blurredImageView.setVisibility(View.VISIBLE); + LogUtil.i( "VideoCallFragment.updateBlurredImageView", - "didBlur: %b, took %d millis", - didBlur, + "took %d millis", (SystemClock.elapsedRealtime() - startTimeMillis)); } -- cgit v1.2.3