Prevent readTrainInfo from crashing statsd.

copy_n in readTrainInfo needs an input iterator and an output iterator.
When we read the size of the trainName, we were passing an
outputIterator that was a pointer to size_t. The goal was to fill up the
size_t with the length of the train. However, we need to do this byte by
byte, and by passing the pointer to the size_t, we increment by size_t
bytes instead of one bytes when we increment the iterator.

The change now is to use linux read, which is the mirror to how we write
the file. This code is cleaner and less error prone than reading the
file to a string.

Another thing this cl does is implement some sanity checks to make sure
we dont read pass the string input buffer, and to try to safeguard
against devices that upgrade from beta 1 to beta 2 and have a trainInfo
from beta1 stored on the device (since they are not backwards
compatible.) Another option here is to create a separate file for
everything besides the experiment ids, but that might not be deasible in
the time we have.

Test: storage manager unit tests pass
Test: debug phonesky apk to trigger binary push, manually inspecting the
file created to ensure the write works, and using adb shell cmd stats
pull-source to verify the read works.
Test: statsd testdrive 10051

Bug: 128460940
Change-Id: I3c08d946db9c43d77e5efca2eb1088adbb4a3ce1
1 file changed