Merge changes I3432d9d3,I90fcf538,I64398603

* changes:
  Binder: Fix some valgrind errors.
  Binder: Don't cast directly from a pointer to binder_uintptr_t
  Binder: Disable attemptIncStrongHandle
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index 95a8ef2..32bc5d9 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -29,17 +29,13 @@
 LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils liblog libpixelflinger libETC1 libui
 LOCAL_LDLIBS := -lpthread -ldl
 
-ifeq ($(TARGET_ARCH),arm)
-	LOCAL_SRC_FILES += fixed_asm.S iterators.S
-	LOCAL_CFLAGS += -fstrict-aliasing
-endif
+LOCAL_SRC_FILES_arm += fixed_asm.S iterators.S
+LOCAL_CFLAGS_arm += -fstrict-aliasing
 
-ifeq ($(TARGET_ARCH),mips)
-    LOCAL_SRC_FILES += arch-$(TARGET_ARCH)/fixed_asm.S
-    LOCAL_CFLAGS += -fstrict-aliasing
-    # The graphics code can generate division by zero
-    LOCAL_CFLAGS += -mno-check-zero-division
-endif
+LOCAL_SRC_FILES_mips += arch-mips/fixed_asm.S
+LOCAL_CFLAGS_mips += -fstrict-aliasing
+# The graphics code can generate division by zero
+LOCAL_CFLAGS_mips += -mno-check-zero-division
 
 # we need to access the private Bionic header <bionic_tls.h>
 LOCAL_C_INCLUDES += bionic/libc/private
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 02914a0..e528831 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -187,8 +187,13 @@
 
     LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation");
 
+#if defined(__LP64__)
+    cnx->libGles2 = load_wrapper("/system/lib64/libGLESv2.so");
+    cnx->libGles1 = load_wrapper("/system/lib64/libGLESv1_CM.so");
+#else
     cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so");
     cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so");
+#endif
     LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1,
             "couldn't load system OpenGL ES wrapper libraries");
 
@@ -268,8 +273,13 @@
             String8 pattern;
             pattern.appendFormat("lib%s", kind);
             const char* const searchPaths[] = {
+#if defined(__LP64__)
+                    "/vendor/lib64/egl",
+                    "/system/lib64/egl"
+#else
                     "/vendor/lib/egl",
                     "/system/lib/egl"
+#endif
             };
 
             // first, we search for the exact name of the GLES userspace
@@ -310,7 +320,11 @@
             if (checkGlesEmulationStatus() == 0) {
                 ALOGD("Emulator without GPU support detected. "
                       "Fallback to software renderer.");
+#if defined(__LP64__)
+                result.setTo("/system/lib64/egl/libGLES_android.so");
+#else
                 result.setTo("/system/lib/egl/libGLES_android.so");
+#endif
                 return true;
             }
 
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index 0cfd886..0b6bf58 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -116,7 +116,7 @@
     if (producer == NULL)
         goto not_valid_surface;
 
-    window = new android::Surface(producer);
+    window = new android::Surface(producer, true);
 
     if (window == NULL)
         goto not_valid_surface;
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index cc10336..4743038 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -182,7 +182,7 @@
             if (array) {
                 releasePointer(_env, array, buf, 0);
             }
-            buf = buf + offset;
+            buf = (char*)buf + offset;
         } else {
             jniThrowException(_env, "java/lang/IllegalArgumentException",
                               "Must use a native order direct Buffer");
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index b2bc550..49a017f 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -120,6 +120,10 @@
 
 LOCAL_MODULE:= surfaceflinger
 
+ifdef TARGET_32_BIT_SURFACEFLINGER
+LOCAL_32_BIT_ONLY := true
+endif
+
 include $(BUILD_EXECUTABLE)
 
 ###############################################################