installd: Replace Dex2oatFileWrapper with UniqueFile

UniqueFile is based on the original Dex2oatFileWrapper, but support
extra features. The class now maintains the file path as a member
variable. This the client to access both fd and file path when they see
fit. As a result, the client no longer provides the cleanup function
with a closure capture, since the class can provide the file path.

Additionally, reduce code duplication in constructors.

Bug: 161470356
Test: atest run_dex2oat_test
Test: atest installd_dexopt_test

Change-Id: I1b66bc58b1885933d1601fdc2f4218c4a262d9f3
7 files changed