Merge "Replace MainWindowSizeChange transaction with applyWithNextDraw" into tm-dev

This commit is contained in:
Rob Carr
2022-03-07 16:05:05 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 75 deletions

View File

@@ -504,13 +504,6 @@ class Task extends TaskFragment {
*/
boolean mInRemoveTask;
// When non-null, this is a transaction that will get applied on the next frame returned after
// a relayout is requested from the client. While this is only valid on a leaf task; since the
// transaction can effect an ancestor task, this also needs to keep track of the ancestor task
// that this transaction manipulates because deferUntilFrame acts on individual surfaces.
SurfaceControl.Transaction mMainWindowSizeChangeTransaction;
Task mMainWindowSizeChangeTask;
private final AnimatingActivityRegistry mAnimatingActivityRegistry =
new AnimatingActivityRegistry();
@@ -4390,17 +4383,16 @@ class Task extends TaskFragment {
leaf.setMainWindowSizeChangeTransaction(t, origin);
return;
}
mMainWindowSizeChangeTransaction = t;
mMainWindowSizeChangeTask = t == null ? null : origin;
final WindowState w = getTopVisibleAppMainWindow();
if (w != null) {
w.applyWithNextDraw((d) -> {
d.merge(t);
});
} else {
t.apply();
}
}
SurfaceControl.Transaction getMainWindowSizeChangeTransaction() {
return mMainWindowSizeChangeTransaction;
}
Task getMainWindowSizeChangeTask() {
return mMainWindowSizeChangeTask;
}
void setActivityWindowingMode(int windowingMode) {
PooledConsumer c = PooledLambda.obtainConsumer(ActivityRecord::setWindowingMode,

View File

@@ -5988,15 +5988,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
finishDrawing(null);
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
if (!useBLASTSync()) return;
final Task task = getTask();
if (task != null) {
final SurfaceControl.Transaction t = task.getMainWindowSizeChangeTransaction();
if (t != null) {
mSyncTransaction.merge(t);
}
task.setMainWindowSizeChangeTransaction(null);
}
}
@Override
@@ -6033,10 +6024,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (mRedrawForSyncReported) {
return false;
}
final Task task = getTask();
if (task != null && task.getMainWindowSizeChangeTransaction() != null) {
return true;
}
return useBLASTSync();
}

View File

@@ -442,50 +442,6 @@ class WindowStateAnimator {
return mService.useBLASTSync() && mWin.useBLASTSync();
}
private boolean shouldConsumeMainWindowSizeTransaction() {
// We only consume the transaction when the client is calling relayout
// because this is the only time we know the frameNumber will be valid
// due to the client renderer being paused. Put otherwise, only when
// mInRelayout is true can we guarantee the next frame will contain
// the most recent configuration.
if (!mWin.mInRelayout) return false;
// Since we can only do this for one window, we focus on the main application window
if (mAttrType != TYPE_BASE_APPLICATION) return false;
final Task task = mWin.getTask();
if (task == null) return false;
if (task.getMainWindowSizeChangeTransaction() == null) return false;
// Likewise we only focus on the task root, since we can only use one window
if (!mWin.mActivityRecord.isRootOfTask()) return false;
return true;
}
void setSurfaceBoundariesLocked(SurfaceControl.Transaction t) {
if (mSurfaceController == null) {
return;
}
final WindowState w = mWin;
final Task task = w.getTask();
if (shouldConsumeMainWindowSizeTransaction()) {
if (isInBlastSync()) {
// If we're in a sync transaction, there's no need to call defer transaction.
// The sync transaction will contain the buffer so the bounds change transaction
// will only be applied with the buffer.
t.merge(task.getMainWindowSizeChangeTransaction());
task.setMainWindowSizeChangeTransaction(null);
} else {
mWin.applyWithNextDraw(finishedFrame -> {
final SurfaceControl.Transaction sizeChangedTransaction =
task.getMainWindowSizeChangeTransaction();
if (sizeChangedTransaction != null) {
finishedFrame.merge(sizeChangedTransaction);
task.setMainWindowSizeChangeTransaction(null);
}
});
}
}
}
void prepareSurfaceLocked(SurfaceControl.Transaction t) {
final WindowState w = mWin;
if (!hasSurface()) {
@@ -501,8 +457,6 @@ class WindowStateAnimator {
computeShownFrameLocked();
setSurfaceBoundariesLocked(t);
if (w.isParentWindowHidden() || !w.isOnScreen()) {
hide(t, "prepareSurfaceLocked");
mWallpaperControllerLocked.hideWallpapers(w);