WindowManager: Reapply magnification spec when adding windows.

Previously the magnification spec was effectively reapplied on each
frame when preparing surfaces. Following the migration to the hierarchy
it was thought this wasn't needed since parent hierarchy layers
would be magnified and Surfaces would receive them as they came and went.
It didn't end up quite so hunky-dory. While the app layer is magnified in whole,
the non app layer relies on magnification of individual windows to avoid magnifying
the navigation bar. Simply put this means we need to reapply magnification
when adding windows in addition to when the magnification spec changes.

Bug: 74221620
Test: Manual
Change-Id: Ifd17ecc837a9aa611ddc29e87aa95d2854b2af8e
This commit is contained in:
Robert Carr
2018-04-30 17:54:53 -07:00
parent 9411ab1589
commit 24be9ab639
2 changed files with 16 additions and 0 deletions

View File

@@ -393,6 +393,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
/** Temporary float array to retrieve 3x3 matrix values. */
private final float[] mTmpFloats = new float[9];
private MagnificationSpec mMagnificationSpec;
private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
WindowStateAnimator winAnimator = w.mWinAnimator;
final AppWindowToken atoken = w.mAppToken;
@@ -3837,10 +3839,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
}
void applyMagnificationSpec(MagnificationSpec spec) {
if (spec.scale != 1.0) {
mMagnificationSpec = spec;
} else {
mMagnificationSpec = null;
}
applyMagnificationSpec(getPendingTransaction(), spec);
getPendingTransaction().apply();
}
void reapplyMagnificationSpec() {
if (mMagnificationSpec != null) {
applyMagnificationSpec(getPendingTransaction(), mMagnificationSpec);
}
}
@Override
void onParentSet() {
// Since we are the top of the SurfaceControl hierarchy here

View File

@@ -808,6 +808,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
void onParentSet() {
super.onParentSet();
setDrawnStateEvaluated(false /*evaluated*/);
getDisplayContent().reapplyMagnificationSpec();
}
@Override