AudioTrack error checks
AudioTrack error checks

getMinBufferSize():
  Simplify native_get_min_buff_size error checks and handle more errors.

setPlaybackHeadPosition():
  Disallow for streaming mode [underlying AudioTrack C++ requires this].
  Disallow setPlaybackHeadPosition before write().
  Remove unnecessary synchronization around native_set_position().

setLoopPoints():
  As setLoopPoints() is effectively a variant of setPlaybackHeadPosition(), do the same error checks.

write():
  Don't set "write completed" state if write() parameters are invalid or native write fails.
  It was setting "write completed" flag too early, and ignoring native write return value.
  Detect integer overflow.

reloadStaticData():
  Disallow reloadStaticData() before write().

Change-Id: Iec36fc0ea67095e18a2c238b148dad5545c102c1

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