merge in master-release history after reset to master
diff --git a/core/Makefile b/core/Makefile
index 78b9f1e..f0b866a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1433,6 +1433,7 @@
 	done; \
 	if [ $$FAIL ]; then exit 1; fi
 	$(hide) ( \
+		ATREE_STRIP="strip -x" \
 		$(HOST_OUT_EXECUTABLES)/atree \
 		$(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
 			-m $(PRIVATE_DEP_FILE) \
diff --git a/core/build_id.mk b/core/build_id.mk
index ccc2c36..40bb35d 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -1,4 +1,3 @@
-
 #
 # Copyright (C) 2008 The Android Open Source Project
 #
@@ -14,9 +13,20 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+#
+# Defines branch-specific values.
+#
+
 # BUILD_ID is usually used to specify the branch name
 # (like "MAIN") or a branch name and a release candidate
-# (like "CRB01").  It must be a single word, and is
+# (like "TC1-RC5").  It must be a single word, and is
 # capitalized by convention.
+#
+BUILD_ID := MASTER
 
-export BUILD_ID=AAN68
+# DISPLAY_BUILD_NUMBER should only be set for development branches,
+# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
+# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY
+# is the same as BUILD_ID
+DISPLAY_BUILD_NUMBER := true
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 229eaf0..19a1e89 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -34,17 +34,23 @@
 HOST_GLOBAL_LDFLAGS += -static
 endif # BUILD_HOST_static
 
+build_mac_version := $(shell sw_vers -productVersion)
 mac_sdk_version := 10.6
 mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk
 ifeq ($(wildcard $(mac_sdk_root)),)
+recent_xcode4_mac_sdk_root := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+ifeq ($(wildcard $(recent_xcode4_mac_sdk_root)),)
 $(warning *****************************************************)
 $(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root))
+$(warning * or $(recent_xcode4_mac_sdk_root))
 $(warning *****************************************************)
 $(error Stop.)
 endif
+mac_sdk_root := $(recent_xcode4_mac_sdk_root)
+endif
 
-HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
-HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
+HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
 
 HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
 HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 98868ae..bca442d 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -109,6 +109,7 @@
 			-fstack-protector \
 			-Wa,--noexecstack \
 			-Werror=format-security \
+			-D_FORTIFY_SOURCE=1 \
 			-fno-short-enums \
 			$(arch_variant_cflags) \
 			-include $(android_config_h) \
diff --git a/core/java.mk b/core/java.mk
index 2b6851b..4e33ef2 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -4,7 +4,7 @@
 # all_res_assets
 
 ifeq ($(TARGET_BUILD_PDK),true)
-ifeq ($(TARGET_BUILD_PDK_JAVA),)
+ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
 # LOCAL_SDK not defined or set to current
 ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
 LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
diff --git a/core/main.mk b/core/main.mk
index ab0479e..1ab9b6c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -213,6 +213,14 @@
 endif
 
 # -----------------------------------------------------------------
+# Variable to check java support level inside PDK build.
+# Not necessary if the components is not in PDK.
+# not defined : not supported
+# "sdk" : sdk API only
+# "platform" : platform API supproted
+TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
+
+# -----------------------------------------------------------------
 # The pdk (Platform Development Kit) build
 include build/core/pdk_config.mk
 
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 492a9c4..9df2ce2 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -51,6 +51,15 @@
 PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
     $(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
 
+# check and override java support level
+ifeq ($(TARGET_BUILD_PDK),true)
+ifneq ($(wildcard external/proguard),)
+TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
+else # no proguard
+TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
+endif
+# platform supprot is set after checking platform.zip
+endif # PDK
 
 ifdef PDK_FUSION_PLATFORM_ZIP
 TARGET_BUILD_PDK := true
@@ -67,8 +76,14 @@
 	$(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
 _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
     $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
+
 ifneq ($(_pdk_fusion_java_file_list),)
-TARGET_BUILD_PDK_JAVA := true
+# This represents whether java build can use platform API or not
+# This should not be used in Android.mk
+TARGET_BUILD_PDK_JAVA_PLATFORM := true
+ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
+TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
+endif
 endif
 
 $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
@@ -91,7 +106,7 @@
 	@mkdir -p $(dir $@)
 	$(hide) cp -fpPR $< $@
 
-ifeq (true,$(TARGET_BUILD_PDK_JAVA))
+ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
 
 define JAVA_dependency_template
 $(OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) $(OUT_DIR)/$(strip $(2)) \
@@ -122,7 +137,7 @@
 
 ifeq ($(TARGET_BUILD_PDK),true)
 
-ifeq ($(TARGET_BUILD_PDK_JAVA),)
+ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
 
 # SDK used for Java build under PDK
 PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
diff --git a/core/user_tags.mk b/core/user_tags.mk
index ca2594b..22582a1 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -217,7 +217,6 @@
 	libESR_Portable \
 	libESR_Shared \
 	libETC1 \
-	libexif \
 	libext \
 	libext2_blkid \
 	libext2_blkid_host \
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index fceb2e5..697d295 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -63,7 +63,8 @@
 	Calendar \
 	SmokeTest \
 	SmokeTestApp \
-	rild
+	rild \
+	LegacyCamera
 
 
 # Define the host tools and libs that are parts of the SDK.
diff --git a/tools/atree/fs.cpp b/tools/atree/fs.cpp
index b648394..9468cfd 100644
--- a/tools/atree/fs.cpp
+++ b/tools/atree/fs.cpp
@@ -152,8 +152,8 @@
 int
 strip_file(const string& path)
 {
-    // Default strip command to run is "strip" unless overridden by the STRIP env var.
-    const char* strip_cmd = getenv("STRIP");
+    // Default strip command to run is "strip" unless overridden by the ATREE_STRIP env var.
+    const char* strip_cmd = getenv("ATREE_STRIP");
     if (!strip_cmd || !strip_cmd[0]) {
         strip_cmd = "strip";
     }
@@ -163,7 +163,52 @@
         return -1;
     } else if (pid == 0) {
         // Exec in the child. Only returns if execve failed.
-        return execlp(strip_cmd, strip_cmd, path.c_str(), (char *)NULL);
+
+        int num_args = 0;
+        const char *s = strip_cmd;
+        while (*s) {
+            while (*s == ' ') ++s;
+            if (*s && *s != ' ') {
+                ++num_args;
+                while (*s && *s != ' ') ++s;
+            }
+        }
+
+        if (num_args <= 0) {
+            fprintf(stderr, "Invalid ATREE_STRIP command '%s'\n", strip_cmd);
+            return 1;
+
+        } else if (num_args == 1) {
+            return execlp(strip_cmd, strip_cmd, path.c_str(), (char *)NULL);
+
+        } else {
+            // Split the arguments if more than 1
+            char* cmd = strdup(strip_cmd);
+            const char** args = (const char**) malloc(sizeof(const char*) * (num_args + 2));
+
+            const char** curr = args;
+            char* s = cmd;
+            while (*s) {
+                while (*s == ' ') ++s;
+                if (*s && *s != ' ') {
+                    *curr = s;
+                    ++curr;
+                    while (*s && *s != ' ') ++s;
+                    if (*s) {
+                        *s = '\0';
+                        ++s;
+                    }
+                }
+            }
+
+            args[num_args] = path.c_str();
+            args[num_args + 1] = NULL;
+
+            int ret = execvp(args[0], (char* const*)args);
+            free(args);
+            free(cmd);
+            return ret;
+        }
     } else {
         // Wait for child pid and return its exit code.
         int status;