Merge "Use ARCH_ARM_HAVE_ARMV7A to select qemu kernel for dexpreopt"
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/core/definitions.mk b/core/definitions.mk
index 1afbb90..4b39d0b 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1221,7 +1221,7 @@
 define create-resource-java-files
 @mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR)
 @mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
-$(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m -z \
+$(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
     $(eval # PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
     $(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
     $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
@@ -1367,7 +1367,7 @@
 #values; applications can override these by explicitly stating
 #them in their manifest.
 define add-assets-to-package
-$(hide) $(AAPT) package -z -u $(PRIVATE_AAPT_FLAGS) \
+$(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
     $(addprefix -c , $(PRODUCT_AAPT_CONFIG)) \
     $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
     $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
diff --git a/core/java.mk b/core/java.mk
index bc81eae..baa83ee 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -82,6 +82,7 @@
     $(full_classes_jar) \
     $(full_classes_compiled_jar) \
     $(full_classes_emma_jar) \
+    $(full_classes_full_names_jar) \
     $(full_classes_stubs_jar) \
     $(full_classes_jarjar_jar) \
     $(built_dex)
@@ -153,7 +154,7 @@
 # be done after the inclusion of base_rules.mk.
 ALL_MODULES.$(LOCAL_MODULE).CHECKED := $(full_classes_compiled_jar)
 
-ifneq ($(LOCAL_NO_EMMA_COMPILE),true) 
+ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
 # If you instrument class files that have local variable debug information in
 # them emma does not correctly maintain the local variable table.
 # This will cause an error when you try to convert the class files for Android.
@@ -161,7 +162,7 @@
 # line and source debug information, not local information.
 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g:{lines,source}
 else
-# when emma is off, compile with the default flags, which contain full debug 
+# when emma is off, compile with the default flags, which contain full debug
 # info
 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
 endif
@@ -177,9 +178,12 @@
 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
 # $(full_classes_emma_jar)
-$(full_classes_emma_jar): $(full_classes_compiled_jar)
+$(full_classes_emma_jar): $(full_classes_compiled_jar) | $(EMMA_JAR)
 	$(transform-classes.jar-to-emma)
 $(PRIVATE_EMMA_COVERAGE_FILE): $(full_classes_emma_jar)
+
+# tell proguard to load emma jar
+LOCAL_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) $(addprefix -libraryjars ,$(EMMA_JAR))
 else
 $(full_classes_emma_jar): $(full_classes_compiled_jar) | $(ACP)
 	@echo Copying: $<
diff --git a/core/package.mk b/core/package.mk
index 0b9036b..24807f9 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -74,6 +74,11 @@
 
 #$(warning $(LOCAL_PATH) $(LOCAL_PACKAGE_NAME) $(sort $(LOCAL_MODULE_TAGS)))
 
+ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
+# Force localization check if it's not tagged as tests.
+LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
+endif
+
 ifeq (,$(LOCAL_ASSET_DIR))
 LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
 endif
diff --git a/core/proguard.flags b/core/proguard.flags
index 3544b90..06e32cc 100644
--- a/core/proguard.flags
+++ b/core/proguard.flags
@@ -38,6 +38,12 @@
     java.lang.Class class$(java.lang.String, boolean);
 }
 
+# Keep classes and methods that have the guava @VisibleForTesting annotation
+-keep @com.google.common.annotations.VisibleForTesting class *
+-keepclassmembers class * {
+@com.google.common.annotations.VisibleForTesting *;
+}
+
 # Please specify classes to be kept explicitly in your package's configuration.
 # -keep class * extends android.app.Activity
 # -keep class * extends android.view.View
diff --git a/tools/warn.py b/tools/warn.py
index 6fea20a..8097123 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# This file uses the following encoding: utf-8
 
 import sys
 import re
@@ -51,6 +52,7 @@
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'Incompatible pointer types',
         'patterns':[r".*: warning: assignment from incompatible pointer type",
+                    r".*: warning: return from incompatible pointer type",
                     r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
                     r".*: warning: initialization from incompatible pointer type"] },
     { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-fno-builtin',
@@ -61,7 +63,8 @@
         'patterns':[r".*: warning: unused parameter '.*'"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused',
         'description':'Unused function, variable or label',
-        'patterns':[r".*: warning: '.+' defined but not used"] },
+        'patterns':[r".*: warning: '.+' defined but not used",
+                    r".*: warning: unused variable '.+'"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused-value',
         'description':'Statement with no effect',
         'patterns':[r".*: warning: statement with no effect"] },
@@ -82,6 +85,9 @@
         'patterns':[r".*: warning: comparison between signed and unsigned",
                     r".*: warning: comparison of promoted \~unsigned with unsigned",
                     r".*: warning: signed and unsigned type in conditional expression"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
+        'description':'Comparison between enum and non-enum',
+        'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
     { 'category':'libpng',  'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'libpng: zero area',
         'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
@@ -215,6 +221,12 @@
         'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
         'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
     { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
+        'description':'aapt: No default translation',
+        'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
+    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
+        'description':'aapt: Missing default or required localization',
+        'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
+    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'aapt: String marked untranslatable, but translation exists',
         'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
     { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
@@ -228,7 +240,8 @@
         'patterns':[r".*: warning: backslash and newline separated by space"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Warray-bounds',
         'description':'Array subscript out of bounds',
-        'patterns':[r".*: warning: array subscript is above array bounds"] },
+        'patterns':[r".*: warning: array subscript is above array bounds",
+                    r".*: warning: array subscript is below array bounds"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
         'description':'Decimal constant is unsigned only in ISO C90',
         'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
@@ -267,6 +280,9 @@
         'patterns':[r".*: warning:   '.+'"] },
     { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
         'description':'',
+        'patterns':[r".*: warning:   base '.+'"] },
+    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
+        'description':'',
         'patterns':[r".*: warning:   when initialized here"] },
     { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-parameter-type',
         'description':'Parameter type not specified',
@@ -301,6 +317,9 @@
     { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wcomment',
         'description':'Line continuation inside comment',
         'patterns':[r".*: warning: multi-line comment"] },
+    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wcomment',
+        'description':'Comment inside comment',
+        'patterns':[r".*: warning: "".+"" within comment"] },
     { 'category':'C/C++',   'severity':severity.HARMLESS, 'members':[], 'option':'',
         'description':'Extra tokens after #endif',
         'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
@@ -339,6 +358,24 @@
     { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
         'description':'Converting from <type> to <other type>',
         'patterns':[r".*: warning: converting to '.+' from '.+'"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
+        'description':'Return value from void function',
+        'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
+    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'',
+        'description':'Useless specifier',
+        'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
+    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'',
+        'description':'Duplicate logtag',
+        'patterns':[r".*: warning: tag "".+"" \(None\) duplicated in .+"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
+        'description':'Operator new returns NULL',
+        'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
+        'description':'NULL used in arithmetic',
+        'patterns':[r".*: warning: NULL used in arithmetic"] },
+    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
+        'description':'Use of deprecated method',
+        'patterns':[r".*: warning: '.+' is deprecated .+"] },
 
     # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
     { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'',
@@ -491,6 +528,9 @@
 # read the log file and classify all the warnings
 lastmatchedline = ''
 for line in infile:
+    # replace fancy quotes with plain ol' quotes
+    line = line.replace("‘", "'");
+    line = line.replace("’", "'");
     if warningpattern.match(line):
         if line != lastmatchedline:
             classifywarning(line)