Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24be9ab6 authored by Robert Carr's avatar Robert Carr
Browse files

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
parent 9411ab15
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -808,6 +808,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    void onParentSet() {
        super.onParentSet();
        setDrawnStateEvaluated(false /*evaluated*/);

        getDisplayContent().reapplyMagnificationSpec();
    }

    @Override