resolve merge conflicts of 364e42e to master

Change-Id: I0d742baa230d2d55b34de4f4a7a441dfb214d133
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/ninja.mk b/core/ninja.mk
index 9e7fe5b..07b3a0d 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -142,7 +142,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/pathmap.mk b/core/pathmap.mk
index 9b5a7db..d77f053 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -106,6 +106,10 @@
 #
 FRAMEWORKS_SUPPORT_SUBDIRS := \
         annotations \
+        compat \
+        media-compat \
+        fragment \
+        core-ui \
         v4 \
         v7/gridlayout \
         v7/cardview \
@@ -147,6 +151,7 @@
 #
 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 \
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 069c2e2..4e12a43 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -307,8 +307,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
@@ -351,7 +350,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 bdfc65a..459914c 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 := NMR1
+  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 := NMR1
+  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),N
+  PLATFORM_VERSION_ALL_CODENAMES := $(PLATFORM_VERSION_CODENAME),NMR1,N
 endif
 
 ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index 5be012c..bd65f1e 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/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/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/sdk_base.mk b/target/product/sdk_base.mk
index ebe3708..16f9840 100644
--- a/target/product/sdk_base.mk
+++ b/target/product/sdk_base.mk
@@ -70,8 +70,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