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

Commit c7ad0a0c authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev
Browse files

Constrain 'touch modal' behavior to the activity stack.

Currently a 'touch modal' window grabs drag events
from the entire screen. Since 'touch modal' is the
default, this makes dragging between apps impossible.

This change allows such grabbing behavior only for
events that are still over the same activity stack.

Bug:19548858
Change-Id: I7d48b58e7fcb620521361e17cb70914913afae03
parent 5ac3e1f4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.server.wm.WindowManagerService.H;
import android.content.ClipData;
import android.content.ClipDescription;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.IBinder;
import android.os.Message;
@@ -63,6 +64,7 @@ class DragState {
    Display mDisplay;

    private final Region mTmpRegion = new Region();
    private final Rect mTmpRect = new Rect();

    DragState(WindowManagerService service, IBinder token, SurfaceControl surface,
            int flags, IBinder localWin) {
@@ -411,6 +413,12 @@ class DragState {
                continue;
            }

            child.getStackBounds(mTmpRect);
            if (!mTmpRect.contains(x, y)) {
                // outside of this window's activity stack == don't tell about drags
                continue;
            }

            child.getTouchableRegion(mTmpRegion);

            final int touchFlags = flags &