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

Commit 9d55afe2 authored by Robert Horvath's avatar Robert Horvath Committed by Android (Google) Code Review
Browse files

Merge "Prevent ArrayList allocation for prefer keep clear areas" into tm-dev

parents c5f7947c e10a3513
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -11939,13 +11939,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @NonNull
    List<Rect> collectPreferKeepClearRects() {
        ListenerInfo info = mListenerInfo;
        final List<Rect> list = new ArrayList<>();
        boolean keepBoundsClear =
                (info != null && info.mPreferKeepClear) || mPreferKeepClearForFocus;
        boolean hasCustomKeepClearRects = info != null && info.mKeepClearRects != null;
        if (!keepBoundsClear && !hasCustomKeepClearRects) {
            return Collections.emptyList();
        } else if (keepBoundsClear && !hasCustomKeepClearRects) {
            return Collections.singletonList(new Rect(0, 0, getWidth(), getHeight()));
        }
        if ((info != null && info.mPreferKeepClear) || mPreferKeepClearForFocus) {
        final List<Rect> list = new ArrayList<>();
        if (keepBoundsClear) {
            list.add(new Rect(0, 0, getWidth(), getHeight()));
        }
        if (info != null && info.mKeepClearRects != null) {
        if (hasCustomKeepClearRects) {
            list.addAll(info.mKeepClearRects);
        }