auto import from //depot/cupcake/@137055
diff --git a/core/Makefile b/core/Makefile
index 2983628..9ba117a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -899,6 +899,7 @@
 
 .PHONY: installed-file-list
 installed-file-list: $(INSTALLED_FILES_FILE)
+$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE))
 
 # -----------------------------------------------------------------
 # A zip of the tests that are built when running "make tests".
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 01bf9a5..50b56f9 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -123,7 +123,11 @@
 ifdef PREVIOUS_BUILD_CONFIG
   ifneq "$(current_build_config)" "$(PREVIOUS_BUILD_CONFIG)"
     $(info *** Build configuration changed: "$(PREVIOUS_BUILD_CONFIG)" -> "$(current_build_config)")
-    force_installclean := true
+    ifneq ($(DISABLE_AUTO_INSTALLCLEAN),true)
+      force_installclean := true
+    else
+      $(info DISABLE_AUTO_INSTALLCLEAN is set; skipping auto-clean. Your tree may be in an inconsistent state.)
+    endif
   endif
 endif  # else, this is the first build, so no need to clean.
 PREVIOUS_BUILD_CONFIG :=
diff --git a/core/definitions.mk b/core/definitions.mk
index 67f7166..3efef8d 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -558,7 +558,7 @@
 else
 define pretty
 endef
-hide := 
+hide :=
 endif
 
 ###########################################################
@@ -984,7 +984,7 @@
 ###########################################################
 ## Commands for running gcc to link a statically linked
 ## executable.  In practice, we only use this on arm, so
-## the other platforms don't have the 
+## the other platforms don't have the
 ## transform-o-to-static-executable defined
 ###########################################################
 
@@ -1033,7 +1033,7 @@
 
 
 ###########################################################
-## Commands for running javac to make .class files 
+## Commands for running javac to make .class files
 ###########################################################
 
 #@echo "Source intermediates dir: $(PRIVATE_SOURCE_INTERMEDIATES_DIR)"
@@ -1064,9 +1064,9 @@
 endef
 
 ifeq ($(HOST_OS),windows)
-xlint_unchecked := 
+xlint_unchecked :=
 else
-#xlint_unchecked := -Xlint:unchecked 
+#xlint_unchecked := -Xlint:unchecked
 endif
 
 # emit-line, <word list>, <output file>
@@ -1102,7 +1102,7 @@
 
 # For a list of jar files, unzip them to a specified directory,
 # but make sure that no META-INF files come along for the ride.
-# 
+#
 # $(1): files to unzip
 # $(2): destination directory
 define unzip-jar-files
@@ -1250,7 +1250,7 @@
 endef
 
 # TODO(joeo): If we can ever upgrade to post 3.81 make and get the
-# new prebuilt rules to work, we should change this to copy the 
+# new prebuilt rules to work, we should change this to copy the
 # resources to the out directory and then copy the resources.
 
 # Note: not using aapt tool for this because we aren't making
@@ -1263,11 +1263,15 @@
 @mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
 $(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES), \
     $(PRIVATE_CLASS_INTERMEDIATES_DIR))
+$(call dump-words-to-file,$(sort\
+	$(PRIVATE_JAVA_SOURCES)),\
+	$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq)
 $(hide) $(HOST_JAVAC) -encoding ascii -g \
 	$(xlint_unchecked) \
 	$(addprefix -classpath ,$(strip \
 		$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
-	-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_JAVA_SOURCES) || \
+	-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR)\
+        \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq || \
 	( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )
 $(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
     $@ $(PRIVATE_JAR_MANIFEST) $(PRIVATE_EXTRA_JAR_ARGS) \
@@ -1482,4 +1486,3 @@
 #	  sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
 #	      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
 #	  rm -f $*.d
-
diff --git a/core/main.mk b/core/main.mk
index 1369944..1f3412f 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -136,11 +136,17 @@
   ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
     WITH_DEXPREOPT := true
   endif
+  
+  # Disallow mock locations by default for user builds
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
+  
 else # !user_variant
   # Turn on checkjni for non-user builds.
   ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
   # Set device insecure for non-user builds.
   ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
+  # Allow mock locations by default for non user builds
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
 endif # !user_variant
 
 ifeq (true,$(strip $(enable_target_debugging)))
diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map
index 3ac09a4..429ae1a 100644
--- a/core/prelink-linux-arm.map
+++ b/core/prelink-linux-arm.map
@@ -91,6 +91,7 @@
 libqcamera.so           0xA9400000
 
 # pv libraries
+libopencorenet_support.so     0xA7D20000
 libpvasf.so                   0xA7BC0000
 libpvasfreg.so                0xA7B70000
 libopencoredownload.so        0xA7B40000
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index c9df6c4..9ef99db 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -15,22 +15,7 @@
 cts_dir := $(HOST_OUT)/cts
 cts_tools_src_dir := cts/tools
 
-# Build a name that looks like:
-#
-#     linux-x86   --> android-cts_linux-x86
-#     darwin-x86  --> android-cts_mac-x86
-#     windows-x86 --> android-cts_windows
-#
 cts_name := android-cts
-ifeq ($(HOST_OS),darwin)
-    cts_host_os := mac
-else
-    cts_host_os := $(HOST_OS)
-endif
-ifneq ($(HOST_OS),windows)
-    cts_host_os := $(cts_host_os)-$(HOST_ARCH)
-endif
-cts_name := $(cts_name)_$(cts_host_os)
 
 CTS_EXECUTABLE := cts
 ifeq ($(HOST_OS),windows)
@@ -48,13 +33,13 @@
 	CtsDatabaseTestCases \
 	CtsGraphicsTestCases \
 	CtsLocationTestCases \
-	CtsNetTestCases \
 	CtsOsTestCases \
 	CtsProviderTestCases \
 	CtsTextTestCases \
 	CtsUtilTestCases \
 	CtsViewTestCases \
 	CtsWidgetTestCases \
+	CtsNetTestCases \
 	SignatureTest
 
 DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans
@@ -85,6 +70,9 @@
      $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR)
 
 # Package CTS and clean up.
+#
+# TODO:
+#   Pack cts.bat into the same zip file as well. See http://buganizer/issue?id=1656821 for more details
 INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip
 $(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name)
 $(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir)