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

Commit 8afceda1 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Clear preordered list after use." into lmp-dev

parents ee98df79 50ac6cb9
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -324,19 +324,27 @@ public class GhostView extends View {
        final ArrayList<View> preorderedList = parent.buildOrderedChildList();
        final ArrayList<View> preorderedList = parent.buildOrderedChildList();
        final boolean customOrder = preorderedList == null
        final boolean customOrder = preorderedList == null
                && parent.isChildrenDrawingOrderEnabled();
                && parent.isChildrenDrawingOrderEnabled();

        // This default value shouldn't be used because both view and comparedWith
        // should be in the list. If there is an error, then just return an arbitrary
        // view is on top.
        boolean isOnTop = true;
        for (int i = 0; i < childrenCount; i++) {
        for (int i = 0; i < childrenCount; i++) {
            int childIndex = customOrder ? parent.getChildDrawingOrder(childrenCount, i) : i;
            int childIndex = customOrder ? parent.getChildDrawingOrder(childrenCount, i) : i;
            final View child = (preorderedList == null)
            final View child = (preorderedList == null)
                    ? parent.getChildAt(childIndex) : preorderedList.get(childIndex);
                    ? parent.getChildAt(childIndex) : preorderedList.get(childIndex);
            if (child == view) {
            if (child == view) {
                return false;
                isOnTop = false;
                break;
            } else if (child == comparedWith) {
            } else if (child == comparedWith) {
                return true;
                isOnTop = true;
                break;
            }
            }
        }
        }


        // Shouldn't get here. Neither of the children is in the parent.
        if (preorderedList != null) {
        // Just return an arbitrary one.
            preorderedList.clear();
        return true;
        }
        return isOnTop;
    }
    }
}
}