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

Commit 603248d9 authored by Robert Carr's avatar Robert Carr
Browse files

Update surface size even when preserving geometry.

A recent change is causing some apps to request their
SurfaceView size before requesting visibility. We won't
apply this because of the View.GONE check in WMS. Once the app
becomes visible, it thinks the surface size hasn't changed
locally, so it appends PRESERVE_GEOMETRY to let the render thread
and reposition child control the layout size. Now we will never
set a requested width/height though and end up with 0. The line
to not update requested size while preferring geometry was
required when we were using SCALING_MODE_NO_SCALE_CROP, as
making the size smaller would apply immediately (with
the surface size acting as a reduced crop until we got a new
buffer), but now that we are using SCALING_MODE_FREEZE there
are no problems.

Bug: 27914300
Change-Id: Ic0997ab3950f3eac360260e9939b6f2ee6667453
parent a85c273c
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -2602,8 +2602,6 @@ public class WindowManagerService extends IWindowManager.Stub
                        == PackageManager.PERMISSION_GRANTED;

        long origId = Binder.clearCallingIdentity();
        final boolean preserveGeometry = (attrs != null) && (attrs.privateFlags &
                WindowManager.LayoutParams.PRIVATE_FLAG_PRESERVE_GEOMETRY) != 0;
        synchronized(mWindowMap) {
            WindowState win = windowForClientLocked(session, client, false);
            if (win == null) {
@@ -2611,7 +2609,7 @@ public class WindowManagerService extends IWindowManager.Stub
            }

            WindowStateAnimator winAnimator = win.mWinAnimator;
            if (!preserveGeometry && viewVisibility != View.GONE) {
            if (viewVisibility != View.GONE) {
                win.setRequestedSize(requestedWidth, requestedHeight);
            }

@@ -2660,9 +2658,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if ((attrChanges & WindowManager.LayoutParams.ALPHA_CHANGED) != 0) {
                winAnimator.mAlpha = attrs.alpha;
            }
            if (!preserveGeometry) {
            win.setWindowScale(win.mRequestedWidth, win.mRequestedHeight);
            }

            boolean imMayMove = (flagChanges & (FLAG_ALT_FOCUSABLE_IM | FLAG_NOT_FOCUSABLE)) != 0;
            final boolean isDefaultDisplay = win.isDefaultDisplay();