Merge "Switch to prebuilt clang-3217047" am: 3500ddfe1b am: c3c8abdf2a am: c328dd288c
am: 944bb9aec5

Change-Id: I7a799b03d648341439cae65cff9aa5392e5c37a7
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 fb31890..ebda48b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -336,7 +336,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
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 7113892..dc75649 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -152,6 +152,8 @@
   external/gentoo/integration/ \
   external/valgrind/ \
   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/definitions.mk b/core/definitions.mk
index 832f969..391087d 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2142,6 +2142,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)) \
@@ -2158,7 +2159,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 27165d4..23a9a72 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/ninja.mk b/core/ninja.mk
index 27441ad..c8ae3fc 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -140,7 +140,7 @@
 .PHONY: ninja_wrapper
 ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL)
 	@echo Starting build with ninja
-	+$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS)
+	+$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) -d keepdepfile $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS)
 
 # Dummy Android.mk and CleanSpec.mk files so that kati won't recurse into the
 # out directory
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 9545823..2a36ce7 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 edc584b..14a8635 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -115,7 +115,6 @@
         v7/cardview \
         v7/mediarouter \
         v7/palette \
-        v8/renderscript \
         v13 \
         v17/leanback \
         design \
@@ -141,6 +140,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 +156,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 0c856ff..bfa9e2d 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -351,8 +351,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
@@ -395,7 +394,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/version_defaults.mk b/core/version_defaults.mk
index 31fb679..71daea9 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
+  PLATFORM_VERSION := O
 endif
 
 ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -70,12 +70,12 @@
 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
   # codenames after PLATFORM_VERSION_CODENAME.
-  PLATFORM_VERSION_ALL_CODENAMES := $(PLATFORM_VERSION_CODENAME)
+  PLATFORM_VERSION_ALL_CODENAMES := $(PLATFORM_VERSION_CODENAME),NMR1
 endif
 
 ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
@@ -91,7 +91,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/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 325b0ce..6b908e0 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -77,7 +77,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 4d70664..456715f 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -40,6 +40,9 @@
     hid \
     ime \
     input \
+    input.evdev.default \
+    inputflinger \
+    inputflingerhost \
     javax.obex \
     libandroid \
     libandroid_runtime \
@@ -58,6 +61,7 @@
     libeffects \
     libinput \
     libinputflinger \
+    libinputflingerhost \
     libiprouteutil \
     libjnigraphics \
     libldnhncr \
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/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);