Cache MemoryIntArray size

The underlying ashmem buffer size should never change, so cache it upon
MemoryIntArray creation. We still validate that the ashmem region hasn't
been closed before any associated operations on the member size.

This reduces MemoryIntArray-related overhead for some common operations
by ~50%.

Bug: 323623465
Test: m + presubmit
Change-Id: I41060c3da3dad830b35acf042c5bc5b0af3b6091
4 files changed