Merge "GestureExclusion: Fix restriction priority" into qt-dev
am: 36151597fb
Change-Id: I9b2c4c530d25a43a480b29158cce99c30c5428c8
This commit is contained in:
@@ -140,7 +140,7 @@ import static com.android.server.wm.WindowManagerService.logSurface;
|
||||
import static com.android.server.wm.WindowState.RESIZE_HANDLE_WIDTH_IN_DP;
|
||||
import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING;
|
||||
import static com.android.server.wm.WindowStateAnimator.READY_TO_SHOW;
|
||||
import static com.android.server.wm.utils.RegionUtils.forEachRect;
|
||||
import static com.android.server.wm.utils.RegionUtils.forEachRectReverse;
|
||||
import static com.android.server.wm.utils.RegionUtils.rectListToRegion;
|
||||
|
||||
import android.animation.AnimationHandler;
|
||||
@@ -5257,13 +5257,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
r.op(edge, Op.INTERSECT);
|
||||
|
||||
final int[] remaining = {limit};
|
||||
forEachRect(r, rect -> {
|
||||
forEachRectReverse(r, rect -> {
|
||||
if (remaining[0] <= 0) {
|
||||
return;
|
||||
}
|
||||
final int height = rect.height();
|
||||
if (height > remaining[0]) {
|
||||
rect.bottom = rect.top + remaining[0];
|
||||
rect.top = rect.bottom - remaining[0];
|
||||
}
|
||||
remaining[0] -= height;
|
||||
global.op(rect, Op.UNION);
|
||||
|
||||
@@ -20,6 +20,8 @@ import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.RegionIterator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -48,14 +50,21 @@ public class RegionUtils {
|
||||
/**
|
||||
* Applies actions on each rect contained within a {@code Region}.
|
||||
*
|
||||
* Order is bottom to top, then right to left.
|
||||
*
|
||||
* @param region the given region.
|
||||
* @param rectConsumer the action holder.
|
||||
*/
|
||||
public static void forEachRect(Region region, Consumer<Rect> rectConsumer) {
|
||||
public static void forEachRectReverse(Region region, Consumer<Rect> rectConsumer) {
|
||||
final RegionIterator it = new RegionIterator(region);
|
||||
final ArrayList<Rect> rects = new ArrayList<>();
|
||||
final Rect rect = new Rect();
|
||||
while (it.next(rect)) {
|
||||
rectConsumer.accept(rect);
|
||||
rects.add(new Rect(rect));
|
||||
}
|
||||
// TODO: instead of creating an array and reversing it, expose the reverse iterator through
|
||||
// JNI.
|
||||
Collections.reverse(rects);
|
||||
rects.forEach(rectConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user