Fix ExifInterface#saveAttributes behavior

cherry-pick from aosp/1015050, aosp/1079822

1. Currently, calling ExifInterface#saveAttributes with StrictMode
   that detects unbuffered I/O throws an exception. Change
   saveJpegAttributes to take BufferedInput/OutputStreams
   as parameters.
2. Change saveAttributes so that when an exception is thrown, the
   original image file is not deleted but restored.
3. Distinguish between two identical exception messages in
   saveAttributes.
4. Add test for checking StrictMode.

Bug: 137139466
Test: Run atest CtsMediaTestCases:android.media.cts.ExifInterfaceTest
Change-Id: I9e4111ec35740198bdbdba0c9b609875b6231474
1 file changed