Merge "Ensure we clear magnification specs on non-magnifiable containers."

This commit is contained in:
Treehugger Robot
2019-12-30 07:37:31 +00:00
committed by Gerrit Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -4807,7 +4807,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
// Re-parent IME's SurfaceControl when MagnificationSpec changed.
updateImeParent();
applyMagnificationSpec(getPendingTransaction(), spec);
if (spec.scale != 1.0) {
applyMagnificationSpec(getPendingTransaction(), spec);
} else {
clearMagnificationSpec(getPendingTransaction());
}
getPendingTransaction().apply();
}

View File

@@ -137,6 +137,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
*/
private boolean mCommittedReparentToAnimationLeash;
private MagnificationSpec mLastMagnificationSpec;
WindowContainer(WindowManagerService wms) {
mWmService = wms;
mPendingTransaction = wms.mTransactionFactory.make();
@@ -1186,6 +1188,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
if (shouldMagnify()) {
t.setMatrix(mSurfaceControl, spec.scale, 0, 0, spec.scale)
.setPosition(mSurfaceControl, spec.offsetX, spec.offsetY);
mLastMagnificationSpec = spec;
} else {
for (int i = 0; i < mChildren.size(); i++) {
mChildren.get(i).applyMagnificationSpec(t, spec);
@@ -1193,6 +1196,17 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
}
void clearMagnificationSpec(Transaction t) {
if (mLastMagnificationSpec != null) {
t.setMatrix(mSurfaceControl, 1, 0, 0, 1)
.setPosition(mSurfaceControl, 0, 0);
}
mLastMagnificationSpec = null;
for (int i = 0; i < mChildren.size(); i++) {
mChildren.get(i).clearMagnificationSpec(t);
}
}
void prepareSurfaces() {
// If a leash has been set when the transaction was committed, then the leash reparent has
// been committed.