Bounds check read and write path in native code.
Bounds check read and write path in native code.

Already checked in Java, but requested by security review.

Change-Id: I5314dbc32546278b977236a154fba03f38610b1a

xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base