Merge "Preserve intended width/height for Blast adapter layers"

This commit is contained in:
Valerie Hau
2020-01-21 15:50:28 +00:00
committed by Android (Google) Code Review
9 changed files with 40 additions and 17 deletions

View File

@@ -31,6 +31,7 @@ import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
@@ -188,6 +189,7 @@ public abstract class WallpaperService extends Service {
DisplayCutout mDispatchedDisplayCutout = DisplayCutout.NO_CUTOUT;
final InsetsState mInsetsState = new InsetsState();
final MergedConfiguration mMergedConfiguration = new MergedConfiguration();
private final Point mSurfaceSize = new Point();
final WindowManager.LayoutParams mLayout
= new WindowManager.LayoutParams();
@@ -838,12 +840,13 @@ public abstract class WallpaperService extends Service {
} else {
mLayout.surfaceInsets.set(0, 0, 0, 0);
}
final int relayoutResult = mSession.relayout(
mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
View.VISIBLE, 0, -1, mWinFrame, mContentInsets,
mVisibleInsets, mStableInsets, mBackdropFrame,
mDisplayCutout, mMergedConfiguration, mSurfaceControl,
mInsetsState);
mInsetsState, mSurfaceSize);
if (mSurfaceControl.isValid()) {
mSurfaceHolder.mSurface.copyFrom(mSurfaceControl);
mSurfaceControl.release();

View File

@@ -18,6 +18,7 @@
package android.view;
import android.content.ClipData;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Bundle;
@@ -90,6 +91,7 @@ interface IWindowSession {
* since it was last displayed.
* @param outSurface Object in which is placed the new display surface.
* @param insetsState The current insets state in the system.
* @param outSurfaceSize The width and height of the surface control
*
* @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
* {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
@@ -101,7 +103,7 @@ interface IWindowSession {
out Rect outBackdropFrame,
out DisplayCutout.ParcelableWrapper displayCutout,
out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
out InsetsState insetsState);
out InsetsState insetsState, out Point outSurfaceSize);
/*
* Notify the window manager that an application is relaunching and

View File

@@ -436,6 +436,10 @@ public final class ViewRootImpl implements ViewParent,
FallbackEventHandler mFallbackEventHandler;
Choreographer mChoreographer;
// used in relayout to get SurfaceControl size
// for BLAST adapter surface setup
private final Point mSurfaceSize = new Point();
final Rect mTempRect; // used in the transaction to not thrash the heap.
final Rect mVisRect; // used to retrieve visible rect of focused view.
private final Rect mTempBoundsRect = new Rect(); // used to set the size of the bounds surface.
@@ -7333,14 +7337,13 @@ public final class ViewRootImpl implements ViewParent,
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber,
mTmpFrame, mPendingContentInsets, mPendingVisibleInsets,
mPendingStableInsets, mPendingBackDropFrame, mPendingDisplayCutout,
mPendingMergedConfiguration, mSurfaceControl, mTempInsets);
mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mSurfaceSize);
if (mSurfaceControl.isValid()) {
if (!WindowManagerGlobal.USE_BLAST_ADAPTER) {
mSurface.copyFrom(mSurfaceControl);
} else {
mSurface.transferFrom(getOrCreateBLASTSurface(
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
(int) (mView.getMeasuredHeight() * appScale + 0.5f)));
mSurface.transferFrom(getOrCreateBLASTSurface(mSurfaceSize.x,
mSurfaceSize.y));
}
} else {
destroySurface();

View File

@@ -18,6 +18,7 @@ package android.view;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.RemoteException;
@@ -159,7 +160,8 @@ public class WindowlessWindowManager implements IWindowSession {
Rect outFrame, Rect outContentInsets, Rect outVisibleInsets,
Rect outStableInsets, Rect outBackdropFrame,
DisplayCutout.ParcelableWrapper cutout, MergedConfiguration mergedConfiguration,
SurfaceControl outSurfaceControl, InsetsState outInsetsState) {
SurfaceControl outSurfaceControl, InsetsState outInsetsState,
Point outSurfaceSize) {
State state = null;
synchronized (this) {
state = mStateForWindow.get(window.asBinder());