Capture MSKPs from RE more reliably

Bug: 187078781
Test: capture an MSKP

The old method relied on checking the file size of the created file and
assuming it was finished when it stopped growing for a certain amount of
time. This lead to pulling the file early, and possibly deleting it
while the device is still attempting to write to it.

Instead, add an extra debugging system property that represents the name
of the latest MSKP captured. Set it to "" when beginning recording. When
it is no longer "", this means that the file has been written. adb pull
that file.

Also print the name of the file in logcat.

Defensively lock mMutex during setupMultiFrameCapture(), which modifies
variables that may be modified by another thread.

In record.sh rootandsetup, set the backend to "skiaglthreaded". This is
the version we're planning to ship (and is already the default), and
"skiagl" doesn't seem to boot currently.

Remove the timeout waiting for the file to be written. Writing the file
can take a very long time, and it's more useful to get a file than to
prevent a long hang.

If the phone doesn't have the right permissions to write files to disk,
write a helpful error message and exit.

Change-Id: I39c08bee5e7f47fc0fbe1475c872fd755935c90b
4 files changed