Fix CoordinatorLayout dependency sorting

Since CoordinatorLayout allows dependency chaining
of views, a simple sort is not sufficient to handle
all cases. This CL fixes the sorting by moving us
to a topological sort based on a breadth first search.

The search is linear so should actually be slightly
quicker than the current selection sort.

Also changed some of CoordinatorLayout's internals
to use the DAG rather than the sorted list.

BUG: 29529648

Change-Id: I1283f72c312824ee3ed1fd4b0bb7e7405f38cb2b
7 files changed