summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-07-12 07:31:14 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-07-12 07:31:14 +0000
commit442c9b88edcdf780933c4c1f274021a3b48d2a4a (patch)
tree67f86db4c4c0144749a7190130c74df46e0f84a9
parentd7380586250c1926a685636eedc5ad139657f95e (diff)
parent6e7e1b9a79e078d7c77648b414809df79218597e (diff)
downloadandroid_packages_apps_Dialer-442c9b88edcdf780933c4c1f274021a3b48d2a4a.tar.gz
android_packages_apps_Dialer-442c9b88edcdf780933c4c1f274021a3b48d2a4a.tar.bz2
android_packages_apps_Dialer-442c9b88edcdf780933c4c1f274021a3b48d2a4a.zip
release-request-b6f2d5b3-a3d6-410f-b58f-c85ba8187177-for-git_oc-mr1-release-4173087 snap-temp-L93200000081515229
Change-Id: Iaf4293418ebe2b4c801225f2eb88a971b5e696cf
-rw-r--r--java/com/android/dialer/app/calllog/CallLogFragment.java2
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java2
-rw-r--r--java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java62
-rw-r--r--java/com/android/dialer/app/calllog/calllogcache/CallLogCacheLollipopMr1.java96
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteTileView.java8
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java1
-rw-r--r--java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java13
-rw-r--r--java/com/android/incallui/video/impl/VideoCallFragment.java139
-rw-r--r--java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java3
9 files changed, 149 insertions, 177 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java
index 369fbbc91..6d4aea91f 100644
--- a/java/com/android/dialer/app/calllog/CallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/CallLogFragment.java
@@ -346,7 +346,7 @@ public class CallLogFragment extends Fragment
activityType == CallLogAdapter.ACTIVITY_TYPE_DIALTACTS
? (CallLogAdapter.OnActionModeStateChangedListener) getActivity()
: null,
- CallLogCache.getCallLogCache(getActivity()),
+ new CallLogCache(getActivity()),
mContactInfoCache,
getVoicemailPlaybackPresenter(),
new FilteredNumberAsyncQueryHandler(getActivity()),
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 27aa82577..884d07d50 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -353,7 +353,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
View.OnClickListener expandCollapseListener,
VoicemailPlaybackPresenter voicemailPlaybackPresenter) {
Resources resources = context.getResources();
- CallLogCache callLogCache = CallLogCache.getCallLogCache(context);
+ CallLogCache callLogCache = new CallLogCache(context);
PhoneCallDetailsHelper phoneCallDetailsHelper =
new PhoneCallDetailsHelper(context, resources, callLogCache);
diff --git a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
index 2e7c9339a..15de14318 100644
--- a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
+++ b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
@@ -19,8 +19,14 @@ package com.android.dialer.app.calllog.calllogcache;
import android.content.Context;
import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
+import android.text.TextUtils;
+import android.util.ArrayMap;
import com.android.dialer.app.calllog.CallLogAdapter;
+import com.android.dialer.calllogutils.PhoneAccountUtils;
+import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.CallUtil;
+import java.util.Map;
+import javax.annotation.concurrent.ThreadSafe;
/**
* This is the base class for the CallLogCaches.
@@ -31,7 +37,8 @@ import com.android.dialer.util.CallUtil;
*
* <p>This is designed with the specific use case of the {@link CallLogAdapter} in mind.
*/
-public abstract class CallLogCache {
+@ThreadSafe
+public class CallLogCache {
// TODO: Dialer should be fixed so as not to check isVoicemail() so often but at the time of
// this writing, that was a much larger undertaking than creating this cache.
@@ -39,17 +46,18 @@ public abstract class CallLogCache {
private boolean mHasCheckedForVideoAvailability;
private int mVideoAvailability;
+ private final Map<PhoneAccountHandle, String> mPhoneAccountLabelCache = new ArrayMap<>();
+ private final Map<PhoneAccountHandle, Integer> mPhoneAccountColorCache = new ArrayMap<>();
+ private final Map<PhoneAccountHandle, Boolean> mPhoneAccountCallWithNoteCache = new ArrayMap<>();
public CallLogCache(Context context) {
mContext = context;
}
- /** Return the most compatible version of the TelecomCallLogCache. */
- public static CallLogCache getCallLogCache(Context context) {
- return new CallLogCacheLollipopMr1(context);
- }
-
- public void reset() {
+ public synchronized void reset() {
+ mPhoneAccountLabelCache.clear();
+ mPhoneAccountColorCache.clear();
+ mPhoneAccountCallWithNoteCache.clear();
mHasCheckedForVideoAvailability = false;
mVideoAvailability = 0;
}
@@ -58,8 +66,13 @@ public abstract class CallLogCache {
* Returns true if the given number is the number of the configured voicemail. To be able to
* mock-out this, it is not a static method.
*/
- public abstract boolean isVoicemailNumber(
- PhoneAccountHandle accountHandle, @Nullable CharSequence number);
+ public synchronized boolean isVoicemailNumber(
+ PhoneAccountHandle accountHandle, @Nullable CharSequence number) {
+ if (TextUtils.isEmpty(number)) {
+ return false;
+ }
+ return TelecomUtil.isVoicemailNumber(mContext, accountHandle, number.toString());
+ }
/**
* Returns {@code true} when the current sim supports checking video calling capabilities via the
@@ -74,10 +87,26 @@ public abstract class CallLogCache {
}
/** Extract account label from PhoneAccount object. */
- public abstract String getAccountLabel(PhoneAccountHandle accountHandle);
+ public synchronized String getAccountLabel(PhoneAccountHandle accountHandle) {
+ if (mPhoneAccountLabelCache.containsKey(accountHandle)) {
+ return mPhoneAccountLabelCache.get(accountHandle);
+ } else {
+ String label = PhoneAccountUtils.getAccountLabel(mContext, accountHandle);
+ mPhoneAccountLabelCache.put(accountHandle, label);
+ return label;
+ }
+ }
/** Extract account color from PhoneAccount object. */
- public abstract int getAccountColor(PhoneAccountHandle accountHandle);
+ public synchronized int getAccountColor(PhoneAccountHandle accountHandle) {
+ if (mPhoneAccountColorCache.containsKey(accountHandle)) {
+ return mPhoneAccountColorCache.get(accountHandle);
+ } else {
+ Integer color = PhoneAccountUtils.getAccountColor(mContext, accountHandle);
+ mPhoneAccountColorCache.put(accountHandle, color);
+ return color;
+ }
+ }
/**
* Determines if the PhoneAccount supports specifying a call subject (i.e. calling with a note)
@@ -86,5 +115,14 @@ public abstract class CallLogCache {
* @param accountHandle The PhoneAccount handle.
* @return {@code true} if calling with a note is supported, {@code false} otherwise.
*/
- public abstract boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle);
+ public synchronized boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle) {
+ if (mPhoneAccountCallWithNoteCache.containsKey(accountHandle)) {
+ return mPhoneAccountCallWithNoteCache.get(accountHandle);
+ } else {
+ Boolean supportsCallWithNote =
+ PhoneAccountUtils.getAccountSupportsCallSubject(mContext, accountHandle);
+ mPhoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote);
+ return supportsCallWithNote;
+ }
+ }
}
diff --git a/java/com/android/dialer/app/calllog/calllogcache/CallLogCacheLollipopMr1.java b/java/com/android/dialer/app/calllog/calllogcache/CallLogCacheLollipopMr1.java
deleted file mode 100644
index 2424b6dbd..000000000
--- a/java/com/android/dialer/app/calllog/calllogcache/CallLogCacheLollipopMr1.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.app.calllog.calllogcache;
-
-import android.content.Context;
-import android.support.annotation.Nullable;
-import android.telecom.PhoneAccountHandle;
-import android.text.TextUtils;
-import android.util.ArrayMap;
-import com.android.dialer.calllogutils.PhoneAccountUtils;
-import com.android.dialer.telecom.TelecomUtil;
-import java.util.Map;
-
-/**
- * This is the CallLogCache for versions of dialer Lollipop Mr1 and above with support for multi-SIM
- * devices.
- *
- * <p>This class should not be initialized directly and instead be acquired from {@link
- * CallLogCache#getCallLogCache}.
- */
-class CallLogCacheLollipopMr1 extends CallLogCache {
-
- private final Map<PhoneAccountHandle, String> mPhoneAccountLabelCache = new ArrayMap<>();
- private final Map<PhoneAccountHandle, Integer> mPhoneAccountColorCache = new ArrayMap<>();
- private final Map<PhoneAccountHandle, Boolean> mPhoneAccountCallWithNoteCache = new ArrayMap<>();
-
- /* package */ CallLogCacheLollipopMr1(Context context) {
- super(context);
- }
-
- @Override
- public void reset() {
- mPhoneAccountLabelCache.clear();
- mPhoneAccountColorCache.clear();
- mPhoneAccountCallWithNoteCache.clear();
-
- super.reset();
- }
-
- @Override
- public boolean isVoicemailNumber(
- PhoneAccountHandle accountHandle, @Nullable CharSequence number) {
- if (TextUtils.isEmpty(number)) {
- return false;
- }
- return TelecomUtil.isVoicemailNumber(mContext, accountHandle, number.toString());
- }
-
- @Override
- public String getAccountLabel(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountLabelCache.containsKey(accountHandle)) {
- return mPhoneAccountLabelCache.get(accountHandle);
- } else {
- String label = PhoneAccountUtils.getAccountLabel(mContext, accountHandle);
- mPhoneAccountLabelCache.put(accountHandle, label);
- return label;
- }
- }
-
- @Override
- public int getAccountColor(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountColorCache.containsKey(accountHandle)) {
- return mPhoneAccountColorCache.get(accountHandle);
- } else {
- Integer color = PhoneAccountUtils.getAccountColor(mContext, accountHandle);
- mPhoneAccountColorCache.put(accountHandle, color);
- return color;
- }
- }
-
- @Override
- public boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountCallWithNoteCache.containsKey(accountHandle)) {
- return mPhoneAccountCallWithNoteCache.get(accountHandle);
- } else {
- Boolean supportsCallWithNote =
- PhoneAccountUtils.getAccountSupportsCallSubject(mContext, accountHandle);
- mPhoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote);
- return supportsCallWithNote;
- }
- }
-}
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
index eb4f8e967..30870eb39 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
@@ -62,6 +62,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
private String mPhoneNumberString;
private boolean isPinned;
private boolean isStarred;
+ private int position = -1;
public PhoneFavoriteTileView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -126,8 +127,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
CallSpecificAppData.Builder callSpecificAppData =
CallSpecificAppData.newBuilder()
.setCallInitiationType(CallInitiationType.Type.SPEED_DIAL)
- .setSpeedDialContactPosition(
- ((PhoneFavoriteListView) v.getParent()).getPositionForView(v));
+ .setSpeedDialContactPosition(position);
if (isStarred) {
callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.STARRED_CONTACT);
} else {
@@ -182,4 +182,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// Unlike Contacts' tiles, the Dialer's favorites tiles are square.
return false;
}
+
+ public void setPosition(int position) {
+ this.position = position;
+ }
}
diff --git a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
index 876fbf146..dbd601a7d 100644
--- a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
+++ b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
@@ -440,6 +440,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
tileView.setPhotoManager(mPhotoManager);
tileView.setListener(mListener);
tileView.loadFromContact(getItem(position));
+ tileView.setPosition(position);
return tileView;
}
diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
index b86ce8229..4100521ab 100644
--- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
+++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
@@ -21,6 +21,7 @@ import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager;
import android.support.v4.os.BuildCompat;
@@ -56,7 +57,17 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
LogUtil.i(
"LegacyVoicemailNotificationReceiver.onReceive", "received legacy voicemail notification");
- Assert.checkArgument(BuildCompat.isAtLeastO());
+ if (!BuildCompat.isAtLeastO()) {
+ LogUtil.e(
+ "LegacyVoicemailNotificationReceiver.onReceive",
+ "SDK not finalized: SDK_INT="
+ + Build.VERSION.SDK_INT
+ + ", PREVIEW_SDK_INT="
+ + Build.VERSION.PREVIEW_SDK_INT
+ + ", RELEASE="
+ + Build.VERSION.RELEASE);
+ return;
+ }
PhoneAccountHandle phoneAccountHandle =
Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE));
diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java
index 67c131af9..4d172235e 100644
--- a/java/com/android/incallui/video/impl/VideoCallFragment.java
+++ b/java/com/android/incallui/video/impl/VideoCallFragment.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Point;
import android.graphics.drawable.Animatable;
@@ -44,11 +45,11 @@ import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.View.OnLayoutChangeListener;
import android.view.View.OnSystemUiVisibilityChangeListener;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewOutlineProvider;
-import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -59,7 +60,6 @@ import android.widget.TextView;
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.common.concurrent.ThreadUtil;
import com.android.dialer.compat.ActivityCompat;
import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment;
import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter;
@@ -123,9 +123,6 @@ public class VideoCallFragment extends Fragment
}
};
- // Must use a named method reference as otherwise they do not match.
- // https://stackoverflow.com/questions/28190304/two-exact-method-references-are-not-equal
- private final Runnable updatePreviewVideoIfSafe = this::updatePreviewVideoScaling;
private InCallScreenDelegate inCallScreenDelegate;
private VideoCallScreenDelegate videoCallScreenDelegate;
private InCallButtonUiDelegate inCallButtonUiDelegate;
@@ -257,25 +254,43 @@ public class VideoCallFragment extends Fragment
greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background);
fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background);
- // We need the texture view size to be able to scale the remote video. At this point the view
- // layout won't be complete so add a layout listener.
- ViewTreeObserver observer = remoteTextureView.getViewTreeObserver();
- observer.addOnGlobalLayoutListener(
- new ViewTreeObserver.OnGlobalLayoutListener() {
+ remoteTextureView.addOnLayoutChangeListener(
+ new OnLayoutChangeListener() {
@Override
- public void onGlobalLayout() {
- LogUtil.i("VideoCallFragment.onGlobalLayout", null);
+ public void onLayoutChange(
+ View v,
+ int left,
+ int top,
+ int right,
+ int bottom,
+ int oldLeft,
+ int oldTop,
+ int oldRight,
+ int oldBottom) {
+ LogUtil.i("VideoCallFragment.onLayoutChange", "remoteTextureView layout changed");
updateRemoteVideoScaling();
- updatePreviewVideoScaling();
- updateVideoOffViews();
- // Remove the listener so we don't continually re-layout.
- ViewTreeObserver observer = remoteTextureView.getViewTreeObserver();
- if (observer.isAlive()) {
- observer.removeOnGlobalLayoutListener(this);
- }
+ updateRemoteOffView();
}
});
+ previewTextureView.addOnLayoutChangeListener(
+ new OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(
+ View v,
+ int left,
+ int top,
+ int right,
+ int bottom,
+ int oldLeft,
+ int oldTop,
+ int oldRight,
+ int oldBottom) {
+ LogUtil.i("VideoCallFragment.onLayoutChange", "previewTextureView layout changed");
+ fixPreviewRotation();
+ updatePreviewOffView();
+ }
+ });
return view;
}
@@ -354,9 +369,6 @@ public class VideoCallFragment extends Fragment
super.onPause();
LogUtil.i("VideoCallFragment.onPause", null);
inCallScreenDelegate.onInCallScreenPaused();
-
- // If this is scheduled we should remove it
- ThreadUtil.getUiThreadHandler().removeCallbacks(updatePreviewVideoIfSafe);
}
@Override
@@ -461,7 +473,7 @@ public class VideoCallFragment extends Fragment
View view = getView();
if (view != null) {
// Code is more expressive with all flags present, even though some may be combined
- //noinspection PointlessBitwiseExpression
+ // noinspection PointlessBitwiseExpression
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
}
@@ -662,15 +674,19 @@ public class VideoCallFragment extends Fragment
"showPreview: %b, shouldShowRemote: %b",
shouldShowPreview,
shouldShowRemote);
- this.shouldShowPreview = shouldShowPreview;
- this.shouldShowRemote = shouldShowRemote;
- this.isRemotelyHeld = isRemotelyHeld;
videoCallScreenDelegate.getLocalVideoSurfaceTexture().attachToTextureView(previewTextureView);
videoCallScreenDelegate.getRemoteVideoSurfaceTexture().attachToTextureView(remoteTextureView);
- updateVideoOffViews();
- updateRemoteVideoScaling();
+ this.isRemotelyHeld = isRemotelyHeld;
+ if (this.shouldShowRemote != shouldShowRemote) {
+ this.shouldShowRemote = shouldShowRemote;
+ updateRemoteOffView();
+ }
+ if (this.shouldShowPreview != shouldShowPreview) {
+ this.shouldShowPreview = shouldShowPreview;
+ updatePreviewOffView();
+ }
}
@Override
@@ -732,7 +748,6 @@ public class VideoCallFragment extends Fragment
} else {
exitFullscreenMode();
}
- updateVideoOffViews();
OnHoldFragment onHoldFragment =
((OnHoldFragment)
@@ -949,31 +964,15 @@ public class VideoCallFragment extends Fragment
// Do nothing
}
- private void updatePreviewVideoScaling() {
- if (previewTextureView.getWidth() == 0 || previewTextureView.getHeight() == 0) {
- LogUtil.i("VideoCallFragment.updatePreviewVideoScaling", "view layout hasn't finished yet");
- return;
- }
- VideoSurfaceTexture localVideoSurfaceTexture =
- videoCallScreenDelegate.getLocalVideoSurfaceTexture();
- Point cameraDimensions = localVideoSurfaceTexture.getSurfaceDimensions();
- if (cameraDimensions == null) {
- LogUtil.i(
- "VideoCallFragment.updatePreviewVideoScaling", "camera dimensions haven't been set");
- return;
- }
- if (isLandscape()) {
- VideoSurfaceBindings.scaleVideoAndFillView(
- previewTextureView,
- cameraDimensions.x,
- cameraDimensions.y,
- videoCallScreenDelegate.getDeviceOrientation());
- } else {
- VideoSurfaceBindings.scaleVideoAndFillView(
- previewTextureView,
- cameraDimensions.y,
- cameraDimensions.x,
- videoCallScreenDelegate.getDeviceOrientation());
+ private void fixPreviewRotation() {
+ int rotationDegrees = getRotationDegrees();
+ if (rotationDegrees == 90 || rotationDegrees == 270) {
+ int viewWidth = previewTextureView.getWidth();
+ int viewHeight = previewTextureView.getHeight();
+ Matrix transform = new Matrix();
+ // Multiplying by -1 prevents the image from being upside down in landscape mode.
+ transform.postRotate(rotationDegrees * -1.0f, viewWidth / 2.0f, viewHeight / 2.0f);
+ previewTextureView.setTransform(transform);
}
}
@@ -1010,6 +1009,22 @@ public class VideoCallFragment extends Fragment
return rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270;
}
+ private int getRotationDegrees() {
+ int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();
+ switch (rotation) {
+ case Surface.ROTATION_0:
+ return 0;
+ case Surface.ROTATION_90:
+ return 90;
+ case Surface.ROTATION_180:
+ return 180;
+ case Surface.ROTATION_270:
+ return 270;
+ default:
+ throw Assert.createAssertionFailException("unsupported rotation: " + rotation);
+ }
+ }
+
private void enterGreenScreenMode() {
LogUtil.i("VideoCallFragment.enterGreenScreenMode", null);
RelativeLayout.LayoutParams params =
@@ -1019,7 +1034,6 @@ public class VideoCallFragment extends Fragment
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
previewTextureView.setLayoutParams(params);
previewTextureView.setOutlineProvider(null);
- updatePreviewVideoScaling();
updateOverlayBackground();
contactGridManager.setIsMiddleRowVisible(true);
updateMutePreviewOverlayVisibility();
@@ -1055,12 +1069,11 @@ public class VideoCallFragment extends Fragment
previewOffBlurredImageView.setLayoutParams(params);
previewOffBlurredImageView.setOutlineProvider(circleOutlineProvider);
previewOffBlurredImageView.setClipToOutline(true);
-
- // Wait until the layout pass has finished before updating the scaling
- ThreadUtil.postOnUiThread(updatePreviewVideoIfSafe);
}
- private void updateVideoOffViews() {
+ private void updatePreviewOffView() {
+ LogUtil.enterBlock("VideoCallFragment.updatePreviewOffView");
+
// Always hide the preview off and remote off views in green screen mode.
boolean previewEnabled = isInGreenScreenMode || shouldShowPreview;
previewOffOverlay.setVisibility(previewEnabled ? View.GONE : View.VISIBLE);
@@ -1070,7 +1083,10 @@ public class VideoCallFragment extends Fragment
shouldShowPreview,
BLUR_PREVIEW_RADIUS,
BLUR_PREVIEW_SCALE_FACTOR);
+ }
+ private void updateRemoteOffView() {
+ LogUtil.enterBlock("VideoCallFragment.updateRemoteOffView");
boolean remoteEnabled = isInGreenScreenMode || shouldShowRemote;
boolean isResumed = remoteEnabled && !isRemotelyHeld;
if (isResumed) {
@@ -1097,7 +1113,6 @@ public class VideoCallFragment extends Fragment
isRemotelyHeld ? R.string.videocall_remotely_held : R.string.videocall_remote_video_off);
remoteVideoOff.setVisibility(View.VISIBLE);
}
- LogUtil.i("VideoCallFragment.updateVideoOffViews", "calling updateBlurredImageView");
updateBlurredImageView(
remoteTextureView,
remoteOffBlurredImageView,
@@ -1125,6 +1140,8 @@ public class VideoCallFragment extends Fragment
int width = Math.round(textureView.getWidth() * scaleFactor);
int height = Math.round(textureView.getHeight() * scaleFactor);
+ LogUtil.i("VideoCallFragment.updateBlurredImageView", "width: %d, height: %d", width, height);
+
// This call takes less than 10 milliseconds.
Bitmap bitmap = textureView.getBitmap(width, height);
@@ -1261,4 +1278,4 @@ public class VideoCallFragment extends Fragment
}
}
}
-//LINT.ThenChange(//depot/google3/third_party/java_src/android_app/dialer/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java)
+// LINT.ThenChange(//depot/google3/third_party/java_src/android_app/dialer/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java)
diff --git a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
index 8cac40229..1af7dff4f 100644
--- a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
+++ b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
@@ -67,9 +67,6 @@ public class VideoSurfaceTextureImpl implements VideoSurfaceTexture {
"VideoSurfaceTextureImpl.setSurfaceDimensions",
"surfaceDimensions: " + surfaceDimensions + " " + toString());
this.surfaceDimensions = surfaceDimensions;
- if (surfaceDimensions != null && savedSurfaceTexture != null) {
- savedSurfaceTexture.setDefaultBufferSize(surfaceDimensions.x, surfaceDimensions.y);
- }
}
@Override