Fix how we build the statsd protos.

This lets us include frameworks protos, and use the constants
and messages from them.

Change-Id: I609d6e524f780e6a5beea543a68561bede47813e
Test: make
diff --git a/cmds/incident_helper/Android.bp b/cmds/incident_helper/Android.bp
index fc0bdcc..d7b6d69 100644
--- a/cmds/incident_helper/Android.bp
+++ b/cmds/incident_helper/Android.bp
@@ -50,12 +50,15 @@
         "testdata/*",
     ],
 
-    shared_libs: [
-        "libprotobuf-cpp-full",
-    ],
-
     static_libs: [
         "libgmock",
         "libplatformprotos"
     ],
+
+    shared_libs: [
+        "libprotobuf-cpp-full"
+    ],
+    proto: {
+        type: "full",
+    },
 }
diff --git a/cmds/incident_helper/tests/CpuFreqParser_test.cpp b/cmds/incident_helper/tests/CpuFreqParser_test.cpp
index 1c2f9e5..82deee4 100644
--- a/cmds/incident_helper/tests/CpuFreqParser_test.cpp
+++ b/cmds/incident_helper/tests/CpuFreqParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -125,6 +118,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
diff --git a/cmds/incident_helper/tests/CpuInfoParser_test.cpp b/cmds/incident_helper/tests/CpuInfoParser_test.cpp
index bbc14bc..8dce53e 100644
--- a/cmds/incident_helper/tests/CpuInfoParser_test.cpp
+++ b/cmds/incident_helper/tests/CpuInfoParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -153,6 +146,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
diff --git a/cmds/incident_helper/tests/KernelWakesParser_test.cpp b/cmds/incident_helper/tests/KernelWakesParser_test.cpp
index a8fa6208..a98c62b 100644
--- a/cmds/incident_helper/tests/KernelWakesParser_test.cpp
+++ b/cmds/incident_helper/tests/KernelWakesParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -76,7 +69,7 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
 
@@ -114,6 +107,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
diff --git a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
index de64e70..a9e6e816 100644
--- a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
+++ b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -108,6 +101,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
-}
\ No newline at end of file
+}
diff --git a/cmds/incident_helper/tests/ProcrankParser_test.cpp b/cmds/incident_helper/tests/ProcrankParser_test.cpp
index e86647a..76b25d7 100644
--- a/cmds/incident_helper/tests/ProcrankParser_test.cpp
+++ b/cmds/incident_helper/tests/ProcrankParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -104,7 +97,7 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
 
@@ -142,6 +135,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }
diff --git a/cmds/incident_helper/tests/SystemPropertiesParser_test.cpp b/cmds/incident_helper/tests/SystemPropertiesParser_test.cpp
index 98838e9..2fe2411 100644
--- a/cmds/incident_helper/tests/SystemPropertiesParser_test.cpp
+++ b/cmds/incident_helper/tests/SystemPropertiesParser_test.cpp
@@ -21,7 +21,7 @@
 #include <android-base/file.h>
 #include <android-base/test_utils.h>
 #include <gmock/gmock.h>
-#include <google/protobuf/message.h>
+#include <google/protobuf/message_lite.h>
 #include <gtest/gtest.h>
 #include <string.h>
 #include <fcntl.h>
@@ -42,13 +42,6 @@
         ASSERT_TRUE(tf.fd != -1);
     }
 
-    string getSerializedString(::google::protobuf::Message& message) {
-        string expectedStr;
-        message.SerializeToFileDescriptor(tf.fd);
-        ReadFileToString(tf.path, &expectedStr);
-        return expectedStr;
-    }
-
 protected:
     TemporaryFile tf;
 
@@ -99,6 +92,6 @@
 
     CaptureStdout();
     ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
-    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
+    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
     close(fd);
 }