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

Commit 3eeb4e6e authored by Adrian Roos's avatar Adrian Roos
Browse files

Fix cropping for fullscreen windows

Bug: 15046646
Change-Id: I526c0044e3715a4096373b8bbbdbd0c864be2df9
parent a76a150f
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.view.MagnificationSpec;
import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import android.view.WindowManager.LayoutParams;
@@ -151,6 +152,10 @@ class WindowStateAnimator {
    static final int READY_TO_SHOW = 3;
    /** Set when the window has been shown in the screen the first time. */
    static final int HAS_DRAWN = 4;

    private static final int SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN =
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

    static String drawStateToString(int state) {
        switch (state) {
            case NO_SURFACE: return "NO_SURFACE";
@@ -1176,9 +1181,15 @@ class WindowStateAnimator {
            // content insets as well.
            int offsetTop = Math.max(w.mSystemDecorRect.top, w.mContentInsets.top);
            mTmpClipRect.set(w.mSystemDecorRect);
            // Don't apply the workaround to apps explicitly requesting fullscreen layout.
            if ((w.mSystemUiVisibility & SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN)
                    == SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN) {
                mTmpClipRect.intersect(mClipRect);
            } else {
                mTmpClipRect.offset(0, -offsetTop);
                mTmpClipRect.intersect(mClipRect);
                mTmpClipRect.offset(0, offsetTop);
            }
            clipRect = mTmpClipRect;

        }