Descriptor annotation is added
The descriptor annotation allows the author of an AIDL interface to
override the interface descriptor token which by default is set to the
fully qualified name of the interface. For example,
package android.foo;
@Descriptor(value="android.bar.IWorld")
interface IHello {...}
The descriptor of the above interface is "android.bar.IWorld". If the
Descriptor annotation was missing, it would have been
"android.foo.IHello".
This would be useful when an already published interface has to be
renamed. By making the descriptor of the renamed interface to be the
descriptor of the interface before the renaiming, the interfaces -
before and after the renaming - can talk to each other.
Bug: 165712106
Test: atest aidl_unittests
Test: atest aidl_integration_test
Change-Id: I9cee8d883925f4d53adde4a131af450fb689b269
diff --git a/aidl_language.h b/aidl_language.h
index 74ef07d..64a8a0f 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -168,6 +168,7 @@
JAVA_DEBUG,
JAVA_ONLY_IMMUTABLE,
FIXED_SIZE,
+ DESCRIPTOR,
};
static std::string TypeToString(Type type);
@@ -236,6 +237,7 @@
bool IsStableApiParcelable(Options::Language lang) const;
bool IsHide() const;
bool IsJavaDebug() const;
+ std::string GetDescriptor() const;
void DumpAnnotations(CodeWriter* writer) const;
@@ -872,6 +874,8 @@
bool LanguageSpecificCheckValid(const AidlTypenames& typenames,
Options::Language lang) const override;
+ std::string GetDescriptor() const;
+
private:
std::vector<std::unique_ptr<AidlMethod>> methods_;
std::vector<std::unique_ptr<AidlConstantDeclaration>> constants_;