Add a lock when writing temporary files in BootReceiver

This is needed because there is potentially a race condition between when NativeTombstoneManager tries to delete leftover .tmp files and when those files are added to dropbox.

Direct cherrypick from internal master

Test: atest ErrorsTest
Bug: 284900963
Change-Id: I07936c51646915cb8760f45c4bb920f5fb335025
Merged-In: I07936c51646915cb8760f45c4bb920f5fb335025
2 files changed