merge in jb-mr1-release history after reset to jb-mr1-dev
diff --git a/core/binary.mk b/core/binary.mk
index 23bbc81..e17efa4 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -5,30 +5,20 @@
 ## The list of object files is exported in $(all_objects).
 ###########################################################
 
-######################################
-## Sanity check for LOCAL_NDK_VERSION
-######################################
 my_ndk_version_root :=
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
+  ifdef LOCAL_NDK_VERSION
+    $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
+  endif
   ifdef LOCAL_IS_HOST_MODULE
-    $(error $(LOCAL_PATH): LOCAL_NDK_VERSION can not be used in host module)
+    $(error $(LOCAL_PATH): LOCAL_SDK_VERSION can not be used in host module)
   endif
   ifneq ($(filter-out SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
-    $(error $(LOCAL_PATH): LOCAL_NDK_VERSION can only be used to build target shared/static libraries, \
+    $(error $(LOCAL_PATH): NDK can only be used to build target shared/static libraries, \
           while your module is of class $(LOCAL_MODULE_CLASS))
   endif
-  ifeq ($(filter $(LOCAL_NDK_VERSION),$(TARGET_AVAILABLE_NDK_VERSIONS)),)
-    $(error $(LOCAL_PATH): Invalid LOCAL_NDK_VERSION '$(LOCAL_NDK_VERSION)' \
-           Choices are $(TARGET_AVAILABLE_NDK_VERSIONS))
-  endif
-  ifndef LOCAL_SDK_VERSION
-    $(error $(LOCAL_PATH): LOCAL_NDK_VERSION must be defined with LOCAL_SDK_VERSION)
-  endif
-  my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r$(LOCAL_NDK_VERSION)/sources
-  my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r$(LOCAL_NDK_VERSION)/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
-  ifeq ($(wildcard $(my_ndk_version_root)),)
-    $(error $(LOCAL_PATH): ndk version root does not exist: $(my_ndk_version_root))
-  endif
+  my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
+  my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
 
   # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
   # See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -40,7 +30,7 @@
     LOCAL_NDK_STL_VARIANT := system
   endif
   ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
-    $(error $(LOCAL_PATH): Unkown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
+    $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
   endif
   ifeq (system,$(LOCAL_NDK_STL_VARIANT))
     my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
@@ -58,7 +48,7 @@
     # LOCAL_NDK_STL_VARIANT is gnustl_static
     my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
                                $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
-    my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libstdc++.a
+    my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a
   endif
   endif
 endif
@@ -106,7 +96,7 @@
   LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES))
 endif
 
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
   # Get the list of INSTALLED libraries as module names.
   # We can not compute the full path of the LOCAL_SHARED_LIBRARIES for
   # they may cusomize their install path with LOCAL_MODULE_PATH
@@ -133,7 +123,7 @@
 endif
 
 # Add in libcompiler-rt for all regular device builds
-ifeq (,$(LOCAL_NDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(BUILD_TINY_ANDROID))
+ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(BUILD_TINY_ANDROID))
   LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
 endif
 
@@ -177,7 +167,7 @@
 my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
 endif
 
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
 my_target_project_includes :=
 my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
 # TODO: more reliable way to remove platform stuff.
@@ -571,7 +561,7 @@
 
 LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
 
-ifndef LOCAL_NDK_VERSION
+ifndef LOCAL_SDK_VERSION
   LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
 endif
 
@@ -616,7 +606,7 @@
 so_suffix := $($(my_prefix)SHLIB_SUFFIX)
 a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
 
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
 built_shared_libraries := \
     $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
       $(addsuffix $(so_suffix), \
@@ -642,7 +632,7 @@
       $(call intermediates-dir-for, \
         STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
 
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
 built_static_libraries += $(my_ndk_stl_static_lib)
 endif
 
diff --git a/core/build_id.mk b/core/build_id.mk
index 3a4d2c4..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=JOO45C
+# 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/clear_vars.mk b/core/clear_vars.mk
index 8273eb6..a564b3c 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -97,7 +97,6 @@
 LOCAL_CERTIFICATE:=
 LOCAL_SDK_VERSION:=
 LOCAL_SDK_RES_VERSION:=
-LOCAL_NDK_VERSION:=
 LOCAL_NDK_STL_VARIANT:=
 LOCAL_NO_EMMA_INSTRUMENT:=
 LOCAL_NO_EMMA_COMPILE:=
diff --git a/core/config.mk b/core/config.mk
index 194fbe1..aa4e7f1 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -323,13 +323,6 @@
 COLUMN:= column
 endif
 
-dir := $(shell uname)
-ifeq ($(HOST_OS),windows)
-dir := $(HOST_OS)
-endif
-ifeq ($(HOST_OS),darwin)
-dir := $(HOST_OS)-$(HOST_ARCH)
-endif
 OLD_FLEX := prebuilts/misc/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
 
 ifeq ($(HOST_OS),darwin)
@@ -440,10 +433,6 @@
     $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
     $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
 
-TARGET_AVAILABLE_NDK_VERSIONS := $(call numerically_sort,\
-    $(patsubst $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r%,%, \
-    $(wildcard $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r*)))
-
 INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
 
 # This is the standard way to name a directory containing prebuilt target
diff --git a/core/package.mk b/core/package.mk
index 3f911fb..a1d901e 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -307,12 +307,12 @@
 # libstlport_shared.so should never go to the system image.
 # Instead it should be packaged into the apk.
 ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
-ifndef LOCAL_NDK_VERSION
-$(error LOCAL_NDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
+ifndef LOCAL_SDK_VERSION
+$(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
     LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
 endif
 jni_shared_libraries += \
-    $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r$(LOCAL_NDK_VERSION)/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
+    $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
 endif
 
 # Set the abi directory used by the local JNI shared libraries.
diff --git a/core/shared_library.mk b/core/shared_library.mk
index ab7480d..122cd29 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -46,7 +46,7 @@
 my_target_libgcc := $(TARGET_LIBGCC)
 my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
 my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
-ifdef LOCAL_NDK_VERSION
+ifdef LOCAL_SDK_VERSION
 # Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
 # so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
 my_target_global_ld_dirs := \
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index ac0d289..eb95114 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -96,4 +96,3 @@
   # anyone trying to parse it as an integer will probably get "0".
   BUILD_NUMBER := eng.$(USER).$(shell date +%Y%m%d.%H%M%S)
 endif
-
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 9f14c71..6b0dcb9 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -22,6 +22,7 @@
 	DeskClock \
 	Email2 \
 	Exchange2 \
+	FusedLocation \
 	Imap2 \
 	Gallery \
 	Music \
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 4e27c49..f11daf7 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -4063,3 +4063,98 @@
 .plusone {
   float:right;
 }
+
+
+
+/************* HOME/LANDING PAGE *****************/
+
+.slideshow-home {
+  height: 500px;
+  width: 940px;
+  border-bottom: 1px solid #CCC;
+  position: relative;
+  margin: 0;
+}
+.slideshow-home .frame {
+  width: 940px;
+  height: 500px;
+}
+.slideshow-home .content-left {
+  float: left;
+  text-align: center;
+  vertical-align: center;
+  margin: 0 0 0 35px;
+}
+.slideshow-home .content-right {
+  margin: 80px 0 0 0;
+}
+.slideshow-home .content-right p {
+  margin-bottom: 10px;
+}
+.slideshow-home .content-right p:last-child {
+  margin-top: 15px;
+}
+.slideshow-home .content-right h1 {
+  padding:0;
+}
+.slideshow-home .item {
+  height: 500px;
+  width: 940px;
+}
+.home-sections {
+  padding: 30px 20px 20px;
+  margin: 20px 0;
+  background: -webkit-linear-gradient(top, #F6F6F6,#F9F9F9);
+}
+.home-sections ul {
+  margin: 0;
+}
+.home-sections ul li {
+  float: left;
+  display: block;
+  list-style: none;
+  width: 170px;
+  height: 35px;
+  border: 1px solid #ccc;
+  background: white;
+  margin-right: 10px;
+  border-radius: 1px;
+  -webkit-border-radius: 1px;
+  -moz-border-radius: 1px;
+  box-shadow: 1px 1px 5px #EEE;
+  -webkit-box-shadow: 1px 1px 5px #EEE;
+  -moz-box-shadow: 1px 1px 5px #EEE;
+  background: white;
+}
+.home-sections ul li:hover {
+  background: #F9F9F9;
+  border: 1px solid #CCC;
+}
+.home-sections ul li a,
+.home-sections ul li a:hover {
+  font-weight: bold;
+  margin-top: 8px;
+  line-height: 18px;
+  float: left;
+  width: 100%;
+  text-align: center;
+  color: #09c !important;
+}
+.home-sections ul li a {
+  font-weight: bold;
+  margin-top: 8px;
+  line-height: 18px;
+  float: left;
+  width:100%;
+  text-align:center;
+}
+.home-sections ul li img {
+  float: left;
+  margin: -8px 0 0 10px;
+}
+.home-sections ul li.last {
+  margin-right: 0px;
+}
+#footer {
+  margin-top: -40px;
+}
diff --git a/tools/droiddoc/templates-sdk/assets/css/home.css b/tools/droiddoc/templates-sdk/assets/css/home.css
deleted file mode 100644
index 5b7e048..0000000
--- a/tools/droiddoc/templates-sdk/assets/css/home.css
+++ /dev/null
@@ -1,90 +0,0 @@
-.slideshow-home {
-  height: 500px;
-  width: 940px;
-  border-bottom: 1px solid #CCC;
-  position: relative;
-  margin: 0;
-}
-.slideshow-home .frame {
-  width: 940px;
-  height: 500px;
-}
-.slideshow-home .content-left {
-  float: left;
-  text-align: center;
-  vertical-align: center;
-  margin: 0 0 0 35px;
-}
-.slideshow-home .content-right {
-  margin: 80px 0 0 0;
-}
-.slideshow-home .content-right p {
-  margin-bottom: 10px;
-}
-.slideshow-home .content-right p:last-child {
-  margin-top: 15px;
-}
-.slideshow-home .content-right h1 {
-  padding:0;
-}
-.slideshow-home .item {
-  height: 500px;
-  width: 940px;
-}
-.home-sections {
-  padding: 30px 20px 20px;
-  margin: 20px 0;
-  background: -webkit-linear-gradient(top, #F6F6F6,#F9F9F9);
-}
-.home-sections ul {
-  margin: 0;
-}
-.home-sections ul li {
-  float: left;
-  display: block;
-  list-style: none;
-  width: 170px;
-  height: 35px;
-  border: 1px solid #ccc;
-  background: white;
-  margin-right: 10px;
-  border-radius: 1px;
-  -webkit-border-radius: 1px;
-  -moz-border-radius: 1px;
-  box-shadow: 1px 1px 5px #EEE;
-  -webkit-box-shadow: 1px 1px 5px #EEE;
-  -moz-box-shadow: 1px 1px 5px #EEE;
-  background: white;
-}
-.home-sections ul li:hover {
-  background: #F9F9F9;
-  border: 1px solid #CCC;
-}
-.home-sections ul li a,
-.home-sections ul li a:hover {
-  font-weight: bold;
-  margin-top: 8px;
-  line-height: 18px;
-  float: left;
-  width: 100%;
-  text-align: center;
-  color: #09c !important;
-}
-.home-sections ul li a {
-  font-weight: bold;
-  margin-top: 8px;
-  line-height: 18px;
-  float: left;
-  width:100%;
-  text-align:center;
-}
-.home-sections ul li img {
-  float: left;
-  margin: -8px 0 0 10px;
-}
-.home-sections ul li.last {
-  margin-right: 0px;
-}
-#footer {
-  margin-top: -40px;
-}
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index d03f6f4..175403e 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -20,11 +20,6 @@
 type="text/css">
 <?cs /if ?>
 
-<?cs if:carousel ?>
-<!-- homepage carousel -->
-<link href="<?cs var:toroot ?>assets/css/home.css" rel="stylesheet" type="text/css">
-<?cs /if ?>
-
 <!-- BASIC JAVASCRIPT -->
 <script src="<?cs var:toroot ?>assets/js/global-libraries-combined.js"
         type="text/javascript"></script>
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 5037ac5..7681a60 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -747,10 +747,11 @@
     }
 
 class Difference(object):
-  def __init__(self, tf, sf):
+  def __init__(self, tf, sf, diff_program=None):
     self.tf = tf
     self.sf = sf
     self.patch = None
+    self.diff_program = diff_program
 
   def ComputePatch(self):
     """Compute the patch (as a string of data) needed to turn sf into
@@ -759,8 +760,11 @@
     tf = self.tf
     sf = self.sf
 
-    ext = os.path.splitext(tf.name)[1]
-    diff_program = DIFF_PROGRAM_BY_EXT.get(ext, "bsdiff")
+    if self.diff_program:
+      diff_program = self.diff_program
+    else:
+      ext = os.path.splitext(tf.name)[1]
+      diff_program = DIFF_PROGRAM_BY_EXT.get(ext, "bsdiff")
 
     ttemp = tf.WriteToTemp()
     stemp = sf.WriteToTemp()