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

Commit 0eac1689 authored by chaviw's avatar chaviw
Browse files

Fix window cropping issue.

Comparing mLayer to mSystemDecorLayer no longer makes sense since mLayer
is always zero. The code was always falling into this check and causing
the crop to be calculated incorrectly by ignoring system decor.

Test: Apps in split screen now have the background when draging.
Change-Id: I3e310390fcc840d9ae869ed58243a9f8ff5d1337
parent 8cfd3d03
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -4115,9 +4115,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            policyCrop.intersect(-mCompatFrame.left, -mCompatFrame.top,
                    displayInfo.logicalWidth - mCompatFrame.left,
                    displayInfo.logicalHeight - mCompatFrame.top);
        } else if (mLayer >= mService.mSystemDecorLayer) {
            // Above the decor layer is easy, just use the entire window
            policyCrop.set(0, 0, mCompatFrame.width(), mCompatFrame.height());
        } else if (mDecorFrame.isEmpty()) {
            // Windows without policy decor aren't cropped.
            policyCrop.set(0, 0, mCompatFrame.width(), mCompatFrame.height());
+3 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import android.app.ActivityManager.TaskDescription;
import android.content.Context;
import android.graphics.Rect;
import android.os.Debug;
import android.platform.test.annotations.Presubmit;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
@@ -327,11 +328,8 @@ public class WindowFrameTests extends WindowTestsBase {

        w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null);
        w.calculatePolicyCrop(policyCrop);
        // If we were above system decor we wouldnt' get any cropping though
        w.mLayer = sWm.mSystemDecorLayer + 1;
        w.calculatePolicyCrop(policyCrop);
        assertRect(policyCrop, 0, 0, logicalWidth, logicalHeight);
        w.mLayer = 1;
        assertRect(policyCrop, 0, cf.top, logicalWidth, cf.bottom);

        dcf.setEmpty();
        // Likewise with no decor frame we would get no crop
        w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null);