diff options
author | Steven Moreland <smoreland@google.com> | 2017-09-15 16:21:24 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2017-09-25 11:43:29 -0700 |
commit | 9a6da7a784bea068b1f3fc3758c9cfc785183693 (patch) | |
tree | fbecc5bf15e6541b6170b75e3b7dc1bdfca6e660 /utils | |
parent | 74214204ebc00cdbb7f7f91b1f6be554dd52a84a (diff) | |
download | hidl-9a6da7a784bea068b1f3fc3758c9cfc785183693.tar.gz |
Add adapters for HIDL interfaces.
An adapter for a HIDL interface takes an x.(y+1) interface
and registers it as an x.y interface.
This adds new autogenerated test libraries to HIDL which
can be used to run tests.
Test: can switch out implementations
~/android/master$ lshal | grep hidl.allocator
Y android.hidl.allocator@1.0::IAllocator/ashmem 0/1 652 471
~/android/master$ lshal | grep hidl.allocator
Y android.hidl.allocator@1.0::IAllocator/ashmem 0/1 7635 471
~/android/master$ lshal | grep hidl.allocator
Y android.hidl.allocator@1.0::IAllocator/ashmem 0/1 652 471
Test: build all adapters in hardware/interfaces
Test: adapt @1.1::IPower to @1.0::IPower
Test: NFC works even after having an adaption layer over it (@1.0 -> @1.0 :/)
Bug: 37518178
Change-Id: Ia009d59352963321f16e085f034f70c462ccceeb
Diffstat (limited to 'utils')
-rw-r--r-- | utils/FQName.cpp | 8 | ||||
-rw-r--r-- | utils/include/hidl-util/FQName.h | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/utils/FQName.cpp b/utils/FQName.cpp index 630fff47..bb62244f 100644 --- a/utils/FQName.cpp +++ b/utils/FQName.cpp @@ -318,6 +318,10 @@ std::string FQName::getInterfaceBaseName() const { return getInterfaceName().substr(1); } +std::string FQName::getInterfaceAdapterName() const { + return "A" + getInterfaceBaseName(); +} + std::string FQName::getInterfaceHwName() const { return "IHw" + getInterfaceBaseName(); } @@ -338,6 +342,10 @@ FQName FQName::getInterfaceProxyFqName() const { return FQName(package(), version(), getInterfaceProxyName()); } +FQName FQName::getInterfaceAdapterFqName() const { + return FQName(package(), version(), getInterfaceAdapterName()); +} + FQName FQName::getInterfaceStubFqName() const { return FQName(package(), version(), getInterfaceStubName()); } diff --git a/utils/include/hidl-util/FQName.h b/utils/include/hidl-util/FQName.h index 3cdc7a9b..ae852388 100644 --- a/utils/include/hidl-util/FQName.h +++ b/utils/include/hidl-util/FQName.h @@ -110,6 +110,11 @@ struct FQName { // Must be called on an interface // android.hardware.foo@1.0::IBar + // -> ABar + std::string getInterfaceAdapterName() const; + + // Must be called on an interface + // android.hardware.foo@1.0::IBar // -> IBar std::string getInterfaceName() const; @@ -140,6 +145,11 @@ struct FQName { // Must be called on an interface // android.hardware.foo@1.0::IBar + // -> android.hardware.foo@1.0::ABar + FQName getInterfaceAdapterFqName() const; + + // Must be called on an interface + // android.hardware.foo@1.0::IBar // -> android.hardware.foo@1.0::BnBar FQName getInterfaceStubFqName() const; |