1# Defining constants as part of an interface 2 3AIDL has been enhanced to support defining integer and string constants 4as part of an interface. 5 6## Integer constants 7 8``` 9interface IMyInterface { 10 const int CONST_A = 1; 11 const int CONST_B = 2; 12 const int CONST_C = 3; 13 ... 14} 15``` 16 17These map to appropriate 32 bit integer class constants in Java and C++ (e.g. 18`IMyInterface.CONST_A` and `IMyInterface::CONST_A` respectively). 19 20## String constants 21 22``` 23interface IMyInterface { 24 const String CONST_A = "foo"; 25 const String CONST_B = "bar"; 26 ... 27} 28``` 29 30These map to class level String constants in Java, and static getter 31functions that return a const android::String16& in C++. 32 33The constants are limited to contain printable ASCII characters < 0x10 34and without backspaces (i.e. no '\' character). 35 36