Let the client set transform hint on its own
This is a step to move the layout logic to the client side. We won't invoke IWindowSession#relayout then. Bug: 161810301 Test: atest WmTests Change-Id: Ib5ac048a573907af0a81f3e228575d9458862cfd
This commit is contained in:
parent
80d665bbbc
commit
5242af609e
@ -271,6 +271,7 @@ public abstract class WallpaperService extends Service {
|
||||
private Display mDisplay;
|
||||
private Context mDisplayContext;
|
||||
private int mDisplayState;
|
||||
private @Surface.Rotation int mDisplayInstallOrientation;
|
||||
private float mWallpaperDimAmount = 0.05f;
|
||||
|
||||
SurfaceControl mSurfaceControl = new SurfaceControl();
|
||||
@ -1082,6 +1083,11 @@ public abstract class WallpaperService extends Service {
|
||||
mWindow, mLayout, mWidth, mHeight,
|
||||
View.VISIBLE, 0, -1, mWinFrames, mMergedConfiguration, mSurfaceControl,
|
||||
mInsetsState, mTempControls, mSurfaceSize);
|
||||
|
||||
final int transformHint = SurfaceControl.rotationToBufferTransform(
|
||||
(mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
|
||||
mSurfaceControl.setTransformHint(transformHint);
|
||||
|
||||
if (mSurfaceControl.isValid()) {
|
||||
if (mBbqSurfaceControl == null) {
|
||||
mBbqSurfaceControl = new SurfaceControl.Builder()
|
||||
@ -1095,9 +1101,9 @@ public abstract class WallpaperService extends Service {
|
||||
.build();
|
||||
updateSurfaceDimming();
|
||||
}
|
||||
// Propagate transform hint from WM so we can use the right hint for the
|
||||
// Propagate transform hint from WM, so we can use the right hint for the
|
||||
// first frame.
|
||||
mBbqSurfaceControl.setTransformHint(mSurfaceControl.getTransformHint());
|
||||
mBbqSurfaceControl.setTransformHint(transformHint);
|
||||
Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x,
|
||||
mSurfaceSize.y, mFormat);
|
||||
// If blastSurface == null that means it hasn't changed since the last
|
||||
@ -1335,6 +1341,7 @@ public abstract class WallpaperService extends Service {
|
||||
mWallpaperDimAmount = mDisplayContext.getResources().getFloat(
|
||||
com.android.internal.R.dimen.config_wallpaperDimAmount);
|
||||
mDisplayState = mDisplay.getState();
|
||||
mDisplayInstallOrientation = mDisplay.getInstallOrientation();
|
||||
|
||||
if (DEBUG) Log.v(TAG, "onCreate(): " + this);
|
||||
onCreate(mSurfaceHolder);
|
||||
|
@ -927,6 +927,18 @@ public final class Display {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the install orientation of the display.
|
||||
* @hide
|
||||
*/
|
||||
@Surface.Rotation
|
||||
public int getInstallOrientation() {
|
||||
synchronized (mLock) {
|
||||
updateDisplayInfoLocked();
|
||||
return mDisplayInfo.installOrientation;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getRotation}
|
||||
* @return orientation of this display.
|
||||
|
@ -391,6 +391,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final DisplayManager mDisplayManager;
|
||||
final String mBasePackageName;
|
||||
|
||||
private @Surface.Rotation int mDisplayInstallOrientation;
|
||||
|
||||
final int[] mTmpLocation = new int[2];
|
||||
|
||||
final TypedValue mTmpValue = new TypedValue();
|
||||
@ -1017,6 +1019,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mView = view;
|
||||
|
||||
mAttachInfo.mDisplayState = mDisplay.getState();
|
||||
mDisplayInstallOrientation = mDisplay.getInstallOrientation();
|
||||
mViewLayoutDirectionInitial = mView.getRawLayoutDirection();
|
||||
mFallbackEventHandler.setView(view);
|
||||
mWindowAttributes.copyFrom(attrs);
|
||||
@ -7898,6 +7901,10 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
|
||||
mTempControls, mSurfaceSize);
|
||||
|
||||
final int transformHint = SurfaceControl.rotationToBufferTransform(
|
||||
(mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
|
||||
mSurfaceControl.setTransformHint(transformHint);
|
||||
|
||||
if (mAttachInfo.mContentCaptureManager != null) {
|
||||
MainContentCaptureSession mainSession = mAttachInfo.mContentCaptureManager
|
||||
.getMainContentCaptureSession();
|
||||
@ -7916,7 +7923,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
|
||||
mAttachInfo.mThreadedRenderer.setBlastBufferQueue(mBlastBufferQueue);
|
||||
}
|
||||
int transformHint = mSurfaceControl.getTransformHint();
|
||||
if (mPreviousTransformHint != transformHint) {
|
||||
mPreviousTransformHint = transformHint;
|
||||
dispatchTransformHintChanged(transformHint);
|
||||
|
@ -805,12 +805,6 @@
|
||||
"group": "WM_DEBUG_REMOTE_ANIMATIONS",
|
||||
"at": "com\/android\/server\/wm\/RemoteAnimationController.java"
|
||||
},
|
||||
"-1248290210": {
|
||||
"message": "Passing transform hint %d for window %s",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_ORIENTATION",
|
||||
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
||||
},
|
||||
"-1228653755": {
|
||||
"message": "Launch on display check: displayId=%d callingPid=%d callingUid=%d",
|
||||
"level": "DEBUG",
|
||||
|
@ -2430,14 +2430,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
configChanged = displayContent.updateOrientation();
|
||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||
|
||||
final DisplayInfo displayInfo = win.getDisplayInfo();
|
||||
final int transformHint = (displayInfo.rotation + displayInfo.installOrientation) % 4;
|
||||
outSurfaceControl.setTransformHint(
|
||||
SurfaceControl.rotationToBufferTransform(transformHint));
|
||||
ProtoLog.v(WM_DEBUG_ORIENTATION,
|
||||
"Passing transform hint %d for window %s",
|
||||
transformHint, win);
|
||||
|
||||
if (toBeDisplayed && win.mIsWallpaper) {
|
||||
displayContent.mWallpaperController.updateWallpaperOffset(win, false /* sync */);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user