History log of /system/tools/hidl/Interface.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
368e46077eb9fbe52242e037a5b9de91693fe70f 16-Feb-2018 Steven Moreland <smoreland@google.com> Do all validation during validation phase.

When hidl-gen was originally written, validation occured
at two different times: parsing and generation.

Since then, hidl-gen was re-written to be a multi-pass compiler.
The basic phases are now (see main + AST::postParse):
parse, process, validate, generate

However, some validation still exists during the generation phase.
This validation code has been gradually cleaned up, but, here, I am
cleaning up all the rest.

By moving the code to validation, we are fixing several classes
of problems:
1. generate functions almost exclusively (except for the few exceptions
that this CL cleans up) always return status OK. We have a bunch of
data flow logic which exists solely to propagate "return OK". This
is just plain silly.
2. a large number of the returns from emit/generate functions are not
actually checked. We've had a several bugs from this and also many
CLs just to fix this when they've been discovered. This causes problems
where hidl-gen fails but nothing notices.
3. sometimes files are written before things are validated. This is
extremely frustrating and also the cause of other bugs. One common
case of this (while developing) is when updating makefiles, the hidl-gen
compiler complains something is wrong with an interface, but it has
already partially written new but invalid makefiles. This means that
they have to be manually fixed before another build can begin.
4. having status_t returns from generate functions indicates to someone
working on hidl-gen that they can return an error here, but they
should always return an error from the correct validation function.
Removing the ability to return ERROR makes sure that new errors are
caught/validated in the correct place. One instance in this CL of
this happening is that annotations are also checked on isHidlReserved
methods whereas before, these were incorrectly only checked on regular
methods.

(note, breaking text to avoid pinging these)
B ug: 65636464 (forward declarations, made this possible)
B ug: 34807779 (better tools for java compatibility, closer to being solved)
B ug: 32573681 (instance of 2 above).

Test: hidl's run_all_host_tests.sh
Change-Id: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
/system/tools/hidl/Interface.h
04dea8d14fa4089d690e71f1b79d7d3b810c7272 06-Feb-2018 Steven Moreland <smoreland@google.com> Move file accesses for hash files to Coordinator.

Right now a couple places of code in hidl-gen access hash files.
Moving this to Coordinator.cpp for two reasons:

- sane place to add onFileAccess calls
- Interface.cpp can't participate in dep management because
it is in a library that can't depend on Coordinator.cpp

Test: hidl_hash_test, hidl_test
Bug: 73001417
Change-Id: I65fda85cb5845ded64d71637950901edaa7d8b4a
/system/tools/hidl/Interface.h
3ce7214bd94cc880601d4dd459a37264633452a2 02-Feb-2018 Steven Moreland <smoreland@google.com> Unify Java + C++ flag definitions.

Right now, we have duplicated definitions of flags in
C++ and Java that have to be kept in sync. Moving this here
so that that is no longer a requirement.

This will also allow us to add new flags in the future after
we start emitting transaction errors when flags are

Bug: 72877008
Test: N/A
Change-Id: I17b1ff55d09200f09e02edfdc2f1619bb121b3da
/system/tools/hidl/Interface.h
ecfb4517ff68c59294f1ddc99513aef7b6dc2f24 21-Nov-2017 Howard Chen <howardsoc@google.com> HIDL defined type to support a composed interface

This patch supports parcel/un-parcel a struct with a composed
Interface.

Bug: 68295540
Test: hidl_test
Change-Id: Ia1d4493115c9bd2df8a5b2266632d3e88931ee4d
/system/tools/hidl/Interface.h
4b8f7a11f794d9b4899af92a856b4a03b80b31e8 18-Nov-2017 Steven Moreland <smoreland@google.com> Rename global..Decls to package...Decls

For something like android.hidl.foo@V1_0::IFoo.SomeStruct.SomeEnum
emitGlobalType/HwDeclarations puts relevant functions in
"android::hidl::foo::V1_0".

Since this isn't the global namespace and we are actually going
to put other things relative to the global namespace, renaming.

Bug: 68715899
Test: hidl_test
Change-Id: Ibc465dc69d028b13d96f123a42a1f5bf391c32b3
/system/tools/hidl/Interface.h
9a6da7a784bea068b1f3fc3758c9cfc785183693 16-Sep-2017 Steven Moreland <smoreland@google.com> 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
/system/tools/hidl/Interface.h
ff5e64ae0c65b80e2baa4a95b9ae9ee894b60080 11-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Fix strong references

Makes strong references to deal with interface corner case explicitly.
Makes hidl-gen to detect a cycle through typedef.

Cycle example:
typedef S A;
struct S {
A foo;
};

Fixes: 65559985

Test: mma
Test: error test in follow up CL
Change-Id: I132037995c3fc99edfe3e57a1fe84d3c36ca6993
/system/tools/hidl/Interface.h
5dc72fe4f6f1d2c03c75307a9bd80f055f752ed3 08-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Make recursive methods in Type work with cyclic AST

Fixes Type::canCheckEquality, Type::needsResolveReferences,
Type::isJavaCompatible, Type:containsPointer.

Adds set of visited Types to these functions to prevent
infinite recursion.

deep versions of these functions *do not* guarantee the correct
return value, but non-deep versions do:
We need to find al least one path from requested vertex
to "bad" vertex (ie. which is not java compatible).

Fixes a bug with containsPointer (containsPointer returned true
if inner type contained a pointer), so more structures get
__attribute__ aligned and static_assert generated for
struct fields.

This change is required for forward reference, as current
implementations assume that the graph is acyclic.

Potential future work: to reduce theoretical complexity of
described actions (square to linear).

Bug: 31827278

Test: mma
Test: output not changed in
out/soong/.intermediates/hardware/interfaces

Change-Id: I3dbdd1605f9317637241057b12de6031125abf7b
/system/tools/hidl/Interface.h
565b0137b2ad0e8e239d38e92c025f096de62f2d 07-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Refactor AST::addScopedType.

Makes NamedType receive full name in constructor.
Adds test that defined type names are unique within one scope.

Test: mma
Test: hidl_error_test
Change-Id: If218e1febc2af9f44c5908408f67e772efdda18e
/system/tools/hidl/Interface.h
b58f4185934a93fc511c03a8a970b31c5ea0dfca 30-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Make Type::getReferences return pointer

This change makes it able to add lookups as one more tree pass,
as it requires to change Type inside of references.

This change require getReferences to become non-const, so from now
we maintain const and non-const versions of recursive pass and getting
dependencies.

Bug: 31827278
Test: mma
Change-Id: I201533db5ca0bd30fbad34ef71ed2bd210c607e4
/system/tools/hidl/Interface.h
40731afa5f0e4e0e9bc36bd9c37e24b9bdaa3413 24-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Add acyclic check pass to hidl-gen

Adds recursive tree pass that checks that directed graph of
definitions and references is acyclic.
It prints nice error message, which shows the whole found cycle.

To be really tested, it requires lookups to be moved outside of parsing.

Test: hidl_test
Bug: 31827278

Change-Id: I9e96fa8206cfb84a56298991c526f71befae1478
/system/tools/hidl/Interface.h
891a866402345777c7e746cf8d0e4ffd0bd28ca2 26-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Constant Expressions have same tree structure as Type

Makes constant expressions tree structures and type signatures
be similar to AST (type declarations and references).

This change is useful for making same structure for calling
constant expressions evaluation and lookup (they depend on local
identifiers).

Bug: 31827278

Test: mma

Change-Id: I901284009d8b845358788b8c9e3de083a2f63f3f
/system/tools/hidl/Interface.h
0344e61434d7af537cbf33c86b47ec165593f7dd 25-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Get rid if Reference<Interface>

This change allows to have
std::vector<Reference<Type>*> getReferences()
^
Thus we can make recursive lookup be like:
for ref : getReferences() { ref->lookup() }

The check that Interface expends only interfaces is moved to
Interface::validate.

Bug: 31827278
Test: mma
Test: new error test

Change-Id: I8e81b1bdf5658749d4b33d02e812a49765dc03bb
/system/tools/hidl/Interface.h
104f1ff4d184b1816fefb12bbaef6aae2a9cb5dc 25-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Delete unused Interface::lookupMethod

Interface::lookupMethod was only used for checking duplicate
method names, was completely replaced by more efficient
Interface::validateUniqueNames.

Test: mma
Change-Id: I7c45ea366109ee60a2630d63f643236fcbffe798
/system/tools/hidl/Interface.h
33431e6cd425c6cd179080442a8616e2baa20aae 22-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Build AST graph explicitly for simpler post-parsing passes

Puts all of AST parent-child dependencies into a graph.
This change also makes it able to not care about such case:
Type -> (non Type) -> Type (ex. Interface -> Method -> Type)
and to store only Type -> Type relations.

Test: hidl_test
Change-Id: Ic67d9833d9519d7bd6cbae603c556c5bd905167a
/system/tools/hidl/Interface.h
cec46c48853a8c1246656d0095a9faa3fad5c4f9 09-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Move type-related stuff ouside of parsing

3 new passes: resolving inheritance, evaluating constant expressions and
validation.

`resolveInheritance` completes type fields definition which depends on
type base class (so it needs to be looked up before this pass). That
includes interface method serial autofill and enum value autofill.

`evaluate` evaluates constant expressions. This pass depends on the
previous one as enum autofill creates new expressions (+1s).

`validate` proceedes all type-related checks.

`callForReference` is a special way of calling passes for types:
it is used for types that are defined in reference.
Currently that is only array type (size is defined in reference only)
and template type as it could contain an array.
We need such special way to avoid cyclic evaluate call:
struct S { S[42] arr; };

Test: full build, device boot
Test: hidl_test
Test: full build on mac
Test: generated files differ only in constant expression comments

Change-Id: I499e62ae41c52cc86b13d0014eed790454137af6
/system/tools/hidl/Interface.h
8c90cc59bf93bd0c08970b4488067a33015d4a1c 03-Aug-2017 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy performance warnings in system/tools/hidl.

* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.

Bug: 30407689
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Ib90a35106eb59d05878b75504b87ef324211cc6b
/system/tools/hidl/Interface.h
f1b902d10bd2d71ad7f4769620678101821fd5d1 14-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Refactor interface and enum type- and parent-related methods

Make EnumType typeChain has the same syntax
(same name and same return way instead of result by pointer).

Add EnumType::superTypeChain by analogy with Interface::superTypeChain.
Add Interface::allSuperMethodsFromRoot as a mixture of
Interface::allSuperMethodsFromRoot and Interface::superTypeChain.

Test: build hidl-gen, hidl_test
Change-Id: I0af678eab7a563b471f041599ff83bc2b4b9764a
/system/tools/hidl/Interface.h
505316c499a4dbb95f6567e8531fb6f1e74c3ded 05-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Revert "Revert "Add Reference type""

This reverts commit 6f2f2c026b0b6e372194794e171208a91d74f852.

Reason for revert: mac build problem could be easily fixed

Mac build failure was caused by not declaring template specialization
in header file. Unfortunately, it cannot be easily declared there,
as that would cause cyclic declaration.

The reason why Reference<T>(Reference<O>) constructor could get only
unresolved references is because there is no way to check that the
requested conversion is valid (without specialization or rtti).

However, the appeared messy solution is to be deleted with moving
lookup calls outside of the parser.

Test: builds, hidl_test
Test: builds on mac

Change-Id: Icb24e2ad52563f659e758a186d90e414ab7f1c59
/system/tools/hidl/Interface.h
6f2f2c026b0b6e372194794e171208a91d74f852 05-Aug-2017 Steven Moreland <smoreland@google.com> Revert "Add Reference type"

This reverts commit 4b80bc4402ec88504265e6fdbcdb8a803d67eb64.

Reason for revert: breaking mac build

Change-Id: I38b4a6e67173d87d7d78ff191aa26d4a980d2e39
/system/tools/hidl/Interface.h
4b80bc4402ec88504265e6fdbcdb8a803d67eb64 29-Jul-2017 Timur Iskhakov <iskhakovt@google.com> Add Reference type

Add Reference placeholder which keeps Type, FQName and Location.
This type is necessary for adding forward reference support:
it stores FQName until lookup happens, then stores resolved Type;
it stores Location, as all type-related checks are to be moved outside
of the parsing, so we need to keep Location for future error messages.

Reference type has overwritten operators to make it work as Type*,
providing additional checks that Type is resolved before being using.

Reference type is also useful for adding forward reference support as
it checks that every Type member call appears after lookup.

ConstantExpression is to support Reference (and to not be evaluated
during parsing) in future CL.

Test: links, compiles, hidl_test

Change-Id: I7a031b541e678032af1190209e9d2aaf4999bf1b
/system/tools/hidl/Interface.h
cb0ba5213057de39aa164f2f9a3691370bcbfe6b 18-Jul-2017 Timur Iskhakov <iskhakovt@google.com> Moving hidl-gen parser stack outside of AST

Move compiler stack outside of AST members,
adding a parent member to NamedType to make AST
a real tree.

Add a check that interface must be declared in global scope,
that was not checked in hidl-gen.

Also move scanner outside of AST.

Test: compiles, links, boots, hidl_test
Change-Id: Ida0c192b258e40c8cfe033f00a842444df0130ad
/system/tools/hidl/Interface.h
30b5d1ffe964d0b82008bfc8f4b8e61ab3bac86f 03-Apr-2017 Yifan Hong <elsk@google.com> Add getHashChain() to IBase.

Each interface has a getHashChain() method that
returns the hash of all .hal files from the rtti
of the interface up to IBase.

Test: hidl_test

Bug: 36602587
Change-Id: I13f2e54bd45593c70064dff05fa934d5cd01996a
/system/tools/hidl/Interface.h
424a948265821d514be42e9e2dd9a53cf515d0bb 14-Feb-2017 Steven Moreland <smoreland@google.com> IBase: add ping method

Add ping method to IBase. We deleted this from libhwbinder types, so
moving it to hidl types.

Bug: 34501346
Test: hidl_test
Change-Id: I1e13a48f1ca3668450def6434650763483baf34e
/system/tools/hidl/Interface.h
37065d636ffcb246da079837c1659dfab4d02438 07-Feb-2017 Andreas Huber <andih@google.com> Adds a debug(...) method to IBase, the base class for all Treble interfaces

The default implementation does nothing but this allows implementations to
emit diagnostics to a given file handle in a unified fashion.

Bug: 33961528
Test: hidl_test, hidl_test_java
Change-Id: Id7e8417275934c73032c9832c41e041d2d5d2fb7
/system/tools/hidl/Interface.h
bcffce24587acabb731f696f917c0284ac619524 02-Feb-2017 Yifan Hong <elsk@google.com> IBase::getReferenceInfo -> getDebugInfo

getDebugInfo is a more generalized name. Also, references
are not queryed from the server process, but rather only
pids and pointers to the server stub object is returned,
so that lshal can query from /d/binder/proc/{pid}.

Bug: 34777099
Bug: 34861460

Test: lshal
Test: NFC / light / audio with and without persistent.hal.binderized;
run lshal to reflect this.

Change-Id: I3052fe67074c856eb2f56c3948ba078a00d04c52
/system/tools/hidl/Interface.h
cd2ae45f51a5ad7089e2ec2fa922e2d4a0f7d136 31-Jan-2017 Yifan Hong <elsk@google.com> Add getReferenceInfo to IBase.

Also added a IMPL_STUB_IMPL for HIDL reserved methods that:
* add a method with the same name and signature
to BnHwFoo
* BnHwFoo::onTransact will call BnHwFoo::method instead of
_hidl_mImpl->method
* Content of IMPL_STUB_IMPL will go to BnHwFoo::method.

Test: make and tested NFC / light / audio
Test: hidl_test

Change-Id: I85f6314450178c02c7bcba91c8a9fffbce822c76
/system/tools/hidl/Interface.h
ffa913993fb527b44053c11f139689d3267748ec 31-Jan-2017 Yifan Hong <elsk@google.com> Get method signatures from IBase.hal

instead of hardcoding them in hidl-gen.

Test: hidl_test

Bug: 32559427

Change-Id: Ib0d3beca695fca47eb5f82d5d54c651da9af3687
/system/tools/hidl/Interface.h
c75fd47b91f2edea70bb88f5508d9a161b916045 11-Jan-2017 Yifan Hong <elsk@google.com> Add interfaceDescriptor() method to all interfaces

which returns interfaceChain[0].

Bug: 34136228
Test: hidl_test
Test: hidl_test_java
Change-Id: Id0d8139d51f39b1c317d966b305e883e561241b8
/system/tools/hidl/Interface.h
f5cc2f74e86504f7904a0a24e7fcc00fa19cd579 05-Jan-2017 Yifan Hong <elsk@google.com> Emit toString functions for all types.

* toString() is mainly for debugging purposes only.

* For HIDL internal types (hidl_string, hidl_vec, etc.)
toString() is found in ::android::hardware::details.

* For a user defined type
android.hardware.foo@1.0::IFoo.Type,
toString() is found in ::android::hardware::foo::V1_0.

* For bitfield<::anroid::hardware::foo::V1_0::T>
that gets translated to the underlying
numeric type of T, it doesn't make sense to override toString().
A templated toString() function for each user-defined HIDL enum \
is introduced into the same namespace; call it with
using namespace ::android::hardware::foo::V1_0;
toString<IFoo::MyEnumType>(value);

Test: hidl_test and look at the output of logcat

Bug: 33459772

Change-Id: I70eee018e31d700bf1376334276dbd343af5615f
/system/tools/hidl/Interface.h
dd85c5c9cc6ff58737809668d993c5e6eab673d7 04-Jan-2017 Zhuoyao Zhang <zhuoyao@google.com> Support to enable profiling dynamically.

* Add an additonal reserved method setHALInstrumentation to
enable/disable instrumentation during the hal execution.

Test: make hidl-gen
Change-Id: Iaf20e3f798a51b111bffd2e7294973bce0cabf9e
/system/tools/hidl/Interface.h
eefe4f2405c3cb0f1d164bdb748e5d0ded3624f9 05-Jan-2017 Yifan Hong <elsk@google.com> Clean up hard-coded Bp/Bn/Bs/IHw prefixes.

Also,
* use iface->localName() instead of "I" + iface->getBaseName()
* do not hardcode IBase related strings
* remove baseName in some places

Bug: 32559427
Test: hidl_test
Change-Id: Ib2049f570ca27d33a945dd6ccb5442e336a11262
/system/tools/hidl/Interface.h
51a6509db3078657a2401069c37515504b40c12c 05-Jan-2017 Yifan Hong <elsk@google.com> Renamed Interface::getProxyName to getProxyFqName

getStubName and getPassthroughName as well. This is
to allow a separate getProxyName that returns the name
only, so that they are consistent with getBaseName.

Test: compiles

Change-Id: I0c0d05523622209981d3337ca510127529ae4c38
/system/tools/hidl/Interface.h
b40ef02ca14e507a5a5b878c90eaac52ffe64fd9 02-Jan-2017 Martijn Coenen <maco@google.com> Callback elision for HIDL interfaces.

HIDL interface types are now elided.

Bug: 31380743
Test: mma, hidl_test, hidl_test_java
Change-Id: Ie2bcd67b9f1d8dbd4331a3c29ae1294ba75d0be7
/system/tools/hidl/Interface.h
115d428f9c38c078d679a98942c47ce4a17bd599 19-Dec-2016 Martijn Coenen <maco@google.com> Add (un)linkToDeath to generated interfaces.

(un)linkToDeath is now a part of IBase, and can be
called on any generated HIDL interface. The implementation
is a no-op, except in proxy objects, which are by
definition a different process than the interface they point
to.

Since clients are not aware of the transport implementation, we must
wrap the transport-independent callback in a transport-specific
callback object. In case of binder, that object is a
hidl_binder_death_recipient.

The binder proxy object contains a list of registered death
recipients, as well as a mutex to protect access to the list.
The list is required to allow us to map back transport-independent
callbacks to transport-dependent callbacks in unlinkToDeath().

Bug: 31632518
Test: mma, hidl_test
Change-Id: I5083a8789dd706a886a8a09f8c733031a351a36a
/system/tools/hidl/Interface.h
a63e0ad0b4fb276e9e00806f3f3934e64e3f1b34 07-Dec-2016 Martijn Coenen <maco@google.com> Stop generating IHw classes.

The main rationale of the IHw class was to be able
to cast binder objects to/from interfaces safely.
That functionality is now taking over by interfaceChain()
in IBase, together with the toBinder()/fromBinder() functions
in libhidl.

The remaining binder objects related to IFoo are now just
BpFoo and BnFoo, and both still inherit from IInterface.

Note that the IHw *header* itself remains, as it contains the
declarations for reading/writing datatypes related to the
interface into a Parcel.

Test: mma, hidl_test, hidl_test_java
Bug: 33173166
Change-Id: I6bbe1228830a413058d0e9dbb6345ed1c01aa97d
/system/tools/hidl/Interface.h
30bb6a869be0f3f82497b7b11c71ec9d47652ed0 30-Nov-2016 Steven Moreland <smoreland@google.com> Add a typeName() method to each type for error printing purposes.

Test: compiles with mma
Change-Id: I1283c395440282fde1106ad47aa185bdeda75880
/system/tools/hidl/Interface.h
c89340422f53046bfe24ff3e529161f9194120f8 18-Nov-2016 Yifan Hong <elsk@google.com> Hidlize IBase; use IBase instead of IBinder.

* IBase is hidlized over hwbinder. GenericBinder
is removed and Interface with name
android.hidl.base@1.0::IBase is used instead.

* Removed AST::mImportedNamesForJava, because in Java,
we always refer to a type with the full name. We don't
import anything in the java file.

* IFoo.h now includes HidlSupport.h instead of
HidlTransportSupport.h

Test: hidl_test
Test: hidl_test_java

Fix: 32756130
Fix: 33273293

Change-Id: I435ad7c68dea028a16252148b6f5778e3610b7cd
/system/tools/hidl/Interface.h
af712c083e79fb9990e56677cf4c80eacb9c3d3b 16-Nov-2016 Martijn Coenen <maco@google.com> Generate notifySyspropsChanged().

notifySyspropsChanged() can be used to notify
any HIDL interface of the fact that a system
property has changed, upon which the process
hosting the interface can take action.

The current implementation calls
report_sysprop_change(), which is a libcutils
function that will call a set of previously
registered callbacks.

One such callback is used for atrace, where the
enabled trace categories are stored in system
properties, and we need to notify running
services when those properties have changed.
Without notifying them, we'd need to have a
process to be restarted *while* a trace is
already running, which in the best case is
clumsy, and in the worst case totally
impractical.

(We may want to move this out of libcutils at
some point, but that is out of the scope of
this CL).

Bug: 31262344
Test: mma, hidl_test, hidl_test_java, systrace works without restart
Change-Id: I7b368e2a89ac9947cd0f8c4311df6c31d3ef4a8a
/system/tools/hidl/Interface.h
a588b23323213c525bf34dc0562679195afe611e 10-Nov-2016 Zhuoyao Zhang <zhuoyao@google.com> Support generating the new TYPE_HIDL_INTERFACE for vts.

* Needs to distiguish the callback interface vs normal interface. The
former has TYPE_HIDL_CALLBACK in vts and the latter has
TYPE_HILD_INTERFACE

Test: make hidl-gen
Bug: 32764837
Change-Id: Ic5bd44ed707ad302be98abe271abad1758ff276f
/system/tools/hidl/Interface.h
60e52bde289712dc0e561872022f9c2432069e1a 09-Nov-2016 Yifan Hong <elsk@google.com> Renamed Interface::get*Name methods

Test: mma

Bug: 32559427
Change-Id: I0ff972dc8172b4e246c443c6141d412fdf036aa2
/system/tools/hidl/Interface.h
158655a90308d8e5f03dc28b8330d5b0cce038f0 08-Nov-2016 Yifan Hong <elsk@google.com> Remove toBinder from IHidlInterfaceBase.

Bug: 32001926
Test: hidl_test

Bug: 32559427 (4) added FQName::getTopLevelHwName

Change-Id: Ibde4f76ee51b729722569d420262182ea750b05b
/system/tools/hidl/Interface.h
4ed1347cd29e6e07acad368891bb03078c798aba 02-Nov-2016 Yifan Hong <elsk@google.com> Remove extra from getJavaType.

Bug: 32559427
Test: hidl_test_java

Change-Id: I1a96630eed1b61ab4ff2959ced2e83f94e8fb36d
/system/tools/hidl/Interface.h
3b320f8a60e4343bf06319bca3fc949c95eaf326 01-Nov-2016 Yifan Hong <elsk@google.com> Remove extra from getCppType.

The argument is used for array type originally. We
now use hidl_array instead of T[], so there is no
need to use extra.

Renamed the convenience getCppType to getCppStackType
to avoid casting to (Type *) before using this
method (which makes it inconvenient)

Also fixes:
* RefType::getCppType ignores specifyNamespaces
* ConstantExpression.cpp emits a C-style cast instead
of static_cast

Bug: 32559427

Test: mma passes
Test: hidl_test

Change-Id: I7e2e31c34c1ca1aa83c4a5a4dbdf7fd6b9aff30c
/system/tools/hidl/Interface.h
a4b53d0da8c1c6889c361fd30b913adc364163bc 01-Nov-2016 Yifan Hong <elsk@google.com> Add location info to named types.

Bug: 31827278

Test: hidl_test
Change-Id: I1922d5c309c9706cef37ab34d28e1193d1e247cd
/system/tools/hidl/Interface.h
fe95aa243eb53df9cb46ca74192e760d7520b611 20-Oct-2016 Yifan Hong <elsk@google.com> cast functions for interfaces.

Test: hidl_test

Bug: 32001926

Change-Id: Ia788d775a668c4232c8a017a6b9430ddf16faca3
/system/tools/hidl/Interface.h
10fe0b55e774903fe37b658458053527da8b5a53 19-Oct-2016 Yifan Hong <elsk@google.com> IHidlInterfaceBase for all autogenerated interfaces.

Add an interfaceChain() method to each interface
to facilitate casting between interfaces.

Add ::descriptor for each interface (so that
IFoo::descriptor won't fall back to
IHidlInterfaceBase::descriptor.

Test: hidl_test
Test: cd system/tools/hidl && mma
Test: cd hardware/interfaces/test && mma

Bug: 32337854
Change-Id: I317b7905750db0bfefc4c5fd608a07080923c719
/system/tools/hidl/Interface.h
14ee6749f12bcd43477fe8110fbec38e15376b40 18-Oct-2016 Steven Moreland <smoreland@google.com> Emit error if function is overloaded.

Test: check error is reported correclty, hidl_test
Bug: 31758541

Change-Id: If82cb3fbd8c068c6e25cbc131a8102e24cf83988
/system/tools/hidl/Interface.h
7c5ddfb41a806a7bf71581952d06b637a7670cf7 29-Sep-2016 Andreas Huber <andih@google.com> Allow struct, union and enum type declarations to be annotated.

Change-Id: Idce594b47c324d8420638e2e8853da3c99150672
Bug: 31800672
Test: hidl_test, hidl_test_java
/system/tools/hidl/Interface.h
69e7c70e72dff0734d542b737ba8bb1178244218 09-Sep-2016 Steven Moreland <smoreland@google.com> Oneway keyword behavior in passthrough mode.

Added BsFoo class to output. This acts as a proxy similar to BpFoo,
however instead of delegating tasks accross the binder interface, it
does so directly to the implementation. The only added behavior is using
doing queueing up these function calls on another thread so that
the asynchronous behavior will match the binderized case.

BUG: 31237398

Change-Id: I099824f0f754089c824b368a188f8125a111f840
/system/tools/hidl/Interface.h
4c865b72b320a46f326a335cfd326b66b0e10f67 15-Sep-2016 Andreas Huber <andih@google.com> [Java hidl-gen] Fix multi-dimensional arrays (used within structures, not

as method arguments).

Bug: 31438033
Change-Id: I8e29ae8eca2a9ef8a320e37ca0bb79dcfa8a9b9a
/system/tools/hidl/Interface.h
d537ab02e1707597d70665fd8c75ca1ec9f57326 12-Sep-2016 Steven Moreland <smoreland@google.com> Remove dependency on libutils.

As part of this, TypeDef has also been converted to a NamedType. This is
because originally, Scope contained just a KeyedVector<localname, idx> of
types which it contained, and an std::vector<type> which idx indexes into
(KeyedVector<localname, type> alone would have also worked). However, now
it contains a std::map<localname, idx> instead. Because of this, we have lost
the ability to iterate over the keys (localnames) in O(n). By converting
TypeDef to a NamedType, name => idx => type such that name == type->name.
This also means that in function hierarchy calling Scope::addType, we no
longer have to pass around the tuple (name, type) since type->name == name,
and we can pass around only type.

Change-Id: I8f85afe0e389979a2fd98ff5eeccf47e3fcc8307
/system/tools/hidl/Interface.h
979e099f1163ff75beed5776cd01fb409b90a0cd 07-Sep-2016 Steven Moreland <smoreland@google.com> Added knowledge of namespacing into generation.

This is the first step in making code aware of namespacing. Currently,
the solution to generate symbols which are properly namespaced is to
post-process text after it is being outputed by a Formatter. Ideally
objects will know what namespace they are in and be able to print
themselves out accordingly. This change specifically will allow
generated code to remove namespaces from symbols that don't need
to be qualified entirely without relying on post-processing to remove
the namespace.

Change-Id: Ie535d05a64eb3d6c7d3b5451abdaa289c574170f
/system/tools/hidl/Interface.h
4078631353d6d34db21c890d1870e796eca6ea38 16-Aug-2016 Steven Moreland <smoreland@google.com> Split 'IFoo' into 'IFoo' and 'IHwFoo'

The traditional binder "IFoo" interface is coupled
very tightly with Binder; it inherits from Binder
objects and implements several Binder-only methods.

We want to abstract away the RPC mechanism as much as we can; therefore,
we want to create a "clean" IFoo interface, which contains just the
methods defined in the HIDL interface. Separately, there's an IHwFoo
interface, which implements IFoo as well as the necessary Binder
methods.

Changes in hidl-gen to support this:
- Generates IHwFoo.h
- Moved (DECLARE|IMPLEMENT)_HW_BINDER macros from IFoo to IHwFoo
- Added REGISTER_AND_GET_SERVICE macros to IFoo
- Removed all hwbinder/ include paths from IFoo
- When passing an interface through a HIDL method, wrap a
BnInterface object around it
- BnFoo's implementation of IFoo calls through the register
interface implementation
- Updated test code

Tests: hidl_test, hidl_java_test, libhwbinder bench, NFC all work.
Bug: 30588200
Change-Id: Ie7ca4eef905f84aebd06bee971b5f6170e169797
/system/tools/hidl/Interface.h
1aec397b1fdea7db4120dbe55b6995bb2a9d9138 26-Aug-2016 Andreas Huber <andih@google.com> Adds (C)opyright headers everywhere.

Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
/system/tools/hidl/Interface.h
80b217fa80694377cc0ad043e2385467dae2e179 24-Aug-2016 Andreas Huber <andih@google.com> Merge "Fix nested structure/union name handling."
864c771ca4ec8a01e31c7c243625b7a5f6316768 17-Aug-2016 Zhuoyao Zhang <zhuoyao@google.com> Enhanced hidl-gen support for generating vts files.

*Support callflow from mehtod annotations.
*Support inheritance for interfaces and types.
*Support Array and Union type.

b/30762234

Change-Id: I059b780d6362a557bb9cfd70d6c5ec0e73916ce3
/system/tools/hidl/Interface.h
9ed827c8cd6e8eddb1ad9987ab9413c1de8a27df 22-Aug-2016 Andreas Huber <andih@google.com> Fix nested structure/union name handling.

Local names must be assigned before processing the body.

Change-Id: I9c3e3d4b7575c612148aea89bbd424e59e3c0604
/system/tools/hidl/Interface.h
ea081b35840e687dfe7a5c11d4a546f2bf2db99e 18-Aug-2016 Andreas Huber <andih@google.com> Fix accidental infinite recursion in determining if an Interface is java

compatible or not. If that interface's methods (or something even farther
downstream) references the original interface we'll recurse indefinitely without
this fix.

Change-Id: Ib94dfec2dd32c00f1ee03c49d13f59f6e31f6d8d
/system/tools/hidl/Interface.h
295ad30bf6212c16accc5095601b2a71d44b4c8b 16-Aug-2016 Andreas Huber <andih@google.com> Support for a generic "binder" type (reflected as "interface" in hidl)

marshaled as a sp<hwbinder::IBinder>.

Bug: 30884691
Change-Id: I157d78fbbe839637805359441925aec597c52383
/system/tools/hidl/Interface.h
70a59e1dc3dcf32f791d2dd7966111d4adf32eca 16-Aug-2016 Andreas Huber <andih@google.com> Validate upfront that an interface is compatible with our Java backend,

emit diagnostics if it is not. Also cleans up all other error messages to
clearly indicate an error condition.

Bug: 30876839
Change-Id: I18bcd723107ab93abcad38c976f3c38dda60a743
/system/tools/hidl/Interface.h
5158db484e5ab302368f191d75d5b1334c270e52 10-Aug-2016 Zhuoyao Zhang <zhuoyao@google.com> Extend hidl-gen to support generate vts file.

b/30762234

TODO: add regression test.

Change-Id: I1c31fd9a85805cd450ea03cc0ccc750a756d1009
/system/tools/hidl/Interface.h
2831d5145675ead9f2fb767bf5fe4ae56b88349f 15-Aug-2016 Andreas Huber <andih@google.com> Initial commit of Java backend to hidl-gen.

Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
/system/tools/hidl/Interface.h
ba7e6e9d5d30a9d9a39daeb42d2ca2cd06234640 10-Aug-2016 Zhuoyao Zhang <zhuoyao@google.com> Support annotation for interface in hidl-gen.

Change-Id: I8b59695dad33473202b490ef0cb4bb928019b8ee
/system/tools/hidl/Interface.h
6cb08cf9f021a01d9d2b1eaec6729aac6ae70708 04-Aug-2016 Andreas Huber <andih@google.com> Support for inheritance of interfaces.
/system/tools/hidl/Interface.h
31629bcd51ab30bc0aadc69f3fc8ce4893eca900 03-Aug-2016 Andreas Huber <andih@google.com> Saner determination of a declared type's name (now short + full name)

at the time the type is introduced to a scope.
/system/tools/hidl/Interface.h
867fcb63af8c3ac96ed1b3f3950525aa70393bdf 03-Aug-2016 Andreas Huber <andih@google.com> bye bye, dump(), RefType no longer gets a name.
/system/tools/hidl/Interface.h
881227d860c59471eee31d39946e96ce2daa35d6 02-Aug-2016 Andreas Huber <andih@google.com> generate C++ interface header, proxy and stub headers and sources.
/system/tools/hidl/Interface.h
a2723d26427f7db19777dfed330047253e7a4e1b 30-Jul-2016 Andreas Huber <andih@google.com> Enforce naming conventions and allow empty (except for the header) types.hal files.
/system/tools/hidl/Interface.h
c9410c7e62a33fd7599b2f3e025093a2d171577e 28-Jul-2016 Andreas Huber <andih@google.com> initial commit of reimplementation of hidl-gen

commit 56da787631c17276bc987f19649c6c1ea92200c3
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 12:18:57 2016 -0700

ast.cpp => AST.cpp

commit 095552aba072152d9c87475895cd2e97c43b7b03
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:43:04 2016 -0700

TypeContainer => Scope, since it now also holds constants.

commit 89ec1c511e7806037a53e43333c37fdf1b7aa39e
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:41:05 2016 -0700

initial support for constants

commit b60b7ae588654b634bfdc5c283a25dd6378e1df7
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:01:46 2016 -0700

Support for typedef, maintain ordering inside TypeContainer

commit 8e83034a077ce2309deeb0e2094079cf6f11d8b4
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:36:29 2016 -0700

support for optional super interface

commit 9d44b022adb4a68dfca67ba2a6d845b7c8f27b88
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:28:18 2016 -0700

ast => AST

commit 48fd7f8a4e8ecf230cfc416aec6c8f6115e410af
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:26:44 2016 -0700

Each type in its own source/header file pair.

commit ca1285ecbcbbb1340eec476e3fd4d1334908d8c1
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 08:52:24 2016 -0700

added scalar types "char", "bool" and "opaque"

commit fbb351e5f4392fcbbce77402dfe059a1c8d79fb2
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 13:47:32 2016 -0700

some fixes to the parser and ast.

commit 78288216b101349e9364c2d4470ecb5b9a942f5c
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 12:34:21 2016 -0700

Formatter, AST::dump(), NamedType

commit 4b8cc5d0a8ff5f70cb53e21b56138124259b8bcb
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 11:45:10 2016 -0700

revamp of the parser, scoped type containers

commit 0193fbfa5c7ac3ac1ce306dfb9c55d879f8c02b5
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 10:13:35 2016 -0700

store output in AST.

commit 7f53022123978cc7c2a05b0c4aba7a4c5deea93b
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 10:06:54 2016 -0700

reentrant lexer/parser

commit 3d3e343d6cea2fb127b203071e8aff08a5715011
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 15:27:02 2016 -0700

better typename lookup, comments.

commit 39f13ae860dbd9ffd163a5c99f150170525457ef
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 14:29:33 2016 -0700

an actual AST.

commit b1f3f1d94a8d1257426da35ace5bc2af04c433b6
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 12:51:34 2016 -0700

initial commit

Change-Id: I44d1d928a5f3dcb908e264d53af09bbe25d8c464
/system/tools/hidl/Interface.h