Merge "Replace MainWindowSizeChange transaction with applyWithNextDraw" into tm-dev
This commit is contained in:
@@ -504,13 +504,6 @@ class Task extends TaskFragment {
|
|||||||
*/
|
*/
|
||||||
boolean mInRemoveTask;
|
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 =
|
private final AnimatingActivityRegistry mAnimatingActivityRegistry =
|
||||||
new AnimatingActivityRegistry();
|
new AnimatingActivityRegistry();
|
||||||
|
|
||||||
@@ -4390,17 +4383,16 @@ class Task extends TaskFragment {
|
|||||||
leaf.setMainWindowSizeChangeTransaction(t, origin);
|
leaf.setMainWindowSizeChangeTransaction(t, origin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mMainWindowSizeChangeTransaction = t;
|
final WindowState w = getTopVisibleAppMainWindow();
|
||||||
mMainWindowSizeChangeTask = t == null ? null : origin;
|
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) {
|
void setActivityWindowingMode(int windowingMode) {
|
||||||
PooledConsumer c = PooledLambda.obtainConsumer(ActivityRecord::setWindowingMode,
|
PooledConsumer c = PooledLambda.obtainConsumer(ActivityRecord::setWindowingMode,
|
||||||
|
|||||||
@@ -5988,15 +5988,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
finishDrawing(null);
|
finishDrawing(null);
|
||||||
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
|
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
|
||||||
if (!useBLASTSync()) return;
|
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
|
@Override
|
||||||
@@ -6033,10 +6024,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
if (mRedrawForSyncReported) {
|
if (mRedrawForSyncReported) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Task task = getTask();
|
|
||||||
if (task != null && task.getMainWindowSizeChangeTransaction() != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return useBLASTSync();
|
return useBLASTSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -442,50 +442,6 @@ class WindowStateAnimator {
|
|||||||
return mService.useBLASTSync() && mWin.useBLASTSync();
|
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) {
|
void prepareSurfaceLocked(SurfaceControl.Transaction t) {
|
||||||
final WindowState w = mWin;
|
final WindowState w = mWin;
|
||||||
if (!hasSurface()) {
|
if (!hasSurface()) {
|
||||||
@@ -501,8 +457,6 @@ class WindowStateAnimator {
|
|||||||
|
|
||||||
computeShownFrameLocked();
|
computeShownFrameLocked();
|
||||||
|
|
||||||
setSurfaceBoundariesLocked(t);
|
|
||||||
|
|
||||||
if (w.isParentWindowHidden() || !w.isOnScreen()) {
|
if (w.isParentWindowHidden() || !w.isOnScreen()) {
|
||||||
hide(t, "prepareSurfaceLocked");
|
hide(t, "prepareSurfaceLocked");
|
||||||
mWallpaperControllerLocked.hideWallpapers(w);
|
mWallpaperControllerLocked.hideWallpapers(w);
|
||||||
|
|||||||
Reference in New Issue
Block a user