Add O_CREAT to ProfileCompilationInfo::SaveFallback.
Before this change, ProfileCompilationInfo::SaveFallback relies on
ProfileSaver::ProcessProfilingInfo to create an empty file beforehand if
the file didn't exist. This doesn't work if SaveFallback is called by
other callers (e.g., CopyAndUpdateProfileKey), and there can be a race.
After this change, ProcessProfilingInfo no longer creates an empty file,
and SaveFallback creates the file itself.
This change also avoids unnecessary file creation when saving is not
needed.
Bug: 275378665
Bug: 282191456
Test: art/test.py -b --host -r -t 595-profile-saving
Test: art/test.py --target -r -t 595-profile-saving (chroot on U device)
Test: art/test.py --target -r -t 595-profile-saving (chroot on T device)
Test: profman --copy-and-update-profile-key --profile-file=YouTube.dm --output-profile-type=app --apk=YouTube.apk --dex-location=base.apk --reference-profile-file=/tmp/1.prof
Change-Id: I01ef27791c2625f0cbd242fcaa8056df4b7d24d0
3 files changed