Merge "Include file_contexts conditionally elsewhere" am: e65af5ce72 am: 10539b3253
am: 96377665f2

Change-Id: Ib46554b2ebccd930a4b2a827c7fdd8a9ff0f15db
diff --git a/core/Makefile b/core/Makefile
index eaafd7b..578ff7c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -71,13 +71,33 @@
 endif
 
 # -----------------------------------------------------------------
+# vendor_default_property_overrides_split_enabled and
+# vendor_build_property_overrides_split_enabled
+vendor_default_property_overrides_split_enabled :=
+vendor_build_property_overrides_split_enabled :=
+ifeq ($(ENABLE_TREBLE), true)
+  ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
+    vendor_build_property_overrides_split_enabled := true
+
+    # Checks whether early mount for vendor partition is enabled or not.
+    # TODO(jaekyun): Early mount will be mandatory for ENABLE_TREBLE=true. After
+    # that is done, this condition check should be removed.
+    ifeq ($(ENABLE_EARLY_MOUNT), true)
+      vendor_default_property_overrides_split_enabled := true
+    endif
+  endif
+endif
+
+# -----------------------------------------------------------------
 # default.prop
 INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
 FINAL_DEFAULT_PROPERTIES := \
     $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
-FINAL_DEFAULT_PROPERTIES += \
-    $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+ifndef vendor_default_property_overrides_split_enabled
+  FINAL_DEFAULT_PROPERTIES += \
+      $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+endif
 FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
     $(FINAL_DEFAULT_PROPERTIES),=)
 
@@ -100,6 +120,30 @@
 	$(hide) build/tools/post_process_props.py $@
 
 # -----------------------------------------------------------------
+# vendor default.prop
+INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
+ifdef vendor_default_property_overrides_split_enabled
+INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
+ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
+
+FINAL_VENDOR_DEFAULT_PROPERTIES += \
+    $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
+    $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
+
+$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
+	@echo Target buildinfo: $@
+	@mkdir -p $(dir $@)
+	$(hide) echo "#" > $@; \
+	        echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
+	        echo "#" >> $@;
+	$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
+		echo "$(line)" >> $@;)
+	$(hide) build/tools/post_process_props.py $@
+
+endif  # vendor_default_property_overrides_split_enabled
+
+# -----------------------------------------------------------------
 # build.prop
 INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
@@ -190,6 +234,7 @@
 endef
 
 BUILDINFO_SH := build/tools/buildinfo.sh
+VENDOR_BUILDINFO_SH := build/tools/vendor_buildinfo.sh
 
 # TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test harness to distinguish builds.
 TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
@@ -202,7 +247,7 @@
 else
 system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
 endif
-$(intermediate_system_build_prop): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
+$(intermediate_system_build_prop): $(VENDOR_BUILDINFO_SH) $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
 	@echo Target buildinfo: $@
 	@mkdir -p $(dir $@)
 	$(hide) echo > $@
@@ -237,10 +282,8 @@
 			PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
 			PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
 			BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
-			TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
 			BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
 			$(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \
-			TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
 			TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
 			TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
 			TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
@@ -248,6 +291,11 @@
 			TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
 			TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
 	        bash $(BUILDINFO_SH) >> $@
+ifndef vendor_build_property_overrides_split_enabled
+	$(hide) TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
+			TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
+	        bash $(VENDOR_BUILDINFO_SH) >> $@
+endif
 	$(hide) $(foreach file,$(system_prop_file), \
 		if [ -f "$(file)" ]; then \
 			echo "#" >> $@; \
@@ -288,14 +336,33 @@
 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
 INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
-$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
+
+ifdef vendor_build_property_overrides_split_enabled
+FINAL_VENDOR_BUILD_PROPERTIES += \
+    $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
+FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
+    $(FINAL_VENDOR_BUILD_PROPERTIES),=)
+endif  # vendor_build_property_overrides_split_enabled
+
+$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH)
 	@echo Target vendor buildinfo: $@
 	@mkdir -p $(dir $@)
 	$(hide) echo > $@
 	$(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
 	$(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
 	$(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
-endif
+ifdef vendor_build_property_overrides_split_enabled
+	$(hide) TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
+			TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
+	        bash $(VENDOR_BUILDINFO_SH) >> $@
+	$(hide) echo "#" >> $@; \
+	        echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
+	        echo "#" >> $@;
+	$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
+		echo "$(line)" >> $@;)
+	$(hide) build/tools/post_process_props.py $@
+endif  # vendor_build_property_overrides_split_enabled
+endif  # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
 
 # ----------------------------------------------------------------
 
@@ -913,7 +980,10 @@
 recovery_sepolicy := $(call intermediates-dir-for,ETC,sepolicy.recovery)/sepolicy.recovery
 recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
 recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
-recovery_build_prop := $(intermediate_system_build_prop)
+recovery_build_props := $(intermediate_system_build_prop)
+ifdef vendor_build_property_overrides_split_enabled
+recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
+endif
 recovery_resources_common := $(call include-path-for, recovery)/res
 
 # Set recovery_density to the density bucket of the device.
@@ -1065,8 +1135,13 @@
   $(if $(strip $(recovery_wipe)), \
     $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
   $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
-  $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
+  $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \
           > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
+  $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \
+    $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
+            >> $(TARGET_RECOVERY_ROOT_OUT)/default.prop)
+  $(hide) cat $(recovery_build_props) \
+          >> $(TARGET_RECOVERY_ROOT_OUT)/default.prop
   $(BOARD_RECOVERY_IMAGE_PREPARE)
   $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
     $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
@@ -1108,9 +1183,10 @@
 		$(INTERNAL_RECOVERYIMAGE_FILES) \
 		$(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
 		$(INSTALLED_2NDBOOTLOADER_TARGET) \
-		$(recovery_build_prop) $(recovery_resource_deps) \
+		$(recovery_build_props) $(recovery_resource_deps) \
 		$(recovery_fstab) \
 		$(RECOVERY_INSTALL_OTA_KEYS) \
+		$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
 		$(BOARD_RECOVERY_KERNEL_MODULES) \
 		$(DEPMOD)
 		$(call pretty,"Target boot image from recovery: $@")
@@ -1123,9 +1199,10 @@
 		$(INTERNAL_RECOVERYIMAGE_FILES) \
 		$(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
 		$(INSTALLED_2NDBOOTLOADER_TARGET) \
-		$(recovery_build_prop) $(recovery_resource_deps) \
+		$(recovery_build_props) $(recovery_resource_deps) \
 		$(recovery_fstab) \
 		$(RECOVERY_INSTALL_OTA_KEYS) \
+		$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
 		$(BOARD_RECOVERY_KERNEL_MODULES) \
 		$(DEPMOD)
 		$(call build-recoveryimage-target, $@)
@@ -1631,7 +1708,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)
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 faae547..97f1c6f 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -373,7 +373,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 be43a26..4bff567 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -76,6 +76,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 9f9bf96..65fc7c8 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -67,6 +67,7 @@
 LOCAL_DX_FLAGS:=
 LOCAL_EMMA_COVERAGE_FILTER:=
 LOCAL_EMMA_INSTRUMENT:=
+LOCAL_ERROR_PRONE_FLAGS:=
 LOCAL_EXPORT_C_INCLUDE_DEPS:=
 LOCAL_EXPORT_C_INCLUDE_DIRS:=
 LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
@@ -183,7 +184,7 @@
 LOCAL_PROGUARD_FLAGS:=
 LOCAL_PROPRIETARY_MODULE:=
 LOCAL_PROTOC_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_PROTO_JAVA_OUTPUT_PARAMS:=
 LOCAL_RECORDED_MODULE_TYPE:=
 LOCAL_RENDERSCRIPT_CC:=
@@ -228,6 +229,7 @@
 LOCAL_USE_VNDK:=
 LOCAL_VTSC_FLAGS:=
 LOCAL_VTS_INCLUDES:=
+LOCAL_VTS_MODE:=
 LOCAL_WARNINGS_ENABLE:=
 LOCAL_WHOLE_STATIC_LIBRARIES:=
 LOCAL_YACCFLAGS:=
diff --git a/core/definitions.mk b/core/definitions.mk
index 1a7cc50..10ee297 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1165,6 +1165,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 $@)
@@ -1172,6 +1173,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)" \
@@ -1184,10 +1186,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) \
 	$<
@@ -2098,6 +2104,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)) \
@@ -2114,7 +2121,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 d17b7c9..06a625c 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 ba2999f..3c68d39 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 1835983..2864e56 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
@@ -432,6 +436,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 8fc4fb6..3a6dc16 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -52,7 +52,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/main.mk b/core/main.mk
index 7433f90..9a39a5e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -275,9 +275,15 @@
 ADDITIONAL_BUILD_PROPERTIES += \
   ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
 endif
-ADDITIONAL_BUILD_PROPERTIES := \
-  $(ADDITIONAL_BUILD_PROPERTIES) \
-  $(PRODUCT_PROPERTY_OVERRIDES)
+
+ifneq ($(ENABLE_TREBLE), true)
+  ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
+else
+  ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
+    ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
+  endif
+endif
+
 
 # Bring in standard build system definitions.
 include $(BUILD_SYSTEM)/definitions.mk
diff --git a/core/package_internal.mk b/core/package_internal.mk
index ca12437..b47b351 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))
@@ -338,6 +337,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)
@@ -590,12 +603,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 c328e58..7ca9588 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -99,79 +99,3 @@
 #
 FRAMEWORKS_BASE_JAVA_SRC_DIRS := \
 	$(addprefix frameworks/base/,$(FRAMEWORKS_BASE_SUBDIRS))
-
-#
-# A list of all source roots under frameworks/support.
-#
-FRAMEWORKS_SUPPORT_SUBDIRS := \
-        annotations \
-        compat \
-        media-compat \
-        fragment \
-        core-ui \
-        core-utils \
-        v7/gridlayout \
-        v7/cardview \
-        v7/mediarouter \
-        v7/palette \
-        v13 \
-        v17/leanback \
-        design \
-        percent \
-        recommendation \
-        transition \
-        v7/preference \
-        v14/preference \
-        v17/preference-leanback \
-        documents-archive \
-        customtabs
-
-#
-# A list of all source roots under frameworks/multidex.
-#
-FRAMEWORKS_MULTIDEX_SUBDIRS := \
-        multidex/library/src \
-        multidex/instrumentation/src
-
-#
-# A version of FRAMEWORKS_SUPPORT_SUBDIRS that is expanded to full paths from
-# the root of the tree.
-#
-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 \
-	frameworks/support/v7/recyclerview/src
-
-#
-# A list of support library modules.
-#
-FRAMEWORKS_SUPPORT_JAVA_LIBRARIES := \
-    $(foreach dir,$(FRAMEWORKS_SUPPORT_SUBDIRS),android-support-$(subst /,-,$(dir))) \
-    android-support-v4 \
-    android-support-vectordrawable \
-    android-support-animatedvectordrawable \
-    android-support-v7-appcompat \
-    android-support-v7-recyclerview \
-    android-support-v8-renderscript \
-    android-support-multidex \
-    android-support-multidex-instrumentation
-
-#
-# A list of all documented source roots under frameworks/data-binding.
-#
-FRAMEWORKS_DATA_BINDING_SUBDIRS := \
-        baseLibrary/src/main \
-        extensions/library/src/main \
-        extensions/library/src/doc
-
-#
-# A version of FRAMEWORKS_DATA_BINDING_SUBDIRS that is expanded to full paths from
-# the root of the tree.
-#
-FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS := \
-	$(addprefix frameworks/data-binding/,$(FRAMEWORKS_DATA_BINDING_SUBDIRS))
-
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 997f971..36a3280 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -379,8 +379,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
@@ -423,7 +422,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/static_java_library.mk b/core/static_java_library.mk
index bf72a82..4dec1a8 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -69,7 +69,7 @@
 
 proguard_options_file :=
 
-ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
+ifneq ($(filter custom,$(LOCAL_PROGUARD_ENABLED)),custom)
   proguard_options_file := $(intermediates.COMMON)/proguard_options
 endif
 
@@ -168,14 +168,22 @@
 endif # LOCAL_JACK_ENABLED
 $(full_classes_compiled_jar): $(R_file_stamp)
 
+
+# if we have custom proguarding done use the proguarded classes jar instead of the normal classes jar
+ifeq ($(filter custom,$(LOCAL_PROGUARD_ENABLED)),custom)
+aar_classes_jar = $(full_classes_proguard_jar)
+else
+aar_classes_jar = $(full_classes_jar)
+endif
+
 # Rule to build AAR, archive including classes.jar, resource, etc.
 built_aar := $(intermediates.COMMON)/javalib.aar
 $(built_aar): PRIVATE_MODULE := $(LOCAL_MODULE)
 $(built_aar): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-$(built_aar): PRIVATE_CLASSES_JAR := $(full_classes_jar)
+$(built_aar): PRIVATE_CLASSES_JAR := $(aar_classes_jar)
 $(built_aar): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
 $(built_aar): PRIVATE_R_TXT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.txt
-$(built_aar) : $(full_classes_jar) $(full_android_manifest)
+$(built_aar) : $(aar_classes_jar) $(full_android_manifest)
 	@echo "target AAR:  $(PRIVATE_MODULE) ($@)"
 	$(hide) rm -rf $(dir $@)aar && mkdir -p $(dir $@)aar/res
 	$(hide) cp $(PRIVATE_ANDROID_MANIFEST) $(dir $@)aar/AndroidManifest.xml
@@ -191,5 +199,6 @@
 endif  # need_compile_res
 
 # Reset internal variables.
+aar_classes_jar :=
 all_res_assets :=
 LOCAL_IS_STATIC_JAVA_LIBRARY :=
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index d8f900e..eae30c4 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -25,9 +25,14 @@
 out_dir := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)
 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)/host-libprotobuf-java-full.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/version_defaults.mk b/core/version_defaults.mk
index 79bbc2a..ed19f06 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -76,21 +76,33 @@
 $(foreach v,$(ENABLED_VERSIONS), \
   $(eval IS_AT_LEAST_$(v) := true))
 
+# Default versions for each TARGET_PLATFORM_VERSION
+
+# This is the canonical definition of the platform version,
+# 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.
+
+# When you add a new PLATFORM_VERSION which will result in a new
+# PLATFORM_SDK_VERSION please ensure you add a corresponding isAtLeast*
+# method in the following java file:
+# frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
+
+# When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
+# please add that PLATFORM_VERSION to the following text file:
+# cts/tests/tests/os/assets/platform_versions.txt
+PLATFORM_VERSION.O := O
+
+# 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.O := O
+
 ifndef PLATFORM_VERSION
-  # This is the canonical definition of the platform version,
-  # 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.
-
-  # When you add a new PLATFORM_VERSION which will result in a new
-  # PLATFORM_SDK_VERSION please ensure you add a corresponding isAtLeast*
-  # method in the following java file:
-  # frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
-
-  # When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
-  # please add that PLATFORM_VERSION to the following text file:
-  # cts/tests/tests/os/assets/platform_versions.txt
-  PLATFORM_VERSION := 7.1.2
+  PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
+  ifndef PLATFORM_VERSION
+    # PLATFORM_VERSION falls back to TARGET_PLATFORM_VERSION
+    PLATFORM_VERSION := $(TARGET_PLATFORM_VERSION)
+  endif
 endif
 
 ifndef PLATFORM_SDK_VERSION
@@ -123,9 +135,11 @@
 endif
 
 ifndef 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 := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
+  ifndef PLATFORM_VERSION_CODENAME
+    # PLATFORM_VERSION_CODENAME falls back to TARGET_PLATFORM_VERSION
+    PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
+  endif
 
   # 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
@@ -146,7 +160,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 9680780..b58640d 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -335,6 +335,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..a0d1e14 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -47,7 +47,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1879048192  # 1.75 GB
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648  # 2 GB
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -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/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 34fffed..455edc6 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -77,7 +77,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1879048192  # 1.75 GB
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560  # 2.5 GB
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/generic_arm64/system.prop b/target/board/generic_arm64/system.prop
index aee6b13..24578a9 100644
--- a/target/board/generic_arm64/system.prop
+++ b/target/board/generic_arm64/system.prop
@@ -2,5 +2,5 @@
 # system.prop for generic arm64 sdk
 #
 
-rild.libpath=/system/lib/libreference-ril.so
+rild.libpath=/system/lib64/libreference-ril.so
 rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index b68d88b..b2e5fe8 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -54,7 +54,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1879048192  # 1.75 GB
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648  # 2 GB
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 734003200
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/generic_mips64/system.prop b/target/board/generic_mips64/system.prop
index 326e4b7..aa03eae 100644
--- a/target/board/generic_mips64/system.prop
+++ b/target/board/generic_mips64/system.prop
@@ -2,5 +2,5 @@
 # system.prop for generic mips64 sdk
 #
 
-rild.libpath=/system/lib/libreference-ril.so
+rild.libpath=/system/lib64/libreference-ril.so
 rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index f8ac496..499efba 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -33,7 +33,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index bd2f987..1854724 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -39,7 +39,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648 # 2 GB
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2.5 GB
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/generic_x86_64/system.prop b/target/board/generic_x86_64/system.prop
index 137a0f9..43d4a88 100644
--- a/target/board/generic_x86_64/system.prop
+++ b/target/board/generic_x86_64/system.prop
@@ -2,5 +2,5 @@
 # system.prop for generic sdk
 #
 
-rild.libpath=/system/lib/libreference-ril.so
+rild.libpath=/system/lib64/libreference-ril.so
 rild.libargs=-d /dev/ttyS0
diff --git a/target/product/aosp_x86_arm.mk b/target/product/aosp_x86_arm.mk
index 85a2cf8..19f57e8 100644
--- a/target/product/aosp_x86_arm.mk
+++ b/target/product/aosp_x86_arm.mk
@@ -23,6 +23,7 @@
 # Their dependency libraries will be automatically pulled in.
 PRODUCT_PACKAGES += \
   libandroid_arm \
+  libaaudio_arm \
   libc_arm \
   libdl_arm \
   libEGL_arm \
diff --git a/target/product/base.mk b/target/product/base.mk
index 2eb20aa..731da7c 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -27,6 +27,7 @@
     app_process \
     applypatch \
     audioserver \
+    bit \
     blkid \
     bmgr \
     bugreport \
@@ -36,10 +37,17 @@
     dnsmasq \
     dpm \
     framework \
+    framework-sysconfig.xml \
     fsck_msdos \
     hid \
     ime \
+    incidentd \
+    incident \
+    incident_report \
     input \
+    input.evdev.default \
+    inputflinger \
+    inputflingerhost \
     javax.obex \
     libandroid \
     libandroid_runtime \
@@ -58,6 +66,7 @@
     libeffects \
     libinput \
     libinputflinger \
+    libinputflingerhost \
     libiprouteutil \
     libjnigraphics \
     libldnhncr \
@@ -98,10 +107,12 @@
     libmediandk \
     libvulkan \
     libwifi-service \
+    locksettings \
     media \
     media_cmd \
     mediadrmserver \
     mediaserver \
+    mediametrics \
     mediacodec \
     mediaextractor \
     monkey \
@@ -111,6 +122,7 @@
     ping \
     ping6 \
     platform.xml \
+    privapp-permissions-platform.xml \
     pppd \
     pm \
     racoon \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index fe1a382..d754428 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -24,6 +24,7 @@
 
 PRODUCT_PACKAGES += \
     BackupRestoreConfirmation \
+    CompanionDeviceManager \
     CtsShimPrebuilt \
     CtsShimPrivPrebuilt \
     DownloadProvider \
@@ -59,6 +60,7 @@
     keystore \
     keystore.default \
     ld.mc \
+    libaaudio \
     libOpenMAXAL \
     libOpenSLES \
     libdownmix \
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index ef8794d..b6b064d 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -31,7 +31,6 @@
 
 PRODUCT_PACKAGES += \
     audio.primary.default \
-    audio_policy.default \
     local_time.default \
     power.default
 
@@ -60,6 +59,7 @@
     keystore \
     keystore.default \
     ld.mc \
+    libaaudio \
     libOpenMAXAL \
     libOpenSLES \
     libdownmix \
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 51adbdb..ceaad4b 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -20,11 +20,14 @@
 PRODUCT_PACKAGES += \
     adb \
     adbd \
+    android.hardware.configstore@1.0-impl \
+    android.hardware.configstore@1.0-service \
     android.hidl.allocator@1.0-service \
     android.hidl.memory@1.0-impl \
     atrace \
     bootanimation \
     bootstat \
+    charger \
     cmd \
     crash_dump \
     debuggerd\
@@ -76,6 +79,7 @@
     service \
     servicemanager \
     sh \
+    storaged \
     surfaceflinger \
     tombstoned \
     toolbox \
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index afa8389..b6e83ec 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -47,12 +47,36 @@
     fingerprint.goldfish \
     sensors.goldfish \
     audio.primary.goldfish \
+    audio.primary.goldfish_legacy \
+    android.hardware.audio@2.0-service \
     vibrator.goldfish \
     power.goldfish \
     fingerprint.ranchu \
-    fingerprintd \
+    android.hardware.biometrics.fingerprint@2.1-service \
     sensors.ranchu
 
+PRODUCT_PACKAGES += \
+    android.hardware.audio@2.0-impl \
+    android.hardware.audio.effect@2.0-impl \
+    android.hardware.broadcastradio@1.0-impl \
+    android.hardware.soundtrigger@2.0-impl
+
+PRODUCT_PACKAGES += \
+	android.hardware.keymaster@3.0-impl \
+	android.hardware.keymaster@3.0-service
+
+PRODUCT_PACKAGES += \
+    android.hardware.gnss@1.0-service \
+    android.hardware.gnss@1.0-impl
+
+PRODUCT_PACKAGES += \
+	android.hardware.sensors@1.0-impl \
+	android.hardware.sensors@1.0-service
+
+# camera service treble disable until all backwards compat is complete
+PRODUCT_PROPERTY_OVERRIDES += \
+    camera.disable_treble=1
+
 PRODUCT_COPY_FILES += \
     device/generic/goldfish/fstab.goldfish:root/fstab.goldfish \
     device/generic/goldfish/init.goldfish.rc:root/init.goldfish.rc \
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 5c48358..7722f55 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -46,7 +46,6 @@
 
 PRODUCT_PACKAGES += \
     audio.primary.default \
-    audio_policy.default \
     local_time.default \
     vibrator.default \
     power.default
@@ -63,7 +62,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..30beb9b 100644
--- a/target/product/sdk_base.mk
+++ b/target/product/sdk_base.mk
@@ -18,13 +18,14 @@
 
 PRODUCT_PACKAGES := \
 	ApiDemos \
+	CellBroadcastReceiver \
 	CubeLiveWallpapers \
 	CustomLocale \
 	Development \
 	Dialer \
 	EmulatorSmokeTests \
 	Fallback \
-	Gallery \
+	Gallery2 \
 	GestureBuilder \
 	Launcher3 \
 	LegacyCamera \
@@ -38,6 +39,7 @@
 	OpenWnn \
 	Protips \
 	rild \
+	screenrecord \
 	SdkSetup \
 	SmokeTest \
 	SmokeTestApp \
@@ -54,9 +56,32 @@
 # audio libraries.
 PRODUCT_PACKAGES += \
 	audio.primary.goldfish \
-	audio_policy.default \
+	audio.r_submix.default \
 	local_time.default
 
+# CDD mandates following codecs
+PRODUCT_PACKAGES += \
+    libstagefright_soft_aacdec \
+    libstagefright_soft_aacenc \
+    libstagefright_soft_amrdec \
+    libstagefright_soft_amrnbenc \
+    libstagefright_soft_amrwbenc \
+    libstagefright_soft_avcdec \
+    libstagefright_soft_avcenc \
+    libstagefright_soft_flacenc \
+    libstagefright_soft_g711dec \
+    libstagefright_soft_gsmdec \
+    libstagefright_soft_hevcdec \
+    libstagefright_soft_mp3dec \
+    libstagefright_soft_mpeg2dec \
+    libstagefright_soft_mpeg4dec \
+    libstagefright_soft_mpeg4enc \
+    libstagefright_soft_opusdec \
+    libstagefright_soft_rawdec \
+    libstagefright_soft_vorbisdec \
+    libstagefright_soft_vpxdec \
+    libstagefright_soft_vpxenc
+
 PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
 
 PRODUCT_COPY_FILES := \
@@ -69,13 +94,14 @@
 	device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
 	frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \
 	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_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
+	device/generic/goldfish/audio_policy.conf:system/etc/audio_policy.conf
 
 include $(SRC_TARGET_DIR)/product/emulator.mk
 
@@ -86,7 +112,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/buildinfo.sh b/tools/buildinfo.sh
index dcb66bf..d214aab 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -30,7 +30,6 @@
 echo "ro.product.brand=$PRODUCT_BRAND"
 echo "ro.product.name=$PRODUCT_NAME"
 echo "ro.product.device=$TARGET_DEVICE"
-echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
 
 # These values are deprecated, use "ro.product.cpu.abilist"
 # instead (see below).
@@ -49,7 +48,6 @@
   echo "ro.product.locale=$PRODUCT_DEFAULT_LOCALE"
 fi
 echo "ro.wifi.channels=$PRODUCT_DEFAULT_WIFI_CHANNELS"
-echo "ro.board.platform=$TARGET_BOARD_PLATFORM"
 
 echo "# ro.build.product is obsolete; use ro.product.device"
 echo "ro.build.product=$TARGET_DEVICE"
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/post_process_props.py b/tools/post_process_props.py
index 295f8f6..83c6f9a 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -29,6 +29,12 @@
 def mangle_build_prop(prop):
   pass
 
+# Put the modifications that you need to make into /vendor/default.prop and
+# /odm/default.prop into this function. The prop object has get(name) and
+# put(name,value) methods.
+def mangle_default_prop_override(prop):
+  pass
+
 # Put the modifications that you need to make into the /default.prop into this
 # function. The prop object has get(name) and put(name,value) methods.
 def mangle_default_prop(prop):
@@ -113,6 +119,9 @@
 
   if filename.endswith("/build.prop"):
     mangle_build_prop(properties)
+  elif (filename.endswith("/vendor/default.prop") or
+        filename.endswith("/odm/default.prop")):
+    mangle_default_prop_override(properties)
   elif filename.endswith("/default.prop"):
     mangle_default_prop(properties)
   else:
diff --git a/tools/vendor_buildinfo.sh b/tools/vendor_buildinfo.sh
new file mode 100755
index 0000000..2854fa8
--- /dev/null
+++ b/tools/vendor_buildinfo.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo "# begin build properties"
+echo "# autogenerated by vendor_buildinfo.sh"
+
+echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
+echo "ro.board.platform=$TARGET_BOARD_PLATFORM"
+
+echo "# end build properties"
diff --git a/tools/zipalign/ZipEntry.h b/tools/zipalign/ZipEntry.h
index 431b6db..247cf69 100644
--- a/tools/zipalign/ZipEntry.h
+++ b/tools/zipalign/ZipEntry.h
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <time.h>
 
 namespace android {