Updating Security String to 2017-01-01 on nyc-dev am: 202380f93e am: 6108f21d36 am: 6a954bbdbc am: 2e5e286112 am: 7a83d3131b
am: 3e3c6e34ae

Change-Id: I59b7bf97a357831395c0810c467c35c9eb4da143
diff --git a/core/Makefile b/core/Makefile
index f86291b..0b2c058 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -838,6 +838,7 @@
 $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
 $(if $(BOARD_HAS_EXT4_RESERVED_BLOCKS),$(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(1))
 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
@@ -850,6 +851,7 @@
 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
@@ -859,6 +861,7 @@
 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
+$(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
 $(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
 $(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
 $(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
@@ -1593,7 +1596,8 @@
 	@echo Installed file list: $@
 	@mkdir -p $(dir $@)
 	@rm -f $@
-	$(hide) build/tools/fileslist.py $(TARGET_OUT_SYSTEM_OTHER) > $@
+	$(hide) build/tools/fileslist.py $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
+	$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
 
 systemotherimage_intermediates := \
     $(call intermediates-dir-for,PACKAGING,system_other)
@@ -2465,6 +2469,7 @@
 -include $(sort $(wildcard product/*/*/build/tasks/*.mk))
 # Also add test specifc tasks
 include $(sort $(wildcard platform_testing/build/tasks/*.mk))
+include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
 endif
 
 include $(BUILD_SYSTEM)/product-graph.mk
diff --git a/core/aapt2.mk b/core/aapt2.mk
index ccc4535..34f32e3 100644
--- a/core/aapt2.mk
+++ b/core/aapt2.mk
@@ -1,20 +1,25 @@
 ######################################
 # Compile resource with AAPT2
 # Input variables:
-# full_android_manifest,
-# my_res_resources, my_overlay_resources,
-# my_compiled_res_base_dir, my_res_package,
-# R_file_stamp, proguard_options_file
-# my_generated_res_dirs: Resources generated during the build process and we have to compile them in a single run of aapt2.
-# my_generated_res_dirs_deps: the dependency to use for my_generated_res_dirs.
+# - full_android_manifest
+# - my_res_resources
+# - my_overlay_resources
+# - my_compiled_res_base_dir
+# - my_res_package
+# - R_file_stamp
+# - proguard_options_file
+# - my_generated_res_dirs: Resources generated during the build process and we have to compile them in a single run of aapt2.
+# - my_generated_res_dirs_deps: the dependency to use for my_generated_res_dirs.
+# - my_apk_split_configs: The configurations for which to generate splits.
+# - built_apk_splits: The paths where AAPT should generate the splits.
 #
 # Output variables:
-# my_res_resources_flat, my_overlay_resources_flat,
-# my_generated_resources_flata
+# - my_res_resources_flat
+# - my_overlay_resources_flat
+# - my_generated_resources_flata
 #
 ######################################
 
-
 # Compile all the resource files.
 my_res_resources_flat := \
   $(foreach r, $(my_res_resources),\
@@ -52,6 +57,11 @@
 $(my_res_package): PRIVATE_AAPT_FLAGS += --auto-add-overlay
 endif
 
+ifneq ($(my_apk_split_configs),)
+# Join the Split APK paths with their configuration, separated by a ':'.
+$(my_res_package): PRIVATE_AAPT_FLAGS += $(addprefix --split ,$(join $(built_apk_splits),$(addprefix :,$(my_apk_split_configs))))
+endif
+
 $(my_res_package): PRIVATE_RES_FLAT := $(my_res_resources_flat)
 $(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_generated_resources_flata) $(my_overlay_resources_flat)
 $(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources)
diff --git a/core/binary.mk b/core/binary.mk
index c11ed32..136316b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -345,7 +345,7 @@
 # Issue warning if LOCAL_CLANG* is set to false and the local makefile is not found
 # in the exception project list.
 ifeq ($(my_clang),false)
-    ifeq ($(call find_in_local_clang_exception_projects,$(LOCAL_MODULE_MAKEFILE)),)
+    ifeq ($(call find_in_local_clang_exception_projects,$(LOCAL_MODULE_MAKEFILE))$(LOCAL_IS_AUX_MODULE),)
         $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_CLANG is set to false)
     endif
 endif
@@ -991,7 +991,7 @@
 
 $(vts_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
 $(vts_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(vts_gen_include_root)
-$(vts_gen_cpp) : PRIVATE_VTS_FLAGS := $(addprefix -I,$(LOCAL_VTS_INCLUDES))
+$(vts_gen_cpp) : PRIVATE_VTS_FLAGS := $(addprefix -I,$(LOCAL_VTS_INCLUDES)) $(addprefix -m,$(LOCAL_VTS_MODE))
 
 # Add generated headers to include paths.
 my_c_includes += $(vts_gen_include_root)
diff --git a/core/build-system.html b/core/build-system.html
index 95f35ce..e72e141 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -707,6 +707,11 @@
 them here.  For example:</p>
 <p><code>LOCAL_JAVACFLAGS += -Xlint:deprecation</code></p>
 
+<h4>LOCAL_ERROR_PRONE_FLAGS</h4>
+<p>If you have additional flags to pass into the error prone compiler, add
+them here.  For example:</p>
+<p><code>LOCAL_ERROR_PRONE_FLAGS += -Xep:ClassCanBeStatic:ERROR</code></p>
+
 <h4>LOCAL_JAVA_LIBRARIES</h4>
 <p>When linking Java apps and libraries, <code>LOCAL_JAVA_LIBRARIES</code>
 specifies which sets of java classes to include.  Currently there are
diff --git a/core/build_id.mk b/core/build_id.mk
index 5a012b9..0e8e2cf 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,4 +18,4 @@
 # (like "CRB01").  It must be a single word, and is
 # capitalized by convention.
 
-export BUILD_ID=NYC
+export BUILD_ID=MASTER
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 60e0641..e3f7bdd 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -93,6 +93,8 @@
   device/lge/bullhead/ \
   external/gentoo/integration/ \
   hardware/qcom/ \
+  test/vts/hals/camera/bullhead/ \
+  test/vts/hals/etc/libqdutils/ \
   $(INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS)
 
 # Find $1 in the exception project list.
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 76fcbac..8ad7d88 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -72,6 +72,7 @@
 LOCAL_INTERMEDIATE_SOURCES:=
 LOCAL_INTERMEDIATE_SOURCE_DIR:=
 LOCAL_JAVACFLAGS:=
+LOCAL_ERROR_PRONE_FLAGS:=
 LOCAL_JAVA_LIBRARIES:=
 LOCAL_JAVA_LAYERS_FILE:=
 LOCAL_NO_STANDARD_LIBRARIES:=
@@ -110,6 +111,7 @@
 LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
 LOCAL_AIDL_INCLUDES:=
 LOCAL_VTS_INCLUDES:=
+LOCAL_VTS_MODE:=
 LOCAL_JARJAR_RULES:=
 LOCAL_ADDITIONAL_JAVA_DIR:=
 LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
@@ -143,7 +145,7 @@
 LOCAL_DEX_PREOPT:= # '',true,false,nostripping
 LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
 LOCAL_DEX_PREOPT_FLAGS:=
-LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
+LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,stream,full,nanopb-c,nanopb-c-enable_malloc
 LOCAL_PROTOC_FLAGS:=
 LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
 LOCAL_VTSC_FLAGS:=
diff --git a/core/definitions.mk b/core/definitions.mk
index 7a42ad8..ea383f2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1132,6 +1132,7 @@
 ###########################################################
 ## Commands for running protoc to compile .proto into .java
 ###########################################################
+# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
 
 define transform-proto-to-java
 @mkdir -p $(dir $@)
@@ -1139,6 +1140,7 @@
 @rm -rf $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
 @mkdir -p $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
 $(hide) for f in $(PRIVATE_PROTO_SRC_FILES); do \
+        PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
         $(PROTOC) \
         $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
         $(PRIVATE_PROTO_JAVA_OUTPUT_OPTION)="$(PRIVATE_PROTO_JAVA_OUTPUT_PARAMS):$(PRIVATE_PROTO_JAVA_OUTPUT_DIR)" \
@@ -1151,10 +1153,14 @@
 ######################################################################
 ## Commands for running protoc to compile .proto into .pb.cc (or.pb.c) and .pb.h
 ######################################################################
+# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
+
 define transform-proto-to-cc
 @echo "Protoc: $@ <= $<"
 @mkdir -p $(dir $@)
-$(hide) $(PROTOC) \
+$(hide) \
+	PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
+	$(PROTOC) \
 	$(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
 	$(PRIVATE_PROTOC_FLAGS) \
 	$<
@@ -2084,6 +2090,7 @@
 define aapt2-link
 @mkdir -p $(dir $@)
 $(call dump-words-to-file,$(PRIVATE_RES_FLAT),$(dir $@)aapt2-flat-list)
+$(call dump-words-to-file,$(PRIVATE_OVERLAY_FLAT),$(dir $@)aapt2-flat-overlay-list)
 $(hide) $(AAPT2) link -o $@ \
   $(PRIVATE_AAPT_FLAGS) \
   $(addprefix --manifest ,$(PRIVATE_ANDROID_MANIFEST)) \
@@ -2100,7 +2107,7 @@
   $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
   $(addprefix --rename-manifest-package ,$(PRIVATE_MANIFEST_PACKAGE_NAME)) \
   $(addprefix --rename-instrumentation-target-package ,$(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
-  $(addprefix -R , $(PRIVATE_OVERLAY_FLAT)) \
+  -R \@$(dir $@)aapt2-flat-overlay-list \
   \@$(dir $@)aapt2-flat-list
 endef
 
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 12c0bb0..bd3dadd 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -164,6 +164,11 @@
   $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
 endif
 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
+ifneq ($(ENABLE_TREBLE),true)
+ifneq ($(BOARD_WRAPS_CONVENTIONAL_HALS),)
+$(error BOARD_WRAPS_CONVENTIONAL_HALS cannot be defined when ENABLE_TREBLE is not set to true)
+endif
+endif
 board_config_mk :=
 
 ###########################################
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index cc26d7c..cd12caa 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -57,6 +57,11 @@
 # Run build/tools/java-layers.py for more details.
 layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
 
+# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
+ifeq ($(RUN_ERROR_PRONE),true)
+LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
+endif
+
 $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
diff --git a/core/java.mk b/core/java.mk
index 9199f7c..198c075 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -67,7 +67,11 @@
   ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
     LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
   else
-    LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
+    ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
+      # No library for stream protobufs
+    else
+      LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
+    endif
   endif
 endif
 endif
@@ -398,6 +402,12 @@
 # This intentionally depends on java_sources, not all_java_sources.
 # Deps for generated source files must be handled separately,
 # via deps on the target that generates the sources.
+
+# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
+ifeq ($(RUN_ERROR_PRONE),true)
+LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
+endif
+
 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
 $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
diff --git a/core/java_common.mk b/core/java_common.mk
index 1119a37..aea6eb3 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -54,7 +54,12 @@
   ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
 $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
   else
+    ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out
+$(proto_java_sources_file_stamp): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
+    else
 $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
+    endif
   endif
 endif
 $(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index af1d2a5..fb2f188 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -75,10 +75,6 @@
 LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
 endif
 
-ifdef LOCAL_PACKAGE_SPLITS
-LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
-endif
-
 need_compile_asset :=
 ifeq (,$(LOCAL_ASSET_DIR))
 LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
@@ -163,6 +159,10 @@
        ) \
      ))
 
+ifdef LOCAL_PACKAGE_SPLITS
+LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
+endif
+
 endif  # LOCAL_USE_AAPT2
 
 ifneq ($(all_resources),)
@@ -171,7 +171,6 @@
 
 all_res_assets := $(strip $(all_assets) $(all_resources))
 
-
 # If no assets or resources were found, clear the directory variables so
 # we don't try to build them.
 ifneq (true,$(need_compile_asset))
@@ -325,6 +324,20 @@
 endif  # LOCAL_DATA_BINDING
 
 ifeq ($(need_compile_res),true)
+
+###############################
+## APK splits
+built_apk_splits :=
+installed_apk_splits :=
+my_apk_split_configs :=
+
+ifdef LOCAL_PACKAGE_SPLITS
+my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS)
+my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
+built_apk_splits := $(foreach s,$(my_split_suffixes),$(built_module_path)/package_$(s).apk)
+installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
+endif
+
 ifdef LOCAL_USE_AAPT2
 my_compiled_res_base_dir := $(intermediates)/flat-res
 my_generated_res_dirs := $(rs_generated_res_dir)
@@ -548,12 +561,6 @@
 ###############################
 ## APK splits
 ifdef LOCAL_PACKAGE_SPLITS
-# LOCAL_PACKAGE_SPLITS is a list of resource labels.
-# aapt will convert comma inside resource lable to underscore in the file names.
-my_split_suffixes := $(subst $(comma),_,$(LOCAL_PACKAGE_SPLITS))
-built_apk_splits := $(foreach s,$(my_split_suffixes),$(built_module_path)/package_$(s).apk)
-installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
-
 # The splits should have been built in the same command building the base apk.
 # This rule just runs signing.
 # Note that we explicily check the existence of the split apk and remove the
diff --git a/core/pathmap.mk b/core/pathmap.mk
index ce1754e..55cf867 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -114,7 +114,6 @@
         v7/cardview \
         v7/mediarouter \
         v7/palette \
-        v8/renderscript \
         v13 \
         v17/leanback \
         design \
@@ -124,7 +123,6 @@
         v7/preference \
         v14/preference \
         v17/preference-leanback \
-        documents-archive \
         customtabs
 
 #
@@ -141,6 +139,7 @@
 FRAMEWORKS_SUPPORT_JAVA_SRC_DIRS := \
 	$(addprefix frameworks/support/,$(FRAMEWORKS_SUPPORT_SUBDIRS)) \
 	$(addprefix frameworks/,$(FRAMEWORKS_MULTIDEX_SUBDIRS)) \
+        frameworks/rs/support \
         frameworks/support/graphics/drawable/animated \
         frameworks/support/graphics/drawable/static \
 	frameworks/support/v7/appcompat/src \
@@ -156,6 +155,7 @@
     android-support-animatedvectordrawable \
     android-support-v7-appcompat \
     android-support-v7-recyclerview \
+    android-support-v8-renderscript \
     android-support-multidex \
     android-support-multidex-instrumentation
 
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index d9f9ea8..c53cc53 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -365,8 +365,7 @@
 
 endif # LOCAL_PACKAGE_SPLITS
 
-else # LOCAL_MODULE_CLASS != APPS
-ifeq ($(prebuilt_module_is_dex_javalib),true)
+else ifeq ($(prebuilt_module_is_dex_javalib),true)  # ! LOCAL_MODULE_CLASS != APPS
 # This is a target shared library, i.e. a jar with classes.dex.
 #######################################
 # defines built_odex along with rule to install odex
@@ -409,7 +408,6 @@
 	$(hide) chmod +x $@
 endif
 endif # ! prebuilt_module_is_dex_javalib
-endif # LOCAL_MODULE_CLASS != APPS
 
 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
 my_src_jar := $(my_prebuilt_src_file)
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index d8f900e..5328764 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -26,8 +26,13 @@
 test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
 test_tools := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar \
   $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar \
+  $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
   $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
+  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util-tests.jar \
+  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-common-util-tests.jar \
+  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-tradefed-tests.jar \
   $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed).jar \
+  $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed)-tests.jar \
   $(HOST_OUT_EXECUTABLES)/$(test_suite_tradefed) \
   $(test_suite_readme)
 
diff --git a/core/tasks/vts.mk b/core/tasks/vts.mk
deleted file mode 100644
index 507f22e..0000000
--- a/core/tasks/vts.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2016 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.
-
-test_suite_name := vts
-test_suite_tradefed := vts-tradefed
-test_suite_readme := test/vts/README.md
-
-include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
-
-.PHONY: vts
-vts: $(compatibility_zip)
-$(call dist-for-goals, vts, $(compatibility_zip))
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 98fdfcc..79b4dc6 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -43,7 +43,7 @@
   # which is the version that we reveal to the end user.
   # Update this value when the platform version changes (rather
   # than overriding it somewhere else).  Can be an arbitrary string.
-  PLATFORM_VERSION := 7.1.2
+  PLATFORM_VERSION := O
 endif
 
 ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -55,6 +55,10 @@
   # intermediate builds).  During development, this number remains at the
   # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
   # the code-name of the new development work.
+
+  # When you change PLATFORM_SDK_VERSION please ensure you also update the
+  # corresponding methods for isAtLeast* in the following java file:
+  # platform/frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
   PLATFORM_SDK_VERSION := 25
 endif
 
@@ -70,7 +74,7 @@
 ifeq "" "$(PLATFORM_VERSION_CODENAME)"
   # This is the current development code-name, if the build is not a final
   # release build.  If this is a final release build, it is simply "REL".
-  PLATFORM_VERSION_CODENAME := REL
+  PLATFORM_VERSION_CODENAME := O
 
   # This is all of the development codenames that are active.  Should be either
   # the same as PLATFORM_VERSION_CODENAME or a comma-separated list of additional
@@ -91,7 +95,7 @@
     # assuming the device can only support APIs as of the previous official
     # public release.
     # This value will always be 0 for release builds.
-    PLATFORM_PREVIEW_SDK_VERSION := 0
+    PLATFORM_PREVIEW_SDK_VERSION := 1
   endif
 endif
 
diff --git a/envsetup.sh b/envsetup.sh
index 710b28f..fde0e15 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -329,6 +329,8 @@
             . $f
         done
     fi
+
+    complete -C "bit --tab" bit
 }
 
 function choosetype()
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index ed259db..38b4e8d 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -56,7 +56,3 @@
 
 BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
 
-ifeq ($(TARGET_PRODUCT),sdk)
-  # include an expanded selection of fonts for the SDK.
-  EXTENDED_FONT_FOOTPRINT := true
-endif
diff --git a/target/product/base.mk b/target/product/base.mk
index 2eb20aa..3125303 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -27,6 +27,7 @@
     app_process \
     applypatch \
     audioserver \
+    bit \
     blkid \
     bmgr \
     bugreport \
@@ -40,6 +41,9 @@
     hid \
     ime \
     input \
+    input.evdev.default \
+    inputflinger \
+    inputflingerhost \
     javax.obex \
     libandroid \
     libandroid_runtime \
@@ -58,6 +62,7 @@
     libeffects \
     libinput \
     libinputflinger \
+    libinputflingerhost \
     libiprouteutil \
     libjnigraphics \
     libldnhncr \
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 5faf24f..6de492b 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -23,6 +23,7 @@
     atrace \
     bootanimation \
     bootstat \
+    charger \
     cmd \
     debuggerd \
     dumpstate \
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 5c48358..b99fe97 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -63,7 +63,6 @@
 $(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
 $(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
 $(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
-$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
 $(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
 $(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)
 $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 98d8c3c..36c3de8 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -21,4 +21,4 @@
 
 # These are all the locales that have translations and are displayable
 # by TextView in this branch.
-PRODUCT_LOCALES := en_US en_AU en_IN fr_FR it_IT es_ES et_EE de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN zh_HK ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR sv_SE bg_BG ca_ES en_GB fi_FI hi_IN hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA am_ET en_XA ar_XB fr_CA km_KH lo_LA ne_NP si_LK mn_MN hy_AM az_AZ ka_GE my_MM mr_IN ml_IN is_IS mk_MK ky_KG eu_ES gl_ES bn_BD ta_IN kn_IN te_IN uz_UZ ur_PK kk_KZ sq_AL gu_IN pa_IN be_BY bs_BA
+PRODUCT_LOCALES := en_US en_AU en_IN fr_FR it_IT es_ES et_EE de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN zh_HK ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR sv_SE bg_BG ca_ES en_GB fi_FI hi_IN hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA am_ET en_XA ar_XB fr_CA km_KH lo_LA ne_NP si_LK mn_MN hy_AM az_AZ ka_GE my_MM mr_IN ml_IN is_IS mk_MK ky_KG eu_ES gl_ES bn_BD ta_IN kn_IN te_IN uz_UZ ur_PK kk_KZ sq_AL gu_IN pa_IN be_BY bs_BA sr_Latn_RS
diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk
index fa257ae..2d415ae 100644
--- a/target/product/sdk_base.mk
+++ b/target/product/sdk_base.mk
@@ -71,8 +71,9 @@
 	frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \
 	frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \
 	device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
+	device/generic/goldfish/camera/media_codecs_performance.xml:system/etc/media_codecs_performance.xml \
 	frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
-	frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
+	frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \
 	frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml \
 	frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf \
 	hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf
@@ -86,7 +87,6 @@
 $(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
 $(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
 $(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
-$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
 $(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
 $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
 $(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index dd67aa5..2556fa8 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -78,7 +78,10 @@
           elif:reference ?>/reference<?cs
           elif:downloads ?>/downloads<?cs /if ?><?cs
         else ?><?cs
-          if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
+          if:reference.testSupport ?>/reference/android/support/test<?cs
+          elif:reference.wearableSupport ?>/reference/android/support/wearable<?cs
+          elif:reference.constraintSupport ?>/reference/android/support/constraint<?cs
+          elif:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
             if:guide ?>/guide<?cs
             elif:training ?>/training<?cs
             elif:reference ?>/reference<?cs
@@ -103,8 +106,6 @@
           elif:wearpreview ?>/wear/preview<?cs
           elif:work ?>/work<?cs
           elif:design ?>/design<?cs
-          elif:reference.testSupport ?>/reference/android/support/test<?cs
-          elif:reference.wearableSupport ?>/reference/android/support/wearable<?cs
           elif:walkthru ?>/walkthru<?cs /if ?><?cs
         /if ?>/_book.yaml" /><?cs
         /if ?>
diff --git a/tools/libhost/CopyFile.c b/tools/libhost/CopyFile.c
index 5be012c..bd65f1e 100644
--- a/tools/libhost/CopyFile.c
+++ b/tools/libhost/CopyFile.c
@@ -323,8 +323,11 @@
                 (void) close(dstFd);
             }
 
-            if (copyResult != 0)
+            if (copyResult != 0) {
+                free(srcRsrcName);
+                free(dstRsrcName);
                 return -1;
+            }
         }
 
         free(srcRsrcName);
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 7abe857..f32161c 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -460,6 +460,8 @@
         return False
       build_command.extend(["-d", base_fs_file])
     build_command.extend(["-L", prop_dict["mount_point"]])
+    if "extfs_inode_count" in prop_dict:
+      build_command.extend(["-i", prop_dict["extfs_inode_count"]])
     if "selinux_fc" in prop_dict:
       build_command.append(prop_dict["selinux_fc"])
   elif fs_type.startswith("squash"):
@@ -639,6 +641,7 @@
     copy_prop("system_avb_enable", "avb_enable")
     copy_prop("system_avb_add_hashtree_footer_args",
               "avb_add_hashtree_footer_args")
+    copy_prop("system_extfs_inode_count", "extfs_inode_count")
   elif mount_point == "system_other":
     # We inherit the selinux policies of /system since we contain some of its files.
     d["mount_point"] = "system"
@@ -655,6 +658,7 @@
     copy_prop("system_avb_enable", "avb_enable")
     copy_prop("system_avb_add_hashtree_footer_args",
               "avb_add_hashtree_footer_args")
+    copy_prop("system_extfs_inode_count", "extfs_inode_count")
   elif mount_point == "data":
     # Copy the generic fs type first, override with specific one if available.
     copy_prop("fs_type", "fs_type")
@@ -677,11 +681,13 @@
     copy_prop("vendor_avb_enable", "avb_enable")
     copy_prop("vendor_avb_add_hashtree_footer_args",
               "avb_add_hashtree_footer_args")
+    copy_prop("vendor_extfs_inode_count", "extfs_inode_count")
   elif mount_point == "oem":
     copy_prop("fs_type", "fs_type")
     copy_prop("oem_size", "partition_size")
     copy_prop("oem_journal_size", "journal_size")
     copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
+    copy_prop("oem_extfs_inode_count", "extfs_inode_count")
   d["partition_name"] = mount_point
   return d