VintfObject now provides instance methods.
VintfObject used to only contain static methods. It now
contains instance methods, and the static methods are
delegates to the instance methods. For example:
GetDeviceHalManifest calls GetInstance()->getDeviceHalManifest()
getDeviceHalManifest does the actual job.
The static dependencies (FileSystem, PropertyFetcher, PartitionMounter,
ObjectFactory<RuntimeInfo> are also moved from utils.cpp to the
static VintfObject instance.
Tests are updated to create a test VintfObject instance with
the mocked dependencies, and run test on the test object.
As a result, utils.cpp is now empty and removed, and
libvintf_common is the same as libvintf. Hence libvintf_common is also
removed.
This allows:
- Allows better mocking in tests. Tests are now independent of
each other because a new VintfObject is created for every test.
(Previously this is done very badly by clearing the global states,
which is error prone)
- A bug in VintfObjectTest.FrameworkCompatibilityMatrixCombine
is discovered because it depends on setting global states in
previous test cases. This is also fixed in this CL.
- In recovery, two VintfObject is required; one for XMLs in the
recovery image (under /) and one for XMLs in system/vendor image
(under /mnt). HIDL HAL getService in recovery depends on the former,
and OTA depends on the latter. This CL prepares recovery to work.
(A follow-up CL is needed to update VintfObjectRecovery to use
/mnt for getService).
Some other notable changes in the CL:
- CompatibilityMatrix/HalManifest fetchAllInformation now takes
a FileSystem argument to fetch files correctly, because the global
FileSystem object is removed.
- Globals in utils.cpp / utils-fake.cpp is removed
- DevicePropertyFetcher is moved from utils.cpp to PropertyFetcher.cpp
and is always built (for both host and target); but host VintfObject
uses dummy PropertyFetcher by default. (See
createDefaultPropertyFetcher in VintfObject.cpp).
Bug: 110855270
Bug: 80132328
Bug: 111372832
Test: vintf_object_test
Test: livintf_test
Change-Id: I24320662191b977c0e562129e49b33e80de727cc
18 files changed