Back-out some changes from 7e582a25f8 (#14786) which skipped necessary logic to calculate device lists properly.
7e582a25f8