summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/video
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-22 09:39:08 -0700
committerEric Erfanian <erfanian@google.com>2017-06-22 17:23:58 +0000
commit842a9777de13bebb1c82f9d57222c52f9ddec558 (patch)
tree742285fa641f62ba0b358a65a452f4f65db04ce2 /java/com/android/incallui/video
parenta8a71b12c67ca852382e94d5e6d5d04430529902 (diff)
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
Diffstat (limited to 'java/com/android/incallui/video')
-rw-r--r--java/com/android/incallui/video/impl/VideoCallFragment.java76
1 files changed, 41 insertions, 35 deletions
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));
}