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

Commit 776dd9e5 authored by Robert Carr's avatar Robert Carr
Browse files

ViewRootImpl: Correct opaque flag usage

In performTraversals, "params" may be null. In this case we were
not passing params to the WM indicating no changes (an obscure
artifact of the protocol).  In R the WM would simply ignore this
however our updateOpacity logic in S is treating null as "translucent"
it seems easiest to just pass mWindowAttributes directly avoiding
the null case. While the opacity was broken, it seems an animation
was added to StartingSurfaceDrawer which depends on having a translucent
window. We also update this code to request a transparent pixel format
as would have been required in the R API.

Bug: 186555833
Test: Existing tests pass
Change-Id: I180bf1796bbb4b7049ae9811f674f31014c2a400
parent 926a7ee3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2783,7 +2783,7 @@ public final class ViewRootImpl implements ViewParent,
                        & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
                final boolean dragResizing = freeformResizing || dockedResizing;
                if (mSurfaceControl.isValid()) {
                    updateOpacity(params, dragResizing);
                    updateOpacity(mWindowAttributes, dragResizing);
                }

                if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString()
@@ -7749,9 +7749,10 @@ public final class ViewRootImpl implements ViewParent,
        return relayoutResult;
    }

    private void updateOpacity(@Nullable WindowManager.LayoutParams params, boolean dragResizing) {
    private void updateOpacity(WindowManager.LayoutParams params, boolean dragResizing) {
        boolean opaque = false;
        if (params != null && !PixelFormat.formatHasAlpha(params.format)

        if (!PixelFormat.formatHasAlpha(params.format)
                // Don't make surface with surfaceInsets opaque as they display a
                // translucent shadow.
                && params.surfaceInsets.left == 0
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.os.IBinder;
@@ -215,6 +216,7 @@ public class StartingSurfaceDrawer {
                WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
        params.setFitInsetsSides(0);
        params.setFitInsetsTypes(0);
        params.format = PixelFormat.TRANSLUCENT;
        int windowFlags = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
                | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN