Merge "Fix regex for finding symbol data."
diff --git a/core/combo/TARGET_linux-aarch64.mk b/core/combo/TARGET_linux-aarch64.mk
index bdb3017..1b24435 100644
--- a/core/combo/TARGET_linux-aarch64.mk
+++ b/core/combo/TARGET_linux-aarch64.mk
@@ -77,12 +77,6 @@
 
 TARGET_GLOBAL_CFLAGS += \
 			-fpic -fPIE \
-			$(arch_variant_cflags) \
-			-include $(android_config_h) \
-			-I $(dir $(android_config_h))
-
-TARGET_GLOBAL_CFLAGS += \
-			-fpic -fPIE \
 			-ffunction-sections \
 			-fdata-sections \
 			-funwind-tables \
@@ -94,6 +88,9 @@
 			-include $(android_config_h) \
 			-I $(dir $(android_config_h))
 
+# TODO - remove __ANDROID__ after the next aarch64 toolchain refresh
+TARGET_GLOBAL_CFLAGS += -D__ANDROID__=1
+
 TARGET_GLOBAL_CFLAGS += -fno-strict-volatile-bitfields
 
 # This is to avoid the dreaded warning compiler message:
diff --git a/tools/releasetools/sign_target_files_apks b/tools/releasetools/sign_target_files_apks
index 00693b8..ab24706 100755
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -235,8 +235,9 @@
       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]
+        if len(value) >  1 and value[-1].endswith("-keys"):
+          value.pop()
+        value = " ".join(value)
       line = key + "=" + value
     if line != original_line:
       print "  replace: ", original_line