distinguish signed and unsigned user builds in UI

Add "dev-keys" or "test-keys" to the value of ro.build.display.id for
user builds.  (This is the property that is displayed under "Build
number" in the Settings UI.)  Modify the signing script to remove the
keys tag from this value when signing.

Change-Id: I3d9d92056f8567d7f84b1be047619be7c6e4c419
diff --git a/core/Makefile b/core/Makefile
index 55ab6a5..d610867 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -96,10 +96,11 @@
 # Both of these tags will be removed and replaced with "release-keys"
 # when the target-files is signed in a post-build step.
 ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
-BUILD_VERSION_TAGS += test-keys
+BUILD_KEYS := test-keys
 else
-BUILD_VERSION_TAGS += dev-keys
+BUILD_KEYS := dev-keys
 endif
+BUILD_VERSION_TAGS += $(BUILD_KEYS)
 BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
 
 # A human-readable string that descibes this build in detail.
@@ -121,9 +122,9 @@
 
   # Dev. branches should have DISPLAY_BUILD_NUMBER set
   ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
-    BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
+    BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) $(BUILD_KEYS)
   else
-    BUILD_DISPLAY_ID := $(BUILD_ID)
+    BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
   endif
 else
   # Non-user builds should show detailed build information
diff --git a/tools/releasetools/sign_target_files_apks b/tools/releasetools/sign_target_files_apks
index 9fb1008..5556573 100755
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -196,6 +196,11 @@
         value = " ".join(pieces)
       elif key == "ro.build.tags":
         value = EditTags(value)
+      elif key == "ro.build.display.id":
+        # change, eg, "JWR66N dev-keys" to "JWR66N"
+        value = value.split()
+        if len(value) == 2 and value[1].endswith("-keys"):
+          value = value[0]
       line = key + "=" + value
     if line != original_line:
       print "  replace: ", original_line