Switch to use ro.build.display.id instead of ro.build.id.

These two properties are equivalent on Nexus devices, but the 'display' variant
often has more meaningful data on other devices.

Change-Id: I8411fa02b62f920f3d79426a57a9fd8fcce886b1
diff --git a/src/com/android/tradefed/build/DeviceBuildDescriptor.java b/src/com/android/tradefed/build/DeviceBuildDescriptor.java
index dd4ffb9..fffc021 100644
--- a/src/com/android/tradefed/build/DeviceBuildDescriptor.java
+++ b/src/com/android/tradefed/build/DeviceBuildDescriptor.java
@@ -56,8 +56,8 @@
     }
 
     /**
-     * Gets the device build alias. Maps to the ro.build.id property on device. Typically follows
-     * format IMM76.
+     * Gets the device build alias. Maps to the {@link ITestDevice#DISPLAYED_BUILD_ID_PROP}
+     * property on device. Typically follows format IMM76.
      */
     public String getDeviceBuildAlias() {
         return mBuild.getBuildAttributes().get(DEVICE_BUILD_ALIAS);
@@ -86,7 +86,8 @@
     public static void injectDeviceAttributes(ITestDevice device, IBuildInfo b)
             throws DeviceNotAvailableException {
         b.addBuildAttribute(DEVICE_BUILD_ID, device.getBuildId());
-        b.addBuildAttribute(DEVICE_BUILD_ALIAS, device.getProperty("ro.build.id"));
+        b.addBuildAttribute(DEVICE_BUILD_ALIAS, device.getProperty(
+                ITestDevice.DISPLAYED_BUILD_ID_PROP));
         b.addBuildAttribute(DEVICE_PRODUCT, device.getProperty("ro.product.name"));
         b.addBuildAttribute(DEVICE_BUILD_TYPE, device.getProperty("ro.build.type"));
     }
diff --git a/src/com/android/tradefed/device/DeviceManager.java b/src/com/android/tradefed/device/DeviceManager.java
index 34a2320..d8b08f8 100644
--- a/src/com/android/tradefed/device/DeviceManager.java
+++ b/src/com/android/tradefed/device/DeviceManager.java
@@ -932,7 +932,7 @@
                     deviceState,
                     getDisplay(selector.getDeviceProductType(device)),
                     getDisplay(selector.getDeviceProductVariant(device)),
-                    getDisplay(device.getProperty("ro.build.id")),
+                    getDisplay(device.getProperty(ITestDevice.DISPLAYED_BUILD_ID_PROP)),
                     getDisplay(selector.getBatteryLevel(device)))
             );
         }
diff --git a/src/com/android/tradefed/device/ITestDevice.java b/src/com/android/tradefed/device/ITestDevice.java
index e2b8ab5..d6b2523 100644
--- a/src/com/android/tradefed/device/ITestDevice.java
+++ b/src/com/android/tradefed/device/ITestDevice.java
@@ -52,6 +52,13 @@
     }
 
     /**
+     * The property name of the device's 'displayed' build ID. This is typically a more
+     * user-friendly presentation than {@link ITestDevice#getBuildId()} which for Nexus devices is
+     * typically an integer.
+     */
+    public static final String DISPLAYED_BUILD_ID_PROP = "ro.build.display.id";
+
+    /**
      * A simple struct class to store information about a single mountpoint
      */
     public static class MountPointInfo {
diff --git a/tests/src/com/android/tradefed/targetprep/DeviceSetupTest.java b/tests/src/com/android/tradefed/targetprep/DeviceSetupTest.java
index 3fdb381..823d511 100644
--- a/tests/src/com/android/tradefed/targetprep/DeviceSetupTest.java
+++ b/tests/src/com/android/tradefed/targetprep/DeviceSetupTest.java
@@ -90,7 +90,8 @@
         // expect a bunch of shell commands - no need to verify which ones
         EasyMock.expect(mMockDevice.executeShellCommand((String)EasyMock.anyObject())).
                 andReturn("").anyTimes();
-        EasyMock.expect(mMockDevice.getProperty("ro.build.id")).andReturn("IMM76K");
+        EasyMock.expect(mMockDevice.getProperty(ITestDevice.DISPLAYED_BUILD_ID_PROP)).andReturn(
+                "IMM76K");
     }
 
     /**