Fix abuse of Runtime.freeMemory.

Runtime.freeMemory is the largest allocation that's
possible *without a heap expansion*. That's a poor proxy
for "can i allocate this byte array" and leads to flaky
CTS tests.

bug: 17021619

(cherry picked from commit df7e1dbcd0ff712f39b8e80023228ea4eb8531c2)

Change-Id: I58dd8c006316e6f1195172cff8a262a96269c2b8
1 file changed