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

Commit 29cae890 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Create 1x1 dummy surface when zero size is specified for drag shadow

Since P, we cannot create zero size surface. For compatibility, we
create 1x1 dummy surface when the app claims zero size surface.

Bug: 72416622
Test: Invoke startDragAndDrop with zero size surface
Change-Id: Ifefd07e93389979eaa2a6fbe29abe5850fcdef34
parent 8e2af197
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -23634,9 +23634,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        Point shadowTouchPoint = new Point();
        shadowBuilder.onProvideShadowMetrics(shadowSize, shadowTouchPoint);
        if ((shadowSize.x <= 0) || (shadowSize.y <= 0)
        if ((shadowSize.x < 0) || (shadowSize.y < 0)
                || (shadowTouchPoint.x < 0) || (shadowTouchPoint.y < 0)) {
            throw new IllegalStateException("Drag shadow dimensions must be positive");
            throw new IllegalStateException("Drag shadow dimensions must not be negative");
        }
        // Create 1x1 surface when zero surface size is specified because SurfaceControl.Builder
        // does not accept zero size surface.
        if (shadowSize.x == 0  || shadowSize.y == 0) {
            shadowSize.x = 1;
            shadowSize.y = 1;
        }
        if (ViewDebug.DEBUG_DRAG) {