Skip to content
Snippets Groups Projects
Commit 4de2fbdd authored by Patrick Williams's avatar Patrick Williams Committed by Android (Google) Code Review
Browse files

Merge "Update ViewRootImpl#getBufferTransformHint to use display rotation" into main

parents 4ecb85fd 65507cbb
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,7 @@ import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodCl
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER;
 
import static com.android.input.flags.Flags.enablePointerChoreographer;
import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay;
 
import android.Manifest;
import android.accessibilityservice.AccessibilityService;
......@@ -997,8 +998,6 @@ public final class ViewRootImpl implements ViewParent,
*/
private final boolean mViewBoundsSandboxingEnabled;
 
private int mLastTransformHint = Integer.MIN_VALUE;
private AccessibilityWindowAttributes mAccessibilityWindowAttributes;
 
/*
......@@ -8918,11 +8917,13 @@ public final class ViewRootImpl implements ViewParent,
 
final int transformHint = SurfaceControl.rotationToBufferTransform(
(mDisplay.getInstallOrientation() + mDisplay.getRotation()) % 4);
final boolean transformHintChanged = transformHint != mPreviousTransformHint;
mPreviousTransformHint = transformHint;
mSurfaceControl.setTransformHint(transformHint);
 
WindowLayout.computeSurfaceSize(mWindowAttributes, winConfig.getMaxBounds(), requestedWidth,
requestedHeight, mWinFrameInScreen, mPendingDragResizing, mSurfaceSize);
 
final boolean transformHintChanged = transformHint != mLastTransformHint;
final boolean sizeChanged = !mLastSurfaceSize.equals(mSurfaceSize);
final boolean surfaceControlChanged =
(relayoutResult & RELAYOUT_RES_SURFACE_CHANGED) == RELAYOUT_RES_SURFACE_CHANGED;
......@@ -8951,10 +8952,6 @@ public final class ViewRootImpl implements ViewParent,
}
}
 
mLastTransformHint = transformHint;
mSurfaceControl.setTransformHint(transformHint);
if (mAttachInfo.mContentCaptureManager != null) {
ContentCaptureSession mainSession = mAttachInfo.mContentCaptureManager
.getMainContentCaptureSession();
......@@ -8968,8 +8965,7 @@ public final class ViewRootImpl implements ViewParent,
mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl, mBlastBufferQueue);
}
mHdrRenderState.forceUpdateHdrSdrRatio();
if (mPreviousTransformHint != transformHint) {
mPreviousTransformHint = transformHint;
if (transformHintChanged) {
dispatchTransformHintChanged(transformHint);
}
} else {
......@@ -11933,6 +11929,14 @@ public final class ViewRootImpl implements ViewParent,
 
@Override
public @SurfaceControl.BufferTransform int getBufferTransformHint() {
// TODO(b/326482114) We use mPreviousTransformHint (calculated using mDisplay's rotation)
// instead of mSurfaceControl#getTransformHint because there's a race where SurfaceFlinger
// can set an incorrect transform hint for a few frames before it is aware of the updated
// display rotation.
if (enableBufferTransformHintFromDisplay()) {
return mPreviousTransformHint;
}
if (mSurfaceControl.isValid()) {
return mSurfaceControl.getTransformHint();
} else {
......
......@@ -81,3 +81,14 @@ flag {
is_fixed_read_only: true
bug: "321263247"
}
flag {
namespace: "window_surfaces"
name: "enable_buffer_transform_hint_from_display"
description: "Always use display info to determine VRI's buffer transform hint"
is_fixed_read_only: true
bug: "301238858"
metadata {
purpose: PURPOSE_BUGFIX
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment