Merge changes I5c2facba,I2fecbeaa,I045ddf19,I961d190d

* changes:
  Move frame validation logic for deferTransactionUntil.
  Handle surfaceInset changes with deferred transactions.
  Various pinned animation bug fixes.
  Nuke WindowState#mShownPosition. Rework mXOffset/mYOffset.
This commit is contained in:
TreeHugger Robot
2018-03-01 02:06:40 +00:00
committed by Android (Google) Code Review
13 changed files with 115 additions and 123 deletions

View File

@@ -763,18 +763,14 @@ public class SurfaceControl implements Parcelable {
}
public void deferTransactionUntil(IBinder handle, long frame) {
if (frame > 0) {
synchronized(SurfaceControl.class) {
sGlobalTransaction.deferTransactionUntil(this, handle, frame);
}
synchronized(SurfaceControl.class) {
sGlobalTransaction.deferTransactionUntil(this, handle, frame);
}
}
public void deferTransactionUntil(Surface barrier, long frame) {
if (frame > 0) {
synchronized(SurfaceControl.class) {
sGlobalTransaction.deferTransactionUntilSurface(this, barrier, frame);
}
synchronized(SurfaceControl.class) {
sGlobalTransaction.deferTransactionUntilSurface(this, barrier, frame);
}
}
@@ -1479,6 +1475,9 @@ public class SurfaceControl implements Parcelable {
public Transaction deferTransactionUntil(SurfaceControl sc, IBinder handle,
long frameNumber) {
if (frameNumber < 0) {
return this;
}
sc.checkNotReleased();
nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, handle, frameNumber);
return this;
@@ -1486,6 +1485,9 @@ public class SurfaceControl implements Parcelable {
public Transaction deferTransactionUntilSurface(SurfaceControl sc, Surface barrierSurface,
long frameNumber) {
if (frameNumber < 0) {
return this;
}
sc.checkNotReleased();
nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject,
barrierSurface.mNativeObject, frameNumber);

View File

@@ -6440,18 +6440,24 @@ public final class ViewRootImpl implements ViewParent,
params.backup();
mTranslator.translateWindowLayout(params);
}
if (params != null) {
if (DBG) Log.d(mTag, "WindowLayout in layoutWindow:" + params);
}
if (params != null && mOrigWindowType != params.type) {
// For compatibility with old apps, don't crash here.
if (mTargetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Slog.w(mTag, "Window type can not be changed after "
+ "the window is added; ignoring change of " + mView);
params.type = mOrigWindowType;
if (mOrigWindowType != params.type) {
// For compatibility with old apps, don't crash here.
if (mTargetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Slog.w(mTag, "Window type can not be changed after "
+ "the window is added; ignoring change of " + mView);
params.type = mOrigWindowType;
}
}
if (mSurface.isValid()) {
params.frameNumber = mSurface.getNextFrameNumber();
}
}
int relayoutResult = mWindowSession.relayout(
mWindow, mSeq, params,
(int) (mView.getMeasuredWidth() * appScale + 0.5f),

View File

@@ -2370,6 +2370,13 @@ public interface WindowManager extends ViewManager {
*/
public long hideTimeoutMilliseconds = -1;
/**
* A frame number in which changes requested in this layout will be rendered.
*
* @hide
*/
public long frameNumber = -1;
/**
* The color mode requested by this window. The target display may
* not be able to honor the request. When the color mode is not set
@@ -2543,6 +2550,7 @@ public interface WindowManager extends ViewManager {
TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
out.writeInt(mColorMode);
out.writeLong(hideTimeoutMilliseconds);
out.writeLong(frameNumber);
}
public static final Parcelable.Creator<LayoutParams> CREATOR
@@ -2599,6 +2607,7 @@ public interface WindowManager extends ViewManager {
accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
mColorMode = in.readInt();
hideTimeoutMilliseconds = in.readLong();
frameNumber = in.readLong();
}
@SuppressWarnings({"PointlessBitwiseExpression"})
@@ -2799,6 +2808,10 @@ public interface WindowManager extends ViewManager {
changes |= SURFACE_INSETS_CHANGED;
}
// The frame number changing is only relevant in the context of other
// changes, and so we don't need to track it with a flag.
frameNumber = o.frameNumber;
if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
hasManualSurfaceInsets = o.hasManualSurfaceInsets;
changes |= SURFACE_INSETS_CHANGED;