Add build number into CTS Verifier.

Change-Id: I10f98415d89eea50a7b0a652f882200f2eaf062b
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index b6a7b71..7f43962 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -36,6 +36,8 @@
 
 LOCAL_PACKAGE_NAME := CtsVerifier
 
+LOCAL_AAPT_FLAGS += --version-name "5.0_r1.91 $(BUILD_NUMBER)"
+
 LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni
 
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index a99408f..4ce9ecd 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -17,8 +17,7 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.android.cts.verifier"
-      android:versionCode="5"
-      android:versionName="5.0_r1.91">
+      android:versionCode="5">
 
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21"/>
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
index dc2502c..05c5e77 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
@@ -96,6 +96,7 @@
         xml.startTag(null, VERIFIER_INFO_TAG);
         xml.attribute(null, "version-name", Version.getVersionName(mContext));
         xml.attribute(null, "version-code", Integer.toString(Version.getVersionCode(mContext)));
+        xml.attribute(null, "build", Version.getBuildNumber(mContext));
         xml.endTag(null, VERIFIER_INFO_TAG);
 
         xml.startTag(null, DEVICE_INFO_TAG);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/Version.java b/apps/CtsVerifier/src/com/android/cts/verifier/Version.java
index e7b6121..dfe9508 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/Version.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/Version.java
@@ -24,13 +24,21 @@
 class Version {
 
     static String getVersionName(Context context) {
-        return getPackageInfo(context).versionName;
+        return getVersionNameStrings(context)[0];
     }
 
     static int getVersionCode(Context context) {
         return getPackageInfo(context).versionCode;
     }
 
+    static String getBuildNumber(Context context) {
+        return getVersionNameStrings(context)[1];
+    }
+
+    static private String[] getVersionNameStrings(Context context) {
+        return getPackageInfo(context).versionName.split(" ");
+    }
+
     static PackageInfo getPackageInfo(Context context) {
         try {
             PackageManager packageManager = context.getPackageManager();