Add build-time checks of AIDL API hashes

All frozen AIDL APIs are required to have a hash, and these are checked
for accuracy at build time. This ensures that these interfaces aren't
changed, since we are relying on their stability over time.

Bug: 150154330
Test: atest CtsNdkBinderTestCases, freeze a new interface and verify
Merged-In: Iff9ce5b8022ebd587ee451eb45d070e500da430a
Change-Id: I34b618387895d6a3de7a9035acdc0691952a2925
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 957c0d0..2cc280e 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -868,7 +868,7 @@
   ASSERT_TRUE(result);
   string actual;
   EXPECT_TRUE(io_delegate_.GetWrittenContents("dump/foo/bar/IFoo.aidl", &actual));
-  EXPECT_EQ(actual, R"(package foo.bar;
+  EXPECT_EQ(actual, string(kPreamble).append(R"(package foo.bar;
 /* @hide */
 interface IFoo {
   /* @hide */
@@ -880,10 +880,10 @@
   const int A = 1;
   const String STR = "Hello";
 }
-)");
+)"));
 
   EXPECT_TRUE(io_delegate_.GetWrittenContents("dump/foo/bar/Data.aidl", &actual));
-  EXPECT_EQ(actual, R"(package foo.bar;
+  EXPECT_EQ(actual, string(kPreamble).append(R"(package foo.bar;
 /* @hide */
 parcelable Data {
   /* @hide */
@@ -896,7 +896,7 @@
   /* @hide */
   @nullable String[] c;
 }
-)");
+)"));
 }
 
 TEST_F(AidlTest, ApiDumpWithManualIds) {
@@ -915,13 +915,13 @@
   ASSERT_TRUE(result);
   string actual;
   EXPECT_TRUE(io_delegate_.GetWrittenContents("dump/foo/bar/IFoo.aidl", &actual));
-  EXPECT_EQ(actual, R"(package foo.bar;
+  EXPECT_EQ(actual, string(kPreamble).append(R"(package foo.bar;
 interface IFoo {
   int foo() = 1;
   int bar() = 2;
   int baz() = 10;
 }
-)");
+)"));
 }
 
 TEST_F(AidlTest, ApiDumpWithManualIdsOnlyOnSomeMethods) {