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

Commit 9bdd2e61 authored by John Reck's avatar John Reck
Browse files

Handle window surface insets

Bug: 69413152
Test: PixelCopy CTS tests
Change-Id: Ie26c38e462fbc6c19669d33efaec5251f40f75bd
parent 2ebb0212
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -263,8 +263,16 @@ public final class PixelCopy {
                    "Only able to copy windows with decor views");
        }
        Surface surface = null;
        if (source.peekDecorView().getViewRootImpl() != null) {
            surface = source.peekDecorView().getViewRootImpl().mSurface;
        final ViewRootImpl root = source.peekDecorView().getViewRootImpl();
        if (root != null) {
            surface = root.mSurface;
            final Rect surfaceInsets = root.mWindowAttributes.surfaceInsets;
            if (srcRect == null) {
                srcRect = new Rect(surfaceInsets.left, surfaceInsets.top,
                        root.mWidth + surfaceInsets.left, root.mHeight + surfaceInsets.top);
            } else {
                srcRect.offset(surfaceInsets.left, surfaceInsets.top);
            }
        }
        if (surface == null || !surface.isValid()) {
            throw new IllegalArgumentException(