Merge "Send size-compat scale to the client" into tm-qpr-dev
This commit is contained in:
@@ -88,6 +88,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase
|
||||
final InsetsState mOutInsetsState = new InsetsState();
|
||||
final InsetsSourceControl[] mOutControls = new InsetsSourceControl[0];
|
||||
final Rect mOutAttachedFrame = new Rect();
|
||||
final float[] mOutSizeCompatScale = { 1f };
|
||||
|
||||
TestWindow() {
|
||||
mLayoutParams.setTitle(TestWindow.class.getName());
|
||||
@@ -106,7 +107,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase
|
||||
long startTime = SystemClock.elapsedRealtimeNanos();
|
||||
session.addToDisplay(this, mLayoutParams, View.VISIBLE,
|
||||
Display.DEFAULT_DISPLAY, mRequestedVisibilities, inputChannel,
|
||||
mOutInsetsState, mOutControls, mOutAttachedFrame);
|
||||
mOutInsetsState, mOutControls, mOutAttachedFrame, mOutSizeCompatScale);
|
||||
final long elapsedTimeNsOfAdd = SystemClock.elapsedRealtimeNanos() - startTime;
|
||||
state.addExtraResult("add", elapsedTimeNsOfAdd);
|
||||
|
||||
|
||||
@@ -460,6 +460,15 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
|
||||
setDisplayWindowingMode(WINDOWING_MODE_UNDEFINED);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void scale(float scale) {
|
||||
mBounds.scale(scale);
|
||||
mMaxBounds.scale(scale);
|
||||
if (mAppBounds != null) {
|
||||
mAppBounds.scale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the fields from delta into this Configuration object, keeping
|
||||
* track of which ones have changed. Any undefined fields in {@code delta}
|
||||
|
||||
@@ -551,12 +551,7 @@ public class CompatibilityInfo implements Parcelable {
|
||||
if (isScalingRequired()) {
|
||||
float invertedRatio = applicationInvertedScale;
|
||||
inoutConfig.densityDpi = (int)((inoutConfig.densityDpi * invertedRatio) + .5f);
|
||||
inoutConfig.windowConfiguration.getMaxBounds().scale(invertedRatio);
|
||||
inoutConfig.windowConfiguration.getBounds().scale(invertedRatio);
|
||||
final Rect appBounds = inoutConfig.windowConfiguration.getAppBounds();
|
||||
if (appBounds != null) {
|
||||
appBounds.scale(invertedRatio);
|
||||
}
|
||||
inoutConfig.windowConfiguration.scale(invertedRatio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1134,7 +1134,7 @@ public abstract class WallpaperService extends Service {
|
||||
|
||||
if (mSession.addToDisplay(mWindow, mLayout, View.VISIBLE,
|
||||
mDisplay.getDisplayId(), mRequestedVisibilities, inputChannel,
|
||||
mInsetsState, mTempControls, new Rect()) < 0) {
|
||||
mInsetsState, mTempControls, new Rect(), new float[1]) < 0) {
|
||||
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,15 +50,16 @@ interface IWindowSession {
|
||||
int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, in int layerStackId, in InsetsVisibilities requestedVisibilities,
|
||||
out InputChannel outInputChannel, out InsetsState insetsState,
|
||||
out InsetsSourceControl[] activeControls, out Rect attachedFrame);
|
||||
out InsetsSourceControl[] activeControls, out Rect attachedFrame,
|
||||
out float[] sizeCompatScale);
|
||||
int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, in int layerStackId, in int userId,
|
||||
in InsetsVisibilities requestedVisibilities, out InputChannel outInputChannel,
|
||||
out InsetsState insetsState, out InsetsSourceControl[] activeControls,
|
||||
out Rect attachedFrame);
|
||||
out Rect attachedFrame, out float[] sizeCompatScale);
|
||||
int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs,
|
||||
in int viewVisibility, in int layerStackId, out InsetsState insetsState,
|
||||
out Rect attachedFrame);
|
||||
out Rect attachedFrame, out float[] sizeCompatScale);
|
||||
@UnsupportedAppUsage
|
||||
void remove(IWindow window);
|
||||
|
||||
|
||||
@@ -695,6 +695,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
boolean mPendingAlwaysConsumeSystemBars;
|
||||
private final InsetsState mTempInsets = new InsetsState();
|
||||
private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE];
|
||||
private final WindowConfiguration mTempWinConfig = new WindowConfiguration();
|
||||
private float mInvSizeCompatScale = 1f;
|
||||
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
|
||||
= new ViewTreeObserver.InternalInsetsInfo();
|
||||
|
||||
@@ -1094,6 +1096,16 @@ public final class ViewRootImpl implements ViewParent,
|
||||
return mContext.getResources().getConfiguration();
|
||||
}
|
||||
|
||||
private WindowConfiguration getCompatWindowConfiguration() {
|
||||
final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
|
||||
if (mInvSizeCompatScale == 1f) {
|
||||
return winConfig;
|
||||
}
|
||||
mTempWinConfig.setTo(winConfig);
|
||||
mTempWinConfig.scale(mInvSizeCompatScale);
|
||||
return mTempWinConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* We have one child
|
||||
*/
|
||||
@@ -1224,10 +1236,11 @@ public final class ViewRootImpl implements ViewParent,
|
||||
controlInsetsForCompatibility(mWindowAttributes);
|
||||
|
||||
Rect attachedFrame = new Rect();
|
||||
final float[] sizeCompatScale = { 1f };
|
||||
res = mWindowSession.addToDisplayAsUser(mWindow, mWindowAttributes,
|
||||
getHostVisibility(), mDisplay.getDisplayId(), userId,
|
||||
mInsetsController.getRequestedVisibilities(), inputChannel, mTempInsets,
|
||||
mTempControls, attachedFrame);
|
||||
mTempControls, attachedFrame, sizeCompatScale);
|
||||
if (!attachedFrame.isValid()) {
|
||||
attachedFrame = null;
|
||||
}
|
||||
@@ -1237,6 +1250,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mTranslator.translateRectInScreenToAppWindow(attachedFrame);
|
||||
}
|
||||
mTmpFrames.attachedFrame = attachedFrame;
|
||||
mTmpFrames.sizeCompatScale = sizeCompatScale[0];
|
||||
mInvSizeCompatScale = 1f / sizeCompatScale[0];
|
||||
} catch (RemoteException e) {
|
||||
mAdded = false;
|
||||
mView = null;
|
||||
@@ -1259,7 +1274,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final InsetsState state = mInsetsController.getState();
|
||||
final Rect displayCutoutSafe = mTempRect;
|
||||
state.getDisplayCutoutSafe(displayCutoutSafe);
|
||||
final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
|
||||
final WindowConfiguration winConfig = getCompatWindowConfiguration();
|
||||
mWindowLayout.computeFrames(mWindowAttributes, state,
|
||||
displayCutoutSafe, winConfig.getBounds(), winConfig.getWindowingMode(),
|
||||
UNSPECIFIED_LENGTH, UNSPECIFIED_LENGTH,
|
||||
@@ -1749,19 +1764,24 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mTranslator.translateRectInScreenToAppWindow(displayFrame);
|
||||
mTranslator.translateRectInScreenToAppWindow(attachedFrame);
|
||||
}
|
||||
final float sizeCompatScale = frames.sizeCompatScale;
|
||||
final boolean frameChanged = !mWinFrame.equals(frame);
|
||||
final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration);
|
||||
final boolean attachedFrameChanged = LOCAL_LAYOUT
|
||||
&& !Objects.equals(mTmpFrames.attachedFrame, attachedFrame);
|
||||
final boolean displayChanged = mDisplay.getDisplayId() != displayId;
|
||||
final boolean resizeModeChanged = mResizeMode != resizeMode;
|
||||
final boolean sizeCompatScaleChanged = mTmpFrames.sizeCompatScale != sizeCompatScale;
|
||||
if (msg == MSG_RESIZED && !frameChanged && !configChanged && !attachedFrameChanged
|
||||
&& !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) {
|
||||
&& !displayChanged && !resizeModeChanged && !forceNextWindowRelayout
|
||||
&& !sizeCompatScaleChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPendingDragResizing = resizeMode != RESIZE_MODE_INVALID;
|
||||
mResizeMode = resizeMode;
|
||||
mTmpFrames.sizeCompatScale = sizeCompatScale;
|
||||
mInvSizeCompatScale = 1f / sizeCompatScale;
|
||||
|
||||
if (configChanged) {
|
||||
// If configuration changed - notify about that and, maybe, about move to display.
|
||||
@@ -8062,11 +8082,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
if (maybeSyncSeqId > 0) {
|
||||
mSyncSeqId = maybeSyncSeqId;
|
||||
}
|
||||
mInvSizeCompatScale = 1f / mTmpFrames.sizeCompatScale;
|
||||
|
||||
final int transformHint = SurfaceControl.rotationToBufferTransform(
|
||||
(mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
|
||||
|
||||
final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
|
||||
final WindowConfiguration winConfig = getCompatWindowConfiguration();
|
||||
WindowLayout.computeSurfaceSize(mWindowAttributes, winConfig.getMaxBounds(), requestedWidth,
|
||||
requestedHeight, mTmpFrames.frame, mPendingDragResizing, mSurfaceSize);
|
||||
|
||||
@@ -8169,7 +8190,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
private void setFrame(Rect frame) {
|
||||
mWinFrame.set(frame);
|
||||
|
||||
final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
|
||||
final WindowConfiguration winConfig = getCompatWindowConfiguration();
|
||||
mPendingBackDropFrame.set(mPendingDragResizing && !winConfig.useWindowFrameForBackdrop()
|
||||
? winConfig.getMaxBounds()
|
||||
: frame);
|
||||
|
||||
@@ -149,7 +149,8 @@ public class WindowlessWindowManager implements IWindowSession {
|
||||
public int addToDisplay(IWindow window, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, InsetsVisibilities requestedVisibilities,
|
||||
InputChannel outInputChannel, InsetsState outInsetsState,
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame) {
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
final SurfaceControl.Builder b = new SurfaceControl.Builder(mSurfaceSession)
|
||||
.setFormat(attrs.format)
|
||||
.setBLASTLayer()
|
||||
@@ -182,6 +183,7 @@ public class WindowlessWindowManager implements IWindowSession {
|
||||
mStateForWindow.put(window.asBinder(), state);
|
||||
}
|
||||
outAttachedFrame.set(0, 0, -1, -1);
|
||||
outSizeCompatScale[0] = 1f;
|
||||
|
||||
final int res = WindowManagerGlobal.ADD_OKAY | WindowManagerGlobal.ADD_FLAG_APP_VISIBLE |
|
||||
WindowManagerGlobal.ADD_FLAG_USE_BLAST;
|
||||
@@ -197,15 +199,18 @@ public class WindowlessWindowManager implements IWindowSession {
|
||||
public int addToDisplayAsUser(IWindow window, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, int userId, InsetsVisibilities requestedVisibilities,
|
||||
InputChannel outInputChannel, InsetsState outInsetsState,
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame) {
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
return addToDisplay(window, attrs, viewVisibility, displayId, requestedVisibilities,
|
||||
outInputChannel, outInsetsState, outActiveControls, outAttachedFrame);
|
||||
outInputChannel, outInsetsState, outActiveControls, outAttachedFrame,
|
||||
outSizeCompatScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDisplayWithoutInputChannel(android.view.IWindow window,
|
||||
android.view.WindowManager.LayoutParams attrs, int viewVisibility, int layerStackId,
|
||||
android.view.InsetsState insetsState, Rect outAttachedFrame) {
|
||||
android.view.InsetsState insetsState, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ public class ClientWindowFrames implements Parcelable {
|
||||
|
||||
public boolean isParentFrameClippedByDisplayCutout;
|
||||
|
||||
public float sizeCompatScale = 1f;
|
||||
|
||||
public ClientWindowFrames() {
|
||||
}
|
||||
|
||||
@@ -60,6 +62,7 @@ public class ClientWindowFrames implements Parcelable {
|
||||
attachedFrame = new Rect(other.attachedFrame);
|
||||
}
|
||||
isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout;
|
||||
sizeCompatScale = other.sizeCompatScale;
|
||||
}
|
||||
|
||||
private ClientWindowFrames(Parcel in) {
|
||||
@@ -73,6 +76,7 @@ public class ClientWindowFrames implements Parcelable {
|
||||
parentFrame.readFromParcel(in);
|
||||
attachedFrame = in.readTypedObject(Rect.CREATOR);
|
||||
isParentFrameClippedByDisplayCutout = in.readBoolean();
|
||||
sizeCompatScale = in.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,6 +86,7 @@ public class ClientWindowFrames implements Parcelable {
|
||||
parentFrame.writeToParcel(dest, flags);
|
||||
dest.writeTypedObject(attachedFrame, flags);
|
||||
dest.writeBoolean(isParentFrameClippedByDisplayCutout);
|
||||
dest.writeFloat(sizeCompatScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,7 +96,8 @@ public class ClientWindowFrames implements Parcelable {
|
||||
+ " display=" + displayFrame.toShortString(sb)
|
||||
+ " parentFrame=" + parentFrame.toShortString(sb)
|
||||
+ (attachedFrame != null ? " attachedFrame=" + attachedFrame.toShortString() : "")
|
||||
+ " parentClippedByDisplayCutout=" + isParentFrameClippedByDisplayCutout + "}";
|
||||
+ (isParentFrameClippedByDisplayCutout ? " parentClippedByDisplayCutout" : "")
|
||||
+ (sizeCompatScale != 1f ? " sizeCompatScale=" + sizeCompatScale : "") + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -228,12 +228,13 @@ public class TaskSnapshotWindow {
|
||||
|
||||
final InsetsState tmpInsetsState = new InsetsState();
|
||||
final InputChannel tmpInputChannel = new InputChannel();
|
||||
final float[] sizeCompatScale = { 1f };
|
||||
|
||||
try {
|
||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "TaskSnapshot#addToDisplay");
|
||||
final int res = session.addToDisplay(window, layoutParams, View.GONE, displayId,
|
||||
info.requestedVisibilities, tmpInputChannel, tmpInsetsState, tmpControls,
|
||||
new Rect());
|
||||
new Rect(), sizeCompatScale);
|
||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||
if (res < 0) {
|
||||
Slog.w(TAG, "Failed to add snapshot starting window res=" + res);
|
||||
|
||||
@@ -251,7 +251,7 @@ public class StartingSurfaceDrawerTests extends ShellTestCase {
|
||||
anyInt() /* viewVisibility */, anyInt() /* displayId */,
|
||||
any() /* requestedVisibility */, any() /* outInputChannel */,
|
||||
any() /* outInsetsState */, any() /* outActiveControls */,
|
||||
any() /* outAttachedFrame */);
|
||||
any() /* outAttachedFrame */, any() /* outSizeCompatScale */);
|
||||
TaskSnapshotWindow mockSnapshotWindow = TaskSnapshotWindow.create(windowInfo,
|
||||
mBinder,
|
||||
snapshot, mTestExecutor, () -> {
|
||||
|
||||
@@ -198,28 +198,31 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
|
||||
public int addToDisplay(IWindow window, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, InsetsVisibilities requestedVisibilities,
|
||||
InputChannel outInputChannel, InsetsState outInsetsState,
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame) {
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
return mService.addWindow(this, window, attrs, viewVisibility, displayId,
|
||||
UserHandle.getUserId(mUid), requestedVisibilities, outInputChannel, outInsetsState,
|
||||
outActiveControls, outAttachedFrame);
|
||||
outActiveControls, outAttachedFrame, outSizeCompatScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDisplayAsUser(IWindow window, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, int userId, InsetsVisibilities requestedVisibilities,
|
||||
InputChannel outInputChannel, InsetsState outInsetsState,
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame) {
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
return mService.addWindow(this, window, attrs, viewVisibility, displayId, userId,
|
||||
requestedVisibilities, outInputChannel, outInsetsState, outActiveControls,
|
||||
outAttachedFrame);
|
||||
outAttachedFrame, outSizeCompatScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDisplayWithoutInputChannel(IWindow window, WindowManager.LayoutParams attrs,
|
||||
int viewVisibility, int displayId, InsetsState outInsetsState, Rect outAttachedFrame) {
|
||||
int viewVisibility, int displayId, InsetsState outInsetsState, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
return mService.addWindow(this, window, attrs, viewVisibility, displayId,
|
||||
UserHandle.getUserId(mUid), mDummyRequestedVisibilities, null /* outInputChannel */,
|
||||
outInsetsState, mDummyControls, outAttachedFrame);
|
||||
outInsetsState, mDummyControls, outAttachedFrame, outSizeCompatScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1448,7 +1448,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public int addWindow(Session session, IWindow client, LayoutParams attrs, int viewVisibility,
|
||||
int displayId, int requestUserId, InsetsVisibilities requestedVisibilities,
|
||||
InputChannel outInputChannel, InsetsState outInsetsState,
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame) {
|
||||
InsetsSourceControl[] outActiveControls, Rect outAttachedFrame,
|
||||
float[] outSizeCompatScale) {
|
||||
Arrays.fill(outActiveControls, null);
|
||||
int[] appOp = new int[1];
|
||||
final boolean isRoundedCornerOverlay = (attrs.privateFlags
|
||||
@@ -1865,11 +1866,15 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
getInsetsSourceControls(win, outActiveControls);
|
||||
|
||||
if (win.mLayoutAttached) {
|
||||
outAttachedFrame.set(win.getParentWindow().getCompatFrame());
|
||||
outAttachedFrame.set(win.getParentWindow().getFrame());
|
||||
if (win.mInvGlobalScale != 1f) {
|
||||
outAttachedFrame.scale(win.mInvGlobalScale);
|
||||
}
|
||||
} else {
|
||||
// Make this invalid which indicates a null attached frame.
|
||||
outAttachedFrame.set(0, 0, -1, -1);
|
||||
}
|
||||
outSizeCompatScale[0] = win.getSizeCompatScale();
|
||||
}
|
||||
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
|
||||
@@ -472,11 +472,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
int mTouchableInsets = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME;
|
||||
|
||||
// Current transformation being applied.
|
||||
float mGlobalScale=1;
|
||||
float mInvGlobalScale=1;
|
||||
float mGlobalScale = 1f;
|
||||
float mInvGlobalScale = 1f;
|
||||
float mSizeCompatScale = 1f;
|
||||
final float mOverrideScale;
|
||||
float mHScale=1, mVScale=1;
|
||||
float mLastHScale=1, mLastVScale=1;
|
||||
float mHScale = 1f, mVScale = 1f;
|
||||
float mLastHScale = 1f, mLastVScale = 1f;
|
||||
|
||||
// An offset in pixel of the surface contents from the window position. Used for Wallpaper
|
||||
// to provide the effect of scrolling within a large surface. We just use these values as
|
||||
@@ -1252,18 +1253,19 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
void updateGlobalScale() {
|
||||
if (hasCompatScale()) {
|
||||
if (mOverrideScale != 1f) {
|
||||
mGlobalScale = mToken.hasSizeCompatBounds()
|
||||
? mToken.getSizeCompatScale() * mOverrideScale
|
||||
: mOverrideScale;
|
||||
} else {
|
||||
mGlobalScale = mToken.getSizeCompatScale();
|
||||
}
|
||||
mSizeCompatScale = (mOverrideScale == 1f || mToken.hasSizeCompatBounds())
|
||||
? mToken.getSizeCompatScale()
|
||||
: 1f;
|
||||
mGlobalScale = mSizeCompatScale * mOverrideScale;
|
||||
mInvGlobalScale = 1f / mGlobalScale;
|
||||
return;
|
||||
}
|
||||
|
||||
mGlobalScale = mInvGlobalScale = 1f;
|
||||
mGlobalScale = mInvGlobalScale = mSizeCompatScale = 1f;
|
||||
}
|
||||
|
||||
float getSizeCompatScale() {
|
||||
return mSizeCompatScale;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1354,7 +1356,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
windowFrames.mFrame.set(clientWindowFrames.frame);
|
||||
windowFrames.mDisplayFrame.set(clientWindowFrames.displayFrame);
|
||||
windowFrames.mParentFrame.set(clientWindowFrames.parentFrame);
|
||||
if (hasCompatScale()) {
|
||||
if (mGlobalScale != 1f) {
|
||||
// The frames sent from the client need to be adjusted to the real coordinate space.
|
||||
windowFrames.mFrame.scale(mGlobalScale);
|
||||
windowFrames.mDisplayFrame.scale(mGlobalScale);
|
||||
@@ -1366,7 +1368,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
windowFrames.mFrame.set(clientWindowFrames.frame);
|
||||
|
||||
windowFrames.mCompatFrame.set(windowFrames.mFrame);
|
||||
if (hasCompatScale()) {
|
||||
if (mInvGlobalScale != 1f) {
|
||||
// Also, the scaled frame that we report to the app needs to be adjusted to be in
|
||||
// its coordinate space.
|
||||
windowFrames.mCompatFrame.scale(mInvGlobalScale);
|
||||
@@ -1471,10 +1473,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return mWindowFrames.mParentFrame;
|
||||
}
|
||||
|
||||
Rect getCompatFrame() {
|
||||
return mWindowFrames.mCompatFrame;
|
||||
}
|
||||
|
||||
WindowManager.LayoutParams getAttrs() {
|
||||
return mAttrs;
|
||||
}
|
||||
@@ -1728,7 +1726,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
*/
|
||||
InsetsState getCompatInsetsState() {
|
||||
InsetsState state = getInsetsState();
|
||||
if (hasCompatScale()) {
|
||||
if (mInvGlobalScale != 1f) {
|
||||
state = new InsetsState(state, true);
|
||||
state.scale(mInvGlobalScale);
|
||||
}
|
||||
@@ -3837,15 +3835,19 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
boolean relayoutVisible) {
|
||||
outFrames.frame.set(mWindowFrames.mCompatFrame);
|
||||
outFrames.displayFrame.set(mWindowFrames.mDisplayFrame);
|
||||
if (mInvGlobalScale != 1.0f && hasCompatScale()) {
|
||||
if (mInvGlobalScale != 1f) {
|
||||
outFrames.displayFrame.scale(mInvGlobalScale);
|
||||
}
|
||||
if (mLayoutAttached) {
|
||||
if (outFrames.attachedFrame == null) {
|
||||
outFrames.attachedFrame = new Rect();
|
||||
}
|
||||
outFrames.attachedFrame.set(getParentWindow().getCompatFrame());
|
||||
outFrames.attachedFrame.set(getParentWindow().getFrame());
|
||||
if (mInvGlobalScale != 1f) {
|
||||
outFrames.attachedFrame.scale(mInvGlobalScale);
|
||||
}
|
||||
}
|
||||
outFrames.sizeCompatScale = mSizeCompatScale;
|
||||
|
||||
// Note: in the cases where the window is tied to an activity, we should not send a
|
||||
// configuration update when the window has requested to be hidden. Doing so can lead to
|
||||
@@ -4345,7 +4347,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
pw.println(prefix + "mHasSurface=" + mHasSurface
|
||||
+ " isReadyForDisplay()=" + isReadyForDisplay()
|
||||
+ " mWindowRemovalAllowed=" + mWindowRemovalAllowed);
|
||||
if (hasCompatScale()) {
|
||||
if (mInvGlobalScale != 1f) {
|
||||
pw.println(prefix + "mCompatFrame=" + mWindowFrames.mCompatFrame.toShortString(sTmpSB));
|
||||
}
|
||||
if (dumpAll) {
|
||||
@@ -4557,7 +4559,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
float translateToWindowX(float x) {
|
||||
float winX = x - mWindowFrames.mFrame.left;
|
||||
if (hasCompatScale()) {
|
||||
if (mGlobalScale != 1f) {
|
||||
winX *= mGlobalScale;
|
||||
}
|
||||
return winX;
|
||||
@@ -4565,7 +4567,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
float translateToWindowY(float y) {
|
||||
float winY = y - mWindowFrames.mFrame.top;
|
||||
if (hasCompatScale()) {
|
||||
if (mGlobalScale != 1f) {
|
||||
winY *= mGlobalScale;
|
||||
}
|
||||
return winY;
|
||||
|
||||
@@ -2003,7 +2003,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
anyInt() /* viewVisibility */, anyInt() /* displayId */,
|
||||
any() /* requestedVisibilities */, any() /* outInputChannel */,
|
||||
any() /* outInsetsState */, any() /* outActiveControls */,
|
||||
any() /* outAttachedFrame */);
|
||||
any() /* outAttachedFrame */, any() /* outSizeCompatScale */);
|
||||
mAtm.mWindowManager.mStartingSurfaceController
|
||||
.createTaskSnapshotSurface(activity, snapshot);
|
||||
} catch (RemoteException ignored) {
|
||||
|
||||
@@ -283,7 +283,7 @@ public class WindowManagerServiceTests extends WindowTestsBase {
|
||||
|
||||
mWm.addWindow(session, new TestIWindow(), params, View.VISIBLE, DEFAULT_DISPLAY,
|
||||
UserHandle.USER_SYSTEM, new InsetsVisibilities(), null, new InsetsState(),
|
||||
new InsetsSourceControl[0], new Rect());
|
||||
new InsetsSourceControl[0], new Rect(), new float[1]);
|
||||
|
||||
verify(mWm.mWindowContextListenerController, never()).registerWindowContainerListener(any(),
|
||||
any(), anyInt(), anyInt(), any());
|
||||
|
||||
Reference in New Issue
Block a user