diff options
author | Yifan Hong | 2018-07-12 16:45:52 -0500 |
---|---|---|
committer | Yifan Hong | 2018-07-13 17:42:15 -0500 |
commit | 9f78c180ff6c1cff8d0cd5c3a656bed85492685f (patch) | |
tree | 3e25137e2bd18522df9cdfd62c0601c730569bb5 /HalManifest.cpp | |
parent | f3378017ea2c8818e9ea645328dae1cf5a9fe95a (diff) | |
download | platform-system-libvintf-9f78c180ff6c1cff8d0cd5c3a656bed85492685f.tar.gz platform-system-libvintf-9f78c180ff6c1cff8d0cd5c3a656bed85492685f.tar.xz platform-system-libvintf-9f78c180ff6c1cff8d0cd5c3a656bed85492685f.zip |
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
Diffstat (limited to 'HalManifest.cpp')
-rw-r--r-- | HalManifest.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/HalManifest.cpp b/HalManifest.cpp index fbb3220..17ab530 100644 --- a/HalManifest.cpp +++ b/HalManifest.cpp | |||
@@ -360,8 +360,9 @@ CompatibilityMatrix HalManifest::generateCompatibleMatrix() const { | |||
360 | return matrix; | 360 | return matrix; |
361 | } | 361 | } |
362 | 362 | ||
363 | status_t HalManifest::fetchAllInformation(const std::string& path, std::string* error) { | 363 | status_t HalManifest::fetchAllInformation(const FileSystem* fileSystem, const std::string& path, |
364 | return details::fetchAllInformation(path, gHalManifestConverter, this, error); | 364 | std::string* error) { |
365 | return details::fetchAllInformation(fileSystem, path, gHalManifestConverter, this, error); | ||
365 | } | 366 | } |
366 | 367 | ||
367 | SchemaType HalManifest::type() const { | 368 | SchemaType HalManifest::type() const { |