diff --git a/Android.mk b/Android.mk
index 5ee1076..781d5d1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -381,6 +381,16 @@
 	frameworks/base/core/java/android/os/DropBoxManager.aidl \
 	frameworks/base/core/java/android/os/ParcelFileDescriptor.aidl \
 	frameworks/base/core/java/android/os/ParcelUuid.aidl \
+	frameworks/base/core/java/android/print/PrinterInfo.aidl \
+	frameworks/base/core/java/android/print/PageRange.aidl \
+	frameworks/base/core/java/android/print/PrintAttributes.aidl \
+	frameworks/base/core/java/android/print/PrinterCapabilitiesInfo.aidl \
+	frameworks/base/core/java/android/print/PrinterId.aidl \
+	frameworks/base/core/java/android/print/PrintJobId.aidl \
+	frameworks/base/core/java/android/print/PrintJobInfo.aidl \
+	frameworks/base/core/java/android/view/accessibility/AccessibilityEvent.aidl \
+	frameworks/base/core/java/android/view/accessibility/AccessibilityNodeInfo.aidl \
+	frameworks/base/core/java/android/view/accessibility/AccessibilityRecord.aidl \
 	frameworks/base/core/java/android/view/KeyEvent.aidl \
 	frameworks/base/core/java/android/view/MotionEvent.aidl \
 	frameworks/base/core/java/android/view/Surface.aidl \
diff --git a/api/current.txt b/api/current.txt
index fd901f2..52900c9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27211,7 +27211,6 @@
     method public final java.lang.CharSequence coerceToString();
     method public static final java.lang.String coerceToString(int, int);
     method public static float complexToDimension(int, android.util.DisplayMetrics);
-    method public static float complexToDimensionNoisy(int, android.util.DisplayMetrics);
     method public static int complexToDimensionPixelOffset(int, android.util.DisplayMetrics);
     method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics);
     method public static float complexToFloat(int);
diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java
index c4ba5b1..b8b8f5f 100644
--- a/core/java/android/bluetooth/BluetoothInputDevice.java
+++ b/core/java/android/bluetooth/BluetoothInputDevice.java
@@ -75,6 +75,12 @@
     public static final String ACTION_PROTOCOL_MODE_CHANGED =
         "android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED";
 
+    /**
+     * @hide
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_REPORT =
+        "android.bluetooth.input.profile.action.REPORT";
 
     /**
      * @hide
@@ -129,17 +135,17 @@
     /**
      * @hide
      */
-    public static final byte REPORT_TYPE_INPUT = 0;
+    public static final byte REPORT_TYPE_INPUT = 1;
 
     /**
      * @hide
      */
-    public static final byte REPORT_TYPE_OUTPUT = 1;
+    public static final byte REPORT_TYPE_OUTPUT = 2;
 
     /**
      * @hide
      */
-    public static final byte REPORT_TYPE_FEATURE = 2;
+    public static final byte REPORT_TYPE_FEATURE = 3;
 
     /**
      * @hide
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 60ccc61..433d5d1c 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -738,14 +738,16 @@
         File dir = file.getParentFile();
         if (dir != null) {
             final String prefix = file.getName() + "-mj";
-            final FileFilter filter = new FileFilter() {
+            File[] files = dir.listFiles(new FileFilter() {
                 @Override
                 public boolean accept(File candidate) {
                     return candidate.getName().startsWith(prefix);
                 }
-            };
-            for (File masterJournal : dir.listFiles(filter)) {
-                deleted |= masterJournal.delete();
+            });
+            if (files != null) {
+                for (File masterJournal : files) {
+                    deleted |= masterJournal.delete();
+                }
             }
         }
         return deleted;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 1ce958b..2afea1f 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -27,6 +27,7 @@
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.telephony.SignalStrength;
+import android.text.format.DateFormat;
 import android.util.Printer;
 import android.util.SparseArray;
 import android.util.TimeUtils;
@@ -895,6 +896,11 @@
     public abstract long getNetworkActivityPackets(int type, int which);
 
     /**
+     * Return the wall clock time when battery stats data collection started.
+     */
+    public abstract long getStartClockTime();
+
+    /**
      * Return whether we are currently running on battery.
      */
     public abstract boolean getIsOnBattery();
@@ -1210,7 +1216,8 @@
         dumpLine(pw, 0 /* uid */, category, BATTERY_DATA, 
                 which == STATS_SINCE_CHARGED ? getStartCount() : "N/A",
                 whichBatteryRealtime / 1000, whichBatteryUptime / 1000,
-                totalRealtime / 1000, totalUptime / 1000); 
+                totalRealtime / 1000, totalUptime / 1000,
+                getStartClockTime());
         
         // Calculate wakelock times across all uids.
         long fullWakeLockTimeTotal = 0;
@@ -1587,7 +1594,9 @@
                 formatTimeMs(sb, totalUptime / 1000);
                 sb.append("uptime, ");
         pw.println(sb.toString());
-        
+        pw.print("  Start clock time: ");
+        pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss", getStartClockTime()).toString());
+
         final long screenOnTime = getScreenOnTime(batteryRealtime, which);
         final long phoneOnTime = getPhoneOnTime(batteryRealtime, which);
         final long wifiRunningTime = getGlobalWifiRunningTime(batteryRealtime, which);
diff --git a/core/java/android/util/TypedValue.java b/core/java/android/util/TypedValue.java
index ed45298..931fb81 100644
--- a/core/java/android/util/TypedValue.java
+++ b/core/java/android/util/TypedValue.java
@@ -290,18 +290,14 @@
         return -1;
     }
 
+    /**
+     * @hide Was accidentally exposed in API level 1 for debugging purposes.
+     * Kept for compatibility just in case although the debugging code has been removed.
+     */
+    @Deprecated
     public static float complexToDimensionNoisy(int data, DisplayMetrics metrics)
     {
-        float res = complexToDimension(data, metrics);
-        System.out.println(
-            "Dimension (0x" + ((data>>TypedValue.COMPLEX_MANTISSA_SHIFT)
-                               & TypedValue.COMPLEX_MANTISSA_MASK)
-            + "*" + (RADIX_MULTS[(data>>TypedValue.COMPLEX_RADIX_SHIFT)
-                                & TypedValue.COMPLEX_RADIX_MASK] / MANTISSA_MULT)
-            + ")" + DIMENSION_UNIT_STRS[(data>>COMPLEX_UNIT_SHIFT)
-                                & COMPLEX_UNIT_MASK]
-            + " = " + res);
-        return res;
+        return complexToDimension(data, metrics);
     }
 
     /**
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
index 8dd6a91..439fc6c 100644
--- a/core/java/android/view/DisplayList.java
+++ b/core/java/android/view/DisplayList.java
@@ -364,7 +364,7 @@
         return mValid && mFinalizer != null;
     }
 
-    int getNativeDisplayList() {
+    long getNativeDisplayList() {
         if (!mValid || mFinalizer == null) {
             throw new IllegalStateException("The display list is not valid.");
         }
@@ -1029,73 +1029,73 @@
     // Native methods
     ///////////////////////////////////////////////////////////////////////////
 
-    private static native void nDestroyDisplayList(int displayList);
-    private static native int nGetDisplayListSize(int displayList);
-    private static native void nSetDisplayListName(int displayList, String name);
+    private static native void nDestroyDisplayList(long displayList);
+    private static native int nGetDisplayListSize(long displayList);
+    private static native void nSetDisplayListName(long displayList, String name);
 
     // Properties
 
-    private static native void nReset(int displayList);
-    private static native void nOffsetTopAndBottom(int displayList, float offset);
-    private static native void nOffsetLeftAndRight(int displayList, float offset);
-    private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
+    private static native void nReset(long displayList);
+    private static native void nOffsetTopAndBottom(long displayList, float offset);
+    private static native void nOffsetLeftAndRight(long displayList, float offset);
+    private static native void nSetLeftTopRightBottom(long displayList, int left, int top,
             int right, int bottom);
-    private static native void nSetBottom(int displayList, int bottom);
-    private static native void nSetRight(int displayList, int right);
-    private static native void nSetTop(int displayList, int top);
-    private static native void nSetLeft(int displayList, int left);
-    private static native void nSetCameraDistance(int displayList, float distance);
-    private static native void nSetPivotY(int displayList, float pivotY);
-    private static native void nSetPivotX(int displayList, float pivotX);
-    private static native void nSetCaching(int displayList, boolean caching);
-    private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
-    private static native void nSetProjectToContainedVolume(int displayList, boolean shouldProject);
-    private static native void nSetIsContainedVolume(int displayList, boolean isContainedVolume);
-    private static native void nSetAlpha(int displayList, float alpha);
-    private static native void nSetHasOverlappingRendering(int displayList,
+    private static native void nSetBottom(long displayList, int bottom);
+    private static native void nSetRight(long displayList, int right);
+    private static native void nSetTop(long displayList, int top);
+    private static native void nSetLeft(long displayList, int left);
+    private static native void nSetCameraDistance(long displayList, float distance);
+    private static native void nSetPivotY(long displayList, float pivotY);
+    private static native void nSetPivotX(long displayList, float pivotX);
+    private static native void nSetCaching(long displayList, boolean caching);
+    private static native void nSetClipToBounds(long displayList, boolean clipToBounds);
+    private static native void nSetProjectToContainedVolume(long displayList, boolean shouldProject);
+    private static native void nSetIsContainedVolume(long displayList, boolean isContainedVolume);
+    private static native void nSetAlpha(long displayList, float alpha);
+    private static native void nSetHasOverlappingRendering(long displayList,
             boolean hasOverlappingRendering);
-    private static native void nSetTranslationX(int displayList, float translationX);
-    private static native void nSetTranslationY(int displayList, float translationY);
-    private static native void nSetTranslationZ(int displayList, float translationZ);
-    private static native void nSetRotation(int displayList, float rotation);
-    private static native void nSetRotationX(int displayList, float rotationX);
-    private static native void nSetRotationY(int displayList, float rotationY);
-    private static native void nSetScaleX(int displayList, float scaleX);
-    private static native void nSetScaleY(int displayList, float scaleY);
-    private static native void nSetTransformationInfo(int displayList, float alpha,
+    private static native void nSetTranslationX(long displayList, float translationX);
+    private static native void nSetTranslationY(long displayList, float translationY);
+    private static native void nSetTranslationZ(long displayList, float translationZ);
+    private static native void nSetRotation(long displayList, float rotation);
+    private static native void nSetRotationX(long displayList, float rotationX);
+    private static native void nSetRotationY(long displayList, float rotationY);
+    private static native void nSetScaleX(long displayList, float scaleX);
+    private static native void nSetScaleY(long displayList, float scaleY);
+    private static native void nSetTransformationInfo(long displayList, float alpha,
             float translationX, float translationY, float translationZ,
             float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
-    private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
-    private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
+    private static native void nSetStaticMatrix(long displayList, long nativeMatrix);
+    private static native void nSetAnimationMatrix(long displayList, long animationMatrix);
 
-    private static native boolean nHasOverlappingRendering(int displayList);
-    private static native void nGetMatrix(int displayList, int matrix);
-    private static native float nGetAlpha(int displayList);
-    private static native float nGetLeft(int displayList);
-    private static native float nGetTop(int displayList);
-    private static native float nGetRight(int displayList);
-    private static native float nGetBottom(int displayList);
-    private static native float nGetCameraDistance(int displayList);
-    private static native float nGetScaleX(int displayList);
-    private static native float nGetScaleY(int displayList);
-    private static native float nGetTranslationX(int displayList);
-    private static native float nGetTranslationY(int displayList);
-    private static native float nGetTranslationZ(int displayList);
-    private static native float nGetRotation(int displayList);
-    private static native float nGetRotationX(int displayList);
-    private static native float nGetRotationY(int displayList);
-    private static native float nGetPivotX(int displayList);
-    private static native float nGetPivotY(int displayList);
-    private static native void nOutput(int displayList);
+    private static native boolean nHasOverlappingRendering(long displayList);
+    private static native void nGetMatrix(long displayList, long matrix);
+    private static native float nGetAlpha(long displayList);
+    private static native float nGetLeft(long displayList);
+    private static native float nGetTop(long displayList);
+    private static native float nGetRight(long displayList);
+    private static native float nGetBottom(long displayList);
+    private static native float nGetCameraDistance(long displayList);
+    private static native float nGetScaleX(long displayList);
+    private static native float nGetScaleY(long displayList);
+    private static native float nGetTranslationX(long displayList);
+    private static native float nGetTranslationY(long displayList);
+    private static native float nGetTranslationZ(long displayList);
+    private static native float nGetRotation(long displayList);
+    private static native float nGetRotationX(long displayList);
+    private static native float nGetRotationY(long displayList);
+    private static native float nGetPivotX(long displayList);
+    private static native float nGetPivotY(long displayList);
+    private static native void nOutput(long displayList);
 
     ///////////////////////////////////////////////////////////////////////////
     // Finalization
     ///////////////////////////////////////////////////////////////////////////
 
     private static class DisplayListFinalizer {
-        final int mNativeDisplayList;
+        final long mNativeDisplayList;
 
-        public DisplayListFinalizer(int nativeDisplayList) {
+        public DisplayListFinalizer(long nativeDisplayList) {
             mNativeDisplayList = nativeDisplayList;
         }
 
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 449318e..3384359 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -49,7 +49,7 @@
     private static final int MODIFIER_COLOR_FILTER = 4;
 
     private final boolean mOpaque;
-    private int mRenderer;
+    private long mRenderer;
 
     // The native renderer will be destroyed when this object dies.
     // DO NOT overwrite this reference once it is set.
@@ -92,7 +92,7 @@
     /**
      * Creates a canvas to render into an FBO.
      */
-    GLES20Canvas(int layer, boolean translucent) {
+    GLES20Canvas(long layer, boolean translucent) {
         mOpaque = !translucent;
         mRenderer = nCreateLayerRenderer(layer);
         setupFinalizer();
@@ -122,16 +122,16 @@
         nResetDisplayListRenderer(mRenderer);
     }
 
-    private static native int nCreateRenderer();
-    private static native int nCreateLayerRenderer(int layer);
-    private static native int nCreateDisplayListRenderer();
-    private static native void nResetDisplayListRenderer(int renderer);
-    private static native void nDestroyRenderer(int renderer);
+    private static native long nCreateRenderer();
+    private static native long nCreateLayerRenderer(long layer);
+    private static native long nCreateDisplayListRenderer();
+    private static native void nResetDisplayListRenderer(long renderer);
+    private static native void nDestroyRenderer(long renderer);
 
     private static final class CanvasFinalizer {
-        private final int mRenderer;
+        private final long mRenderer;
 
-        public CanvasFinalizer(int renderer) {
+        public CanvasFinalizer(long renderer) {
             mRenderer = renderer;
         }
 
@@ -175,26 +175,26 @@
         nClearLayerUpdates(mRenderer);
     }
 
-    static native int nCreateTextureLayer(boolean opaque, int[] layerInfo);
-    static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo);
-    static native boolean nResizeLayer(int layerId, int width, int height, int[] layerInfo);
-    static native void nSetOpaqueLayer(int layerId, boolean isOpaque);
-    static native void nSetLayerPaint(int layerId, int nativePaint);
-    static native void nSetLayerColorFilter(int layerId, int nativeColorFilter);
-    static native void nUpdateTextureLayer(int layerId, int width, int height, boolean opaque,
+    static native long nCreateTextureLayer(boolean opaque, int[] layerInfo);
+    static native long nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo);
+    static native boolean nResizeLayer(long layerId, int width, int height, int[] layerInfo);
+    static native void nSetOpaqueLayer(long layerId, boolean isOpaque);
+    static native void nSetLayerPaint(long layerId, long nativePaint);
+    static native void nSetLayerColorFilter(long layerId, long nativeColorFilter);
+    static native void nUpdateTextureLayer(long layerId, int width, int height, boolean opaque,
             SurfaceTexture surface);
-    static native void nClearLayerTexture(int layerId);
-    static native void nSetTextureLayerTransform(int layerId, int matrix);
-    static native void nDestroyLayer(int layerId);
-    static native void nDestroyLayerDeferred(int layerId);
-    static native void nUpdateRenderLayer(int layerId, int renderer, int displayList,
+    static native void nClearLayerTexture(long layerId);
+    static native void nSetTextureLayerTransform(long layerId, long matrix);
+    static native void nDestroyLayer(long layerId);
+    static native void nDestroyLayerDeferred(long layerId);
+    static native void nUpdateRenderLayer(long layerId, long renderer, long displayList,
             int left, int top, int right, int bottom);
-    static native boolean nCopyLayer(int layerId, int bitmap);
+    static native boolean nCopyLayer(long layerId, long bitmap);
 
-    private static native void nClearLayerUpdates(int renderer);
-    private static native void nFlushLayerUpdates(int renderer);
-    private static native void nPushLayerUpdate(int renderer, int layer);
-    private static native void nCancelLayerUpdate(int renderer, int layer);
+    private static native void nClearLayerUpdates(long renderer);
+    private static native void nFlushLayerUpdates(long renderer);
+    private static native void nPushLayerUpdate(long renderer, long layer);
+    private static native void nCancelLayerUpdate(long renderer, long layer);
 
     ///////////////////////////////////////////////////////////////////////////
     // Canvas management
@@ -231,7 +231,7 @@
     /**
      * Returns the native OpenGLRenderer object.
      */
-    int getRenderer() {
+    long getRenderer() {
         return mRenderer;
     }
 
@@ -247,7 +247,7 @@
         nSetViewport(mRenderer, width, height);
     }
     
-    private static native void nSetViewport(int renderer, int width, int height);
+    private static native void nSetViewport(long renderer, int width, int height);
 
     @Override
     public int onPreDraw(Rect dirty) {
@@ -259,8 +259,8 @@
         }
     }
 
-    private static native int nPrepare(int renderer, boolean opaque);
-    private static native int nPrepareDirty(int renderer, int left, int top, int right, int bottom,
+    private static native int nPrepare(long renderer, boolean opaque);
+    private static native int nPrepareDirty(long renderer, int left, int top, int right, int bottom,
             boolean opaque);
 
     @Override
@@ -268,7 +268,7 @@
         nFinish(mRenderer);
     }
 
-    private static native void nFinish(int renderer);
+    private static native void nFinish(long renderer);
 
     /**
      * Returns the size of the stencil buffer required by the underlying
@@ -288,45 +288,45 @@
         nSetCountOverdrawEnabled(mRenderer, enabled);
     }
 
-    static native void nSetCountOverdrawEnabled(int renderer, boolean enabled);
+    static native void nSetCountOverdrawEnabled(long renderer, boolean enabled);
 
     float getOverdraw() {
         return nGetOverdraw(mRenderer);
     }
 
-    static native float nGetOverdraw(int renderer);
+    static native float nGetOverdraw(long renderer);
 
     ///////////////////////////////////////////////////////////////////////////
     // Functor
     ///////////////////////////////////////////////////////////////////////////
 
     @Override
-    public int callDrawGLFunction(int drawGLFunction) {
+    public int callDrawGLFunction(long drawGLFunction) {
         return nCallDrawGLFunction(mRenderer, drawGLFunction);
     }
 
-    private static native int nCallDrawGLFunction(int renderer, int drawGLFunction);
+    private static native int nCallDrawGLFunction(long renderer, long drawGLFunction);
 
     @Override
     public int invokeFunctors(Rect dirty) {
         return nInvokeFunctors(mRenderer, dirty);
     }
 
-    private static native int nInvokeFunctors(int renderer, Rect dirty);
+    private static native int nInvokeFunctors(long renderer, Rect dirty);
 
     @Override
-    public void detachFunctor(int functor) {
+    public void detachFunctor(long functor) {
         nDetachFunctor(mRenderer, functor);
     }
 
-    private static native void nDetachFunctor(int renderer, int functor);
+    private static native void nDetachFunctor(long renderer, long functor);
 
     @Override
-    public void attachFunctor(int functor) {
+    public void attachFunctor(long functor) {
         nAttachFunctor(mRenderer, functor);
     }
 
-    private static native void nAttachFunctor(int renderer, int functor);
+    private static native void nAttachFunctor(long renderer, long functor);
 
     ///////////////////////////////////////////////////////////////////////////
     // Memory
@@ -400,11 +400,11 @@
     // Display list
     ///////////////////////////////////////////////////////////////////////////
 
-    int getDisplayList(int displayList) {
+    long getDisplayList(long displayList) {
         return nGetDisplayList(mRenderer, displayList);
     }
 
-    private static native int nGetDisplayList(int renderer, int displayList);
+    private static native long nGetDisplayList(long renderer, long displayList);
 
     @Override
     public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) {
@@ -412,7 +412,7 @@
                 dirty, flags);
     }
 
-    private static native int nDrawDisplayList(int renderer, int displayList,
+    private static native int nDrawDisplayList(long renderer, long displayList,
             Rect dirty, int flags);
 
     ///////////////////////////////////////////////////////////////////////////
@@ -426,7 +426,7 @@
         nDrawLayer(mRenderer, glLayer.getLayer(), x, y);
     }
 
-    private static native void nDrawLayer(int renderer, int layer, float x, float y);
+    private static native void nDrawLayer(long renderer, long layer, float x, float y);
 
     void interrupt() {
         nInterrupt(mRenderer);
@@ -436,8 +436,8 @@
         nResume(mRenderer);
     }
 
-    private static native void nInterrupt(int renderer);
-    private static native void nResume(int renderer);
+    private static native void nInterrupt(long renderer);
+    private static native void nResume(long renderer);
 
     ///////////////////////////////////////////////////////////////////////////
     // Support
@@ -478,14 +478,14 @@
         return nClipPath(mRenderer, path.mNativePath, op.nativeInt);
     }
 
-    private static native boolean nClipPath(int renderer, int path, int op);
+    private static native boolean nClipPath(long renderer, long path, int op);
 
     @Override
     public boolean clipRect(float left, float top, float right, float bottom) {
         return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt);
     }
     
-    private static native boolean nClipRect(int renderer, float left, float top,
+    private static native boolean nClipRect(long renderer, float left, float top,
             float right, float bottom, int op);
 
     @Override
@@ -498,7 +498,7 @@
         return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt);
     }
     
-    private static native boolean nClipRect(int renderer, int left, int top,
+    private static native boolean nClipRect(long renderer, int left, int top,
             int right, int bottom, int op);
 
     @Override
@@ -533,21 +533,21 @@
         return nClipRegion(mRenderer, region.mNativeRegion, op.nativeInt);
     }
 
-    private static native boolean nClipRegion(int renderer, int region, int op);
+    private static native boolean nClipRegion(long renderer, long region, int op);
 
     @Override
     public boolean getClipBounds(Rect bounds) {
         return nGetClipBounds(mRenderer, bounds);
     }
 
-    private static native boolean nGetClipBounds(int renderer, Rect bounds);
+    private static native boolean nGetClipBounds(long renderer, Rect bounds);
 
     @Override
     public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) {
         return nQuickReject(mRenderer, left, top, right, bottom);
     }
     
-    private static native boolean nQuickReject(int renderer, float left, float top,
+    private static native boolean nQuickReject(long renderer, float left, float top,
             float right, float bottom);
 
     @Override
@@ -572,35 +572,35 @@
         if (dx != 0.0f || dy != 0.0f) nTranslate(mRenderer, dx, dy);
     }
     
-    private static native void nTranslate(int renderer, float dx, float dy);
+    private static native void nTranslate(long renderer, float dx, float dy);
 
     @Override
     public void skew(float sx, float sy) {
         nSkew(mRenderer, sx, sy);
     }
 
-    private static native void nSkew(int renderer, float sx, float sy);
+    private static native void nSkew(long renderer, float sx, float sy);
 
     @Override
     public void rotate(float degrees) {
         nRotate(mRenderer, degrees);
     }
     
-    private static native void nRotate(int renderer, float degrees);
+    private static native void nRotate(long renderer, float degrees);
 
     @Override
     public void scale(float sx, float sy) {
         nScale(mRenderer, sx, sy);
     }
     
-    private static native void nScale(int renderer, float sx, float sy);
+    private static native void nScale(long renderer, float sx, float sy);
 
     @Override
     public void setMatrix(Matrix matrix) {
         nSetMatrix(mRenderer, matrix == null ? 0 : matrix.native_instance);
     }
     
-    private static native void nSetMatrix(int renderer, int matrix);
+    private static native void nSetMatrix(long renderer, long matrix);
 
     @SuppressWarnings("deprecation")
     @Override
@@ -608,14 +608,14 @@
         nGetMatrix(mRenderer, matrix.native_instance);
     }
     
-    private static native void nGetMatrix(int renderer, int matrix);
+    private static native void nGetMatrix(long renderer, long matrix);
 
     @Override
     public void concat(Matrix matrix) {
         if (matrix != null) nConcatMatrix(mRenderer, matrix.native_instance);
     }
     
-    private static native void nConcatMatrix(int renderer, int matrix);
+    private static native void nConcatMatrix(long renderer, long matrix);
     
     ///////////////////////////////////////////////////////////////////////////
     // State management
@@ -631,7 +631,7 @@
         return nSave(mRenderer, saveFlags);
     }
 
-    private static native int nSave(int renderer, int flags);
+    private static native int nSave(long renderer, int flags);
     
     @Override
     public int saveLayer(RectF bounds, Paint paint, int saveFlags) {
@@ -642,7 +642,7 @@
         int count;
         int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             count = nSaveLayer(mRenderer, nativePaint, saveFlags);
         } finally {
             if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
@@ -650,7 +650,7 @@
         return count;
     }
 
-    private static native int nSaveLayer(int renderer, int paint, int saveFlags);    
+    private static native int nSaveLayer(long renderer, long paint, int saveFlags);
 
     @Override
     public int saveLayer(float left, float top, float right, float bottom, Paint paint,
@@ -659,7 +659,7 @@
             int count;
             int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
             try {
-                final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+                final long nativePaint = paint == null ? 0 : paint.mNativePaint;
                 count = nSaveLayer(mRenderer, left, top, right, bottom, nativePaint, saveFlags);
             } finally {
                 if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
@@ -669,8 +669,8 @@
         return save(saveFlags);
     }
 
-    private static native int nSaveLayer(int renderer, float left, float top,
-            float right, float bottom, int paint, int saveFlags);
+    private static native int nSaveLayer(long renderer, float left, float top,
+            float right, float bottom, long paint, int saveFlags);
 
     @Override
     public int saveLayerAlpha(RectF bounds, int alpha, int saveFlags) {
@@ -681,7 +681,7 @@
         return nSaveLayerAlpha(mRenderer, alpha, saveFlags);
     }
 
-    private static native int nSaveLayerAlpha(int renderer, int alpha, int saveFlags);    
+    private static native int nSaveLayerAlpha(long renderer, int alpha, int saveFlags);
 
     @Override
     public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha,
@@ -692,7 +692,7 @@
         return save(saveFlags);
     }
 
-    private static native int nSaveLayerAlpha(int renderer, float left, float top, float right,
+    private static native int nSaveLayerAlpha(long renderer, float left, float top, float right,
             float bottom, int alpha, int saveFlags);
     
     @Override
@@ -700,21 +700,21 @@
         nRestore(mRenderer);
     }
     
-    private static native void nRestore(int renderer);
+    private static native void nRestore(long renderer);
 
     @Override
     public void restoreToCount(int saveCount) {
         nRestoreToCount(mRenderer, saveCount);
     }
 
-    private static native void nRestoreToCount(int renderer, int saveCount);
+    private static native void nRestoreToCount(long renderer, int saveCount);
     
     @Override
     public int getSaveCount() {
         return nGetSaveCount(mRenderer);
     }
     
-    private static native int nGetSaveCount(int renderer);
+    private static native int nGetSaveCount(long renderer);
 
     ///////////////////////////////////////////////////////////////////////////
     // Filtering
@@ -731,8 +731,8 @@
         }
     }
 
-    private static native void nResetPaintFilter(int renderer);
-    private static native void nSetupPaintFilter(int renderer, int clearBits, int setBits);
+    private static native void nResetPaintFilter(long renderer);
+    private static native void nSetupPaintFilter(long renderer, int clearBits, int setBits);
 
     @Override
     public DrawFilter getDrawFilter() {
@@ -755,9 +755,9 @@
         }
     }
 
-    private static native void nDrawArc(int renderer, float left, float top,
+    private static native void nDrawArc(long renderer, float left, float top,
             float right, float bottom, float startAngle, float sweepAngle,
-            boolean useCenter, int paint);
+            boolean useCenter, long paint);
 
     @Override
     public void drawARGB(int a, int r, int g, int b) {
@@ -771,7 +771,7 @@
         // Shaders are ignored when drawing patches
         int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawPatch(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, patch.mNativeChunk,
                     dst.left, dst.top, dst.right, dst.bottom, nativePaint);
         } finally {
@@ -786,7 +786,7 @@
         // Shaders are ignored when drawing patches
         int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawPatch(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, patch.mNativeChunk,
                     dst.left, dst.top, dst.right, dst.bottom, nativePaint);
         } finally {
@@ -794,8 +794,8 @@
         }
     }
 
-    private static native void nDrawPatch(int renderer, int bitmap, byte[] buffer, int chunk,
-            float left, float top, float right, float bottom, int paint);
+    private static native void nDrawPatch(long renderer, long bitmap, byte[] buffer, long chunk,
+            float left, float top, float right, float bottom, long paint);
 
     @Override
     public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) {
@@ -803,15 +803,15 @@
         // Shaders are ignored when drawing bitmaps
         int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, left, top, nativePaint);
         } finally {
             if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
-    private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
-            float left, float top, int paint);
+    private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
+            float left, float top, long paint);
 
     @Override
     public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
@@ -819,7 +819,7 @@
         // Shaders are ignored when drawing bitmaps
         int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer,
                     matrix.native_instance, nativePaint);
         } finally {
@@ -827,8 +827,8 @@
         }
     }
 
-    private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
-            int matrix, int paint);
+    private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
+            long matrix, long paint);
 
     @Override
     public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {
@@ -836,7 +836,7 @@
         // Shaders are ignored when drawing bitmaps
         int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
 
             int left, top, right, bottom;
             if (src == null) {
@@ -863,7 +863,7 @@
         // Shaders are ignored when drawing bitmaps
         int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
     
             float left, top, right, bottom;
             if (src == null) {
@@ -884,9 +884,9 @@
         }
     }
 
-    private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
+    private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
             float srcLeft, float srcTop, float srcRight, float srcBottom,
-            float left, float top, float right, float bottom, int paint);
+            float left, float top, float right, float bottom, long paint);
 
     @Override
     public void drawBitmap(int[] colors, int offset, int stride, float x, float y,
@@ -914,7 +914,7 @@
         // Shaders are ignored when drawing bitmaps
         int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawBitmap(mRenderer, colors, offset, stride, x, y,
                     width, height, hasAlpha, nativePaint);
         } finally {
@@ -922,8 +922,8 @@
         }
     }
 
-    private static native void nDrawBitmap(int renderer, int[] colors, int offset, int stride,
-            float x, float y, int width, int height, boolean hasAlpha, int nativePaint);
+    private static native void nDrawBitmap(long renderer, int[] colors, int offset, int stride,
+            float x, float y, int width, int height, boolean hasAlpha, long nativePaint);
 
     @Override
     public void drawBitmap(int[] colors, int offset, int stride, int x, int y,
@@ -953,7 +953,7 @@
 
         int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         try {
-            final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+            final long nativePaint = paint == null ? 0 : paint.mNativePaint;
             nDrawBitmapMesh(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, meshWidth, meshHeight,
                     verts, vertOffset, colors, colorOffset, nativePaint);
         } finally {
@@ -961,9 +961,9 @@
         }
     }
 
-    private static native void nDrawBitmapMesh(int renderer, int bitmap, byte[] buffer,
+    private static native void nDrawBitmapMesh(long renderer, long bitmap, byte[] buffer,
             int meshWidth, int meshHeight, float[] verts, int vertOffset,
-            int[] colors, int colorOffset, int paint);
+            int[] colors, int colorOffset, long paint);
 
     @Override
     public void drawCircle(float cx, float cy, float radius, Paint paint) {
@@ -975,8 +975,8 @@
         }
     }
 
-    private static native void nDrawCircle(int renderer, float cx, float cy,
-            float radius, int paint);
+    private static native void nDrawCircle(long renderer, float cx, float cy,
+            float radius, long paint);
 
     @Override
     public void drawColor(int color) {
@@ -988,7 +988,7 @@
         nDrawColor(mRenderer, color, mode.nativeInt);
     }
     
-    private static native void nDrawColor(int renderer, int color, int mode);
+    private static native void nDrawColor(long renderer, int color, int mode);
 
     @Override
     public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint) {
@@ -1015,8 +1015,8 @@
         }
     }
 
-    private static native void nDrawLines(int renderer, float[] points,
-            int offset, int count, int paint);
+    private static native void nDrawLines(long renderer, float[] points,
+            int offset, int count, long paint);
 
     @Override
     public void drawLines(float[] pts, Paint paint) {
@@ -1033,8 +1033,8 @@
         }
     }
 
-    private static native void nDrawOval(int renderer, float left, float top,
-            float right, float bottom, int paint);
+    private static native void nDrawOval(long renderer, float left, float top,
+            float right, float bottom, long paint);
 
     @Override
     public void drawPaint(Paint paint) {
@@ -1059,8 +1059,8 @@
         }
     }
 
-    private static native void nDrawPath(int renderer, int path, int paint);
-    private static native void nDrawRects(int renderer, int region, int paint);
+    private static native void nDrawPath(long renderer, long path, long paint);
+    private static native void nDrawRects(long renderer, long region, long paint);
 
     void drawRects(float[] rects, int count, Paint paint) {
         int modifiers = setupModifiers(paint, MODIFIER_COLOR_FILTER | MODIFIER_SHADER);
@@ -1071,7 +1071,7 @@
         }
     }
 
-    private static native void nDrawRects(int renderer, float[] rects, int count, int paint);
+    private static native void nDrawRects(long renderer, float[] rects, int count, long paint);
 
     @Override
     public void drawPicture(Picture picture) {
@@ -1138,8 +1138,8 @@
         }
     }
 
-    private static native void nDrawPoints(int renderer, float[] points,
-            int offset, int count, int paint);
+    private static native void nDrawPoints(long renderer, float[] points,
+            int offset, int count, long paint);
 
     @SuppressWarnings("deprecation")
     @Override
@@ -1156,8 +1156,8 @@
         }
     }
 
-    private static native void nDrawPosText(int renderer, char[] text, int index, int count,
-            float[] pos, int paint);
+    private static native void nDrawPosText(long renderer, char[] text, int index, int count,
+            float[] pos, long paint);
 
     @SuppressWarnings("deprecation")
     @Override
@@ -1174,8 +1174,8 @@
         }
     }
 
-    private static native void nDrawPosText(int renderer, String text, int start, int end,
-            float[] pos, int paint);
+    private static native void nDrawPosText(long renderer, String text, int start, int end,
+            float[] pos, long paint);
 
     @Override
     public void drawRect(float left, float top, float right, float bottom, Paint paint) {
@@ -1188,8 +1188,8 @@
         }
     }
 
-    private static native void nDrawRect(int renderer, float left, float top,
-            float right, float bottom, int paint);
+    private static native void nDrawRect(long renderer, float left, float top,
+            float right, float bottom, long paint);
 
     @Override
     public void drawRect(Rect r, Paint paint) {
@@ -1217,8 +1217,8 @@
         }
     }
 
-    private static native void nDrawRoundRect(int renderer, float left, float top,
-            float right, float bottom, float rx, float y, int paint);
+    private static native void nDrawRoundRect(long renderer, float left, float top,
+            float right, float bottom, float rx, float y, long paint);
 
     @Override
     public void drawText(char[] text, int index, int count, float x, float y, Paint paint) {
@@ -1234,8 +1234,8 @@
         }
     }
     
-    private static native void nDrawText(int renderer, char[] text, int index, int count,
-            float x, float y, int bidiFlags, int paint);
+    private static native void nDrawText(long renderer, char[] text, int index, int count,
+            float x, float y, int bidiFlags, long paint);
 
     @Override
     public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
@@ -1274,8 +1274,8 @@
         }
     }
 
-    private static native void nDrawText(int renderer, String text, int start, int end,
-            float x, float y, int bidiFlags, int paint);
+    private static native void nDrawText(long renderer, String text, int start, int end,
+            float x, float y, int bidiFlags, long paint);
 
     @Override
     public void drawText(String text, float x, float y, Paint paint) {
@@ -1304,8 +1304,8 @@
         }
     }
 
-    private static native void nDrawTextOnPath(int renderer, char[] text, int index, int count,
-            int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+    private static native void nDrawTextOnPath(long renderer, char[] text, int index, int count,
+            long path, float hOffset, float vOffset, int bidiFlags, long nativePaint);
 
     @Override
     public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
@@ -1320,8 +1320,8 @@
         }
     }
 
-    private static native void nDrawTextOnPath(int renderer, String text, int start, int end,
-            int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+    private static native void nDrawTextOnPath(long renderer, String text, int start, int end,
+            long path, float hOffset, float vOffset, int bidiFlags, long nativePaint);
 
     @Override
     public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
@@ -1342,8 +1342,8 @@
         }
     }
 
-    private static native void nDrawTextRun(int renderer, char[] text, int index, int count,
-            int contextIndex, int contextCount, float x, float y, int dir, int nativePaint);
+    private static native void nDrawTextRun(long renderer, char[] text, int index, int count,
+            int contextIndex, int contextCount, float x, float y, int dir, long nativePaint);
 
     @Override
     public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
@@ -1376,8 +1376,8 @@
         }
     }
 
-    private static native void nDrawTextRun(int renderer, String text, int start, int end,
-            int contextStart, int contextEnd, float x, float y, int flags, int nativePaint);
+    private static native void nDrawTextRun(long renderer, String text, int start, int end,
+            int contextStart, int contextEnd, float x, float y, int flags, long nativePaint);
 
     @Override
     public void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
@@ -1457,10 +1457,10 @@
         return MODIFIER_NONE;
     }
 
-    private static native void nSetupShader(int renderer, int shader);
-    private static native void nSetupColorFilter(int renderer, int colorFilter);
-    private static native void nSetupShadow(int renderer, float radius,
+    private static native void nSetupShader(long renderer, long shader);
+    private static native void nSetupColorFilter(long renderer, long colorFilter);
+    private static native void nSetupShadow(long renderer, float radius,
             float dx, float dy, int color);
 
-    private static native void nResetModifiers(int renderer, int modifiers);
+    private static native void nResetModifiers(long renderer, int modifiers);
 }
diff --git a/core/java/android/view/GLES20Layer.java b/core/java/android/view/GLES20Layer.java
index 0e3311c..37154eb 100644
--- a/core/java/android/view/GLES20Layer.java
+++ b/core/java/android/view/GLES20Layer.java
@@ -24,7 +24,7 @@
  * An OpenGL ES 2.0 implementation of {@link HardwareLayer}.
  */
 abstract class GLES20Layer extends HardwareLayer {
-    int mLayer;
+    long mLayer;
     Finalizer mFinalizer;
 
     GLES20Layer() {
@@ -39,7 +39,7 @@
      * 
      * @return A pointer to the native layer object, or 0 if the object is NULL
      */
-    public int getLayer() {
+    public long getLayer() {
         return mLayer;
     }
 
@@ -75,9 +75,9 @@
     }
 
     static class Finalizer {
-        private int mLayerId;
+        private long mLayerId;
 
-        public Finalizer(int layerId) {
+        public Finalizer(long layerId) {
             mLayerId = layerId;
         }
 
diff --git a/core/java/android/view/GLES20RecordingCanvas.java b/core/java/android/view/GLES20RecordingCanvas.java
index 97efa18..b7b6883 100644
--- a/core/java/android/view/GLES20RecordingCanvas.java
+++ b/core/java/android/view/GLES20RecordingCanvas.java
@@ -58,7 +58,7 @@
         mDisplayList.clearReferences();
     }
 
-    int end(int nativeDisplayList) {
+    long end(long nativeDisplayList) {
         return getDisplayList(nativeDisplayList);
     }
 
diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java
index 1811111..449bad6 100644
--- a/core/java/android/view/GLRenderer.java
+++ b/core/java/android/view/GLRenderer.java
@@ -1406,22 +1406,20 @@
     }
 
     @Override
-    void detachFunctor(int functor) {
+    void detachFunctor(long functor) {
         if (mCanvas != null) {
             mCanvas.detachFunctor(functor);
         }
     }
 
     @Override
-    boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
+    void attachFunctor(View.AttachInfo attachInfo, long functor) {
         if (mCanvas != null) {
             mCanvas.attachFunctor(functor);
             mFunctorsRunnable.attachInfo = attachInfo;
             attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
             attachInfo.mHandler.postDelayed(mFunctorsRunnable,  0);
-            return true;
         }
-        return false;
     }
 
     /**
diff --git a/core/java/android/view/GraphicBuffer.java b/core/java/android/view/GraphicBuffer.java
index 30c077c..5f2a9cd 100644
--- a/core/java/android/view/GraphicBuffer.java
+++ b/core/java/android/view/GraphicBuffer.java
@@ -56,7 +56,7 @@
     private final int mFormat;
     private final int mUsage;
     // Note: do not rename, this field is used by native code
-    private final int mNativeObject;
+    private final long mNativeObject;
 
     // These two fields are only used by lock/unlockCanvas()
     private Canvas mCanvas;
@@ -77,7 +77,7 @@
      * @return A <code>GraphicBuffer</code> instance or null
      */
     public static GraphicBuffer create(int width, int height, int format, int usage) {
-        int nativeObject = nCreateGraphicBuffer(width, height, format, usage);
+        long nativeObject = nCreateGraphicBuffer(width, height, format, usage);
         if (nativeObject != 0) {
             return new GraphicBuffer(width, height, format, usage, nativeObject);
         }
@@ -87,7 +87,7 @@
     /**
      * Private use only. See {@link #create(int, int, int, int)}.
      */
-    private GraphicBuffer(int width, int height, int format, int usage, int nativeObject) {
+    private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) {
         mWidth = width;
         mHeight = height;
         mFormat = format;
@@ -271,7 +271,7 @@
             int height = in.readInt();
             int format = in.readInt();
             int usage = in.readInt();
-            int nativeObject = nReadGraphicBufferFromParcel(in);
+            long nativeObject = nReadGraphicBufferFromParcel(in);
             if (nativeObject != 0) {
                 return new GraphicBuffer(width, height, format, usage, nativeObject);
             }
@@ -283,10 +283,10 @@
         }
     };
 
-    private static native int nCreateGraphicBuffer(int width, int height, int format, int usage);
-    private static native void nDestroyGraphicBuffer(int nativeObject);
-    private static native void nWriteGraphicBufferToParcel(int nativeObject, Parcel dest);
-    private static native int nReadGraphicBufferFromParcel(Parcel in);
-    private static native boolean nLockCanvas(int nativeObject, Canvas canvas, Rect dirty);
-    private static native boolean nUnlockCanvasAndPost(int nativeObject, Canvas canvas);
+    private static native long nCreateGraphicBuffer(int width, int height, int format, int usage);
+    private static native void nDestroyGraphicBuffer(long nativeObject);
+    private static native void nWriteGraphicBufferToParcel(long nativeObject, Parcel dest);
+    private static native long nReadGraphicBufferFromParcel(Parcel in);
+    private static native boolean nLockCanvas(long nativeObject, Canvas canvas, Rect dirty);
+    private static native boolean nUnlockCanvasAndPost(long nativeObject, Canvas canvas);
 }
diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java
index 2e972c5..a3c7b63 100644
--- a/core/java/android/view/HardwareCanvas.java
+++ b/core/java/android/view/HardwareCanvas.java
@@ -107,7 +107,7 @@
      *
      * @hide
      */
-    public int callDrawGLFunction(int drawGLFunction) {
+    public int callDrawGLFunction(long drawGLFunction) {
         // Noop - this is done in the display list recorder subclass
         return DisplayList.STATUS_DONE;
     }
@@ -132,12 +132,12 @@
      * @param functor The native functor to remove from the execution queue.
      *
      * @see #invokeFunctors(android.graphics.Rect)
-     * @see #callDrawGLFunction(int)
-     * @see #detachFunctor(int)
+     * @see #callDrawGLFunction(long)
+     * @see #detachFunctor(long)
      *
      * @hide
      */
-    abstract void detachFunctor(int functor);
+    abstract void detachFunctor(long functor);
 
     /**
      * Attaches the specified functor to the current functor execution queue.
@@ -145,12 +145,12 @@
      * @param functor The native functor to add to the execution queue.
      *
      * @see #invokeFunctors(android.graphics.Rect)
-     * @see #callDrawGLFunction(int)
-     * @see #detachFunctor(int)
+     * @see #callDrawGLFunction(long)
+     * @see #detachFunctor(long)
      *
      * @hide
      */
-    abstract void attachFunctor(int functor);
+    abstract void attachFunctor(long functor);
 
     /**
      * Indicates that the specified layer must be updated as soon as possible.
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index ac728f1..2013494 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -453,9 +453,9 @@
      * @param functor The native functor to remove from the execution queue.
      *
      * @see HardwareCanvas#callDrawGLFunction(int)
-     * @see #attachFunctor(android.view.View.AttachInfo, int)
+     * @see #attachFunctor(android.view.View.AttachInfo, long)
      */
-    abstract void detachFunctor(int functor);
+    abstract void detachFunctor(long functor);
 
     /**
      * Schedules the specified functor in the functors execution queue.
@@ -464,11 +464,10 @@
      * @param functor The native functor to insert in the execution queue.
      *
      * @see HardwareCanvas#callDrawGLFunction(int)
-     * @see #detachFunctor(int)
+     * @see #detachFunctor(long)
      *
-     * @return true if the functor was attached successfully
      */
-    abstract boolean attachFunctor(View.AttachInfo attachInfo, int functor);
+    abstract void attachFunctor(View.AttachInfo attachInfo, long functor);
 
     /**
      * Initializes the hardware renderer for the specified surface and setup the
diff --git a/core/java/android/view/RemoteGLRenderer.java b/core/java/android/view/RemoteGLRenderer.java
deleted file mode 100644
index 2919775..0000000
--- a/core/java/android/view/RemoteGLRenderer.java
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.view;
-
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.SurfaceTexture;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.SystemProperties;
-import android.os.Trace;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Surface.OutOfResourcesException;
-
-import java.io.PrintWriter;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * Hardware renderer using OpenGL that's used as the remote endpoint
- * of ThreadedRenderer
- *
- * Currently this is mostly a copy of GLRenderer, but with a few modifications
- * to deal with the threading issues. Ideally native-side functionality
- * will replace this, but we need this to bootstrap without risking breaking
- * changes in GLRenderer
- *
- * @hide
- */
-public class RemoteGLRenderer extends HardwareRenderer {
-    static final int SURFACE_STATE_ERROR = 0;
-    static final int SURFACE_STATE_SUCCESS = 1;
-    static final int SURFACE_STATE_UPDATED = 2;
-
-    static final int FUNCTOR_PROCESS_DELAY = 4;
-
-    /**
-     * Number of frames to profile.
-     */
-    private static final int PROFILE_MAX_FRAMES = 128;
-
-    /**
-     * Number of floats per profiled frame.
-     */
-    private static final int PROFILE_FRAME_DATA_COUNT = 3;
-
-    private static final int PROFILE_DRAW_MARGIN = 0;
-    private static final int PROFILE_DRAW_WIDTH = 3;
-    private static final int[] PROFILE_DRAW_COLORS = { 0xcf3e66cc, 0xcfdc3912, 0xcfe69800 };
-    private static final int PROFILE_DRAW_CURRENT_FRAME_COLOR = 0xcf5faa4d;
-    private static final int PROFILE_DRAW_THRESHOLD_COLOR = 0xff5faa4d;
-    private static final int PROFILE_DRAW_THRESHOLD_STROKE_WIDTH = 2;
-    private static final int PROFILE_DRAW_DP_PER_MS = 7;
-
-    private static final String[] VISUALIZERS = {
-            PROFILE_PROPERTY_VISUALIZE_BARS,
-            PROFILE_PROPERTY_VISUALIZE_LINES
-    };
-
-    private static final String[] OVERDRAW = {
-            OVERDRAW_PROPERTY_SHOW,
-            OVERDRAW_PROPERTY_COUNT
-    };
-    private static final int OVERDRAW_TYPE_COUNT = 1;
-    private static final int GL_VERSION = 2;
-
-    int mWidth = -1, mHeight = -1;
-
-    HardwareCanvas mCanvas;
-
-    String mName;
-
-    long mFrameCount;
-    Paint mDebugPaint;
-
-    boolean mDirtyRegionsEnabled;
-    boolean mSurfaceUpdated;
-
-    boolean mProfileEnabled;
-    int mProfileVisualizerType = -1;
-    float[] mProfileData;
-    ReentrantLock mProfileLock;
-    int mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT;
-
-    GraphDataProvider mDebugDataProvider;
-    float[][] mProfileShapes;
-    Paint mProfilePaint;
-
-    boolean mDebugDirtyRegions;
-    int mDebugOverdraw = -1;
-    HardwareLayer mDebugOverdrawLayer;
-    Paint mDebugOverdrawPaint;
-
-    final boolean mTranslucent;
-
-    private final Rect mRedrawClip = new Rect();
-
-    private final int[] mSurfaceSize = new int[2];
-    private final FunctorsRunnable mFunctorsRunnable = new FunctorsRunnable();
-
-    private long mDrawDelta = Long.MAX_VALUE;
-
-    private GLES20Canvas mGlCanvas;
-
-    private DisplayMetrics mDisplayMetrics;
-    private ThreadedRenderer mOwningRenderer;
-    private long mNativeCanvasContext;
-
-    HardwareCanvas createCanvas() {
-        return mGlCanvas = new GLES20Canvas(mTranslucent);
-    }
-
-    void initCaches() {
-        if (GLES20Canvas.initCaches()) {
-            // Caches were (re)initialized, rebind atlas
-            initAtlas();
-        }
-    }
-
-    void initAtlas() {
-        IBinder binder = ServiceManager.getService("assetatlas");
-        if (binder == null) return;
-
-        IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder);
-        try {
-            if (atlas.isCompatible(android.os.Process.myPpid())) {
-                GraphicBuffer buffer = atlas.getBuffer();
-                if (buffer != null) {
-                    int[] map = atlas.getMap();
-                    if (map != null) {
-                        GLES20Canvas.initAtlas(buffer, map);
-                    }
-                    // If IAssetAtlas is not the same class as the IBinder
-                    // we are using a remote service and we can safely
-                    // destroy the graphic buffer
-                    if (atlas.getClass() != binder.getClass()) {
-                        buffer.destroy();
-                    }
-                }
-            }
-        } catch (RemoteException e) {
-            Log.w(LOG_TAG, "Could not acquire atlas", e);
-        }
-    }
-
-    boolean canDraw() {
-        return mCanvas != null && mGlCanvas != null;
-    }
-
-    int onPreDraw(Rect dirty) {
-        return mGlCanvas.onPreDraw(dirty);
-    }
-
-    void onPostDraw() {
-        mGlCanvas.onPostDraw();
-    }
-
-    void drawProfileData(View.AttachInfo attachInfo) {
-        if (mDebugDataProvider != null) {
-            final GraphDataProvider provider = mDebugDataProvider;
-            initProfileDrawData(attachInfo, provider);
-
-            final int height = provider.getVerticalUnitSize();
-            final int margin = provider.getHorizontaUnitMargin();
-            final int width = provider.getHorizontalUnitSize();
-
-            int x = 0;
-            int count = 0;
-            int current = 0;
-
-            final float[] data = provider.getData();
-            final int elementCount = provider.getElementCount();
-            final int graphType = provider.getGraphType();
-
-            int totalCount = provider.getFrameCount() * elementCount;
-            if (graphType == GraphDataProvider.GRAPH_TYPE_LINES) {
-                totalCount -= elementCount;
-            }
-
-            for (int i = 0; i < totalCount; i += elementCount) {
-                if (data[i] < 0.0f) break;
-
-                int index = count * 4;
-                if (i == provider.getCurrentFrame() * elementCount) current = index;
-
-                x += margin;
-                int x2 = x + width;
-
-                int y2 = mHeight;
-                int y1 = (int) (y2 - data[i] * height);
-
-                switch (graphType) {
-                    case GraphDataProvider.GRAPH_TYPE_BARS: {
-                        for (int j = 0; j < elementCount; j++) {
-                            //noinspection MismatchedReadAndWriteOfArray
-                            final float[] r = mProfileShapes[j];
-                            r[index] = x;
-                            r[index + 1] = y1;
-                            r[index + 2] = x2;
-                            r[index + 3] = y2;
-
-                            y2 = y1;
-                            if (j < elementCount - 1) {
-                                y1 = (int) (y2 - data[i + j + 1] * height);
-                            }
-                        }
-                    } break;
-                    case GraphDataProvider.GRAPH_TYPE_LINES: {
-                        for (int j = 0; j < elementCount; j++) {
-                            //noinspection MismatchedReadAndWriteOfArray
-                            final float[] r = mProfileShapes[j];
-                            r[index] = (x + x2) * 0.5f;
-                            r[index + 1] = index == 0 ? y1 : r[index - 1];
-                            r[index + 2] = r[index] + width;
-                            r[index + 3] = y1;
-
-                            y2 = y1;
-                            if (j < elementCount - 1) {
-                                y1 = (int) (y2 - data[i + j + 1] * height);
-                            }
-                        }
-                    } break;
-                }
-
-
-                x += width;
-                count++;
-            }
-
-            x += margin;
-
-            drawGraph(graphType, count);
-            drawCurrentFrame(graphType, current);
-            drawThreshold(x, height);
-        }
-    }
-
-    private void drawGraph(int graphType, int count) {
-        for (int i = 0; i < mProfileShapes.length; i++) {
-            mDebugDataProvider.setupGraphPaint(mProfilePaint, i);
-            switch (graphType) {
-                case GraphDataProvider.GRAPH_TYPE_BARS:
-                    mGlCanvas.drawRects(mProfileShapes[i], count * 4, mProfilePaint);
-                    break;
-                case GraphDataProvider.GRAPH_TYPE_LINES:
-                    mGlCanvas.drawLines(mProfileShapes[i], 0, count * 4, mProfilePaint);
-                    break;
-            }
-        }
-    }
-
-    private void drawCurrentFrame(int graphType, int index) {
-        if (index >= 0) {
-            mDebugDataProvider.setupCurrentFramePaint(mProfilePaint);
-            switch (graphType) {
-                case GraphDataProvider.GRAPH_TYPE_BARS:
-                    mGlCanvas.drawRect(mProfileShapes[2][index], mProfileShapes[2][index + 1],
-                            mProfileShapes[2][index + 2], mProfileShapes[0][index + 3],
-                            mProfilePaint);
-                    break;
-                case GraphDataProvider.GRAPH_TYPE_LINES:
-                    mGlCanvas.drawLine(mProfileShapes[2][index], mProfileShapes[2][index + 1],
-                            mProfileShapes[2][index], mHeight, mProfilePaint);
-                    break;
-            }
-        }
-    }
-
-    private void drawThreshold(int x, int height) {
-        float threshold = mDebugDataProvider.getThreshold();
-        if (threshold > 0.0f) {
-            mDebugDataProvider.setupThresholdPaint(mProfilePaint);
-            int y = (int) (mHeight - threshold * height);
-            mGlCanvas.drawLine(0.0f, y, x, y, mProfilePaint);
-        }
-    }
-
-    private void initProfileDrawData(View.AttachInfo attachInfo, GraphDataProvider provider) {
-        if (mProfileShapes == null) {
-            final int elementCount = provider.getElementCount();
-            final int frameCount = provider.getFrameCount();
-
-            mProfileShapes = new float[elementCount][];
-            for (int i = 0; i < elementCount; i++) {
-                mProfileShapes[i] = new float[frameCount * 4];
-            }
-
-            mProfilePaint = new Paint();
-        }
-
-        mProfilePaint.reset();
-        if (provider.getGraphType() == GraphDataProvider.GRAPH_TYPE_LINES) {
-            mProfilePaint.setAntiAlias(true);
-        }
-
-        if (mDisplayMetrics == null) {
-            mDisplayMetrics = new DisplayMetrics();
-        }
-
-        attachInfo.mDisplay.getMetrics(mDisplayMetrics);
-        provider.prepare(mDisplayMetrics);
-    }
-
-    @Override
-    void destroy(boolean full) {
-        try {
-            if (full && mCanvas != null) {
-                mCanvas = null;
-            }
-            if (mNativeCanvasContext != 0) {
-                destroyContext(mNativeCanvasContext);
-                mNativeCanvasContext = 0;
-            }
-            setEnabled(false);
-        } finally {
-            if (full && mGlCanvas != null) {
-                mGlCanvas = null;
-            }
-        }
-    }
-
-    @Override
-    void pushLayerUpdate(HardwareLayer layer) {
-        mGlCanvas.pushLayerUpdate(layer);
-    }
-
-    @Override
-    void cancelLayerUpdate(HardwareLayer layer) {
-        mGlCanvas.cancelLayerUpdate(layer);
-    }
-
-    @Override
-    void flushLayerUpdates() {
-        mGlCanvas.flushLayerUpdates();
-    }
-
-    @Override
-    HardwareLayer createHardwareLayer(boolean isOpaque) {
-        return new GLES20TextureLayer(isOpaque);
-    }
-
-    @Override
-    public HardwareLayer createHardwareLayer(int width, int height, boolean isOpaque) {
-        return new GLES20RenderLayer(width, height, isOpaque);
-    }
-
-    void countOverdraw(HardwareCanvas canvas) {
-        ((GLES20Canvas) canvas).setCountOverdrawEnabled(true);
-    }
-
-    float getOverdraw(HardwareCanvas canvas) {
-        return ((GLES20Canvas) canvas).getOverdraw();
-    }
-
-    @Override
-    public SurfaceTexture createSurfaceTexture(HardwareLayer layer) {
-        return ((GLES20TextureLayer) layer).getSurfaceTexture();
-    }
-
-    @Override
-    void setSurfaceTexture(HardwareLayer layer, SurfaceTexture surfaceTexture) {
-        ((GLES20TextureLayer) layer).setSurfaceTexture(surfaceTexture);
-    }
-
-    @Override
-    boolean safelyRun(Runnable action) {
-        boolean needsContext = !isEnabled() || checkRenderContext() == SURFACE_STATE_ERROR;
-
-        if (needsContext) {
-            if (!usePBufferSurface()) {
-                return false;
-            }
-        }
-
-        action.run();
-
-        return true;
-    }
-
-    @Override
-    void destroyLayers(final View view) {
-        if (view != null) {
-            safelyRun(new Runnable() {
-                @Override
-                public void run() {
-                    if (mCanvas != null) {
-                        mCanvas.clearLayerUpdates();
-                    }
-                    destroyHardwareLayer(view);
-                    GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
-                }
-            });
-        }
-    }
-
-    private static void destroyHardwareLayer(View view) {
-        view.destroyLayer(true);
-
-        if (view instanceof ViewGroup) {
-            ViewGroup group = (ViewGroup) view;
-
-            int count = group.getChildCount();
-            for (int i = 0; i < count; i++) {
-                destroyHardwareLayer(group.getChildAt(i));
-            }
-        }
-    }
-
-    @Override
-    void destroyHardwareResources(final View view) {
-        if (view != null) {
-            safelyRun(new Runnable() {
-                @Override
-                public void run() {
-                    if (mCanvas != null) {
-                        mCanvas.clearLayerUpdates();
-                    }
-                    destroyResources(view);
-                    GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
-                }
-            });
-        }
-    }
-
-    private static void destroyResources(View view) {
-        view.destroyHardwareResources();
-
-        if (view instanceof ViewGroup) {
-            ViewGroup group = (ViewGroup) view;
-
-            int count = group.getChildCount();
-            for (int i = 0; i < count; i++) {
-                destroyResources(group.getChildAt(i));
-            }
-        }
-    }
-
-    RemoteGLRenderer(ThreadedRenderer owningRenderer, boolean translucent) {
-        mOwningRenderer = owningRenderer;
-        mTranslucent = translucent;
-
-        loadSystemProperties();
-    }
-
-    @Override
-    boolean loadSystemProperties() {
-        boolean value;
-        boolean changed = false;
-
-        String profiling = SystemProperties.get(PROFILE_PROPERTY);
-        int graphType = search(VISUALIZERS, profiling);
-        value = graphType >= 0;
-
-        if (graphType != mProfileVisualizerType) {
-            changed = true;
-            mProfileVisualizerType = graphType;
-
-            mProfileShapes = null;
-            mProfilePaint = null;
-
-            if (value) {
-                mDebugDataProvider = new DrawPerformanceDataProvider(graphType);
-            } else {
-                mDebugDataProvider = null;
-            }
-        }
-
-        // If on-screen profiling is not enabled, we need to check whether
-        // console profiling only is enabled
-        if (!value) {
-            value = Boolean.parseBoolean(profiling);
-        }
-
-        if (value != mProfileEnabled) {
-            changed = true;
-            mProfileEnabled = value;
-
-            if (mProfileEnabled) {
-                Log.d(LOG_TAG, "Profiling hardware renderer");
-
-                int maxProfileFrames = SystemProperties.getInt(PROFILE_MAXFRAMES_PROPERTY,
-                        PROFILE_MAX_FRAMES);
-                mProfileData = new float[maxProfileFrames * PROFILE_FRAME_DATA_COUNT];
-                for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) {
-                    mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1;
-                }
-
-                mProfileLock = new ReentrantLock();
-            } else {
-                mProfileData = null;
-                mProfileLock = null;
-                mProfileVisualizerType = -1;
-            }
-
-            mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT;
-        }
-
-        value = SystemProperties.getBoolean(DEBUG_DIRTY_REGIONS_PROPERTY, false);
-        if (value != mDebugDirtyRegions) {
-            changed = true;
-            mDebugDirtyRegions = value;
-
-            if (mDebugDirtyRegions) {
-                Log.d(LOG_TAG, "Debugging dirty regions");
-            }
-        }
-
-        String overdraw = SystemProperties.get(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY);
-        int debugOverdraw = search(OVERDRAW, overdraw);
-        if (debugOverdraw != mDebugOverdraw) {
-            changed = true;
-            mDebugOverdraw = debugOverdraw;
-
-            if (mDebugOverdraw != OVERDRAW_TYPE_COUNT) {
-                if (mDebugOverdrawLayer != null) {
-                    mDebugOverdrawLayer.destroy();
-                    mDebugOverdrawLayer = null;
-                    mDebugOverdrawPaint = null;
-                }
-            }
-        }
-
-        if (GLRenderer.loadProperties()) {
-            changed = true;
-        }
-
-        return changed;
-    }
-
-    private static int search(String[] values, String value) {
-        for (int i = 0; i < values.length; i++) {
-            if (values[i].equals(value)) return i;
-        }
-        return -1;
-    }
-
-    @Override
-    void dumpGfxInfo(PrintWriter pw) {
-        if (mProfileEnabled) {
-            pw.printf("\n\tDraw\tProcess\tExecute\n");
-
-            mProfileLock.lock();
-            try {
-                for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) {
-                    if (mProfileData[i] < 0) {
-                        break;
-                    }
-                    pw.printf("\t%3.2f\t%3.2f\t%3.2f\n", mProfileData[i], mProfileData[i + 1],
-                            mProfileData[i + 2]);
-                    mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1;
-                }
-                mProfileCurrentFrame = mProfileData.length;
-            } finally {
-                mProfileLock.unlock();
-            }
-        }
-    }
-
-    @Override
-    long getFrameCount() {
-        return mFrameCount;
-    }
-
-    /**
-     * Indicates whether this renderer instance can track and update dirty regions.
-     */
-    boolean hasDirtyRegions() {
-        return mDirtyRegionsEnabled;
-    }
-
-    private void triggerSoftwareFallback() {
-        destroy(true);
-        // we'll try again if it was context lost
-        setRequested(false);
-        Log.w(LOG_TAG, "Mountain View, we've had a problem here. "
-                + "Switching back to software rendering.");
-    }
-
-    @Override
-    boolean initialize(Surface surface) throws OutOfResourcesException {
-        if (isRequested() && !isEnabled()) {
-            mNativeCanvasContext = createContext();
-            boolean surfaceCreated = createEglSurface(surface);
-
-            if (surfaceCreated) {
-                if (mCanvas == null) {
-                    mCanvas = createCanvas();
-                }
-                setEnabled(true);
-                initAtlas();
-                return true;
-            } else {
-                destroy(true);
-                setRequested(false);
-            }
-        }
-        return false;
-    }
-
-    @Override
-    void updateSurface(Surface surface) throws OutOfResourcesException {
-        if (isRequested() && isEnabled()) {
-            createEglSurface(surface);
-        }
-    }
-
-    boolean createEglSurface(Surface surface) throws OutOfResourcesException {
-        // Create an EGL surface we can render into.
-        if (!setSurface(mNativeCanvasContext, surface)) {
-            return false;
-        }
-        makeCurrent(mNativeCanvasContext);
-        mSurfaceUpdated = true;
-
-        initCaches();
-        return true;
-    }
-
-    @Override
-    void invalidate(Surface surface) {
-        setSurface(mNativeCanvasContext, null);
-        setEnabled(false);
-
-        if (surface.isValid()) {
-            if (createEglSurface(surface) && mCanvas != null) {
-                setEnabled(true);
-            }
-        }
-    }
-
-    @Override
-    boolean validate() {
-        return checkRenderContext() != SURFACE_STATE_ERROR;
-    }
-
-    @Override
-    void setup(int width, int height) {
-        if (validate()) {
-            mCanvas.setViewport(width, height);
-            mWidth = width;
-            mHeight = height;
-        }
-    }
-
-    @Override
-    int getWidth() {
-        return mWidth;
-    }
-
-    @Override
-    int getHeight() {
-        return mHeight;
-    }
-
-    @Override
-    void setName(String name) {
-        mName = name;
-    }
-
-    // TODO: Ping pong is fun and all, but this isn't the time or place
-    // However we don't yet have the ability for the RenderThread to run
-    // independently nor have a way to postDelayed, so this will work for now
-    private Runnable mDispatchFunctorsRunnable = new Runnable() {
-        @Override
-        public void run() {
-            ThreadedRenderer.postToRenderThread(mFunctorsRunnable);
-        }
-    };
-
-    class FunctorsRunnable implements Runnable {
-        View.AttachInfo attachInfo;
-
-        @Override
-        public void run() {
-            final HardwareRenderer renderer = attachInfo.mHardwareRenderer;
-            if (renderer == null || !renderer.isEnabled() || renderer != mOwningRenderer) {
-                return;
-            }
-
-            if (checkRenderContext() != SURFACE_STATE_ERROR) {
-                int status = mCanvas.invokeFunctors(mRedrawClip);
-                handleFunctorStatus(attachInfo, status);
-            }
-        }
-    }
-
-    /**
-     * @param displayList The display list to draw
-     * @param attachInfo AttachInfo tied to the specified view.
-     * @param callbacks Callbacks invoked when drawing happens.
-     * @param dirty The dirty rectangle to update, can be null.
-     */
-    void drawDisplayList(DisplayList displayList, View.AttachInfo attachInfo,
-            HardwareDrawCallbacks callbacks, Rect dirty) {
-        if (canDraw()) {
-            if (!hasDirtyRegions()) {
-                dirty = null;
-            }
-
-            final int surfaceState = checkRenderContext();
-            if (surfaceState != SURFACE_STATE_ERROR) {
-                HardwareCanvas canvas = mCanvas;
-
-                if (mProfileEnabled) {
-                    mProfileLock.lock();
-                }
-
-                dirty = beginFrame(canvas, dirty, surfaceState);
-
-                int saveCount = 0;
-                int status = DisplayList.STATUS_DONE;
-
-                long start = GLRenderer.getSystemTime();
-                try {
-                    status = prepareFrame(dirty);
-
-                    saveCount = canvas.save();
-                    callbacks.onHardwarePreDraw(canvas);
-
-                    status |= doDrawDisplayList(attachInfo, canvas, displayList, status);
-                } catch (Exception e) {
-                    Log.e(LOG_TAG, "An error has occurred while drawing:", e);
-                } finally {
-                    callbacks.onHardwarePostDraw(canvas);
-                    canvas.restoreToCount(saveCount);
-
-                    mDrawDelta = GLRenderer.getSystemTime() - start;
-
-                    if (mDrawDelta > 0) {
-                        mFrameCount++;
-
-                        debugOverdraw(attachInfo, dirty, canvas, displayList);
-                        debugDirtyRegions(dirty, canvas);
-                        drawProfileData(attachInfo);
-                    }
-                }
-
-                onPostDraw();
-
-                swapBuffers(status);
-
-                if (mProfileEnabled) {
-                    mProfileLock.unlock();
-                }
-
-                attachInfo.mIgnoreDirtyState = false;
-            }
-        }
-    }
-
-    @Override
-    void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
-            Rect dirty) {
-        throw new IllegalAccessError();
-    }
-
-    private void debugOverdraw(View.AttachInfo attachInfo, Rect dirty,
-            HardwareCanvas canvas, DisplayList displayList) {
-
-        if (mDebugOverdraw == OVERDRAW_TYPE_COUNT) {
-            if (mDebugOverdrawLayer == null) {
-                mDebugOverdrawLayer = createHardwareLayer(mWidth, mHeight, true);
-            } else if (mDebugOverdrawLayer.getWidth() != mWidth ||
-                    mDebugOverdrawLayer.getHeight() != mHeight) {
-                mDebugOverdrawLayer.resize(mWidth, mHeight);
-            }
-
-            if (!mDebugOverdrawLayer.isValid()) {
-                mDebugOverdraw = -1;
-                return;
-            }
-
-            HardwareCanvas layerCanvas = mDebugOverdrawLayer.start(canvas, dirty);
-            countOverdraw(layerCanvas);
-            final int restoreCount = layerCanvas.save();
-            layerCanvas.drawDisplayList(displayList, null, DisplayList.FLAG_CLIP_CHILDREN);
-            layerCanvas.restoreToCount(restoreCount);
-            mDebugOverdrawLayer.end(canvas);
-
-            float overdraw = getOverdraw(layerCanvas);
-            DisplayMetrics metrics = attachInfo.mRootView.getResources().getDisplayMetrics();
-
-            drawOverdrawCounter(canvas, overdraw, metrics.density);
-        }
-    }
-
-    private void drawOverdrawCounter(HardwareCanvas canvas, float overdraw, float density) {
-        final String text = String.format("%.2fx", overdraw);
-        final Paint paint = setupPaint(density);
-        // HSBtoColor will clamp the values in the 0..1 range
-        paint.setColor(Color.HSBtoColor(0.28f - 0.28f * overdraw / 3.5f, 0.8f, 1.0f));
-
-        canvas.drawText(text, density * 4.0f, mHeight - paint.getFontMetrics().bottom, paint);
-    }
-
-    private Paint setupPaint(float density) {
-        if (mDebugOverdrawPaint == null) {
-            mDebugOverdrawPaint = new Paint();
-            mDebugOverdrawPaint.setAntiAlias(true);
-            mDebugOverdrawPaint.setShadowLayer(density * 3.0f, 0.0f, 0.0f, 0xff000000);
-            mDebugOverdrawPaint.setTextSize(density * 20.0f);
-        }
-        return mDebugOverdrawPaint;
-    }
-
-    private Rect beginFrame(HardwareCanvas canvas, Rect dirty, int surfaceState) {
-        // We had to change the current surface and/or context, redraw everything
-        if (surfaceState == SURFACE_STATE_UPDATED) {
-            dirty = null;
-            GLRenderer.beginFrame(null);
-        } else {
-            int[] size = mSurfaceSize;
-            GLRenderer.beginFrame(size);
-
-            if (size[1] != mHeight || size[0] != mWidth) {
-                mWidth = size[0];
-                mHeight = size[1];
-
-                canvas.setViewport(mWidth, mHeight);
-
-                dirty = null;
-            }
-        }
-
-        if (mDebugDataProvider != null) dirty = null;
-
-        return dirty;
-    }
-
-    private int prepareFrame(Rect dirty) {
-        int status;
-        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "prepareFrame");
-        try {
-            status = onPreDraw(dirty);
-        } finally {
-            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
-        }
-        return status;
-    }
-
-    private int doDrawDisplayList(View.AttachInfo attachInfo, HardwareCanvas canvas,
-            DisplayList displayList, int status) {
-
-        long drawDisplayListStartTime = 0;
-        if (mProfileEnabled) {
-            drawDisplayListStartTime = System.nanoTime();
-        }
-
-        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "drawDisplayList");
-        try {
-            status |= canvas.drawDisplayList(displayList, mRedrawClip,
-                    DisplayList.FLAG_CLIP_CHILDREN);
-        } finally {
-            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
-        }
-
-        if (mProfileEnabled) {
-            long now = System.nanoTime();
-            float total = (now - drawDisplayListStartTime) * 0.000001f;
-            mProfileData[mProfileCurrentFrame + 1] = total;
-        }
-
-        handleFunctorStatus(attachInfo, status);
-        return status;
-    }
-
-    private void swapBuffers(int status) {
-        if ((status & DisplayList.STATUS_DREW) == DisplayList.STATUS_DREW) {
-            long eglSwapBuffersStartTime = 0;
-            if (mProfileEnabled) {
-                eglSwapBuffersStartTime = System.nanoTime();
-            }
-
-            if (!swapBuffers(mNativeCanvasContext)) {
-                triggerSoftwareFallback();
-            }
-            mSurfaceUpdated = false;
-
-            if (mProfileEnabled) {
-                long now = System.nanoTime();
-                float total = (now - eglSwapBuffersStartTime) * 0.000001f;
-                mProfileData[mProfileCurrentFrame + 2] = total;
-            }
-        }
-    }
-
-    private void debugDirtyRegions(Rect dirty, HardwareCanvas canvas) {
-        if (mDebugDirtyRegions) {
-            if (mDebugPaint == null) {
-                mDebugPaint = new Paint();
-                mDebugPaint.setColor(0x7fff0000);
-            }
-
-            if (dirty != null && (mFrameCount & 1) == 0) {
-                canvas.drawRect(dirty, mDebugPaint);
-            }
-        }
-    }
-
-    private void handleFunctorStatus(final View.AttachInfo attachInfo, int status) {
-        // If the draw flag is set, functors will be invoked while executing
-        // the tree of display lists
-        if ((status & DisplayList.STATUS_DRAW) != 0) {
-            // TODO: Can we just re-queue ourselves up to draw next frame instead
-            // of bouncing back to the UI thread?
-            // TODO: Respect mRedrawClip - for now just full inval
-            attachInfo.mHandler.post(new Runnable() {
-                @Override
-                public void run() {
-                    attachInfo.mViewRootImpl.invalidate();
-                }
-            });
-            mRedrawClip.setEmpty();
-        }
-
-        if ((status & DisplayList.STATUS_INVOKE) != 0 ||
-                attachInfo.mHandler.hasCallbacks(mDispatchFunctorsRunnable)) {
-            attachInfo.mHandler.removeCallbacks(mDispatchFunctorsRunnable);
-            mFunctorsRunnable.attachInfo = attachInfo;
-            attachInfo.mHandler.postDelayed(mDispatchFunctorsRunnable, FUNCTOR_PROCESS_DELAY);
-        }
-    }
-
-    @Override
-    void detachFunctor(int functor) {
-        if (mCanvas != null) {
-            mCanvas.detachFunctor(functor);
-        }
-    }
-
-    @Override
-    boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
-        if (mCanvas != null) {
-            mCanvas.attachFunctor(functor);
-            mFunctorsRunnable.attachInfo = attachInfo;
-            attachInfo.mHandler.removeCallbacks(mDispatchFunctorsRunnable);
-            attachInfo.mHandler.postDelayed(mDispatchFunctorsRunnable,  0);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Ensures the current EGL context and surface are the ones we expect.
-     * This method throws an IllegalStateException if invoked from a thread
-     * that did not initialize EGL.
-     *
-     * @return {@link #SURFACE_STATE_ERROR} if the correct EGL context cannot be made current,
-     *         {@link #SURFACE_STATE_UPDATED} if the EGL context was changed or
-     *         {@link #SURFACE_STATE_SUCCESS} if the EGL context was the correct one
-     *
-     * @see #checkRenderContextUnsafe()
-     */
-    int checkRenderContext() {
-        if (!makeCurrent(mNativeCanvasContext)) {
-            triggerSoftwareFallback();
-            return SURFACE_STATE_ERROR;
-        }
-        return mSurfaceUpdated ? SURFACE_STATE_UPDATED : SURFACE_STATE_SUCCESS;
-    }
-
-    private static int dpToPx(int dp, float density) {
-        return (int) (dp * density + 0.5f);
-    }
-
-    class DrawPerformanceDataProvider extends GraphDataProvider {
-        private final int mGraphType;
-
-        private int mVerticalUnit;
-        private int mHorizontalUnit;
-        private int mHorizontalMargin;
-        private int mThresholdStroke;
-
-        DrawPerformanceDataProvider(int graphType) {
-            mGraphType = graphType;
-        }
-
-        @Override
-        void prepare(DisplayMetrics metrics) {
-            final float density = metrics.density;
-
-            mVerticalUnit = dpToPx(PROFILE_DRAW_DP_PER_MS, density);
-            mHorizontalUnit = dpToPx(PROFILE_DRAW_WIDTH, density);
-            mHorizontalMargin = dpToPx(PROFILE_DRAW_MARGIN, density);
-            mThresholdStroke = dpToPx(PROFILE_DRAW_THRESHOLD_STROKE_WIDTH, density);
-        }
-
-        @Override
-        int getGraphType() {
-            return mGraphType;
-        }
-
-        @Override
-        int getVerticalUnitSize() {
-            return mVerticalUnit;
-        }
-
-        @Override
-        int getHorizontalUnitSize() {
-            return mHorizontalUnit;
-        }
-
-        @Override
-        int getHorizontaUnitMargin() {
-            return mHorizontalMargin;
-        }
-
-        @Override
-        float[] getData() {
-            return mProfileData;
-        }
-
-        @Override
-        float getThreshold() {
-            return 16;
-        }
-
-        @Override
-        int getFrameCount() {
-            return mProfileData.length / PROFILE_FRAME_DATA_COUNT;
-        }
-
-        @Override
-        int getElementCount() {
-            return PROFILE_FRAME_DATA_COUNT;
-        }
-
-        @Override
-        int getCurrentFrame() {
-            return mProfileCurrentFrame / PROFILE_FRAME_DATA_COUNT;
-        }
-
-        @Override
-        void setupGraphPaint(Paint paint, int elementIndex) {
-            paint.setColor(PROFILE_DRAW_COLORS[elementIndex]);
-            if (mGraphType == GRAPH_TYPE_LINES) paint.setStrokeWidth(mThresholdStroke);
-        }
-
-        @Override
-        void setupThresholdPaint(Paint paint) {
-            paint.setColor(PROFILE_DRAW_THRESHOLD_COLOR);
-            paint.setStrokeWidth(mThresholdStroke);
-        }
-
-        @Override
-        void setupCurrentFramePaint(Paint paint) {
-            paint.setColor(PROFILE_DRAW_CURRENT_FRAME_COLOR);
-            if (mGraphType == GRAPH_TYPE_LINES) paint.setStrokeWidth(mThresholdStroke);
-        }
-    }
-
-    static native long createContext();
-    static native boolean usePBufferSurface();
-    static native boolean setSurface(long nativeCanvasContext, Surface surface);
-    static native boolean swapBuffers(long nativeCanvasContext);
-    static native boolean makeCurrent(long nativeCanvasContext);
-    static native void destroyContext(long nativeCanvasContext);
-}
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index a2775d4..fdaae01 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -37,19 +37,19 @@
 public class Surface implements Parcelable {
     private static final String TAG = "Surface";
 
-    private static native int nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
+    private static native long nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
             throws OutOfResourcesException;
-    private static native int nativeCreateFromSurfaceControl(int surfaceControlNativeObject);
+    private static native long nativeCreateFromSurfaceControl(long surfaceControlNativeObject);
 
-    private static native int nativeLockCanvas(int nativeObject, Canvas canvas, Rect dirty)
+    private static native long nativeLockCanvas(long nativeObject, Canvas canvas, Rect dirty)
             throws OutOfResourcesException;
-    private static native void nativeUnlockCanvasAndPost(int nativeObject, Canvas canvas);
+    private static native void nativeUnlockCanvasAndPost(long nativeObject, Canvas canvas);
 
-    private static native void nativeRelease(int nativeObject);
-    private static native boolean nativeIsValid(int nativeObject);
-    private static native boolean nativeIsConsumerRunningBehind(int nativeObject);
-    private static native int nativeReadFromParcel(int nativeObject, Parcel source);
-    private static native void nativeWriteToParcel(int nativeObject, Parcel dest);
+    private static native void nativeRelease(long nativeObject);
+    private static native boolean nativeIsValid(long nativeObject);
+    private static native boolean nativeIsConsumerRunningBehind(long nativeObject);
+    private static native long nativeReadFromParcel(long nativeObject, Parcel source);
+    private static native void nativeWriteToParcel(long nativeObject, Parcel dest);
 
     public static final Parcelable.Creator<Surface> CREATOR =
             new Parcelable.Creator<Surface>() {
@@ -76,8 +76,8 @@
     // Guarded state.
     final Object mLock = new Object(); // protects the native state
     private String mName;
-    int mNativeObject; // package scope only for SurfaceControl access
-    private int mLockedObject;
+    long mNativeObject; // package scope only for SurfaceControl access
+    private long mLockedObject;
     private int mGenerationId; // incremented each time mNativeObject changes
     private final Canvas mCanvas = new CompatibleCanvas();
 
@@ -140,7 +140,7 @@
     }
 
     /* called from android_view_Surface_createFromIGraphicBufferProducer() */
-    private Surface(int nativeObject) {
+    private Surface(long nativeObject) {
         synchronized (mLock) {
             setNativeObjectLocked(nativeObject);
         }
@@ -271,8 +271,8 @@
             checkNotReleasedLocked();
             if (mNativeObject != mLockedObject) {
                 Log.w(TAG, "WARNING: Surface's mNativeObject (0x" +
-                        Integer.toHexString(mNativeObject) + ") != mLockedObject (0x" +
-                        Integer.toHexString(mLockedObject) +")");
+                        Long.toHexString(mNativeObject) + ") != mLockedObject (0x" +
+                        Long.toHexString(mLockedObject) +")");
             }
             if (mLockedObject == 0) {
                 throw new IllegalStateException("Surface was not locked");
@@ -317,12 +317,12 @@
             throw new IllegalArgumentException("other must not be null");
         }
 
-        int surfaceControlPtr = other.mNativeObject;
+        long surfaceControlPtr = other.mNativeObject;
         if (surfaceControlPtr == 0) {
             throw new NullPointerException(
                     "SurfaceControl native object is null. Are you using a released SurfaceControl?");
         }
-        int newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
+        long newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
 
         synchronized (mLock) {
             if (mNativeObject != 0) {
@@ -344,7 +344,7 @@
             throw new IllegalArgumentException("other must not be null");
         }
         if (other != this) {
-            final int newPtr;
+            final long newPtr;
             synchronized (other.mLock) {
                 newPtr = other.mNativeObject;
                 other.setNativeObjectLocked(0);
@@ -401,7 +401,7 @@
         }
     }
 
-    private void setNativeObjectLocked(int ptr) {
+    private void setNativeObjectLocked(long ptr) {
         if (mNativeObject != ptr) {
             if (mNativeObject == 0 && ptr != 0) {
                 mCloseGuard.open("release");
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 914a5ca..a6f856c 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -32,11 +32,11 @@
 public class SurfaceControl {
     private static final String TAG = "SurfaceControl";
 
-    private static native int nativeCreate(SurfaceSession session, String name,
+    private static native long nativeCreate(SurfaceSession session, String name,
             int w, int h, int format, int flags)
             throws OutOfResourcesException;
-    private static native void nativeRelease(int nativeObject);
-    private static native void nativeDestroy(int nativeObject);
+    private static native void nativeRelease(long nativeObject);
+    private static native void nativeDestroy(long nativeObject);
 
     private static native Bitmap nativeScreenshot(IBinder displayToken,
             int width, int height, int minLayer, int maxLayer, boolean allLayers);
@@ -47,21 +47,21 @@
     private static native void nativeCloseTransaction();
     private static native void nativeSetAnimationTransaction();
 
-    private static native void nativeSetLayer(int nativeObject, int zorder);
-    private static native void nativeSetPosition(int nativeObject, float x, float y);
-    private static native void nativeSetSize(int nativeObject, int w, int h);
-    private static native void nativeSetTransparentRegionHint(int nativeObject, Region region);
-    private static native void nativeSetAlpha(int nativeObject, float alpha);
-    private static native void nativeSetMatrix(int nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
-    private static native void nativeSetFlags(int nativeObject, int flags, int mask);
-    private static native void nativeSetWindowCrop(int nativeObject, int l, int t, int r, int b);
-    private static native void nativeSetLayerStack(int nativeObject, int layerStack);
+    private static native void nativeSetLayer(long nativeObject, int zorder);
+    private static native void nativeSetPosition(long nativeObject, float x, float y);
+    private static native void nativeSetSize(long nativeObject, int w, int h);
+    private static native void nativeSetTransparentRegionHint(long nativeObject, Region region);
+    private static native void nativeSetAlpha(long nativeObject, float alpha);
+    private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
+    private static native void nativeSetFlags(long nativeObject, int flags, int mask);
+    private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b);
+    private static native void nativeSetLayerStack(long nativeObject, int layerStack);
 
     private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
     private static native IBinder nativeCreateDisplay(String name, boolean secure);
     private static native void nativeDestroyDisplay(IBinder displayToken);
     private static native void nativeSetDisplaySurface(
-            IBinder displayToken, int nativeSurfaceObject);
+            IBinder displayToken, long nativeSurfaceObject);
     private static native void nativeSetDisplayLayerStack(
             IBinder displayToken, int layerStack);
     private static native void nativeSetDisplayProjection(
@@ -76,7 +76,7 @@
 
     private final CloseGuard mCloseGuard = CloseGuard.get();
     private final String mName;
-    int mNativeObject; // package visibility only for Surface.java access
+    long mNativeObject; // package visibility only for Surface.java access
 
     /* flags used in constructor (keep in sync with ISurfaceComposerClient.h) */
 
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index bf81811..161fe33 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -127,7 +127,7 @@
     private final Object[] mNativeWindowLock = new Object[0];
     // Used from native code, do not write!
     @SuppressWarnings({"UnusedDeclaration"})
-    private int mNativeWindow;
+    private long mNativeWindow;
 
     /**
      * Creates a new TextureView.
@@ -834,6 +834,6 @@
     private native void nCreateNativeWindow(SurfaceTexture surface);
     private native void nDestroyNativeWindow();
 
-    private static native boolean nLockCanvas(int nativeWindow, Canvas canvas, Rect dirty);
-    private static native void nUnlockCanvasAndPost(int nativeWindow, Canvas canvas);
+    private static native boolean nLockCanvas(long nativeWindow, Canvas canvas, Rect dirty);
+    private static native void nUnlockCanvasAndPost(long nativeWindow, Canvas canvas);
 }
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 2cd1b6e..2c9f1d9 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -18,25 +18,26 @@
 
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
-import android.os.Looper;
 import android.os.SystemClock;
 import android.os.Trace;
-import android.util.Log;
 import android.view.Surface.OutOfResourcesException;
 import android.view.View.AttachInfo;
 
 import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.util.HashMap;
 
 /**
  * Hardware renderer that proxies the rendering to a render thread. Most calls
- * are synchronous, however a few such as draw() are posted async. The display list
- * is shared between the two threads and is guarded by a top level lock.
+ * are currently synchronous.
+ * TODO: Make draw() async.
+ * TODO: Figure out how to share the DisplayList between two threads (global lock?)
  *
  * The UI thread can block on the RenderThread, but RenderThread must never
  * block on the UI thread.
  *
+ * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates
+ * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed
+ * by the lifecycle of the RenderProxy.
+ *
  * Note that although currently the EGL context & surfaces are created & managed
  * by the render thread, the goal is to move that into a shared structure that can
  * be managed by both threads. EGLSurface creation & deletion should ideally be
@@ -48,49 +49,29 @@
 public class ThreadedRenderer extends HardwareRenderer {
     private static final String LOGTAG = "ThreadedRenderer";
 
-    @SuppressWarnings("serial")
-    static HashMap<String, Method> sMethodLut = new HashMap<String, Method>() {{
-        Method[] methods = RemoteGLRenderer.class.getDeclaredMethods();
-        for (Method m : methods) {
-            m.setAccessible(true);
-            put(m.getName() + ":" + m.getParameterTypes().length, m);
-        }
-    }};
-    static boolean sNeedsInit = true;
+    private static final Rect NULL_RECT = new Rect(-1, -1, -1, -1);
 
-    private RemoteGLRenderer mRemoteRenderer;
     private int mWidth, mHeight;
-    private RTJob mPreviousDraw;
+    private long mNativeProxy;
 
     ThreadedRenderer(boolean translucent) {
-        mRemoteRenderer = new RemoteGLRenderer(this, translucent);
-        setEnabled(true);
-        if (sNeedsInit) {
-            sNeedsInit = false;
-            postToRenderThread(new Runnable() {
-                @Override
-                public void run() {
-                    // Hack to allow GLRenderer to create a handler to post the EGL
-                    // destruction to, although it'll never run
-                    Looper.prepare();
-                }
-            });
-        }
+        mNativeProxy = nCreateProxy(translucent);
+        setEnabled(mNativeProxy != 0);
     }
 
     @Override
     void destroy(boolean full) {
-        run("destroy", full);
+        nDestroyCanvas(mNativeProxy);
     }
 
     @Override
     boolean initialize(Surface surface) throws OutOfResourcesException {
-        return (Boolean) run("initialize", surface);
+        return nInitialize(mNativeProxy, surface);
     }
 
     @Override
     void updateSurface(Surface surface) throws OutOfResourcesException {
-        post("updateSurface", surface);
+        nUpdateSurface(mNativeProxy, surface);
     }
 
     @Override
@@ -100,12 +81,27 @@
 
     @Override
     void destroyHardwareResources(View view) {
-        run("destroyHardwareResources", view);
+        // TODO: canvas.clearLayerUpdates()
+        destroyResources(view);
+        // TODO: GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
+    }
+
+    private static void destroyResources(View view) {
+        view.destroyHardwareResources();
+
+        if (view instanceof ViewGroup) {
+            ViewGroup group = (ViewGroup) view;
+
+            int count = group.getChildCount();
+            for (int i = 0; i < count; i++) {
+                destroyResources(group.getChildAt(i));
+            }
+        }
     }
 
     @Override
     void invalidate(Surface surface) {
-        post("invalidate", surface);
+        updateSurface(surface);
     }
 
     @Override
@@ -116,14 +112,15 @@
 
     @Override
     boolean safelyRun(Runnable action) {
-        return (Boolean) run("safelyRun", action);
+        // TODO:
+        return false;
     }
 
     @Override
     void setup(int width, int height) {
         mWidth = width;
         mHeight = height;
-        post("setup", width, height);
+        nSetup(mNativeProxy, width, height);
     }
 
     @Override
@@ -149,7 +146,7 @@
 
     @Override
     boolean loadSystemProperties() {
-        return (Boolean) run("loadSystemProperties");
+        return false;
     }
 
     @Override
@@ -174,20 +171,10 @@
      *
      *  @hide */
     public void repeatLastDraw() {
-        if (mPreviousDraw == null) {
-            throw new IllegalStateException("There isn't a previous draw");
-        }
-        synchronized (mPreviousDraw) {
-            mPreviousDraw.completed = false;
-        }
-        mPreviousDraw.args[3] = null;
-        postToRenderThread(mPreviousDraw);
     }
 
     @Override
     void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) {
-        requireCompletion(mPreviousDraw);
-
         attachInfo.mIgnoreDirtyState = true;
         attachInfo.mDrawingTime = SystemClock.uptimeMillis();
         view.mPrivateFlags |= View.PFLAG_DRAWN;
@@ -202,8 +189,11 @@
 
         view.mRecreateDisplayList = false;
 
-        mPreviousDraw = post("drawDisplayList", displayList, attachInfo,
-                callbacks, dirty);
+        if (dirty == null) {
+            dirty = NULL_RECT;
+        }
+        nDrawDisplayList(mNativeProxy, displayList.getNativeDisplayList(),
+                dirty.left, dirty.top, dirty.right, dirty.bottom);
     }
 
     @Override
@@ -227,86 +217,41 @@
     }
 
     @Override
-    void detachFunctor(int functor) {
-        run("detachFunctor", functor);
+    void detachFunctor(long functor) {
+        nDetachFunctor(mNativeProxy, functor);
     }
 
     @Override
-    boolean attachFunctor(AttachInfo attachInfo, int functor) {
-        return (Boolean) run("attachFunctor", attachInfo, functor);
+    void attachFunctor(AttachInfo attachInfo, long functor) {
+        nAttachFunctor(mNativeProxy, functor);
     }
 
     @Override
     void setName(String name) {
-        post("setName", name);
     }
 
-    private static void requireCompletion(RTJob job) {
-        if (job != null) {
-            synchronized (job) {
-                if (!job.completed) {
-                    try {
-                        job.wait();
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            }
-        }
-    }
-
-    private RTJob post(String method, Object... args) {
-        RTJob job = new RTJob();
-        job.method = sMethodLut.get(method + ":" + args.length);
-        job.args = args;
-        job.target = mRemoteRenderer;
-        if (job.method == null) {
-            throw new NullPointerException("Couldn't find method: " + method);
-        }
-        postToRenderThread(job);
-        return job;
-    }
-
-    private Object run(String method, Object... args) {
-        RTJob job = new RTJob();
-        job.method = sMethodLut.get(method + ":" + args.length);
-        job.args = args;
-        job.target = mRemoteRenderer;
-        if (job.method == null) {
-            throw new NullPointerException("Couldn't find method: " + method);
-        }
-        synchronized (job) {
-            postToRenderThread(job);
-            try {
-                job.wait();
-                return job.ret;
-            } catch (InterruptedException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    static class RTJob implements Runnable {
-        Method method;
-        Object[] args;
-        Object target;
-        Object ret;
-        boolean completed = false;
-
-        @Override
-        public void run() {
-            try {
-                ret = method.invoke(target, args);
-                synchronized (this) {
-                    completed = true;
-                    notify();
-                }
-            } catch (Exception e) {
-                Log.e(LOGTAG, "Failed to invoke: " + method.getName(), e);
-            }
+    @Override
+    protected void finalize() throws Throwable {
+        try {
+            nDeleteProxy(mNativeProxy);
+        } finally {
+            super.finalize();
         }
     }
 
     /** @hide */
     public static native void postToRenderThread(Runnable runnable);
+
+    private static native long nCreateProxy(boolean translucent);
+    private static native void nDeleteProxy(long nativeProxy);
+
+    private static native boolean nInitialize(long nativeProxy, Surface window);
+    private static native void nUpdateSurface(long nativeProxy, Surface window);
+    private static native void nSetup(long nativeProxy, int width, int height);
+    private static native void nDrawDisplayList(long nativeProxy, long displayList,
+            int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);
+    private static native void nDestroyCanvas(long nativeProxy);
+
+    private static native void nAttachFunctor(long nativeProxy, long functor);
+    private static native void nDetachFunctor(long nativeProxy, long functor);
 }
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 41b0c67..5aa46f3 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -660,12 +660,11 @@
         mHandler.sendMessageAtFrontOfQueue(mHandler.obtainMessage(MSG_FLUSH_LAYER_UPDATES));
     }
 
-    public boolean attachFunctor(int functor) {
+    public void attachFunctor(int functor) {
         //noinspection SimplifiableIfStatement
         if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
-            return mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
+            mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
         }
-        return false;
     }
 
     public void detachFunctor(int functor) {
diff --git a/core/java/android/view/accessibility/AccessibilityRecord.aidl b/core/java/android/view/accessibility/AccessibilityRecord.aidl
new file mode 100644
index 0000000..d542af0
--- /dev/null
+++ b/core/java/android/view/accessibility/AccessibilityRecord.aidl
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.accessibility;
+
+parcelable AccessibilityRecord;
diff --git a/core/java/android/webkit/DebugFlags.java b/core/java/android/webkit/DebugFlags.java
index b5ca8c1..7b3cb1b 100644
--- a/core/java/android/webkit/DebugFlags.java
+++ b/core/java/android/webkit/DebugFlags.java
@@ -31,7 +31,6 @@
     public static final boolean COOKIE_SYNC_MANAGER = false;
     public static final boolean TRACE_API = false;
     public static final boolean TRACE_CALLBACK = false;
-    public static final boolean TRACE_JAVASCRIPT_BRIDGE = false;
     public static final boolean URL_UTIL = false;
     public static final boolean WEB_SYNC_MANAGER = false;
 
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index a87c7d2..746d34a 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -1638,6 +1638,7 @@
                         || mMaxDate.get(Calendar.DAY_OF_WEEK) != mFirstDayOfWeek) {
                     mTotalWeekCount++;
                 }
+                notifyDataSetChanged();
             }
 
             /**
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index aa8bbb2..15606a45 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8670,6 +8670,10 @@
         super.onRtlPropertiesChanged(layoutDirection);
 
         mTextDir = getTextDirectionHeuristic();
+
+        if (mLayout != null) {
+            checkForRelayout();
+        }
     }
 
     TextDirectionHeuristic getTextDirectionHeuristic() {
diff --git a/core/java/android/widget/TimePickerDelegate.java b/core/java/android/widget/TimePickerDelegate.java
index 182d370..c9a9894 100644
--- a/core/java/android/widget/TimePickerDelegate.java
+++ b/core/java/android/widget/TimePickerDelegate.java
@@ -27,6 +27,7 @@
 import android.os.Parcelable;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
+import android.text.format.DateUtils;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -44,6 +45,7 @@
 import java.text.DateFormatSymbols;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Locale;
 
 /**
  * A view for selecting the time of day, in either 24 hour or AM/PM mode.
@@ -120,6 +122,8 @@
     private String mMinutePickerDescription;
     private String mSelectMinutes;
 
+    private Calendar mTempCalendar;
+
     public TimePickerDelegate(TimePicker delegator, Context context, AttributeSet attrs,
                               int defStyleAttr, int defStyleRes) {
         super(delegator, context);
@@ -506,23 +510,40 @@
     }
 
     @Override
+    public void setCurrentLocale(Locale locale) {
+        super.setCurrentLocale(locale);
+        mTempCalendar = Calendar.getInstance(locale);
+    }
+
+    @Override
     public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
-        return mRadialTimePickerView.dispatchPopulateAccessibilityEvent(event);
+        onPopulateAccessibilityEvent(event);
+        return true;
     }
 
     @Override
     public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
-        mRadialTimePickerView.onPopulateAccessibilityEvent(event);
+        int flags = DateUtils.FORMAT_SHOW_TIME;
+        if (mIs24HourView) {
+            flags |= DateUtils.FORMAT_24HOUR;
+        } else {
+            flags |= DateUtils.FORMAT_12HOUR;
+        }
+        mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour());
+        mTempCalendar.set(Calendar.MINUTE, getCurrentMinute());
+        String selectedDate = DateUtils.formatDateTime(mContext,
+                mTempCalendar.getTimeInMillis(), flags);
+        event.getText().add(selectedDate);
     }
 
     @Override
     public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
-        mRadialTimePickerView.onInitializeAccessibilityEvent(event);
+        event.setClassName(TimePicker.class.getName());
     }
 
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
-        mRadialTimePickerView.onInitializeAccessibilityNodeInfo(info);
+        info.setClassName(TimePicker.class.getName());
     }
 
     /**
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 70ba4e3..7425445 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -87,7 +87,7 @@
     private static final int MAGIC = 0xBA757475; // 'BATSTATS'
 
     // Current on-disk Parcel version
-    private static final int VERSION = 70 + (USE_OLD_HISTORY ? 1000 : 0);
+    private static final int VERSION = 71 + (USE_OLD_HISTORY ? 1000 : 0);
 
     // Maximum number of items we will record in the history.
     private static final int MAX_HISTORY_ITEMS = 2000;
@@ -209,6 +209,8 @@
 
     int mStartCount;
 
+    long mStartClockTime;
+
     long mBatteryUptime;
     long mBatteryLastUptime;
     long mBatteryRealtime;
@@ -2842,6 +2844,10 @@
         }
     }
 
+    @Override public long getStartClockTime() {
+        return mStartClockTime;
+    }
+
     @Override public boolean getIsOnBattery() {
         return mOnBattery;
     }
@@ -4959,6 +4965,7 @@
     }
 
     void initTimes() {
+        mStartClockTime = System.currentTimeMillis();
         mBatteryRealtime = mTrackBatteryPastUptime = 0;
         mBatteryUptime = mTrackBatteryPastRealtime = 0;
         mUptimeStart = mTrackBatteryUptimeStart = SystemClock.uptimeMillis() * 1000;
@@ -5832,6 +5839,7 @@
         mBatteryRealtime = in.readLong();
         mUptime = in.readLong();
         mRealtime = in.readLong();
+        mStartClockTime = in.readLong();
         mDischargeUnplugLevel = in.readInt();
         mDischargeCurrentLevel = in.readInt();
         mLowDischargeAmountSinceCharge = in.readInt();
@@ -6040,9 +6048,7 @@
      * @param out the Parcel to be written to.
      */
     public void writeSummaryToParcel(Parcel out) {
-        // Need to update with current kernel wake lock counts.
-        updateKernelWakelocksLocked();
-        updateNetworkActivityLocked();
+        pullPendingStateUpdatesLocked();
 
         final long NOW_SYS = SystemClock.uptimeMillis() * 1000;
         final long NOWREAL_SYS = SystemClock.elapsedRealtime() * 1000;
@@ -6058,6 +6064,7 @@
         out.writeLong(computeBatteryRealtime(NOWREAL_SYS, STATS_SINCE_CHARGED));
         out.writeLong(computeUptime(NOW_SYS, STATS_SINCE_CHARGED));
         out.writeLong(computeRealtime(NOWREAL_SYS, STATS_SINCE_CHARGED));
+        out.writeLong(mStartClockTime);
         out.writeInt(mDischargeUnplugLevel);
         out.writeInt(mDischargeCurrentLevel);
         out.writeInt(getLowDischargeAmountSinceCharge());
@@ -6293,6 +6300,7 @@
         mBatteryLastUptime = 0;
         mBatteryRealtime = in.readLong();
         mBatteryLastRealtime = 0;
+        mStartClockTime = in.readLong();
         mScreenOn = false;
         mScreenOnTimer = new StopwatchTimer(null, -1, null, mUnpluggables, in);
         for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
@@ -6408,6 +6416,7 @@
         out.writeInt(mStartCount);
         out.writeLong(mBatteryUptime);
         out.writeLong(mBatteryRealtime);
+        out.writeLong(mStartClockTime);
         mScreenOnTimer.writeToParcel(out, batteryRealtime);
         for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
             mScreenBrightnessTimer[i].writeToParcel(out, batteryRealtime);
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index d72b054..f8d96e3 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -58,7 +58,6 @@
 	android_view_GLRenderer.cpp \
 	android_view_GLES20Canvas.cpp \
 	android_view_ThreadedRenderer.cpp \
-	android_view_RemoteGLRenderer.cpp \
 	android_view_MotionEvent.cpp \
 	android_view_PointerIcon.cpp \
 	android_view_VelocityTracker.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 074d7ac..7ed6641 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -124,7 +124,6 @@
 extern int register_android_view_GLES20Canvas(JNIEnv* env);
 extern int register_android_view_GLRenderer(JNIEnv* env);
 extern int register_android_view_ThreadedRenderer(JNIEnv* env);
-extern int register_android_view_RemoteGLRenderer(JNIEnv* env);
 extern int register_android_view_Surface(JNIEnv* env);
 extern int register_android_view_SurfaceControl(JNIEnv* env);
 extern int register_android_view_SurfaceSession(JNIEnv* env);
@@ -1129,7 +1128,6 @@
     REG_JNI(register_android_view_GLES20Canvas),
     REG_JNI(register_android_view_GLRenderer),
     REG_JNI(register_android_view_ThreadedRenderer),
-    REG_JNI(register_android_view_RemoteGLRenderer),
     REG_JNI(register_android_view_Surface),
     REG_JNI(register_android_view_SurfaceControl),
     REG_JNI(register_android_view_SurfaceSession),
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 2125763..24160ab 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -289,8 +289,9 @@
 }
 
 static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors,
-                              int offset, int stride, int width, int height,
-                              SkBitmap::Config config, jboolean isMutable) {
+                              jint offset, jint stride, jint width, jint height,
+                              jint configHandle, jboolean isMutable) {
+    SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle);
     if (NULL != jColors) {
         size_t n = env->GetArrayLength(jColors);
         if (n < SkAbs32(stride) * (size_t)height) {
@@ -321,8 +322,10 @@
             getPremulBitmapCreateFlags(isMutable), NULL, NULL);
 }
 
-static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src,
-                           SkBitmap::Config dstConfig, jboolean isMutable) {
+static jobject Bitmap_copy(JNIEnv* env, jobject, jlong srcHandle,
+                           jint dstConfigHandle, jboolean isMutable) {
+    const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle);
+    SkBitmap::Config dstConfig = static_cast<SkBitmap::Config>(dstConfigHandle);
     SkBitmap            result;
     JavaPixelAllocator  allocator(env);
 
@@ -333,7 +336,8 @@
             getPremulBitmapCreateFlags(isMutable), NULL, NULL);
 }
 
-static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static void Bitmap_destructor(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
 #ifdef USE_OPENGL_RENDERER
     if (android::uirenderer::Caches::hasInstance()) {
         android::uirenderer::Caches::getInstance().resourceCache.destructor(bitmap);
@@ -343,24 +347,28 @@
     delete bitmap;
 }
 
-static jboolean Bitmap_recycle(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static jboolean Bitmap_recycle(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
 #ifdef USE_OPENGL_RENDERER
     if (android::uirenderer::Caches::hasInstance()) {
-        return android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap);
+        bool result;
+        result = android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap);
+        return result ? JNI_TRUE : JNI_FALSE;
     }
 #endif // USE_OPENGL_RENDERER
     bitmap->setPixels(NULL, NULL);
-    return true;
+    return JNI_TRUE;
 }
 
-static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jint bitmapInt,
-        int width, int height, SkBitmap::Config config, int allocSize) {
+static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle,
+        jint width, jint height, jint configHandle, jint allocSize) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle);    
     if (width * height * SkBitmap::ComputeBytesPerPixel(config) > allocSize) {
         // done in native as there's no way to get BytesPerPixel in Java
         doThrowIAE(env, "Bitmap not large enough to support new configuration");
         return;
     }
-    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapInt);
     SkPixelRef* ref = bitmap->pixelRef();
     SkSafeRef(ref);
     bitmap->setConfig(config, width, height);
@@ -380,9 +388,10 @@
     kWEBP_JavaEncodeFormat = 2
 };
 
-static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
-                            int format, int quality,
-                            jobject jstream, jbyteArray jstorage) {
+static jboolean Bitmap_compress(JNIEnv* env, jobject clazz, jlong bitmapHandle,
+                                jint format, jint quality,
+                                jobject jstream, jbyteArray jstorage) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkImageEncoder::Type fm;
 
     switch (format) {
@@ -396,7 +405,7 @@
         fm = SkImageEncoder::kWEBP_Type;
         break;
     default:
-        return false;
+        return JNI_FALSE;
     }
 
     bool success = false;
@@ -404,12 +413,12 @@
         SkAutoLockPixels alp(*bitmap);
 
         if (NULL == bitmap->getPixels()) {
-            return false;
+            return JNI_FALSE;
         }
 
         SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
         if (NULL == strm) {
-            return false;
+            return JNI_FALSE;
         }
 
         SkImageEncoder* encoder = SkImageEncoder::Create(fm);
@@ -419,31 +428,37 @@
         }
         delete strm;
     }
-    return success;
+    return success ? JNI_TRUE : JNI_FALSE;
 }
 
-static void Bitmap_erase(JNIEnv* env, jobject, SkBitmap* bitmap, jint color) {
+static void Bitmap_erase(JNIEnv* env, jobject, jlong bitmapHandle, jint color) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     bitmap->eraseColor(color);
 }
 
-static int Bitmap_rowBytes(JNIEnv* env, jobject, SkBitmap* bitmap) {
-    return bitmap->rowBytes();
+static jint Bitmap_rowBytes(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    return static_cast<jint>(bitmap->rowBytes());
 }
 
-static int Bitmap_config(JNIEnv* env, jobject, SkBitmap* bitmap) {
-    return bitmap->config();
+static jint Bitmap_config(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    return static_cast<jint>(bitmap->config());
 }
 
-static int Bitmap_getGenerationId(JNIEnv* env, jobject, SkBitmap* bitmap) {
-    return bitmap->getGenerationID();
+static jint Bitmap_getGenerationId(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    return static_cast<jint>(bitmap->getGenerationID());
 }
 
-static jboolean Bitmap_hasAlpha(JNIEnv* env, jobject, SkBitmap* bitmap) {
-    return !bitmap->isOpaque();
+static jboolean Bitmap_hasAlpha(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    return !bitmap->isOpaque() ? JNI_TRUE : JNI_FALSE;
 }
 
-static void Bitmap_setAlphaAndPremultiplied(JNIEnv* env, jobject, SkBitmap* bitmap,
+static void Bitmap_setAlphaAndPremultiplied(JNIEnv* env, jobject, jlong bitmapHandle,
                                             jboolean hasAlpha, jboolean isPremul) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     if (!hasAlpha) {
         bitmap->setAlphaType(kOpaque_SkAlphaType);
     } else if (isPremul) {
@@ -451,14 +466,17 @@
     } else {
         bitmap->setAlphaType(kUnpremul_SkAlphaType);
     }
+    bitmap->setIsOpaque(!hasAlpha);
 }
 
-static jboolean Bitmap_hasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap) {
-    return bitmap->hasHardwareMipMap();
+static jboolean Bitmap_hasMipMap(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    return bitmap->hasHardwareMipMap() ? JNI_TRUE : JNI_FALSE;
 }
 
-static void Bitmap_setHasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap,
+static void Bitmap_setHasMipMap(JNIEnv* env, jobject, jlong bitmapHandle,
                                 jboolean hasMipMap) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     bitmap->setHasHardwareMipMap(hasMipMap);
 }
 
@@ -532,12 +550,13 @@
 }
 
 static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
-                                     const SkBitmap* bitmap,
+                                     jlong bitmapHandle,
                                      jboolean isMutable, jint density,
                                      jobject parcel) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     if (parcel == NULL) {
         SkDebugf("------- writeToParcel null parcel\n");
-        return false;
+        return JNI_FALSE;
     }
 
     android::Parcel* p = android::parcelForJavaObject(env, parcel);
@@ -568,7 +587,7 @@
     android::status_t status = p->writeBlob(size, &blob);
     if (status) {
         doThrowRE(env, "Could not write bitmap to parcel blob.");
-        return false;
+        return JNI_FALSE;
     }
 
     bitmap->lockPixels();
@@ -581,12 +600,14 @@
     bitmap->unlockPixels();
 
     blob.release();
-    return true;
+    return JNI_TRUE;
 }
 
 static jobject Bitmap_extractAlpha(JNIEnv* env, jobject clazz,
-                                   const SkBitmap* src, const SkPaint* paint,
+                                   jlong srcHandle, jlong paintHandle,
                                    jintArray offsetXY) {
+    const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle);
+    const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
     SkIPoint  offset;
     SkBitmap* dst = new SkBitmap;
     JavaPixelAllocator allocator(env);
@@ -612,8 +633,9 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static int Bitmap_getPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
-        int x, int y, bool isPremultiplied) {
+static jint Bitmap_getPixel(JNIEnv* env, jobject, jlong bitmapHandle,
+        jint x, jint y, jboolean isPremultiplied) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkAutoLockPixels alp(*bitmap);
 
     ToColorProc proc = ChooseToColorProc(*bitmap, isPremultiplied);
@@ -627,12 +649,13 @@
 
     SkColor dst[1];
     proc(dst, src, 1, bitmap->getColorTable());
-    return dst[0];
+    return static_cast<jint>(dst[0]);
 }
 
-static void Bitmap_getPixels(JNIEnv* env, jobject, const SkBitmap* bitmap,
-        jintArray pixelArray, int offset, int stride,
-        int x, int y, int width, int height, bool isPremultiplied) {
+static void Bitmap_getPixels(JNIEnv* env, jobject, jlong bitmapHandle,
+        jintArray pixelArray, jint offset, jint stride,
+        jint x, jint y, jint width, jint height, jboolean isPremultiplied) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkAutoLockPixels alp(*bitmap);
 
     ToColorProc proc = ChooseToColorProc(*bitmap, isPremultiplied);
@@ -657,8 +680,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static void Bitmap_setPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
-        int x, int y, SkColor color, bool isPremultiplied) {
+static void Bitmap_setPixel(JNIEnv* env, jobject, jlong bitmapHandle,
+        jint x, jint y, jint colorHandle, jboolean isPremultiplied) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+    SkColor color = static_cast<SkColor>(colorHandle);
     SkAutoLockPixels alp(*bitmap);
     if (NULL == bitmap->getPixels()) {
         return;
@@ -673,15 +698,17 @@
     bitmap->notifyPixelsChanged();
 }
 
-static void Bitmap_setPixels(JNIEnv* env, jobject, const SkBitmap* bitmap,
-        jintArray pixelArray, int offset, int stride,
-        int x, int y, int width, int height, bool isPremultiplied) {
+static void Bitmap_setPixels(JNIEnv* env, jobject, jlong bitmapHandle,
+        jintArray pixelArray, jint offset, jint stride,
+        jint x, jint y, jint width, jint height, jboolean isPremultiplied) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     GraphicsJNI::SetPixels(env, pixelArray, offset, stride,
             x, y, width, height, *bitmap, isPremultiplied);
 }
 
 static void Bitmap_copyPixelsToBuffer(JNIEnv* env, jobject,
-                                      const SkBitmap* bitmap, jobject jbuffer) {
+                                      jlong bitmapHandle, jobject jbuffer) {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkAutoLockPixels alp(*bitmap);
     const void* src = bitmap->getPixels();
 
@@ -694,7 +721,8 @@
 }
 
 static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject,
-                                    const SkBitmap* bitmap, jobject jbuffer) {
+                                        jlong bitmapHandle, jobject jbuffer) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkAutoLockPixels alp(*bitmap);
     void* dst = bitmap->getPixels();
 
@@ -706,12 +734,14 @@
     }
 }
 
-static bool Bitmap_sameAs(JNIEnv* env, jobject, const SkBitmap* bm0,
-                             const SkBitmap* bm1) {
+static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle,
+                              jlong bm1Handle) {
+    const SkBitmap* bm0 = reinterpret_cast<SkBitmap*>(bm0Handle);
+    const SkBitmap* bm1 = reinterpret_cast<SkBitmap*>(bm1Handle);
     if (bm0->width() != bm1->width() ||
         bm0->height() != bm1->height() ||
         bm0->config() != bm1->config()) {
-        return false;
+        return JNI_FALSE;
     }
 
     SkAutoLockPixels alp0(*bm0);
@@ -719,24 +749,24 @@
 
     // if we can't load the pixels, return false
     if (NULL == bm0->getPixels() || NULL == bm1->getPixels()) {
-        return false;
+        return JNI_FALSE;
     }
 
     if (bm0->config() == SkBitmap::kIndex8_Config) {
         SkColorTable* ct0 = bm0->getColorTable();
         SkColorTable* ct1 = bm1->getColorTable();
         if (NULL == ct0 || NULL == ct1) {
-            return false;
+            return JNI_FALSE;
         }
         if (ct0->count() != ct1->count()) {
-            return false;
+            return JNI_FALSE;
         }
 
         SkAutoLockColors alc0(ct0);
         SkAutoLockColors alc1(ct1);
         const size_t size = ct0->count() * sizeof(SkPMColor);
         if (memcmp(alc0.colors(), alc1.colors(), size) != 0) {
-            return false;
+            return JNI_FALSE;
         }
     }
 
@@ -747,13 +777,14 @@
     const size_t size = bm0->width() * bm0->bytesPerPixel();
     for (int y = 0; y < h; y++) {
         if (memcmp(bm0->getAddr(0, y), bm1->getAddr(0, y), size) != 0) {
-            return false;
+            return JNI_FALSE;
         }
     }
-    return true;
+    return JNI_TRUE;
 }
 
-static void Bitmap_prepareToDraw(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static void Bitmap_prepareToDraw(JNIEnv* env, jobject, jlong bitmapHandle) {
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     bitmap->lockPixels();
     bitmap->unlockPixels();
 }
@@ -765,38 +796,38 @@
 static JNINativeMethod gBitmapMethods[] = {
     {   "nativeCreate",             "([IIIIIIZ)Landroid/graphics/Bitmap;",
         (void*)Bitmap_creator },
-    {   "nativeCopy",               "(IIZ)Landroid/graphics/Bitmap;",
+    {   "nativeCopy",               "(JIZ)Landroid/graphics/Bitmap;",
         (void*)Bitmap_copy },
-    {   "nativeDestructor",         "(I)V", (void*)Bitmap_destructor },
-    {   "nativeRecycle",            "(I)Z", (void*)Bitmap_recycle },
-    {   "nativeReconfigure",        "(IIIII)V", (void*)Bitmap_reconfigure },
-    {   "nativeCompress",           "(IIILjava/io/OutputStream;[B)Z",
+    {   "nativeDestructor",         "(J)V", (void*)Bitmap_destructor },
+    {   "nativeRecycle",            "(J)Z", (void*)Bitmap_recycle },
+    {   "nativeReconfigure",        "(JIIII)V", (void*)Bitmap_reconfigure },
+    {   "nativeCompress",           "(JIILjava/io/OutputStream;[B)Z",
         (void*)Bitmap_compress },
-    {   "nativeErase",              "(II)V", (void*)Bitmap_erase },
-    {   "nativeRowBytes",           "(I)I", (void*)Bitmap_rowBytes },
-    {   "nativeConfig",             "(I)I", (void*)Bitmap_config },
-    {   "nativeHasAlpha",           "(I)Z", (void*)Bitmap_hasAlpha },
-    {   "nativeSetAlphaAndPremultiplied", "(IZZ)V", (void*)Bitmap_setAlphaAndPremultiplied},
-    {   "nativeHasMipMap",          "(I)Z", (void*)Bitmap_hasMipMap },
-    {   "nativeSetHasMipMap",       "(IZ)V", (void*)Bitmap_setHasMipMap },
+    {   "nativeErase",              "(JI)V", (void*)Bitmap_erase },
+    {   "nativeRowBytes",           "(J)I", (void*)Bitmap_rowBytes },
+    {   "nativeConfig",             "(J)I", (void*)Bitmap_config },
+    {   "nativeHasAlpha",           "(J)Z", (void*)Bitmap_hasAlpha },
+    {   "nativeSetAlphaAndPremultiplied", "(JZZ)V", (void*)Bitmap_setAlphaAndPremultiplied},
+    {   "nativeHasMipMap",          "(J)Z", (void*)Bitmap_hasMipMap },
+    {   "nativeSetHasMipMap",       "(JZ)V", (void*)Bitmap_setHasMipMap },
     {   "nativeCreateFromParcel",
         "(Landroid/os/Parcel;)Landroid/graphics/Bitmap;",
         (void*)Bitmap_createFromParcel },
-    {   "nativeWriteToParcel",      "(IZILandroid/os/Parcel;)Z",
+    {   "nativeWriteToParcel",      "(JZILandroid/os/Parcel;)Z",
         (void*)Bitmap_writeToParcel },
-    {   "nativeExtractAlpha",       "(II[I)Landroid/graphics/Bitmap;",
+    {   "nativeExtractAlpha",       "(JJ[I)Landroid/graphics/Bitmap;",
         (void*)Bitmap_extractAlpha },
-    {   "nativeGenerationId",       "(I)I", (void*)Bitmap_getGenerationId },
-    {   "nativeGetPixel",           "(IIIZ)I", (void*)Bitmap_getPixel },
-    {   "nativeGetPixels",          "(I[IIIIIIIZ)V", (void*)Bitmap_getPixels },
-    {   "nativeSetPixel",           "(IIIIZ)V", (void*)Bitmap_setPixel },
-    {   "nativeSetPixels",          "(I[IIIIIIIZ)V", (void*)Bitmap_setPixels },
-    {   "nativeCopyPixelsToBuffer", "(ILjava/nio/Buffer;)V",
+    {   "nativeGenerationId",       "(J)I", (void*)Bitmap_getGenerationId },
+    {   "nativeGetPixel",           "(JIIZ)I", (void*)Bitmap_getPixel },
+    {   "nativeGetPixels",          "(J[IIIIIIIZ)V", (void*)Bitmap_getPixels },
+    {   "nativeSetPixel",           "(JIIIZ)V", (void*)Bitmap_setPixel },
+    {   "nativeSetPixels",          "(J[IIIIIIIZ)V", (void*)Bitmap_setPixels },
+    {   "nativeCopyPixelsToBuffer", "(JLjava/nio/Buffer;)V",
                                             (void*)Bitmap_copyPixelsToBuffer },
-    {   "nativeCopyPixelsFromBuffer", "(ILjava/nio/Buffer;)V",
+    {   "nativeCopyPixelsFromBuffer", "(JLjava/nio/Buffer;)V",
                                             (void*)Bitmap_copyPixelsFromBuffer },
-    {   "nativeSameAs",             "(II)Z", (void*)Bitmap_sameAs },
-    {   "nativePrepareToDraw",      "(I)V", (void*)Bitmap_prepareToDraw },
+    {   "nativeSameAs",             "(JJ)Z", (void*)Bitmap_sameAs },
+    {   "nativePrepareToDraw",      "(J)V", (void*)Bitmap_prepareToDraw },
 };
 
 #define kClassPathName  "android/graphics/Bitmap"
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index d042ce9..3e1f26a 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -273,7 +273,7 @@
     SkBitmap* outputBitmap = NULL;
     unsigned int existingBufferSize = 0;
     if (javaBitmap != NULL) {
-        outputBitmap = (SkBitmap*) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
+        outputBitmap = (SkBitmap*) env->GetLongField(javaBitmap, gBitmap_nativeBitmapFieldID);
         if (outputBitmap->isImmutable()) {
             ALOGW("Unable to reuse an immutable bitmap as an image decoder target.");
             javaBitmap = NULL;
@@ -532,7 +532,7 @@
     return doDecode(env, stream, padding, bitmapFactoryOptions, weOwnTheFD);
 }
 
-static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset,
+static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jlong native_asset,
         jobject padding, jobject options) {
 
     SkStreamRewindable* stream;
@@ -557,7 +557,7 @@
 }
 
 static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
-        int offset, int length, jobject options) {
+        jint offset, jint length, jobject options) {
 
     /*  If optionsShareable() we could decide to just wrap the java array and
         share it, but that means adding a globalref to the java array object
@@ -594,7 +594,7 @@
     },
 
     {   "nativeDecodeAsset",
-        "(ILandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
+        "(JLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
         (void*)nativeDecodeAsset
     },
 
@@ -647,7 +647,7 @@
 
     jclass bitmap_class = env->FindClass("android/graphics/Bitmap");
     SkASSERT(bitmap_class);
-    gBitmap_nativeBitmapFieldID = getFieldIDCheck(env, bitmap_class, "mNativeBitmap", "I");
+    gBitmap_nativeBitmapFieldID = getFieldIDCheck(env, bitmap_class, "mNativeBitmap", "J");
     gBitmap_layoutBoundsFieldID = getFieldIDCheck(env, bitmap_class, "mLayoutBounds", "[I");
     int ret = AndroidRuntime::registerNativeMethods(env,
                                     "android/graphics/BitmapFactory$Options",
diff --git a/core/jni/android/graphics/Camera.cpp b/core/jni/android/graphics/Camera.cpp
index 5176d9a..54d448e 100644
--- a/core/jni/android/graphics/Camera.cpp
+++ b/core/jni/android/graphics/Camera.cpp
@@ -7,84 +7,102 @@
 
 static void Camera_constructor(JNIEnv* env, jobject obj) {
     Sk3DView* view = new Sk3DView;
-    env->SetIntField(obj, gNativeInstanceFieldID, (int)view);
+    env->SetLongField(obj, gNativeInstanceFieldID, reinterpret_cast<jlong>(view));
 }
 
 static void Camera_destructor(JNIEnv* env, jobject obj) {
-    delete (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* view = reinterpret_cast<Sk3DView*>(viewHandle);
+    delete view;
 }
 
 static void Camera_save(JNIEnv* env, jobject obj) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->save();
 }
 
 static void Camera_restore(JNIEnv* env, jobject obj) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->restore();
 }
 
 static void Camera_translate(JNIEnv* env, jobject obj,
-                             float dx, float dy, float dz) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+                             jfloat dx, jfloat dy, jfloat dz) {
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->translate(SkFloatToScalar(dx), SkFloatToScalar(dy), SkFloatToScalar(dz));
 }
 
-static void Camera_rotateX(JNIEnv* env, jobject obj, float degrees) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateX(JNIEnv* env, jobject obj, jfloat degrees) {
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->rotateX(SkFloatToScalar(degrees));
 }
 
-static void Camera_rotateY(JNIEnv* env, jobject obj, float degrees) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateY(JNIEnv* env, jobject obj, jfloat degrees) {
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->rotateY(SkFloatToScalar(degrees));
 }
 
-static void Camera_rotateZ(JNIEnv* env, jobject obj, float degrees) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateZ(JNIEnv* env, jobject obj, jfloat degrees) {
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->rotateZ(SkFloatToScalar(degrees));
 }
 
 static void Camera_rotate(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->rotateX(SkFloatToScalar(x));
     v->rotateY(SkFloatToScalar(y));
     v->rotateZ(SkFloatToScalar(z));
 }
 
 static void Camera_setLocation(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->setCameraLocation(SkFloatToScalar(x), SkFloatToScalar(y), SkFloatToScalar(z));
 }
 
 static jfloat Camera_getLocationX(JNIEnv* env, jobject obj) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     return SkScalarToFloat(v->getCameraLocationX());
 }
 
 static jfloat Camera_getLocationY(JNIEnv* env, jobject obj) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     return SkScalarToFloat(v->getCameraLocationY());
 }
 
 static jfloat Camera_getLocationZ(JNIEnv* env, jobject obj) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     return SkScalarToFloat(v->getCameraLocationZ());
 }
 
-static void Camera_getMatrix(JNIEnv* env, jobject obj, int native_matrix) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
-    v->getMatrix((SkMatrix*)native_matrix);
+static void Camera_getMatrix(JNIEnv* env, jobject obj, jlong matrixHandle) {
+    SkMatrix* native_matrix =  reinterpret_cast<SkMatrix*>(matrixHandle);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
+    v->getMatrix(native_matrix);
 }
 
-static void Camera_applyToCanvas(JNIEnv* env, jobject obj, int native_canvas) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_applyToCanvas(JNIEnv* env, jobject obj, jlong canvasHandle) {
+    SkCanvas* native_canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     v->applyToCanvas((SkCanvas*)native_canvas);
 }
 
-static float Camera_dotWithNormal(JNIEnv* env, jobject obj,
-                                  float x, float y, float z) {
-    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static jfloat Camera_dotWithNormal(JNIEnv* env, jobject obj,
+                                  jfloat x, jfloat y, jfloat z) {
+    jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+    Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
     SkScalar dot = v->dotWithNormal(SkFloatToScalar(x), SkFloatToScalar(y),
                                     SkFloatToScalar(z));
     return SkScalarToFloat(dot);
@@ -111,8 +129,8 @@
     { "getLocationX",        "()F",    (void*)Camera_getLocationX  },
     { "getLocationY",        "()F",    (void*)Camera_getLocationY  },
     { "getLocationZ",        "()F",    (void*)Camera_getLocationZ  },
-    { "nativeGetMatrix",     "(I)V",   (void*)Camera_getMatrix     },
-    { "nativeApplyToCanvas", "(I)V",   (void*)Camera_applyToCanvas },
+    { "nativeGetMatrix",     "(J)V",   (void*)Camera_getMatrix     },
+    { "nativeApplyToCanvas", "(J)V",   (void*)Camera_applyToCanvas },
     { "dotWithNormal",       "(FFF)F", (void*)Camera_dotWithNormal }
 };
 
@@ -121,7 +139,7 @@
     if (clazz == 0) {
         return -1;
     }
-    gNativeInstanceFieldID = env->GetFieldID(clazz, "native_instance", "I");
+    gNativeInstanceFieldID = env->GetFieldID(clazz, "native_instance", "J");
     if (gNativeInstanceFieldID == 0) {
         return -1;
     }
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 9a00d538..2cb2812 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -44,13 +44,13 @@
 static uint32_t get_thread_msec() {
 #if defined(HAVE_POSIX_CLOCKS)
     struct timespec tm;
-    
+
     clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm);
-    
+
     return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000;
 #else
     struct timeval tv;
-    
+
     gettimeofday(&tv, NULL);
     return tv.tv_sec * 1000LL + tv.tv_usec / 1000;
 #endif
@@ -76,23 +76,27 @@
 class SkCanvasGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkCanvas* canvas) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong canvasHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         canvas->unref();
     }
 
-    static SkCanvas* initRaster(JNIEnv* env, jobject, SkBitmap* bitmap) {
+    static jlong initRaster(JNIEnv* env, jobject, jlong bitmapHandle) {
+        SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
         if (bitmap) {
-            return new SkCanvas(*bitmap);
+            return reinterpret_cast<jlong>(new SkCanvas(*bitmap));
         } else {
             // Create an empty bitmap device to prevent callers from crashing
             // if they attempt to draw into this canvas.
             SkBitmap emptyBitmap;
-            return new SkCanvas(emptyBitmap);
+            return reinterpret_cast<jlong>(new SkCanvas(emptyBitmap));
         }
     }
-    
+
     static void copyCanvasState(JNIEnv* env, jobject clazz,
-                                SkCanvas* srcCanvas, SkCanvas* dstCanvas) {
+                                jlong srcCanvasHandle, jlong dstCanvasHandle) {
+        SkCanvas* srcCanvas = reinterpret_cast<SkCanvas*>(srcCanvasHandle);
+        SkCanvas* dstCanvas = reinterpret_cast<SkCanvas*>(dstCanvasHandle);
         if (srcCanvas && dstCanvas) {
             dstCanvas->setMatrix(srcCanvas->getTotalMatrix());
             if (NULL != srcCanvas->getDevice() && NULL != dstCanvas->getDevice()) {
@@ -116,73 +120,89 @@
     static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
         SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
-        return canvas->getDevice()->accessBitmap(false).isOpaque();
-    }
-    
-    static int getWidth(JNIEnv* env, jobject jcanvas) {
-        NPE_CHECK_RETURN_ZERO(env, jcanvas);
-        SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
-        return canvas->getDevice()->accessBitmap(false).width();
-    }
-    
-    static int getHeight(JNIEnv* env, jobject jcanvas) {
-        NPE_CHECK_RETURN_ZERO(env, jcanvas);
-        SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
-        return canvas->getDevice()->accessBitmap(false).height();
+        bool result = canvas->getDevice()->accessBitmap(false).isOpaque();
+        return result ? JNI_TRUE : JNI_FALSE;
     }
 
-    static int saveAll(JNIEnv* env, jobject jcanvas) {
+    static jint getWidth(JNIEnv* env, jobject jcanvas) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
-        return GraphicsJNI::getNativeCanvas(env, jcanvas)->save();
+        SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
+        int width = canvas->getDevice()->accessBitmap(false).width();
+        return static_cast<jint>(width);
     }
-    
-    static int save(JNIEnv* env, jobject jcanvas, SkCanvas::SaveFlags flags) {
+
+    static jint getHeight(JNIEnv* env, jobject jcanvas) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
-        return GraphicsJNI::getNativeCanvas(env, jcanvas)->save(flags);
+        SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
+        int height = canvas->getDevice()->accessBitmap(false).height();
+        return static_cast<jint>(height);
     }
-    
-    static int saveLayer(JNIEnv* env, jobject, SkCanvas* canvas, jobject bounds,
-                         SkPaint* paint, int flags) {
+
+    static jint saveAll(JNIEnv* env, jobject jcanvas) {
+        NPE_CHECK_RETURN_ZERO(env, jcanvas);
+        int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->save();
+        return static_cast<jint>(result);
+    }
+
+    static jint save(JNIEnv* env, jobject jcanvas, jint flagsHandle) {
+        SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(flagsHandle);
+        NPE_CHECK_RETURN_ZERO(env, jcanvas);
+        int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->save(flags);
+        return static_cast<jint>(result);
+    }
+
+    static jint saveLayer(JNIEnv* env, jobject, jlong canvasHandle, jobject bounds,
+                         jlong paintHandle, jint flags) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint  = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect* bounds_ = NULL;
         SkRect  storage;
         if (bounds != NULL) {
             GraphicsJNI::jrectf_to_rect(env, bounds, &storage);
             bounds_ = &storage;
         }
-        return canvas->saveLayer(bounds_, paint, (SkCanvas::SaveFlags)flags);
+        return canvas->saveLayer(bounds_, paint, static_cast<SkCanvas::SaveFlags>(flags));
     }
- 
-    static int saveLayer4F(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static jint saveLayer4F(JNIEnv* env, jobject, jlong canvasHandle,
                            jfloat l, jfloat t, jfloat r, jfloat b,
-                           SkPaint* paint, int flags) {
+                           jlong paintHandle, jint flags) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint  = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect bounds;
         bounds.set(SkFloatToScalar(l), SkFloatToScalar(t), SkFloatToScalar(r),
                    SkFloatToScalar(b));
-        return canvas->saveLayer(&bounds, paint, (SkCanvas::SaveFlags)flags);
+        int result = canvas->saveLayer(&bounds, paint,
+                                      static_cast<SkCanvas::SaveFlags>(flags));
+        return static_cast<jint>(result);
     }
- 
-    static int saveLayerAlpha(JNIEnv* env, jobject, SkCanvas* canvas,
-                              jobject bounds, int alpha, int flags) {
+
+    static jint saveLayerAlpha(JNIEnv* env, jobject, jlong canvasHandle,
+                              jobject bounds, jint alpha, jint flags) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         SkRect* bounds_ = NULL;
         SkRect  storage;
         if (bounds != NULL) {
             GraphicsJNI::jrectf_to_rect(env, bounds, &storage);
             bounds_ = &storage;
         }
-        return canvas->saveLayerAlpha(bounds_, alpha,
-                                      (SkCanvas::SaveFlags)flags);
+        int result = canvas->saveLayerAlpha(bounds_, alpha,
+                                      static_cast<SkCanvas::SaveFlags>(flags));
+        return static_cast<jint>(result);
     }
- 
-    static int saveLayerAlpha4F(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static jint saveLayerAlpha4F(JNIEnv* env, jobject, jlong canvasHandle,
                                 jfloat l, jfloat t, jfloat r, jfloat b,
-                                int alpha, int flags) {
+                                jint alpha, jint flags) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         SkRect  bounds;
         bounds.set(SkFloatToScalar(l), SkFloatToScalar(t), SkFloatToScalar(r),
                    SkFloatToScalar(b));
-        return canvas->saveLayerAlpha(&bounds, alpha,
-                                      (SkCanvas::SaveFlags)flags);
+        int result = canvas->saveLayerAlpha(&bounds, alpha,
+                                      static_cast<SkCanvas::SaveFlags>(flags));
+        return static_cast<jint>(result);
     }
- 
+
     static void restore(JNIEnv* env, jobject jcanvas) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
@@ -192,13 +212,14 @@
         }
         canvas->restore();
     }
- 
-    static int getSaveCount(JNIEnv* env, jobject jcanvas) {
+
+    static jint getSaveCount(JNIEnv* env, jobject jcanvas) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
-        return GraphicsJNI::getNativeCanvas(env, jcanvas)->getSaveCount();
+        int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->getSaveCount();
+        return static_cast<jint>(result);
     }
- 
-    static void restoreToCount(JNIEnv* env, jobject jcanvas, int restoreCount) {
+
+    static void restoreToCount(JNIEnv* env, jobject jcanvas, jint restoreCount) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
         if (restoreCount < 1) {
@@ -207,48 +228,52 @@
         }
         canvas->restoreToCount(restoreCount);
     }
- 
+
     static void translate(JNIEnv* env, jobject jcanvas, jfloat dx, jfloat dy) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         (void)GraphicsJNI::getNativeCanvas(env, jcanvas)->translate(dx_, dy_);
     }
- 
+
     static void scale__FF(JNIEnv* env, jobject jcanvas, jfloat sx, jfloat sy) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         (void)GraphicsJNI::getNativeCanvas(env, jcanvas)->scale(sx_, sy_);
     }
- 
+
     static void rotate__F(JNIEnv* env, jobject jcanvas, jfloat degrees) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkScalar degrees_ = SkFloatToScalar(degrees);
         (void)GraphicsJNI::getNativeCanvas(env, jcanvas)->rotate(degrees_);
     }
- 
+
     static void skew__FF(JNIEnv* env, jobject jcanvas, jfloat sx, jfloat sy) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         (void)GraphicsJNI::getNativeCanvas(env, jcanvas)->skew(sx_, sy_);
     }
- 
-    static void concat(JNIEnv* env, jobject, SkCanvas* canvas,
-                       const SkMatrix* matrix) {
+
+    static void concat(JNIEnv* env, jobject, jlong canvasHandle,
+                       jlong matrixHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         canvas->concat(*matrix);
     }
-    
-    static void setMatrix(JNIEnv* env, jobject, SkCanvas* canvas,
-                          const SkMatrix* matrix) {
+
+    static void setMatrix(JNIEnv* env, jobject, jlong canvasHandle,
+                          jlong matrixHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         if (NULL == matrix) {
             canvas->resetMatrix();
         } else {
             canvas->setMatrix(*matrix);
         }
     }
-    
+
     static jboolean clipRect_FFFF(JNIEnv* env, jobject jcanvas, jfloat left,
                                   jfloat top, jfloat right, jfloat bottom) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
@@ -256,122 +281,149 @@
         r.set(SkFloatToScalar(left), SkFloatToScalar(top),
               SkFloatToScalar(right), SkFloatToScalar(bottom));
         SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
-        return c->clipRect(r);
+        bool result = c->clipRect(r);
+        return result ? JNI_TRUE : JNI_FALSE;
     }
-    
+
     static jboolean clipRect_IIII(JNIEnv* env, jobject jcanvas, jint left,
                                   jint top, jint right, jint bottom) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
         SkRect  r;
         r.set(SkIntToScalar(left), SkIntToScalar(top),
               SkIntToScalar(right), SkIntToScalar(bottom));
-        return GraphicsJNI::getNativeCanvas(env, jcanvas)->clipRect(r);
+        bool result = GraphicsJNI::getNativeCanvas(env, jcanvas)->clipRect(r);
+        return result ? JNI_TRUE : JNI_FALSE;
     }
-    
+
     static jboolean clipRect_RectF(JNIEnv* env, jobject jcanvas, jobject rectf) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
         NPE_CHECK_RETURN_ZERO(env, rectf);
         SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
         SkRect tmp;
-        return c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
+        bool result = c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
+        return result ? JNI_TRUE : JNI_FALSE;
     }
-    
+
     static jboolean clipRect_Rect(JNIEnv* env, jobject jcanvas, jobject rect) {
         NPE_CHECK_RETURN_ZERO(env, jcanvas);
         NPE_CHECK_RETURN_ZERO(env, rect);
         SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
         SkRect tmp;
-        return c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
+        bool result = c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
+        return result ? JNI_TRUE : JNI_FALSE;
+
     }
-    
-    static jboolean clipRect(JNIEnv* env, jobject, SkCanvas* canvas,
-                             float left, float top, float right, float bottom,
-                             int op) {
+
+    static jboolean clipRect(JNIEnv* env, jobject, jlong canvasHandle,
+                             jfloat left, jfloat top, jfloat right, jfloat bottom,
+                             jint op) {
         SkRect rect;
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         rect.set(SkFloatToScalar(left), SkFloatToScalar(top),
                  SkFloatToScalar(right), SkFloatToScalar(bottom));
-        return canvas->clipRect(rect, (SkRegion::Op)op);
+        bool result = canvas->clipRect(rect, static_cast<SkRegion::Op>(op));
+        return result ? JNI_TRUE : JNI_FALSE;
+
     }
- 
-    static jboolean clipPath(JNIEnv* env, jobject, SkCanvas* canvas,
-                             SkPath* path, int op) {
-        return canvas->clipPath(*path, (SkRegion::Op)op);
+
+    static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle,
+                             SkPath* path, jint op) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        bool result = canvas->clipPath(*path, static_cast<SkRegion::Op>(op));
+        return result ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean clipRegion(JNIEnv* env, jobject, SkCanvas* canvas,
-                               SkRegion* deviceRgn, int op) {
-        return canvas->clipRegion(*deviceRgn, (SkRegion::Op)op);
+
+    static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle,
+                               jlong deviceRgnHandle, jint op) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
+        bool result = canvas->clipRegion(*deviceRgn, static_cast<SkRegion::Op>(op));
+        return result ? JNI_TRUE : JNI_FALSE;
     }
-    
-    static void setDrawFilter(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void setDrawFilter(JNIEnv* env, jobject, jlong canvasHandle,
                               SkDrawFilter* filter) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         canvas->setDrawFilter(filter);
     }
-    
-    static jboolean quickReject__RectF(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static jboolean quickReject__RectF(JNIEnv* env, jobject, jlong canvasHandle,
                                         jobject rect) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         SkRect rect_;
         GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
         return canvas->quickReject(rect_);
     }
 
-    static jboolean quickReject__Path(JNIEnv* env, jobject, SkCanvas* canvas,
+    static jboolean quickReject__Path(JNIEnv* env, jobject, jlong canvasHandle,
                                        SkPath* path) {
-        return canvas->quickReject(*path);
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        bool result = canvas->quickReject(*path);
+        return result ? JNI_TRUE : JNI_FALSE;
     }
 
-    static jboolean quickReject__FFFF(JNIEnv* env, jobject, SkCanvas* canvas,
+    static jboolean quickReject__FFFF(JNIEnv* env, jobject, jlong canvasHandle,
                                        jfloat left, jfloat top, jfloat right,
                                        jfloat bottom) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         SkRect r;
         r.set(SkFloatToScalar(left), SkFloatToScalar(top),
               SkFloatToScalar(right), SkFloatToScalar(bottom));
-        return canvas->quickReject(r);
+        bool result = canvas->quickReject(r);
+        return result ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static void drawRGB(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawRGB(JNIEnv* env, jobject, jlong canvasHandle,
                         jint r, jint g, jint b) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         canvas->drawARGB(0xFF, r, g, b);
     }
- 
-    static void drawARGB(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawARGB(JNIEnv* env, jobject, jlong canvasHandle,
                          jint a, jint r, jint g, jint b) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         canvas->drawARGB(a, r, g, b);
     }
- 
-    static void drawColor__I(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawColor__I(JNIEnv* env, jobject, jlong canvasHandle,
                              jint color) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         canvas->drawColor(color);
     }
- 
-    static void drawColor__II(JNIEnv* env, jobject, SkCanvas* canvas,
-                              jint color, SkPorterDuff::Mode mode) {
+
+    static void drawColor__II(JNIEnv* env, jobject, jlong canvasHandle,
+                              jint color, jint modeHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
         canvas->drawColor(color, SkPorterDuff::ToXfermodeMode(mode));
     }
- 
-    static void drawPaint(JNIEnv* env, jobject, SkCanvas* canvas,
-                          SkPaint* paint) {
+
+    static void drawPaint(JNIEnv* env, jobject, jlong canvasHandle,
+                          jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         canvas->drawPaint(*paint);
     }
-    
+
     static void doPoints(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
                          jint offset, jint count, jobject jpaint,
-                         SkCanvas::PointMode mode) {
+                         jint modeHandle) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         NPE_CHECK_RETURN_VOID(env, jptsArray);
         NPE_CHECK_RETURN_VOID(env, jpaint);
+        SkCanvas::PointMode mode = static_cast<SkCanvas::PointMode>(modeHandle);
         SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
         const SkPaint& paint = *GraphicsJNI::getNativePaint(env, jpaint);
-        
+
         AutoJavaFloatArray autoPts(env, jptsArray);
         float* floats = autoPts.ptr();
         const int length = autoPts.length();
-        
+
         if ((offset | count) < 0 || offset + count > length) {
             doThrowAIOOBE(env);
             return;
         }
-        
+
         // now convert the floats into SkPoints
         count >>= 1;    // now it is the number of points
         SkAutoSTMalloc<32, SkPoint> storage(count);
@@ -380,98 +432,118 @@
         for (int i = 0; i < count; i++) {
             pts[i].set(SkFloatToScalar(src[0]), SkFloatToScalar(src[1]));
             src += 2;
-        }        
+        }
         canvas->drawPoints(mode, count, pts, paint);
     }
-    
+
     static void drawPoints(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
                            jint offset, jint count, jobject jpaint) {
         doPoints(env, jcanvas, jptsArray, offset, count, jpaint,
                  SkCanvas::kPoints_PointMode);
     }
-    
+
     static void drawLines(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
                            jint offset, jint count, jobject jpaint) {
         doPoints(env, jcanvas, jptsArray, offset, count, jpaint,
                  SkCanvas::kLines_PointMode);
     }
-    
-    static void drawPoint(JNIEnv* env, jobject jcanvas, float x, float y,
+
+    static void drawPoint(JNIEnv* env, jobject jcanvas, jfloat x, jfloat y,
                           jobject jpaint) {
         NPE_CHECK_RETURN_VOID(env, jcanvas);
         NPE_CHECK_RETURN_VOID(env, jpaint);
         SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
         const SkPaint& paint = *GraphicsJNI::getNativePaint(env, jpaint);
-        
+
         canvas->drawPoint(SkFloatToScalar(x), SkFloatToScalar(y), paint);
     }
- 
-    static void drawLine__FFFFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawLine__FFFFPaint(JNIEnv* env, jobject, jlong canvasHandle,
                                     jfloat startX, jfloat startY, jfloat stopX,
-                                    jfloat stopY, SkPaint* paint) {
+                                    jfloat stopY, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         canvas->drawLine(SkFloatToScalar(startX), SkFloatToScalar(startY),
                          SkFloatToScalar(stopX), SkFloatToScalar(stopY),
                          *paint);
     }
- 
-    static void drawRect__RectFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
-                                     jobject rect, SkPaint* paint) {
+
+    static void drawRect__RectFPaint(JNIEnv* env, jobject, jlong canvasHandle,
+                                     jobject rect, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect rect_;
         GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
         canvas->drawRect(rect_, *paint);
     }
- 
-    static void drawRect__FFFFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawRect__FFFFPaint(JNIEnv* env, jobject, jlong canvasHandle,
                                     jfloat left, jfloat top, jfloat right,
-                                    jfloat bottom, SkPaint* paint) {
+                                    jfloat bottom, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkScalar left_ = SkFloatToScalar(left);
         SkScalar top_ = SkFloatToScalar(top);
         SkScalar right_ = SkFloatToScalar(right);
         SkScalar bottom_ = SkFloatToScalar(bottom);
         canvas->drawRectCoords(left_, top_, right_, bottom_, *paint);
     }
- 
-    static void drawOval(JNIEnv* env, jobject, SkCanvas* canvas, jobject joval,
-                         SkPaint* paint) {
+
+    static void drawOval(JNIEnv* env, jobject, jlong canvasHandle, jobject joval,
+                         jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect oval;
         GraphicsJNI::jrectf_to_rect(env, joval, &oval);
         canvas->drawOval(oval, *paint);
     }
- 
-    static void drawCircle(JNIEnv* env, jobject, SkCanvas* canvas, jfloat cx,
-                           jfloat cy, jfloat radius, SkPaint* paint) {
+
+    static void drawCircle(JNIEnv* env, jobject, jlong canvasHandle, jfloat cx,
+                           jfloat cy, jfloat radius, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         canvas->drawCircle(SkFloatToScalar(cx), SkFloatToScalar(cy),
                            SkFloatToScalar(radius), *paint);
     }
- 
-    static void drawArc(JNIEnv* env, jobject, SkCanvas* canvas, jobject joval,
+
+    static void drawArc(JNIEnv* env, jobject, jlong canvasHandle, jobject joval,
                         jfloat startAngle, jfloat sweepAngle,
-                        jboolean useCenter, SkPaint* paint) {
+                        jboolean useCenter, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect oval;
         GraphicsJNI::jrectf_to_rect(env, joval, &oval);
         canvas->drawArc(oval, SkFloatToScalar(startAngle),
                         SkFloatToScalar(sweepAngle), useCenter, *paint);
     }
- 
-    static void drawRoundRect(JNIEnv* env, jobject, SkCanvas* canvas,
+
+    static void drawRoundRect(JNIEnv* env, jobject, jlong canvasHandle,
                               jobject jrect, jfloat rx, jfloat ry,
-                              SkPaint* paint) {
+                              jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect rect;
         GraphicsJNI::jrectf_to_rect(env, jrect, &rect);
         canvas->drawRoundRect(rect, SkFloatToScalar(rx), SkFloatToScalar(ry),
                               *paint);
     }
- 
-    static void drawPath(JNIEnv* env, jobject, SkCanvas* canvas, SkPath* path,
-                         SkPaint* paint) {
+
+    static void drawPath(JNIEnv* env, jobject, jlong canvasHandle, jlong pathHandle,
+                         jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         canvas->drawPath(*path, *paint);
     }
- 
+
     static void drawBitmap__BitmapFFPaint(JNIEnv* env, jobject jcanvas,
-                                          SkCanvas* canvas, SkBitmap* bitmap,
+                                          jlong canvasHandle, jlong bitmapHandle,
                                           jfloat left, jfloat top,
-                                          SkPaint* paint, jint canvasDensity,
+                                          jlong paintHandle, jint canvasDensity,
                                           jint screenDensity, jint bitmapDensity) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkScalar left_ = SkFloatToScalar(left);
         SkScalar top_ = SkFloatToScalar(top);
 
@@ -514,7 +586,7 @@
             GraphicsJNI::jrect_to_irect(env, srcIRect, &src);
             srcPtr = &src;
         }
-        
+
         if (screenDensity != 0 && screenDensity != bitmapDensity) {
             SkPaint filteredPaint;
             if (paint) {
@@ -527,31 +599,39 @@
         }
     }
 
-    static void drawBitmapRF(JNIEnv* env, jobject, SkCanvas* canvas,
-                             SkBitmap* bitmap, jobject srcIRect,
-                             jobject dstRectF, SkPaint* paint,
+    static void drawBitmapRF(JNIEnv* env, jobject, jlong canvasHandle,
+                             jlong bitmapHandle, jobject srcIRect,
+                             jobject dstRectF, jlong paintHandle,
                              jint screenDensity, jint bitmapDensity) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect      dst;
         GraphicsJNI::jrectf_to_rect(env, dstRectF, &dst);
         doDrawBitmap(env, canvas, bitmap, srcIRect, dst, paint,
                 screenDensity, bitmapDensity);
     }
-    
-    static void drawBitmapRR(JNIEnv* env, jobject, SkCanvas* canvas,
-                             SkBitmap* bitmap, jobject srcIRect,
-                             jobject dstRect, SkPaint* paint,
+
+    static void drawBitmapRR(JNIEnv* env, jobject, jlong canvasHandle,
+                             jlong bitmapHandle, jobject srcIRect,
+                             jobject dstRect, jlong paintHandle,
                              jint screenDensity, jint bitmapDensity) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkRect      dst;
         GraphicsJNI::jrect_to_rect(env, dstRect, &dst);
         doDrawBitmap(env, canvas, bitmap, srcIRect, dst, paint,
                 screenDensity, bitmapDensity);
     }
-    
-    static void drawBitmapArray(JNIEnv* env, jobject, SkCanvas* canvas,
-                                jintArray jcolors, int offset, int stride,
-                                jfloat x, jfloat y, int width, int height,
-                                jboolean hasAlpha, SkPaint* paint)
+
+    static void drawBitmapArray(JNIEnv* env, jobject, jlong canvasHandle,
+                                jintArray jcolors, jint offset, jint stride,
+                                jfloat x, jfloat y, jint width, jint height,
+                                jboolean hasAlpha, jlong paintHandle)
     {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkBitmap    bitmap;
         bitmap.setConfig(hasAlpha ? SkBitmap::kARGB_8888_Config :
                          SkBitmap::kRGB_565_Config, width, height);
@@ -567,24 +647,31 @@
         canvas->drawBitmap(bitmap, SkFloatToScalar(x), SkFloatToScalar(y),
                            paint);
     }
-    
-    static void drawBitmapMatrix(JNIEnv* env, jobject, SkCanvas* canvas,
-                                 const SkBitmap* bitmap, const SkMatrix* matrix,
-                                 const SkPaint* paint) {
+
+    static void drawBitmapMatrix(JNIEnv* env, jobject, jlong canvasHandle,
+                                 jlong bitmapHandle, jlong matrixHandle,
+                                 jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         canvas->drawBitmapMatrix(*bitmap, *matrix, paint);
     }
-    
-    static void drawBitmapMesh(JNIEnv* env, jobject, SkCanvas* canvas,
-                          const SkBitmap* bitmap, int meshWidth, int meshHeight,
-                          jfloatArray jverts, int vertIndex, jintArray jcolors,
-                          int colorIndex, const SkPaint* paint) {
+
+    static void drawBitmapMesh(JNIEnv* env, jobject, jlong canvasHandle,
+                          jlong bitmapHandle, jint meshWidth, jint meshHeight,
+                          jfloatArray jverts, jint vertIndex, jintArray jcolors,
+                          jint colorIndex, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
 
         const int ptCount = (meshWidth + 1) * (meshHeight + 1);
         const int indexCount = meshWidth * meshHeight * 6;
 
         AutoJavaFloatArray  vertA(env, jverts, vertIndex + (ptCount << 1));
         AutoJavaIntArray    colorA(env, jcolors, colorIndex + ptCount);
-        
+
         /*  Our temp storage holds 2 or 3 arrays.
             texture points [ptCount * sizeof(SkPoint)]
             optionally vertex points [ptCount * sizeof(SkPoint)] if we need a
@@ -623,7 +710,7 @@
             const SkScalar h = SkIntToScalar(bitmap->height());
             const SkScalar dx = w / meshWidth;
             const SkScalar dy = h / meshHeight;
-            
+
             SkPoint* texsPtr = texs;
             SkScalar y = 0;
             for (int i = 0; i <= meshHeight; i++) {
@@ -642,7 +729,7 @@
             }
             SkASSERT(texsPtr - texs == ptCount);
         }
-        
+
         // cons up indices
         {
             uint16_t* indexPtr = indices;
@@ -690,13 +777,16 @@
                              indexCount, tmpPaint);
     }
 
-    static void drawVertices(JNIEnv* env, jobject, SkCanvas* canvas,
-                             SkCanvas::VertexMode mode, int vertexCount,
-                             jfloatArray jverts, int vertIndex,
-                             jfloatArray jtexs, int texIndex,
-                             jintArray jcolors, int colorIndex,
-                             jshortArray jindices, int indexIndex,
-                             int indexCount, const SkPaint* paint) {
+    static void drawVertices(JNIEnv* env, jobject, jlong canvasHandle,
+                             jint modeHandle, jint vertexCount,
+                             jfloatArray jverts, jint vertIndex,
+                             jfloatArray jtexs, jint texIndex,
+                             jintArray jcolors, jint colorIndex,
+                             jshortArray jindices, jint indexIndex,
+                             jint indexCount, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkCanvas::VertexMode mode = static_cast<SkCanvas::VertexMode>(modeHandle);
+        const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
 
         AutoJavaFloatArray  vertA(env, jverts, vertIndex + vertexCount);
         AutoJavaFloatArray  texA(env, jtexs, texIndex + vertexCount);
@@ -718,7 +808,7 @@
             count += ptCount;   // += for texs
         }
         SkAutoMalloc storage(count * sizeof(SkPoint));
-        verts = (SkPoint*)storage.get();        
+        verts = (SkPoint*)storage.get();
         const float* src = vertA.ptr() + vertIndex;
         for (int i = 0; i < ptCount; i++) {
             verts[i].set(SkFloatToFixed(src[0]), SkFloatToFixed(src[1]));
@@ -748,20 +838,26 @@
     }
 
 
-    static void drawText___CIIFFIPaintTypeface(JNIEnv* env, jobject, SkCanvas* canvas,
-                                      jcharArray text, int index, int count,
-                                      jfloat x, jfloat y, int flags, SkPaint* paint,
-                                      TypefaceImpl *typeface) {
+    static void drawText___CIIFFIPaintTypeface(JNIEnv* env, jobject, jlong canvasHandle,
+                                               jcharArray text, jint index, jint count,
+                                               jfloat x, jfloat y, jint flags,
+                                               jlong paintHandle, jlong typefaceHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
         jchar* textArray = env->GetCharArrayElements(text, NULL);
         drawTextWithGlyphs(canvas, textArray + index, 0, count, x, y, flags, paint, typeface);
         env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
     }
 
     static void drawText__StringIIFFIPaintTypeface(JNIEnv* env, jobject,
-                                          SkCanvas* canvas, jstring text,
-                                          int start, int end,
-                                          jfloat x, jfloat y, int flags, SkPaint* paint,
-                                          TypefaceImpl *typeface) {
+                                                   jlong canvasHandle, jstring text,
+                                                   jint start, jint end,
+                                                   jfloat x, jfloat y, jint flags,
+                                                   jlong paintHandle, jlong typefaceHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         drawTextWithGlyphs(canvas, textArray, start, end, x, y, flags, paint, typeface);
         env->ReleaseStringChars(text, textArray);
@@ -898,10 +994,12 @@
     }
 
     static void drawTextRun___CIIIIFFIPaintTypeface(
-        JNIEnv* env, jobject, SkCanvas* canvas, jcharArray text, int index,
-        int count, int contextIndex, int contextCount,
-        jfloat x, jfloat y, int dirFlags, SkPaint* paint,
-        TypefaceImpl* typeface) {
+        JNIEnv* env, jobject, jlong canvasHandle, jcharArray text, jint index,
+        jint count, jint contextIndex, jint contextCount,
+        jfloat x, jfloat y, jint dirFlags, jlong paintHandle, jlong typefaceHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
 
         jchar* chars = env->GetCharArrayElements(text, NULL);
         drawTextWithGlyphs(canvas, chars + contextIndex, index - contextIndex,
@@ -910,10 +1008,12 @@
     }
 
     static void drawTextRun__StringIIIIFFIPaintTypeface(
-        JNIEnv* env, jobject obj, SkCanvas* canvas, jstring text, jint start,
+        JNIEnv* env, jobject obj, jlong canvasHandle, jstring text, jint start,
         jint end, jint contextStart, jint contextEnd,
-        jfloat x, jfloat y, jint dirFlags, SkPaint* paint,
-        TypefaceImpl* typeface) {
+        jfloat x, jfloat y, jint dirFlags, jlong paintHandle, jlong typefaceHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
 
         jint count = end - start;
         jint contextCount = contextEnd - contextStart;
@@ -923,9 +1023,11 @@
         env->ReleaseStringChars(text, chars);
     }
 
-    static void drawPosText___CII_FPaint(JNIEnv* env, jobject, SkCanvas* canvas,
-                                         jcharArray text, int index, int count,
-                                         jfloatArray pos, SkPaint* paint) {
+    static void drawPosText___CII_FPaint(JNIEnv* env, jobject, jlong canvasHandle,
+                                         jcharArray text, jint index, jint count,
+                                         jfloatArray pos, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         jchar* textArray = text ? env->GetCharArrayElements(text, NULL) : NULL;
         jsize textCount = text ? env->GetArrayLength(text) : NULL;
         float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL;
@@ -936,12 +1038,12 @@
             posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]);
             posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]);
         }
-        
+
         SkPaint::TextEncoding encoding = paint->getTextEncoding();
         paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
         canvas->drawPosText(textArray + index, count << 1, posPtr, *paint);
         paint->setTextEncoding(encoding);
-        
+
         if (text) {
             env->ReleaseCharArrayElements(text, textArray, 0);
         }
@@ -952,9 +1054,11 @@
     }
 
     static void drawPosText__String_FPaint(JNIEnv* env, jobject,
-                                           SkCanvas* canvas, jstring text,
+                                           jlong canvasHandle, jstring text,
                                            jfloatArray pos,
-                                           SkPaint* paint) {
+                                           jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const void* text_ = text ? env->GetStringChars(text, NULL) : NULL;
         int byteLength = text ? env->GetStringLength(text) : 0;
         float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL;
@@ -981,8 +1085,11 @@
     }
 
     static void drawTextOnPath___CIIPathFFPaint(JNIEnv* env, jobject,
-            SkCanvas* canvas, jcharArray text, int index, int count,
-            SkPath* path, jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+            jlong canvasHandle, jcharArray text, jint index, jint count,
+            jlong pathHandle, jfloat hOffset, jfloat vOffset, jint bidiFlags, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
 
         jchar* textArray = env->GetCharArrayElements(text, NULL);
         TextLayout::drawTextOnPath(paint, textArray + index, count, bidiFlags, hOffset, vOffset,
@@ -991,8 +1098,11 @@
     }
 
     static void drawTextOnPath__StringPathFFPaint(JNIEnv* env, jobject,
-            SkCanvas* canvas, jstring text, SkPath* path,
-            jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+            jlong canvasHandle, jstring text, jlong pathHandle,
+            jfloat hOffset, jfloat vOffset, jint bidiFlags, jlong paintHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* text_ = env->GetStringChars(text, NULL);
         int count = env->GetStringLength(text);
         TextLayout::drawTextOnPath(paint, text_, count, bidiFlags, hOffset, vOffset,
@@ -1027,8 +1137,9 @@
         return true;
     }
 
-    static bool getClipBounds(JNIEnv* env, jobject, SkCanvas* canvas,
-                              jobject bounds) {
+    static jboolean getClipBounds(JNIEnv* env, jobject, jlong canvasHandle,
+                                  jobject bounds) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
         SkRect   r;
         SkIRect ir;
         bool result = getHardClipBounds(canvas, &r);
@@ -1039,30 +1150,32 @@
         r.round(&ir);
 
         (void)GraphicsJNI::irect_to_jrect(ir, env, bounds);
-        return result;
+        return result ? JNI_TRUE : JNI_FALSE;
     }
 
-    static void getCTM(JNIEnv* env, jobject, SkCanvas* canvas,
-                       SkMatrix* matrix) {
+    static void getCTM(JNIEnv* env, jobject, jlong canvasHandle,
+                       jlong matrixHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         *matrix = canvas->getTotalMatrix();
     }
 };
 
 static JNINativeMethod gCanvasMethods[] = {
-    {"finalizer", "(I)V", (void*) SkCanvasGlue::finalizer},
-    {"initRaster","(I)I", (void*) SkCanvasGlue::initRaster},
-    {"copyNativeCanvasState","(II)V", (void*) SkCanvasGlue::copyCanvasState},
+    {"finalizer", "(J)V", (void*) SkCanvasGlue::finalizer},
+    {"initRaster","(J)J", (void*) SkCanvasGlue::initRaster},
+    {"copyNativeCanvasState","(JJ)V", (void*) SkCanvasGlue::copyCanvasState},
     {"isOpaque","()Z", (void*) SkCanvasGlue::isOpaque},
     {"getWidth","()I", (void*) SkCanvasGlue::getWidth},
     {"getHeight","()I", (void*) SkCanvasGlue::getHeight},
     {"save","()I", (void*) SkCanvasGlue::saveAll},
     {"save","(I)I", (void*) SkCanvasGlue::save},
-    {"native_saveLayer","(ILandroid/graphics/RectF;II)I",
+    {"native_saveLayer","(JLandroid/graphics/RectF;JI)I",
         (void*) SkCanvasGlue::saveLayer},
-    {"native_saveLayer","(IFFFFII)I", (void*) SkCanvasGlue::saveLayer4F},
-    {"native_saveLayerAlpha","(ILandroid/graphics/RectF;II)I",
+    {"native_saveLayer","(JFFFFJI)I", (void*) SkCanvasGlue::saveLayer4F},
+    {"native_saveLayerAlpha","(JLandroid/graphics/RectF;II)I",
         (void*) SkCanvasGlue::saveLayerAlpha},
-    {"native_saveLayerAlpha","(IFFFFII)I",
+    {"native_saveLayerAlpha","(JFFFFII)I",
         (void*) SkCanvasGlue::saveLayerAlpha4F},
     {"restore","()V", (void*) SkCanvasGlue::restore},
     {"getSaveCount","()I", (void*) SkCanvasGlue::getSaveCount},
@@ -1071,77 +1184,77 @@
     {"scale","(FF)V", (void*) SkCanvasGlue::scale__FF},
     {"rotate","(F)V", (void*) SkCanvasGlue::rotate__F},
     {"skew","(FF)V", (void*) SkCanvasGlue::skew__FF},
-    {"native_concat","(II)V", (void*) SkCanvasGlue::concat},
-    {"native_setMatrix","(II)V", (void*) SkCanvasGlue::setMatrix},
+    {"native_concat","(JJ)V", (void*) SkCanvasGlue::concat},
+    {"native_setMatrix","(JJ)V", (void*) SkCanvasGlue::setMatrix},
     {"clipRect","(FFFF)Z", (void*) SkCanvasGlue::clipRect_FFFF},
     {"clipRect","(IIII)Z", (void*) SkCanvasGlue::clipRect_IIII},
     {"clipRect","(Landroid/graphics/RectF;)Z",
         (void*) SkCanvasGlue::clipRect_RectF},
     {"clipRect","(Landroid/graphics/Rect;)Z",
         (void*) SkCanvasGlue::clipRect_Rect},
-    {"native_clipRect","(IFFFFI)Z", (void*) SkCanvasGlue::clipRect},
-    {"native_clipPath","(III)Z", (void*) SkCanvasGlue::clipPath},
-    {"native_clipRegion","(III)Z", (void*) SkCanvasGlue::clipRegion},
-    {"nativeSetDrawFilter", "(II)V", (void*) SkCanvasGlue::setDrawFilter},
-    {"native_getClipBounds","(ILandroid/graphics/Rect;)Z",
+    {"native_clipRect","(JFFFFI)Z", (void*) SkCanvasGlue::clipRect},
+    {"native_clipPath","(JJI)Z", (void*) SkCanvasGlue::clipPath},
+    {"native_clipRegion","(JJI)Z", (void*) SkCanvasGlue::clipRegion},
+    {"nativeSetDrawFilter", "(JJ)V", (void*) SkCanvasGlue::setDrawFilter},
+    {"native_getClipBounds","(JLandroid/graphics/Rect;)Z",
         (void*) SkCanvasGlue::getClipBounds},
-    {"native_getCTM", "(II)V", (void*)SkCanvasGlue::getCTM},
-    {"native_quickReject","(ILandroid/graphics/RectF;)Z",
+    {"native_getCTM", "(JJ)V", (void*)SkCanvasGlue::getCTM},
+    {"native_quickReject","(JLandroid/graphics/RectF;)Z",
         (void*) SkCanvasGlue::quickReject__RectF},
-    {"native_quickReject","(II)Z", (void*) SkCanvasGlue::quickReject__Path},
-    {"native_quickReject","(IFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF},
-    {"native_drawRGB","(IIII)V", (void*) SkCanvasGlue::drawRGB},
-    {"native_drawARGB","(IIIII)V", (void*) SkCanvasGlue::drawARGB},
-    {"native_drawColor","(II)V", (void*) SkCanvasGlue::drawColor__I},
-    {"native_drawColor","(III)V", (void*) SkCanvasGlue::drawColor__II},
-    {"native_drawPaint","(II)V", (void*) SkCanvasGlue::drawPaint},
+    {"native_quickReject","(JJ)Z", (void*) SkCanvasGlue::quickReject__Path},
+    {"native_quickReject","(JFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF},
+    {"native_drawRGB","(JIII)V", (void*) SkCanvasGlue::drawRGB},
+    {"native_drawARGB","(JIIII)V", (void*) SkCanvasGlue::drawARGB},
+    {"native_drawColor","(JI)V", (void*) SkCanvasGlue::drawColor__I},
+    {"native_drawColor","(JII)V", (void*) SkCanvasGlue::drawColor__II},
+    {"native_drawPaint","(JJ)V", (void*) SkCanvasGlue::drawPaint},
     {"drawPoint", "(FFLandroid/graphics/Paint;)V",
     (void*) SkCanvasGlue::drawPoint},
     {"drawPoints", "([FIILandroid/graphics/Paint;)V",
         (void*) SkCanvasGlue::drawPoints},
     {"drawLines", "([FIILandroid/graphics/Paint;)V",
         (void*) SkCanvasGlue::drawLines},
-    {"native_drawLine","(IFFFFI)V", (void*) SkCanvasGlue::drawLine__FFFFPaint},
-    {"native_drawRect","(ILandroid/graphics/RectF;I)V",
+    {"native_drawLine","(JFFFFJ)V", (void*) SkCanvasGlue::drawLine__FFFFPaint},
+    {"native_drawRect","(JLandroid/graphics/RectF;J)V",
         (void*) SkCanvasGlue::drawRect__RectFPaint},
-    {"native_drawRect","(IFFFFI)V", (void*) SkCanvasGlue::drawRect__FFFFPaint},
-    {"native_drawOval","(ILandroid/graphics/RectF;I)V",
+    {"native_drawRect","(JFFFFJ)V", (void*) SkCanvasGlue::drawRect__FFFFPaint},
+    {"native_drawOval","(JLandroid/graphics/RectF;J)V",
         (void*) SkCanvasGlue::drawOval},
-    {"native_drawCircle","(IFFFI)V", (void*) SkCanvasGlue::drawCircle},
-    {"native_drawArc","(ILandroid/graphics/RectF;FFZI)V",
+    {"native_drawCircle","(JFFFJ)V", (void*) SkCanvasGlue::drawCircle},
+    {"native_drawArc","(JLandroid/graphics/RectF;FFZJ)V",
         (void*) SkCanvasGlue::drawArc},
-    {"native_drawRoundRect","(ILandroid/graphics/RectF;FFI)V",
+    {"native_drawRoundRect","(JLandroid/graphics/RectF;FFJ)V",
         (void*) SkCanvasGlue::drawRoundRect},
-    {"native_drawPath","(III)V", (void*) SkCanvasGlue::drawPath},
-    {"native_drawBitmap","(IIFFIIII)V",
+    {"native_drawPath","(JJJ)V", (void*) SkCanvasGlue::drawPath},
+    {"native_drawBitmap","(JJFFJIII)V",
         (void*) SkCanvasGlue::drawBitmap__BitmapFFPaint},
-    {"native_drawBitmap","(IILandroid/graphics/Rect;Landroid/graphics/RectF;III)V",
+    {"native_drawBitmap","(JJLandroid/graphics/Rect;Landroid/graphics/RectF;JII)V",
         (void*) SkCanvasGlue::drawBitmapRF},
-    {"native_drawBitmap","(IILandroid/graphics/Rect;Landroid/graphics/Rect;III)V",
+    {"native_drawBitmap","(JJLandroid/graphics/Rect;Landroid/graphics/Rect;JII)V",
         (void*) SkCanvasGlue::drawBitmapRR},
-    {"native_drawBitmap", "(I[IIIFFIIZI)V",
+    {"native_drawBitmap", "(J[IIIFFIIZJ)V",
     (void*)SkCanvasGlue::drawBitmapArray},
-    {"nativeDrawBitmapMatrix", "(IIII)V",
+    {"nativeDrawBitmapMatrix", "(JJJJ)V",
         (void*)SkCanvasGlue::drawBitmapMatrix},
-    {"nativeDrawBitmapMesh", "(IIII[FI[III)V",
+    {"nativeDrawBitmapMesh", "(JJII[FI[IIJ)V",
         (void*)SkCanvasGlue::drawBitmapMesh},
-    {"nativeDrawVertices", "(III[FI[FI[II[SIII)V",
+    {"nativeDrawVertices", "(JII[FI[FI[II[SIIJ)V",
         (void*)SkCanvasGlue::drawVertices},
-    {"native_drawText","(I[CIIFFIII)V",
+    {"native_drawText","(J[CIIFFIJJ)V",
         (void*) SkCanvasGlue::drawText___CIIFFIPaintTypeface},
-    {"native_drawText","(ILjava/lang/String;IIFFIII)V",
+    {"native_drawText","(JLjava/lang/String;IIFFIJJ)V",
         (void*) SkCanvasGlue::drawText__StringIIFFIPaintTypeface},
-    {"native_drawTextRun","(I[CIIIIFFIII)V",
+    {"native_drawTextRun","(J[CIIIIFFIJJ)V",
         (void*) SkCanvasGlue::drawTextRun___CIIIIFFIPaintTypeface},
-    {"native_drawTextRun","(ILjava/lang/String;IIIIFFIII)V",
+    {"native_drawTextRun","(JLjava/lang/String;IIIIFFIJJ)V",
         (void*) SkCanvasGlue::drawTextRun__StringIIIIFFIPaintTypeface},
-    {"native_drawPosText","(I[CII[FI)V",
+    {"native_drawPosText","(J[CII[FJ)V",
         (void*) SkCanvasGlue::drawPosText___CII_FPaint},
-    {"native_drawPosText","(ILjava/lang/String;[FI)V",
+    {"native_drawPosText","(JLjava/lang/String;[FJ)V",
         (void*) SkCanvasGlue::drawPosText__String_FPaint},
-    {"native_drawTextOnPath","(I[CIIIFFII)V",
+    {"native_drawTextOnPath","(J[CIIJFFIJ)V",
         (void*) SkCanvasGlue::drawTextOnPath___CIIPathFFPaint},
-    {"native_drawTextOnPath","(ILjava/lang/String;IFFII)V",
+    {"native_drawTextOnPath","(JLjava/lang/String;JFFIJ)V",
         (void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
 
     {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches},
@@ -1162,7 +1275,7 @@
     int result;
 
     REG(env, "android/graphics/Canvas", gCanvasMethods);
-    
+
     return result;
 }
 
diff --git a/core/jni/android/graphics/ColorFilter.cpp b/core/jni/android/graphics/ColorFilter.cpp
index 26169e7..da40acff 100644
--- a/core/jni/android/graphics/ColorFilter.cpp
+++ b/core/jni/android/graphics/ColorFilter.cpp
@@ -32,7 +32,9 @@
 
 class SkColorFilterGlue {
 public:
-    static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle, jlong fHandle) {
+        SkColorFilter* obj = reinterpret_cast<SkColorFilter *>(objHandle);
+        SkiaColorFilter* f = reinterpret_cast<SkiaColorFilter *>(fHandle);
         if (obj) SkSafeUnref(obj);
         // f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef
 #ifdef USE_OPENGL_RENDERER
@@ -44,26 +46,30 @@
 #endif
     }
 
-    static SkiaColorFilter* glCreatePorterDuffFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
-            jint srcColor, SkPorterDuff::Mode mode) {
+    static jlong glCreatePorterDuffFilter(JNIEnv* env, jobject, jlong skFilterHandle,
+            jint srcColor, jint modeHandle) {
+        SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
+        SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
 #ifdef USE_OPENGL_RENDERER
-        return new SkiaBlendFilter(skFilter, srcColor, SkPorterDuff::ToXfermodeMode(mode));
+        return reinterpret_cast<jlong>(new SkiaBlendFilter(skFilter, srcColor, SkPorterDuff::ToXfermodeMode(mode)));
 #else
         return NULL;
 #endif
     }
 
-    static SkiaColorFilter* glCreateLightingFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+    static jlong glCreateLightingFilter(JNIEnv* env, jobject, jlong skFilterHandle,
             jint mul, jint add) {
+        SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
 #ifdef USE_OPENGL_RENDERER
-        return new SkiaLightingFilter(skFilter, mul, add);
+        return reinterpret_cast<jlong>(new SkiaLightingFilter(skFilter, mul, add));
 #else
         return NULL;
 #endif
     }
 
-    static SkiaColorFilter* glCreateColorMatrixFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+    static jlong glCreateColorMatrixFilter(JNIEnv* env, jobject, jlong skFilterHandle,
             jfloatArray jarray) {
+        SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
 #ifdef USE_OPENGL_RENDERER
         AutoJavaFloatArray autoArray(env, jarray, 20);
         const float* src = autoArray.ptr();
@@ -80,22 +86,23 @@
         colorVector[2] = src[14];
         colorVector[3] = src[19];
 
-        return new SkiaColorMatrixFilter(skFilter, colorMatrix, colorVector);
+        return reinterpret_cast<jlong>(new SkiaColorMatrixFilter(skFilter, colorMatrix, colorVector));
 #else
         return NULL;
 #endif
     }
 
-    static SkColorFilter* CreatePorterDuffFilter(JNIEnv* env, jobject, jint srcColor,
-            SkPorterDuff::Mode mode) {
-        return SkColorFilter::CreateModeFilter(srcColor, SkPorterDuff::ToXfermodeMode(mode));
+    static jlong CreatePorterDuffFilter(JNIEnv* env, jobject, jint srcColor,
+            jint modeHandle) {
+        SkPorterDuff::Mode mode = (SkPorterDuff::Mode) modeHandle;
+        return reinterpret_cast<jlong>(SkColorFilter::CreateModeFilter(srcColor, SkPorterDuff::ToXfermodeMode(mode)));
     }
 
-    static SkColorFilter* CreateLightingFilter(JNIEnv* env, jobject, jint mul, jint add) {
-        return SkColorFilter::CreateLightingFilter(mul, add);
+    static jlong CreateLightingFilter(JNIEnv* env, jobject, jint mul, jint add) {
+        return reinterpret_cast<jlong>(SkColorFilter::CreateLightingFilter(mul, add));
     }
 
-    static SkColorFilter* CreateColorMatrixFilter(JNIEnv* env, jobject, jfloatArray jarray) {
+    static jlong CreateColorMatrixFilter(JNIEnv* env, jobject, jfloatArray jarray) {
         AutoJavaFloatArray autoArray(env, jarray, 20);
         const float* src = autoArray.ptr();
 
@@ -104,30 +111,30 @@
         for (int i = 0; i < 20; i++) {
             array[i] = SkFloatToScalar(src[i]);
         }
-        return new SkColorMatrixFilter(array);
+        return reinterpret_cast<jlong>(new SkColorMatrixFilter(array));
 #else
-        return new SkColorMatrixFilter(src);
+        return reinterpret_cast<jlong>(new SkColorMatrixFilter(src));
 #endif
     }
 };
 
 static JNINativeMethod colorfilter_methods[] = {
-    {"destroyFilter", "(II)V", (void*) SkColorFilterGlue::finalizer}
+    {"destroyFilter", "(JJ)V", (void*) SkColorFilterGlue::finalizer}
 };
 
 static JNINativeMethod porterduff_methods[] = {
-    { "native_CreatePorterDuffFilter", "(II)I", (void*) SkColorFilterGlue::CreatePorterDuffFilter   },
-    { "nCreatePorterDuffFilter",       "(III)I", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
+    { "native_CreatePorterDuffFilter", "(II)J", (void*) SkColorFilterGlue::CreatePorterDuffFilter   },
+    { "nCreatePorterDuffFilter",       "(JII)J", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
 };
 
 static JNINativeMethod lighting_methods[] = {
-    { "native_CreateLightingFilter", "(II)I", (void*) SkColorFilterGlue::CreateLightingFilter   },
-    { "nCreateLightingFilter",       "(III)I", (void*) SkColorFilterGlue::glCreateLightingFilter },
+    { "native_CreateLightingFilter", "(II)J", (void*) SkColorFilterGlue::CreateLightingFilter   },
+    { "nCreateLightingFilter",       "(JII)J", (void*) SkColorFilterGlue::glCreateLightingFilter },
 };
 
 static JNINativeMethod colormatrix_methods[] = {
-    { "nativeColorMatrixFilter", "([F)I", (void*) SkColorFilterGlue::CreateColorMatrixFilter   },
-    { "nColorMatrixFilter",      "(I[F)I", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
+    { "nativeColorMatrixFilter", "([F)J", (void*) SkColorFilterGlue::CreateColorMatrixFilter   },
+    { "nColorMatrixFilter",      "(J[F)J", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
 };
 
 #define REG(env, name, array) \
diff --git a/core/jni/android/graphics/DrawFilter.cpp b/core/jni/android/graphics/DrawFilter.cpp
index 2f9fe7e..fbfa2ec 100644
--- a/core/jni/android/graphics/DrawFilter.cpp
+++ b/core/jni/android/graphics/DrawFilter.cpp
@@ -33,18 +33,20 @@
 class SkDrawFilterGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkDrawFilter* obj) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkDrawFilter* obj = reinterpret_cast<SkDrawFilter*>(objHandle);
         SkSafeUnref(obj);
     }
 
-    static SkDrawFilter* CreatePaintFlagsDF(JNIEnv* env, jobject clazz,
-                                           int clearFlags, int setFlags) {
+    static jlong CreatePaintFlagsDF(JNIEnv* env, jobject clazz,
+                                    jint clearFlags, jint setFlags) {
         // trim off any out-of-range bits
         clearFlags &= SkPaint::kAllFlags;
         setFlags &= SkPaint::kAllFlags;
 
         if (clearFlags | setFlags) {
-            return new SkPaintFlagsDrawFilter(clearFlags, setFlags);
+            SkDrawFilter* filter = new SkPaintFlagsDrawFilter(clearFlags, setFlags);
+            return reinterpret_cast<jlong>(filter);
         } else {
             return NULL;
         }
@@ -52,11 +54,11 @@
 };
 
 static JNINativeMethod drawfilter_methods[] = {
-    {"nativeDestructor", "(I)V", (void*) SkDrawFilterGlue::finalizer}
+    {"nativeDestructor", "(J)V", (void*) SkDrawFilterGlue::finalizer}
 };
 
 static JNINativeMethod paintflags_methods[] = {
-    {"nativeConstructor","(II)I", (void*) SkDrawFilterGlue::CreatePaintFlagsDF}
+    {"nativeConstructor","(II)J", (void*) SkDrawFilterGlue::CreatePaintFlagsDF}
 };
 
 #define REG(env, name, array)                                                                       \
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 2a2db57..66f9f3d 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -293,7 +293,8 @@
     SkASSERT(env);
     SkASSERT(bitmap);
     SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class));
-    SkBitmap* b = (SkBitmap*)env->GetIntField(bitmap, gBitmap_nativeInstanceID);
+    jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativeInstanceID);
+    SkBitmap* b = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkASSERT(b);
     return b;
 }
@@ -316,7 +317,8 @@
     SkASSERT(env);
     SkASSERT(canvas);
     SkASSERT(env->IsInstanceOf(canvas, gCanvas_class));
-    SkCanvas* c = (SkCanvas*)env->GetIntField(canvas, gCanvas_nativeInstanceID);
+    jlong canvasHandle = env->GetLongField(canvas, gCanvas_nativeInstanceID);
+    SkCanvas* c = reinterpret_cast<SkCanvas*>(canvasHandle);
     SkASSERT(c);
     return c;
 }
@@ -325,7 +327,8 @@
     SkASSERT(env);
     SkASSERT(paint);
     SkASSERT(env->IsInstanceOf(paint, gPaint_class));
-    SkPaint* p = (SkPaint*)env->GetIntField(paint, gPaint_nativeInstanceID);
+    jlong paintHandle = env->GetLongField(paint, gPaint_nativeInstanceID);
+    SkPaint* p = reinterpret_cast<SkPaint*>(paintHandle);
     SkASSERT(p);
     return p;
 }
@@ -335,7 +338,8 @@
     SkASSERT(env);
     SkASSERT(picture);
     SkASSERT(env->IsInstanceOf(picture, gPicture_class));
-    SkPicture* p = (SkPicture*)env->GetIntField(picture, gPicture_nativeInstanceID);
+    jlong pictureHandle = env->GetLongField(picture, gPicture_nativeInstanceID);
+    SkPicture* p = reinterpret_cast<SkPicture*>(pictureHandle);
     SkASSERT(p);
     return p;
 }
@@ -345,7 +349,8 @@
     SkASSERT(env);
     SkASSERT(region);
     SkASSERT(env->IsInstanceOf(region, gRegion_class));
-    SkRegion* r = (SkRegion*)env->GetIntField(region, gRegion_nativeInstanceID);
+    jlong regionHandle = env->GetLongField(region, gRegion_nativeInstanceID);
+    SkRegion* r = reinterpret_cast<SkRegion*>(regionHandle);
     SkASSERT(r);
     return r;
 }
@@ -377,7 +382,7 @@
     assert_premultiplied(*bitmap, isPremultiplied);
 
     jobject obj = env->NewObject(gBitmap_class, gBitmap_constructorMethodID,
-            static_cast<jint>(reinterpret_cast<uintptr_t>(bitmap)), buffer,
+            reinterpret_cast<jlong>(bitmap), buffer,
             bitmap->width(), bitmap->height(), density, isMutable, isPremultiplied,
             ninepatch, layoutbounds);
     hasException(env); // For the side effect of logging.
@@ -421,7 +426,7 @@
 {
     SkASSERT(region != NULL);
     jobject obj = env->NewObject(gRegion_class, gRegion_constructorMethodID,
-            static_cast<jint>(reinterpret_cast<uintptr_t>(region)), 0);
+                                 reinterpret_cast<jlong>(region), 0);
     hasException(env); // For the side effect of logging.
     return obj;
 }
@@ -666,8 +671,8 @@
     gPointF_yFieldID = getFieldIDCheck(env, gPointF_class, "y", "F");
 
     gBitmap_class = make_globalref(env, "android/graphics/Bitmap");
-    gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "I");
-    gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", "(I[BIIIZZ[B[I)V");
+    gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "J");
+    gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", "(J[BIIIZZ[B[I)V");
     gBitmap_reinitMethodID = env->GetMethodID(gBitmap_class, "reinit", "(IIZ)V");
     gBitmap_getAllocationByteCountMethodID = env->GetMethodID(gBitmap_class, "getAllocationByteCount", "()I");
     gBitmapRegionDecoder_class = make_globalref(env, "android/graphics/BitmapRegionDecoder");
@@ -678,18 +683,18 @@
                                                      "nativeInt", "I");
 
     gCanvas_class = make_globalref(env, "android/graphics/Canvas");
-    gCanvas_nativeInstanceID = getFieldIDCheck(env, gCanvas_class, "mNativeCanvas", "I");
+    gCanvas_nativeInstanceID = getFieldIDCheck(env, gCanvas_class, "mNativeCanvas", "J");
 
     gPaint_class = make_globalref(env, "android/graphics/Paint");
-    gPaint_nativeInstanceID = getFieldIDCheck(env, gPaint_class, "mNativePaint", "I");
+    gPaint_nativeInstanceID = getFieldIDCheck(env, gPaint_class, "mNativePaint", "J");
 
     gPicture_class = make_globalref(env, "android/graphics/Picture");
-    gPicture_nativeInstanceID = getFieldIDCheck(env, gPicture_class, "mNativePicture", "I");
+    gPicture_nativeInstanceID = getFieldIDCheck(env, gPicture_class, "mNativePicture", "J");
 
     gRegion_class = make_globalref(env, "android/graphics/Region");
-    gRegion_nativeInstanceID = getFieldIDCheck(env, gRegion_class, "mNativeRegion", "I");
+    gRegion_nativeInstanceID = getFieldIDCheck(env, gRegion_class, "mNativeRegion", "J");
     gRegion_constructorMethodID = env->GetMethodID(gRegion_class, "<init>",
-        "(II)V");
+        "(JI)V");
 
     c = env->FindClass("java/lang/Byte");
     gByte_class = (jclass) env->NewGlobalRef(
diff --git a/core/jni/android/graphics/LayerRasterizer.cpp b/core/jni/android/graphics/LayerRasterizer.cpp
index e5bc6f8..29e7db1 100644
--- a/core/jni/android/graphics/LayerRasterizer.cpp
+++ b/core/jni/android/graphics/LayerRasterizer.cpp
@@ -3,11 +3,13 @@
 
 class SkLayerRasterizerGlue {
 public:
-    static SkRasterizer* create(JNIEnv* env, jobject) {
-        return new SkLayerRasterizer();
+    static jlong create(JNIEnv* env, jobject) {
+        return reinterpret_cast<jlong>(new SkLayerRasterizer());
     }
 
-    static void addLayer(JNIEnv* env, jobject, SkLayerRasterizer* layer, const SkPaint* paint, float dx, float dy) {
+    static void addLayer(JNIEnv* env, jobject, jlong layerHandle, jlong paintHandle, jfloat dx, jfloat dy) {
+        SkLayerRasterizer* layer = reinterpret_cast<SkLayerRasterizer *>(layerHandle);
+        const SkPaint* paint = reinterpret_cast<SkPaint *>(paintHandle);
         SkASSERT(layer);
         SkASSERT(paint);
         layer->addLayer(*paint, SkFloatToScalar(dx), SkFloatToScalar(dy));
@@ -19,8 +21,8 @@
 #include <android_runtime/AndroidRuntime.h>
 
 static JNINativeMethod gLayerRasterizerMethods[] = {
-    { "nativeConstructor",  "()I",      (void*)SkLayerRasterizerGlue::create    },
-    { "nativeAddLayer",     "(IIFF)V",  (void*)SkLayerRasterizerGlue::addLayer  }
+    { "nativeConstructor",  "()J",      (void*)SkLayerRasterizerGlue::create    },
+    { "nativeAddLayer",     "(JJFF)V",  (void*)SkLayerRasterizerGlue::addLayer  }
 };
 
 int register_android_graphics_LayerRasterizer(JNIEnv* env)
diff --git a/core/jni/android/graphics/MaskFilter.cpp b/core/jni/android/graphics/MaskFilter.cpp
index d954ddf..f331af7 100644
--- a/core/jni/android/graphics/MaskFilter.cpp
+++ b/core/jni/android/graphics/MaskFilter.cpp
@@ -13,18 +13,19 @@
 
 class SkMaskFilterGlue {
 public:
-    static void destructor(JNIEnv* env, jobject, SkMaskFilter* filter) {
+    static void destructor(JNIEnv* env, jobject, jlong filterHandle) {
+        SkMaskFilter* filter = reinterpret_cast<SkMaskFilter *>(filterHandle);
         SkSafeUnref(filter);
     }
 
-    static SkMaskFilter* createBlur(JNIEnv* env, jobject, float radius, int blurStyle) {
+    static jlong createBlur(JNIEnv* env, jobject, jfloat radius, jint blurStyle) {
         SkMaskFilter* filter = SkBlurMaskFilter::Create(SkFloatToScalar(radius),
                                         (SkBlurMaskFilter::BlurStyle)blurStyle);
         ThrowIAE_IfNull(env, filter);
-        return filter;
+        return reinterpret_cast<jlong>(filter);
     }
 
-    static SkMaskFilter* createEmboss(JNIEnv* env, jobject, jfloatArray dirArray, float ambient, float specular, float radius) {
+    static jlong createEmboss(JNIEnv* env, jobject, jfloatArray dirArray, jfloat ambient, jfloat specular, jfloat radius) {
         SkScalar direction[3];
 
         AutoJavaFloatArray autoDir(env, dirArray, 3);
@@ -38,39 +39,42 @@
                                                       SkFloatToScalar(specular),
                                                       SkFloatToScalar(radius));
         ThrowIAE_IfNull(env, filter);
-        return filter;
+        return reinterpret_cast<jlong>(filter);
     }
 
-    static SkMaskFilter* createTable(JNIEnv* env, jobject, jbyteArray jtable) {
+    static jlong createTable(JNIEnv* env, jobject, jbyteArray jtable) {
         AutoJavaByteArray autoTable(env, jtable, 256);
-        return new SkTableMaskFilter((const uint8_t*)autoTable.ptr());
+        SkMaskFilter* filter = new SkTableMaskFilter((const uint8_t*)autoTable.ptr());
+        return reinterpret_cast<jlong>(filter);
     }
 
-    static SkMaskFilter* createClipTable(JNIEnv* env, jobject, int min, int max) {
-        return SkTableMaskFilter::CreateClip(min, max);
+    static jlong createClipTable(JNIEnv* env, jobject, jint min, jint max) {
+        SkMaskFilter* filter = SkTableMaskFilter::CreateClip(min, max);
+        return reinterpret_cast<jlong>(filter);
     }
 
-    static SkMaskFilter* createGammaTable(JNIEnv* env, jobject, float gamma) {
-        return SkTableMaskFilter::CreateGamma(gamma);
+    static jlong createGammaTable(JNIEnv* env, jobject, jfloat gamma) {
+        SkMaskFilter* filter = SkTableMaskFilter::CreateGamma(gamma);
+        return reinterpret_cast<jlong>(filter);
     }
 };
 
 static JNINativeMethod gMaskFilterMethods[] = {
-    { "nativeDestructor",   "(I)V",     (void*)SkMaskFilterGlue::destructor      }
+    { "nativeDestructor",   "(J)V",     (void*)SkMaskFilterGlue::destructor      }
 };
 
 static JNINativeMethod gBlurMaskFilterMethods[] = {
-    { "nativeConstructor",  "(FI)I",    (void*)SkMaskFilterGlue::createBlur      }
+    { "nativeConstructor",  "(FI)J",    (void*)SkMaskFilterGlue::createBlur      }
 };
 
 static JNINativeMethod gEmbossMaskFilterMethods[] = {
-    { "nativeConstructor",  "([FFFF)I", (void*)SkMaskFilterGlue::createEmboss    }
+    { "nativeConstructor",  "([FFFF)J", (void*)SkMaskFilterGlue::createEmboss    }
 };
 
 static JNINativeMethod gTableMaskFilterMethods[] = {
-    { "nativeNewTable", "([B)I", (void*)SkMaskFilterGlue::createTable    },
-    { "nativeNewClip",  "(II)I", (void*)SkMaskFilterGlue::createClipTable    },
-    { "nativeNewGamma", "(F)I", (void*)SkMaskFilterGlue::createGammaTable    }
+    { "nativeNewTable", "([B)J", (void*)SkMaskFilterGlue::createTable    },
+    { "nativeNewClip",  "(II)J", (void*)SkMaskFilterGlue::createClipTable    },
+    { "nativeNewGamma", "(F)J", (void*)SkMaskFilterGlue::createGammaTable    }
 };
 
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Matrix.cpp b/core/jni/android/graphics/Matrix.cpp
index 4bd59e7..6ae9fea 100644
--- a/core/jni/android/graphics/Matrix.cpp
+++ b/core/jni/android/graphics/Matrix.cpp
@@ -31,210 +31,237 @@
 class SkMatrixGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkMatrix* obj) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         delete obj;
     }
 
-    static SkMatrix* create(JNIEnv* env, jobject clazz, const SkMatrix* src) {
+    static jlong create(JNIEnv* env, jobject clazz, jlong srcHandle) {
+        const SkMatrix* src = reinterpret_cast<SkMatrix*>(srcHandle);
         SkMatrix* obj = new SkMatrix();
         if (src)
             *obj = *src;
         else
             obj->reset();
-        return obj;
+        return reinterpret_cast<jlong>(obj);
     }
- 
-    static jboolean isIdentity(JNIEnv* env, jobject clazz, SkMatrix* obj) {
-        return obj->isIdentity();
+
+    static jboolean isIdentity(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+        return obj->isIdentity() ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean rectStaysRect(JNIEnv* env, jobject clazz, SkMatrix* obj) {
-        return obj->rectStaysRect();
+    static jboolean rectStaysRect(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+        return obj->rectStaysRect() ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static void reset(JNIEnv* env, jobject clazz, SkMatrix* obj) {
+    static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         obj->reset();
     }
- 
-    static void set(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* other) {
+     static void set(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+        SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
         *obj = *other;
     }
- 
-    static void setTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+     static void setTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->setTranslate(dx_, dy_);
     }
- 
-    static void setScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+     static void setScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
         obj->setScale(sx_, sy_, px_, py_);
     }
- 
-    static void setScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+     static void setScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         obj->setScale(sx_, sy_);
     }
- 
-    static void setRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+     static void setRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
         obj->setRotate(degrees_, px_, py_);
     }
- 
-    static void setRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+     static void setRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
         obj->setRotate(degrees_);
     }
- 
-    static void setSinCos__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sinValue, jfloat cosValue, jfloat px, jfloat py) {
+     static void setSinCos__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sinValue, jfloat cosValue, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sinValue_ = SkFloatToScalar(sinValue);
         SkScalar cosValue_ = SkFloatToScalar(cosValue);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
         obj->setSinCos(sinValue_, cosValue_, px_, py_);
     }
- 
-    static void setSinCos__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sinValue, jfloat cosValue) {
+     static void setSinCos__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sinValue, jfloat cosValue) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sinValue_ = SkFloatToScalar(sinValue);
         SkScalar cosValue_ = SkFloatToScalar(cosValue);
         obj->setSinCos(sinValue_, cosValue_);
     }
- 
-    static void setSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+     static void setSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
         obj->setSkew(kx_, ky_, px_, py_);
     }
- 
-    static void setSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky) {
+     static void setSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
         obj->setSkew(kx_, ky_);
     }
- 
-    static jboolean setConcat(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* a, SkMatrix* b) {
-        return obj->setConcat(*a, *b);
+     static jboolean setConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong aHandle, jlong bHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+        SkMatrix* a = reinterpret_cast<SkMatrix*>(aHandle);
+        SkMatrix* b = reinterpret_cast<SkMatrix*>(bHandle);
+        return obj->setConcat(*a, *b) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+
+    static jboolean preTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
-        return obj->preTranslate(dx_, dy_);
+        return obj->preTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+
+    static jboolean preScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->preScale(sx_, sy_, px_, py_);
+        return obj->preScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+
+    static jboolean preScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
-        return obj->preScale(sx_, sy_);
+        return obj->preScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+
+    static jboolean preRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->preRotate(degrees_, px_, py_);
+        return obj->preRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+
+    static jboolean preRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
-        return obj->preRotate(degrees_);
+        return obj->preRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+
+    static jboolean preSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->preSkew(kx_, ky_, px_, py_);
+        return obj->preSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky) {
+
+    static jboolean preSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
-        return obj->preSkew(kx_, ky_);
+        return obj->preSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean preConcat(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* other) {
-        return obj->preConcat(*other);
+
+    static jboolean preConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+        SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
+        return obj->preConcat(*other) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+
+    static jboolean postTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
-        return obj->postTranslate(dx_, dy_);
+        return obj->postTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+
+    static jboolean postScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->postScale(sx_, sy_, px_, py_);
+        return obj->postScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+
+    static jboolean postScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar sx_ = SkFloatToScalar(sx);
         SkScalar sy_ = SkFloatToScalar(sy);
-        return obj->postScale(sx_, sy_);
+        return obj->postScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+
+    static jboolean postRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->postRotate(degrees_, px_, py_);
+        return obj->postRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+
+    static jboolean postRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar degrees_ = SkFloatToScalar(degrees);
-        return obj->postRotate(degrees_);
+        return obj->postRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+
+    static jboolean postSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+        SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
         SkScalar px_ = SkFloatToScalar(px);
         SkScalar py_ = SkFloatToScalar(py);
-        return obj->postSkew(kx_, ky_, px_, py_);
+        return obj->postSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloat kx, jfloat ky) {
+
+    static jboolean postSkew__FF(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat kx, jfloat ky) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         SkScalar kx_ = SkFloatToScalar(kx);
         SkScalar ky_ = SkFloatToScalar(ky);
-        return matrix->postSkew(kx_, ky_);
+        return matrix->postSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean postConcat(JNIEnv* env, jobject clazz, SkMatrix* matrix, SkMatrix* other) {
-        return matrix->postConcat(*other);
+
+    static jboolean postConcat(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong otherHandle) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
+        return matrix->postConcat(*other) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean setRectToRect(JNIEnv* env, jobject clazz, SkMatrix* matrix, jobject src, jobject dst, SkMatrix::ScaleToFit stf) {
+
+    static jboolean setRectToRect(JNIEnv* env, jobject clazz, jlong matrixHandle, jobject src, jobject dst, jint stfHandle) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        SkMatrix::ScaleToFit stf = static_cast<SkMatrix::ScaleToFit>(stfHandle);
         SkRect src_;
         GraphicsJNI::jrectf_to_rect(env, src, &src_);
         SkRect dst_;
         GraphicsJNI::jrectf_to_rect(env, dst, &dst_);
-        return matrix->setRectToRect(src_, dst_, stf);
+        return matrix->setRectToRect(src_, dst_, stf) ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean setPolyToPoly(JNIEnv* env, jobject clazz, SkMatrix* matrix,
-                                  jfloatArray jsrc, int srcIndex,
-                                  jfloatArray jdst, int dstIndex, int ptCount) {
+
+    static jboolean setPolyToPoly(JNIEnv* env, jobject clazz, jlong matrixHandle,
+                                  jfloatArray jsrc, jint srcIndex,
+                                  jfloatArray jdst, jint dstIndex, jint ptCount) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         SkASSERT(srcIndex >= 0);
         SkASSERT(dstIndex >= 0);
         SkASSERT((unsigned)ptCount <= 4);
@@ -243,6 +270,7 @@
         AutoJavaFloatArray autoDst(env, jdst, dstIndex + (ptCount << 1), kRW_JNIAccess);
         float* src = autoSrc.ptr() + srcIndex;
         float* dst = autoDst.ptr() + dstIndex;
+        bool result;
 
 #ifdef SK_SCALAR_IS_FIXED        
         SkPoint srcPt[4], dstPt[4];
@@ -252,21 +280,25 @@
             srcPt[i].set(SkFloatToScalar(src[x]), SkFloatToScalar(src[y]));
             dstPt[i].set(SkFloatToScalar(dst[x]), SkFloatToScalar(dst[y]));
         }
-        return matrix->setPolyToPoly(srcPt, dstPt, ptCount);
+        result = matrix->setPolyToPoly(srcPt, dstPt, ptCount);
 #else
-        return matrix->setPolyToPoly((const SkPoint*)src, (const SkPoint*)dst,
+        result = matrix->setPolyToPoly((const SkPoint*)src, (const SkPoint*)dst,
                                      ptCount);
 #endif
+        return result ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jboolean invert(JNIEnv* env, jobject clazz, SkMatrix* matrix, SkMatrix* inverse) {
+
+    static jboolean invert(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong inverseHandle) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        SkMatrix* inverse = reinterpret_cast<SkMatrix*>(inverseHandle);
         return matrix->invert(inverse);
     }
- 
-    static void mapPoints(JNIEnv* env, jobject clazz, SkMatrix* matrix,
-                              jfloatArray dst, int dstIndex,
-                              jfloatArray src, int srcIndex,
-                              int ptCount, bool isPts) {
+
+    static void mapPoints(JNIEnv* env, jobject clazz, jlong matrixHandle,
+                              jfloatArray dst, jint dstIndex,
+                              jfloatArray src, jint srcIndex,
+                              jint ptCount, jboolean isPts) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         SkASSERT(ptCount >= 0);
         AutoJavaFloatArray autoSrc(env, src, srcIndex + (ptCount << 1), kRO_JNIAccess);
         AutoJavaFloatArray autoDst(env, dst, dstIndex + (ptCount << 1), kRW_JNIAccess);
@@ -304,20 +336,24 @@
                                ptCount);
 #endif
     }
- 
-    static jboolean mapRect__RectFRectF(JNIEnv* env, jobject clazz, SkMatrix* matrix, jobjectArray dst, jobject src) {
+
+    static jboolean mapRect__RectFRectF(JNIEnv* env, jobject clazz, jlong matrixHandle, jobjectArray dst, jobject src) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         SkRect dst_, src_;
         GraphicsJNI::jrectf_to_rect(env, src, &src_);
         jboolean rectStaysRect = matrix->mapRect(&dst_, src_);
         GraphicsJNI::rect_to_jrectf(dst_, env, dst);
-        return rectStaysRect;
+        return rectStaysRect ? JNI_TRUE : JNI_FALSE;
     }
- 
-    static jfloat mapRadius(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloat radius) {
-        return SkScalarToFloat(matrix->mapRadius(SkFloatToScalar(radius)));
+
+    static jfloat mapRadius(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat radius) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        float result;
+        result = SkScalarToFloat(matrix->mapRadius(SkFloatToScalar(radius)));
+        return static_cast<jfloat>(result);
     }
- 
-    static void getValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
+    static void getValues(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloatArray values) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         AutoJavaFloatArray autoValues(env, values, 9, kRW_JNIAccess);
         float* dst = autoValues.ptr();
 
@@ -334,8 +370,9 @@
         }
 #endif
     }
- 
-    static void setValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
+
+    static void setValues(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloatArray values) {
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         AutoJavaFloatArray autoValues(env, values, 9, kRO_JNIAccess);
         const float* src = autoValues.ptr();
 
@@ -353,53 +390,55 @@
 #endif
     }
 
-    static jboolean equals(JNIEnv* env, jobject clazz, const SkMatrix* a, const SkMatrix* b) {
+    static jboolean equals(JNIEnv* env, jobject clazz, jlong aHandle, jlong bHandle) {
+        const SkMatrix* a = reinterpret_cast<SkMatrix*>(aHandle);
+        const SkMatrix* b = reinterpret_cast<SkMatrix*>(bHandle);
         return *a == *b;
     }
  };
 
 static JNINativeMethod methods[] = {
-    {"finalizer", "(I)V", (void*) SkMatrixGlue::finalizer},
-    {"native_create","(I)I", (void*) SkMatrixGlue::create},
-    {"native_isIdentity","(I)Z", (void*) SkMatrixGlue::isIdentity},
-    {"native_rectStaysRect","(I)Z", (void*) SkMatrixGlue::rectStaysRect},
-    {"native_reset","(I)V", (void*) SkMatrixGlue::reset},
-    {"native_set","(II)V", (void*) SkMatrixGlue::set},
-    {"native_setTranslate","(IFF)V", (void*) SkMatrixGlue::setTranslate},
-    {"native_setScale","(IFFFF)V", (void*) SkMatrixGlue::setScale__FFFF},
-    {"native_setScale","(IFF)V", (void*) SkMatrixGlue::setScale__FF},
-    {"native_setRotate","(IFFF)V", (void*) SkMatrixGlue::setRotate__FFF},
-    {"native_setRotate","(IF)V", (void*) SkMatrixGlue::setRotate__F},
-    {"native_setSinCos","(IFFFF)V", (void*) SkMatrixGlue::setSinCos__FFFF},
-    {"native_setSinCos","(IFF)V", (void*) SkMatrixGlue::setSinCos__FF},
-    {"native_setSkew","(IFFFF)V", (void*) SkMatrixGlue::setSkew__FFFF},
-    {"native_setSkew","(IFF)V", (void*) SkMatrixGlue::setSkew__FF},
-    {"native_setConcat","(III)Z", (void*) SkMatrixGlue::setConcat},
-    {"native_preTranslate","(IFF)Z", (void*) SkMatrixGlue::preTranslate},
-    {"native_preScale","(IFFFF)Z", (void*) SkMatrixGlue::preScale__FFFF},
-    {"native_preScale","(IFF)Z", (void*) SkMatrixGlue::preScale__FF},
-    {"native_preRotate","(IFFF)Z", (void*) SkMatrixGlue::preRotate__FFF},
-    {"native_preRotate","(IF)Z", (void*) SkMatrixGlue::preRotate__F},
-    {"native_preSkew","(IFFFF)Z", (void*) SkMatrixGlue::preSkew__FFFF},
-    {"native_preSkew","(IFF)Z", (void*) SkMatrixGlue::preSkew__FF},
-    {"native_preConcat","(II)Z", (void*) SkMatrixGlue::preConcat},
-    {"native_postTranslate","(IFF)Z", (void*) SkMatrixGlue::postTranslate},
-    {"native_postScale","(IFFFF)Z", (void*) SkMatrixGlue::postScale__FFFF},
-    {"native_postScale","(IFF)Z", (void*) SkMatrixGlue::postScale__FF},
-    {"native_postRotate","(IFFF)Z", (void*) SkMatrixGlue::postRotate__FFF},
-    {"native_postRotate","(IF)Z", (void*) SkMatrixGlue::postRotate__F},
-    {"native_postSkew","(IFFFF)Z", (void*) SkMatrixGlue::postSkew__FFFF},
-    {"native_postSkew","(IFF)Z", (void*) SkMatrixGlue::postSkew__FF},
-    {"native_postConcat","(II)Z", (void*) SkMatrixGlue::postConcat},
-    {"native_setRectToRect","(ILandroid/graphics/RectF;Landroid/graphics/RectF;I)Z", (void*) SkMatrixGlue::setRectToRect},
-    {"native_setPolyToPoly","(I[FI[FII)Z", (void*) SkMatrixGlue::setPolyToPoly},
-    {"native_invert","(II)Z", (void*) SkMatrixGlue::invert},
-    {"native_mapPoints","(I[FI[FIIZ)V", (void*) SkMatrixGlue::mapPoints},
-    {"native_mapRect","(ILandroid/graphics/RectF;Landroid/graphics/RectF;)Z", (void*) SkMatrixGlue::mapRect__RectFRectF},
-    {"native_mapRadius","(IF)F", (void*) SkMatrixGlue::mapRadius},
-    {"native_getValues","(I[F)V", (void*) SkMatrixGlue::getValues},
-    {"native_setValues","(I[F)V", (void*) SkMatrixGlue::setValues},
-    {"native_equals", "(II)Z", (void*) SkMatrixGlue::equals}
+    {"finalizer", "(J)V", (void*) SkMatrixGlue::finalizer},
+    {"native_create","(J)J", (void*) SkMatrixGlue::create},
+    {"native_isIdentity","(J)Z", (void*) SkMatrixGlue::isIdentity},
+    {"native_rectStaysRect","(J)Z", (void*) SkMatrixGlue::rectStaysRect},
+    {"native_reset","(J)V", (void*) SkMatrixGlue::reset},
+    {"native_set","(JJ)V", (void*) SkMatrixGlue::set},
+    {"native_setTranslate","(JFF)V", (void*) SkMatrixGlue::setTranslate},
+    {"native_setScale","(JFFFF)V", (void*) SkMatrixGlue::setScale__FFFF},
+    {"native_setScale","(JFF)V", (void*) SkMatrixGlue::setScale__FF},
+    {"native_setRotate","(JFFF)V", (void*) SkMatrixGlue::setRotate__FFF},
+    {"native_setRotate","(JF)V", (void*) SkMatrixGlue::setRotate__F},
+    {"native_setSinCos","(JFFFF)V", (void*) SkMatrixGlue::setSinCos__FFFF},
+    {"native_setSinCos","(JFF)V", (void*) SkMatrixGlue::setSinCos__FF},
+    {"native_setSkew","(JFFFF)V", (void*) SkMatrixGlue::setSkew__FFFF},
+    {"native_setSkew","(JFF)V", (void*) SkMatrixGlue::setSkew__FF},
+    {"native_setConcat","(JJJ)Z", (void*) SkMatrixGlue::setConcat},
+    {"native_preTranslate","(JFF)Z", (void*) SkMatrixGlue::preTranslate},
+    {"native_preScale","(JFFFF)Z", (void*) SkMatrixGlue::preScale__FFFF},
+    {"native_preScale","(JFF)Z", (void*) SkMatrixGlue::preScale__FF},
+    {"native_preRotate","(JFFF)Z", (void*) SkMatrixGlue::preRotate__FFF},
+    {"native_preRotate","(JF)Z", (void*) SkMatrixGlue::preRotate__F},
+    {"native_preSkew","(JFFFF)Z", (void*) SkMatrixGlue::preSkew__FFFF},
+    {"native_preSkew","(JFF)Z", (void*) SkMatrixGlue::preSkew__FF},
+    {"native_preConcat","(JJ)Z", (void*) SkMatrixGlue::preConcat},
+    {"native_postTranslate","(JFF)Z", (void*) SkMatrixGlue::postTranslate},
+    {"native_postScale","(JFFFF)Z", (void*) SkMatrixGlue::postScale__FFFF},
+    {"native_postScale","(JFF)Z", (void*) SkMatrixGlue::postScale__FF},
+    {"native_postRotate","(JFFF)Z", (void*) SkMatrixGlue::postRotate__FFF},
+    {"native_postRotate","(JF)Z", (void*) SkMatrixGlue::postRotate__F},
+    {"native_postSkew","(JFFFF)Z", (void*) SkMatrixGlue::postSkew__FFFF},
+    {"native_postSkew","(JFF)Z", (void*) SkMatrixGlue::postSkew__FF},
+    {"native_postConcat","(JJ)Z", (void*) SkMatrixGlue::postConcat},
+    {"native_setRectToRect","(JLandroid/graphics/RectF;Landroid/graphics/RectF;I)Z", (void*) SkMatrixGlue::setRectToRect},
+    {"native_setPolyToPoly","(J[FI[FII)Z", (void*) SkMatrixGlue::setPolyToPoly},
+    {"native_invert","(JJ)Z", (void*) SkMatrixGlue::invert},
+    {"native_mapPoints","(J[FI[FIIZ)V", (void*) SkMatrixGlue::mapPoints},
+    {"native_mapRect","(JLandroid/graphics/RectF;Landroid/graphics/RectF;)Z", (void*) SkMatrixGlue::mapRect__RectFRectF},
+    {"native_mapRadius","(JF)F", (void*) SkMatrixGlue::mapRadius},
+    {"native_getValues","(J[F)V", (void*) SkMatrixGlue::getValues},
+    {"native_setValues","(J[F)V", (void*) SkMatrixGlue::setValues},
+    {"native_equals", "(JJ)Z", (void*) SkMatrixGlue::equals}
 };
 
 static jfieldID sNativeInstanceField;
@@ -409,13 +448,13 @@
         sizeof(methods) / sizeof(methods[0]));
 
     jclass clazz = env->FindClass("android/graphics/Matrix");
-    sNativeInstanceField = env->GetFieldID(clazz, "native_instance", "I");
+    sNativeInstanceField = env->GetFieldID(clazz, "native_instance", "J");
 
     return result;
 }
 
 SkMatrix* android_graphics_Matrix_getSkMatrix(JNIEnv* env, jobject matrixObj) {
-    return reinterpret_cast<SkMatrix*>(env->GetIntField(matrixObj, sNativeInstanceField));
+    return reinterpret_cast<SkMatrix*>(env->GetLongField(matrixObj, sNativeInstanceField));
 }
 
 }
diff --git a/core/jni/android/graphics/NinePatch.cpp b/core/jni/android/graphics/NinePatch.cpp
index 7e6aeae..871e24d 100644
--- a/core/jni/android/graphics/NinePatch.cpp
+++ b/core/jni/android/graphics/NinePatch.cpp
@@ -46,22 +46,22 @@
 public:
     static jboolean isNinePatchChunk(JNIEnv* env, jobject, jbyteArray obj) {
         if (NULL == obj) {
-            return false;
+            return JNI_FALSE;
         }
         if (env->GetArrayLength(obj) < (int)sizeof(Res_png_9patch)) {
-            return false;
+            return JNI_FALSE;
         }
         const jbyte* array = env->GetByteArrayElements(obj, 0);
         if (array != NULL) {
             const Res_png_9patch* chunk = reinterpret_cast<const Res_png_9patch*>(array);
             int8_t wasDeserialized = chunk->wasDeserialized;
             env->ReleaseByteArrayElements(obj, const_cast<jbyte*>(array), JNI_ABORT);
-            return wasDeserialized != -1;
+            return (wasDeserialized != -1) ? JNI_TRUE : JNI_FALSE;
         }
-        return false;
+        return JNI_FALSE;
     }
 
-    static int8_t* validateNinePatchChunk(JNIEnv* env, jobject, jint, jbyteArray obj) {
+    static jlong validateNinePatchChunk(JNIEnv* env, jobject, jlong, jbyteArray obj) {
         size_t chunkSize = env->GetArrayLength(obj);
         if (chunkSize < (int) (sizeof(Res_png_9patch))) {
             jniThrowRuntimeException(env, "Array too small for chunk.");
@@ -72,10 +72,11 @@
         // This call copies the content of the jbyteArray
         env->GetByteArrayRegion(obj, 0, chunkSize, reinterpret_cast<jbyte*>(storage));
         // Deserialize in place, return the array we just allocated
-        return (int8_t*) Res_png_9patch::deserialize(storage);
+        return reinterpret_cast<jlong>(Res_png_9patch::deserialize(storage));
     }
 
-    static void finalize(JNIEnv* env, jobject, int8_t* patch) {
+    static void finalize(JNIEnv* env, jobject, jlong patchHandle) {
+        int8_t* patch = reinterpret_cast<int8_t*>(patchHandle);
 #ifdef USE_OPENGL_RENDERER
         if (android::uirenderer::Caches::hasInstance()) {
             Res_png_9patch* p = (Res_png_9patch*) patch;
@@ -115,9 +116,13 @@
         }
     }
 
-    static void drawF(JNIEnv* env, jobject, SkCanvas* canvas, jobject boundsRectF,
-            const SkBitmap* bitmap, Res_png_9patch* chunk, const SkPaint* paint,
+    static void drawF(JNIEnv* env, jobject, jlong canvasHandle, jobject boundsRectF,
+            jlong bitmapHandle, jlong chunkHandle, jlong paintHandle,
             jint destDensity, jint srcDensity) {
+        SkCanvas* canvas       = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        Res_png_9patch* chunk  = reinterpret_cast<Res_png_9patch*>(chunkHandle);
+        const SkPaint* paint   = reinterpret_cast<SkPaint*>(paintHandle);
         SkASSERT(canvas);
         SkASSERT(boundsRectF);
         SkASSERT(bitmap);
@@ -130,9 +135,13 @@
         draw(env, canvas, bounds, bitmap, chunk, paint, destDensity, srcDensity);
     }
 
-    static void drawI(JNIEnv* env, jobject, SkCanvas* canvas, jobject boundsRect,
-            const SkBitmap* bitmap, Res_png_9patch* chunk, const SkPaint* paint,
+    static void drawI(JNIEnv* env, jobject, jlong canvasHandle, jobject boundsRect,
+            jlong bitmapHandle, jlong chunkHandle, jlong paintHandle,
             jint destDensity, jint srcDensity) {
+        SkCanvas* canvas       = reinterpret_cast<SkCanvas*>(canvasHandle);
+        const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        Res_png_9patch* chunk  = reinterpret_cast<Res_png_9patch*>(chunkHandle);
+        const SkPaint* paint   = reinterpret_cast<SkPaint*>(paintHandle);
         SkASSERT(canvas);
         SkASSERT(boundsRect);
         SkASSERT(bitmap);
@@ -144,8 +153,10 @@
         draw(env, canvas, bounds, bitmap, chunk, paint, destDensity, srcDensity);
     }
 
-    static jint getTransparentRegion(JNIEnv* env, jobject, const SkBitmap* bitmap,
-            Res_png_9patch* chunk, jobject boundsRect) {
+    static jlong getTransparentRegion(JNIEnv* env, jobject, jlong bitmapHandle,
+            jlong chunkHandle, jobject boundsRect) {
+        const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+        Res_png_9patch* chunk = reinterpret_cast<Res_png_9patch*>(chunkHandle);
         SkASSERT(bitmap);
         SkASSERT(chunk);
         SkASSERT(boundsRect);
@@ -156,7 +167,7 @@
         SkRegion* region = NULL;
         NinePatch_Draw(NULL, bounds, *bitmap, *chunk, NULL, &region);
 
-        return (jint) region;
+        return reinterpret_cast<jlong>(region);
     }
 
 };
@@ -167,11 +178,11 @@
 
 static JNINativeMethod gNinePatchMethods[] = {
     { "isNinePatchChunk", "([B)Z",                        (void*) SkNinePatchGlue::isNinePatchChunk },
-    { "validateNinePatchChunk", "(I[B)I",                 (void*) SkNinePatchGlue::validateNinePatchChunk },
-    { "nativeFinalize", "(I)V",                           (void*) SkNinePatchGlue::finalize },
-    { "nativeDraw", "(ILandroid/graphics/RectF;IIIII)V",  (void*) SkNinePatchGlue::drawF },
-    { "nativeDraw", "(ILandroid/graphics/Rect;IIIII)V",   (void*) SkNinePatchGlue::drawI },
-    { "nativeGetTransparentRegion", "(IILandroid/graphics/Rect;)I",
+    { "validateNinePatchChunk", "(J[B)J",                 (void*) SkNinePatchGlue::validateNinePatchChunk },
+    { "nativeFinalize", "(J)V",                           (void*) SkNinePatchGlue::finalize },
+    { "nativeDraw", "(JLandroid/graphics/RectF;JJJII)V",  (void*) SkNinePatchGlue::drawF },
+    { "nativeDraw", "(JLandroid/graphics/Rect;JJJII)V",   (void*) SkNinePatchGlue::drawI },
+    { "nativeGetTransparentRegion", "(JJLandroid/graphics/Rect;)J",
                                                           (void*) SkNinePatchGlue::getTransparentRegion }
 };
 
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 1ca3f3a..6c81f06 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -70,33 +70,40 @@
         AFTER, AT_OR_AFTER, BEFORE, AT_OR_BEFORE, AT
     };
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkPaint* obj) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
         delete obj;
     }
 
-    static SkPaint* init(JNIEnv* env, jobject clazz) {
+    static jlong init(JNIEnv* env, jobject clazz) {
         SkPaint* obj = new SkPaint();
         defaultSettingsForAndroid(obj);
-        return obj;
+        return reinterpret_cast<jlong>(obj);
     }
 
-    static SkPaint* intiWithPaint(JNIEnv* env, jobject clazz, SkPaint* paint) {
+    static jlong initWithPaint(JNIEnv* env, jobject clazz, jlong paintHandle) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         SkPaint* obj = new SkPaint(*paint);
-        return obj;
+        return reinterpret_cast<jlong>(obj);
     }
 
-    static void reset(JNIEnv* env, jobject clazz, SkPaint* obj) {
+    static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
         obj->reset();
         defaultSettingsForAndroid(obj);
     }
 
-    static void assign(JNIEnv* env, jobject clazz, SkPaint* dst, const SkPaint* src) {
+    static void assign(JNIEnv* env, jobject clazz, jlong dstPaintHandle, jlong srcPaintHandle) {
+        SkPaint* dst = reinterpret_cast<SkPaint*>(dstPaintHandle);
+        const SkPaint* src = reinterpret_cast<SkPaint*>(srcPaintHandle);
         *dst = *src;
     }
 
     static jint getFlags(JNIEnv* env, jobject paint) {
         NPE_CHECK_RETURN_ZERO(env, paint);
-        return GraphicsJNI::getNativePaint(env, paint)->getFlags();
+        int result;
+        result = GraphicsJNI::getNativePaint(env, paint)->getFlags();
+        return static_cast<jint>(result);
     }
 
     static void setFlags(JNIEnv* env, jobject paint, jint flags) {
@@ -156,22 +163,29 @@
         GraphicsJNI::getNativePaint(env, paint)->setDither(dither);
     }
 
-    static jint getStyle(JNIEnv* env, jobject clazz, SkPaint* obj) {
-        return obj->getStyle();
+    static jint getStyle(JNIEnv* env, jobject clazz,jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        return static_cast<jint>(obj->getStyle());
     }
 
-    static void setStyle(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Style style) {
+    static void setStyle(JNIEnv* env, jobject clazz, jlong objHandle, jint styleHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPaint::Style style = static_cast<SkPaint::Style>(styleHandle);
         obj->setStyle(style);
     }
 
     static jint getColor(JNIEnv* env, jobject paint) {
         NPE_CHECK_RETURN_ZERO(env, paint);
-        return GraphicsJNI::getNativePaint(env, paint)->getColor();
+        int color;
+        color = GraphicsJNI::getNativePaint(env, paint)->getColor();
+        return static_cast<jint>(color);
     }
 
     static jint getAlpha(JNIEnv* env, jobject paint) {
         NPE_CHECK_RETURN_ZERO(env, paint);
-        return GraphicsJNI::getNativePaint(env, paint)->getAlpha();
+        int alpha;
+        alpha = GraphicsJNI::getNativePaint(env, paint)->getAlpha();
+        return static_cast<jint>(alpha);
     }
 
     static void setColor(JNIEnv* env, jobject paint, jint color) {
@@ -204,64 +218,90 @@
         GraphicsJNI::getNativePaint(env, paint)->setStrokeMiter(SkFloatToScalar(miter));
     }
 
-    static jint getStrokeCap(JNIEnv* env, jobject clazz, SkPaint* obj) {
-        return obj->getStrokeCap();
+    static jint getStrokeCap(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        return static_cast<jint>(obj->getStrokeCap());
     }
 
-    static void setStrokeCap(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Cap cap) {
+    static void setStrokeCap(JNIEnv* env, jobject clazz, jlong objHandle, jint capHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPaint::Cap cap = static_cast<SkPaint::Cap>(capHandle);
         obj->setStrokeCap(cap);
     }
 
-    static jint getStrokeJoin(JNIEnv* env, jobject clazz, SkPaint* obj) {
-        return obj->getStrokeJoin();
+    static jint getStrokeJoin(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        return static_cast<jint>(obj->getStrokeJoin());
     }
 
-    static void setStrokeJoin(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Join join) {
+    static void setStrokeJoin(JNIEnv* env, jobject clazz, jlong objHandle, jint joinHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPaint::Join join = (SkPaint::Join) joinHandle;
         obj->setStrokeJoin(join);
     }
 
-    static jboolean getFillPath(JNIEnv* env, jobject clazz, SkPaint* obj, SkPath* src, SkPath* dst) {
-        return obj->getFillPath(*src, dst);
+    static jboolean getFillPath(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jlong dstHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
+        SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
+        return obj->getFillPath(*src, dst) ? JNI_TRUE : JNI_FALSE;
     }
 
-    static SkShader* setShader(JNIEnv* env, jobject clazz, SkPaint* obj, SkShader* shader) {
-        return obj->setShader(shader);
+    static jlong setShader(JNIEnv* env, jobject clazz, jlong objHandle, jlong shaderHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+        return reinterpret_cast<jlong>(obj->setShader(shader));
     }
 
-    static SkColorFilter* setColorFilter(JNIEnv* env, jobject clazz, SkPaint* obj, SkColorFilter* filter) {
-        return obj->setColorFilter(filter);
+    static jlong setColorFilter(JNIEnv* env, jobject clazz, jlong objHandle, jlong filterHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint *>(objHandle);
+        SkColorFilter* filter  = reinterpret_cast<SkColorFilter *>(filterHandle);
+        return reinterpret_cast<jlong>(obj->setColorFilter(filter));
     }
 
-    static SkXfermode* setXfermode(JNIEnv* env, jobject clazz, SkPaint* obj, SkXfermode* xfermode) {
-        return obj->setXfermode(xfermode);
+    static jlong setXfermode(JNIEnv* env, jobject clazz, jlong objHandle, jlong xfermodeHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkXfermode* xfermode = reinterpret_cast<SkXfermode*>(xfermodeHandle);
+        return reinterpret_cast<jlong>(obj->setXfermode(xfermode));
     }
 
-    static SkPathEffect* setPathEffect(JNIEnv* env, jobject clazz, SkPaint* obj, SkPathEffect* effect) {
-        return obj->setPathEffect(effect);
+    static jlong setPathEffect(JNIEnv* env, jobject clazz, jlong objHandle, jlong effectHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPathEffect* effect  = reinterpret_cast<SkPathEffect*>(effectHandle);
+        return reinterpret_cast<jlong>(obj->setPathEffect(effect));
     }
 
-    static SkMaskFilter* setMaskFilter(JNIEnv* env, jobject clazz, SkPaint* obj, SkMaskFilter* maskfilter) {
-        return obj->setMaskFilter(maskfilter);
+    static jlong setMaskFilter(JNIEnv* env, jobject clazz, jlong objHandle, jlong maskfilterHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkMaskFilter* maskfilter  = reinterpret_cast<SkMaskFilter*>(maskfilterHandle);
+        return reinterpret_cast<jlong>(obj->setMaskFilter(maskfilter));
     }
 
-    static SkTypeface* setTypeface(JNIEnv* env, jobject clazz, SkPaint* obj, SkTypeface* typeface) {
+    static jlong setTypeface(JNIEnv* env, jobject clazz, jlong objHandle, jlong typefaceHandle) {
 #ifndef USE_MINIKIN
-        return obj->setTypeface(typeface);
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkTypeface* typeface = reinterpret_cast<SkTypeface*>(typefaceHandle);
+        return reinterpret_cast<jlong>(obj->setTypeface(typeface));
 #else
         // TODO(raph): not yet implemented
         return NULL;
 #endif
     }
 
-    static SkRasterizer* setRasterizer(JNIEnv* env, jobject clazz, SkPaint* obj, SkRasterizer* rasterizer) {
-        return obj->setRasterizer(rasterizer);
+    static jlong setRasterizer(JNIEnv* env, jobject clazz, jlong objHandle, jlong rasterizerHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkRasterizer* rasterizer = reinterpret_cast<SkRasterizer*>(rasterizerHandle);
+        return reinterpret_cast<jlong>(obj->setRasterizer(rasterizer));
     }
 
-    static jint getTextAlign(JNIEnv* env, jobject clazz, SkPaint* obj) {
-        return obj->getTextAlign();
+    static jint getTextAlign(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        return static_cast<jint>(obj->getTextAlign());
     }
 
-    static void setTextAlign(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Align align) {
+    static void setTextAlign(JNIEnv* env, jobject clazz, jlong objHandle, jint alignHandle) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+        SkPaint::Align align = static_cast<SkPaint::Align>(alignHandle);
         obj->setTextAlign(align);
     }
 
@@ -305,7 +345,8 @@
         output[0] = '\0';
     }
 
-    static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) {
+    static void setTextLocale(JNIEnv* env, jobject clazz, jlong objHandle, jstring locale) {
+        SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
         ScopedUtfChars localeChars(env, locale);
         char langTag[ULOC_FULLNAME_CAPACITY];
         toLanguageTag(langTag, ULOC_FULLNAME_CAPACITY, localeChars.c_str());
@@ -395,7 +436,7 @@
         return descent - ascent + leading;
     }
 
-    static jfloat measureText_CIII(JNIEnv* env, jobject jpaint, jcharArray text, int index, int count,
+    static jfloat measureText_CIII(JNIEnv* env, jobject jpaint, jcharArray text, jint index, jint count,
             jint bidiFlags) {
         NPE_CHECK_RETURN_ZERO(env, jpaint);
         NPE_CHECK_RETURN_ZERO(env, text);
@@ -420,7 +461,7 @@
         return result;
     }
 
-    static jfloat measureText_StringIII(JNIEnv* env, jobject jpaint, jstring text, int start, int end,
+    static jfloat measureText_StringIII(JNIEnv* env, jobject jpaint, jstring text, jint start, jint end,
             jint bidiFlags) {
         NPE_CHECK_RETURN_ZERO(env, jpaint);
         NPE_CHECK_RETURN_ZERO(env, text);
@@ -493,8 +534,9 @@
         return count;
     }
 
-    static int getTextWidths___CIII_F(JNIEnv* env, jobject clazz, SkPaint* paint, jcharArray text,
-            int index, int count, jint bidiFlags, jfloatArray widths) {
+    static jint getTextWidths___CIII_F(JNIEnv* env, jobject clazz, jlong paintHandle, jcharArray text,
+            jint index, jint count, jint bidiFlags, jfloatArray widths) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetCharArrayElements(text, NULL);
         count = dotextwidths(env, paint, textArray + index, count, widths, bidiFlags);
         env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray),
@@ -502,8 +544,9 @@
         return count;
     }
 
-    static int getTextWidths__StringIII_F(JNIEnv* env, jobject clazz, SkPaint* paint, jstring text,
-            int start, int end, jint bidiFlags, jfloatArray widths) {
+    static jint getTextWidths__StringIII_F(JNIEnv* env, jobject clazz, jlong paintHandle, jstring text,
+            jint start, jint end, jint bidiFlags, jfloatArray widths) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         int count = dotextwidths(env, paint, textArray + start, end - start, widths, bidiFlags);
         env->ReleaseStringChars(text, textArray);
@@ -540,9 +583,10 @@
         return glyphsCount;
     }
 
-    static int getTextGlyphs__StringIIIII_C(JNIEnv* env, jobject clazz, SkPaint* paint,
+    static jint getTextGlyphs__StringIIIII_C(JNIEnv* env, jobject clazz, jlong paintHandle,
             jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
             jcharArray glyphs) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         int count = doTextGlyphs(env, paint, textArray + contextStart, start - contextStart,
                 end - start, contextEnd - contextStart, flags, glyphs);
@@ -582,9 +626,10 @@
         return totalAdvance;
     }
 
-    static float getTextRunAdvances___CIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
+    static jfloat getTextRunAdvances___CIIIII_FI(JNIEnv* env, jobject clazz, jlong paintHandle,
             jcharArray text, jint index, jint count, jint contextIndex, jint contextCount,
             jint flags, jfloatArray advances, jint advancesIndex) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         jchar* textArray = env->GetCharArrayElements(text, NULL);
         jfloat result = doTextRunAdvances(env, paint, textArray + contextIndex,
                 index - contextIndex, count, contextCount, flags, advances, advancesIndex);
@@ -592,9 +637,10 @@
         return result;
     }
 
-    static float getTextRunAdvances__StringIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
+    static jfloat getTextRunAdvances__StringIIIII_FI(JNIEnv* env, jobject clazz, jlong paintHandle,
             jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
             jfloatArray advances, jint advancesIndex) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         jfloat result = doTextRunAdvances(env, paint, textArray + contextStart,
                 start - contextStart, end - start, contextEnd - contextStart, flags,
@@ -647,8 +693,9 @@
         return pos;
     }
 
-    static jint getTextRunCursor___C(JNIEnv* env, jobject clazz, SkPaint* paint, jcharArray text,
+    static jint getTextRunCursor___C(JNIEnv* env, jobject clazz, jlong paintHandle, jcharArray text,
             jint contextStart, jint contextCount, jint flags, jint offset, jint cursorOpt) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         jchar* textArray = env->GetCharArrayElements(text, NULL);
         jint result = doTextRunCursor(env, paint, textArray, contextStart, contextCount, flags,
                 offset, cursorOpt);
@@ -656,8 +703,9 @@
         return result;
     }
 
-    static jint getTextRunCursor__String(JNIEnv* env, jobject clazz, SkPaint* paint, jstring text,
+    static jint getTextRunCursor__String(JNIEnv* env, jobject clazz, jlong paintHandle, jstring text,
             jint contextStart, jint contextEnd, jint flags, jint offset, jint cursorOpt) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         jint result = doTextRunCursor(env, paint, textArray, contextStart,
                 contextEnd - contextStart, flags, offset, cursorOpt);
@@ -670,22 +718,26 @@
         TextLayout::getTextPath(paint, text, count, bidiFlags, x, y, path);
     }
 
-    static void getTextPath___C(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
-            jcharArray text, int index, int count, jfloat x, jfloat y, SkPath* path) {
+    static void getTextPath___C(JNIEnv* env, jobject clazz, jlong paintHandle, jint bidiFlags,
+            jcharArray text, jint index, jint count, jfloat x, jfloat y, jlong pathHandle) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
         const jchar* textArray = env->GetCharArrayElements(text, NULL);
         getTextPath(env, paint, textArray + index, count, bidiFlags, x, y, path);
         env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray), JNI_ABORT);
     }
 
-    static void getTextPath__String(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
-            jstring text, int start, int end, jfloat x, jfloat y, SkPath* path) {
+    static void getTextPath__String(JNIEnv* env, jobject clazz, jlong paintHandle, jint bidiFlags,
+            jstring text, jint start, jint end, jfloat x, jfloat y, jlong pathHandle) {
+        SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
         const jchar* textArray = env->GetStringChars(text, NULL);
         getTextPath(env, paint, textArray + start, end - start, bidiFlags, x, y, path);
         env->ReleaseStringChars(text, textArray);
     }
 
     static void setShadowLayer(JNIEnv* env, jobject jpaint, jfloat radius,
-                               jfloat dx, jfloat dy, int color) {
+                               jfloat dx, jfloat dy, jint color) {
         NPE_CHECK_RETURN_VOID(env, jpaint);
 
         SkPaint* paint = GraphicsJNI::getNativePaint(env, jpaint);
@@ -721,8 +773,8 @@
         return bytes >> 1;
     }
 
-    static int breakTextC(JNIEnv* env, jobject jpaint, jcharArray jtext,
-            int index, int count, float maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
+    static jint breakTextC(JNIEnv* env, jobject jpaint, jcharArray jtext,
+            jint index, jint count, jfloat maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
         NPE_CHECK_RETURN_ZERO(env, jpaint);
         NPE_CHECK_RETURN_ZERO(env, jtext);
 
@@ -749,8 +801,8 @@
         return count;
     }
 
-    static int breakTextS(JNIEnv* env, jobject jpaint, jstring jtext,
-                bool forwards, float maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
+    static jint breakTextS(JNIEnv* env, jobject jpaint, jstring jtext,
+                jboolean forwards, jfloat maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
         NPE_CHECK_RETURN_ZERO(env, jpaint);
         NPE_CHECK_RETURN_ZERO(env, jtext);
 
@@ -781,15 +833,17 @@
         GraphicsJNI::irect_to_jrect(ir, env, bounds);
     }
 
-    static void getStringBounds(JNIEnv* env, jobject, const SkPaint* paint,
-                                jstring text, int start, int end, jint bidiFlags, jobject bounds) {
+    static void getStringBounds(JNIEnv* env, jobject, jlong paintHandle,
+                                jstring text, jint start, jint end, jint bidiFlags, jobject bounds) {
+        const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);;
         const jchar* textArray = env->GetStringChars(text, NULL);
         doTextBounds(env, textArray + start, end - start, bounds, *paint, bidiFlags);
         env->ReleaseStringChars(text, textArray);
     }
 
-    static void getCharArrayBounds(JNIEnv* env, jobject, const SkPaint* paint,
-                        jcharArray text, int index, int count, jint bidiFlags, jobject bounds) {
+    static void getCharArrayBounds(JNIEnv* env, jobject, jlong paintHandle,
+                        jcharArray text, jint index, jint count, jint bidiFlags, jobject bounds) {
+        const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
         const jchar* textArray = env->GetCharArrayElements(text, NULL);
         doTextBounds(env, textArray + index, count, bounds, *paint, bidiFlags);
         env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray),
@@ -799,11 +853,11 @@
 };
 
 static JNINativeMethod methods[] = {
-    {"finalizer", "(I)V", (void*) SkPaintGlue::finalizer},
-    {"native_init","()I", (void*) SkPaintGlue::init},
-    {"native_initWithPaint","(I)I", (void*) SkPaintGlue::intiWithPaint},
-    {"native_reset","(I)V", (void*) SkPaintGlue::reset},
-    {"native_set","(II)V", (void*) SkPaintGlue::assign},
+    {"finalizer", "(J)V", (void*) SkPaintGlue::finalizer},
+    {"native_init","()J", (void*) SkPaintGlue::init},
+    {"native_initWithPaint","(J)J", (void*) SkPaintGlue::initWithPaint},
+    {"native_reset","(J)V", (void*) SkPaintGlue::reset},
+    {"native_set","(JJ)V", (void*) SkPaintGlue::assign},
     {"getFlags","()I", (void*) SkPaintGlue::getFlags},
     {"setFlags","(I)V", (void*) SkPaintGlue::setFlags},
     {"getHinting","()I", (void*) SkPaintGlue::getHinting},
@@ -816,8 +870,8 @@
     {"setFakeBoldText","(Z)V", (void*) SkPaintGlue::setFakeBoldText},
     {"setFilterBitmap","(Z)V", (void*) SkPaintGlue::setFilterBitmap},
     {"setDither","(Z)V", (void*) SkPaintGlue::setDither},
-    {"native_getStyle","(I)I", (void*) SkPaintGlue::getStyle},
-    {"native_setStyle","(II)V", (void*) SkPaintGlue::setStyle},
+    {"native_getStyle","(J)I", (void*) SkPaintGlue::getStyle},
+    {"native_setStyle","(JI)V", (void*) SkPaintGlue::setStyle},
     {"getColor","()I", (void*) SkPaintGlue::getColor},
     {"setColor","(I)V", (void*) SkPaintGlue::setColor},
     {"getAlpha","()I", (void*) SkPaintGlue::getAlpha},
@@ -826,21 +880,21 @@
     {"setStrokeWidth","(F)V", (void*) SkPaintGlue::setStrokeWidth},
     {"getStrokeMiter","()F", (void*) SkPaintGlue::getStrokeMiter},
     {"setStrokeMiter","(F)V", (void*) SkPaintGlue::setStrokeMiter},
-    {"native_getStrokeCap","(I)I", (void*) SkPaintGlue::getStrokeCap},
-    {"native_setStrokeCap","(II)V", (void*) SkPaintGlue::setStrokeCap},
-    {"native_getStrokeJoin","(I)I", (void*) SkPaintGlue::getStrokeJoin},
-    {"native_setStrokeJoin","(II)V", (void*) SkPaintGlue::setStrokeJoin},
-    {"native_getFillPath","(III)Z", (void*) SkPaintGlue::getFillPath},
-    {"native_setShader","(II)I", (void*) SkPaintGlue::setShader},
-    {"native_setColorFilter","(II)I", (void*) SkPaintGlue::setColorFilter},
-    {"native_setXfermode","(II)I", (void*) SkPaintGlue::setXfermode},
-    {"native_setPathEffect","(II)I", (void*) SkPaintGlue::setPathEffect},
-    {"native_setMaskFilter","(II)I", (void*) SkPaintGlue::setMaskFilter},
-    {"native_setTypeface","(II)I", (void*) SkPaintGlue::setTypeface},
-    {"native_setRasterizer","(II)I", (void*) SkPaintGlue::setRasterizer},
-    {"native_getTextAlign","(I)I", (void*) SkPaintGlue::getTextAlign},
-    {"native_setTextAlign","(II)V", (void*) SkPaintGlue::setTextAlign},
-    {"native_setTextLocale","(ILjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
+    {"native_getStrokeCap","(J)I", (void*) SkPaintGlue::getStrokeCap},
+    {"native_setStrokeCap","(JI)V", (void*) SkPaintGlue::setStrokeCap},
+    {"native_getStrokeJoin","(J)I", (void*) SkPaintGlue::getStrokeJoin},
+    {"native_setStrokeJoin","(JI)V", (void*) SkPaintGlue::setStrokeJoin},
+    {"native_getFillPath","(JJJ)Z", (void*) SkPaintGlue::getFillPath},
+    {"native_setShader","(JJ)J", (void*) SkPaintGlue::setShader},
+    {"native_setColorFilter","(JJ)J", (void*) SkPaintGlue::setColorFilter},
+    {"native_setXfermode","(JJ)J", (void*) SkPaintGlue::setXfermode},
+    {"native_setPathEffect","(JJ)J", (void*) SkPaintGlue::setPathEffect},
+    {"native_setMaskFilter","(JJ)J", (void*) SkPaintGlue::setMaskFilter},
+    {"native_setTypeface","(JJ)J", (void*) SkPaintGlue::setTypeface},
+    {"native_setRasterizer","(JJ)J", (void*) SkPaintGlue::setRasterizer},
+    {"native_getTextAlign","(J)I", (void*) SkPaintGlue::getTextAlign},
+    {"native_setTextAlign","(JI)V", (void*) SkPaintGlue::setTextAlign},
+    {"native_setTextLocale","(JLjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
     {"getTextSize","()F", (void*) SkPaintGlue::getTextSize},
     {"setTextSize","(F)V", (void*) SkPaintGlue::setTextSize},
     {"getTextScaleX","()F", (void*) SkPaintGlue::getTextScaleX},
@@ -856,24 +910,24 @@
     {"native_measureText","(Ljava/lang/String;III)F", (void*) SkPaintGlue::measureText_StringIII},
     {"native_breakText","([CIIFI[F)I", (void*) SkPaintGlue::breakTextC},
     {"native_breakText","(Ljava/lang/String;ZFI[F)I", (void*) SkPaintGlue::breakTextS},
-    {"native_getTextWidths","(I[CIII[F)I", (void*) SkPaintGlue::getTextWidths___CIII_F},
-    {"native_getTextWidths","(ILjava/lang/String;III[F)I", (void*) SkPaintGlue::getTextWidths__StringIII_F},
-    {"native_getTextRunAdvances","(I[CIIIII[FI)F",
+    {"native_getTextWidths","(J[CIII[F)I", (void*) SkPaintGlue::getTextWidths___CIII_F},
+    {"native_getTextWidths","(JLjava/lang/String;III[F)I", (void*) SkPaintGlue::getTextWidths__StringIII_F},
+    {"native_getTextRunAdvances","(J[CIIIII[FI)F",
         (void*) SkPaintGlue::getTextRunAdvances___CIIIII_FI},
-    {"native_getTextRunAdvances","(ILjava/lang/String;IIIII[FI)F",
+    {"native_getTextRunAdvances","(JLjava/lang/String;IIIII[FI)F",
         (void*) SkPaintGlue::getTextRunAdvances__StringIIIII_FI},
 
 
-    {"native_getTextGlyphs","(ILjava/lang/String;IIIII[C)I",
+    {"native_getTextGlyphs","(JLjava/lang/String;IIIII[C)I",
         (void*) SkPaintGlue::getTextGlyphs__StringIIIII_C},
-    {"native_getTextRunCursor", "(I[CIIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
-    {"native_getTextRunCursor", "(ILjava/lang/String;IIIII)I",
+    {"native_getTextRunCursor", "(J[CIIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
+    {"native_getTextRunCursor", "(JLjava/lang/String;IIIII)I",
         (void*) SkPaintGlue::getTextRunCursor__String},
-    {"native_getTextPath","(II[CIIFFI)V", (void*) SkPaintGlue::getTextPath___C},
-    {"native_getTextPath","(IILjava/lang/String;IIFFI)V", (void*) SkPaintGlue::getTextPath__String},
-    {"nativeGetStringBounds", "(ILjava/lang/String;IIILandroid/graphics/Rect;)V",
+    {"native_getTextPath","(JI[CIIFFJ)V", (void*) SkPaintGlue::getTextPath___C},
+    {"native_getTextPath","(JILjava/lang/String;IIFFJ)V", (void*) SkPaintGlue::getTextPath__String},
+    {"nativeGetStringBounds", "(JLjava/lang/String;IIILandroid/graphics/Rect;)V",
                                         (void*) SkPaintGlue::getStringBounds },
-    {"nativeGetCharArrayBounds", "(I[CIIILandroid/graphics/Rect;)V",
+    {"nativeGetCharArrayBounds", "(J[CIIILandroid/graphics/Rect;)V",
                                     (void*) SkPaintGlue::getCharArrayBounds },
     {"nSetShadowLayer", "(FFFI)V", (void*)SkPaintGlue::setShadowLayer}
 };
diff --git a/core/jni/android/graphics/Path.cpp b/core/jni/android/graphics/Path.cpp
index 2126ed4..c4d728f 100644
--- a/core/jni/android/graphics/Path.cpp
+++ b/core/jni/android/graphics/Path.cpp
@@ -36,7 +36,8 @@
 class SkPathGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkPath* obj) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
 #ifdef USE_OPENGL_RENDERER
         if (android::uirenderer::Caches::hasInstance()) {
             android::uirenderer::Caches::getInstance().resourceCache.destructor(obj);
@@ -46,79 +47,96 @@
         delete obj;
     }
 
-    static SkPath* init1(JNIEnv* env, jobject clazz) {
-        return new SkPath();
+    static jlong init1(JNIEnv* env, jobject clazz) {
+        return reinterpret_cast<jlong>(new SkPath());
     }
- 
-    static SkPath* init2(JNIEnv* env, jobject clazz, SkPath* val) {
-        return new SkPath(*val);
+
+    static jlong init2(JNIEnv* env, jobject clazz, jlong valHandle) {
+        SkPath* val = reinterpret_cast<SkPath*>(valHandle);
+        return reinterpret_cast<jlong>(new SkPath(*val));
     }
- 
-    static void reset(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+    static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         obj->reset();
     }
 
-    static void rewind(JNIEnv* env, jobject clazz, SkPath* obj) {
+    static void rewind(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         obj->rewind();
     }
 
-    static void assign(JNIEnv* env, jobject clazz, SkPath* dst, const SkPath* src) {
+    static void assign(JNIEnv* env, jobject clazz, jlong dstHandle, jlong srcHandle) {
+        SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
+        const SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
         *dst = *src;
     }
- 
-    static jint getFillType(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+    static jint getFillType(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         return obj->getFillType();
     }
  
-    static void setFillType(JNIEnv* env, jobject clazz, SkPath* path, SkPath::FillType ft) {
+    static void setFillType(JNIEnv* env, jobject clazz, jlong pathHandle, jint ftHandle) {
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+        SkPath::FillType ft = static_cast<SkPath::FillType>(ftHandle);
         path->setFillType(ft);
     }
- 
-    static jboolean isEmpty(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+    static jboolean isEmpty(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         return obj->isEmpty();
     }
  
-    static jboolean isRect(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect) {
+    static jboolean isRect(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect) {
         SkRect rect_;
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         jboolean result = obj->isRect(&rect_);
         GraphicsJNI::rect_to_jrectf(rect_, env, rect);
         return result;
     }
  
-    static void computeBounds(JNIEnv* env, jobject clazz, SkPath* obj, jobject bounds) {
+    static void computeBounds(JNIEnv* env, jobject clazz, jlong objHandle, jobject bounds) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         const SkRect& bounds_ = obj->getBounds();
         GraphicsJNI::rect_to_jrectf(bounds_, env, bounds);
     }
  
-    static void incReserve(JNIEnv* env, jobject clazz, SkPath* obj, jint extraPtCount) {
+    static void incReserve(JNIEnv* env, jobject clazz, jlong objHandle, jint extraPtCount) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         obj->incReserve(extraPtCount);
     }
  
-    static void moveTo__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y) {
+    static void moveTo__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar x_ = SkFloatToScalar(x);
         SkScalar y_ = SkFloatToScalar(y);
         obj->moveTo(x_, y_);
     }
  
-    static void rMoveTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+    static void rMoveTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->rMoveTo(dx_, dy_);
     }
  
-    static void lineTo__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y) {
+    static void lineTo__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar x_ = SkFloatToScalar(x);
         SkScalar y_ = SkFloatToScalar(y);
         obj->lineTo(x_, y_);
     }
  
-    static void rLineTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+    static void rLineTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->rLineTo(dx_, dy_);
     }
  
-    static void quadTo__FFFF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
+    static void quadTo__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar x1_ = SkFloatToScalar(x1);
         SkScalar y1_ = SkFloatToScalar(y1);
         SkScalar x2_ = SkFloatToScalar(x2);
@@ -126,7 +144,8 @@
         obj->quadTo(x1_, y1_, x2_, y2_);
     }
  
-    static void rQuadTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2) {
+    static void rQuadTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar dx1_ = SkFloatToScalar(dx1);
         SkScalar dy1_ = SkFloatToScalar(dy1);
         SkScalar dx2_ = SkFloatToScalar(dx2);
@@ -134,7 +153,8 @@
         obj->rQuadTo(dx1_, dy1_, dx2_, dy2_);
     }
  
-    static void cubicTo__FFFFFF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+    static void cubicTo__FFFFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar x1_ = SkFloatToScalar(x1);
         SkScalar y1_ = SkFloatToScalar(y1);
         SkScalar x2_ = SkFloatToScalar(x2);
@@ -144,7 +164,8 @@
         obj->cubicTo(x1_, y1_, x2_, y2_, x3_, y3_);
     }
  
-    static void rCubicTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+    static void rCubicTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar x1_ = SkFloatToScalar(x1);
         SkScalar y1_ = SkFloatToScalar(y1);
         SkScalar x2_ = SkFloatToScalar(x2);
@@ -154,7 +175,8 @@
         obj->rCubicTo(x1_, y1_, x2_, y2_, x3_, y3_);
     }
  
-    static void arcTo(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo) {
+    static void arcTo(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkRect oval_;
         GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
         SkScalar startAngle_ = SkFloatToScalar(startAngle);
@@ -162,17 +184,22 @@
         obj->arcTo(oval_, startAngle_, sweepAngle_, forceMoveTo);
     }
  
-    static void close(JNIEnv* env, jobject clazz, SkPath* obj) {
+    static void close(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         obj->close();
     }
  
-    static void addRect__RectFI(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect, SkPath::Direction dir) {
+    static void addRect__RectFI(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect, jint dirHandle) {
         SkRect rect_;
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
         obj->addRect(rect_, dir);
     }
  
-    static void addRect__FFFFI(JNIEnv* env, jobject clazz, SkPath* obj, jfloat left, jfloat top, jfloat right, jfloat bottom, SkPath::Direction dir) {
+    static void addRect__FFFFI(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         SkScalar left_ = SkFloatToScalar(left);
         SkScalar top_ = SkFloatToScalar(top);
         SkScalar right_ = SkFloatToScalar(right);
@@ -180,39 +207,48 @@
         obj->addRect(left_, top_, right_, bottom_, dir);
     }
  
-    static void addOval(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, SkPath::Direction dir) {
+    static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jint dirHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         SkRect oval_;
         GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
         obj->addOval(oval_, dir);
     }
  
-    static void addCircle(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y, jfloat radius, SkPath::Direction dir) {
+    static void addCircle(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y, jfloat radius, jint dirHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         SkScalar x_ = SkFloatToScalar(x);
         SkScalar y_ = SkFloatToScalar(y);
         SkScalar radius_ = SkFloatToScalar(radius);
         obj->addCircle(x_, y_, radius_, dir);
     }
  
-    static void addArc(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, jfloat startAngle, jfloat sweepAngle) {
+    static void addArc(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jfloat startAngle, jfloat sweepAngle) {
         SkRect oval_;
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
         SkScalar startAngle_ = SkFloatToScalar(startAngle);
         SkScalar sweepAngle_ = SkFloatToScalar(sweepAngle);
         obj->addArc(oval_, startAngle_, sweepAngle_);
     }
  
-    static void addRoundRectXY(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect,
-            jfloat rx, jfloat ry, SkPath::Direction dir) {
+    static void addRoundRectXY(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect,
+            jfloat rx, jfloat ry, jint dirHandle) {
         SkRect rect_;
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
         SkScalar rx_ = SkFloatToScalar(rx);
         SkScalar ry_ = SkFloatToScalar(ry);
         obj->addRoundRect(rect_, rx_, ry_, dir);
     }
     
-    static void addRoundRect8(JNIEnv* env, jobject, SkPath* obj, jobject rect,
-            jfloatArray array, SkPath::Direction dir) {
+    static void addRoundRect8(JNIEnv* env, jobject, jlong objHandle, jobject rect,
+            jfloatArray array, jint dirHandle) {
         SkRect rect_;
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
         GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
         AutoJavaFloatArray  afa(env, array, 8);
         const float* src = afa.ptr();
@@ -224,48 +260,68 @@
         obj->addRoundRect(rect_, dst, dir);
     }
     
-    static void addPath__PathFF(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src, jfloat dx, jfloat dy) {
+    static void addPath__PathFF(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jfloat dx, jfloat dy) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->addPath(*src, dx_, dy_);
     }
  
-    static void addPath__Path(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src) {
+    static void addPath__Path(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
         obj->addPath(*src);
     }
  
-    static void addPath__PathMatrix(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src, SkMatrix* matrix) {
+    static void addPath__PathMatrix(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jlong matrixHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         obj->addPath(*src, *matrix);
     }
  
-    static void offset__FFPath(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy, SkPath* dst) {
+    static void offset__FFPath(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy, jlong dstHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->offset(dx_, dy_, dst);
     }
  
-    static void offset__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+    static void offset__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->offset(dx_, dy_);
     }
 
-    static void setLastPoint(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+    static void setLastPoint(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
         SkScalar dx_ = SkFloatToScalar(dx);
         SkScalar dy_ = SkFloatToScalar(dy);
         obj->setLastPt(dx_, dy_);
     }
  
-    static void transform__MatrixPath(JNIEnv* env, jobject clazz, SkPath* obj, SkMatrix* matrix, SkPath* dst) {
+    static void transform__MatrixPath(JNIEnv* env, jobject clazz, jlong objHandle, jlong matrixHandle, jlong dstHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+        SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
         obj->transform(*matrix, dst);
     }
  
-    static void transform__Matrix(JNIEnv* env, jobject clazz, SkPath* obj, SkMatrix* matrix) {
+    static void transform__Matrix(JNIEnv* env, jobject clazz, jlong objHandle, jlong matrixHandle) {
+        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+        SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
         obj->transform(*matrix);
     }
 
-    static jboolean op(JNIEnv* env, jobject clazz, SkPath* p1, SkPath* p2, SkPathOp op, SkPath* r) {
-         return Op(*p1, *p2, op, r);
+    static jboolean op(JNIEnv* env, jobject clazz, jlong p1Handle, jlong p2Handle, jint opHandle, jlong rHandle) {
+        SkPath* p1  = reinterpret_cast<SkPath*>(p1Handle);
+        SkPath* p2  = reinterpret_cast<SkPath*>(p2Handle);
+        SkPathOp op = static_cast<SkPathOp>(opHandle);
+        SkPath* r   = reinterpret_cast<SkPath*>(rHandle);
+        return Op(*p1, *p2, op, r);
      }
 
     typedef SkPoint (*bezierCalculation)(float t, const SkPoint* points);
@@ -421,8 +477,9 @@
     // Note that more than one point may have the same length along the path in
     // the case of a move.
     // NULL can be returned if the Path is empty.
-    static jfloatArray approximate(JNIEnv* env, jclass, SkPath* path, float acceptableError)
+    static jfloatArray approximate(JNIEnv* env, jclass, jlong pathHandle, float acceptableError)
     {
+        SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
         SkASSERT(path);
         SkPath::Iter pathIter(*path, false);
         SkPath::Verb verb;
@@ -459,8 +516,11 @@
         return result;
     }
 
-    static SkPathMeasure* trim(JNIEnv* env, jobject clazz, SkPath* inPath, SkPath* outPath,
-            SkPathMeasure* pathMeasure, jfloat trimStart, jfloat trimEnd, jfloat trimOffset) {
+    static SkPathMeasure* trim(JNIEnv* env, jobject clazz, jlong inPathPtr, jlong outPathPtr,
+            jlong pathMeasurePtr, jfloat trimStart, jfloat trimEnd, jfloat trimOffset) {
+        SkPath* inPath = reinterpret_cast<SkPath*>(inPathPtr);
+        SkPath* outPath = reinterpret_cast<SkPath*>(outPathPtr);
+        SkPathMeasure* pathMeasure = reinterpret_cast<SkPathMeasure*>(pathMeasurePtr);
         if (trimStart == 0 && trimEnd == 1) {
             if (outPath != NULL) {
                 *outPath = *inPath;
@@ -500,53 +560,53 @@
         return pathMeasure;
     }
 
-    static void destroyMeasure(JNIEnv* env, jobject clazz, SkPathMeasure* measure) {
-        delete measure;
+    static void destroyMeasure(JNIEnv* env, jobject clazz, jlong measure) {
+        delete reinterpret_cast<SkPathMeasure*>(measure);
     }
 };
 
 static JNINativeMethod methods[] = {
-    {"finalizer", "(I)V", (void*) SkPathGlue::finalizer},
-    {"init1","()I", (void*) SkPathGlue::init1},
-    {"init2","(I)I", (void*) SkPathGlue::init2},
-    {"native_reset","(I)V", (void*) SkPathGlue::reset},
-    {"native_rewind","(I)V", (void*) SkPathGlue::rewind},
-    {"native_set","(II)V", (void*) SkPathGlue::assign},
-    {"native_getFillType","(I)I", (void*) SkPathGlue::getFillType},
-    {"native_setFillType","(II)V", (void*) SkPathGlue::setFillType},
-    {"native_isEmpty","(I)Z", (void*) SkPathGlue::isEmpty},
-    {"native_isRect","(ILandroid/graphics/RectF;)Z", (void*) SkPathGlue::isRect},
-    {"native_computeBounds","(ILandroid/graphics/RectF;)V", (void*) SkPathGlue::computeBounds},
-    {"native_incReserve","(II)V", (void*) SkPathGlue::incReserve},
-    {"native_moveTo","(IFF)V", (void*) SkPathGlue::moveTo__FF},
-    {"native_rMoveTo","(IFF)V", (void*) SkPathGlue::rMoveTo},
-    {"native_lineTo","(IFF)V", (void*) SkPathGlue::lineTo__FF},
-    {"native_rLineTo","(IFF)V", (void*) SkPathGlue::rLineTo},
-    {"native_quadTo","(IFFFF)V", (void*) SkPathGlue::quadTo__FFFF},
-    {"native_rQuadTo","(IFFFF)V", (void*) SkPathGlue::rQuadTo},
-    {"native_cubicTo","(IFFFFFF)V", (void*) SkPathGlue::cubicTo__FFFFFF},
-    {"native_rCubicTo","(IFFFFFF)V", (void*) SkPathGlue::rCubicTo},
-    {"native_arcTo","(ILandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo},
-    {"native_close","(I)V", (void*) SkPathGlue::close},
-    {"native_addRect","(ILandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI},
-    {"native_addRect","(IFFFFI)V", (void*) SkPathGlue::addRect__FFFFI},
-    {"native_addOval","(ILandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval},
-    {"native_addCircle","(IFFFI)V", (void*) SkPathGlue::addCircle},
-    {"native_addArc","(ILandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc},
-    {"native_addRoundRect","(ILandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY},
-    {"native_addRoundRect","(ILandroid/graphics/RectF;[FI)V", (void*) SkPathGlue::addRoundRect8},
-    {"native_addPath","(IIFF)V", (void*) SkPathGlue::addPath__PathFF},
-    {"native_addPath","(II)V", (void*) SkPathGlue::addPath__Path},
-    {"native_addPath","(III)V", (void*) SkPathGlue::addPath__PathMatrix},
-    {"native_offset","(IFFI)V", (void*) SkPathGlue::offset__FFPath},
-    {"native_offset","(IFF)V", (void*) SkPathGlue::offset__FF},
-    {"native_setLastPoint","(IFF)V", (void*) SkPathGlue::setLastPoint},
-    {"native_transform","(III)V", (void*) SkPathGlue::transform__MatrixPath},
-    {"native_transform","(II)V", (void*) SkPathGlue::transform__Matrix},
-    {"native_op","(IIII)Z", (void*) SkPathGlue::op},
-    {"native_approximate", "(IF)[F", (void*) SkPathGlue::approximate},
-    {"native_destroyMeasure","(I)V", (void*) SkPathGlue::destroyMeasure},
-    {"native_trim","(IIIFFF)I", (void*) SkPathGlue::trim},
+    {"finalizer", "(J)V", (void*) SkPathGlue::finalizer},
+    {"init1","()J", (void*) SkPathGlue::init1},
+    {"init2","(J)J", (void*) SkPathGlue::init2},
+    {"native_reset","(J)V", (void*) SkPathGlue::reset},
+    {"native_rewind","(J)V", (void*) SkPathGlue::rewind},
+    {"native_set","(JJ)V", (void*) SkPathGlue::assign},
+    {"native_getFillType","(J)I", (void*) SkPathGlue::getFillType},
+    {"native_setFillType","(JI)V", (void*) SkPathGlue::setFillType},
+    {"native_isEmpty","(J)Z", (void*) SkPathGlue::isEmpty},
+    {"native_isRect","(JLandroid/graphics/RectF;)Z", (void*) SkPathGlue::isRect},
+    {"native_computeBounds","(JLandroid/graphics/RectF;)V", (void*) SkPathGlue::computeBounds},
+    {"native_incReserve","(JI)V", (void*) SkPathGlue::incReserve},
+    {"native_moveTo","(JFF)V", (void*) SkPathGlue::moveTo__FF},
+    {"native_rMoveTo","(JFF)V", (void*) SkPathGlue::rMoveTo},
+    {"native_lineTo","(JFF)V", (void*) SkPathGlue::lineTo__FF},
+    {"native_rLineTo","(JFF)V", (void*) SkPathGlue::rLineTo},
+    {"native_quadTo","(JFFFF)V", (void*) SkPathGlue::quadTo__FFFF},
+    {"native_rQuadTo","(JFFFF)V", (void*) SkPathGlue::rQuadTo},
+    {"native_cubicTo","(JFFFFFF)V", (void*) SkPathGlue::cubicTo__FFFFFF},
+    {"native_rCubicTo","(JFFFFFF)V", (void*) SkPathGlue::rCubicTo},
+    {"native_arcTo","(JLandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo},
+    {"native_close","(J)V", (void*) SkPathGlue::close},
+    {"native_addRect","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI},
+    {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect__FFFFI},
+    {"native_addOval","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval},
+    {"native_addCircle","(JFFFI)V", (void*) SkPathGlue::addCircle},
+    {"native_addArc","(JLandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc},
+    {"native_addRoundRect","(JLandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY},
+    {"native_addRoundRect","(JLandroid/graphics/RectF;[FI)V", (void*) SkPathGlue::addRoundRect8},
+    {"native_addPath","(JJFF)V", (void*) SkPathGlue::addPath__PathFF},
+    {"native_addPath","(JJ)V", (void*) SkPathGlue::addPath__Path},
+    {"native_addPath","(JJJ)V", (void*) SkPathGlue::addPath__PathMatrix},
+    {"native_offset","(JFFJ)V", (void*) SkPathGlue::offset__FFPath},
+    {"native_offset","(JFF)V", (void*) SkPathGlue::offset__FF},
+    {"native_setLastPoint","(JFF)V", (void*) SkPathGlue::setLastPoint},
+    {"native_transform","(JJJ)V", (void*) SkPathGlue::transform__MatrixPath},
+    {"native_transform","(JJ)V", (void*) SkPathGlue::transform__Matrix},
+    {"native_op","(JJIJ)Z", (void*) SkPathGlue::op},
+    {"native_approximate", "(JF)[F", (void*) SkPathGlue::approximate},
+    {"native_destroyMeasure","(J)V", (void*) SkPathGlue::destroyMeasure},
+    {"native_trim","(JJJFFF)I", (void*) SkPathGlue::trim},
 };
 
 int register_android_graphics_Path(JNIEnv* env) {
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp
index 0503614..2803758 100644
--- a/core/jni/android/graphics/PathEffect.cpp
+++ b/core/jni/android/graphics/PathEffect.cpp
@@ -11,22 +11,29 @@
 class SkPathEffectGlue {
 public:
 
-    static void destructor(JNIEnv* env, jobject, SkPathEffect* effect) {
+    static void destructor(JNIEnv* env, jobject, jlong effectHandle) {
+        SkPathEffect* effect = reinterpret_cast<SkPathEffect*>(effectHandle);
         SkSafeUnref(effect);
     }
 
-    static SkPathEffect* Compose_constructor(JNIEnv* env, jobject,
-                                   SkPathEffect* outer, SkPathEffect* inner) {
-        return new SkComposePathEffect(outer, inner);
+    static jlong Compose_constructor(JNIEnv* env, jobject,
+                                     jlong outerHandle, jlong innerHandle) {
+        SkPathEffect* outer = reinterpret_cast<SkPathEffect*>(outerHandle);
+        SkPathEffect* inner = reinterpret_cast<SkPathEffect*>(innerHandle);
+        SkPathEffect* effect = new SkComposePathEffect(outer, inner);
+        return reinterpret_cast<jlong>(effect);
     }
 
-    static SkPathEffect* Sum_constructor(JNIEnv* env, jobject,
-                                  SkPathEffect* first, SkPathEffect* second) {
-        return new SkSumPathEffect(first, second);
+    static jlong Sum_constructor(JNIEnv* env, jobject,
+                                 jlong firstHandle, jlong secondHandle) {
+        SkPathEffect* first = reinterpret_cast<SkPathEffect*>(firstHandle);
+        SkPathEffect* second = reinterpret_cast<SkPathEffect*>(secondHandle);
+        SkPathEffect* effect = new SkSumPathEffect(first, second);
+        return reinterpret_cast<jlong>(effect);
     }
 
-    static SkPathEffect* Dash_constructor(JNIEnv* env, jobject,
-                                      jfloatArray intervalArray, float phase) {
+    static jlong Dash_constructor(JNIEnv* env, jobject,
+                                      jfloatArray intervalArray, jfloat phase) {
         AutoJavaFloatArray autoInterval(env, intervalArray);
         int     count = autoInterval.length() & ~1;  // even number
         float*  values = autoInterval.ptr();
@@ -36,24 +43,29 @@
         for (int i = 0; i < count; i++) {
             intervals[i] = SkFloatToScalar(values[i]);
         }
-        return new SkDashPathEffect(intervals, count, SkFloatToScalar(phase));
+        SkPathEffect* effect = new SkDashPathEffect(intervals, count, SkFloatToScalar(phase));
+        return reinterpret_cast<jlong>(effect);
     }
 
-    static SkPathEffect* OneD_constructor(JNIEnv* env, jobject,
-                  const SkPath* shape, float advance, float phase, int style) {
+    static jlong OneD_constructor(JNIEnv* env, jobject,
+                  jlong shapeHandle, jfloat advance, jfloat phase, jint style) {
+        const SkPath* shape = reinterpret_cast<SkPath*>(shapeHandle);
         SkASSERT(shape != NULL);
-        return new SkPath1DPathEffect(*shape, SkFloatToScalar(advance),
+        SkPathEffect* effect = new SkPath1DPathEffect(*shape, SkFloatToScalar(advance),
                      SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style);
+        return reinterpret_cast<jlong>(effect);
     }
 
-    static SkPathEffect* Corner_constructor(JNIEnv* env, jobject, float radius){
-        return new SkCornerPathEffect(SkFloatToScalar(radius));
+    static jlong Corner_constructor(JNIEnv* env, jobject, jfloat radius){
+        SkPathEffect* effect = new SkCornerPathEffect(SkFloatToScalar(radius));
+        return reinterpret_cast<jlong>(effect);
     }
 
-    static SkPathEffect* Discrete_constructor(JNIEnv* env, jobject,
-                                              float length, float deviation) {
-        return new SkDiscretePathEffect(SkFloatToScalar(length),
+    static jlong Discrete_constructor(JNIEnv* env, jobject,
+                                      jfloat length, jfloat deviation) {
+        SkPathEffect* effect = new SkDiscretePathEffect(SkFloatToScalar(length),
                                         SkFloatToScalar(deviation));
+        return reinterpret_cast<jlong>(effect);
     }
 
 };
@@ -61,31 +73,31 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 static JNINativeMethod gPathEffectMethods[] = {
-    { "nativeDestructor", "(I)V", (void*)SkPathEffectGlue::destructor }
+    { "nativeDestructor", "(J)V", (void*)SkPathEffectGlue::destructor }
 };
 
 static JNINativeMethod gComposePathEffectMethods[] = {
-    { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Compose_constructor }
+    { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Compose_constructor }
 };
 
 static JNINativeMethod gSumPathEffectMethods[] = {
-    { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Sum_constructor }
+    { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Sum_constructor }
 };
 
 static JNINativeMethod gDashPathEffectMethods[] = {
-    { "nativeCreate", "([FF)I", (void*)SkPathEffectGlue::Dash_constructor }
+    { "nativeCreate", "([FF)J", (void*)SkPathEffectGlue::Dash_constructor }
 };
 
 static JNINativeMethod gPathDashPathEffectMethods[] = {
-    { "nativeCreate", "(IFFI)I", (void*)SkPathEffectGlue::OneD_constructor }
+    { "nativeCreate", "(JFFI)J", (void*)SkPathEffectGlue::OneD_constructor }
 };
 
 static JNINativeMethod gCornerPathEffectMethods[] = {
-    { "nativeCreate", "(F)I", (void*)SkPathEffectGlue::Corner_constructor }
+    { "nativeCreate", "(F)J", (void*)SkPathEffectGlue::Corner_constructor }
 };
 
 static JNINativeMethod gDiscretePathEffectMethods[] = {
-    { "nativeCreate", "(FF)I", (void*)SkPathEffectGlue::Discrete_constructor }
+    { "nativeCreate", "(FF)J", (void*)SkPathEffectGlue::Discrete_constructor }
 };
 
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index fcf22b8..bac8ef7 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -28,71 +28,80 @@
 
 class SkPictureGlue {
 public:
-    static SkPicture* newPicture(JNIEnv* env, jobject, const SkPicture* src) {
+    static jlong newPicture(JNIEnv* env, jobject, jlong srcHandle) {
+        const SkPicture* src = reinterpret_cast<SkPicture*>(srcHandle);
         if (src) {
-            return new SkPicture(*src);
+            return reinterpret_cast<jlong>(new SkPicture(*src));
         } else {
-            return new SkPicture;
+            return reinterpret_cast<jlong>(new SkPicture);
         }
     }
-    
-    static SkPicture* deserialize(JNIEnv* env, jobject, jobject jstream,
-                                  jbyteArray jstorage) {
+
+    static jlong deserialize(JNIEnv* env, jobject, jobject jstream,
+                             jbyteArray jstorage) {
         SkPicture* picture = NULL;
         SkStream* strm = CreateJavaInputStreamAdaptor(env, jstream, jstorage);
         if (strm) {
             picture = SkPicture::CreateFromStream(strm);
             delete strm;
         }
-        return picture;
+        return reinterpret_cast<jlong>(picture);
     }
-    
-    static void killPicture(JNIEnv* env, jobject, SkPicture* picture) {
+
+    static void killPicture(JNIEnv* env, jobject, jlong pictureHandle) {
+        SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
         SkASSERT(picture);
         picture->unref();
     }
-    
-    static void draw(JNIEnv* env, jobject, SkCanvas* canvas,
-                            SkPicture* picture) {
+
+    static void draw(JNIEnv* env, jobject, jlong canvasHandle,
+                            jlong pictureHandle) {
+        SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+        SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
         SkASSERT(canvas);
         SkASSERT(picture);
         picture->draw(canvas);
     }
-    
-    static bool serialize(JNIEnv* env, jobject, SkPicture* picture,
+
+    static jboolean serialize(JNIEnv* env, jobject, jlong pictureHandle,
                           jobject jstream, jbyteArray jstorage) {
+        SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
         SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
         
         if (NULL != strm) {
             picture->serialize(strm);
             delete strm;
-            return true;
+            return JNI_TRUE;
         }
-        return false;
+        return JNI_FALSE;
     }
-        
-    static int getWidth(JNIEnv* env, jobject jpic) {
+
+    static jint getWidth(JNIEnv* env, jobject jpic) {
         NPE_CHECK_RETURN_ZERO(env, jpic);
-        return GraphicsJNI::getNativePicture(env, jpic)->width();
+        int width = GraphicsJNI::getNativePicture(env, jpic)->width();
+        return static_cast<jint>(width);
     }
-    
-    static int getHeight(JNIEnv* env, jobject jpic) {
+
+    static jint getHeight(JNIEnv* env, jobject jpic) {
         NPE_CHECK_RETURN_ZERO(env, jpic);
-        return GraphicsJNI::getNativePicture(env, jpic)->height();
+        int height = GraphicsJNI::getNativePicture(env, jpic)->height();
+        return static_cast<jint>(height);
     }
-    
-    static SkCanvas* beginRecording(JNIEnv* env, jobject, SkPicture* pict,
-                                    int w, int h) {
+
+    static jlong beginRecording(JNIEnv* env, jobject, jlong pictHandle,
+                                    jint w, jint h) {
+        SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
         // beginRecording does not ref its return value, it just returns it.
         SkCanvas* canvas = pict->beginRecording(w, h);
         // the java side will wrap this guy in a Canvas.java, which will call
         // unref in its finalizer, so we have to ref it here, so that both that
         // Canvas.java and our picture can both be owners
         canvas->ref();
-        return canvas;
+        return reinterpret_cast<jlong>(canvas);
     }
-    
-    static void endRecording(JNIEnv* env, jobject, SkPicture* pict) {
+
+    static void endRecording(JNIEnv* env, jobject, jlong pictHandle) {
+        SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
         pict->endRecording();
     }
 };
@@ -100,30 +109,30 @@
 static JNINativeMethod gPictureMethods[] = {
     {"getWidth", "()I", (void*) SkPictureGlue::getWidth},
     {"getHeight", "()I", (void*) SkPictureGlue::getHeight},
-    {"nativeConstructor", "(I)I", (void*) SkPictureGlue::newPicture},
-    {"nativeCreateFromStream", "(Ljava/io/InputStream;[B)I", (void*)SkPictureGlue::deserialize},
-    {"nativeBeginRecording", "(III)I", (void*) SkPictureGlue::beginRecording},
-    {"nativeEndRecording", "(I)V", (void*) SkPictureGlue::endRecording},
-    {"nativeDraw", "(II)V", (void*) SkPictureGlue::draw},
-    {"nativeWriteToStream", "(ILjava/io/OutputStream;[B)Z", (void*)SkPictureGlue::serialize},
-    {"nativeDestructor","(I)V", (void*) SkPictureGlue::killPicture}
+    {"nativeConstructor", "(J)J", (void*) SkPictureGlue::newPicture},
+    {"nativeCreateFromStream", "(Ljava/io/InputStream;[B)J", (void*)SkPictureGlue::deserialize},
+    {"nativeBeginRecording", "(JII)J", (void*) SkPictureGlue::beginRecording},
+    {"nativeEndRecording", "(J)V", (void*) SkPictureGlue::endRecording},
+    {"nativeDraw", "(JJ)V", (void*) SkPictureGlue::draw},
+    {"nativeWriteToStream", "(JLjava/io/OutputStream;[B)Z", (void*)SkPictureGlue::serialize},
+    {"nativeDestructor","(J)V", (void*) SkPictureGlue::killPicture}
 };
 
 #include <android_runtime/AndroidRuntime.h>
-    
+
 #define REG(env, name, array) \
     result = android::AndroidRuntime::registerNativeMethods(env, name, array, \
     SK_ARRAY_COUNT(array));  \
     if (result < 0) return result
-    
+
 int register_android_graphics_Picture(JNIEnv* env) {
     int result;
-    
+
     REG(env, "android/graphics/Picture", gPictureMethods);
-    
+
     return result;
 }
-    
+
 }
 
 
diff --git a/core/jni/android/graphics/PorterDuff.cpp b/core/jni/android/graphics/PorterDuff.cpp
index 47de601..8a49eb5 100644
--- a/core/jni/android/graphics/PorterDuff.cpp
+++ b/core/jni/android/graphics/PorterDuff.cpp
@@ -31,15 +31,15 @@
 class SkPorterDuffGlue {
 public:
 
-    static SkXfermode* CreateXfermode(JNIEnv* env, jobject,
-                                      SkPorterDuff::Mode mode) {
-        return SkPorterDuff::CreateXfermode(mode);
+    static jlong CreateXfermode(JNIEnv* env, jobject, jint modeHandle) {
+        SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
+        return reinterpret_cast<jlong>(SkPorterDuff::CreateXfermode(mode));
     }
  
 };
 
 static JNINativeMethod methods[] = {
-    {"nativeCreateXfermode","(I)I", (void*) SkPorterDuffGlue::CreateXfermode},
+    {"nativeCreateXfermode","(I)J", (void*) SkPorterDuffGlue::CreateXfermode},
 };
 
 int register_android_graphics_PorterDuff(JNIEnv* env) {
diff --git a/core/jni/android/graphics/Rasterizer.cpp b/core/jni/android/graphics/Rasterizer.cpp
index 4e1b36a..b6450d0 100644
--- a/core/jni/android/graphics/Rasterizer.cpp
+++ b/core/jni/android/graphics/Rasterizer.cpp
@@ -31,14 +31,15 @@
 class SkRasterizerGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject clazz, SkRasterizer* obj) {
+    static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+        SkRasterizer* obj = reinterpret_cast<SkRasterizer *>(objHandle);
         SkSafeUnref(obj);
     }
  
 };
 
 static JNINativeMethod methods[] = {
-    {"finalizer", "(I)V", (void*) SkRasterizerGlue::finalizer}
+    {"finalizer", "(J)V", (void*) SkRasterizerGlue::finalizer}
 };
 
 int register_android_graphics_Rasterizer(JNIEnv* env) {
diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp
index ded2186..bcf1273 100644
--- a/core/jni/android/graphics/Region.cpp
+++ b/core/jni/android/graphics/Region.cpp
@@ -29,95 +29,131 @@
 
 static jfieldID gRegion_nativeInstanceFieldID;
 
+static inline jboolean boolTojboolean(bool value) {
+    return value ? JNI_TRUE : JNI_FALSE;
+}
+
 static inline SkRegion* GetSkRegion(JNIEnv* env, jobject regionObject) {
-    SkRegion* rgn = (SkRegion*)env->GetIntField(regionObject, gRegion_nativeInstanceFieldID);
-    SkASSERT(rgn != NULL);
-    return rgn;
+    jlong regionHandle = env->GetLongField(regionObject, gRegion_nativeInstanceFieldID);
+    SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
+    SkASSERT(region != NULL);
+    return region;
 }
 
-static SkRegion* Region_constructor(JNIEnv* env, jobject) {
-    return new SkRegion;
+static jlong Region_constructor(JNIEnv* env, jobject) {
+    return reinterpret_cast<jlong>(new SkRegion);
 }
 
-static void Region_destructor(JNIEnv* env, jobject, SkRegion* region) {
+static void Region_destructor(JNIEnv* env, jobject, jlong regionHandle) {
+    SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     SkASSERT(region);
     delete region;
 }
 
-static void Region_setRegion(JNIEnv* env, jobject, SkRegion* dst, const SkRegion* src) {
+static void Region_setRegion(JNIEnv* env, jobject, jlong dstHandle, jlong srcHandle) {
+    SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+    const SkRegion* src = reinterpret_cast<SkRegion*>(srcHandle);
     SkASSERT(dst && src);
     *dst = *src;
 }
 
-static jboolean Region_setRect(JNIEnv* env, jobject, SkRegion* dst, int left, int top, int right, int bottom) {
-    return dst->setRect(left, top, right, bottom);
+static jboolean Region_setRect(JNIEnv* env, jobject, jlong dstHandle, jint left, jint top, jint right, jint bottom) {
+    SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+    bool result = dst->setRect(left, top, right, bottom);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_setPath(JNIEnv* env, jobject, SkRegion* dst,
-                               const SkPath* path, const SkRegion* clip) {
+static jboolean Region_setPath(JNIEnv* env, jobject, jlong dstHandle,
+                               jlong pathHandle, jlong clipHandle) {
+    SkRegion*       dst  = reinterpret_cast<SkRegion*>(dstHandle);
+    const SkPath*   path = reinterpret_cast<SkPath*>(pathHandle);
+    const SkRegion* clip = reinterpret_cast<SkRegion*>(clipHandle);
     SkASSERT(dst && path && clip);
-    return dst->setPath(*path, *clip);
+    bool result = dst->setPath(*path, *clip);
+    return boolTojboolean(result);
+
 }
 
-static jboolean Region_getBounds(JNIEnv* env, jobject, SkRegion* region, jobject rectBounds) {
+static jboolean Region_getBounds(JNIEnv* env, jobject, jlong regionHandle, jobject rectBounds) {
+    SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     GraphicsJNI::irect_to_jrect(region->getBounds(), env, rectBounds);
-    return !region->isEmpty();
+    bool result = !region->isEmpty();
+    return boolTojboolean(result);
 }
 
-static jboolean Region_getBoundaryPath(JNIEnv* env, jobject, const SkRegion* region, SkPath* path) {
-    return region->getBoundaryPath(path);
+static jboolean Region_getBoundaryPath(JNIEnv* env, jobject, jlong regionHandle, jlong pathHandle) {
+    const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
+    SkPath*   path = reinterpret_cast<SkPath*>(pathHandle);
+    bool result = region->getBoundaryPath(path);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_op0(JNIEnv* env, jobject, SkRegion* dst, int left, int top, int right, int bottom, int op) {
+static jboolean Region_op0(JNIEnv* env, jobject, jlong dstHandle, jint left, jint top, jint right, jint bottom, jint op) {
+    SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
     SkIRect ir;
 
     ir.set(left, top, right, bottom);
-    return dst->op(ir, (SkRegion::Op)op);
+    bool result = dst->op(ir, (SkRegion::Op)op);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_op1(JNIEnv* env, jobject, SkRegion* dst, jobject rectObject, const SkRegion* region, int op) {
+static jboolean Region_op1(JNIEnv* env, jobject, jlong dstHandle, jobject rectObject, jlong regionHandle, jint op) {
+    SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+    const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     SkIRect    ir;
     GraphicsJNI::jrect_to_irect(env, rectObject, &ir);
-    return dst->op(ir, *region, (SkRegion::Op)op);
+    bool result = dst->op(ir, *region, (SkRegion::Op)op);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_op2(JNIEnv* env, jobject, SkRegion* dst, const SkRegion* region1, const SkRegion* region2, int op) {
-    return dst->op(*region1, *region2, (SkRegion::Op)op);
+static jboolean Region_op2(JNIEnv* env, jobject, jlong dstHandle, jlong region1Handle, jlong region2Handle, jint op) {
+    SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+    const SkRegion* region1 = reinterpret_cast<SkRegion*>(region1Handle);
+    const SkRegion* region2 = reinterpret_cast<SkRegion*>(region2Handle);
+    bool result = dst->op(*region1, *region2, (SkRegion::Op)op);
+    return boolTojboolean(result);
 }
 
 ////////////////////////////////////  These are methods, not static
 
 static jboolean Region_isEmpty(JNIEnv* env, jobject region) {
-    return GetSkRegion(env, region)->isEmpty();
+    bool result = GetSkRegion(env, region)->isEmpty();
+    return boolTojboolean(result);
 }
 
 static jboolean Region_isRect(JNIEnv* env, jobject region) {
-    return GetSkRegion(env, region)->isRect();
+    bool result = GetSkRegion(env, region)->isRect();
+    return boolTojboolean(result);
 }
 
 static jboolean Region_isComplex(JNIEnv* env, jobject region) {
-    return GetSkRegion(env, region)->isComplex();
+    bool result = GetSkRegion(env, region)->isComplex();
+    return boolTojboolean(result);
 }
 
-static jboolean Region_contains(JNIEnv* env, jobject region, int x, int y) {
-    return GetSkRegion(env, region)->contains(x, y);
+static jboolean Region_contains(JNIEnv* env, jobject region, jint x, jint y) {
+    bool result = GetSkRegion(env, region)->contains(x, y);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_quickContains(JNIEnv* env, jobject region, int left, int top, int right, int bottom) {
-    return GetSkRegion(env, region)->quickContains(left, top, right, bottom);
+static jboolean Region_quickContains(JNIEnv* env, jobject region, jint left, jint top, jint right, jint bottom) {
+    bool result = GetSkRegion(env, region)->quickContains(left, top, right, bottom);
+    return boolTojboolean(result);
 }
 
-static jboolean Region_quickRejectIIII(JNIEnv* env, jobject region, int left, int top, int right, int bottom) {
+static jboolean Region_quickRejectIIII(JNIEnv* env, jobject region, jint left, jint top, jint right, jint bottom) {
     SkIRect ir;
     ir.set(left, top, right, bottom);
-    return GetSkRegion(env, region)->quickReject(ir);
+    bool result = GetSkRegion(env, region)->quickReject(ir);
+    return boolTojboolean(result);
 }
 
 static jboolean Region_quickRejectRgn(JNIEnv* env, jobject region, jobject other) {
-    return GetSkRegion(env, region)->quickReject(*GetSkRegion(env, other));
+    bool result = GetSkRegion(env, region)->quickReject(*GetSkRegion(env, other));
+    return boolTojboolean(result);
 }
 
-static void Region_translate(JNIEnv* env, jobject region, int x, int y, jobject dst) {
+static void Region_translate(JNIEnv* env, jobject region, jint x, jint y, jobject dst) {
     SkRegion* rgn = GetSkRegion(env, region);
     if (dst)
         rgn->translate(x, y, GetSkRegion(env, dst));
@@ -155,7 +191,8 @@
         scale_rgn(rgn, *rgn, scale);
 }
 
-static jstring Region_toString(JNIEnv* env, jobject clazz, SkRegion* region) {
+static jstring Region_toString(JNIEnv* env, jobject clazz, jlong regionHandle) {
+    SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     char* str = region->toString();
     if (str == NULL) {
         return NULL;
@@ -167,7 +204,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
+static jlong Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
 {
     if (parcel == NULL) {
         return NULL;
@@ -179,13 +216,14 @@
     size_t size = p->readInt32();
     region->readFromMemory(p->readInplace(size));
 
-    return region;
+    return reinterpret_cast<jlong>(region);
 }
 
-static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion* region, jobject parcel)
+static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, jlong regionHandle, jobject parcel)
 {
+    const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     if (parcel == NULL) {
-        return false;
+        return JNI_FALSE;
     }
 
     android::Parcel* p = android::parcelForJavaObject(env, parcel);
@@ -194,14 +232,16 @@
     p->writeInt32(size);
     region->writeToMemory(p->writeInplace(size));
 
-    return true;
+    return JNI_TRUE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-static jboolean Region_equals(JNIEnv* env, jobject clazz, const SkRegion *r1, const SkRegion* r2)
+static jboolean Region_equals(JNIEnv* env, jobject clazz, jlong r1Handle, jlong r2Handle)
 {
-  return (jboolean) (*r1 == *r2);
+    const SkRegion *r1 = reinterpret_cast<SkRegion*>(r1Handle);
+    const SkRegion *r2 = reinterpret_cast<SkRegion*>(r2Handle);
+    return boolTojboolean(*r1 == *r2);
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -217,20 +257,23 @@
     }
 };
 
-static RgnIterPair* RegionIter_constructor(JNIEnv* env, jobject, const SkRegion* region)
+static jlong RegionIter_constructor(JNIEnv* env, jobject, jlong regionHandle)
 {
+    const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
     SkASSERT(region);
-    return new RgnIterPair(*region);
+    return reinterpret_cast<jlong>(new RgnIterPair(*region));
 }
 
-static void RegionIter_destructor(JNIEnv* env, jobject, RgnIterPair* pair)
+static void RegionIter_destructor(JNIEnv* env, jobject, jlong pairHandle)
 {
+    RgnIterPair* pair = reinterpret_cast<RgnIterPair*>(pairHandle);
     SkASSERT(pair);
     delete pair;
 }
 
-static jboolean RegionIter_next(JNIEnv* env, jobject, RgnIterPair* pair, jobject rectObject)
+static jboolean RegionIter_next(JNIEnv* env, jobject, jlong pairHandle, jobject rectObject)
 {
+    RgnIterPair* pair = reinterpret_cast<RgnIterPair*>(pairHandle);
     // the caller has checked that rectObject is not nul
     SkASSERT(pair);
     SkASSERT(rectObject);
@@ -238,31 +281,31 @@
     if (!pair->fIter.done()) {
         GraphicsJNI::irect_to_jrect(pair->fIter.rect(), env, rectObject);
         pair->fIter.next();
-        return true;
+        return JNI_TRUE;
     }
-    return false;
+    return JNI_FALSE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 static JNINativeMethod gRegionIterMethods[] = {
-    { "nativeConstructor",  "(I)I",                         (void*)RegionIter_constructor   },
-    { "nativeDestructor",   "(I)V",                         (void*)RegionIter_destructor    },
-    { "nativeNext",         "(ILandroid/graphics/Rect;)Z",  (void*)RegionIter_next          }
+    { "nativeConstructor",  "(J)J",                         (void*)RegionIter_constructor   },
+    { "nativeDestructor",   "(J)V",                         (void*)RegionIter_destructor    },
+    { "nativeNext",         "(JLandroid/graphics/Rect;)Z",  (void*)RegionIter_next          }
 };
 
 static JNINativeMethod gRegionMethods[] = {
     // these are static methods
-    { "nativeConstructor",      "()I",                              (void*)Region_constructor       },
-    { "nativeDestructor",       "(I)V",                             (void*)Region_destructor        },
-    { "nativeSetRegion",        "(II)V",                            (void*)Region_setRegion         },
-    { "nativeSetRect",          "(IIIII)Z",                         (void*)Region_setRect           },
-    { "nativeSetPath",          "(III)Z",                           (void*)Region_setPath           },
-    { "nativeGetBounds",        "(ILandroid/graphics/Rect;)Z",      (void*)Region_getBounds         },
-    { "nativeGetBoundaryPath",  "(II)Z",                            (void*)Region_getBoundaryPath   },
-    { "nativeOp",               "(IIIIII)Z",                        (void*)Region_op0               },
-    { "nativeOp",               "(ILandroid/graphics/Rect;II)Z",    (void*)Region_op1               },
-    { "nativeOp",               "(IIII)Z",                          (void*)Region_op2               },
+    { "nativeConstructor",      "()J",                              (void*)Region_constructor       },
+    { "nativeDestructor",       "(J)V",                             (void*)Region_destructor        },
+    { "nativeSetRegion",        "(JJ)V",                            (void*)Region_setRegion         },
+    { "nativeSetRect",          "(JIIII)Z",                         (void*)Region_setRect           },
+    { "nativeSetPath",          "(JJJ)Z",                           (void*)Region_setPath           },
+    { "nativeGetBounds",        "(JLandroid/graphics/Rect;)Z",      (void*)Region_getBounds         },
+    { "nativeGetBoundaryPath",  "(JJ)Z",                            (void*)Region_getBoundaryPath   },
+    { "nativeOp",               "(JIIIII)Z",                        (void*)Region_op0               },
+    { "nativeOp",               "(JLandroid/graphics/Rect;JI)Z",    (void*)Region_op1               },
+    { "nativeOp",               "(JJJI)Z",                          (void*)Region_op2               },
     // these are methods that take the java region object
     { "isEmpty",                "()Z",                              (void*)Region_isEmpty           },
     { "isRect",                 "()Z",                              (void*)Region_isRect            },
@@ -273,11 +316,11 @@
     { "quickReject",            "(Landroid/graphics/Region;)Z",     (void*)Region_quickRejectRgn    },
     { "scale",                  "(FLandroid/graphics/Region;)V",    (void*)Region_scale             },
     { "translate",              "(IILandroid/graphics/Region;)V",   (void*)Region_translate         },
-    { "nativeToString",         "(I)Ljava/lang/String;",            (void*)Region_toString          },
+    { "nativeToString",         "(J)Ljava/lang/String;",            (void*)Region_toString          },
     // parceling methods
-    { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I",           (void*)Region_createFromParcel  },
-    { "nativeWriteToParcel",    "(ILandroid/os/Parcel;)Z",          (void*)Region_writeToParcel     },
-    { "nativeEquals",           "(II)Z",                            (void*)Region_equals            },
+    { "nativeCreateFromParcel", "(Landroid/os/Parcel;)J",           (void*)Region_createFromParcel  },
+    { "nativeWriteToParcel",    "(JLandroid/os/Parcel;)Z",          (void*)Region_writeToParcel     },
+    { "nativeEquals",           "(JJ)Z",                            (void*)Region_equals            },
 };
 
 int register_android_graphics_Region(JNIEnv* env)
@@ -285,7 +328,7 @@
     jclass clazz = env->FindClass("android/graphics/Region");
     SkASSERT(clazz);
 
-    gRegion_nativeInstanceFieldID = env->GetFieldID(clazz, "mNativeRegion", "I");
+    gRegion_nativeInstanceFieldID = env->GetFieldID(clazz, "mNativeRegion", "J");
     SkASSERT(gRegion_nativeInstanceFieldID);
 
     int result = android::AndroidRuntime::registerNativeMethods(env, "android/graphics/Region",
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 6323ab3..3047440 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -24,7 +24,7 @@
     }
 }
 
-static void Color_RGBToHSV(JNIEnv* env, jobject, int red, int green, int blue, jfloatArray hsvArray)
+static void Color_RGBToHSV(JNIEnv* env, jobject, jint red, jint green, jint blue, jfloatArray hsvArray)
 {
     SkScalar hsv[3];
     SkRGBToHSV(red, green, blue, hsv);
@@ -36,7 +36,7 @@
     }
 }
 
-static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArray)
+static jint Color_HSVToColor(JNIEnv* env, jobject, jint alpha, jfloatArray hsvArray)
 {
     AutoJavaFloatArray  autoHSV(env, hsvArray, 3);
     float*      values = autoHSV.ptr();;
@@ -46,13 +46,15 @@
         hsv[i] = SkFloatToScalar(values[i]);
     }
 
-    return SkHSVToColor(alpha, hsv);
+    return static_cast<jint>(SkHSVToColor(alpha, hsv));
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
-static void Shader_destructor(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader)
+static void Shader_destructor(JNIEnv* env, jobject o, jlong shaderHandle, jlong skiaShaderHandle)
 {
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+    SkiaShader* skiaShader = reinterpret_cast<SkiaShader*>(skiaShaderHandle);
     SkSafeUnref(shader);
     // skiaShader == NULL when not !USE_OPENGL_RENDERER, so no need to delete it outside the ifdef
 #ifdef USE_OPENGL_RENDERER
@@ -64,9 +66,12 @@
 #endif
 }
 
-static void Shader_setLocalMatrix(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader,
-        const SkMatrix* matrix)
+static void Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle,
+        jlong skiaShaderHandle, jlong matrixHandle)
 {
+    SkShader* shader       = reinterpret_cast<SkShader*>(shaderHandle);
+    SkiaShader* skiaShader = reinterpret_cast<SkiaShader*>(skiaShaderHandle);
+    const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
     if (shader) {
         if (NULL == matrix) {
             shader->resetLocalMatrix();
@@ -82,24 +87,27 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
-static SkShader* BitmapShader_constructor(JNIEnv* env, jobject o, const SkBitmap* bitmap,
-                                          int tileModeX, int tileModeY)
+static jlong BitmapShader_constructor(JNIEnv* env, jobject o, jlong bitmapHandle,
+                                      jint tileModeX, jint tileModeY)
 {
+    const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
     SkShader* s = SkShader::CreateBitmapShader(*bitmap,
                                         (SkShader::TileMode)tileModeX,
                                         (SkShader::TileMode)tileModeY);
 
     ThrowIAE_IfNull(env, s);
-    return s;
+    return reinterpret_cast<jlong>(s);
 }
 
-static SkiaShader* BitmapShader_postConstructor(JNIEnv* env, jobject o, SkShader* shader,
-        SkBitmap* bitmap, int tileModeX, int tileModeY) {
+static jlong BitmapShader_postConstructor(JNIEnv* env, jobject o, jlong shaderHandle,
+        jlong bitmapHandle, jint tileModeX, jint tileModeY) {
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+    SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
 #ifdef USE_OPENGL_RENDERER
     SkiaShader* skiaShader = new SkiaBitmapShader(bitmap, shader,
             static_cast<SkShader::TileMode>(tileModeX), static_cast<SkShader::TileMode>(tileModeY),
             NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
@@ -107,9 +115,9 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
-static SkShader* LinearGradient_create1(JNIEnv* env, jobject o,
-                                        float x0, float y0, float x1, float y1,
-                                        jintArray colorArray, jfloatArray posArray, int tileMode)
+static jlong LinearGradient_create1(JNIEnv* env, jobject o,
+                                    jfloat x0, jfloat y0, jfloat x1, jfloat y1,
+                                    jintArray colorArray, jfloatArray posArray, jint tileMode)
 {
     SkPoint pts[2];
     pts[0].set(SkFloatToScalar(x0), SkFloatToScalar(y0));
@@ -137,13 +145,14 @@
 
     env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
     ThrowIAE_IfNull(env, shader);
-    return shader;
+    return reinterpret_cast<jlong>(shader);
 }
 
-static SkiaShader* LinearGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
-        float x0, float y0, float x1, float y1, jintArray colorArray,
-        jfloatArray posArray, int tileMode) {
+static jlong LinearGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x0, jfloat y0, jfloat x1, jfloat y1, jintArray colorArray,
+        jfloatArray posArray, jint tileMode) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     size_t count = env->GetArrayLength(colorArray);
     const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
 
@@ -206,15 +215,16 @@
             (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
     env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
 }
 
-static SkiaShader* LinearGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
-        float x0, float y0, float x1, float y1, int color0, int color1, int tileMode) {
+static jlong LinearGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x0, jfloat y0, jfloat x1, jfloat y1, jint color0, jint color1, jint tileMode) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     float* storedBounds = new float[4];
     storedBounds[0] = x0; storedBounds[1] = y0;
     storedBounds[2] = x1; storedBounds[3] = y1;
@@ -231,15 +241,15 @@
             storedPositions, 2, shader, static_cast<SkShader::TileMode>(tileMode), NULL,
             (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
 }
 
-static SkShader* LinearGradient_create2(JNIEnv* env, jobject o,
-                                        float x0, float y0, float x1, float y1,
-                                        int color0, int color1, int tileMode)
+static jlong LinearGradient_create2(JNIEnv* env, jobject o,
+                                    jfloat x0, jfloat y0, jfloat x1, jfloat y1,
+                                    jint color0, jint color1, jint tileMode)
 {
     SkPoint pts[2];
     pts[0].set(SkFloatToScalar(x0), SkFloatToScalar(y0));
@@ -252,13 +262,13 @@
     SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, (SkShader::TileMode)tileMode);
 
     ThrowIAE_IfNull(env, s);
-    return s;
+    return reinterpret_cast<jlong>(s);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
-static SkShader* RadialGradient_create1(JNIEnv* env, jobject, float x, float y, float radius,
-        jintArray colorArray, jfloatArray posArray, int tileMode) {
+static jlong RadialGradient_create1(JNIEnv* env, jobject, jfloat x, jfloat y, jfloat radius,
+        jintArray colorArray, jfloatArray posArray, jint tileMode) {
     SkPoint center;
     center.set(SkFloatToScalar(x), SkFloatToScalar(y));
 
@@ -285,11 +295,11 @@
                                  JNI_ABORT);
 
     ThrowIAE_IfNull(env, shader);
-    return shader;
+    return reinterpret_cast<jlong>(shader);
 }
 
-static SkShader* RadialGradient_create2(JNIEnv* env, jobject, float x, float y, float radius,
-        int color0, int color1, int tileMode) {
+static jlong RadialGradient_create2(JNIEnv* env, jobject, jfloat x, jfloat y, jfloat radius,
+        jint color0, jint color1, jint tileMode) {
     SkPoint center;
     center.set(SkFloatToScalar(x), SkFloatToScalar(y));
 
@@ -300,12 +310,13 @@
     SkShader* s = SkGradientShader::CreateRadial(center, SkFloatToScalar(radius), colors, NULL,
                                           2, (SkShader::TileMode)tileMode);
     ThrowIAE_IfNull(env, s);
-    return s;
+    return reinterpret_cast<jlong>(s);
 }
 
-static SkiaShader* RadialGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
-        float x, float y, float radius, jintArray colorArray, jfloatArray posArray, int tileMode) {
+static jlong RadialGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x, jfloat y, jfloat radius, jintArray colorArray, jfloatArray posArray, jint tileMode) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     size_t count = env->GetArrayLength(colorArray);
     const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
 
@@ -335,15 +346,16 @@
             (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
     env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
 }
 
-static SkiaShader* RadialGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
-        float x, float y, float radius, int color0, int color1, int tileMode) {
+static jlong RadialGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x, jfloat y, jfloat radius, jint color0, jint color1, jint tileMode) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     float* storedPositions = new float[2];
     storedPositions[0] = 0.0f;
     storedPositions[1] = 1.0f;
@@ -356,7 +368,7 @@
             storedPositions, 2, shader, (SkShader::TileMode) tileMode, NULL,
             (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
@@ -364,7 +376,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static SkShader* SweepGradient_create1(JNIEnv* env, jobject, float x, float y,
+static jlong SweepGradient_create1(JNIEnv* env, jobject, jfloat x, jfloat y,
         jintArray jcolors, jfloatArray jpositions) {
     size_t      count = env->GetArrayLength(jcolors);
     const jint* colors = env->GetIntArrayElements(jcolors, NULL);
@@ -388,10 +400,10 @@
     env->ReleaseIntArrayElements(jcolors, const_cast<jint*>(colors),
                                  JNI_ABORT);
     ThrowIAE_IfNull(env, shader);
-    return shader;
+    return reinterpret_cast<jlong>(shader);
 }
 
-static SkShader* SweepGradient_create2(JNIEnv* env, jobject, float x, float y,
+static jlong SweepGradient_create2(JNIEnv* env, jobject, jfloat x, jfloat y,
         int color0, int color1) {
     SkColor colors[2];
     colors[0] = color0;
@@ -399,12 +411,13 @@
     SkShader* s = SkGradientShader::CreateSweep(SkFloatToScalar(x), SkFloatToScalar(y),
                                          colors, NULL, 2);
     ThrowIAE_IfNull(env, s);
-    return s;
+    return reinterpret_cast<jlong>(s);
 }
 
-static SkiaShader* SweepGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
-        float x, float y, jintArray colorArray, jfloatArray posArray) {
+static jlong SweepGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x, jfloat y, jintArray colorArray, jfloatArray posArray) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     size_t count = env->GetArrayLength(colorArray);
     const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
 
@@ -433,15 +446,16 @@
             shader, NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
     env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
 }
 
-static SkiaShader* SweepGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
-        float x, float y, int color0, int color1) {
+static jlong SweepGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+        jfloat x, jfloat y, jint color0, jint color1) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
     float* storedPositions = new float[2];
     storedPositions[0] = 0.0f;
     storedPositions[1] = 1.0f;
@@ -453,7 +467,7 @@
     SkiaShader* skiaShader = new SkiaSweepGradientShader(x, y, storedColors, storedPositions, 2,
             shader, NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
 
-    return skiaShader;
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
@@ -461,39 +475,57 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
-static SkShader* ComposeShader_create1(JNIEnv* env, jobject o,
-        SkShader* shaderA, SkShader* shaderB, SkXfermode* mode)
+static jlong ComposeShader_create1(JNIEnv* env, jobject o,
+        jlong shaderAHandle, jlong shaderBHandle, jlong modeHandle)
 {
-    return new SkComposeShader(shaderA, shaderB, mode);
+    SkShader* shaderA = reinterpret_cast<SkShader *>(shaderAHandle);
+    SkShader* shaderB = reinterpret_cast<SkShader *>(shaderBHandle);
+    SkXfermode* mode = reinterpret_cast<SkXfermode *>(modeHandle);
+    SkShader* shader = new SkComposeShader(shaderA, shaderB, mode);
+    return reinterpret_cast<jlong>(shader);
 }
 
-static SkShader* ComposeShader_create2(JNIEnv* env, jobject o,
-        SkShader* shaderA, SkShader* shaderB, SkPorterDuff::Mode porterDuffMode)
+static jlong ComposeShader_create2(JNIEnv* env, jobject o,
+        jlong shaderAHandle, jlong shaderBHandle, jint porterDuffModeHandle)
 {
+    SkShader* shaderA = reinterpret_cast<SkShader *>(shaderAHandle);
+    SkShader* shaderB = reinterpret_cast<SkShader *>(shaderBHandle);
+    SkPorterDuff::Mode porterDuffMode = static_cast<SkPorterDuff::Mode>(porterDuffModeHandle);
     SkAutoUnref au(SkPorterDuff::CreateXfermode(porterDuffMode));
     SkXfermode* mode = (SkXfermode*) au.get();
-    return new SkComposeShader(shaderA, shaderB, mode);
+    SkShader* shader = new SkComposeShader(shaderA, shaderB, mode);
+    return reinterpret_cast<jlong>(shader);
 }
 
-static SkiaShader* ComposeShader_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
-        SkiaShader* shaderA, SkiaShader* shaderB, SkPorterDuff::Mode porterDuffMode) {
+static jlong ComposeShader_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+        jlong shaderAHandle, jlong shaderBHandle, jint porterDuffModeHandle) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader *>(shaderHandle);
+    SkiaShader* shaderA = reinterpret_cast<SkiaShader *>(shaderAHandle);
+    SkiaShader* shaderB = reinterpret_cast<SkiaShader *>(shaderBHandle);
+    SkPorterDuff::Mode porterDuffMode = static_cast<SkPorterDuff::Mode>(porterDuffModeHandle);
     SkXfermode::Mode mode = SkPorterDuff::ToXfermodeMode(porterDuffMode);
-    return new SkiaComposeShader(shaderA, shaderB, mode, shader);
+    SkiaShader* skiaShader = new SkiaComposeShader(shaderA, shaderB, mode, shader);
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
 }
 
-static SkiaShader* ComposeShader_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
-        SkiaShader* shaderA, SkiaShader* shaderB, SkXfermode* mode) {
+static jlong ComposeShader_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+        jlong shaderAHandle, jlong shaderBHandle, jlong modeHandle) {
 #ifdef USE_OPENGL_RENDERER
+    SkShader* shader = reinterpret_cast<SkShader *>(shaderHandle);
+    SkiaShader* shaderA = reinterpret_cast<SkiaShader *>(shaderAHandle);
+    SkiaShader* shaderB = reinterpret_cast<SkiaShader *>(shaderBHandle);
+    SkXfermode* mode = reinterpret_cast<SkXfermode *>(modeHandle);
     SkXfermode::Mode skiaMode;
     if (!SkXfermode::IsMode(mode, &skiaMode)) {
         // TODO: Support other modes
         skiaMode = SkXfermode::kSrcOver_Mode;
     }
-    return new SkiaComposeShader(shaderA, shaderB, skiaMode, shader);
+    SkiaShader* skiaShader = new SkiaComposeShader(shaderA, shaderB, skiaMode, shader);
+    return reinterpret_cast<jlong>(skiaShader);
 #else
     return NULL;
 #endif
@@ -507,41 +539,41 @@
 };
 
 static JNINativeMethod gShaderMethods[] = {
-    { "nativeDestructor",        "(II)V",    (void*)Shader_destructor        },
-    { "nativeSetLocalMatrix",    "(III)V",   (void*)Shader_setLocalMatrix    }
+    { "nativeDestructor",        "(JJ)V",    (void*)Shader_destructor        },
+    { "nativeSetLocalMatrix",    "(JJJ)V",   (void*)Shader_setLocalMatrix    }
 };
 
 static JNINativeMethod gBitmapShaderMethods[] = {
-    { "nativeCreate",     "(III)I",  (void*)BitmapShader_constructor },
-    { "nativePostCreate", "(IIII)I", (void*)BitmapShader_postConstructor }
+    { "nativeCreate",     "(JII)J",  (void*)BitmapShader_constructor },
+    { "nativePostCreate", "(JJII)J", (void*)BitmapShader_postConstructor }
 };
 
 static JNINativeMethod gLinearGradientMethods[] = {
-    { "nativeCreate1",     "(FFFF[I[FI)I",  (void*)LinearGradient_create1     },
-    { "nativeCreate2",     "(FFFFIII)I",    (void*)LinearGradient_create2     },
-    { "nativePostCreate1", "(IFFFF[I[FI)I", (void*)LinearGradient_postCreate1 },
-    { "nativePostCreate2", "(IFFFFIII)I",   (void*)LinearGradient_postCreate2 }
+    { "nativeCreate1",     "(FFFF[I[FI)J",  (void*)LinearGradient_create1     },
+    { "nativeCreate2",     "(FFFFIII)J",    (void*)LinearGradient_create2     },
+    { "nativePostCreate1", "(JFFFF[I[FI)J", (void*)LinearGradient_postCreate1 },
+    { "nativePostCreate2", "(JFFFFIII)J",   (void*)LinearGradient_postCreate2 }
 };
 
 static JNINativeMethod gRadialGradientMethods[] = {
-    { "nativeCreate1",     "(FFF[I[FI)I",  (void*)RadialGradient_create1     },
-    { "nativeCreate2",     "(FFFIII)I",    (void*)RadialGradient_create2     },
-    { "nativePostCreate1", "(IFFF[I[FI)I", (void*)RadialGradient_postCreate1 },
-    { "nativePostCreate2", "(IFFFIII)I",   (void*)RadialGradient_postCreate2 }
+    { "nativeCreate1",     "(FFF[I[FI)J",  (void*)RadialGradient_create1     },
+    { "nativeCreate2",     "(FFFIII)J",    (void*)RadialGradient_create2     },
+    { "nativePostCreate1", "(JFFF[I[FI)J", (void*)RadialGradient_postCreate1 },
+    { "nativePostCreate2", "(JFFFIII)J",   (void*)RadialGradient_postCreate2 }
 };
 
 static JNINativeMethod gSweepGradientMethods[] = {
-    { "nativeCreate1",     "(FF[I[F)I",  (void*)SweepGradient_create1     },
-    { "nativeCreate2",     "(FFII)I",    (void*)SweepGradient_create2     },
-    { "nativePostCreate1", "(IFF[I[F)I", (void*)SweepGradient_postCreate1 },
-    { "nativePostCreate2", "(IFFII)I",   (void*)SweepGradient_postCreate2 }
+    { "nativeCreate1",     "(FF[I[F)J",  (void*)SweepGradient_create1     },
+    { "nativeCreate2",     "(FFII)J",    (void*)SweepGradient_create2     },
+    { "nativePostCreate1", "(JFF[I[F)J", (void*)SweepGradient_postCreate1 },
+    { "nativePostCreate2", "(JFFII)J",   (void*)SweepGradient_postCreate2 }
 };
 
 static JNINativeMethod gComposeShaderMethods[] = {
-    { "nativeCreate1",      "(III)I",   (void*)ComposeShader_create1     },
-    { "nativeCreate2",      "(III)I",   (void*)ComposeShader_create2     },
-    { "nativePostCreate1",  "(IIII)I",  (void*)ComposeShader_postCreate1 },
-    { "nativePostCreate2",  "(IIII)I",  (void*)ComposeShader_postCreate2 }
+    { "nativeCreate1",      "(JJJ)J",   (void*)ComposeShader_create1     },
+    { "nativeCreate2",      "(JJI)J",   (void*)ComposeShader_create2     },
+    { "nativePostCreate1",  "(JJJJ)J",  (void*)ComposeShader_postCreate1 },
+    { "nativePostCreate2",  "(JJJI)J",  (void*)ComposeShader_postCreate2 }
 };
 
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp
index 04f9fe1..a349a7f 100644
--- a/core/jni/android/graphics/Typeface.cpp
+++ b/core/jni/android/graphics/Typeface.cpp
@@ -44,8 +44,9 @@
     const char* fCStr;
 };
 
-static TypefaceImpl* Typeface_create(JNIEnv* env, jobject, jstring name,
-                                   SkTypeface::Style style) {
+static jlong Typeface_create(JNIEnv* env, jobject, jstring name,
+                             jint styleHandle) {
+    SkTypeface::Style style = static_cast<SkTypeface::Style>(styleHandle);
     TypefaceImpl* face = NULL;
 
     if (NULL != name) {
@@ -57,10 +58,11 @@
     if (NULL == face) {
         face = TypefaceImpl_createFromName(NULL, style);
     }
-    return face;
+    return reinterpret_cast<jlong>(face);
 }
 
-static TypefaceImpl* Typeface_createFromTypeface(JNIEnv* env, jobject, TypefaceImpl* family, int style) {
+static jlong Typeface_createFromTypeface(JNIEnv* env, jobject, jlong familyHandle, jint style) {
+    SkTypeface* family = reinterpret_cast<SkTypeface*>(familyHandle);
     TypefaceImpl* face = TypefaceImpl_createFromTypeface(family, (SkTypeface::Style)style);
     // Try to find the closest matching font, using the standard heuristic
     if (NULL == face) {
@@ -72,21 +74,22 @@
     if (NULL == face) {
         face = TypefaceImpl_createFromName(NULL, (SkTypeface::Style)style);
     }
-    return face;
+    return reinterpret_cast<jlong>(face);
 }
 
-static void Typeface_unref(JNIEnv* env, jobject obj, TypefaceImpl* face) {
+static void Typeface_unref(JNIEnv* env, jobject obj, jlong faceHandle) {
+    TypefaceImpl* face = reinterpret_cast<TypefaceImpl*>(faceHandle);
     TypefaceImpl_unref(face);
 }
 
-static int Typeface_getStyle(JNIEnv* env, jobject obj, TypefaceImpl* face) {
+static jint Typeface_getStyle(JNIEnv* env, jobject obj, jlong faceHandle) {
+    TypefaceImpl* face = reinterpret_cast<TypefaceImpl*>(faceHandle);
     return TypefaceImpl_getStyle(face);
 }
 
-static TypefaceImpl* Typeface_createFromAsset(JNIEnv* env, jobject,
-                                            jobject jassetMgr,
-                                            jstring jpath) {
-
+static jlong Typeface_createFromAsset(JNIEnv* env, jobject,
+                                      jobject jassetMgr,
+                                      jstring jpath) {
     NPE_CHECK_RETURN_ZERO(env, jassetMgr);
     NPE_CHECK_RETURN_ZERO(env, jpath);
 
@@ -95,33 +98,32 @@
         return NULL;
     }
 
-    AutoJavaStringToUTF8    str(env, jpath);
+    AutoJavaStringToUTF8 str(env, jpath);
     Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER);
     if (NULL == asset) {
         return NULL;
     }
 
-    return TypefaceImpl_createFromAsset(asset);
+    return reinterpret_cast<jlong>(TypefaceImpl_createFromAsset(asset));
 }
 
-static TypefaceImpl* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) {
+static jlong Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) {
     NPE_CHECK_RETURN_ZERO(env, jpath);
 
     AutoJavaStringToUTF8 str(env, jpath);
-
-    return TypefaceImpl_createFromFile(str.c_str());
+    return reinterpret_cast<jlong>(TypefaceImpl_createFromFile(str.c_str()));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 static JNINativeMethod gTypefaceMethods[] = {
-    { "nativeCreate",        "(Ljava/lang/String;I)I", (void*)Typeface_create },
-    { "nativeCreateFromTypeface", "(II)I", (void*)Typeface_createFromTypeface },
-    { "nativeUnref",              "(I)V",  (void*)Typeface_unref },
-    { "nativeGetStyle",           "(I)I",  (void*)Typeface_getStyle },
-    { "nativeCreateFromAsset",    "(Landroid/content/res/AssetManager;Ljava/lang/String;)I",
+    { "nativeCreate",        "(Ljava/lang/String;I)J", (void*)Typeface_create },
+    { "nativeCreateFromTypeface", "(JI)J", (void*)Typeface_createFromTypeface },
+    { "nativeUnref",              "(J)V",  (void*)Typeface_unref },
+    { "nativeGetStyle",           "(J)I",  (void*)Typeface_getStyle },
+    { "nativeCreateFromAsset",    "(Landroid/content/res/AssetManager;Ljava/lang/String;)J",
                                            (void*)Typeface_createFromAsset },
-    { "nativeCreateFromFile",     "(Ljava/lang/String;)I",
+    { "nativeCreateFromFile",     "(Ljava/lang/String;)J",
                                            (void*)Typeface_createFromFile },
 };
 
diff --git a/core/jni/android/graphics/Xfermode.cpp b/core/jni/android/graphics/Xfermode.cpp
index 976a91f..eedceb7 100644
--- a/core/jni/android/graphics/Xfermode.cpp
+++ b/core/jni/android/graphics/Xfermode.cpp
@@ -26,35 +26,37 @@
 class SkXfermodeGlue {
 public:
 
-    static void finalizer(JNIEnv* env, jobject, SkXfermode* obj)
+    static void finalizer(JNIEnv* env, jobject, jlong objHandle)
     {
+        SkXfermode* obj = reinterpret_cast<SkXfermode *>(objHandle);
         SkSafeUnref(obj);
     }
     
-    static SkXfermode* avoid_create(JNIEnv* env, jobject, SkColor opColor,
-                                U8CPU tolerance, SkAvoidXfermode::Mode mode)
+    static jlong avoid_create(JNIEnv* env, jobject, jint opColor,
+                                jint tolerance, jint modeHandle)
     {
-        return new SkAvoidXfermode(opColor, tolerance, mode);
+        SkAvoidXfermode::Mode mode = static_cast<SkAvoidXfermode::Mode>(modeHandle);
+        return reinterpret_cast<jlong>(new SkAvoidXfermode(opColor, tolerance, mode));
     }
-    
-    static SkXfermode* pixelxor_create(JNIEnv* env, jobject, SkColor opColor)
+
+    static jlong pixelxor_create(JNIEnv* env, jobject, jint opColor)
     {
-        return new SkPixelXorXfermode(opColor);
+        return reinterpret_cast<jlong>(new SkPixelXorXfermode(opColor));
     }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
 static JNINativeMethod gXfermodeMethods[] = {
-    {"finalizer", "(I)V", (void*) SkXfermodeGlue::finalizer}
+    {"finalizer", "(J)V", (void*) SkXfermodeGlue::finalizer}
 };
 
 static JNINativeMethod gAvoidMethods[] = {
-    {"nativeCreate", "(III)I", (void*) SkXfermodeGlue::avoid_create}
+    {"nativeCreate", "(III)J", (void*) SkXfermodeGlue::avoid_create}
 };
 
 static JNINativeMethod gPixelXorMethods[] = {
-    {"nativeCreate", "(I)I", (void*) SkXfermodeGlue::pixelxor_create}
+    {"nativeCreate", "(I)J", (void*) SkXfermodeGlue::pixelxor_create}
 };
 
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 4bb091d..a17f328 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -389,7 +389,7 @@
 }
 
 static
-int util_frustumCullSpheres(JNIEnv *env, jclass clazz,
+jint util_frustumCullSpheres(JNIEnv *env, jclass clazz,
         jfloatArray mvp_ref, jint mvpOffset,
         jfloatArray spheres_ref, jint spheresOffset, jint spheresCount,
         jintArray results_ref, jint resultsOffset, jint resultsCapacity) {
@@ -436,7 +436,7 @@
  */
 
 static
-int util_visibilityTest(JNIEnv *env, jclass clazz,
+jint util_visibilityTest(JNIEnv *env, jclass clazz,
         jfloatArray ws_ref, jint wsOffset,
         jfloatArray positions_ref, jint positionsOffset,
         jcharArray indices_ref, jint indicesOffset, jint indexCount) {
@@ -553,7 +553,7 @@
 void nativeUtilsClassInit(JNIEnv *env, jclass clazz)
 {
     jclass bitmapClass = env->FindClass("android/graphics/Bitmap");
-    nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
+    nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
 }
 
 extern void setGLDebugLevel(int level);
@@ -630,7 +630,7 @@
         jobject jbitmap)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+            (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
     SkBitmap::Config config = bitmap.config();
     return getInternalFormat(config);
@@ -640,7 +640,7 @@
         jobject jbitmap)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+            (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
     SkBitmap::Config config = bitmap.config();
     return getType(config);
@@ -651,7 +651,7 @@
         jobject jbitmap, jint type, jint border)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+            (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
     SkBitmap::Config config = bitmap.config();
     if (internalformat < 0) {
@@ -700,7 +700,7 @@
         jobject jbitmap, jint format, jint type)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+            (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
     SkBitmap::Config config = bitmap.config();
     if (format < 0) {
@@ -773,7 +773,7 @@
     pointer = _env->CallStaticLongMethod(nioAccessClass,
             getBasePointerID, buffer);
     if (pointer != 0L) {
-        return (void *) (jint) pointer;
+        return reinterpret_cast<void *>(pointer);
     }
     return NULL;
 }
@@ -974,7 +974,7 @@
             result = etc1_pkm_is_valid((etc1_byte*) headerB.getData());
         }
     }
-    return result;
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
 /**
@@ -997,7 +997,7 @@
 /**
  * Read the image height from a PKM header
  */
-static int etc1_getHeight(JNIEnv *env, jclass clazz,
+static jint etc1_getHeight(JNIEnv *env, jclass clazz,
         jobject header) {
     jint result = 0;
     BufferHelper headerB(env, header);
diff --git a/core/jni/android_view_DisplayList.cpp b/core/jni/android_view_DisplayList.cpp
index 9169a16..a796302 100644
--- a/core/jni/android_view_DisplayList.cpp
+++ b/core/jni/android_view_DisplayList.cpp
@@ -42,19 +42,19 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_DisplayList_reset(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->reset();
 }
 
 static jint android_view_DisplayList_getDisplayListSize(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getSize();
 }
 
 static void android_view_DisplayList_setDisplayListName(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jstring name) {
+        jobject clazz, jlong displayListPtr, jstring name) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     if (name != NULL) {
         const char* textArray = env->GetStringUTFChars(name, NULL);
@@ -64,13 +64,13 @@
 }
 
 static void android_view_DisplayList_output(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->output();
 }
 
 static void android_view_DisplayList_destroyDisplayList(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     DisplayList::destroyDisplayListDeferred(displayList);
 }
@@ -80,105 +80,105 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_DisplayList_setCaching(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jboolean caching) {
+        jobject clazz, jlong displayListPtr, jboolean caching) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setCaching(caching);
 }
 
 static void android_view_DisplayList_setStaticMatrix(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jint matrixPtr) {
+        jobject clazz, jlong displayListPtr, jlong matrixPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     displayList->setStaticMatrix(matrix);
 }
 
 static void android_view_DisplayList_setAnimationMatrix(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jint matrixPtr) {
+        jobject clazz, jlong displayListPtr, jlong matrixPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     displayList->setAnimationMatrix(matrix);
 }
 
 static void android_view_DisplayList_setClipToBounds(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jboolean clipToBounds) {
+        jobject clazz, jlong displayListPtr, jboolean clipToBounds) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setClipToBounds(clipToBounds);
 }
 
 static void android_view_DisplayList_setIsContainedVolume(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jboolean isContainedVolume) {
+        jobject clazz, jlong displayListPtr, jboolean isContainedVolume) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setIsContainedVolume(isContainedVolume);
 }
 
 static void android_view_DisplayList_setProjectToContainedVolume(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jboolean shouldProject) {
+        jobject clazz, jlong displayListPtr, jboolean shouldProject) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setProjectToContainedVolume(shouldProject);
 }
 
 static void android_view_DisplayList_setAlpha(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float alpha) {
+        jobject clazz, jlong displayListPtr, float alpha) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setAlpha(alpha);
 }
 
 static void android_view_DisplayList_setHasOverlappingRendering(JNIEnv* env,
-        jobject clazz, jint displayListPtr, bool hasOverlappingRendering) {
+        jobject clazz, jlong displayListPtr, bool hasOverlappingRendering) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setHasOverlappingRendering(hasOverlappingRendering);
 }
 
 static void android_view_DisplayList_setTranslationX(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float tx) {
+        jobject clazz, jlong displayListPtr, float tx) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setTranslationX(tx);
 }
 
 static void android_view_DisplayList_setTranslationY(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float ty) {
+        jobject clazz, jlong displayListPtr, float ty) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setTranslationY(ty);
 }
 
 static void android_view_DisplayList_setTranslationZ(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float tz) {
+        jobject clazz, jlong displayListPtr, float tz) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setTranslationZ(tz);
 }
 
 static void android_view_DisplayList_setRotation(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float rotation) {
+        jobject clazz, jlong displayListPtr, float rotation) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setRotation(rotation);
 }
 
 static void android_view_DisplayList_setRotationX(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float rx) {
+        jobject clazz, jlong displayListPtr, float rx) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setRotationX(rx);
 }
 
 static void android_view_DisplayList_setRotationY(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float ry) {
+        jobject clazz, jlong displayListPtr, float ry) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setRotationY(ry);
 }
 
 static void android_view_DisplayList_setScaleX(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float sx) {
+        jobject clazz, jlong displayListPtr, float sx) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setScaleX(sx);
 }
 
 static void android_view_DisplayList_setScaleY(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float sy) {
+        jobject clazz, jlong displayListPtr, float sy) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setScaleY(sy);
 }
 
 static void android_view_DisplayList_setTransformationInfo(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float alpha,
+        jobject clazz, jlong displayListPtr, float alpha,
         float translationX, float translationY, float translationZ,
         float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
@@ -194,68 +194,68 @@
 }
 
 static void android_view_DisplayList_setPivotX(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float px) {
+        jobject clazz, jlong displayListPtr, float px) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setPivotX(px);
 }
 
 static void android_view_DisplayList_setPivotY(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float py) {
+        jobject clazz, jlong displayListPtr, float py) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setPivotY(py);
 }
 
 static void android_view_DisplayList_setCameraDistance(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float distance) {
+        jobject clazz, jlong displayListPtr, float distance) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setCameraDistance(distance);
 }
 
 static void android_view_DisplayList_setLeft(JNIEnv* env,
-        jobject clazz, jint displayListPtr, int left) {
+        jobject clazz, jlong displayListPtr, int left) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setLeft(left);
 }
 
 static void android_view_DisplayList_setTop(JNIEnv* env,
-        jobject clazz, jint displayListPtr, int top) {
+        jobject clazz, jlong displayListPtr, int top) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setTop(top);
 }
 
 static void android_view_DisplayList_setRight(JNIEnv* env,
-        jobject clazz, jint displayListPtr, int right) {
+        jobject clazz, jlong displayListPtr, int right) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setRight(right);
 }
 
 static void android_view_DisplayList_setBottom(JNIEnv* env,
-        jobject clazz, jint displayListPtr, int bottom) {
+        jobject clazz, jlong displayListPtr, int bottom) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setBottom(bottom);
 }
 
 static void android_view_DisplayList_setLeftTopRightBottom(JNIEnv* env,
-        jobject clazz, jint displayListPtr, int left, int top,
+        jobject clazz, jlong displayListPtr, int left, int top,
         int right, int bottom) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->setLeftTopRightBottom(left, top, right, bottom);
 }
 
 static void android_view_DisplayList_offsetLeftAndRight(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float offset) {
+        jobject clazz, jlong displayListPtr, float offset) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->offsetLeftRight(offset);
 }
 
 static void android_view_DisplayList_offsetTopAndBottom(JNIEnv* env,
-        jobject clazz, jint displayListPtr, float offset) {
+        jobject clazz, jlong displayListPtr, float offset) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     displayList->offsetTopBottom(offset);
 }
 
 static void android_view_DisplayList_getMatrix(JNIEnv* env,
-        jobject clazz, jint displayListPtr, jint matrixPtr) {
+        jobject clazz, jlong displayListPtr, jlong matrixPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     SkMatrix* source = displayList->getStaticMatrix();
@@ -267,97 +267,97 @@
 }
 
 static jboolean android_view_DisplayList_hasOverlappingRendering(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->hasOverlappingRendering();
 }
 
 static jfloat android_view_DisplayList_getAlpha(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getAlpha();
 }
 
 static jfloat android_view_DisplayList_getLeft(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getLeft();
 }
 
 static jfloat android_view_DisplayList_getTop(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getTop();
 }
 
 static jfloat android_view_DisplayList_getRight(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getRight();
 }
 
 static jfloat android_view_DisplayList_getBottom(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getBottom();
 }
 
 static jfloat android_view_DisplayList_getCameraDistance(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getCameraDistance();
 }
 
 static jfloat android_view_DisplayList_getScaleX(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getScaleX();
 }
 
 static jfloat android_view_DisplayList_getScaleY(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getScaleY();
 }
 
 static jfloat android_view_DisplayList_getTranslationX(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getTranslationX();
 }
 
 static jfloat android_view_DisplayList_getTranslationY(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getTranslationY();
 }
 
 static jfloat android_view_DisplayList_getRotation(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getRotation();
 }
 
 static jfloat android_view_DisplayList_getRotationX(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getRotationX();
 }
 
 static jfloat android_view_DisplayList_getRotationY(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getRotationY();
 }
 
 static jfloat android_view_DisplayList_getPivotX(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getPivotX();
 }
 
 static jfloat android_view_DisplayList_getPivotY(JNIEnv* env,
-        jobject clazz, jint displayListPtr) {
+        jobject clazz, jlong displayListPtr) {
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return displayList->getPivotY();
 }
@@ -372,61 +372,61 @@
 
 static JNINativeMethod gMethods[] = {
 #ifdef USE_OPENGL_RENDERER
-    { "nDestroyDisplayList",   "(I)V",   (void*) android_view_DisplayList_destroyDisplayList },
-    { "nGetDisplayListSize",   "(I)I",   (void*) android_view_DisplayList_getDisplayListSize },
-    { "nSetDisplayListName",   "(ILjava/lang/String;)V",
+    { "nDestroyDisplayList",   "(J)V",   (void*) android_view_DisplayList_destroyDisplayList },
+    { "nGetDisplayListSize",   "(J)I",   (void*) android_view_DisplayList_getDisplayListSize },
+    { "nSetDisplayListName",   "(JLjava/lang/String;)V",
             (void*) android_view_DisplayList_setDisplayListName },
-    { "nOutput",               "(I)V",  (void*) android_view_DisplayList_output },
+    { "nOutput",               "(J)V",  (void*) android_view_DisplayList_output },
 
-    { "nReset",                "(I)V",   (void*) android_view_DisplayList_reset },
-    { "nSetCaching",           "(IZ)V",  (void*) android_view_DisplayList_setCaching },
-    { "nSetStaticMatrix",      "(II)V",  (void*) android_view_DisplayList_setStaticMatrix },
-    { "nSetAnimationMatrix",   "(II)V",  (void*) android_view_DisplayList_setAnimationMatrix },
-    { "nSetClipToBounds",      "(IZ)V",  (void*) android_view_DisplayList_setClipToBounds },
-    { "nSetIsContainedVolume", "(IZ)V",  (void*) android_view_DisplayList_setIsContainedVolume },
-    { "nSetProjectToContainedVolume", "(IZ)V",
+    { "nReset",                "(J)V",   (void*) android_view_DisplayList_reset },
+    { "nSetCaching",           "(JZ)V",  (void*) android_view_DisplayList_setCaching },
+    { "nSetStaticMatrix",      "(JJ)V",  (void*) android_view_DisplayList_setStaticMatrix },
+    { "nSetAnimationMatrix",   "(JJ)V",  (void*) android_view_DisplayList_setAnimationMatrix },
+    { "nSetClipToBounds",      "(JZ)V",  (void*) android_view_DisplayList_setClipToBounds },
+    { "nSetIsContainedVolume", "(JZ)V",  (void*) android_view_DisplayList_setIsContainedVolume },
+    { "nSetProjectToContainedVolume", "(JZ)V",
             (void*) android_view_DisplayList_setProjectToContainedVolume },
-    { "nSetAlpha",             "(IF)V",  (void*) android_view_DisplayList_setAlpha },
-    { "nSetHasOverlappingRendering", "(IZ)V",
+    { "nSetAlpha",             "(JF)V",  (void*) android_view_DisplayList_setAlpha },
+    { "nSetHasOverlappingRendering", "(JZ)V",
             (void*) android_view_DisplayList_setHasOverlappingRendering },
-    { "nSetTranslationX",      "(IF)V",  (void*) android_view_DisplayList_setTranslationX },
-    { "nSetTranslationY",      "(IF)V",  (void*) android_view_DisplayList_setTranslationY },
-    { "nSetTranslationZ",      "(IF)V",  (void*) android_view_DisplayList_setTranslationZ },
-    { "nSetRotation",          "(IF)V",  (void*) android_view_DisplayList_setRotation },
-    { "nSetRotationX",         "(IF)V",  (void*) android_view_DisplayList_setRotationX },
-    { "nSetRotationY",         "(IF)V",  (void*) android_view_DisplayList_setRotationY },
-    { "nSetScaleX",            "(IF)V",  (void*) android_view_DisplayList_setScaleX },
-    { "nSetScaleY",            "(IF)V",  (void*) android_view_DisplayList_setScaleY },
-    { "nSetTransformationInfo","(IFFFFFFFFF)V",
+    { "nSetTranslationX",      "(JF)V",  (void*) android_view_DisplayList_setTranslationX },
+    { "nSetTranslationY",      "(JF)V",  (void*) android_view_DisplayList_setTranslationY },
+    { "nSetTranslationZ",      "(JF)V",  (void*) android_view_DisplayList_setTranslationZ },
+    { "nSetRotation",          "(JF)V",  (void*) android_view_DisplayList_setRotation },
+    { "nSetRotationX",         "(JF)V",  (void*) android_view_DisplayList_setRotationX },
+    { "nSetRotationY",         "(JF)V",  (void*) android_view_DisplayList_setRotationY },
+    { "nSetScaleX",            "(JF)V",  (void*) android_view_DisplayList_setScaleX },
+    { "nSetScaleY",            "(JF)V",  (void*) android_view_DisplayList_setScaleY },
+    { "nSetTransformationInfo","(JFFFFFFFFF)V",
             (void*) android_view_DisplayList_setTransformationInfo },
-    { "nSetPivotX",            "(IF)V",  (void*) android_view_DisplayList_setPivotX },
-    { "nSetPivotY",            "(IF)V",  (void*) android_view_DisplayList_setPivotY },
-    { "nSetCameraDistance",    "(IF)V",  (void*) android_view_DisplayList_setCameraDistance },
-    { "nSetLeft",              "(II)V",  (void*) android_view_DisplayList_setLeft },
-    { "nSetTop",               "(II)V",  (void*) android_view_DisplayList_setTop },
-    { "nSetRight",             "(II)V",  (void*) android_view_DisplayList_setRight },
-    { "nSetBottom",            "(II)V",  (void*) android_view_DisplayList_setBottom },
-    { "nSetLeftTopRightBottom","(IIIII)V", (void*) android_view_DisplayList_setLeftTopRightBottom },
-    { "nOffsetLeftAndRight",   "(IF)V",  (void*) android_view_DisplayList_offsetLeftAndRight },
-    { "nOffsetTopAndBottom",   "(IF)V",  (void*) android_view_DisplayList_offsetTopAndBottom },
+    { "nSetPivotX",            "(JF)V",  (void*) android_view_DisplayList_setPivotX },
+    { "nSetPivotY",            "(JF)V",  (void*) android_view_DisplayList_setPivotY },
+    { "nSetCameraDistance",    "(JF)V",  (void*) android_view_DisplayList_setCameraDistance },
+    { "nSetLeft",              "(JI)V",  (void*) android_view_DisplayList_setLeft },
+    { "nSetTop",               "(JI)V",  (void*) android_view_DisplayList_setTop },
+    { "nSetRight",             "(JI)V",  (void*) android_view_DisplayList_setRight },
+    { "nSetBottom",            "(JI)V",  (void*) android_view_DisplayList_setBottom },
+    { "nSetLeftTopRightBottom","(JIIII)V", (void*) android_view_DisplayList_setLeftTopRightBottom },
+    { "nOffsetLeftAndRight",   "(JF)V",  (void*) android_view_DisplayList_offsetLeftAndRight },
+    { "nOffsetTopAndBottom",   "(JF)V",  (void*) android_view_DisplayList_offsetTopAndBottom },
 
-    { "nGetMatrix",               "(II)V", (void*) android_view_DisplayList_getMatrix },
-    { "nHasOverlappingRendering", "(I)Z",  (void*) android_view_DisplayList_hasOverlappingRendering },
-    { "nGetAlpha",                "(I)F",  (void*) android_view_DisplayList_getAlpha },
-    { "nGetLeft",                 "(I)F",  (void*) android_view_DisplayList_getLeft },
-    { "nGetTop",                  "(I)F",  (void*) android_view_DisplayList_getTop },
-    { "nGetRight",                "(I)F",  (void*) android_view_DisplayList_getRight },
-    { "nGetBottom",               "(I)F",  (void*) android_view_DisplayList_getBottom },
-    { "nGetCameraDistance",       "(I)F",  (void*) android_view_DisplayList_getCameraDistance },
-    { "nGetScaleX",               "(I)F",  (void*) android_view_DisplayList_getScaleX },
-    { "nGetScaleY",               "(I)F",  (void*) android_view_DisplayList_getScaleY },
-    { "nGetTranslationX",         "(I)F",  (void*) android_view_DisplayList_getTranslationX },
-    { "nGetTranslationY",         "(I)F",  (void*) android_view_DisplayList_getTranslationY },
-    { "nGetRotation",             "(I)F",  (void*) android_view_DisplayList_getRotation },
-    { "nGetRotationX",            "(I)F",  (void*) android_view_DisplayList_getRotationX },
-    { "nGetRotationY",            "(I)F",  (void*) android_view_DisplayList_getRotationY },
-    { "nGetPivotX",               "(I)F",  (void*) android_view_DisplayList_getPivotX },
-    { "nGetPivotY",               "(I)F",  (void*) android_view_DisplayList_getPivotY },
+    { "nGetMatrix",               "(JJ)V", (void*) android_view_DisplayList_getMatrix },
+    { "nHasOverlappingRendering", "(J)Z",  (void*) android_view_DisplayList_hasOverlappingRendering },
+    { "nGetAlpha",                "(J)F",  (void*) android_view_DisplayList_getAlpha },
+    { "nGetLeft",                 "(J)F",  (void*) android_view_DisplayList_getLeft },
+    { "nGetTop",                  "(J)F",  (void*) android_view_DisplayList_getTop },
+    { "nGetRight",                "(J)F",  (void*) android_view_DisplayList_getRight },
+    { "nGetBottom",               "(J)F",  (void*) android_view_DisplayList_getBottom },
+    { "nGetCameraDistance",       "(J)F",  (void*) android_view_DisplayList_getCameraDistance },
+    { "nGetScaleX",               "(J)F",  (void*) android_view_DisplayList_getScaleX },
+    { "nGetScaleY",               "(J)F",  (void*) android_view_DisplayList_getScaleY },
+    { "nGetTranslationX",         "(J)F",  (void*) android_view_DisplayList_getTranslationX },
+    { "nGetTranslationY",         "(J)F",  (void*) android_view_DisplayList_getTranslationY },
+    { "nGetRotation",             "(J)F",  (void*) android_view_DisplayList_getRotation },
+    { "nGetRotationX",            "(J)F",  (void*) android_view_DisplayList_getRotationX },
+    { "nGetRotationY",            "(J)F",  (void*) android_view_DisplayList_getRotationY },
+    { "nGetPivotX",               "(J)F",  (void*) android_view_DisplayList_getPivotX },
+    { "nGetPivotY",               "(J)F",  (void*) android_view_DisplayList_getPivotY },
 #endif
 };
 
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 32e0f3b..6cc94e3 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -94,17 +94,17 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_flushCaches(JNIEnv* env, jobject clazz,
-        Caches::FlushMode mode) {
+        jint mode) {
     if (Caches::hasInstance()) {
-        Caches::getInstance().flush(mode);
+        Caches::getInstance().flush(static_cast<Caches::FlushMode>(mode));
     }
 }
 
-static bool android_view_GLES20Canvas_initCaches(JNIEnv* env, jobject clazz) {
+static jboolean android_view_GLES20Canvas_initCaches(JNIEnv* env, jobject clazz) {
     if (Caches::hasInstance()) {
-        return Caches::getInstance().init();
+        return Caches::getInstance().init() ? JNI_TRUE : JNI_FALSE;
     }
-    return false;
+    return JNI_FALSE;
 }
 
 static void android_view_GLES20Canvas_terminateCaches(JNIEnv* env, jobject clazz) {
@@ -132,15 +132,15 @@
 // Constructors
 // ----------------------------------------------------------------------------
 
-static jint android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) {
+static jlong android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) {
     RENDERER_LOGD("Create OpenGLRenderer");
     OpenGLRenderer* renderer = new OpenGLRenderer();
     renderer->initProperties();
-    return reinterpret_cast<jint>(renderer);
+    return reinterpret_cast<jlong>(renderer);
 }
 
 static void android_view_GLES20Canvas_destroyRenderer(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     RENDERER_LOGD("Destroy OpenGLRenderer");
     delete renderer;
@@ -151,26 +151,26 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_setViewport(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint width, jint height) {
+        jlong rendererPtr, jint width, jint height) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->setViewport(width, height);
 }
 
 static int android_view_GLES20Canvas_prepare(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jboolean opaque) {
+        jlong rendererPtr, jboolean opaque) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->prepare(opaque);
 }
 
 static int android_view_GLES20Canvas_prepareDirty(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint left, jint top, jint right, jint bottom,
+        jlong rendererPtr, jint left, jint top, jint right, jint bottom,
         jboolean opaque) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->prepareDirty(left, top, right, bottom, opaque);
 }
 
 static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->finish();
 }
@@ -198,13 +198,13 @@
 }
 
 static void android_view_GLES20Canvas_setCountOverdrawEnabled(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jboolean enabled) {
+        jlong rendererPtr, jboolean enabled) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->setCountOverdrawEnabled(enabled);
 }
 
 static jfloat android_view_GLES20Canvas_getOverdraw(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->getOverdraw();
 }
@@ -214,7 +214,7 @@
 // ----------------------------------------------------------------------------
 
 static jint android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint functorPtr) {
+        jlong rendererPtr, jlong functorPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Functor* functor = reinterpret_cast<Functor*>(functorPtr);
     android::uirenderer::Rect dirty;
@@ -222,21 +222,21 @@
 }
 
 static void android_view_GLES20Canvas_detachFunctor(JNIEnv* env,
-        jobject clazz, jint rendererPtr, jint functorPtr) {
+        jobject clazz, jlong rendererPtr, jint functorPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Functor* functor = reinterpret_cast<Functor*>(functorPtr);
     renderer->detachFunctor(functor);
 }
 
 static void android_view_GLES20Canvas_attachFunctor(JNIEnv* env,
-        jobject clazz, jint rendererPtr, jint functorPtr) {
+        jobject clazz, jlong rendererPtr, jlong functorPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Functor* functor = reinterpret_cast<Functor*>(functorPtr);
     renderer->attachFunctor(functor);
 }
 
 static jint android_view_GLES20Canvas_invokeFunctors(JNIEnv* env,
-        jobject clazz, jint rendererPtr, jobject dirty) {
+        jobject clazz, jlong rendererPtr, jobject dirty) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     android::uirenderer::Rect bounds;
     status_t status = renderer->invokeFunctors(bounds);
@@ -263,26 +263,26 @@
 // State
 // ----------------------------------------------------------------------------
 
-static jint android_view_GLES20Canvas_save(JNIEnv* env, jobject clazz, jint rendererPtr,
+static jint android_view_GLES20Canvas_save(JNIEnv* env, jobject clazz, jlong rendererPtr,
         jint flags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->save(flags);
 }
 
 static jint android_view_GLES20Canvas_getSaveCount(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->getSaveCount();
 }
 
 static void android_view_GLES20Canvas_restore(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->restore();
 }
 
 static void android_view_GLES20Canvas_restoreToCount(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint saveCount) {
+        jlong rendererPtr, jint saveCount) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->restoreToCount(saveCount);
 }
@@ -292,15 +292,15 @@
 // ----------------------------------------------------------------------------
 
 static jint android_view_GLES20Canvas_saveLayer(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        jint paintPtr, jint saveFlags) {
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jlong paintPtr, jint saveFlags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     return renderer->saveLayer(left, top, right, bottom, paint, saveFlags);
 }
 
 static jint android_view_GLES20Canvas_saveLayerClip(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint paintPtr, jint saveFlags) {
+        jlong rendererPtr, jlong paintPtr, jint saveFlags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     const android::uirenderer::Rect& bounds(renderer->getClipBounds());
@@ -309,14 +309,14 @@
 }
 
 static jint android_view_GLES20Canvas_saveLayerAlpha(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
         jint alpha, jint saveFlags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     return renderer->saveLayerAlpha(left, top, right, bottom, alpha, saveFlags);
 }
 
 static jint android_view_GLES20Canvas_saveLayerAlphaClip(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint alpha, jint saveFlags) {
+        jlong rendererPtr, jint alpha, jint saveFlags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const android::uirenderer::Rect& bounds(renderer->getClipBounds());
     return renderer->saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom,
@@ -327,49 +327,57 @@
 // Clipping
 // ----------------------------------------------------------------------------
 
-static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom) {
+static jboolean android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
-    return renderer->quickRejectConservative(left, top, right, bottom);
+    const bool result = renderer->quickRejectConservative(left, top, right, bottom);
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
-static bool android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jint op) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
-    return renderer->clipRect(left, top, right, bottom, op);
+    const bool result = renderer->clipRect(left, top, right, bottom,
+                                           static_cast<SkRegion::Op>(op));
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
-static bool android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint left, jint top, jint right, jint bottom,
-        SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jint left, jint top, jint right, jint bottom,
+        jint op) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
-    return renderer->clipRect(float(left), float(top), float(right), float(bottom), op);
+    const bool result = renderer->clipRect(float(left), float(top), float(right),
+                                           float(bottom),
+                                           static_cast<SkRegion::Op>(op));
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
-static bool android_view_GLES20Canvas_clipPath(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint pathPtr, SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipPath(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jlong pathPtr, jint op) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
-    return renderer->clipPath(path, op);
+    const bool result = renderer->clipPath(path, static_cast<SkRegion::Op>(op));
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
-static bool android_view_GLES20Canvas_clipRegion(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint regionPtr, SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRegion(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jlong regionPtr, jint op) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkRegion* region = reinterpret_cast<SkRegion*>(regionPtr);
-    return renderer->clipRegion(region, op);
+    const bool result = renderer->clipRegion(region, static_cast<SkRegion::Op>(op));
+    return result ? JNI_TRUE : JNI_FALSE;
 }
 
-static bool android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jobject rect) {
+static jboolean android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject clazz,
+        jlong rendererPtr, jobject rect) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const android::uirenderer::Rect& bounds(renderer->getClipBounds());
 
     env->CallVoidMethod(rect, gRectClassInfo.set,
             int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom));
 
-    return !bounds.isEmpty();
+    return !bounds.isEmpty() ? JNI_TRUE : JNI_FALSE;
 }
 
 // ----------------------------------------------------------------------------
@@ -377,45 +385,45 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_translate(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat dx, jfloat dy) {
+        jlong rendererPtr, jfloat dx, jfloat dy) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->translate(dx, dy);
 }
 
 static void android_view_GLES20Canvas_rotate(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat degrees) {
+        jlong rendererPtr, jfloat degrees) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->rotate(degrees);
 }
 
 static void android_view_GLES20Canvas_scale(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat sx, jfloat sy) {
+        jlong rendererPtr, jfloat sx, jfloat sy) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->scale(sx, sy);
 }
 
 static void android_view_GLES20Canvas_skew(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat sx, jfloat sy) {
+        jlong rendererPtr, jfloat sx, jfloat sy) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->skew(sx, sy);
 }
 
 static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint matrixPtr) {
+        jlong rendererPtr, jlong matrixPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     renderer->setMatrix(matrix);
 }
 
 static void android_view_GLES20Canvas_getMatrix(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint matrixPtr) {
+        jlong rendererPtr, jlong matrixPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     renderer->getMatrix(matrix);
 }
 
 static void android_view_GLES20Canvas_concatMatrix(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint matrixPtr) {
+        jlong rendererPtr, jlong matrixPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     renderer->concatMatrix(matrix);
@@ -426,8 +434,8 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_drawBitmap(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
-        jfloat left, jfloat top, jint paintPtr) {
+        jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
+        jfloat left, jfloat top, jlong paintPtr) {
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     // This object allows the renderer to allocate a global JNI ref to the buffer object.
     JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -438,9 +446,9 @@
 }
 
 static void android_view_GLES20Canvas_drawBitmapRect(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
+        jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
         float srcLeft, float srcTop, float srcRight, float srcBottom,
-        float dstLeft, float dstTop, float dstRight, float dstBottom, jint paintPtr) {
+        float dstLeft, float dstTop, float dstRight, float dstBottom, jlong paintPtr) {
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     // This object allows the renderer to allocate a global JNI ref to the buffer object.
     JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -452,8 +460,8 @@
 }
 
 static void android_view_GLES20Canvas_drawBitmapMatrix(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
-        jint matrixPtr, jint paintPtr) {
+        jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
+        jlong matrixPtr, jlong paintPtr) {
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     // This object allows the renderer to allocate a global JNI ref to the buffer object.
     JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -465,8 +473,8 @@
 }
 
 static void android_view_GLES20Canvas_drawBitmapData(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jintArray colors, jint offset, jint stride,
-        jfloat left, jfloat top, jint width, jint height, jboolean hasAlpha, jint paintPtr) {
+        jlong rendererPtr, jintArray colors, jint offset, jint stride,
+        jfloat left, jfloat top, jint width, jint height, jboolean hasAlpha, jlong paintPtr) {
     SkBitmap* bitmap = new SkBitmap;
     bitmap->setConfig(hasAlpha ? SkBitmap::kARGB_8888_Config : SkBitmap::kRGB_565_Config,
             width, height);
@@ -492,9 +500,9 @@
 }
 
 static void android_view_GLES20Canvas_drawBitmapMesh(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
+        jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
         jint meshWidth, jint meshHeight, jfloatArray vertices, jint offset, jintArray colors,
-        jint colorOffset, jint paintPtr) {
+        jint colorOffset, jlong paintPtr) {
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     // This object allows the renderer to allocate a global JNI ref to the buffer object.
     JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -511,8 +519,8 @@
 }
 
 static void android_view_GLES20Canvas_drawPatch(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint bitmapPtr, jbyteArray buffer, jint patchPtr,
-        float left, float top, float right, float bottom, jint paintPtr) {
+        jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer, jlong patchPtr,
+        float left, float top, float right, float bottom, jlong paintPtr) {
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     // This object allows the renderer to allocate a global JNI ref to the buffer object.
     JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -524,52 +532,52 @@
 }
 
 static void android_view_GLES20Canvas_drawColor(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint color, SkXfermode::Mode mode) {
+        jlong rendererPtr, jint color, jint mode) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
-    renderer->drawColor(color, mode);
+    renderer->drawColor(color, static_cast<SkXfermode::Mode>(mode));
 }
 
 static void android_view_GLES20Canvas_drawRect(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        jint paintPtr) {
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     renderer->drawRect(left, top, right, bottom, paint);
 }
 
 static void android_view_GLES20Canvas_drawRoundRect(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        jfloat rx, jfloat ry, jint paintPtr) {
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jfloat rx, jfloat ry, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     renderer->drawRoundRect(left, top, right, bottom, rx, ry, paint);
 }
 
 static void android_view_GLES20Canvas_drawCircle(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat x, jfloat y, jfloat radius, jint paintPtr) {
+        jlong rendererPtr, jfloat x, jfloat y, jfloat radius, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     renderer->drawCircle(x, y, radius, paint);
 }
 
 static void android_view_GLES20Canvas_drawOval(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        jint paintPtr) {
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     renderer->drawOval(left, top, right, bottom, paint);
 }
 
 static void android_view_GLES20Canvas_drawArc(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
-        jfloat startAngle, jfloat sweepAngle, jboolean useCenter, jint paintPtr) {
+        jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+        jfloat startAngle, jfloat sweepAngle, jboolean useCenter, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
     renderer->drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint);
 }
 
 static void android_view_GLES20Canvas_drawRegionAsRects(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint regionPtr, jint paintPtr) {
+        jlong rendererPtr, jlong regionPtr, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkRegion* region = reinterpret_cast<SkRegion*>(regionPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -599,7 +607,7 @@
 }
 
 static void android_view_GLES20Canvas_drawRects(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloatArray rects, jint count, jint paintPtr) {
+        jlong rendererPtr, jfloatArray rects, jint count, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jfloat* storage = env->GetFloatArrayElements(rects, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -608,7 +616,7 @@
 }
 
 static void android_view_GLES20Canvas_drawPoints(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloatArray points, jint offset, jint count, jint paintPtr) {
+        jlong rendererPtr, jfloatArray points, jint offset, jint count, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jfloat* storage = env->GetFloatArrayElements(points, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -617,7 +625,7 @@
 }
 
 static void android_view_GLES20Canvas_drawPath(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint pathPtr, jint paintPtr) {
+        jlong rendererPtr, jlong pathPtr, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -625,7 +633,7 @@
 }
 
 static void android_view_GLES20Canvas_drawLines(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloatArray points, jint offset, jint count, jint paintPtr) {
+        jlong rendererPtr, jfloatArray points, jint offset, jint count, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jfloat* storage = env->GetFloatArrayElements(points, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -638,7 +646,7 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_resetModifiers(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint modifiers) {
+        jlong rendererPtr, jint modifiers) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     if (modifiers & MODIFIER_SHADOW) renderer->resetShadow();
     if (modifiers & MODIFIER_SHADER) renderer->resetShader();
@@ -646,21 +654,21 @@
 }
 
 static void android_view_GLES20Canvas_setupShader(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint shaderPtr) {
+        jlong rendererPtr, jlong shaderPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkiaShader* shader = reinterpret_cast<SkiaShader*>(shaderPtr);
     renderer->setupShader(shader);
 }
 
 static void android_view_GLES20Canvas_setupColorFilter(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint colorFilterPtr) {
+        jlong rendererPtr, jlong colorFilterPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     SkiaColorFilter* colorFilter = reinterpret_cast<SkiaColorFilter*>(colorFilterPtr);
     renderer->setupColorFilter(colorFilter);
 }
 
 static void android_view_GLES20Canvas_setupShadow(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jfloat radius, jfloat dx, jfloat dy, jint color) {
+        jlong rendererPtr, jfloat radius, jfloat dx, jfloat dy, jint color) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->setupShadow(radius, dx, dy, color);
 }
@@ -670,13 +678,13 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_setupPaintFilter(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint clearBits, jint setBits) {
+        jlong rendererPtr, jint clearBits, jint setBits) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->setupPaintFilter(clearBits, setBits);
 }
 
 static void android_view_GLES20Canvas_resetPaintFilter(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->resetPaintFilter();
 }
@@ -757,8 +765,8 @@
 }
 
 static void android_view_GLES20Canvas_drawTextArray(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jcharArray text, jint index, jint count,
-        jfloat x, jfloat y, jint flags, jint paintPtr) {
+        jlong rendererPtr, jcharArray text, jint index, jint count,
+        jfloat x, jfloat y, jint flags, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jchar* textArray = env->GetCharArrayElements(text, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -768,8 +776,8 @@
 }
 
 static void android_view_GLES20Canvas_drawText(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jstring text, jint start, jint end,
-        jfloat x, jfloat y, jint flags, jint paintPtr) {
+        jlong rendererPtr, jstring text, jint start, jint end,
+        jfloat x, jfloat y, jint flags, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const jchar* textArray = env->GetStringChars(text, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -779,8 +787,8 @@
 }
 
 static void android_view_GLES20Canvas_drawTextArrayOnPath(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jcharArray text, jint index, jint count,
-        jint pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jint paintPtr) {
+        jlong rendererPtr, jcharArray text, jint index, jint count,
+        jlong pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jchar* textArray = env->GetCharArrayElements(text, NULL);
     SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
@@ -792,8 +800,8 @@
 }
 
 static void android_view_GLES20Canvas_drawTextOnPath(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jstring text, jint start, jint end,
-        jint pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jint paintPtr) {
+        jlong rendererPtr, jstring text, jint start, jint end,
+        jlong pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const jchar* textArray = env->GetStringChars(text, NULL);
     SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
@@ -805,9 +813,9 @@
 }
 
 static void android_view_GLES20Canvas_drawTextRunArray(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jcharArray text, jint index, jint count,
+        jlong rendererPtr, jcharArray text, jint index, jint count,
         jint contextIndex, jint contextCount, jfloat x, jfloat y, jint dirFlags,
-        jint paintPtr) {
+        jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jchar* textArray = env->GetCharArrayElements(text, NULL);
     SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -818,9 +826,9 @@
  }
 
 static void android_view_GLES20Canvas_drawTextRun(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jstring text, jint start, jint end,
+        jlong rendererPtr, jstring text, jint start, jint end,
         jint contextStart, int contextEnd, jfloat x, jfloat y, jint dirFlags,
-        jint paintPtr) {
+        jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const jchar* textArray = env->GetStringChars(text, NULL);
     jint count = end - start;
@@ -848,8 +856,8 @@
 }
 
 static void android_view_GLES20Canvas_drawPosTextArray(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jcharArray text, jint index, jint count,
-        jfloatArray pos, jint paintPtr) {
+        jlong rendererPtr, jcharArray text, jint index, jint count,
+        jfloatArray pos, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     jchar* textArray = env->GetCharArrayElements(text, NULL);
     jfloat* positions = env->GetFloatArrayElements(pos, NULL);
@@ -862,8 +870,8 @@
 }
 
 static void android_view_GLES20Canvas_drawPosText(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jstring text, jint start, jint end,
-        jfloatArray pos, jint paintPtr) {
+        jlong rendererPtr, jstring text, jint start, jint end,
+        jfloatArray pos, jlong paintPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     const jchar* textArray = env->GetStringChars(text, NULL);
     jfloat* positions = env->GetFloatArrayElements(pos, NULL);
@@ -880,7 +888,7 @@
 // ----------------------------------------------------------------------------
 
 static jint android_view_GLES20Canvas_getDisplayList(JNIEnv* env,
-        jobject clazz, jint rendererPtr, jint displayListPtr) {
+        jobject clazz, jlong rendererPtr, jlong displayListPtr) {
     DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
     return reinterpret_cast<jint>(renderer->getDisplayList(displayList));
@@ -892,13 +900,13 @@
 }
 
 static void android_view_GLES20Canvas_resetDisplayListRenderer(JNIEnv* env,
-        jobject clazz, jint rendererPtr) {
+        jobject clazz, jlong rendererPtr) {
     DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
     renderer->reset();
 }
 
 static jint android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
-        jobject clazz, jint rendererPtr, jint displayListPtr,
+        jobject clazz, jlong rendererPtr, jlong displayListPtr,
         jobject dirty, jint flags) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
@@ -916,19 +924,19 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_interrupt(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->interrupt();
 }
 
 static void android_view_GLES20Canvas_resume(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->resume();
 }
 
 static jint android_view_GLES20Canvas_createLayerRenderer(JNIEnv* env,
-        jobject clazz, jint layerPtr) {
+        jobject clazz, jlong layerPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     if (layer) {
         OpenGLRenderer* renderer = new LayerRenderer(layer);
@@ -938,7 +946,7 @@
     return NULL;
 }
 
-static jint android_view_GLES20Canvas_createTextureLayer(JNIEnv* env, jobject clazz,
+static jlong android_view_GLES20Canvas_createTextureLayer(JNIEnv* env, jobject clazz,
         jboolean isOpaque, jintArray layerInfo) {
     Layer* layer = LayerRenderer::createTextureLayer(isOpaque);
 
@@ -948,10 +956,10 @@
         env->ReleaseIntArrayElements(layerInfo, storage, 0);
     }
 
-    return reinterpret_cast<jint>(layer);
+    return reinterpret_cast<jlong>(layer);
 }
 
-static jint android_view_GLES20Canvas_createLayer(JNIEnv* env, jobject clazz,
+static jlong android_view_GLES20Canvas_createLayer(JNIEnv* env, jobject clazz,
         jint width, jint height, jboolean isOpaque, jintArray layerInfo) {
     Layer* layer = LayerRenderer::createLayer(width, height, isOpaque);
 
@@ -962,24 +970,24 @@
         env->ReleaseIntArrayElements(layerInfo, storage, 0);
     }
 
-    return reinterpret_cast<jint>(layer);
+    return reinterpret_cast<jlong>(layer);
 }
 
-static bool android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint width, jint height, jintArray layerInfo) {
+static jboolean android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz,
+        jlong layerPtr, jint width, jint height, jintArray layerInfo) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     if (LayerRenderer::resizeLayer(layer, width, height)) {
         jint* storage = env->GetIntArrayElements(layerInfo, NULL);
         storage[0] = layer->getWidth();
         storage[1] = layer->getHeight();
         env->ReleaseIntArrayElements(layerInfo, storage, 0);
-        return true;
+        return JNI_TRUE;
     }
-    return false;
+    return JNI_FALSE;
 }
 
 static void android_view_GLES20Canvas_setLayerPaint(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint paintPtr) {
+        jlong layerPtr, jlong paintPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     if (layer) {
         SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -988,7 +996,7 @@
 }
 
 static void android_view_GLES20Canvas_setLayerColorFilter(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint colorFilterPtr) {
+        jlong layerPtr, jlong colorFilterPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     if (layer) {
         SkiaColorFilter* colorFilter = reinterpret_cast<SkiaColorFilter*>(colorFilterPtr);
@@ -997,7 +1005,7 @@
 }
 
 static void android_view_GLES20Canvas_setOpaqueLayer(JNIEnv* env, jobject clazz,
-        jint layerPtr, jboolean isOpaque) {
+        jlong layerPtr, jboolean isOpaque) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     if (layer) {
         layer->setBlend(!isOpaque);
@@ -1005,7 +1013,7 @@
 }
 
 static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint width, jint height, jboolean isOpaque, jobject surface) {
+        jlong layerPtr, jint width, jint height, jboolean isOpaque, jobject surface) {
     float transform[16];
     sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
 
@@ -1036,7 +1044,7 @@
 }
 
 static void android_view_GLES20Canvas_updateRenderLayer(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint rendererPtr, jint displayListPtr,
+        jlong layerPtr, jlong rendererPtr, jlong displayListPtr,
         jint left, jint top, jint right, jint bottom) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
@@ -1045,65 +1053,65 @@
 }
 
 static void android_view_GLES20Canvas_clearLayerTexture(JNIEnv* env, jobject clazz,
-        jint layerPtr) {
+        jlong layerPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     layer->clearTexture();
 }
 
 static void android_view_GLES20Canvas_setTextureLayerTransform(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint matrixPtr) {
+        jlong layerPtr, jlong matrixPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
     layer->getTransform().load(*matrix);
 }
 
-static void android_view_GLES20Canvas_destroyLayer(JNIEnv* env, jobject clazz, jint layerPtr) {
+static void android_view_GLES20Canvas_destroyLayer(JNIEnv* env, jobject clazz, jlong layerPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     LayerRenderer::destroyLayer(layer);
 }
 
 static void android_view_GLES20Canvas_destroyLayerDeferred(JNIEnv* env,
-        jobject clazz, jint layerPtr) {
+        jobject clazz, jlong layerPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     LayerRenderer::destroyLayerDeferred(layer);
 }
 
 static void android_view_GLES20Canvas_drawLayer(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint layerPtr, jfloat x, jfloat y) {
+        jlong rendererPtr, jlong layerPtr, jfloat x, jfloat y) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     renderer->drawLayer(layer, x, y);
 }
 
 static jboolean android_view_GLES20Canvas_copyLayer(JNIEnv* env, jobject clazz,
-        jint layerPtr, jint bitmapPtr) {
+        jlong layerPtr, jlong bitmapPtr) {
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
     return LayerRenderer::copyLayer(layer, bitmap);
 }
 
 static void android_view_GLES20Canvas_pushLayerUpdate(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint layerPtr) {
+        jlong rendererPtr, jlong layerPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     renderer->pushLayerUpdate(layer);
 }
 
 static void android_view_GLES20Canvas_cancelLayerUpdate(JNIEnv* env, jobject clazz,
-        jint rendererPtr, jint layerPtr) {
+        jlong rendererPtr, jlong layerPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     Layer* layer = reinterpret_cast<Layer*>(layerPtr);
     renderer->cancelLayerUpdate(layer);
 }
 
 static void android_view_GLES20Canvas_clearLayerUpdates(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->clearLayerUpdates();
 }
 
 static void android_view_GLES20Canvas_flushLayerUpdates(JNIEnv* env, jobject clazz,
-        jint rendererPtr) {
+        jlong rendererPtr) {
     OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
     renderer->flushLayerUpdates();
 }
@@ -1159,131 +1167,131 @@
     { "nInitAtlas",         "(Landroid/view/GraphicBuffer;[II)V",
             (void*) android_view_GLES20Canvas_initAtlas },
 
-    { "nCreateRenderer",    "()I",             (void*) android_view_GLES20Canvas_createRenderer },
-    { "nDestroyRenderer",   "(I)V",            (void*) android_view_GLES20Canvas_destroyRenderer },
-    { "nSetViewport",       "(III)V",          (void*) android_view_GLES20Canvas_setViewport },
-    { "nPrepare",           "(IZ)I",           (void*) android_view_GLES20Canvas_prepare },
-    { "nPrepareDirty",      "(IIIIIZ)I",       (void*) android_view_GLES20Canvas_prepareDirty },
-    { "nFinish",            "(I)V",            (void*) android_view_GLES20Canvas_finish },
+    { "nCreateRenderer",    "()J",             (void*) android_view_GLES20Canvas_createRenderer },
+    { "nDestroyRenderer",   "(J)V",            (void*) android_view_GLES20Canvas_destroyRenderer },
+    { "nSetViewport",       "(JII)V",          (void*) android_view_GLES20Canvas_setViewport },
+    { "nPrepare",           "(JZ)I",           (void*) android_view_GLES20Canvas_prepare },
+    { "nPrepareDirty",      "(JIIIIZ)I",       (void*) android_view_GLES20Canvas_prepareDirty },
+    { "nFinish",            "(J)V",            (void*) android_view_GLES20Canvas_finish },
     { "nSetProperty",           "(Ljava/lang/String;Ljava/lang/String;)V",
             (void*) android_view_GLES20Canvas_setProperty },
 
-    { "nSetCountOverdrawEnabled", "(IZ)V",     (void*) android_view_GLES20Canvas_setCountOverdrawEnabled },
-    { "nGetOverdraw",             "(I)F",      (void*) android_view_GLES20Canvas_getOverdraw },
+    { "nSetCountOverdrawEnabled", "(JZ)V",     (void*) android_view_GLES20Canvas_setCountOverdrawEnabled },
+    { "nGetOverdraw",             "(J)F",      (void*) android_view_GLES20Canvas_getOverdraw },
 
     { "nGetStencilSize",    "()I",             (void*) android_view_GLES20Canvas_getStencilSize },
 
-    { "nCallDrawGLFunction", "(II)I",          (void*) android_view_GLES20Canvas_callDrawGLFunction },
-    { "nDetachFunctor",      "(II)V",          (void*) android_view_GLES20Canvas_detachFunctor },
-    { "nAttachFunctor",      "(II)V",          (void*) android_view_GLES20Canvas_attachFunctor },
-    { "nInvokeFunctors",     "(ILandroid/graphics/Rect;)I",
+    { "nCallDrawGLFunction", "(JJ)I",          (void*) android_view_GLES20Canvas_callDrawGLFunction },
+    { "nDetachFunctor",      "(JJ)V",          (void*) android_view_GLES20Canvas_detachFunctor },
+    { "nAttachFunctor",      "(JJ)V",          (void*) android_view_GLES20Canvas_attachFunctor },
+    { "nInvokeFunctors",     "(JLandroid/graphics/Rect;)I",
             (void*) android_view_GLES20Canvas_invokeFunctors },
 
-    { "nSave",              "(II)I",           (void*) android_view_GLES20Canvas_save },
-    { "nRestore",           "(I)V",            (void*) android_view_GLES20Canvas_restore },
-    { "nRestoreToCount",    "(II)V",           (void*) android_view_GLES20Canvas_restoreToCount },
-    { "nGetSaveCount",      "(I)I",            (void*) android_view_GLES20Canvas_getSaveCount },
+    { "nSave",              "(JI)I",           (void*) android_view_GLES20Canvas_save },
+    { "nRestore",           "(J)V",            (void*) android_view_GLES20Canvas_restore },
+    { "nRestoreToCount",    "(JI)V",           (void*) android_view_GLES20Canvas_restoreToCount },
+    { "nGetSaveCount",      "(J)I",            (void*) android_view_GLES20Canvas_getSaveCount },
 
-    { "nSaveLayer",         "(IFFFFII)I",      (void*) android_view_GLES20Canvas_saveLayer },
-    { "nSaveLayer",         "(III)I",          (void*) android_view_GLES20Canvas_saveLayerClip },
-    { "nSaveLayerAlpha",    "(IFFFFII)I",      (void*) android_view_GLES20Canvas_saveLayerAlpha },
-    { "nSaveLayerAlpha",    "(III)I",          (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
+    { "nSaveLayer",         "(JFFFFJI)I",      (void*) android_view_GLES20Canvas_saveLayer },
+    { "nSaveLayer",         "(JJI)I",          (void*) android_view_GLES20Canvas_saveLayerClip },
+    { "nSaveLayerAlpha",    "(JFFFFII)I",      (void*) android_view_GLES20Canvas_saveLayerAlpha },
+    { "nSaveLayerAlpha",    "(JII)I",          (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
 
-    { "nQuickReject",       "(IFFFF)Z",        (void*) android_view_GLES20Canvas_quickReject },
-    { "nClipRect",          "(IFFFFI)Z",       (void*) android_view_GLES20Canvas_clipRectF },
-    { "nClipRect",          "(IIIIII)Z",       (void*) android_view_GLES20Canvas_clipRect },
-    { "nClipPath",          "(III)Z",          (void*) android_view_GLES20Canvas_clipPath },
-    { "nClipRegion",        "(III)Z",          (void*) android_view_GLES20Canvas_clipRegion },
+    { "nQuickReject",       "(JFFFF)Z",        (void*) android_view_GLES20Canvas_quickReject },
+    { "nClipRect",          "(JFFFFI)Z",       (void*) android_view_GLES20Canvas_clipRectF },
+    { "nClipRect",          "(JIIIII)Z",       (void*) android_view_GLES20Canvas_clipRect },
+    { "nClipPath",          "(JJI)Z",          (void*) android_view_GLES20Canvas_clipPath },
+    { "nClipRegion",        "(JJI)Z",          (void*) android_view_GLES20Canvas_clipRegion },
 
-    { "nTranslate",         "(IFF)V",          (void*) android_view_GLES20Canvas_translate },
-    { "nRotate",            "(IF)V",           (void*) android_view_GLES20Canvas_rotate },
-    { "nScale",             "(IFF)V",          (void*) android_view_GLES20Canvas_scale },
-    { "nSkew",              "(IFF)V",          (void*) android_view_GLES20Canvas_skew },
+    { "nTranslate",         "(JFF)V",          (void*) android_view_GLES20Canvas_translate },
+    { "nRotate",            "(JF)V",           (void*) android_view_GLES20Canvas_rotate },
+    { "nScale",             "(JFF)V",          (void*) android_view_GLES20Canvas_scale },
+    { "nSkew",              "(JFF)V",          (void*) android_view_GLES20Canvas_skew },
 
-    { "nSetMatrix",         "(II)V",           (void*) android_view_GLES20Canvas_setMatrix },
-    { "nGetMatrix",         "(II)V",           (void*) android_view_GLES20Canvas_getMatrix },
-    { "nConcatMatrix",      "(II)V",           (void*) android_view_GLES20Canvas_concatMatrix },
+    { "nSetMatrix",         "(JJ)V",           (void*) android_view_GLES20Canvas_setMatrix },
+    { "nGetMatrix",         "(JJ)V",           (void*) android_view_GLES20Canvas_getMatrix },
+    { "nConcatMatrix",      "(JJ)V",           (void*) android_view_GLES20Canvas_concatMatrix },
 
-    { "nDrawBitmap",        "(II[BFFI)V",      (void*) android_view_GLES20Canvas_drawBitmap },
-    { "nDrawBitmap",        "(II[BFFFFFFFFI)V",(void*) android_view_GLES20Canvas_drawBitmapRect },
-    { "nDrawBitmap",        "(II[BII)V",       (void*) android_view_GLES20Canvas_drawBitmapMatrix },
-    { "nDrawBitmap",        "(I[IIIFFIIZI)V",  (void*) android_view_GLES20Canvas_drawBitmapData },
+    { "nDrawBitmap",        "(JJ[BFFJ)V",      (void*) android_view_GLES20Canvas_drawBitmap },
+    { "nDrawBitmap",        "(JJ[BFFFFFFFFJ)V",(void*) android_view_GLES20Canvas_drawBitmapRect },
+    { "nDrawBitmap",        "(JJ[BJJ)V",       (void*) android_view_GLES20Canvas_drawBitmapMatrix },
+    { "nDrawBitmap",        "(J[IIIFFIIZJ)V",  (void*) android_view_GLES20Canvas_drawBitmapData },
 
-    { "nDrawBitmapMesh",    "(II[BII[FI[III)V",(void*) android_view_GLES20Canvas_drawBitmapMesh },
+    { "nDrawBitmapMesh",    "(JJ[BII[FI[IIJ)V",(void*) android_view_GLES20Canvas_drawBitmapMesh },
 
-    { "nDrawPatch",         "(II[BIFFFFI)V",   (void*) android_view_GLES20Canvas_drawPatch },
+    { "nDrawPatch",         "(JJ[BJFFFFJ)V",   (void*) android_view_GLES20Canvas_drawPatch },
 
-    { "nDrawColor",         "(III)V",          (void*) android_view_GLES20Canvas_drawColor },
-    { "nDrawRect",          "(IFFFFI)V",       (void*) android_view_GLES20Canvas_drawRect },
-    { "nDrawRects",         "(III)V",          (void*) android_view_GLES20Canvas_drawRegionAsRects },
-    { "nDrawRects",         "(I[FII)V",        (void*) android_view_GLES20Canvas_drawRects },
-    { "nDrawRoundRect",     "(IFFFFFFI)V",     (void*) android_view_GLES20Canvas_drawRoundRect },
-    { "nDrawCircle",        "(IFFFI)V",        (void*) android_view_GLES20Canvas_drawCircle },
-    { "nDrawOval",          "(IFFFFI)V",       (void*) android_view_GLES20Canvas_drawOval },
-    { "nDrawArc",           "(IFFFFFFZI)V",    (void*) android_view_GLES20Canvas_drawArc },
-    { "nDrawPoints",        "(I[FIII)V",       (void*) android_view_GLES20Canvas_drawPoints },
+    { "nDrawColor",         "(JII)V",          (void*) android_view_GLES20Canvas_drawColor },
+    { "nDrawRect",          "(JFFFFJ)V",       (void*) android_view_GLES20Canvas_drawRect },
+    { "nDrawRects",         "(JJJ)V",          (void*) android_view_GLES20Canvas_drawRegionAsRects },
+    { "nDrawRects",         "(J[FIJ)V",        (void*) android_view_GLES20Canvas_drawRects },
+    { "nDrawRoundRect",     "(JFFFFFFJ)V",     (void*) android_view_GLES20Canvas_drawRoundRect },
+    { "nDrawCircle",        "(JFFFJ)V",        (void*) android_view_GLES20Canvas_drawCircle },
+    { "nDrawOval",          "(JFFFFJ)V",       (void*) android_view_GLES20Canvas_drawOval },
+    { "nDrawArc",           "(JFFFFFFZJ)V",    (void*) android_view_GLES20Canvas_drawArc },
+    { "nDrawPoints",        "(J[FIIJ)V",       (void*) android_view_GLES20Canvas_drawPoints },
 
-    { "nDrawPath",          "(III)V",          (void*) android_view_GLES20Canvas_drawPath },
-    { "nDrawLines",         "(I[FIII)V",       (void*) android_view_GLES20Canvas_drawLines },
+    { "nDrawPath",          "(JJJ)V",          (void*) android_view_GLES20Canvas_drawPath },
+    { "nDrawLines",         "(J[FIIJ)V",       (void*) android_view_GLES20Canvas_drawLines },
 
-    { "nResetModifiers",    "(II)V",           (void*) android_view_GLES20Canvas_resetModifiers },
-    { "nSetupShader",       "(II)V",           (void*) android_view_GLES20Canvas_setupShader },
-    { "nSetupColorFilter",  "(II)V",           (void*) android_view_GLES20Canvas_setupColorFilter },
-    { "nSetupShadow",       "(IFFFI)V",        (void*) android_view_GLES20Canvas_setupShadow },
+    { "nResetModifiers",    "(JI)V",           (void*) android_view_GLES20Canvas_resetModifiers },
+    { "nSetupShader",       "(JJ)V",           (void*) android_view_GLES20Canvas_setupShader },
+    { "nSetupColorFilter",  "(JJ)V",           (void*) android_view_GLES20Canvas_setupColorFilter },
+    { "nSetupShadow",       "(JFFFI)V",        (void*) android_view_GLES20Canvas_setupShadow },
 
-    { "nSetupPaintFilter",  "(III)V",          (void*) android_view_GLES20Canvas_setupPaintFilter },
-    { "nResetPaintFilter",  "(I)V",            (void*) android_view_GLES20Canvas_resetPaintFilter },
+    { "nSetupPaintFilter",  "(JII)V",          (void*) android_view_GLES20Canvas_setupPaintFilter },
+    { "nResetPaintFilter",  "(J)V",            (void*) android_view_GLES20Canvas_resetPaintFilter },
 
-    { "nDrawText",          "(I[CIIFFII)V",    (void*) android_view_GLES20Canvas_drawTextArray },
-    { "nDrawText",          "(ILjava/lang/String;IIFFII)V",
+    { "nDrawText",          "(J[CIIFFIJ)V",    (void*) android_view_GLES20Canvas_drawTextArray },
+    { "nDrawText",          "(JLjava/lang/String;IIFFIJ)V",
             (void*) android_view_GLES20Canvas_drawText },
 
-    { "nDrawTextOnPath",    "(I[CIIIFFII)V",   (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
-    { "nDrawTextOnPath",    "(ILjava/lang/String;IIIFFII)V",
+    { "nDrawTextOnPath",    "(J[CIIJFFIJ)V",   (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
+    { "nDrawTextOnPath",    "(JLjava/lang/String;IIJFFIJ)V",
             (void*) android_view_GLES20Canvas_drawTextOnPath },
 
-    { "nDrawTextRun",       "(I[CIIIIFFII)V",  (void*) android_view_GLES20Canvas_drawTextRunArray },
-    { "nDrawTextRun",       "(ILjava/lang/String;IIIIFFII)V",
+    { "nDrawTextRun",       "(J[CIIIIFFIJ)V",  (void*) android_view_GLES20Canvas_drawTextRunArray },
+    { "nDrawTextRun",       "(JLjava/lang/String;IIIIFFIJ)V",
             (void*) android_view_GLES20Canvas_drawTextRun },
 
-    { "nDrawPosText",       "(I[CII[FI)V",     (void*) android_view_GLES20Canvas_drawPosTextArray },
-    { "nDrawPosText",       "(ILjava/lang/String;II[FI)V",
+    { "nDrawPosText",       "(J[CII[FJ)V",     (void*) android_view_GLES20Canvas_drawPosTextArray },
+    { "nDrawPosText",       "(JLjava/lang/String;II[FJ)V",
             (void*) android_view_GLES20Canvas_drawPosText },
 
-    { "nGetClipBounds",     "(ILandroid/graphics/Rect;)Z",
+    { "nGetClipBounds",     "(JLandroid/graphics/Rect;)Z",
             (void*) android_view_GLES20Canvas_getClipBounds },
 
-    { "nGetDisplayList",         "(II)I",      (void*) android_view_GLES20Canvas_getDisplayList },
-    { "nDrawDisplayList",        "(IILandroid/graphics/Rect;I)I",
+    { "nGetDisplayList",         "(JJ)J",      (void*) android_view_GLES20Canvas_getDisplayList },
+    { "nDrawDisplayList",        "(JJLandroid/graphics/Rect;I)I",
             (void*) android_view_GLES20Canvas_drawDisplayList },
 
-    { "nCreateDisplayListRenderer", "()I",     (void*) android_view_GLES20Canvas_createDisplayListRenderer },
-    { "nResetDisplayListRenderer",  "(I)V",    (void*) android_view_GLES20Canvas_resetDisplayListRenderer },
+    { "nCreateDisplayListRenderer", "()J",     (void*) android_view_GLES20Canvas_createDisplayListRenderer },
+    { "nResetDisplayListRenderer",  "(J)V",    (void*) android_view_GLES20Canvas_resetDisplayListRenderer },
 
-    { "nInterrupt",              "(I)V",       (void*) android_view_GLES20Canvas_interrupt },
-    { "nResume",                 "(I)V",       (void*) android_view_GLES20Canvas_resume },
+    { "nInterrupt",              "(J)V",       (void*) android_view_GLES20Canvas_interrupt },
+    { "nResume",                 "(J)V",       (void*) android_view_GLES20Canvas_resume },
 
-    { "nCreateLayerRenderer",    "(I)I",       (void*) android_view_GLES20Canvas_createLayerRenderer },
-    { "nCreateLayer",            "(IIZ[I)I",   (void*) android_view_GLES20Canvas_createLayer },
-    { "nResizeLayer",            "(III[I)Z" ,  (void*) android_view_GLES20Canvas_resizeLayer },
-    { "nSetLayerPaint",          "(II)V",      (void*) android_view_GLES20Canvas_setLayerPaint },
-    { "nSetLayerColorFilter",    "(II)V",      (void*) android_view_GLES20Canvas_setLayerColorFilter },
-    { "nSetOpaqueLayer",         "(IZ)V",      (void*) android_view_GLES20Canvas_setOpaqueLayer },
-    { "nCreateTextureLayer",     "(Z[I)I",     (void*) android_view_GLES20Canvas_createTextureLayer },
-    { "nUpdateTextureLayer",     "(IIIZLandroid/graphics/SurfaceTexture;)V",
+    { "nCreateLayerRenderer",    "(J)J",       (void*) android_view_GLES20Canvas_createLayerRenderer },
+    { "nCreateLayer",            "(IIZ[I)J",   (void*) android_view_GLES20Canvas_createLayer },
+    { "nResizeLayer",            "(JII[I)Z" ,  (void*) android_view_GLES20Canvas_resizeLayer },
+    { "nSetLayerPaint",          "(JJ)V",      (void*) android_view_GLES20Canvas_setLayerPaint },
+    { "nSetLayerColorFilter",    "(JJ)V",      (void*) android_view_GLES20Canvas_setLayerColorFilter },
+    { "nSetOpaqueLayer",         "(JZ)V",      (void*) android_view_GLES20Canvas_setOpaqueLayer },
+    { "nCreateTextureLayer",     "(Z[I)J",     (void*) android_view_GLES20Canvas_createTextureLayer },
+    { "nUpdateTextureLayer",     "(JIIZLandroid/graphics/SurfaceTexture;)V",
             (void*) android_view_GLES20Canvas_updateTextureLayer },
-    { "nUpdateRenderLayer",      "(IIIIIII)V", (void*) android_view_GLES20Canvas_updateRenderLayer },
-    { "nClearLayerTexture",      "(I)V",       (void*) android_view_GLES20Canvas_clearLayerTexture },
-    { "nDestroyLayer",           "(I)V",       (void*) android_view_GLES20Canvas_destroyLayer },
-    { "nDestroyLayerDeferred",   "(I)V",       (void*) android_view_GLES20Canvas_destroyLayerDeferred },
-    { "nDrawLayer",              "(IIFF)V",    (void*) android_view_GLES20Canvas_drawLayer },
-    { "nCopyLayer",              "(II)Z",      (void*) android_view_GLES20Canvas_copyLayer },
-    { "nClearLayerUpdates",      "(I)V",       (void*) android_view_GLES20Canvas_clearLayerUpdates },
-    { "nFlushLayerUpdates",      "(I)V",       (void*) android_view_GLES20Canvas_flushLayerUpdates },
-    { "nPushLayerUpdate",        "(II)V",      (void*) android_view_GLES20Canvas_pushLayerUpdate },
-    { "nCancelLayerUpdate",      "(II)V",      (void*) android_view_GLES20Canvas_cancelLayerUpdate },
+    { "nUpdateRenderLayer",      "(JJJIIII)V", (void*) android_view_GLES20Canvas_updateRenderLayer },
+    { "nClearLayerTexture",      "(J)V",       (void*) android_view_GLES20Canvas_clearLayerTexture },
+    { "nDestroyLayer",           "(J)V",       (void*) android_view_GLES20Canvas_destroyLayer },
+    { "nDestroyLayerDeferred",   "(J)V",       (void*) android_view_GLES20Canvas_destroyLayerDeferred },
+    { "nDrawLayer",              "(JJFF)V",    (void*) android_view_GLES20Canvas_drawLayer },
+    { "nCopyLayer",              "(JJ)Z",      (void*) android_view_GLES20Canvas_copyLayer },
+    { "nClearLayerUpdates",      "(J)V",       (void*) android_view_GLES20Canvas_clearLayerUpdates },
+    { "nFlushLayerUpdates",      "(J)V",       (void*) android_view_GLES20Canvas_flushLayerUpdates },
+    { "nPushLayerUpdate",        "(JJ)V",      (void*) android_view_GLES20Canvas_pushLayerUpdate },
+    { "nCancelLayerUpdate",      "(JJ)V",      (void*) android_view_GLES20Canvas_cancelLayerUpdate },
 
-    { "nSetTextureLayerTransform", "(II)V",    (void*) android_view_GLES20Canvas_setTextureLayerTransform },
+    { "nSetTextureLayerTransform", "(JJ)V",    (void*) android_view_GLES20Canvas_setTextureLayerTransform },
 
     { "nGetMaximumTextureWidth",  "()I",       (void*) android_view_GLES20Canvas_getMaxTextureWidth },
     { "nGetMaximumTextureHeight", "()I",       (void*) android_view_GLES20Canvas_getMaxTextureHeight },
diff --git a/core/jni/android_view_GraphicBuffer.cpp b/core/jni/android_view_GraphicBuffer.cpp
index d68c0b2..2e8dccf 100644
--- a/core/jni/android_view_GraphicBuffer.cpp
+++ b/core/jni/android_view_GraphicBuffer.cpp
@@ -89,6 +89,12 @@
 #define SET_INT(object, field, value) \
     env->SetIntField(object, field, value)
 
+#define GET_LONG(object, field) \
+    env->GetLongField(object, field)
+
+#define SET_LONG(object, field, value) \
+    env->SetLongField(object, field, value)
+
 #define INVOKEV(object, method, ...) \
     env->CallVoidMethod(object, method, __VA_ARGS__)
 
@@ -108,7 +114,7 @@
 // GraphicBuffer lifecycle
 // ----------------------------------------------------------------------------
 
-static GraphicBufferWrapper* android_view_GraphiceBuffer_create(JNIEnv* env, jobject clazz,
+static jlong android_view_GraphiceBuffer_create(JNIEnv* env, jobject clazz,
         jint width, jint height, jint format, jint usage) {
 
     sp<ISurfaceComposer> composer(ComposerService::getComposerService());
@@ -125,11 +131,14 @@
         return NULL;
     }
 
-    return new GraphicBufferWrapper(buffer);
+    GraphicBufferWrapper* wrapper = new GraphicBufferWrapper(buffer);
+    return reinterpret_cast<jlong>(wrapper);
 }
 
 static void android_view_GraphiceBuffer_destroy(JNIEnv* env, jobject clazz,
-        GraphicBufferWrapper* wrapper) {
+        jlong wrapperHandle) {
+    GraphicBufferWrapper* wrapper =
+                reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
     delete wrapper;
 }
 
@@ -140,9 +149,9 @@
 static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
     jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
     SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
-            GET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas));
-    SET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas, (int) newCanvas);
-    SET_INT(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int) newCanvas);
+            GET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas));
+    SET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas, (long) newCanvas);
+    SET_LONG(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (long) newCanvas);
     SkSafeUnref(previousCanvas);
 }
 
@@ -160,10 +169,12 @@
 }
 
 static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
-        GraphicBufferWrapper* wrapper, jobject canvas, jobject dirtyRect) {
+        jlong wrapperHandle, jobject canvas, jobject dirtyRect) {
 
+    GraphicBufferWrapper* wrapper =
+                reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
     if (!wrapper) {
-        return false;
+        return JNI_FALSE;
     }
 
     sp<GraphicBuffer> buffer(wrapper->buffer);
@@ -181,10 +192,10 @@
     void* bits = NULL;
     status_t status = buffer->lock(LOCK_CANVAS_USAGE, rect, &bits);
 
-    if (status) return false;
+    if (status) return JNI_FALSE;
     if (!bits) {
         buffer->unlock();
-        return false;
+        return JNI_FALSE;
     }
 
     ssize_t bytesCount = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat());
@@ -213,21 +224,23 @@
                 int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
     }
 
-    return true;
+    return JNI_TRUE;
 }
 
 static jboolean android_view_GraphicBuffer_unlockCanvasAndPost(JNIEnv* env, jobject,
-        GraphicBufferWrapper* wrapper, jobject canvas) {
+        jlong wrapperHandle, jobject canvas) {
 
+    GraphicBufferWrapper* wrapper =
+                reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
     SkCanvas* nativeCanvas = SkNEW(SkCanvas);
     swapCanvasPtr(env, canvas, nativeCanvas);
 
     if (wrapper) {
         status_t status = wrapper->buffer->unlock();
-        return status == 0;
+        return status == 0 ? JNI_TRUE : JNI_FALSE;
     }
 
-    return false;
+    return JNI_FALSE;
 }
 
 // ----------------------------------------------------------------------------
@@ -235,21 +248,23 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GraphiceBuffer_write(JNIEnv* env, jobject clazz,
-        GraphicBufferWrapper* wrapper, jobject dest) {
+        jlong wrapperHandle, jobject dest) {
+    GraphicBufferWrapper* wrapper =
+                reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
     Parcel* parcel = parcelForJavaObject(env, dest);
     if (parcel) {
         parcel->write(*wrapper->buffer);
     }
 }
 
-static GraphicBufferWrapper* android_view_GraphiceBuffer_read(JNIEnv* env, jobject clazz,
+static jlong android_view_GraphiceBuffer_read(JNIEnv* env, jobject clazz,
         jobject in) {
 
     Parcel* parcel = parcelForJavaObject(env, in);
     if (parcel) {
         sp<GraphicBuffer> buffer = new GraphicBuffer();
         parcel->read(*buffer);
-        return new GraphicBufferWrapper(buffer);
+        return reinterpret_cast<jlong>(new GraphicBufferWrapper(buffer));
     }
 
     return NULL;
@@ -261,7 +276,7 @@
 
 sp<GraphicBuffer> graphicBufferForJavaObject(JNIEnv* env, jobject obj) {
     if (obj) {
-        jint nativeObject = env->GetIntField(obj, gGraphicBufferClassInfo.mNativeObject);
+        jlong nativeObject = env->GetLongField(obj, gGraphicBufferClassInfo.mNativeObject);
         GraphicBufferWrapper* wrapper = (GraphicBufferWrapper*) nativeObject;
         if (wrapper != NULL) {
             sp<GraphicBuffer> buffer(wrapper->buffer);
@@ -290,24 +305,24 @@
 const char* const kClassPathName = "android/view/GraphicBuffer";
 
 static JNINativeMethod gMethods[] = {
-    { "nCreateGraphicBuffer",  "(IIII)I", (void*) android_view_GraphiceBuffer_create },
-    { "nDestroyGraphicBuffer", "(I)V",    (void*) android_view_GraphiceBuffer_destroy },
+    { "nCreateGraphicBuffer",  "(IIII)J", (void*) android_view_GraphiceBuffer_create },
+    { "nDestroyGraphicBuffer", "(J)V",    (void*) android_view_GraphiceBuffer_destroy },
 
-    { "nWriteGraphicBufferToParcel",  "(ILandroid/os/Parcel;)V",
+    { "nWriteGraphicBufferToParcel",  "(JLandroid/os/Parcel;)V",
             (void*) android_view_GraphiceBuffer_write },
-    { "nReadGraphicBufferFromParcel", "(Landroid/os/Parcel;)I",
+    { "nReadGraphicBufferFromParcel", "(Landroid/os/Parcel;)J",
             (void*) android_view_GraphiceBuffer_read },
 
-    { "nLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
+    { "nLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
             (void*) android_view_GraphicBuffer_lockCanvas },
-    { "nUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)Z",
+    { "nUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)Z",
             (void*) android_view_GraphicBuffer_unlockCanvasAndPost },
 };
 
 int register_android_view_GraphicBuffer(JNIEnv* env) {
     jclass clazz;
     FIND_CLASS(clazz, "android/view/GraphicBuffer");
-    GET_FIELD_ID(gGraphicBufferClassInfo.mNativeObject, clazz, "mNativeObject", "I");
+    GET_FIELD_ID(gGraphicBufferClassInfo.mNativeObject, clazz, "mNativeObject", "J");
 
     FIND_CLASS(clazz, "android/graphics/Rect");
     GET_METHOD_ID(gRectClassInfo.set, clazz, "set", "(IIII)V");
@@ -319,11 +334,11 @@
     FIND_CLASS(clazz, "android/graphics/Canvas");
     GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
             "Landroid/graphics/Canvas$CanvasFinalizer;");
-    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
     GET_FIELD_ID(gCanvasClassInfo.mSurfaceFormat, clazz, "mSurfaceFormat", "I");
 
     FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
-    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
 
     return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/core/jni/android_view_RemoteGLRenderer.cpp b/core/jni/android_view_RemoteGLRenderer.cpp
deleted file mode 100644
index 96a203b..0000000
--- a/core/jni/android_view_RemoteGLRenderer.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "RemoteGLRenderer"
-
-#include "jni.h"
-#include <nativehelper/JNIHelp.h>
-
-#include <utils/StrongPointer.h>
-#include <android_runtime/android_view_Surface.h>
-#include <android_runtime/AndroidRuntime.h>
-#include <renderthread/CanvasContext.h>
-#include <system/window.h>
-
-namespace android {
-
-#ifdef USE_OPENGL_RENDERER
-
-#define CHECK_CONTEXT(c) if (!c) ALOGE("Null context passed to %s!", __func__ )
-
-namespace RT = android::uirenderer::renderthread;
-
-static jlong android_view_RemoteGLRenderer_createContext(JNIEnv* env, jobject clazz) {
-    RT::CanvasContext* context = new RT::CanvasContext();
-    return reinterpret_cast<jlong>(context);
-}
-
-static jboolean android_view_RemoteGLRenderer_usePBufferSurface(JNIEnv* env, jobject clazz) {
-    return RT::CanvasContext::useGlobalPBufferSurface();
-}
-
-static jboolean android_view_RemoteGLRenderer_setSurface(JNIEnv* env, jobject clazz,
-        jlong jcontextptr, jobject jsurface) {
-    RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
-    CHECK_CONTEXT(context);
-    sp<ANativeWindow> window;
-    if (jsurface) {
-        window = android_view_Surface_getNativeWindow(env, jsurface);
-    }
-    return context->setSurface(window.get());
-}
-
-static jboolean android_view_RemoteGLRenderer_swapBuffers(JNIEnv* env, jobject clazz,
-        jlong jcontextptr) {
-    RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
-    CHECK_CONTEXT(context);
-    return context->swapBuffers();
-}
-
-static jboolean android_view_RemoteGLRenderer_makeCurrent(JNIEnv* env, jobject clazz,
-        jlong jcontextptr) {
-    RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
-    CHECK_CONTEXT(context);
-    return context->makeCurrent();
-}
-
-static void android_view_RemoteGLRenderer_destroyContext(JNIEnv* env, jobject clazz,
-        jlong jcontextptr) {
-    RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
-    CHECK_CONTEXT(context);
-    delete context;
-}
-#endif
-
-// ----------------------------------------------------------------------------
-// JNI Glue
-// ----------------------------------------------------------------------------
-
-const char* const kClassPathName = "android/view/RemoteGLRenderer";
-
-static JNINativeMethod gMethods[] = {
-#ifdef USE_OPENGL_RENDERER
-    { "createContext", "()J",   (void*) android_view_RemoteGLRenderer_createContext },
-    { "usePBufferSurface", "()Z",   (void*) android_view_RemoteGLRenderer_usePBufferSurface },
-    { "setSurface", "(JLandroid/view/Surface;)Z",   (void*) android_view_RemoteGLRenderer_setSurface },
-    { "swapBuffers", "(J)Z",   (void*) android_view_RemoteGLRenderer_swapBuffers },
-    { "makeCurrent", "(J)Z",   (void*) android_view_RemoteGLRenderer_makeCurrent },
-    { "destroyContext", "(J)V",   (void*) android_view_RemoteGLRenderer_destroyContext },
-#endif
-};
-
-int register_android_view_RemoteGLRenderer(JNIEnv* env) {
-    return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
-}
-
-}; // namespace android
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index dd178d8..19ee8a6 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -97,7 +97,7 @@
             gSurfaceClassInfo.mLock);
     if (env->MonitorEnter(lock) == JNI_OK) {
         sur = reinterpret_cast<Surface *>(
-                env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeObject));
+                env->GetLongField(surfaceObj, gSurfaceClassInfo.mNativeObject));
         env->MonitorExit(lock);
     }
     return sur;
@@ -135,7 +135,7 @@
 
 // ----------------------------------------------------------------------------
 
-static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
+static jlong nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
         jobject surfaceTextureObj) {
     sp<IGraphicBufferProducer> producer(SurfaceTexture_getProducer(env, surfaceTextureObj));
     if (producer == NULL) {
@@ -151,20 +151,20 @@
     }
 
     surface->incStrong(&sRefBaseOwner);
-    return int(surface.get());
+    return jlong(surface.get());
 }
 
-static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
     sur->decStrong(&sRefBaseOwner);
 }
 
-static jboolean nativeIsValid(JNIEnv* env, jclass clazz, jint nativeObject) {
+static jboolean nativeIsValid(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
     return isSurfaceValid(sur) ? JNI_TRUE : JNI_FALSE;
 }
 
-static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jint nativeObject) {
+static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
     if (!isSurfaceValid(sur)) {
         doThrowIAE(env);
@@ -193,14 +193,14 @@
 static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
   jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
   SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
-          env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas));
-  env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas);
-  env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas);
+          env->GetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas));
+  env->SetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas, (jlong)newCanvas);
+  env->SetLongField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (jlong)newCanvas);
   SkSafeUnref(previousCanvas);
 }
 
-static jint nativeLockCanvas(JNIEnv* env, jclass clazz,
-        jint nativeObject, jobject canvasObj, jobject dirtyRectObj) {
+static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,
+        jlong nativeObject, jobject canvasObj, jobject dirtyRectObj) {
     sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
 
     if (!isSurfaceValid(surface)) {
@@ -264,11 +264,11 @@
     // because the latter could be replaced while the surface is locked.
     sp<Surface> lockedSurface(surface);
     lockedSurface->incStrong(&sRefBaseOwner);
-    return (int) lockedSurface.get();
+    return (jlong) lockedSurface.get();
 }
 
 static void nativeUnlockCanvasAndPost(JNIEnv* env, jclass clazz,
-        jint nativeObject, jobject canvasObj) {
+        jlong nativeObject, jobject canvasObj) {
     sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
     if (!isSurfaceValid(surface)) {
         return;
@@ -287,8 +287,8 @@
 
 // ----------------------------------------------------------------------------
 
-static jint nativeCreateFromSurfaceControl(JNIEnv* env, jclass clazz,
-        jint surfaceControlNativeObj) {
+static jlong nativeCreateFromSurfaceControl(JNIEnv* env, jclass clazz,
+        jlong surfaceControlNativeObj) {
     /*
      * This is used by the WindowManagerService just after constructing
      * a Surface and is necessary for returning the Surface reference to
@@ -300,11 +300,11 @@
     if (surface != NULL) {
         surface->incStrong(&sRefBaseOwner);
     }
-    return reinterpret_cast<jint>(surface.get());
+    return reinterpret_cast<jlong>(surface.get());
 }
 
-static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
-        jint nativeObject, jobject parcelObj) {
+static jlong nativeReadFromParcel(JNIEnv* env, jclass clazz,
+        jlong nativeObject, jobject parcelObj) {
     Parcel* parcel = parcelForJavaObject(env, parcelObj);
     if (parcel == NULL) {
         doThrowNPE(env);
@@ -319,7 +319,7 @@
     if (self != NULL
             && (self->getIGraphicBufferProducer()->asBinder() == binder)) {
         // same IGraphicBufferProducer, return ourselves
-        return int(self.get());
+        return jlong(self.get());
     }
 
     sp<Surface> sur;
@@ -336,11 +336,11 @@
         self->decStrong(&sRefBaseOwner);
     }
 
-    return int(sur.get());
+    return jlong(sur.get());
 }
 
 static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
-        jint nativeObject, jobject parcelObj) {
+        jlong nativeObject, jobject parcelObj) {
     Parcel* parcel = parcelForJavaObject(env, parcelObj);
     if (parcel == NULL) {
         doThrowNPE(env);
@@ -353,23 +353,23 @@
 // ----------------------------------------------------------------------------
 
 static JNINativeMethod gSurfaceMethods[] = {
-    {"nativeCreateFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)I",
+    {"nativeCreateFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)J",
             (void*)nativeCreateFromSurfaceTexture },
-    {"nativeRelease", "(I)V",
+    {"nativeRelease", "(J)V",
             (void*)nativeRelease },
-    {"nativeIsValid", "(I)Z",
+    {"nativeIsValid", "(J)Z",
             (void*)nativeIsValid },
-    {"nativeIsConsumerRunningBehind", "(I)Z",
+    {"nativeIsConsumerRunningBehind", "(J)Z",
             (void*)nativeIsConsumerRunningBehind },
-    {"nativeLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)I",
+    {"nativeLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)J",
             (void*)nativeLockCanvas },
-    {"nativeUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)V",
+    {"nativeUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)V",
             (void*)nativeUnlockCanvasAndPost },
-    {"nativeCreateFromSurfaceControl", "(I)I",
+    {"nativeCreateFromSurfaceControl", "(J)J",
             (void*)nativeCreateFromSurfaceControl },
-    {"nativeReadFromParcel", "(ILandroid/os/Parcel;)I",
+    {"nativeReadFromParcel", "(JLandroid/os/Parcel;)J",
             (void*)nativeReadFromParcel },
-    {"nativeWriteToParcel", "(ILandroid/os/Parcel;)V",
+    {"nativeWriteToParcel", "(JLandroid/os/Parcel;)V",
             (void*)nativeWriteToParcel },
 };
 
@@ -381,18 +381,18 @@
     jclass clazz = env->FindClass("android/view/Surface");
     gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
     gSurfaceClassInfo.mNativeObject =
-            env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "I");
+            env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "J");
     gSurfaceClassInfo.mLock =
             env->GetFieldID(gSurfaceClassInfo.clazz, "mLock", "Ljava/lang/Object;");
-    gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(I)V");
+    gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(J)V");
 
     clazz = env->FindClass("android/graphics/Canvas");
     gCanvasClassInfo.mFinalizer = env->GetFieldID(clazz, "mFinalizer", "Landroid/graphics/Canvas$CanvasFinalizer;");
-    gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I");
+    gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "J");
     gCanvasClassInfo.mSurfaceFormat = env->GetFieldID(clazz, "mSurfaceFormat", "I");
 
     clazz = env->FindClass("android/graphics/Canvas$CanvasFinalizer");
-    gCanvasFinalizerClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I");
+    gCanvasFinalizerClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "J");
 
     clazz = env->FindClass("android/graphics/Rect");
     gRectClassInfo.left = env->GetFieldID(clazz, "left", "I");
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 12acfe1..88ec0d7 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -122,7 +122,7 @@
 
 // ----------------------------------------------------------------------------
 
-static jint nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
+static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
         jstring nameStr, jint w, jint h, jint format, jint flags) {
     ScopedUtfChars name(env, nameStr);
     sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
@@ -133,15 +133,15 @@
         return 0;
     }
     surface->incStrong((void *)nativeCreate);
-    return int(surface.get());
+    return reinterpret_cast<jlong>(surface.get());
 }
 
-static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
     ctrl->decStrong((void *)nativeCreate);
 }
 
-static void nativeDestroy(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
     ctrl->clear();
     ctrl->decStrong((void *)nativeCreate);
@@ -230,7 +230,7 @@
     SurfaceComposerClient::setAnimationTransaction();
 }
 
-static void nativeSetLayer(JNIEnv* env, jclass clazz, jint nativeObject, jint zorder) {
+static void nativeSetLayer(JNIEnv* env, jclass clazz, jlong nativeObject, jint zorder) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setLayer(zorder);
     if (err < 0 && err != NO_INIT) {
@@ -238,7 +238,7 @@
     }
 }
 
-static void nativeSetPosition(JNIEnv* env, jclass clazz, jint nativeObject, jfloat x, jfloat y) {
+static void nativeSetPosition(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat x, jfloat y) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setPosition(x, y);
     if (err < 0 && err != NO_INIT) {
@@ -246,7 +246,7 @@
     }
 }
 
-static void nativeSetSize(JNIEnv* env, jclass clazz, jint nativeObject, jint w, jint h) {
+static void nativeSetSize(JNIEnv* env, jclass clazz, jlong nativeObject, jint w, jint h) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setSize(w, h);
     if (err < 0 && err != NO_INIT) {
@@ -254,7 +254,7 @@
     }
 }
 
-static void nativeSetFlags(JNIEnv* env, jclass clazz, jint nativeObject, jint flags, jint mask) {
+static void nativeSetFlags(JNIEnv* env, jclass clazz, jlong nativeObject, jint flags, jint mask) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setFlags(flags, mask);
     if (err < 0 && err != NO_INIT) {
@@ -262,7 +262,7 @@
     }
 }
 
-static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jint nativeObject, jobject regionObj) {
+static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jlong nativeObject, jobject regionObj) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     SkRegion* region = android_graphics_Region_getSkRegion(env, regionObj);
     if (!region) {
@@ -287,7 +287,7 @@
     }
 }
 
-static void nativeSetAlpha(JNIEnv* env, jclass clazz, jint nativeObject, jfloat alpha) {
+static void nativeSetAlpha(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat alpha) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setAlpha(alpha);
     if (err < 0 && err != NO_INIT) {
@@ -295,7 +295,7 @@
     }
 }
 
-static void nativeSetMatrix(JNIEnv* env, jclass clazz, jint nativeObject,
+static void nativeSetMatrix(JNIEnv* env, jclass clazz, jlong nativeObject,
         jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setMatrix(dsdx, dtdx, dsdy, dtdy);
@@ -304,7 +304,7 @@
     }
 }
 
-static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jint nativeObject,
+static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
         jint l, jint t, jint r, jint b) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     Rect crop(l, t, r, b);
@@ -314,7 +314,7 @@
     }
 }
 
-static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jint nativeObject, jint layerStack) {
+static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, jint layerStack) {
     SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
     status_t err = ctrl->setLayerStack(layerStack);
     if (err < 0 && err != NO_INIT) {
@@ -342,7 +342,7 @@
 }
 
 static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz,
-        jobject tokenObj, jint nativeSurfaceObject) {
+        jobject tokenObj, jlong nativeSurfaceObject) {
     sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
     if (token == NULL) return;
     sp<IGraphicBufferProducer> bufferProducer;
@@ -411,11 +411,11 @@
 // ----------------------------------------------------------------------------
 
 static JNINativeMethod sSurfaceControlMethods[] = {
-    {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)I",
+    {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)J",
             (void*)nativeCreate },
-    {"nativeRelease", "(I)V",
+    {"nativeRelease", "(J)V",
             (void*)nativeRelease },
-    {"nativeDestroy", "(I)V",
+    {"nativeDestroy", "(J)V",
             (void*)nativeDestroy },
     {"nativeScreenshot", "(Landroid/os/IBinder;IIIIZ)Landroid/graphics/Bitmap;",
             (void*)nativeScreenshotBitmap },
@@ -427,23 +427,23 @@
             (void*)nativeCloseTransaction },
     {"nativeSetAnimationTransaction", "()V",
             (void*)nativeSetAnimationTransaction },
-    {"nativeSetLayer", "(II)V",
+    {"nativeSetLayer", "(JI)V",
             (void*)nativeSetLayer },
-    {"nativeSetPosition", "(IFF)V",
+    {"nativeSetPosition", "(JFF)V",
             (void*)nativeSetPosition },
-    {"nativeSetSize", "(III)V",
+    {"nativeSetSize", "(JII)V",
             (void*)nativeSetSize },
-    {"nativeSetTransparentRegionHint", "(ILandroid/graphics/Region;)V",
+    {"nativeSetTransparentRegionHint", "(JLandroid/graphics/Region;)V",
             (void*)nativeSetTransparentRegionHint },
-    {"nativeSetAlpha", "(IF)V",
+    {"nativeSetAlpha", "(JF)V",
             (void*)nativeSetAlpha },
-    {"nativeSetMatrix", "(IFFFF)V",
+    {"nativeSetMatrix", "(JFFFF)V",
             (void*)nativeSetMatrix },
-    {"nativeSetFlags", "(III)V",
+    {"nativeSetFlags", "(JII)V",
             (void*)nativeSetFlags },
-    {"nativeSetWindowCrop", "(IIIII)V",
+    {"nativeSetWindowCrop", "(JIIII)V",
             (void*)nativeSetWindowCrop },
-    {"nativeSetLayerStack", "(II)V",
+    {"nativeSetLayerStack", "(JI)V",
             (void*)nativeSetLayerStack },
     {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;",
             (void*)nativeGetBuiltInDisplay },
@@ -451,7 +451,7 @@
             (void*)nativeCreateDisplay },
     {"nativeDestroyDisplay", "(Landroid/os/IBinder;)V",
             (void*)nativeDestroyDisplay },
-    {"nativeSetDisplaySurface", "(Landroid/os/IBinder;I)V",
+    {"nativeSetDisplaySurface", "(Landroid/os/IBinder;J)V",
             (void*)nativeSetDisplaySurface },
     {"nativeSetDisplayLayerStack", "(Landroid/os/IBinder;I)V",
             (void*)nativeSetDisplayLayerStack },
diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp
index 7a4a20a..835615e 100644
--- a/core/jni/android_view_TextureView.cpp
+++ b/core/jni/android_view_TextureView.cpp
@@ -60,9 +60,15 @@
 #define GET_INT(object, field) \
     env->GetIntField(object, field)
 
+#define GET_LONG(object, field) \
+    env->GetLongField(object, field)
+
 #define SET_INT(object, field, value) \
     env->SetIntField(object, field, value)
 
+#define SET_LONG(object, field, value) \
+    env->SetLongField(object, field, value)
+
 #define INVOKEV(object, method, ...) \
     env->CallVoidMethod(object, method, __VA_ARGS__)
 
@@ -104,18 +110,18 @@
     sp<ANativeWindow> window = new Surface(producer, true);
 
     window->incStrong((void*)android_view_TextureView_createNativeWindow);
-    SET_INT(textureView, gTextureViewClassInfo.nativeWindow, jint(window.get()));
+    SET_LONG(textureView, gTextureViewClassInfo.nativeWindow, jlong(window.get()));
 }
 
 static void android_view_TextureView_destroyNativeWindow(JNIEnv* env, jobject textureView) {
 
     ANativeWindow* nativeWindow = (ANativeWindow*)
-            GET_INT(textureView, gTextureViewClassInfo.nativeWindow);
+            GET_LONG(textureView, gTextureViewClassInfo.nativeWindow);
 
     if (nativeWindow) {
         sp<ANativeWindow> window(nativeWindow);
             window->decStrong((void*)android_view_TextureView_createNativeWindow);
-        SET_INT(textureView, gTextureViewClassInfo.nativeWindow, 0);
+        SET_LONG(textureView, gTextureViewClassInfo.nativeWindow, 0);
     }
 }
 
@@ -123,16 +129,16 @@
     jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
     SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
           env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas));
-    env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas);
-    env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas);
+    env->SetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas, (jlong)newCanvas);
+    env->SetLongField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (jlong)newCanvas);
     SkSafeUnref(previousCanvas);
 }
 
 static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
-        jint nativeWindow, jobject canvas, jobject dirtyRect) {
+        jlong nativeWindow, jobject canvas, jobject dirtyRect) {
 
     if (!nativeWindow) {
-        return false;
+        return JNI_FALSE;
     }
 
     ANativeWindow_Buffer buffer;
@@ -149,7 +155,7 @@
 
     sp<ANativeWindow> window((ANativeWindow*) nativeWindow);
     int32_t status = native_window_lock(window.get(), &buffer, &rect);
-    if (status) return false;
+    if (status) return JNI_FALSE;
 
     ssize_t bytesCount = buffer.stride * bytesPerPixel(buffer.format);
 
@@ -180,11 +186,11 @@
                 int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
     }
 
-    return true;
+    return JNI_TRUE;
 }
 
 static void android_view_TextureView_unlockCanvasAndPost(JNIEnv* env, jobject,
-        jint nativeWindow, jobject canvas) {
+        jlong nativeWindow, jobject canvas) {
 
     SkCanvas* nativeCanvas = SkNEW(SkCanvas);
     swapCanvasPtr(env, canvas, nativeCanvas);
@@ -207,9 +213,9 @@
     {   "nDestroyNativeWindow", "()V",
             (void*) android_view_TextureView_destroyNativeWindow },
 
-    {   "nLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
+    {   "nLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
             (void*) android_view_TextureView_lockCanvas },
-    {   "nUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)V",
+    {   "nUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)V",
             (void*) android_view_TextureView_unlockCanvasAndPost },
 };
 
@@ -237,14 +243,14 @@
     FIND_CLASS(clazz, "android/graphics/Canvas");
     GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
             "Landroid/graphics/Canvas$CanvasFinalizer;");
-    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
     GET_FIELD_ID(gCanvasClassInfo.mSurfaceFormat, clazz, "mSurfaceFormat", "I");
 
     FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
-    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
 
     FIND_CLASS(clazz, "android/view/TextureView");
-    GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "I");
+    GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "J");
 
     return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 8d77e36..8e121de 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -20,6 +20,11 @@
 #include <nativehelper/JNIHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 
+#include <utils/StrongPointer.h>
+#include <android_runtime/android_view_Surface.h>
+#include <system/window.h>
+
+#include <renderthread/RenderProxy.h>
 #include <renderthread/RenderTask.h>
 #include <renderthread/RenderThread.h>
 
@@ -27,23 +32,22 @@
 
 #ifdef USE_OPENGL_RENDERER
 
-namespace RT = android::uirenderer::renderthread;
+using namespace android::uirenderer;
+using namespace android::uirenderer::renderthread;
 
 static jmethodID gRunnableMethod;
 
-class JavaTask : public RT::RenderTask {
+class JavaTask : public RenderTask {
 public:
     JavaTask(JNIEnv* env, jobject jrunnable) {
         env->GetJavaVM(&mVm);
         mRunnable = env->NewGlobalRef(jrunnable);
     }
 
-    virtual ~JavaTask() {
-        env()->DeleteGlobalRef(mRunnable);
-    }
-
     virtual void run() {
         env()->CallVoidMethod(mRunnable, gRunnableMethod);
+        env()->DeleteGlobalRef(mRunnable);
+        delete this;
     };
 
 private:
@@ -61,8 +65,70 @@
 
 static void android_view_ThreadedRenderer_postToRenderThread(JNIEnv* env, jobject clazz,
         jobject jrunnable) {
-    RT::RenderTask* task = new JavaTask(env, jrunnable);
-    RT::RenderThread::getInstance().queue(task);
+    RenderTask* task = new JavaTask(env, jrunnable);
+    RenderThread::getInstance().queue(task);
+}
+
+static jlong android_view_ThreadedRenderer_createProxy(JNIEnv* env, jobject clazz,
+        jboolean translucent) {
+    return (jlong) new RenderProxy(translucent);
+}
+
+static void android_view_ThreadedRenderer_deleteProxy(JNIEnv* env, jobject clazz,
+        jlong proxyPtr) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    delete proxy;
+}
+
+static jboolean android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jobject jsurface) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    sp<ANativeWindow> window = android_view_Surface_getNativeWindow(env, jsurface);
+    return proxy->initialize(window.get());
+}
+
+static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jobject jsurface) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    sp<ANativeWindow> window;
+    if (jsurface) {
+        window = android_view_Surface_getNativeWindow(env, jsurface);
+    }
+    proxy->updateSurface(window.get());
+}
+
+static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jint width, jint height) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    proxy->setup(width, height);
+}
+
+static void android_view_ThreadedRenderer_drawDisplayList(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jlong displayListPtr, jint dirtyLeft, jint dirtyTop,
+        jint dirtyRight, jint dirtyBottom) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    DisplayList* displayList = reinterpret_cast<DisplayList*>( displayListPtr);
+    proxy->drawDisplayList(displayList, dirtyLeft, dirtyTop, dirtyRight, dirtyBottom);
+}
+
+static void android_view_ThreadedRenderer_destroyCanvas(JNIEnv* env, jobject clazz,
+        jlong proxyPtr) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    proxy->destroyCanvas();
+}
+
+static void android_view_ThreadedRenderer_attachFunctor(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jlong functorPtr) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    Functor* functor = reinterpret_cast<Functor*>(functorPtr);
+    proxy->attachFunctor(functor);
+}
+
+static void android_view_ThreadedRenderer_detachFunctor(JNIEnv* env, jobject clazz,
+        jlong proxyPtr, jlong functorPtr) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+    Functor* functor = reinterpret_cast<Functor*>(functorPtr);
+    proxy->detachFunctor(functor);
 }
 
 #endif
@@ -76,6 +142,15 @@
 static JNINativeMethod gMethods[] = {
 #ifdef USE_OPENGL_RENDERER
     { "postToRenderThread", "(Ljava/lang/Runnable;)V",   (void*) android_view_ThreadedRenderer_postToRenderThread },
+    { "nCreateProxy", "(Z)J", (void*) android_view_ThreadedRenderer_createProxy },
+    { "nDeleteProxy", "(J)V", (void*) android_view_ThreadedRenderer_deleteProxy },
+    { "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize },
+    { "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface },
+    { "nSetup", "(JII)V", (void*) android_view_ThreadedRenderer_setup },
+    { "nDrawDisplayList", "(JJIIII)V", (void*) android_view_ThreadedRenderer_drawDisplayList},
+    { "nDestroyCanvas", "(J)V", (void*) android_view_ThreadedRenderer_destroyCanvas},
+    { "nAttachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_attachFunctor},
+    { "nDetachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_detachFunctor},
 #endif
 };
 
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 50b3302..a0982bd 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -82,7 +82,7 @@
     gSurface_NativePixelRefFieldID = _env->GetFieldID(surface_class, "mNativePixelRef", "I");
 
     jclass bitmap_class = _env->FindClass("android/graphics/Bitmap");
-    gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "I");
+    gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "J");
 }
 
 static const jint gNull_attrib_base[] = {EGL_NONE};
@@ -276,7 +276,7 @@
     jint* base = 0;
 
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(native_pixmap,
+            (SkBitmap const *)_env->GetLongField(native_pixmap,
                     gBitmap_NativeBitmapFieldID);
     SkPixelRef* ref = nativeBitmap ? nativeBitmap->pixelRef() : 0;
     if (ref == NULL) {
diff --git a/core/res/res/layout/time_header_label.xml b/core/res/res/layout/time_header_label.xml
index 00cb81b..f5f4a04 100644
--- a/core/res/res/layout/time_header_label.xml
+++ b/core/res/res/layout/time_header_label.xml
@@ -54,7 +54,6 @@
             android:paddingRight="@dimen/timepicker_ampm_left_padding"
             android:layout_toRightOf="@+id/separator"
             android:layout_alignBaseline="@+id/separator"
-            android:textAppearance="?android:attr/timePickerHeaderAmPmLabelTextAppearance"
-            android:importantForAccessibility="no" />
+            android:textAppearance="?android:attr/timePickerHeaderAmPmLabelTextAppearance" />
 
 </RelativeLayout>
diff --git a/graphics/java/android/graphics/AvoidXfermode.java b/graphics/java/android/graphics/AvoidXfermode.java
index 5a59e36..206c959 100644
--- a/graphics/java/android/graphics/AvoidXfermode.java
+++ b/graphics/java/android/graphics/AvoidXfermode.java
@@ -56,6 +56,6 @@
         native_instance = nativeCreate(opColor, tolerance, mode.nativeInt);
     }
 
-    private static native int nativeCreate(int opColor, int tolerance,
-                                           int nativeMode);
+    private static native long nativeCreate(int opColor, int tolerance,
+                                            int nativeMode);
 }
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 536c4b6..d6b73fd 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -41,7 +41,7 @@
      * 
      * @hide
      */
-    public final int mNativeBitmap;
+    public final long mNativeBitmap;
 
     /**
      * Backing buffer for the Bitmap.
@@ -113,7 +113,7 @@
      * int (pointer).
      */
     @SuppressWarnings({"UnusedDeclaration"}) // called from JNI
-    Bitmap(int nativeBitmap, byte[] buffer, int width, int height, int density,
+    Bitmap(long nativeBitmap, byte[] buffer, int width, int height, int density,
             boolean isMutable, boolean isPremultiplied,
             byte[] ninePatchChunk, int[] layoutBounds) {
         if (nativeBitmap == 0) {
@@ -1536,7 +1536,7 @@
      */
     public Bitmap extractAlpha(Paint paint, int[] offsetXY) {
         checkRecycled("Can't extractAlpha on a recycled bitmap");
-        int nativePaint = paint != null ? paint.mNativePaint : 0;
+        long nativePaint = paint != null ? paint.mNativePaint : 0;
         Bitmap bm = nativeExtractAlpha(mNativeBitmap, nativePaint, offsetXY);
         if (bm == null) {
             throw new RuntimeException("Failed to extractAlpha on Bitmap");
@@ -1570,9 +1570,9 @@
     }
 
     private static class BitmapFinalizer {
-        private final int mNativeBitmap;
+        private final long mNativeBitmap;
 
-        BitmapFinalizer(int nativeBitmap) {
+        BitmapFinalizer(long nativeBitmap) {
             mNativeBitmap = nativeBitmap;
         }
 
@@ -1593,56 +1593,57 @@
     private static native Bitmap nativeCreate(int[] colors, int offset,
                                               int stride, int width, int height,
                                               int nativeConfig, boolean mutable);
-    private static native Bitmap nativeCopy(int srcBitmap, int nativeConfig,
+    private static native Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig,
                                             boolean isMutable);
-    private static native void nativeDestructor(int nativeBitmap);
-    private static native boolean nativeRecycle(int nativeBitmap);
-    private static native void nativeReconfigure(int nativeBitmap, int width, int height,
+    private static native void nativeDestructor(long nativeBitmap);
+    private static native boolean nativeRecycle(long nativeBitmap);
+    private static native void nativeReconfigure(long nativeBitmap, int width, int height,
                                                  int config, int allocSize);
 
-    private static native boolean nativeCompress(int nativeBitmap, int format,
+    private static native boolean nativeCompress(long nativeBitmap, int format,
                                             int quality, OutputStream stream,
                                             byte[] tempStorage);
-    private static native void nativeErase(int nativeBitmap, int color);
-    private static native int nativeRowBytes(int nativeBitmap);
-    private static native int nativeConfig(int nativeBitmap);
+    private static native void nativeErase(long nativeBitmap, int color);
+    private static native int nativeRowBytes(long nativeBitmap);
+    private static native int nativeConfig(long nativeBitmap);
 
-    private static native int nativeGetPixel(int nativeBitmap, int x, int y,
+    private static native int nativeGetPixel(long nativeBitmap, int x, int y,
                                              boolean isPremultiplied);
-    private static native void nativeGetPixels(int nativeBitmap, int[] pixels,
+    private static native void nativeGetPixels(long nativeBitmap, int[] pixels,
                                                int offset, int stride, int x, int y,
                                                int width, int height, boolean isPremultiplied);
 
-    private static native void nativeSetPixel(int nativeBitmap, int x, int y,
+    private static native void nativeSetPixel(long nativeBitmap, int x, int y,
                                               int color, boolean isPremultiplied);
-    private static native void nativeSetPixels(int nativeBitmap, int[] colors,
+    private static native void nativeSetPixels(long nativeBitmap, int[] colors,
                                                int offset, int stride, int x, int y,
                                                int width, int height, boolean isPremultiplied);
-    private static native void nativeCopyPixelsToBuffer(int nativeBitmap,
+    private static native void nativeCopyPixelsToBuffer(long nativeBitmap,
                                                         Buffer dst);
-    private static native void nativeCopyPixelsFromBuffer(int nb, Buffer src);
-    private static native int nativeGenerationId(int nativeBitmap);
+    private static native void nativeCopyPixelsFromBuffer(long nativeBitmap, Buffer src);
+    private static native int nativeGenerationId(long nativeBitmap);
 
     private static native Bitmap nativeCreateFromParcel(Parcel p);
     // returns true on success
-    private static native boolean nativeWriteToParcel(int nativeBitmap,
+    private static native boolean nativeWriteToParcel(long nativeBitmap,
                                                       boolean isMutable,
                                                       int density,
                                                       Parcel p);
     // returns a new bitmap built from the native bitmap's alpha, and the paint
-    private static native Bitmap nativeExtractAlpha(int nativeBitmap,
-                                                    int nativePaint,
+    private static native Bitmap nativeExtractAlpha(long nativeBitmap,
+                                                    long nativePaint,
                                                     int[] offsetXY);
 
-    private static native void nativePrepareToDraw(int nativeBitmap);
-    private static native boolean nativeHasAlpha(int nativeBitmap);
-    private static native void nativeSetAlphaAndPremultiplied(int nBitmap, boolean hasAlpha,
+    private static native void nativePrepareToDraw(long nativeBitmap);
+    private static native boolean nativeHasAlpha(long nativeBitmap);
+    private static native void nativeSetAlphaAndPremultiplied(long nativeBitmap,
+                                                              boolean hasAlpha,
                                                               boolean isPremul);
-    private static native boolean nativeHasMipMap(int nativeBitmap);
-    private static native void nativeSetHasMipMap(int nBitmap, boolean hasMipMap);
-    private static native boolean nativeSameAs(int nb0, int nb1);
-    
-    /* package */ final int ni() {
+    private static native boolean nativeHasMipMap(long nativeBitmap);
+    private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap);
+    private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1);
+
+    /* package */ final long ni() {
         return mNativeBitmap;
     }
 }
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 2b69a15..c20502f 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -595,7 +595,7 @@
         Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap");
         try {
             if (is instanceof AssetManager.AssetInputStream) {
-                final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+                final long asset = ((AssetManager.AssetInputStream) is).getNativeAsset();
                 bm = nativeDecodeAsset(asset, outPadding, opts);
             } else {
                 bm = decodeStreamInternal(is, outPadding, opts);
@@ -698,7 +698,7 @@
             Rect padding, Options opts);
     private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
             Rect padding, Options opts);
-    private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts);
+    private static native Bitmap nativeDecodeAsset(long nativeAsset, Rect padding, Options opts);
     private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
             int length, Options opts);
     private static native boolean nativeIsSeekable(FileDescriptor fd);
diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java
index a4f75b9..b7673d8 100644
--- a/graphics/java/android/graphics/BitmapShader.java
+++ b/graphics/java/android/graphics/BitmapShader.java
@@ -42,7 +42,7 @@
         mBitmap = bitmap;
         mTileX = tileX;
         mTileY = tileY;
-        final int b = bitmap.ni();
+        final long b = bitmap.ni();
         native_instance = nativeCreate(b, tileX.nativeInt, tileY.nativeInt);
         native_shader = nativePostCreate(native_instance, b, tileX.nativeInt, tileY.nativeInt);
     }
@@ -57,8 +57,8 @@
         return copy;
     }
 
-    private static native int nativeCreate(int native_bitmap, int shaderTileModeX,
+    private static native long nativeCreate(long native_bitmap, int shaderTileModeX,
             int shaderTileModeY);
-    private static native int nativePostCreate(int native_shader, int native_bitmap,
+    private static native long nativePostCreate(long native_shader, long native_bitmap,
             int shaderTileModeX, int shaderTileModeY);
 }
diff --git a/graphics/java/android/graphics/BlurMaskFilter.java b/graphics/java/android/graphics/BlurMaskFilter.java
index 5eafe76..939af52 100644
--- a/graphics/java/android/graphics/BlurMaskFilter.java
+++ b/graphics/java/android/graphics/BlurMaskFilter.java
@@ -47,5 +47,5 @@
         native_instance = nativeConstructor(radius, style.native_int);
     }
 
-    private static native int nativeConstructor(float radius, int style);
+    private static native long nativeConstructor(float radius, int style);
 }
diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java
index 9e07bd4..c263a84 100644
--- a/graphics/java/android/graphics/Camera.java
+++ b/graphics/java/android/graphics/Camera.java
@@ -159,7 +159,7 @@
     }
 
     public native float dotWithNormal(float dx, float dy, float dz);
-    
+
     protected void finalize() throws Throwable {
         try {
             nativeDestructor();
@@ -170,8 +170,8 @@
 
     private native void nativeConstructor();
     private native void nativeDestructor();
-    private native void nativeGetMatrix(int native_matrix);
-    private native void nativeApplyToCanvas(int native_canvas);
-    
-    int native_instance;
+    private native void nativeGetMatrix(long native_matrix);
+    private native void nativeApplyToCanvas(long native_canvas);
+
+    long native_instance;
 }
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 13f4299..2b72b93 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -40,7 +40,7 @@
 
     // assigned in constructors or setBitmap, freed in finalizer
     /** @hide */
-    public int mNativeCanvas;
+    public long mNativeCanvas;
 
     // may be null
     private Bitmap mBitmap;
@@ -84,9 +84,9 @@
     private final CanvasFinalizer mFinalizer;
 
     private static final class CanvasFinalizer {
-        private int mNativeCanvas;
+        private long mNativeCanvas;
 
-        public CanvasFinalizer(int nativeCanvas) {
+        public CanvasFinalizer(long nativeCanvas) {
             mNativeCanvas = nativeCanvas;
         }
 
@@ -144,7 +144,7 @@
     }
 
     /** @hide */
-    public Canvas(int nativeCanvas) {
+    public Canvas(long nativeCanvas) {
         if (nativeCanvas == 0) {
             throw new IllegalStateException();
         }
@@ -157,8 +157,8 @@
      * Replace existing canvas while ensuring that the swap has occurred before
      * the previous native canvas is unreferenced.
      */
-    private void safeCanvasSwap(int nativeCanvas, boolean copyState) {
-        final int oldCanvas = mNativeCanvas;
+    private void safeCanvasSwap(long nativeCanvas, boolean copyState) {
+        final long oldCanvas = mNativeCanvas;
         mNativeCanvas = nativeCanvas;
         mFinalizer.mNativeCanvas = nativeCanvas;
         if (copyState) {
@@ -174,7 +174,7 @@
      *
      * @hide
      */
-    public int getNativeCanvas() {
+    public long getNativeCanvas() {
         return mNativeCanvas;
     }
 
@@ -712,7 +712,7 @@
     }
     
     public void setDrawFilter(DrawFilter filter) {
-        int nativeFilter = 0;
+        long nativeFilter = 0;
         if (filter != null) {
             nativeFilter = filter.mNativeInt;
         }
@@ -1387,7 +1387,7 @@
                 vertOffset, texs, texOffset, colors, colorOffset,
                 indices, indexOffset, indexCount, paint.mNativePaint);
     }
-    
+
     /**
      * Draw the text, with origin at (x,y), using the specified paint. The
      * origin is interpreted based on the Align setting in the paint.
@@ -1713,137 +1713,155 @@
      */
     public static native void freeTextLayoutCaches();
 
-    private static native int initRaster(int nativeBitmapOrZero);
-    private static native void copyNativeCanvasState(int srcCanvas, int dstCanvas);
-    private static native int native_saveLayer(int nativeCanvas, RectF bounds,
-                                               int paint, int layerFlags);
-    private static native int native_saveLayer(int nativeCanvas, float l,
+    private static native long initRaster(long nativeBitmapOrZero);
+    private static native void copyNativeCanvasState(long nativeSrcCanvas,
+                                                     long nativeDstCanvas);
+    private static native int native_saveLayer(long nativeCanvas,
+                                               RectF bounds,
+                                               long nativePaint,
+                                               int layerFlags);
+    private static native int native_saveLayer(long nativeCanvas, float l,
                                                float t, float r, float b,
-                                               int paint, int layerFlags);
-    private static native int native_saveLayerAlpha(int nativeCanvas,
+                                               long nativePaint,
+                                               int layerFlags);
+    private static native int native_saveLayerAlpha(long nativeCanvas,
                                                     RectF bounds, int alpha,
                                                     int layerFlags);
-    private static native int native_saveLayerAlpha(int nativeCanvas, float l,
+    private static native int native_saveLayerAlpha(long nativeCanvas, float l,
                                                     float t, float r, float b,
                                                     int alpha, int layerFlags);
 
-    private static native void native_concat(int nCanvas, int nMatrix);
-    private static native void native_setMatrix(int nCanvas, int nMatrix);
-    private static native boolean native_clipRect(int nCanvas,
+    private static native void native_concat(long nativeCanvas,
+                                             long nativeMatrix);
+    private static native void native_setMatrix(long nativeCanvas,
+                                                long nativeMatrix);
+    private static native boolean native_clipRect(long nativeCanvas,
                                                   float left, float top,
                                                   float right, float bottom,
                                                   int regionOp);
-    private static native boolean native_clipPath(int nativeCanvas,
-                                                  int nativePath,
+    private static native boolean native_clipPath(long nativeCanvas,
+                                                  long nativePath,
                                                   int regionOp);
-    private static native boolean native_clipRegion(int nativeCanvas,
-                                                    int nativeRegion,
+    private static native boolean native_clipRegion(long nativeCanvas,
+                                                    long nativeRegion,
                                                     int regionOp);
-    private static native void nativeSetDrawFilter(int nativeCanvas,
-                                                   int nativeFilter);
-    private static native boolean native_getClipBounds(int nativeCanvas,
+    private static native void nativeSetDrawFilter(long nativeCanvas,
+                                                   long nativeFilter);
+    private static native boolean native_getClipBounds(long nativeCanvas,
                                                        Rect bounds);
-    private static native void native_getCTM(int canvas, int matrix);
-    private static native boolean native_quickReject(int nativeCanvas,
+    private static native void native_getCTM(long nativeCanvas,
+                                             long nativeMatrix);
+    private static native boolean native_quickReject(long nativeCanvas,
                                                      RectF rect);
-    private static native boolean native_quickReject(int nativeCanvas,
-                                                     int path);
-    private static native boolean native_quickReject(int nativeCanvas,
+    private static native boolean native_quickReject(long nativeCanvas,
+                                                     long nativePath);
+    private static native boolean native_quickReject(long nativeCanvas,
                                                      float left, float top,
                                                      float right, float bottom);
-    private static native void native_drawRGB(int nativeCanvas, int r, int g,
+    private static native void native_drawRGB(long nativeCanvas, int r, int g,
                                               int b);
-    private static native void native_drawARGB(int nativeCanvas, int a, int r,
+    private static native void native_drawARGB(long nativeCanvas, int a, int r,
                                                int g, int b);
-    private static native void native_drawColor(int nativeCanvas, int color);
-    private static native void native_drawColor(int nativeCanvas, int color,
+    private static native void native_drawColor(long nativeCanvas, int color);
+    private static native void native_drawColor(long nativeCanvas, int color,
                                                 int mode);
-    private static native void native_drawPaint(int nativeCanvas, int paint);
-    private static native void native_drawLine(int nativeCanvas, float startX,
+    private static native void native_drawPaint(long nativeCanvas,
+                                                long nativePaint);
+    private static native void native_drawLine(long nativeCanvas, float startX,
                                                float startY, float stopX,
-                                               float stopY, int paint);
-    private static native void native_drawRect(int nativeCanvas, RectF rect,
-                                               int paint);
-    private static native void native_drawRect(int nativeCanvas, float left,
+                                               float stopY, long nativePaint);
+    private static native void native_drawRect(long nativeCanvas, RectF rect,
+                                               long nativePaint);
+    private static native void native_drawRect(long nativeCanvas, float left,
                                                float top, float right,
-                                               float bottom, int paint);
-    private static native void native_drawOval(int nativeCanvas, RectF oval,
-                                               int paint);
-    private static native void native_drawCircle(int nativeCanvas, float cx,
+                                               float bottom,
+                                               long nativePaint);
+    private static native void native_drawOval(long nativeCanvas, RectF oval,
+                                               long nativePaint);
+    private static native void native_drawCircle(long nativeCanvas, float cx,
                                                  float cy, float radius,
-                                                 int paint);
-    private static native void native_drawArc(int nativeCanvas, RectF oval,
+                                                 long nativePaint);
+    private static native void native_drawArc(long nativeCanvas, RectF oval,
                                               float startAngle, float sweep,
-                                              boolean useCenter, int paint);
-    private static native void native_drawRoundRect(int nativeCanvas,
+                                              boolean useCenter,
+                                              long nativePaint);
+    private static native void native_drawRoundRect(long nativeCanvas,
                                                     RectF rect, float rx,
-                                                    float ry, int paint);
-    private static native void native_drawPath(int nativeCanvas, int path,
-                                               int paint);
-    private native void native_drawBitmap(int nativeCanvas, int bitmap,
+                                                    float ry, long nativePaint);
+    private static native void native_drawPath(long nativeCanvas,
+                                               long nativePath,
+                                               long nativePaint);
+    private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
                                                  float left, float top,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int canvasDensity,
                                                  int screenDensity,
                                                  int bitmapDensity);
-    private native void native_drawBitmap(int nativeCanvas, int bitmap,
+    private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
                                                  Rect src, RectF dst,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int screenDensity,
                                                  int bitmapDensity);
-    private static native void native_drawBitmap(int nativeCanvas, int bitmap,
+    private static native void native_drawBitmap(long nativeCanvas,
+                                                 long nativeBitmap,
                                                  Rect src, Rect dst,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int screenDensity,
                                                  int bitmapDensity);
-    private static native void native_drawBitmap(int nativeCanvas, int[] colors,
+    private static native void native_drawBitmap(long nativeCanvas, int[] colors,
                                                 int offset, int stride, float x,
                                                  float y, int width, int height,
                                                  boolean hasAlpha,
-                                                 int nativePaintOrZero);
-    private static native void nativeDrawBitmapMatrix(int nCanvas, int nBitmap,
-                                                      int nMatrix, int nPaint);
-    private static native void nativeDrawBitmapMesh(int nCanvas, int nBitmap,
+                                                 long nativePaintOrZero);
+    private static native void nativeDrawBitmapMatrix(long nativeCanvas,
+                                                      long nativeBitmap,
+                                                      long nativeMatrix,
+                                                      long nativePaint);
+    private static native void nativeDrawBitmapMesh(long nativeCanvas,
+                                                    long nativeBitmap,
                                                     int meshWidth, int meshHeight,
                                                     float[] verts, int vertOffset,
-                                                    int[] colors, int colorOffset, int nPaint);
-    private static native void nativeDrawVertices(int nCanvas, int mode, int n,
+                                                    int[] colors, int colorOffset,
+                                                    long nativePaint);
+    private static native void nativeDrawVertices(long nativeCanvas, int mode, int n,
                    float[] verts, int vertOffset, float[] texs, int texOffset,
                    int[] colors, int colorOffset, short[] indices,
-                   int indexOffset, int indexCount, int nPaint);
-    
-    private static native void native_drawText(int nativeCanvas, char[] text,
+                   int indexOffset, int indexCount, long nativePaint);
+
+    private static native void native_drawText(long nativeCanvas, char[] text,
                                                int index, int count, float x,
-                                               float y, int flags, int paint, int typeface);
-    private static native void native_drawText(int nativeCanvas, String text,
+                                               float y, int flags, long nativePaint,
+                                               long nativeTypeface);
+    private static native void native_drawText(long nativeCanvas, String text,
                                                int start, int end, float x,
-                                               float y, int flags, int paint, int typeface);
+                                               float y, int flags, long nativePaint,
+                                               long nativeTypeface);
 
-    private static native void native_drawTextRun(int nativeCanvas, String text,
+    private static native void native_drawTextRun(long nativeCanvas, String text,
             int start, int end, int contextStart, int contextEnd,
-            float x, float y, int flags, int paint, int typeface);
+            float x, float y, int flags, long nativePaint, long nativeTypeface);
 
-    private static native void native_drawTextRun(int nativeCanvas, char[] text,
+    private static native void native_drawTextRun(long nativeCanvas, char[] text,
             int start, int count, int contextStart, int contextCount,
-            float x, float y, int flags, int paint, int typeface);
+            float x, float y, int flags, long nativePaint, long nativeTypeface);
 
-    private static native void native_drawPosText(int nativeCanvas,
+    private static native void native_drawPosText(long nativeCanvas,
                                                   char[] text, int index,
                                                   int count, float[] pos,
-                                                  int paint);
-    private static native void native_drawPosText(int nativeCanvas,
+                                                  long nativePaint);
+    private static native void native_drawPosText(long nativeCanvas,
                                                   String text, float[] pos,
-                                                  int paint);
-    private static native void native_drawTextOnPath(int nativeCanvas,
+                                                  long nativePaint);
+    private static native void native_drawTextOnPath(long nativeCanvas,
                                                      char[] text, int index,
-                                                     int count, int path,
+                                                     int count, long nativePath,
                                                      float hOffset,
                                                      float vOffset, int bidiFlags,
-                                                     int paint);
-    private static native void native_drawTextOnPath(int nativeCanvas,
-                                                     String text, int path,
-                                                     float hOffset, 
-                                                     float vOffset, 
-                                                     int flags, int paint);
-    private static native void finalizer(int nativeCanvas);
+                                                     long nativePaint);
+    private static native void native_drawTextOnPath(long nativeCanvas,
+                                                     String text, long nativePath,
+                                                     float hOffset,
+                                                     float vOffset,
+                                                     int flags, long nativePaint);
+    private static native void finalizer(long nativeCanvas);
 }
diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java
index 8e0af77..d3c1974 100644
--- a/graphics/java/android/graphics/ColorFilter.java
+++ b/graphics/java/android/graphics/ColorFilter.java
@@ -28,14 +28,14 @@
  */
 public class ColorFilter {
     // Holds the pointer to the native SkColorFilter instance
-    int native_instance;
+    long native_instance;
 
     /**
      * Holds the pointer to the native SkiaColorFilter instance, from libhwui.
      *
      * @hide
      */
-    public int nativeColorFilter;
+    public long nativeColorFilter;
 
     @Override
     protected void finalize() throws Throwable {
@@ -46,5 +46,5 @@
         }
     }
 
-    static native void destroyFilter(int native_instance, int nativeColorFilter);
+    static native void destroyFilter(long native_instance, long nativeColorFilter);
 }
diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java
index 8de32ec..3f7331d 100644
--- a/graphics/java/android/graphics/ColorMatrixColorFilter.java
+++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java
@@ -119,6 +119,6 @@
         nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix);
     }
 
-    private static native int nativeColorMatrixFilter(float[] array);
-    private static native int nColorMatrixFilter(int nativeFilter, float[] array);
+    private static native long nativeColorMatrixFilter(float[] array);
+    private static native long nColorMatrixFilter(long nativeFilter, float[] array);
 }
diff --git a/graphics/java/android/graphics/ComposePathEffect.java b/graphics/java/android/graphics/ComposePathEffect.java
index beac78e..3fc9eb5 100644
--- a/graphics/java/android/graphics/ComposePathEffect.java
+++ b/graphics/java/android/graphics/ComposePathEffect.java
@@ -27,6 +27,7 @@
                                        innerpe.native_instance);
     }
     
-    private static native int nativeCreate(int outerpe, int innerpe);
+    private static native long nativeCreate(long nativeOuterpe,
+                                            long nativeInnerpe);
 }
 
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java
index de0d3d6..5109ffd 100644
--- a/graphics/java/android/graphics/ComposeShader.java
+++ b/graphics/java/android/graphics/ComposeShader.java
@@ -104,12 +104,12 @@
         return copy;
     }
 
-    private static native int nativeCreate1(int native_shaderA, int native_shaderB,
-            int native_mode);
-    private static native int nativeCreate2(int native_shaderA, int native_shaderB,
+    private static native long nativeCreate1(long native_shaderA, long native_shaderB,
+            long native_mode);
+    private static native long nativeCreate2(long native_shaderA, long native_shaderB,
             int porterDuffMode);
-    private static native int nativePostCreate1(int native_shader, int native_skiaShaderA,
-            int native_skiaShaderB, int native_mode);
-    private static native int nativePostCreate2(int native_shader, int native_skiaShaderA,
-            int native_skiaShaderB, int porterDuffMode);
+    private static native long nativePostCreate1(long native_shader, long native_skiaShaderA,
+            long native_skiaShaderB, long native_mode);
+    private static native long nativePostCreate2(long native_shader, long native_skiaShaderA,
+            long native_skiaShaderB, int porterDuffMode);
 }
diff --git a/graphics/java/android/graphics/CornerPathEffect.java b/graphics/java/android/graphics/CornerPathEffect.java
index 400c886..8f4d7d9 100644
--- a/graphics/java/android/graphics/CornerPathEffect.java
+++ b/graphics/java/android/graphics/CornerPathEffect.java
@@ -28,6 +28,6 @@
         native_instance = nativeCreate(radius);
     }
     
-    private static native int nativeCreate(float radius);
+    private static native long nativeCreate(float radius);
 }
 
diff --git a/graphics/java/android/graphics/DashPathEffect.java b/graphics/java/android/graphics/DashPathEffect.java
index 2bdecce..ef3ebe8 100644
--- a/graphics/java/android/graphics/DashPathEffect.java
+++ b/graphics/java/android/graphics/DashPathEffect.java
@@ -38,6 +38,6 @@
         native_instance = nativeCreate(intervals, phase);
     }
     
-    private static native int nativeCreate(float intervals[], float phase);
+    private static native long nativeCreate(float intervals[], float phase);
 }
 
diff --git a/graphics/java/android/graphics/DiscretePathEffect.java b/graphics/java/android/graphics/DiscretePathEffect.java
index de8b2f0..3b3c9c9 100644
--- a/graphics/java/android/graphics/DiscretePathEffect.java
+++ b/graphics/java/android/graphics/DiscretePathEffect.java
@@ -26,6 +26,6 @@
         native_instance = nativeCreate(segmentLength, deviation);
     }
     
-    private static native int nativeCreate(float length, float deviation);
+    private static native long nativeCreate(float length, float deviation);
 }
 
diff --git a/graphics/java/android/graphics/DrawFilter.java b/graphics/java/android/graphics/DrawFilter.java
index 1f64539..ed38f37 100644
--- a/graphics/java/android/graphics/DrawFilter.java
+++ b/graphics/java/android/graphics/DrawFilter.java
@@ -25,7 +25,7 @@
 public class DrawFilter {
 
     // this is set by subclasses, but don't make it public
-    /* package */ int mNativeInt;    // pointer to native object
+    /* package */ long mNativeInt;    // pointer to native object
 
     protected void finalize() throws Throwable {
         try {
@@ -35,6 +35,6 @@
         }
     }
     
-    private static native void nativeDestructor(int nativeDrawFilter);
+    private static native void nativeDestructor(long nativeDrawFilter);
 }
 
diff --git a/graphics/java/android/graphics/EmbossMaskFilter.java b/graphics/java/android/graphics/EmbossMaskFilter.java
index 5dd8611..a9e180f 100644
--- a/graphics/java/android/graphics/EmbossMaskFilter.java
+++ b/graphics/java/android/graphics/EmbossMaskFilter.java
@@ -33,6 +33,6 @@
         native_instance = nativeConstructor(direction, ambient, specular, blurRadius);
     }
 
-    private static native int nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
+    private static native long nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
 }
 
diff --git a/graphics/java/android/graphics/LargeBitmap.java b/graphics/java/android/graphics/LargeBitmap.java
index c70c709..936c338 100644
--- a/graphics/java/android/graphics/LargeBitmap.java
+++ b/graphics/java/android/graphics/LargeBitmap.java
@@ -27,7 +27,7 @@
  * @hide
  */
 public final class LargeBitmap {
-    private int mNativeLargeBitmap;
+    private long mNativeLargeBitmap;
     private boolean mRecycled;
 
     /*  Private constructor that must received an already allocated native
@@ -35,8 +35,8 @@
 
         This can be called from JNI code.
     */
-    private LargeBitmap(int lbm) {
-        mNativeLargeBitmap = lbm;
+    private LargeBitmap(long nativeLbm) {
+        mNativeLargeBitmap = nativeLbm;
         mRecycled = false;
     }
 
@@ -109,10 +109,10 @@
         recycle();
     }
 
-    private static native Bitmap nativeDecodeRegion(int lbm,
+    private static native Bitmap nativeDecodeRegion(long nativeLbm,
             int start_x, int start_y, int width, int height,
             BitmapFactory.Options options);
-    private static native int nativeGetWidth(int lbm);
-    private static native int nativeGetHeight(int lbm);
-    private static native void nativeClean(int lbm);
+    private static native int nativeGetWidth(long nativeLbm);
+    private static native int nativeGetHeight(long nativeLbm);
+    private static native void nativeClean(long nativeLbm);
 }
diff --git a/graphics/java/android/graphics/LayerRasterizer.java b/graphics/java/android/graphics/LayerRasterizer.java
index 9bd55a5..dc307c6 100644
--- a/graphics/java/android/graphics/LayerRasterizer.java
+++ b/graphics/java/android/graphics/LayerRasterizer.java
@@ -34,7 +34,7 @@
         nativeAddLayer(native_instance, paint.mNativePaint, 0, 0);
     }
 
-    private static native int nativeConstructor();
-    private static native void nativeAddLayer(int native_layer, int native_paint, float dx, float dy);
+    private static native long nativeConstructor();
+    private static native void nativeAddLayer(long native_layer, long native_paint, float dx, float dy);
 }
 
diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java
index 75f1827..5829edf 100644
--- a/graphics/java/android/graphics/LightingColorFilter.java
+++ b/graphics/java/android/graphics/LightingColorFilter.java
@@ -104,6 +104,6 @@
         nativeColorFilter = nCreateLightingFilter(native_instance, mMul, mAdd);
     }
 
-    private static native int native_CreateLightingFilter(int mul, int add);
-    private static native int nCreateLightingFilter(int nativeFilter, int mul, int add);
+    private static native long native_CreateLightingFilter(int mul, int add);
+    private static native long nCreateLightingFilter(long nativeFilter, int mul, int add);
 }
diff --git a/graphics/java/android/graphics/LinearGradient.java b/graphics/java/android/graphics/LinearGradient.java
index 4c88de3..9ad3e49 100644
--- a/graphics/java/android/graphics/LinearGradient.java
+++ b/graphics/java/android/graphics/LinearGradient.java
@@ -116,12 +116,12 @@
         return copy;
     }
 
-    private native int nativeCreate1(float x0, float y0, float x1, float y1,
+    private native long nativeCreate1(float x0, float y0, float x1, float y1,
             int colors[], float positions[], int tileMode);
-	private native int nativeCreate2(float x0, float y0, float x1, float y1,
+	private native long nativeCreate2(float x0, float y0, float x1, float y1,
             int color0, int color1, int tileMode);
-    private native int nativePostCreate1(int native_shader, float x0, float y0, float x1, float y1,
+    private native long nativePostCreate1(long native_shader, float x0, float y0, float x1, float y1,
             int colors[], float positions[], int tileMode);
-    private native int nativePostCreate2(int native_shader, float x0, float y0, float x1, float y1,
+    private native long nativePostCreate2(long native_shader, float x0, float y0, float x1, float y1,
             int color0, int color1, int tileMode);
 }
diff --git a/graphics/java/android/graphics/MaskFilter.java b/graphics/java/android/graphics/MaskFilter.java
index 4ebb619..27a7dda 100644
--- a/graphics/java/android/graphics/MaskFilter.java
+++ b/graphics/java/android/graphics/MaskFilter.java
@@ -27,6 +27,6 @@
         nativeDestructor(native_instance);
     }
 
-    private static native void nativeDestructor(int native_filter);
-    int native_instance;
+    private static native void nativeDestructor(long native_filter);
+    long native_instance;
 }
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index 32e0c01..c8bcf26 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -219,7 +219,7 @@
     /**
      * @hide
      */
-    public int native_instance;
+    public long native_instance;
 
     /**
      * Create an identity matrix
@@ -800,83 +800,86 @@
         }
     }
 
-    /*package*/ final int ni() {
+    /*package*/ final long ni() {
         return native_instance;
     }
 
-    private static native int native_create(int native_src_or_zero);
-    private static native boolean native_isIdentity(int native_object);
-    private static native boolean native_rectStaysRect(int native_object);
-    private static native void native_reset(int native_object);
-    private static native void native_set(int native_object, int other);
-    private static native void native_setTranslate(int native_object,
+    private static native long native_create(long native_src_or_zero);
+    private static native boolean native_isIdentity(long native_object);
+    private static native boolean native_rectStaysRect(long native_object);
+    private static native void native_reset(long native_object);
+    private static native void native_set(long native_object,
+                                          long native_other);
+    private static native void native_setTranslate(long native_object,
                                                    float dx, float dy);
-    private static native void native_setScale(int native_object,
+    private static native void native_setScale(long native_object,
                                         float sx, float sy, float px, float py);
-    private static native void native_setScale(int native_object,
+    private static native void native_setScale(long native_object,
                                                float sx, float sy);
-    private static native void native_setRotate(int native_object,
+    private static native void native_setRotate(long native_object,
                                             float degrees, float px, float py);
-    private static native void native_setRotate(int native_object,
+    private static native void native_setRotate(long native_object,
                                                 float degrees);
-    private static native void native_setSinCos(int native_object,
+    private static native void native_setSinCos(long native_object,
                             float sinValue, float cosValue, float px, float py);
-    private static native void native_setSinCos(int native_object,
+    private static native void native_setSinCos(long native_object,
                                                 float sinValue, float cosValue);
-    private static native void native_setSkew(int native_object,
+    private static native void native_setSkew(long native_object,
                                         float kx, float ky, float px, float py);
-    private static native void native_setSkew(int native_object,
+    private static native void native_setSkew(long native_object,
                                               float kx, float ky);
-    private static native boolean native_setConcat(int native_object,
-                                                   int a, int b);
-    private static native boolean native_preTranslate(int native_object,
+    private static native boolean native_setConcat(long native_object,
+                                                   long native_a,
+                                                   long native_b);
+    private static native boolean native_preTranslate(long native_object,
                                                       float dx, float dy);
-    private static native boolean native_preScale(int native_object,
+    private static native boolean native_preScale(long native_object,
                                         float sx, float sy, float px, float py);
-    private static native boolean native_preScale(int native_object,
+    private static native boolean native_preScale(long native_object,
                                                   float sx, float sy);
-    private static native boolean native_preRotate(int native_object,
+    private static native boolean native_preRotate(long native_object,
                                             float degrees, float px, float py);
-    private static native boolean native_preRotate(int native_object,
+    private static native boolean native_preRotate(long native_object,
                                                    float degrees);
-    private static native boolean native_preSkew(int native_object,
+    private static native boolean native_preSkew(long native_object,
                                         float kx, float ky, float px, float py);
-    private static native boolean native_preSkew(int native_object,
+    private static native boolean native_preSkew(long native_object,
                                                  float kx, float ky);
-    private static native boolean native_preConcat(int native_object,
-                                                   int other_matrix);
-    private static native boolean native_postTranslate(int native_object,
+    private static native boolean native_preConcat(long native_object,
+                                                   long native_other_matrix);
+    private static native boolean native_postTranslate(long native_object,
                                                        float dx, float dy);
-    private static native boolean native_postScale(int native_object,
+    private static native boolean native_postScale(long native_object,
                                         float sx, float sy, float px, float py);
-    private static native boolean native_postScale(int native_object,
+    private static native boolean native_postScale(long native_object,
                                                    float sx, float sy);
-    private static native boolean native_postRotate(int native_object,
+    private static native boolean native_postRotate(long native_object,
                                             float degrees, float px, float py);
-    private static native boolean native_postRotate(int native_object,
+    private static native boolean native_postRotate(long native_object,
                                                     float degrees);
-    private static native boolean native_postSkew(int native_object,
+    private static native boolean native_postSkew(long native_object,
                                         float kx, float ky, float px, float py);
-    private static native boolean native_postSkew(int native_object,
+    private static native boolean native_postSkew(long native_object,
                                                   float kx, float ky);
-    private static native boolean native_postConcat(int native_object,
-                                                    int other_matrix);
-    private static native boolean native_setRectToRect(int native_object,
+    private static native boolean native_postConcat(long native_object,
+                                                    long native_other_matrix);
+    private static native boolean native_setRectToRect(long native_object,
                                                 RectF src, RectF dst, int stf);
-    private static native boolean native_setPolyToPoly(int native_object,
+    private static native boolean native_setPolyToPoly(long native_object,
         float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount);
-    private static native boolean native_invert(int native_object, int inverse);
-    private static native void native_mapPoints(int native_object,
+    private static native boolean native_invert(long native_object,
+                                                long native_inverse);
+    private static native void native_mapPoints(long native_object,
                         float[] dst, int dstIndex, float[] src, int srcIndex,
                         int ptCount, boolean isPts);
-    private static native boolean native_mapRect(int native_object,
+    private static native boolean native_mapRect(long native_object,
                                                  RectF dst, RectF src);
-    private static native float native_mapRadius(int native_object,
+    private static native float native_mapRadius(long native_object,
                                                  float radius);
-    private static native void native_getValues(int native_object,
+    private static native void native_getValues(long native_object,
                                                 float[] values);
-    private static native void native_setValues(int native_object,
+    private static native void native_setValues(long native_object,
                                                 float[] values);
-    private static native boolean native_equals(int native_a, int native_b);
-    private static native void finalizer(int native_instance);
+    private static native boolean native_equals(long native_a, long native_b);
+    private static native void finalizer(long native_instance);
 }
diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java
index 528d9de..69089b1 100644
--- a/graphics/java/android/graphics/NinePatch.java
+++ b/graphics/java/android/graphics/NinePatch.java
@@ -39,7 +39,7 @@
      *
      * @hide
      */
-    public final int mNativeChunk;
+    public final long mNativeChunk;
 
     private Paint mPaint;
     private String mSrcName;
@@ -217,7 +217,7 @@
      * that are transparent.
      */
     public final Region getTransparentRegion(Rect bounds) {
-        int r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
+        long r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
         return r != 0 ? new Region(r) : null;
     }
 
@@ -236,11 +236,11 @@
      * If validation is successful, this method returns a native Res_png_9patch*
      * object used by the renderers.
      */
-    private static native int validateNinePatchChunk(int bitmap, byte[] chunk);
-    private static native void nativeFinalize(int chunk);
-    private static native void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance,
-            int c, int paint_instance_or_null, int destDensity, int srcDensity);
-    private static native void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance,
-            int c, int paint_instance_or_null, int destDensity, int srcDensity);
-    private static native int nativeGetTransparentRegion(int bitmap, int chunk, Rect location);
+    private static native long validateNinePatchChunk(long bitmap, byte[] chunk);
+    private static native void nativeFinalize(long chunk);
+    private static native void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance,
+            long c, long paint_instance_or_null, int destDensity, int srcDensity);
+    private static native void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance,
+            long c, long paint_instance_or_null, int destDensity, int srcDensity);
+    private static native long nativeGetTransparentRegion(long bitmap, long chunk, Rect location);
 }
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index c2d4df2..916cb5a 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -32,11 +32,11 @@
     /**
      * @hide
      */
-    public int mNativePaint;
+    public long mNativePaint;
     /**
      * @hide
      */
-    public int mNativeTypeface;
+    public long mNativeTypeface;
 
     private ColorFilter mColorFilter;
     private MaskFilter  mMaskFilter;
@@ -949,7 +949,7 @@
      * @return       shader
      */
     public Shader setShader(Shader shader) {
-        int shaderNative = 0;
+        long shaderNative = 0;
         if (shader != null)
             shaderNative = shader.native_instance;
         native_setShader(mNativePaint, shaderNative);
@@ -973,7 +973,7 @@
      * @return       filter
      */
     public ColorFilter setColorFilter(ColorFilter filter) {
-        int filterNative = 0;
+        long filterNative = 0;
         if (filter != null)
             filterNative = filter.native_instance;
         native_setColorFilter(mNativePaint, filterNative);
@@ -1000,7 +1000,7 @@
      * @return         xfermode
      */
     public Xfermode setXfermode(Xfermode xfermode) {
-        int xfermodeNative = 0;
+        long xfermodeNative = 0;
         if (xfermode != null)
             xfermodeNative = xfermode.native_instance;
         native_setXfermode(mNativePaint, xfermodeNative);
@@ -1027,7 +1027,7 @@
      * @return       effect
      */
     public PathEffect setPathEffect(PathEffect effect) {
-        int effectNative = 0;
+        long effectNative = 0;
         if (effect != null) {
             effectNative = effect.native_instance;
         }
@@ -1056,7 +1056,7 @@
      * @return           maskfilter
      */
     public MaskFilter setMaskFilter(MaskFilter maskfilter) {
-        int maskfilterNative = 0;
+        long maskfilterNative = 0;
         if (maskfilter != null) {
             maskfilterNative = maskfilter.native_instance;
         }
@@ -1087,7 +1087,7 @@
      * @return         typeface
      */
     public Typeface setTypeface(Typeface typeface) {
-        int typefaceNative = 0;
+        long typefaceNative = 0;
         if (typeface != null) {
             typefaceNative = typeface.native_instance;
         }
@@ -1119,7 +1119,7 @@
      * @return           rasterizer
      */
     public Rasterizer setRasterizer(Rasterizer rasterizer) {
-        int rasterizerNative = 0;
+        long rasterizerNative = 0;
         if (rasterizer != null) {
             rasterizerNative = rasterizer.native_instance;
         }
@@ -2214,68 +2214,68 @@
         }
     }
 
-    private static native int native_init();
-    private static native int native_initWithPaint(int paint);
-    private static native void native_reset(int native_object);
-    private static native void native_set(int native_dst, int native_src);
-    private static native int native_getStyle(int native_object);
-    private static native void native_setStyle(int native_object, int style);
-    private static native int native_getStrokeCap(int native_object);
-    private static native void native_setStrokeCap(int native_object, int cap);
-    private static native int native_getStrokeJoin(int native_object);
-    private static native void native_setStrokeJoin(int native_object,
+    private static native long native_init();
+    private static native long native_initWithPaint(long paint);
+    private static native void native_reset(long native_object);
+    private static native void native_set(long native_dst, long native_src);
+    private static native int native_getStyle(long native_object);
+    private static native void native_setStyle(long native_object, int style);
+    private static native int native_getStrokeCap(long native_object);
+    private static native void native_setStrokeCap(long native_object, int cap);
+    private static native int native_getStrokeJoin(long native_object);
+    private static native void native_setStrokeJoin(long native_object,
                                                     int join);
-    private static native boolean native_getFillPath(int native_object,
-                                                     int src, int dst);
-    private static native int native_setShader(int native_object, int shader);
-    private static native int native_setColorFilter(int native_object,
-                                                    int filter);
-    private static native int native_setXfermode(int native_object,
-                                                 int xfermode);
-    private static native int native_setPathEffect(int native_object,
-                                                   int effect);
-    private static native int native_setMaskFilter(int native_object,
-                                                   int maskfilter);
-    private static native int native_setTypeface(int native_object,
-                                                 int typeface);
-    private static native int native_setRasterizer(int native_object,
-                                                   int rasterizer);
+    private static native boolean native_getFillPath(long native_object,
+                                                     long src, long dst);
+    private static native long native_setShader(long native_object, long shader);
+    private static native long native_setColorFilter(long native_object,
+                                                    long filter);
+    private static native long native_setXfermode(long native_object,
+                                                  long xfermode);
+    private static native long native_setPathEffect(long native_object,
+                                                    long effect);
+    private static native long native_setMaskFilter(long native_object,
+                                                    long maskfilter);
+    private static native long native_setTypeface(long native_object,
+                                                  long typeface);
+    private static native long native_setRasterizer(long native_object,
+                                                   long rasterizer);
 
-    private static native int native_getTextAlign(int native_object);
-    private static native void native_setTextAlign(int native_object,
+    private static native int native_getTextAlign(long native_object);
+    private static native void native_setTextAlign(long native_object,
                                                    int align);
 
-    private static native void native_setTextLocale(int native_object,
+    private static native void native_setTextLocale(long native_object,
                                                     String locale);
 
-    private static native int native_getTextWidths(int native_object,
+    private static native int native_getTextWidths(long native_object,
                             char[] text, int index, int count, int bidiFlags, float[] widths);
-    private static native int native_getTextWidths(int native_object,
+    private static native int native_getTextWidths(long native_object,
                             String text, int start, int end, int bidiFlags, float[] widths);
 
-    private static native int native_getTextGlyphs(int native_object,
+    private static native int native_getTextGlyphs(long native_object,
             String text, int start, int end, int contextStart, int contextEnd,
             int flags, char[] glyphs);
 
-    private static native float native_getTextRunAdvances(int native_object,
+    private static native float native_getTextRunAdvances(long native_object,
             char[] text, int index, int count, int contextIndex, int contextCount,
             int flags, float[] advances, int advancesIndex);
-    private static native float native_getTextRunAdvances(int native_object,
+    private static native float native_getTextRunAdvances(long native_object,
             String text, int start, int end, int contextStart, int contextEnd,
             int flags, float[] advances, int advancesIndex);
 
-    private native int native_getTextRunCursor(int native_object, char[] text,
+    private native int native_getTextRunCursor(long native_object, char[] text,
             int contextStart, int contextLength, int flags, int offset, int cursorOpt);
-    private native int native_getTextRunCursor(int native_object, String text,
+    private native int native_getTextRunCursor(long native_object, String text,
             int contextStart, int contextEnd, int flags, int offset, int cursorOpt);
 
-    private static native void native_getTextPath(int native_object, int bidiFlags,
-                char[] text, int index, int count, float x, float y, int path);
-    private static native void native_getTextPath(int native_object, int bidiFlags,
-                String text, int start, int end, float x, float y, int path);
-    private static native void nativeGetStringBounds(int nativePaint,
+    private static native void native_getTextPath(long native_object, int bidiFlags,
+                char[] text, int index, int count, float x, float y, long path);
+    private static native void native_getTextPath(long native_object, int bidiFlags,
+                String text, int start, int end, float x, float y, long path);
+    private static native void nativeGetStringBounds(long nativePaint,
                                 String text, int start, int end, int bidiFlags, Rect bounds);
-    private static native void nativeGetCharArrayBounds(int nativePaint,
+    private static native void nativeGetCharArrayBounds(long nativePaint,
                                 char[] text, int index, int count, int bidiFlags, Rect bounds);
-    private static native void finalizer(int nativePaint);
+    private static native void finalizer(long nativePaint);
 }
diff --git a/graphics/java/android/graphics/PaintFlagsDrawFilter.java b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
index c833a12..65a6218 100644
--- a/graphics/java/android/graphics/PaintFlagsDrawFilter.java
+++ b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
@@ -38,6 +38,6 @@
         mNativeInt = nativeConstructor(clearBits, setBits);
     }
     
-    private static native int nativeConstructor(int clearBits, int setBits);
+    private static native long nativeConstructor(int clearBits, int setBits);
 }
 
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 4776088..5ac3f85 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -27,8 +27,8 @@
     /**
      * @hide
      */
-    public final int mNativePath;
-    private int mNativePathMeasure;
+    public final long mNativePath;
+    private long mNativePathMeasure;
 
     /**
      * @hide
@@ -53,7 +53,7 @@
      * @param src The path to copy from when initializing the new path
      */
     public Path(Path src) {
-        int valNative = 0;
+        long valNative = 0;
         if (src != null) {
             valNative = src.mNativePath;
             isSimplePath = src.isSimplePath;
@@ -657,7 +657,7 @@
      *            the original path is modified.
      */
     public void offset(float dx, float dy, Path dst) {
-        int dstNative = 0;
+        long dstNative = 0;
         if (dst != null) {
             dstNative = dst.mNativePath;
             dst.isSimplePath = false;
@@ -703,7 +703,7 @@
      *               then the the original path is modified
      */
     public void transform(Matrix matrix, Path dst) {
-        int dstNative = 0;
+        long dstNative = 0;
         if (dst != null) {
             dst.isSimplePath = false;
             dstNative = dst.mNativePath;
@@ -738,7 +738,7 @@
         }
     }
 
-    final int ni() {
+    final long ni() {
         return mNativePath;
     }
 
@@ -818,7 +818,7 @@
         if (trimStart > trimEnd) {
             throw new IllegalArgumentException("trim end cannot be less than start");
         }
-        int dstNative = 0;
+        long dstNative = 0;
         if (dst != null) {
             dstNative = dst.mNativePath;
             dst.isSimplePath = false;
@@ -828,54 +828,54 @@
                 trimStart, trimEnd, trimOffset);
     }
 
-    private static native int init1();
-    private static native int init2(int nPath);
-    private static native void native_reset(int nPath);
-    private static native void native_rewind(int nPath);
-    private static native void native_set(int native_dst, int native_src);
-    private static native int native_getFillType(int nPath);
-    private static native void native_setFillType(int nPath, int ft);
-    private static native boolean native_isEmpty(int nPath);
-    private static native boolean native_isRect(int nPath, RectF rect);
-    private static native void native_computeBounds(int nPath, RectF bounds);
-    private static native void native_incReserve(int nPath, int extraPtCount);
-    private static native void native_moveTo(int nPath, float x, float y);
-    private static native void native_rMoveTo(int nPath, float dx, float dy);
-    private static native void native_lineTo(int nPath, float x, float y);
-    private static native void native_rLineTo(int nPath, float dx, float dy);
-    private static native void native_quadTo(int nPath, float x1, float y1,
+    private static native long init1();
+    private static native long init2(long nPath);
+    private static native void native_reset(long nPath);
+    private static native void native_rewind(long nPath);
+    private static native void native_set(long native_dst, long native_src);
+    private static native int native_getFillType(long nPath);
+    private static native void native_setFillType(long nPath, int ft);
+    private static native boolean native_isEmpty(long nPath);
+    private static native boolean native_isRect(long nPath, RectF rect);
+    private static native void native_computeBounds(long nPath, RectF bounds);
+    private static native void native_incReserve(long nPath, int extraPtCount);
+    private static native void native_moveTo(long nPath, float x, float y);
+    private static native void native_rMoveTo(long nPath, float dx, float dy);
+    private static native void native_lineTo(long nPath, float x, float y);
+    private static native void native_rLineTo(long nPath, float dx, float dy);
+    private static native void native_quadTo(long nPath, float x1, float y1,
                                              float x2, float y2);
-    private static native void native_rQuadTo(int nPath, float dx1, float dy1,
+    private static native void native_rQuadTo(long nPath, float dx1, float dy1,
                                               float dx2, float dy2);
-    private static native void native_cubicTo(int nPath, float x1, float y1,
+    private static native void native_cubicTo(long nPath, float x1, float y1,
                                         float x2, float y2, float x3, float y3);
-    private static native void native_rCubicTo(int nPath, float x1, float y1,
+    private static native void native_rCubicTo(long nPath, float x1, float y1,
                                         float x2, float y2, float x3, float y3);
-    private static native void native_arcTo(int nPath, RectF oval,
+    private static native void native_arcTo(long nPath, RectF oval,
                     float startAngle, float sweepAngle, boolean forceMoveTo);
-    private static native void native_close(int nPath);
-    private static native void native_addRect(int nPath, RectF rect, int dir);
-    private static native void native_addRect(int nPath, float left, float top,
+    private static native void native_close(long nPath);
+    private static native void native_addRect(long nPath, RectF rect, int dir);
+    private static native void native_addRect(long nPath, float left, float top,
                                             float right, float bottom, int dir);
-    private static native void native_addOval(int nPath, RectF oval, int dir);
-    private static native void native_addCircle(int nPath, float x, float y, float radius, int dir);
-    private static native void native_addArc(int nPath, RectF oval,
+    private static native void native_addOval(long nPath, RectF oval, int dir);
+    private static native void native_addCircle(long nPath, float x, float y, float radius, int dir);
+    private static native void native_addArc(long nPath, RectF oval,
                                             float startAngle, float sweepAngle);
-    private static native void native_addRoundRect(int nPath, RectF rect,
+    private static native void native_addRoundRect(long nPath, RectF rect,
                                                    float rx, float ry, int dir);
-    private static native void native_addRoundRect(int nPath, RectF r, float[] radii, int dir);
-    private static native void native_addPath(int nPath, int src, float dx, float dy);
-    private static native void native_addPath(int nPath, int src);
-    private static native void native_addPath(int nPath, int src, int matrix);
-    private static native void native_offset(int nPath, float dx, float dy, int dst_path);
-    private static native void native_offset(int nPath, float dx, float dy);
-    private static native void native_setLastPoint(int nPath, float dx, float dy);
-    private static native void native_transform(int nPath, int matrix, int dst_path);
-    private static native void native_transform(int nPath, int matrix);
-    private static native boolean native_op(int path1, int path2, int op, int result);
-    private static native void finalizer(int nPath);
-    private static native float[] native_approximate(int nPath, float error);
-    private static native int native_trim(int nPath, int nTargetPath, int nPathMeasure,
+    private static native void native_addRoundRect(long nPath, RectF r, float[] radii, int dir);
+    private static native void native_addPath(long nPath, long src, float dx, float dy);
+    private static native void native_addPath(long nPath, long src);
+    private static native void native_addPath(long nPath, long src, long matrix);
+    private static native void native_offset(long nPath, float dx, float dy, long dst_path);
+    private static native void native_offset(long nPath, float dx, float dy);
+    private static native void native_setLastPoint(long nPath, float dx, float dy);
+    private static native void native_transform(long nPath, long matrix, long dst_path);
+    private static native void native_transform(long nPath, long matrix);
+    private static native boolean native_op(long path1, long path2, int op, long result);
+    private static native void finalizer(long nPath);
+    private static native float[] native_approximate(long nPath, float error);
+    private static native int native_trim(long nPath, long nTargetPath, long nPathMeasure,
             float trimStart, float trimEnd, float trimOffset);
-    private static native void native_destroyMeasure(int nPathMeasure);
+    private static native void native_destroyMeasure(long nPathMeasure);
 }
diff --git a/graphics/java/android/graphics/PathDashPathEffect.java b/graphics/java/android/graphics/PathDashPathEffect.java
index e8ad5fd8..4f43f68 100644
--- a/graphics/java/android/graphics/PathDashPathEffect.java
+++ b/graphics/java/android/graphics/PathDashPathEffect.java
@@ -45,7 +45,7 @@
                                        style.native_style);
     }
     
-    private static native int nativeCreate(int native_path, float advance,
+    private static native long nativeCreate(long native_path, float advance,
                                            float phase, int native_style);
 }
 
diff --git a/graphics/java/android/graphics/PathEffect.java b/graphics/java/android/graphics/PathEffect.java
index 9b2cd66..617dfca 100644
--- a/graphics/java/android/graphics/PathEffect.java
+++ b/graphics/java/android/graphics/PathEffect.java
@@ -27,6 +27,6 @@
         nativeDestructor(native_instance);
     }
 
-    private static native void nativeDestructor(int native_patheffect);
-    int native_instance;
+    private static native void nativeDestructor(long native_patheffect);
+    long native_instance;
 }
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index 71e02f6..25188e0 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -29,7 +29,7 @@
  */
 public class Picture {
     private Canvas mRecordingCanvas;
-    private final int mNativePicture;
+    private final long mNativePicture;
 
     /**
      * @hide
@@ -63,7 +63,7 @@
      * into it.
      */
     public Canvas beginRecording(int width, int height) {
-        int ni = nativeBeginRecording(mNativePicture, width, height);
+        long ni = nativeBeginRecording(mNativePicture, width, height);
         mRecordingCanvas = new RecordingCanvas(this, ni);
         return mRecordingCanvas;
     }
@@ -164,11 +164,11 @@
         }
     }
 
-    final int ni() {
+    final long ni() {
         return mNativePicture;
     }
     
-    private Picture(int nativePicture, boolean fromStream) {
+    private Picture(long nativePicture, boolean fromStream) {
         if (nativePicture == 0) {
             throw new RuntimeException();
         }
@@ -177,21 +177,21 @@
     }
 
     // return empty picture if src is 0, or a copy of the native src
-    private static native int nativeConstructor(int nativeSrcOr0);
-    private static native int nativeCreateFromStream(InputStream stream,
+    private static native long nativeConstructor(long nativeSrcOr0);
+    private static native long nativeCreateFromStream(InputStream stream,
                                                 byte[] storage);
-    private static native int nativeBeginRecording(int nativeCanvas,
+    private static native long nativeBeginRecording(long nativeCanvas,
                                                     int w, int h);
-    private static native void nativeEndRecording(int nativeCanvas);
-    private static native void nativeDraw(int nativeCanvas, int nativePicture);
-    private static native boolean nativeWriteToStream(int nativePicture,
+    private static native void nativeEndRecording(long nativeCanvas);
+    private static native void nativeDraw(long nativeCanvas, long nativePicture);
+    private static native boolean nativeWriteToStream(long nativePicture,
                                            OutputStream stream, byte[] storage);
-    private static native void nativeDestructor(int nativePicture);
+    private static native void nativeDestructor(long nativePicture);
     
     private static class RecordingCanvas extends Canvas {
         private final Picture mPicture;
 
-        public RecordingCanvas(Picture pict, int nativeCanvas) {
+        public RecordingCanvas(Picture pict, long nativeCanvas) {
             super(nativeCanvas);
             mPicture = pict;
         }
diff --git a/graphics/java/android/graphics/PixelXorXfermode.java b/graphics/java/android/graphics/PixelXorXfermode.java
index 6075ec3..0080e65 100644
--- a/graphics/java/android/graphics/PixelXorXfermode.java
+++ b/graphics/java/android/graphics/PixelXorXfermode.java
@@ -29,5 +29,5 @@
         native_instance = nativeCreate(opColor);
     }
 
-    private static native int nativeCreate(int opColor);
+    private static native long nativeCreate(int opColor);
 }
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index 9870ad2..93fc1c7 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -96,7 +96,7 @@
         nativeColorFilter = nCreatePorterDuffFilter(native_instance, mColor, mMode.nativeInt);
     }
 
-    private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
-    private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+    private static native long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
+    private static native long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
             int porterDuffMode);
 }
diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java
index 6ba064c..d9d7689 100644
--- a/graphics/java/android/graphics/PorterDuffXfermode.java
+++ b/graphics/java/android/graphics/PorterDuffXfermode.java
@@ -32,5 +32,5 @@
         native_instance = nativeCreateXfermode(mode.nativeInt);
     }
     
-    private static native int nativeCreateXfermode(int mode);
+    private static native long nativeCreateXfermode(int mode);
 }
diff --git a/graphics/java/android/graphics/RadialGradient.java b/graphics/java/android/graphics/RadialGradient.java
index f011e5c..f10e5d6 100644
--- a/graphics/java/android/graphics/RadialGradient.java
+++ b/graphics/java/android/graphics/RadialGradient.java
@@ -117,14 +117,14 @@
         return copy;
     }
 
-    private static native int nativeCreate1(float x, float y, float radius,
+    private static native long nativeCreate1(float x, float y, float radius,
             int colors[], float positions[], int tileMode);
-	private static native int nativeCreate2(float x, float y, float radius,
+	private static native long nativeCreate2(float x, float y, float radius,
             int color0, int color1, int tileMode);
 
-    private static native int nativePostCreate1(int native_shader, float x, float y, float radius,
+    private static native long nativePostCreate1(long native_shader, float x, float y, float radius,
             int colors[], float positions[], int tileMode);
-    private static native int nativePostCreate2(int native_shader, float x, float y, float radius,
+    private static native long nativePostCreate2(long native_shader, float x, float y, float radius,
             int color0, int color1, int tileMode);
 }
 
diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java
index feb5f0c..817814c 100644
--- a/graphics/java/android/graphics/Rasterizer.java
+++ b/graphics/java/android/graphics/Rasterizer.java
@@ -27,7 +27,7 @@
         finalizer(native_instance);
     }
 
-    private static native void finalizer(int native_instance);
+    private static native void finalizer(long native_instance);
 
-    int native_instance;
+    long native_instance;
 }
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 72d0c43..727723d 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -30,7 +30,7 @@
     /**
      * @hide
      */
-    public final int mNativeRegion;
+    public final long mNativeRegion;
 
     // the native values for these must match up with the enum in SkRegion.h
     public enum Op {
@@ -342,7 +342,7 @@
              * @return a new region created from the data in the parcel
              */
             public Region createFromParcel(Parcel p) {
-                int ni = nativeCreateFromParcel(p);
+                long ni = nativeCreateFromParcel(p);
                 if (ni == 0) {
                     throw new RuntimeException();
                 }
@@ -385,7 +385,7 @@
         }
     }
     
-    Region(int ni) {
+    Region(long ni) {
         if (ni == 0) {
             throw new RuntimeException();
         }
@@ -394,38 +394,38 @@
 
     /* add dummy parameter so constructor can be called from jni without
        triggering 'not cloneable' exception */
-    private Region(int ni, int dummy) {
+    private Region(long ni, int dummy) {
         this(ni);
     }
 
-    final int ni() {
+    final long ni() {
         return mNativeRegion;
     }
 
-    private static native boolean nativeEquals(int native_r1, int native_r2);
+    private static native boolean nativeEquals(long native_r1, long native_r2);
 
-    private static native int nativeConstructor();
-    private static native void nativeDestructor(int native_region);
+    private static native long nativeConstructor();
+    private static native void nativeDestructor(long native_region);
 
-    private static native void nativeSetRegion(int native_dst, int native_src);
-    private static native boolean nativeSetRect(int native_dst, int left,
+    private static native void nativeSetRegion(long native_dst, long native_src);
+    private static native boolean nativeSetRect(long native_dst, int left,
                                                 int top, int right, int bottom);
-    private static native boolean nativeSetPath(int native_dst, int native_path,
-                                                int native_clip);
-    private static native boolean nativeGetBounds(int native_region, Rect rect);
-    private static native boolean nativeGetBoundaryPath(int native_region,
-                                                        int native_path);
+    private static native boolean nativeSetPath(long native_dst, long native_path,
+                                                long native_clip);
+    private static native boolean nativeGetBounds(long native_region, Rect rect);
+    private static native boolean nativeGetBoundaryPath(long native_region,
+                                                        long native_path);
 
-    private static native boolean nativeOp(int native_dst, int left, int top,
+    private static native boolean nativeOp(long native_dst, int left, int top,
                                            int right, int bottom, int op);
-    private static native boolean nativeOp(int native_dst, Rect rect,
-                                           int native_region, int op);
-    private static native boolean nativeOp(int native_dst, int native_region1,
-                                           int native_region2, int op);
+    private static native boolean nativeOp(long native_dst, Rect rect,
+                                           long native_region, int op);
+    private static native boolean nativeOp(long native_dst, long native_region1,
+                                           long native_region2, int op);
 
-    private static native int nativeCreateFromParcel(Parcel p);
-    private static native boolean nativeWriteToParcel(int native_region,
+    private static native long nativeCreateFromParcel(Parcel p);
+    private static native boolean nativeWriteToParcel(long native_region,
                                                       Parcel p);
 
-    private static native String nativeToString(int native_region);
+    private static native String nativeToString(long native_region);
 }
diff --git a/graphics/java/android/graphics/RegionIterator.java b/graphics/java/android/graphics/RegionIterator.java
index 817f853..8401adb 100644
--- a/graphics/java/android/graphics/RegionIterator.java
+++ b/graphics/java/android/graphics/RegionIterator.java
@@ -45,10 +45,10 @@
         nativeDestructor(mNativeIter);
     }
     
-    private static native int nativeConstructor(int native_region);
-    private static native void nativeDestructor(int native_iter);
-    private static native boolean nativeNext(int native_iter, Rect r);
-    
-    private final int mNativeIter;
+    private static native long nativeConstructor(long native_region);
+    private static native void nativeDestructor(long native_iter);
+    private static native boolean nativeNext(long native_iter, Rect r);
+
+    private final long mNativeIter;
 }
 
diff --git a/graphics/java/android/graphics/Shader.java b/graphics/java/android/graphics/Shader.java
index afc68d8..94b4c4a 100644
--- a/graphics/java/android/graphics/Shader.java
+++ b/graphics/java/android/graphics/Shader.java
@@ -28,11 +28,11 @@
      * 
      * @hide 
      */
-    public int native_instance;
+    public long native_instance;
     /**
      * @hide
      */
-    public int native_shader;
+    public long native_shader;
 
     private Matrix mLocalMatrix;
 
@@ -112,7 +112,7 @@
         }
     }
 
-    private static native void nativeDestructor(int native_shader, int native_skiaShader);
-    private static native void nativeSetLocalMatrix(int native_shader,
-            int native_skiaShader, int matrix_instance);
+    private static native void nativeDestructor(long native_shader, long native_skiaShader);
+    private static native void nativeSetLocalMatrix(long native_shader,
+            long native_skiaShader, long matrix_instance);
 }
diff --git a/graphics/java/android/graphics/SumPathEffect.java b/graphics/java/android/graphics/SumPathEffect.java
index cc7c778..8fedc31 100644
--- a/graphics/java/android/graphics/SumPathEffect.java
+++ b/graphics/java/android/graphics/SumPathEffect.java
@@ -27,6 +27,6 @@
                                        second.native_instance);
     }
     
-    private static native int nativeCreate(int first, int second);
+    private static native long nativeCreate(long first, long second);
 }
 
diff --git a/graphics/java/android/graphics/SweepGradient.java b/graphics/java/android/graphics/SweepGradient.java
index e9cda39..21239f7 100644
--- a/graphics/java/android/graphics/SweepGradient.java
+++ b/graphics/java/android/graphics/SweepGradient.java
@@ -106,12 +106,12 @@
         return copy;
     }
 
-    private static native int nativeCreate1(float x, float y, int colors[], float positions[]);
-    private static native int nativeCreate2(float x, float y, int color0, int color1);
+    private static native long nativeCreate1(float x, float y, int colors[], float positions[]);
+    private static native long nativeCreate2(float x, float y, int color0, int color1);
 
-    private static native int nativePostCreate1(int native_shader, float cx, float cy,
+    private static native long nativePostCreate1(long native_shader, float cx, float cy,
             int[] colors, float[] positions);    
-    private static native int nativePostCreate2(int native_shader, float cx, float cy,
+    private static native long nativePostCreate2(long native_shader, float cx, float cy,
             int color0, int color1);
 }
 
diff --git a/graphics/java/android/graphics/TableMaskFilter.java b/graphics/java/android/graphics/TableMaskFilter.java
index a8a7ff0..d0c1438 100644
--- a/graphics/java/android/graphics/TableMaskFilter.java
+++ b/graphics/java/android/graphics/TableMaskFilter.java
@@ -28,7 +28,7 @@
         native_instance = nativeNewTable(table);
     }
     
-    private TableMaskFilter(int ni) {
+    private TableMaskFilter(long ni) {
         native_instance = ni;
     }
     
@@ -40,7 +40,7 @@
         return new TableMaskFilter(nativeNewGamma(gamma));
     }
 
-    private static native int nativeNewTable(byte[] table);
-    private static native int nativeNewClip(int min, int max);
-    private static native int nativeNewGamma(float gamma);
+    private static native long nativeNewTable(byte[] table);
+    private static native long nativeNewClip(int min, int max);
+    private static native long nativeNewGamma(float gamma);
 }
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index aea3ee5..73e0e8d 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -18,6 +18,7 @@
 
 import android.content.res.AssetManager;
 import android.util.SparseArray;
+import android.util.LongSparseArray;
 
 import java.io.File;
 
@@ -45,13 +46,13 @@
     public static final Typeface MONOSPACE;
 
     static Typeface[] sDefaults;
-    private static final SparseArray<SparseArray<Typeface>> sTypefaceCache =
-            new SparseArray<SparseArray<Typeface>>(3);
+    private static final LongSparseArray<SparseArray<Typeface>> sTypefaceCache =
+            new LongSparseArray<SparseArray<Typeface>>(3);
 
     /**
      * @hide
      */
-    public int native_instance;
+    public long native_instance;
 
     // Style
     public static final int NORMAL = 0;
@@ -103,7 +104,7 @@
      * @return The best matching typeface.
      */
     public static Typeface create(Typeface family, int style) {
-        int ni = 0;        
+        long ni = 0;
         if (family != null) {
             // Return early if we're asked for the same face/style
             if (family.mStyle == style) {
@@ -173,7 +174,7 @@
     }
 
     // don't allow clients to call this directly
-    private Typeface(int ni) {
+    private Typeface(long ni) {
         if (ni == 0) {
             throw new RuntimeException("native typeface cannot be made");
         }
@@ -217,15 +218,20 @@
 
     @Override
     public int hashCode() {
-        int result = native_instance;
+        /*
+         * Modified method for hashCode with long native_instance derived from
+         * http://developer.android.com/reference/java/lang/Object.html
+         */
+        int result = 17;
+        result = 31 * result + (int) (native_instance ^ (native_instance >>> 32));
         result = 31 * result + mStyle;
         return result;
     }
 
-    private static native int  nativeCreate(String familyName, int style);
-    private static native int  nativeCreateFromTypeface(int native_instance, int style); 
-    private static native void nativeUnref(int native_instance);
-    private static native int  nativeGetStyle(int native_instance);
-    private static native int  nativeCreateFromAsset(AssetManager mgr, String path);
-    private static native int nativeCreateFromFile(String path);
+    private static native long nativeCreate(String familyName, int style);
+    private static native long nativeCreateFromTypeface(long native_instance, int style);
+    private static native void nativeUnref(long native_instance);
+    private static native int  nativeGetStyle(long native_instance);
+    private static native long nativeCreateFromAsset(AssetManager mgr, String path);
+    private static native long nativeCreateFromFile(String path);
 }
diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java
index 2467bdc..883350d 100644
--- a/graphics/java/android/graphics/Xfermode.java
+++ b/graphics/java/android/graphics/Xfermode.java
@@ -38,7 +38,7 @@
         }
     }
 
-    private static native void finalizer(int native_instance);
+    private static native void finalizer(long native_instance);
 
-    int native_instance;
+    long native_instance;
 }
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index cfb1983..2ec4284 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -156,7 +156,7 @@
      * @param canvas The canvas to draw into
      */
     public void draw(Canvas canvas) {
-        if (canvas != null && canvas.isHardwareAccelerated()) {
+        if (canvas != null && canvas.isHardwareAccelerated() && false) { // temporarily disabled
             final HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas;
             final DisplayList displayList = getDisplayList(hardwareCanvas);
             if (displayList != null) {
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 88f11db..e4648f6 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -52,6 +52,7 @@
 	# RenderThread stuff
 	LOCAL_SRC_FILES += \
 		renderthread/CanvasContext.cpp \
+		renderthread/RenderProxy.cpp \
 		renderthread/RenderTask.cpp \
 		renderthread/RenderThread.cpp
 
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index e3d4e2d..5024880 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1589,7 +1589,9 @@
             mWidth(width), mHeight(height) {}
 
     virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
-        return renderer.drawShadow(mCasterTransform, mCasterAlpha, mWidth, mHeight);
+        SkPath casterOutline; // TODO: drive with path from view
+        casterOutline.addRect(0, 0, mWidth, mHeight);
+        return renderer.drawShadow(mCasterTransform, mCasterAlpha, &casterOutline);
     }
 
     virtual void output(int level, uint32_t logFlags) const {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 7ee803f..7a11948 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -3183,28 +3183,43 @@
 }
 
 status_t OpenGLRenderer::drawShadow(const mat4& casterTransform, float casterAlpha,
-        float width, float height) {
+        const SkPath* casterOutline) {
     if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;
 
-    // For now, always and scissor
-    // TODO: use quickReject
+    // TODO: use quickRejectWithScissor. For now, always force enable scissor.
     mCaches.enableScissor();
 
     SkPaint paint;
-    paint.setColor(mCaches.propertyShadowStrength << 24);
+    paint.setARGB(mCaches.propertyShadowStrength, 0, 0, 0);
     paint.setAntiAlias(true); // want to use AlphaVertex
 
+    // tessellate caster outline into a 2d polygon
+    Vector<Vertex> casterVertices2d;
+    const float casterRefinementThresholdSquared = 20.0f; // TODO: experiment with this value
+    PathTessellator::approximatePathOutlineVertices(*casterOutline,
+            casterRefinementThresholdSquared, casterVertices2d);
+
+    // map 2d caster poly into 3d
+    const int casterVertexCount = casterVertices2d.size();
+    Vector3 casterPolygon[casterVertexCount];
+    for (int i = 0; i < casterVertexCount; i++) {
+        const Vertex& point2d = casterVertices2d[i];
+        casterPolygon[i] = Vector3(point2d.x, point2d.y, 0);
+        casterTransform.mapPoint3d(casterPolygon[i]);
+    }
+
+    // draw caster's shadows
     VertexBuffer ambientShadowVertexBuffer;
-    ShadowTessellator::tessellateAmbientShadow(width, height, casterTransform,
+    ShadowTessellator::tessellateAmbientShadow(casterPolygon, casterVertexCount,
             ambientShadowVertexBuffer);
     drawVertexBuffer(ambientShadowVertexBuffer, &paint);
 
     VertexBuffer spotShadowVertexBuffer;
     Vector3 lightPosScale(mCaches.propertyLightPosXScale,
             mCaches.propertyLightPosYScale, mCaches.propertyLightPosZScale);
-    ShadowTessellator::tessellateSpotShadow(width, height, lightPosScale,
-            *currentTransform(), getWidth(), getHeight(),
-            casterTransform, spotShadowVertexBuffer);
+    ShadowTessellator::tessellateSpotShadow(casterPolygon, casterVertexCount,
+            lightPosScale, *currentTransform(), getWidth(), getHeight(),
+            spotShadowVertexBuffer);
 
     drawVertexBuffer(spotShadowVertexBuffer, &paint);
 
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index fb780ce..c8ecdda 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -170,7 +170,7 @@
     int saveLayerDeferred(float left, float top, float right, float bottom,
             int alpha, SkXfermode::Mode mode, int flags);
 
-    virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t replayFlags);
+    virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t replayFlags = 1);
     virtual status_t drawLayer(Layer* layer, float x, float y);
     virtual status_t drawBitmap(const SkBitmap* bitmap, float left, float top,
             const SkPaint* paint);
@@ -214,7 +214,7 @@
     virtual status_t drawRects(const float* rects, int count, const SkPaint* paint);
 
     status_t drawShadow(const mat4& casterTransform, float casterAlpha,
-            float width, float height);
+            const SkPath* casterOutline);
 
     virtual void resetShader();
     virtual void setupShader(SkiaShader* shader);
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index c6ce67c..cc56333 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -53,7 +53,7 @@
 namespace android {
 namespace uirenderer {
 
-#define THRESHOLD 0.5f
+#define OUTLINE_REFINE_THRESHOLD_SQUARED (0.5f * 0.5f)
 #define ROUND_CAP_THRESH 0.25f
 #define PI 3.1415926535897932f
 
@@ -739,7 +739,8 @@
     // force close if we're filling the path, since fill path expects closed perimeter.
     bool forceClose = paintInfo.style != SkPaint::kStroke_Style;
     bool wasClosed = approximatePathOutlineVertices(path, forceClose,
-            threshInvScaleX * threshInvScaleX, threshInvScaleY * threshInvScaleY, tempVertices);
+            threshInvScaleX * threshInvScaleX, threshInvScaleY * threshInvScaleY,
+            OUTLINE_REFINE_THRESHOLD_SQUARED, tempVertices);
 
     if (!tempVertices.size()) {
         // path was empty, return without allocating vertex buffer
@@ -824,7 +825,8 @@
     Vector<Vertex> outlineVertices;
     approximatePathOutlineVertices(path, true,
             paintInfo.inverseScaleX * paintInfo.inverseScaleX,
-            paintInfo.inverseScaleY * paintInfo.inverseScaleY, outlineVertices);
+            paintInfo.inverseScaleY * paintInfo.inverseScaleY,
+            OUTLINE_REFINE_THRESHOLD_SQUARED, outlineVertices);
 
     if (!outlineVertices.size()) return;
 
@@ -897,6 +899,11 @@
 // Simple path line approximation
 ///////////////////////////////////////////////////////////////////////////////
 
+bool PathTessellator::approximatePathOutlineVertices(const SkPath& path, float thresholdSquared,
+        Vector<Vertex>& outputVertices) {
+    return approximatePathOutlineVertices(path, true, 1.0f, 1.0f, thresholdSquared, outputVertices);
+}
+
 void pushToVector(Vector<Vertex>& vertices, float x, float y) {
     // TODO: make this not yuck
     vertices.push();
@@ -905,7 +912,8 @@
 }
 
 bool PathTessellator::approximatePathOutlineVertices(const SkPath& path, bool forceClose,
-        float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+        float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+        Vector<Vertex>& outputVertices) {
     ATRACE_CALL();
 
     // TODO: to support joins other than sharp miter, join vertices should be labelled in the
@@ -932,7 +940,7 @@
                         pts[0].x(), pts[0].y(),
                         pts[2].x(), pts[2].y(),
                         pts[1].x(), pts[1].y(),
-                        sqrInvScaleX, sqrInvScaleY, outputVertices);
+                        sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
                 break;
             case SkPath::kCubic_Verb:
                 ALOGV("kCubic_Verb");
@@ -941,7 +949,7 @@
                         pts[1].x(), pts[1].y(),
                         pts[3].x(), pts[3].y(),
                         pts[2].x(), pts[2].y(),
-                        sqrInvScaleX, sqrInvScaleY, outputVertices);
+                        sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
                 break;
             default:
                 break;
@@ -964,7 +972,8 @@
 void PathTessellator::recursiveCubicBezierVertices(
         float p1x, float p1y, float c1x, float c1y,
         float p2x, float p2y, float c2x, float c2y,
-        float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+        float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+        Vector<Vertex>& outputVertices) {
     float dx = p2x - p1x;
     float dy = p2y - p1y;
     float d1 = fabs((c1x - p2x) * dy - (c1y - p2y) * dx);
@@ -973,7 +982,7 @@
 
     // multiplying by sqrInvScaleY/X equivalent to multiplying in dimensional scale factors
 
-    if (d * d < THRESHOLD * THRESHOLD * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
+    if (d * d < thresholdSquared * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
         // below thresh, draw line by adding endpoint
         pushToVector(outputVertices, p2x, p2y);
     } else {
@@ -997,11 +1006,11 @@
         recursiveCubicBezierVertices(
                 p1x, p1y, p1c1x, p1c1y,
                 mx, my, p1c1c2x, p1c1c2y,
-                sqrInvScaleX, sqrInvScaleY, outputVertices);
+                sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
         recursiveCubicBezierVertices(
                 mx, my, p2c1c2x, p2c1c2y,
                 p2x, p2y, p2c2x, p2c2y,
-                sqrInvScaleX, sqrInvScaleY, outputVertices);
+                sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
     }
 }
 
@@ -1009,12 +1018,13 @@
         float ax, float ay,
         float bx, float by,
         float cx, float cy,
-        float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+        float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+        Vector<Vertex>& outputVertices) {
     float dx = bx - ax;
     float dy = by - ay;
     float d = (cx - bx) * dy - (cy - by) * dx;
 
-    if (d * d < THRESHOLD * THRESHOLD * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
+    if (d * d < thresholdSquared * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
         // below thresh, draw line by adding endpoint
         pushToVector(outputVertices, bx, by);
     } else {
@@ -1028,9 +1038,9 @@
         float my = (acy + bcy) * 0.5f;
 
         recursiveQuadraticBezierVertices(ax, ay, mx, my, acx, acy,
-                sqrInvScaleX, sqrInvScaleY, outputVertices);
+                sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
         recursiveQuadraticBezierVertices(mx, my, bx, by, bcx, bcy,
-                sqrInvScaleX, sqrInvScaleY, outputVertices);
+                sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
     }
 }
 
diff --git a/libs/hwui/PathTessellator.h b/libs/hwui/PathTessellator.h
index e43b101..a215b7a 100644
--- a/libs/hwui/PathTessellator.h
+++ b/libs/hwui/PathTessellator.h
@@ -31,18 +31,64 @@
 public:
     static void expandBoundsForStroke(SkRect& bounds, const SkPaint* paint);
 
+    /**
+     * Populates a VertexBuffer with a tessellated approximation of the input convex path, as a single
+     * triangle strip. Note: joins are not currently supported.
+     *
+     * @param path The path to be approximated
+     * @param paint The paint the path will be drawn with, indicating AA, painting style
+     *        (stroke vs fill), stroke width, stroke cap & join style, etc.
+     * @param transform The transform the path is to be drawn with, used to drive stretch-aware path
+     *        vertex approximation, and correct AA ramp offsetting.
+     * @param vertexBuffer The output buffer
+     */
     static void tessellatePath(const SkPath& path, const SkPaint* paint,
             const mat4& transform, VertexBuffer& vertexBuffer);
 
+    /**
+     * Populates a VertexBuffer with a tessellated approximation of points as a single triangle
+     * strip (with degenerate tris separating), respecting the shape defined by the paint cap.
+     *
+     * @param points The center vertices of the points to be drawn
+     * @param count The number of floats making up the point vertices
+     * @param paint The paint the points will be drawn with indicating AA, stroke width & cap
+     * @param transform The transform the points will be drawn with, used to drive stretch-aware path
+     *        vertex approximation, and correct AA ramp offsetting
+     * @param bounds An output rectangle, which returns the total area covered by the output buffer
+     * @param vertexBuffer The output buffer
+     */
     static void tessellatePoints(const float* points, int count, const SkPaint* paint,
             const mat4& transform, SkRect& bounds, VertexBuffer& vertexBuffer);
 
+    /**
+     * Populates a VertexBuffer with a tessellated approximation of lines as a single triangle
+     * strip (with degenerate tris separating).
+     *
+     * @param points Pairs of endpoints defining the lines to be drawn
+     * @param count The number of floats making up the line vertices
+     * @param paint The paint the lines will be drawn with indicating AA, stroke width & cap
+     * @param transform The transform the points will be drawn with, used to drive stretch-aware path
+     *        vertex approximation, and correct AA ramp offsetting
+     * @param bounds An output rectangle, which returns the total area covered by the output buffer
+     * @param vertexBuffer The output buffer
+     */
     static void tessellateLines(const float* points, int count, const SkPaint* paint,
             const mat4& transform, SkRect& bounds, VertexBuffer& vertexBuffer);
 
+    /**
+     * Approximates a convex, CW outline into a Vector of 2d vertices.
+     *
+     * @param path The outline to be approximated
+     * @param thresholdSquared The threshold of acceptable error (in pixels) when approximating
+     * @param outputVertices An empty Vector which will be populated with the output
+     */
+    static bool approximatePathOutlineVertices(const SkPath &path, float thresholdSquared,
+            Vector<Vertex> &outputVertices);
+
 private:
     static bool approximatePathOutlineVertices(const SkPath &path, bool forceClose,
-        float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex> &outputVertices);
+            float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+            Vector<Vertex> &outputVertices);
 
 /*
   endpoints a & b,
@@ -52,7 +98,7 @@
             float ax, float ay,
             float bx, float by,
             float cx, float cy,
-            float sqrInvScaleX, float sqrInvScaleY,
+            float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
             Vector<Vertex> &outputVertices);
 
 /*
@@ -64,7 +110,7 @@
             float c1x, float c1y,
             float p2x, float p2y,
             float c2x, float c2y,
-            float sqrInvScaleX, float sqrInvScaleY,
+            float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
             Vector<Vertex> &outputVertices);
 };
 
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index 9d4e83e..4799b32 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -247,8 +247,6 @@
 
     // TODO: rename for consistency
     virtual status_t callDrawGLFunction(Functor* functor, Rect& dirty) = 0;
-
-private:
 }; // class Renderer
 
 }; // namespace uirenderer
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index 6dfd925..7700ea0 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -31,46 +31,8 @@
     return a > b ? a : b;
 }
 
-// TODO: Support path as the input of the polygon instead of the rect's width
-// and height. And the z values need to be computed according to the
-// transformation for each vertex.
-/**
- * Generate the polygon for the caster.
- *
- * @param width the width of the caster
- * @param height the height of the caster
- * @param casterTransform transformation info of the caster
- * @param polygon return the caster's polygon
- *
- */
-void ShadowTessellator::generateCasterPolygon(float width, float height,
-        const mat4& casterTransform, int vertexCount, Vector3* polygon) {
-    Rect blockRect(0, 0, width, height);
-    polygon[0].x = blockRect.left;
-    polygon[0].y = blockRect.top;
-    polygon[0].z = 0;
-    polygon[1].x = blockRect.right;
-    polygon[1].y = blockRect.top;
-    polygon[1].z = 0;
-    polygon[2].x = blockRect.right;
-    polygon[2].y = blockRect.bottom;
-    polygon[2].z = 0;
-    polygon[3].x = blockRect.left;
-    polygon[3].y = blockRect.bottom;
-    polygon[3].z = 0;
-    casterTransform.mapPoint3d(polygon[0]);
-    casterTransform.mapPoint3d(polygon[1]);
-    casterTransform.mapPoint3d(polygon[2]);
-    casterTransform.mapPoint3d(polygon[3]);
-}
-
-void ShadowTessellator::tessellateAmbientShadow(float width, float height,
-        const mat4& casterTransform, VertexBuffer& shadowVertexBuffer) {
-
-    const int vertexCount = 4;
-    Vector3 polygon[vertexCount];
-    generateCasterPolygon(width, height, casterTransform, vertexCount, polygon);
-
+void ShadowTessellator::tessellateAmbientShadow(const Vector3* casterPolygon, int casterVertexCount,
+        VertexBuffer& shadowVertexBuffer) {
     // A bunch of parameters to tweak the shadow.
     // TODO: Allow some of these changable by debug settings or APIs.
     const int rays = 128;
@@ -79,19 +41,14 @@
     const float heightFactor = 128;
     const float geomFactor = 64;
 
-    AmbientShadow::createAmbientShadow(polygon, vertexCount, rays, layers, strength,
+    AmbientShadow::createAmbientShadow(casterPolygon, casterVertexCount, rays, layers, strength,
             heightFactor, geomFactor, shadowVertexBuffer);
 
 }
 
-void ShadowTessellator::tessellateSpotShadow(float width, float height,
+void ShadowTessellator::tessellateSpotShadow(const Vector3* casterPolygon, int casterVertexCount,
         const Vector3& lightPosScale, const mat4& receiverTransform,
-        int screenWidth, int screenHeight, const mat4& casterTransform,
-        VertexBuffer& shadowVertexBuffer) {
-    const int vertexCount = 4;
-    Vector3 polygon[vertexCount];
-    generateCasterPolygon(width, height, casterTransform, vertexCount, polygon);
-
+        int screenWidth, int screenHeight, VertexBuffer& shadowVertexBuffer) {
     // A bunch of parameters to tweak the shadow.
     // TODO: Allow some of these changable by debug settings or APIs.
     const int rays = 256;
@@ -113,7 +70,7 @@
     const float lightSize = maximal / 4;
     const int lightVertexCount = 16;
 
-    SpotShadow::createSpotShadow(polygon, vertexCount, lightCenter, lightSize,
+    SpotShadow::createSpotShadow(casterPolygon, casterVertexCount, lightCenter, lightSize,
             lightVertexCount, rays, layers, strength, shadowVertexBuffer);
 
 }
diff --git a/libs/hwui/ShadowTessellator.h b/libs/hwui/ShadowTessellator.h
index 2399f8f..ef95609 100644
--- a/libs/hwui/ShadowTessellator.h
+++ b/libs/hwui/ShadowTessellator.h
@@ -26,18 +26,12 @@
 
 class ShadowTessellator {
 public:
-    static void tessellateAmbientShadow(float width, float height,
-            const mat4& casterTransform, VertexBuffer& shadowVertexBuffer);
-
-    static void tessellateSpotShadow(float width, float height,
-            const Vector3& lightPosScale, const mat4& receiverTransform,
-            int screenWidth, int screenHeight, const mat4& casterTransform,
+    static void tessellateAmbientShadow(const Vector3* casterPolygon, int casterVertexCount,
             VertexBuffer& shadowVertexBuffer);
 
-private:
-    static void generateCasterPolygon(float width, float height,
-            const mat4& casterTransform, int vertexCount, Vector3* polygon);
-
+    static void tessellateSpotShadow(const Vector3* casterPolygon, int casterVertexCount,
+            const Vector3& lightPosScale, const mat4& receiverTransform,
+            int screenWidth, int screenHeight, VertexBuffer& shadowVertexBuffer);
 }; // ShadowTessellator
 
 }; // namespace uirenderer
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index ffb8a32..a848c8f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -19,14 +19,22 @@
 #include "CanvasContext.h"
 
 #include <cutils/properties.h>
+#include <private/hwui/DrawGlInfo.h>
 #include <strings.h>
 
+#include "RenderThread.h"
 #include "../Caches.h"
+#include "../OpenGLRenderer.h"
 #include "../Stencil.h"
 
 #define PROPERTY_RENDER_DIRTY_REGIONS "debug.hwui.render_dirty_regions"
 #define GLES_VERSION 2
 
+#ifdef USE_OPENGL_RENDERER
+// Android-specific addition that is used to show when frames began in systrace
+EGLAPI void EGLAPIENTRY eglBeginFrame(EGLDisplay dpy, EGLSurface surface);
+#endif
+
 namespace android {
 namespace uirenderer {
 namespace renderthread {
@@ -69,19 +77,19 @@
 public:
     static GlobalContext* get();
 
-    // Returns true if EGL was initialized,
-    // false if it was already initialized
-    bool initialize();
+    // Returns true on success, false on failure
+    void initialize();
 
-    bool usePBufferSurface();
+    void usePBufferSurface();
     EGLSurface createSurface(EGLNativeWindowType window);
     void destroySurface(EGLSurface surface);
 
     void destroy();
 
     bool isCurrent(EGLSurface surface) { return mCurrentSurface == surface; }
-    bool makeCurrent(EGLSurface surface);
-    bool swapBuffers(EGLSurface surface);
+    void makeCurrent(EGLSurface surface);
+    void beginFrame(EGLSurface surface, EGLint* width, EGLint* height);
+    void swapBuffers(EGLSurface surface);
 
     bool enableDirtyRegions(EGLSurface surface);
 
@@ -90,8 +98,9 @@
     // GlobalContext is never destroyed, method is purposely not implemented
     ~GlobalContext();
 
-    bool loadConfig();
-    bool createContext();
+    void loadConfig();
+    void createContext();
+    void initAtlas();
 
     static GlobalContext* sContext;
 
@@ -126,33 +135,27 @@
     ALOGD("Render dirty regions requested: %s", mRequestDirtyRegions ? "true" : "false");
 }
 
-bool GlobalContext::initialize() {
-    if (mEglDisplay != EGL_NO_DISPLAY) return false;
+void GlobalContext::initialize() {
+    if (mEglDisplay != EGL_NO_DISPLAY) return;
 
     mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-    if (mEglDisplay == EGL_NO_DISPLAY) {
-        ALOGE("Failed to get EGL_DEFAULT_DISPLAY! err=%s", egl_error_str());
-        return false;
-    }
+    LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY,
+            "Failed to get EGL_DEFAULT_DISPLAY! err=%s", egl_error_str());
 
     EGLint major, minor;
-    if (eglInitialize(mEglDisplay, &major, &minor) == EGL_FALSE) {
-        ALOGE("Failed to initialize display %p! err=%s", mEglDisplay, egl_error_str());
-        return false;
-    }
+    LOG_ALWAYS_FATAL_IF(eglInitialize(mEglDisplay, &major, &minor) == EGL_FALSE,
+            "Failed to initialize display %p! err=%s", mEglDisplay, egl_error_str());
+
     ALOGI("Initialized EGL, version %d.%d", (int)major, (int)minor);
 
-    if (!loadConfig()) {
-        return false;
-    }
-    if (!createContext()) {
-        return false;
-    }
-
-    return true;
+    loadConfig();
+    createContext();
+    usePBufferSurface();
+    Caches::getInstance().init();
+    initAtlas();
 }
 
-bool GlobalContext::loadConfig() {
+void GlobalContext::loadConfig() {
     EGLint swapBehavior = mCanSetDirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0;
     EGLint attribs[] = {
             EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -177,31 +180,32 @@
             mCanSetDirtyRegions = false;
             loadConfig();
         } else {
-            ALOGE("Failed to choose config, error = %s", egl_error_str());
-            return false;
+            LOG_ALWAYS_FATAL("Failed to choose config, error = %s", egl_error_str());
         }
     }
-    return true;
 }
 
-bool GlobalContext::createContext() {
+void GlobalContext::createContext() {
     EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, EGL_NONE };
     mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, attribs);
-    if (mEglContext == EGL_NO_CONTEXT) {
-        ALOGE("Failed to create context, error = %s", egl_error_str());
-        return false;
-    }
-    return true;
+    LOG_ALWAYS_FATAL_IF(mEglContext == EGL_NO_CONTEXT,
+        "Failed to create context, error = %s", egl_error_str());
 }
 
-bool GlobalContext::usePBufferSurface() {
-    if (mEglDisplay == EGL_NO_DISPLAY) return false;
+void GlobalContext::initAtlas() {
+    // TODO implement
+    // For now just run without an atlas
+}
+
+void GlobalContext::usePBufferSurface() {
+    LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY,
+            "usePBufferSurface() called on uninitialized GlobalContext!");
 
     if (mPBufferSurface == EGL_NO_SURFACE) {
         EGLint attribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE };
         mPBufferSurface = eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs);
     }
-    return makeCurrent(mPBufferSurface);
+    makeCurrent(mPBufferSurface);
 }
 
 EGLSurface GlobalContext::createSurface(EGLNativeWindowType window) {
@@ -238,8 +242,8 @@
     mCurrentSurface = EGL_NO_SURFACE;
 }
 
-bool GlobalContext::makeCurrent(EGLSurface surface) {
-    if (isCurrent(surface)) return true;
+void GlobalContext::makeCurrent(EGLSurface surface) {
+    if (isCurrent(surface)) return;
 
     if (surface == EGL_NO_SURFACE) {
         // If we are setting EGL_NO_SURFACE we don't care about any of the potential
@@ -247,19 +251,31 @@
         // destroyed in which case the current context is already NO_CONTEXT
         eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     } else if (!eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) {
-        ALOGE("Failed to make current on surface %p, error=%s", (void*)surface, egl_error_str());
-        return false;
+        LOG_ALWAYS_FATAL("Failed to make current on surface %p, error=%s",
+                (void*)surface, egl_error_str());
     }
     mCurrentSurface = surface;
-    return true;
 }
 
-bool GlobalContext::swapBuffers(EGLSurface surface) {
-    if (!eglSwapBuffers(mEglDisplay, surface)) {
-        ALOGW("eglSwapBuffers failed on surface %p, error=%s", (void*)surface, egl_error_str());
-        return false;
+void GlobalContext::beginFrame(EGLSurface surface, EGLint* width, EGLint* height) {
+    LOG_ALWAYS_FATAL_IF(surface == EGL_NO_SURFACE,
+            "Tried to beginFrame on EGL_NO_SURFACE!");
+    makeCurrent(surface);
+    if (width) {
+        eglQuerySurface(mEglDisplay, surface, EGL_WIDTH, width);
     }
-    return true;
+    if (height) {
+        eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height);
+    }
+    eglBeginFrame(mEglDisplay, surface);
+}
+
+void GlobalContext::swapBuffers(EGLSurface surface) {
+    eglSwapBuffers(mEglDisplay, surface);
+    EGLint err = eglGetError();
+    // TODO: Check whether we need to special case EGL_CONTEXT_LOST
+    LOG_ALWAYS_FATAL_IF(err != EGL_SUCCESS,
+            "Encountered EGL error %d %s during rendering", err, egl_error_str(err));
 }
 
 bool GlobalContext::enableDirtyRegions(EGLSurface surface) {
@@ -283,17 +299,32 @@
     return value == EGL_BUFFER_PRESERVED;
 }
 
-CanvasContext::CanvasContext()
-        : mEglSurface(EGL_NO_SURFACE)
-        , mDirtyRegionsEnabled(false) {
+CanvasContext::CanvasContext(bool translucent)
+        : mRenderThread(RenderThread::getInstance())
+        , mEglSurface(EGL_NO_SURFACE)
+        , mDirtyRegionsEnabled(false)
+        , mOpaque(!translucent)
+        , mCanvas(0)
+        , mHaveNewSurface(false)
+        , mInvokeFunctorsPending(false)
+        , mInvokeFunctorsTask(this) {
     mGlobalContext = GlobalContext::get();
 }
 
 CanvasContext::~CanvasContext() {
+    removeFunctorsTask();
+    destroyCanvas();
+}
+
+void CanvasContext::destroyCanvas() {
+    if (mCanvas) {
+        delete mCanvas;
+        mCanvas = 0;
+    }
     setSurface(NULL);
 }
 
-bool CanvasContext::setSurface(EGLNativeWindowType window) {
+void CanvasContext::setSurface(EGLNativeWindowType window) {
     if (mEglSurface != EGL_NO_SURFACE) {
         mGlobalContext->destroySurface(mEglSurface);
         mEglSurface = EGL_NO_SURFACE;
@@ -301,24 +332,134 @@
 
     if (window) {
         mEglSurface = mGlobalContext->createSurface(window);
+        LOG_ALWAYS_FATAL_IF(mEglSurface == EGL_NO_SURFACE,
+                "Failed to create EGLSurface for window %p, eglErr = %s",
+                (void*) window, egl_error_str());
     }
 
     if (mEglSurface != EGL_NO_SURFACE) {
         mDirtyRegionsEnabled = mGlobalContext->enableDirtyRegions(mEglSurface);
+        mHaveNewSurface = true;
     }
-    return !window || mEglSurface != EGL_NO_SURFACE;
 }
 
-bool CanvasContext::swapBuffers() {
-    return mGlobalContext->swapBuffers(mEglSurface);
+void CanvasContext::swapBuffers() {
+    mGlobalContext->swapBuffers(mEglSurface);
+    mHaveNewSurface = false;
 }
 
-bool CanvasContext::makeCurrent() {
-    return mGlobalContext->makeCurrent(mEglSurface);
+void CanvasContext::makeCurrent() {
+    mGlobalContext->makeCurrent(mEglSurface);
 }
 
-bool CanvasContext::useGlobalPBufferSurface() {
-    return GlobalContext::get()->usePBufferSurface();
+bool CanvasContext::initialize(EGLNativeWindowType window) {
+    if (mCanvas) return false;
+    setSurface(window);
+    makeCurrent();
+    mCanvas = new OpenGLRenderer();
+    mCanvas->initProperties();
+    return true;
+}
+
+void CanvasContext::updateSurface(EGLNativeWindowType window) {
+    setSurface(window);
+    makeCurrent();
+}
+
+void CanvasContext::setup(int width, int height) {
+    if (!mCanvas) return;
+    mCanvas->setViewport(width, height);
+}
+
+void CanvasContext::drawDisplayList(DisplayList* displayList, Rect* dirty) {
+    LOG_ALWAYS_FATAL_IF(!mCanvas || mEglSurface == EGL_NO_SURFACE,
+            "drawDisplayList called on a context with no canvas or surface!");
+
+    EGLint width, height;
+    mGlobalContext->beginFrame(mEglSurface, &width, &height);
+    if (width != mCanvas->getViewportWidth() || height != mCanvas->getViewportHeight()) {
+        mCanvas->setViewport(width, height);
+        dirty = NULL;
+    } else if (!mDirtyRegionsEnabled || mHaveNewSurface) {
+        dirty = NULL;
+    }
+
+    status_t status;
+    if (dirty) {
+        status = mCanvas->prepareDirty(dirty->left, dirty->top,
+                dirty->right, dirty->bottom, mOpaque);
+    } else {
+        status = mCanvas->prepare(mOpaque);
+    }
+
+    Rect outBounds;
+    status |= mCanvas->drawDisplayList(displayList, outBounds);
+    handleFunctorStatus(status, outBounds);
+
+    // TODO: Draw debug info
+    // TODO: Performance tracking
+
+    mCanvas->finish();
+
+    if (status & DrawGlInfo::kStatusDrew) {
+        swapBuffers();
+    }
+}
+
+void InvokeFunctorsTask::run() {
+    mContext->invokeFunctors();
+}
+
+void CanvasContext::attachFunctor(Functor* functor) {
+    if (!mCanvas) return;
+
+    mCanvas->attachFunctor(functor);
+    removeFunctorsTask();
+    queueFunctorsTask(0);
+}
+
+void CanvasContext::detachFunctor(Functor* functor) {
+    if (!mCanvas) return;
+
+    mCanvas->detachFunctor(functor);
+}
+
+void CanvasContext::invokeFunctors() {
+    mInvokeFunctorsPending = false;
+
+    if (!mCanvas) return;
+
+    makeCurrent();
+    Rect dirty;
+    int status = mCanvas->invokeFunctors(dirty);
+    handleFunctorStatus(status, dirty);
+}
+
+void CanvasContext::handleFunctorStatus(int status, const Rect& redrawClip) {
+    if (status & DrawGlInfo::kStatusDraw) {
+        // TODO: Invalidate the redrawClip
+        // Do we need to post to ViewRootImpl like the current renderer?
+        // Can we just enqueue ourselves to re-invoke the same display list?
+        // Something else entirely? Does ChromiumView still want this in a
+        // RenderThread world?
+    }
+
+    if (status & DrawGlInfo::kStatusInvoke) {
+        queueFunctorsTask();
+    }
+}
+
+void CanvasContext::removeFunctorsTask() {
+    if (!mInvokeFunctorsPending) return;
+
+    mRenderThread.remove(&mInvokeFunctorsTask);
+}
+
+void CanvasContext::queueFunctorsTask(int delayMs) {
+    if (mInvokeFunctorsPending) return;
+
+    mInvokeFunctorsPending = true;
+    mRenderThread.queueDelayed(&mInvokeFunctorsTask, delayMs);
 }
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 77ae737..2daa905 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -19,31 +19,75 @@
 
 #include <cutils/compiler.h>
 #include <EGL/egl.h>
+#include <utils/Functor.h>
+
+#include "RenderTask.h"
+
+#define FUNCTOR_PROCESS_DELAY 4
 
 namespace android {
 namespace uirenderer {
+
+class DisplayList;
+class OpenGLRenderer;
+class Rect;
+
 namespace renderthread {
 
 class GlobalContext;
+class CanvasContext;
+class RenderThread;
+
+class InvokeFunctorsTask : public RenderTask {
+public:
+    InvokeFunctorsTask(CanvasContext* context)
+        : mContext(context) {}
+
+    virtual void run();
+
+private:
+    CanvasContext* mContext;
+};
 
 // This per-renderer class manages the bridge between the global EGL context
 // and the render surface.
 class CanvasContext {
 public:
-    ANDROID_API CanvasContext();
-    ANDROID_API ~CanvasContext();
+    CanvasContext(bool translucent);
+    ~CanvasContext();
 
-    ANDROID_API bool setSurface(EGLNativeWindowType window);
-    ANDROID_API bool swapBuffers();
-    ANDROID_API bool makeCurrent();
+    bool initialize(EGLNativeWindowType window);
+    void updateSurface(EGLNativeWindowType window);
+    void setup(int width, int height);
+    void drawDisplayList(DisplayList* displayList, Rect* dirty);
+    void destroyCanvas();
 
-    ANDROID_API static bool useGlobalPBufferSurface();
+    void attachFunctor(Functor* functor);
+    void detachFunctor(Functor* functor);
 
 private:
+    void setSurface(EGLNativeWindowType window);
+    void swapBuffers();
+    void makeCurrent();
+
+    friend class InvokeFunctorsTask;
+    void invokeFunctors();
+    void handleFunctorStatus(int status, const Rect& redrawClip);
+    void removeFunctorsTask();
+    void queueFunctorsTask(int delayMs = FUNCTOR_PROCESS_DELAY);
 
     GlobalContext* mGlobalContext;
+    RenderThread& mRenderThread;
     EGLSurface mEglSurface;
     bool mDirtyRegionsEnabled;
+
+    bool mOpaque;
+    OpenGLRenderer* mCanvas;
+    bool mHaveNewSurface;
+
+    bool mInvokeFunctorsPending;
+    InvokeFunctorsTask mInvokeFunctorsTask;
+
 };
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
new file mode 100644
index 0000000..25badac
--- /dev/null
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "RenderProxy"
+
+#include "RenderProxy.h"
+
+#include "CanvasContext.h"
+#include "RenderTask.h"
+#include "RenderThread.h"
+
+#include "../DisplayList.h"
+#include "../Rect.h"
+
+namespace android {
+namespace uirenderer {
+namespace renderthread {
+
+#define ARGS(method) method ## Args
+
+#define CREATE_BRIDGE1(name, a1) CREATE_BRIDGE(name, a1,,,,,,,)
+#define CREATE_BRIDGE2(name, a1, a2) CREATE_BRIDGE(name, a1,a2,,,,,,)
+#define CREATE_BRIDGE3(name, a1, a2, a3) CREATE_BRIDGE(name, a1,a2,a3,,,,,)
+#define CREATE_BRIDGE4(name, a1, a2, a3, a4) CREATE_BRIDGE(name, a1,a2,a3,a4,,,,)
+#define CREATE_BRIDGE(name, a1, a2, a3, a4, a5, a6, a7, a8) \
+    typedef struct { \
+        a1; a2; a3; a4; a5; a6; a7; a8; \
+    } ARGS(name); \
+    static void* Bridge_ ## name(ARGS(name)* args)
+
+#define SETUP_TASK(method) \
+    LOG_ALWAYS_FATAL_IF( METHOD_INVOKE_PAYLOAD_SIZE < sizeof(ARGS(method)), \
+        "METHOD_INVOKE_PAYLOAD_SIZE %d is smaller than sizeof(" #method "Args) %d", \
+                METHOD_INVOKE_PAYLOAD_SIZE, sizeof(ARGS(method))); \
+    MethodInvokeRenderTask* task = createTask((RunnableMethod) Bridge_ ## method); \
+    ARGS(method) *args = (ARGS(method) *) task->payload()
+
+CREATE_BRIDGE1(createContext, bool translucent) {
+    return new CanvasContext(args->translucent);
+}
+
+RenderProxy::RenderProxy(bool translucent)
+        : mRenderThread(RenderThread::getInstance())
+        , mContext(0) {
+    SETUP_TASK(createContext);
+    args->translucent = translucent;
+    mContext = (CanvasContext*) postAndWait(task);
+}
+
+RenderProxy::~RenderProxy() {
+    destroyContext();
+}
+
+CREATE_BRIDGE1(destroyContext, CanvasContext* context) {
+    delete args->context;
+    return NULL;
+}
+
+void RenderProxy::destroyContext() {
+    if (mContext) {
+        SETUP_TASK(destroyContext);
+        args->context = mContext;
+        mContext = 0;
+        post(task);
+    }
+}
+
+CREATE_BRIDGE2(initialize, CanvasContext* context, EGLNativeWindowType window) {
+    return (void*) args->context->initialize(args->window);
+}
+
+bool RenderProxy::initialize(EGLNativeWindowType window) {
+    SETUP_TASK(initialize);
+    args->context = mContext;
+    args->window = window;
+    return (bool) postAndWait(task);
+}
+
+CREATE_BRIDGE2(updateSurface, CanvasContext* context, EGLNativeWindowType window) {
+    args->context->updateSurface(args->window);
+    return NULL;
+}
+
+void RenderProxy::updateSurface(EGLNativeWindowType window) {
+    SETUP_TASK(updateSurface);
+    args->context = mContext;
+    args->window = window;
+    post(task);
+}
+
+CREATE_BRIDGE3(setup, CanvasContext* context, int width, int height) {
+    args->context->setup(args->width, args->height);
+    return NULL;
+}
+
+void RenderProxy::setup(int width, int height) {
+    SETUP_TASK(setup);
+    args->context = mContext;
+    args->width = width;
+    args->height = height;
+    post(task);
+}
+
+CREATE_BRIDGE3(drawDisplayList, CanvasContext* context, DisplayList* displayList,
+        Rect dirty) {
+    Rect* dirty = &args->dirty;
+    if (dirty->bottom == -1 && dirty->left == -1 &&
+            dirty->top == -1 && dirty->right == -1) {
+        dirty = 0;
+    }
+    args->context->drawDisplayList(args->displayList, dirty);
+    return NULL;
+}
+
+void RenderProxy::drawDisplayList(DisplayList* displayList,
+        int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom) {
+    SETUP_TASK(drawDisplayList);
+    args->context = mContext;
+    args->displayList = displayList;
+    args->dirty.set(dirtyLeft, dirtyTop, dirtyRight, dirtyBottom);
+    // TODO: Switch to post() once some form of thread safety strategy is in place
+    postAndWait(task);
+}
+
+CREATE_BRIDGE1(destroyCanvas, CanvasContext* context) {
+    args->context->destroyCanvas();
+    return NULL;
+}
+
+void RenderProxy::destroyCanvas() {
+    SETUP_TASK(destroyCanvas);
+    args->context = mContext;
+    post(task);
+}
+
+CREATE_BRIDGE2(attachFunctor, CanvasContext* context, Functor* functor) {
+    args->context->attachFunctor(args->functor);
+    return NULL;
+}
+
+void RenderProxy::attachFunctor(Functor* functor) {
+    SETUP_TASK(attachFunctor);
+    args->context = mContext;
+    args->functor = functor;
+    post(task);
+}
+
+CREATE_BRIDGE2(detachFunctor, CanvasContext* context, Functor* functor) {
+    args->context->detachFunctor(args->functor);
+    return NULL;
+}
+
+void RenderProxy::detachFunctor(Functor* functor) {
+    SETUP_TASK(detachFunctor);
+    args->context = mContext;
+    args->functor = functor;
+    post(task);
+}
+
+MethodInvokeRenderTask* RenderProxy::createTask(RunnableMethod method) {
+    // TODO: Consider having a small pool of these to avoid alloc churn
+    return new MethodInvokeRenderTask(method);
+}
+
+void RenderProxy::post(RenderTask* task) {
+    mRenderThread.queue(task);
+}
+
+void* RenderProxy::postAndWait(MethodInvokeRenderTask* task) {
+    void* retval;
+    task->setReturnPtr(&retval);
+    SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition);
+    AutoMutex _lock(mSyncMutex);
+    mRenderThread.queue(&syncTask);
+    mSyncCondition.wait(mSyncMutex);
+    return retval;
+}
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
new file mode 100644
index 0000000..113c5a8
--- /dev/null
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RENDERPROXY_H_
+#define RENDERPROXY_H_
+
+#include "RenderTask.h"
+
+#include <cutils/compiler.h>
+#include <EGL/egl.h>
+#include <utils/Condition.h>
+#include <utils/Functor.h>
+#include <utils/Mutex.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace uirenderer {
+
+class DisplayList;
+class Rect;
+
+namespace renderthread {
+
+class CanvasContext;
+class ErrorChannel;
+class RenderThread;
+class RenderProxyBridge;
+
+/*
+ * RenderProxy is strictly single threaded. All methods must be invoked on the owning
+ * thread. It is important to note that RenderProxy may be deleted while it has
+ * tasks post()'d as a result. Therefore any RenderTask that is post()'d must not
+ * reference RenderProxy or any of its fields. The exception here is that postAndWait()
+ * references RenderProxy fields. This is safe as RenderProxy cannot
+ * be deleted if it is blocked inside a call.
+ */
+class ANDROID_API RenderProxy {
+public:
+    ANDROID_API RenderProxy(bool translucent);
+    ANDROID_API virtual ~RenderProxy();
+
+    ANDROID_API bool initialize(EGLNativeWindowType window);
+    ANDROID_API void updateSurface(EGLNativeWindowType window);
+    ANDROID_API void setup(int width, int height);
+    ANDROID_API void drawDisplayList(DisplayList* displayList,
+            int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);
+    ANDROID_API void destroyCanvas();
+
+    ANDROID_API void attachFunctor(Functor* functor);
+    ANDROID_API void detachFunctor(Functor* functor);
+
+private:
+    RenderThread& mRenderThread;
+    CanvasContext* mContext;
+
+    Mutex mSyncMutex;
+    Condition mSyncCondition;
+
+    void destroyContext();
+
+    MethodInvokeRenderTask* createTask(RunnableMethod method);
+    void post(RenderTask* task);
+    void* postAndWait(MethodInvokeRenderTask* task);
+
+    // Friend class to help with bridging
+    friend class RenderProxyBridge;
+};
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
+#endif /* RENDERPROXY_H_ */
diff --git a/libs/hwui/renderthread/RenderTask.cpp b/libs/hwui/renderthread/RenderTask.cpp
index 2da91c5..7ca61e4 100644
--- a/libs/hwui/renderthread/RenderTask.cpp
+++ b/libs/hwui/renderthread/RenderTask.cpp
@@ -19,15 +19,18 @@
 #include "RenderTask.h"
 
 #include <utils/Log.h>
+#include <utils/Condition.h>
+#include <utils/Mutex.h>
 
 namespace android {
 namespace uirenderer {
 namespace renderthread {
 
-RenderTask::RenderTask() : mNext(0) {
-}
-
-RenderTask::~RenderTask() {
+void SignalingRenderTask::run() {
+    mTask->run();
+    mLock->lock();
+    mSignal->signal();
+    mLock->unlock();
 }
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderTask.h b/libs/hwui/renderthread/RenderTask.h
index 865b1e6..9fe7573 100644
--- a/libs/hwui/renderthread/RenderTask.h
+++ b/libs/hwui/renderthread/RenderTask.h
@@ -18,19 +18,79 @@
 #define RENDERTASK_H_
 
 #include <cutils/compiler.h>
+#include <utils/Timers.h>
 
 namespace android {
+class Mutex;
+class Condition;
 namespace uirenderer {
 namespace renderthread {
 
+#define METHOD_INVOKE_PAYLOAD_SIZE (8 * sizeof(void*))
+
+/*
+ * Notes about memory management
+ *
+ * RenderThread will only invoke RenderTask::run(). It is the responsibility
+ * of the RenderTask to know if it needs to suicide at the end of run() or
+ * if some other lifecycle is being used. As such, it is not valid to reference
+ * anything on RenderTask after the first call to run().
+ *
+ * For example SignalingRenderTask
+ * is expected to be stack allocated by the calling thread, so it does not
+ * suicide in run() but instead relies on the caller to destroy it.
+ *
+ * MethodInvokeRenderTask however is currently allocated with new, so it will
+ * suicide at the end of run(). TODO: Replace this with a small pool to avoid
+ * malloc/free churn of small objects?
+ */
+
 class ANDROID_API RenderTask {
 public:
-    ANDROID_API RenderTask();
-    ANDROID_API virtual ~RenderTask();
+    ANDROID_API RenderTask() : mNext(0), mRunAt(0) {}
+    ANDROID_API virtual ~RenderTask() {}
 
     ANDROID_API virtual void run() = 0;
 
     RenderTask* mNext;
+    nsecs_t mRunAt;
+};
+
+class SignalingRenderTask : public RenderTask {
+public:
+    // Takes ownership of task, caller owns lock and signal
+    SignalingRenderTask(RenderTask* task, Mutex* lock, Condition* signal)
+            : mTask(task), mLock(lock), mSignal(signal) {}
+    virtual void run();
+
+private:
+    RenderTask* mTask;
+    Mutex* mLock;
+    Condition* mSignal;
+};
+
+typedef void* (*RunnableMethod)(void* data);
+
+class MethodInvokeRenderTask : public RenderTask {
+public:
+    MethodInvokeRenderTask(RunnableMethod method)
+        : mMethod(method), mReturnPtr(0) {}
+
+    void* payload() { return mData; }
+    void setReturnPtr(void** retptr) { mReturnPtr = retptr; }
+
+    virtual void run() {
+        void* retval = mMethod(mData);
+        if (mReturnPtr) {
+            *mReturnPtr = retval;
+        }
+        // Commit suicide
+        delete this;
+    }
+private:
+    RunnableMethod mMethod;
+    char mData[METHOD_INVOKE_PAYLOAD_SIZE];
+    void** mReturnPtr;
 };
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index bccd6e6..e4ec164 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -18,6 +18,8 @@
 
 #include "RenderThread.h"
 
+#include "CanvasContext.h"
+#include "RenderProxy.h"
 #include <utils/Log.h>
 
 namespace android {
@@ -27,8 +29,82 @@
 namespace uirenderer {
 namespace renderthread {
 
+TaskQueue::TaskQueue() : mHead(0), mTail(0) {}
+
+RenderTask* TaskQueue::next() {
+    RenderTask* ret = mHead;
+    if (ret) {
+        mHead = ret->mNext;
+        if (!mHead) {
+            mTail = 0;
+        }
+        ret->mNext = 0;
+    }
+    return ret;
+}
+
+RenderTask* TaskQueue::peek() {
+    return mHead;
+}
+
+void TaskQueue::queue(RenderTask* task) {
+    // Since the RenderTask itself forms the linked list it is not allowed
+    // to have the same task queued twice
+    LOG_ALWAYS_FATAL_IF(task->mNext || mTail == task, "Task is already in the queue!");
+    if (mTail) {
+        // Fast path if we can just append
+        if (mTail->mRunAt <= task->mRunAt) {
+            mTail->mNext = task;
+            mTail = task;
+        } else {
+            // Need to find the proper insertion point
+            RenderTask* previous = 0;
+            RenderTask* next = mHead;
+            while (next && next->mRunAt <= task->mRunAt) {
+                previous = next;
+                next = next->mNext;
+            }
+            if (!previous) {
+                task->mNext = mHead;
+                mHead = task;
+            } else {
+                previous->mNext = task;
+                if (next) {
+                    task->mNext = next;
+                } else {
+                    mTail = task;
+                }
+            }
+        }
+    } else {
+        mTail = mHead = task;
+    }
+}
+
+void TaskQueue::remove(RenderTask* task) {
+    // TaskQueue is strict here to enforce that users are keeping track of
+    // their RenderTasks due to how their memory is managed
+    LOG_ALWAYS_FATAL_IF(!task->mNext && mTail != task,
+            "Cannot remove a task that isn't in the queue!");
+
+    // If task is the head we can just call next() to pop it off
+    // Otherwise we need to scan through to find the task before it
+    if (peek() == task) {
+        next();
+    } else {
+        RenderTask* previous = mHead;
+        while (previous->mNext != task) {
+            previous = previous->mNext;
+        }
+        previous->mNext = task->mNext;
+        if (mTail == task) {
+            mTail = previous;
+        }
+    }
+}
+
 RenderThread::RenderThread() : Thread(true), Singleton<RenderThread>()
-        , mQueueHead(0), mQueueTail(0) {
+        , mNextWakeup(LLONG_MAX) {
     mLooper = new Looper(false);
     run("RenderThread");
 }
@@ -37,16 +113,25 @@
 }
 
 bool RenderThread::threadLoop() {
+    int timeoutMillis = -1;
     for (;;) {
-        int result = mLooper->pollAll(-1);
-        if (result == Looper::POLL_ERROR) {
-            // TODO Something?
-            break;
-        }
+        int result = mLooper->pollAll(timeoutMillis);
+        LOG_ALWAYS_FATAL_IF(result == Looper::POLL_ERROR,
+                "RenderThread Looper POLL_ERROR!");
+
+        nsecs_t nextWakeup;
         // Process our queue, if we have anything
-        while (RenderTask* task = nextTask()) {
+        while (RenderTask* task = nextTask(&nextWakeup)) {
             task->run();
-            delete task;
+            // task may have deleted itself, do not reference it again
+        }
+        if (nextWakeup == LLONG_MAX) {
+            timeoutMillis = -1;
+        } else {
+            timeoutMillis = nextWakeup - systemTime(SYSTEM_TIME_MONOTONIC);
+            if (timeoutMillis < 0) {
+                timeoutMillis = 0;
+            }
         }
     }
 
@@ -55,30 +140,40 @@
 
 void RenderThread::queue(RenderTask* task) {
     AutoMutex _lock(mLock);
-    if (mQueueTail) {
-        mQueueTail->mNext = task;
-    } else {
-        mQueueHead = task;
-    }
-    mQueueTail = task;
-    if (mQueueHead == task) {
-        // Only wake if this is the first task
+    mQueue.queue(task);
+    if (mNextWakeup && task->mRunAt < mNextWakeup) {
+        mNextWakeup = 0;
         mLooper->wake();
     }
 }
 
-RenderTask* RenderThread::nextTask() {
+void RenderThread::queueDelayed(RenderTask* task, int delayMs) {
+    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+    task->mRunAt = now + delayMs;
+    queue(task);
+}
+
+void RenderThread::remove(RenderTask* task) {
     AutoMutex _lock(mLock);
-    RenderTask* ret = mQueueHead;
-    if (ret) {
-        if (mQueueTail == mQueueHead) {
-            mQueueTail = mQueueHead = 0;
-        } else {
-            mQueueHead = ret->mNext;
+    mQueue.remove(task);
+}
+
+RenderTask* RenderThread::nextTask(nsecs_t* nextWakeup) {
+    AutoMutex _lock(mLock);
+    RenderTask* next = mQueue.peek();
+    if (!next) {
+        mNextWakeup = LLONG_MAX;
+    } else {
+        // Most tasks won't be delayed, so avoid unnecessary systemTime() calls
+        if (next->mRunAt <= 0 || next->mRunAt <= systemTime(SYSTEM_TIME_MONOTONIC)) {
+            next = mQueue.next();
         }
-        ret->mNext = 0;
+        mNextWakeup = next->mRunAt;
     }
-    return ret;
+    if (nextWakeup) {
+        *nextWakeup = mNextWakeup;
+    }
+    return next;
 }
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 4edd575..e444aa0 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -28,11 +28,27 @@
 namespace uirenderer {
 namespace renderthread {
 
+class TaskQueue {
+public:
+    TaskQueue();
+
+    RenderTask* next();
+    void queue(RenderTask* task);
+    RenderTask* peek();
+    void remove(RenderTask* task);
+
+private:
+    RenderTask* mHead;
+    RenderTask* mTail;
+};
+
 class ANDROID_API RenderThread : public Thread, public Singleton<RenderThread> {
 public:
     // RenderThread takes complete ownership of tasks that are queued
     // and will delete them after they are run
     ANDROID_API void queue(RenderTask* task);
+    void queueDelayed(RenderTask* task, int delayMs);
+    void remove(RenderTask* task);
 
 protected:
     virtual bool threadLoop();
@@ -43,13 +59,16 @@
     RenderThread();
     virtual ~RenderThread();
 
-    RenderTask* nextTask();
+    // Returns the next task to be run. If this returns NULL nextWakeup is set
+    // to the time to requery for the nextTask to run. mNextWakeup is also
+    // set to this time
+    RenderTask* nextTask(nsecs_t* nextWakeup);
 
     sp<Looper> mLooper;
     Mutex mLock;
 
-    RenderTask* mQueueHead;
-    RenderTask* mQueueTail;
+    nsecs_t mNextWakeup;
+    TaskQueue mQueue;
 };
 
 } /* namespace renderthread */
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 1dcb459..9fe3ac1 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -177,7 +177,7 @@
     public static final int BUFFER_FLAG_END_OF_STREAM         = 4;
 
     private EventHandler mEventHandler;
-    private NotificationCallback mNotificationCallback;
+    private volatile NotificationCallback mNotificationCallback;
 
     static final int EVENT_NOTIFY = 1;
 
@@ -194,8 +194,9 @@
             switch (msg.what) {
                 case EVENT_NOTIFY:
                 {
-                    if (mNotificationCallback != null) {
-                        mNotificationCallback.onCodecNotify(mCodec);
+                    NotificationCallback cb = mNotificationCallback;
+                    if (cb != null) {
+                        cb.onCodecNotify(mCodec);
                     }
                     break;
                 }
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index fe69819..a52b24d 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -264,7 +264,7 @@
                             config);
 
     SkBitmap *bitmap =
-            (SkBitmap *) env->GetIntField(jBitmap, fields.nativeBitmap);
+            (SkBitmap *) env->GetLongField(jBitmap, fields.nativeBitmap);
 
     bitmap->lockPixels();
     rotate((uint16_t*)bitmap->getPixels(),
@@ -406,7 +406,7 @@
     if (fields.createScaledBitmapMethod == NULL) {
         return;
     }
-    fields.nativeBitmap = env->GetFieldID(fields.bitmapClazz, "mNativeBitmap", "I");
+    fields.nativeBitmap = env->GetFieldID(fields.bitmapClazz, "mNativeBitmap", "J");
     if (fields.nativeBitmap == NULL) {
         return;
     }
diff --git a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
index 689366b..de839c6 100644
--- a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
+++ b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
@@ -304,7 +304,7 @@
         int currentUserId = mLockPatternUtils.getCurrentUser();
         if (authenticatedUserId == currentUserId) {
             if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
-            mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
+            mKeyguardScreenCallback.reportUnlockAttempt(true);
             mKeyguardScreenCallback.dismiss(true);
         } else {
             Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
@@ -335,7 +335,7 @@
         // next time the user visits keyguard.
         KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
 
-        mKeyguardScreenCallback.reportFailedUnlockAttempt();
+        mKeyguardScreenCallback.reportUnlockAttempt(false);
     }
 
     /**
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 461fd77..3950159 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -154,14 +154,14 @@
     protected void verifyPasswordAndUnlock() {
         String entry = mPasswordEntry.getText().toString();
         if (mLockPatternUtils.checkPassword(entry)) {
-            mCallback.reportSuccessfulUnlockAttempt();
+            mCallback.reportUnlockAttempt(true);
             mCallback.dismiss(true);
         } else if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) {
             // to avoid accidental lockout, only count attempts that are long enough to be a
             // real password. This may require some tweaking.
-            mCallback.reportFailedUnlockAttempt();
-            if (0 == (mCallback.getFailedAttempts()
-                    % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
+            mCallback.reportUnlockAttempt(false);
+            int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
+            if (0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
                 long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                 handleAttemptLockout(deadline);
             }
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
index 6b8be69..f69fa5f 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
@@ -177,14 +177,14 @@
                     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                     mContext.startActivityAsUser(intent,
                             new UserHandle(mLockPatternUtils.getCurrentUser()));
-                    mCallback.reportSuccessfulUnlockAttempt();
+                    mCallback.reportUnlockAttempt(true);
 
                     // dismiss keyguard
                     mCallback.dismiss(true);
                 } else {
                     mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input, true);
                     mPassword.setText("");
-                    mCallback.reportFailedUnlockAttempt();
+                    mCallback.reportUnlockAttempt(false);
                 }
             }
         });
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
index 0a915ea..368a97a 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
@@ -53,10 +53,12 @@
 
     abstract Context getContext();
 
-    abstract KeyguardSecurityCallback getCallback();
-
     abstract LockPatternUtils getLockPatternUtils();
 
+    abstract void setOnDismissAction(OnDismissAction action);
+
+    abstract void requestDismissKeyguard();
+
     public static class CameraWidgetInfo {
         public String contextPackage;
         public int layoutId;
@@ -190,8 +192,7 @@
         } else {
             // Create a runnable to start the activity and ask the user to enter their
             // credentials.
-            KeyguardSecurityCallback callback = getCallback();
-            callback.setOnDismissAction(new OnDismissAction() {
+            setOnDismissAction(new OnDismissAction() {
                 @Override
                 public boolean onDismiss() {
                     dismissKeyguardOnNextActivity();
@@ -199,7 +200,7 @@
                     return true;
                 }
             });
-            callback.dismiss(false);
+            requestDismissKeyguard();
         }
     }
 
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index dfcd8a8..1548dee 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -18,6 +18,7 @@
 
 import android.nfc.NfcUnlock;
 import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
 import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
 import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
 
@@ -84,20 +85,12 @@
     private AppWidgetHost mAppWidgetHost;
     private AppWidgetManager mAppWidgetManager;
     private KeyguardWidgetPager mAppWidgetContainer;
-    private KeyguardSecurityViewFlipper mSecurityViewContainer;
-    private KeyguardSelectorView mKeyguardSelectorView;
     private KeyguardTransportControlView mTransportControl;
-    private boolean mIsVerifyUnlockOnly;
-    private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
-    private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
     private int mAppWidgetToShow;
 
-    protected OnDismissAction mDismissAction;
-
     protected int mFailedAttempts;
     private LockPatternUtils mLockPatternUtils;
 
-    private KeyguardSecurityModel mSecurityModel;
     private KeyguardViewStateManager mViewStateManager;
 
     private Rect mTempRect = new Rect();
@@ -126,6 +119,8 @@
 
     private Runnable mPostBootCompletedRunnable;
 
+    private OnDismissAction mDismissAction;
+
     /*package*/ interface UserSwitcherCallback {
         void hideSecurityView(int duration);
         void showSecurityView();
@@ -186,8 +181,6 @@
 
         mAppWidgetManager = AppWidgetManager.getInstance(userContext);
 
-        mSecurityModel = new KeyguardSecurityModel(context);
-
         mViewStateManager = new KeyguardViewStateManager(this);
 
         mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(),
@@ -207,13 +200,6 @@
         }
     }
 
-    public void announceCurrentSecurityMethod() {
-        View v = (View) getSecurityView(mCurrentSecuritySelection);
-        if (v != null) {
-            v.announceForAccessibility(v.getContentDescription());
-        }
-    }
-
     private void getInitialTransportState() {
         DisplayClientState dcs = KeyguardUpdateMonitor.getInstance(mContext)
                 .getCachedDisplayClientState();
@@ -300,9 +286,10 @@
         }
         @Override
         public void onNfcUnlock() {
-            if (NfcUnlock.getPropertyEnabled()) mCallback.dismiss(true);
+            if (NfcUnlock.getPropertyEnabled()) {
+                dismiss(true);
+            }
         }
-
     };
 
     private static final boolean isMusicPlaying(int playbackState) {
@@ -322,14 +309,15 @@
 
     private SlidingChallengeLayout mSlidingChallengeLayout;
     private MultiPaneChallengeLayout mMultiPaneChallengeLayout;
+    private KeyguardSecurityContainer mSecurityContainer;
 
     @Override
     public boolean onTouchEvent(MotionEvent ev) {
         boolean result = super.onTouchEvent(ev);
         mTempRect.set(0, 0, 0, 0);
-        offsetRectIntoDescendantCoords(mSecurityViewContainer, mTempRect);
+        offsetRectIntoDescendantCoords(mSecurityContainer, mTempRect);
         ev.offsetLocation(mTempRect.left, mTempRect.top);
-        result = mSecurityViewContainer.dispatchTouchEvent(ev) || result;
+        result = mSecurityContainer.dispatchTouchEvent(ev) || result;
         ev.offsetLocation(-mTempRect.left, -mTempRect.top);
         return result;
     }
@@ -383,9 +371,48 @@
         mAppWidgetContainer.setBouncerAnimationDuration(challenge.getBouncerAnimationDuration());
         mViewStateManager.setPagedView(mAppWidgetContainer);
         mViewStateManager.setChallengeLayout(challenge);
-        mSecurityViewContainer = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
-        mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view);
-        mViewStateManager.setSecurityViewContainer(mSecurityViewContainer);
+
+        mSecurityContainer =
+                (KeyguardSecurityContainer) findViewById(R.id.keyguard_security_container);
+        mSecurityContainer.setLockPatternUtils(mLockPatternUtils);
+        mSecurityContainer.setSecurityCallback(new SecurityCallback() {
+            @Override
+            public void userActivity(long timeout) {
+                if (mViewMediatorCallback != null) {
+                    mViewMediatorCallback.userActivity(timeout);
+                }
+            }
+
+            @Override
+            public void dismiss(boolean authenticated) {
+                KeyguardHostView.this.dismiss(authenticated);
+            }
+
+            @Override
+            public void finish() {
+
+                // If the alternate unlock was suppressed, it can now be safely
+                // enabled because the user has left keyguard.
+                KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
+
+                // If there's a pending runnable because the user interacted with a widget
+                // and we're leaving keyguard, then run it.
+                boolean deferKeyguardDone = false;
+                if (mDismissAction != null) {
+                    deferKeyguardDone = mDismissAction.onDismiss();
+                    mDismissAction = null;
+                }
+                if (mViewMediatorCallback != null) {
+                    if (deferKeyguardDone) {
+                        mViewMediatorCallback.keyguardDonePending();
+                    } else {
+                        mViewMediatorCallback.keyguardDone(true);
+                    }
+                }
+            }
+        });
+
+        mViewStateManager.setSecurityViewContainer(mSecurityContainer);
 
         setBackButtonEnabled(false);
 
@@ -402,8 +429,8 @@
             };
         }
 
-        showPrimarySecurityScreen(false);
-        updateSecurityViews();
+        mSecurityContainer.showPrimarySecurityScreen(false);
+        mSecurityContainer.updateSecurityViews(mViewStateManager.isBouncing());
         enableUserSelectorIfNecessary();
     }
 
@@ -465,32 +492,10 @@
                 || (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0;
     }
 
-    private void updateSecurityViews() {
-        int children = mSecurityViewContainer.getChildCount();
-        for (int i = 0; i < children; i++) {
-            updateSecurityView(mSecurityViewContainer.getChildAt(i));
-        }
-    }
-
-    private void updateSecurityView(View view) {
-        if (view instanceof KeyguardSecurityView) {
-            KeyguardSecurityView ksv = (KeyguardSecurityView) view;
-            ksv.setKeyguardCallback(mCallback);
-            ksv.setLockPatternUtils(mLockPatternUtils);
-            if (mViewStateManager.isBouncing()) {
-                ksv.showBouncer(0);
-            } else {
-                ksv.hideBouncer(0);
-            }
-        } else {
-            Log.w(TAG, "View " + view + " is not a KeyguardSecurityView");
-        }
-    }
-
     void setLockPatternUtils(LockPatternUtils utils) {
-        mSecurityModel.setLockPatternUtils(utils);
         mLockPatternUtils = utils;
-        updateSecurityViews();
+        mSecurityContainer.setLockPatternUtils(utils);
+        mSecurityContainer.updateSecurityViews(mViewStateManager.isBouncing());
     }
 
     @Override
@@ -577,265 +582,7 @@
         return -1;
     }
 
-    private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
 
-        public void userActivity(long timeout) {
-            if (mViewMediatorCallback != null) {
-                mViewMediatorCallback.userActivity(timeout);
-            }
-        }
-
-        public void dismiss(boolean authenticated) {
-            showNextSecurityScreenOrFinish(authenticated);
-        }
-
-        public boolean isVerifyUnlockOnly() {
-            return mIsVerifyUnlockOnly;
-        }
-
-        public void reportSuccessfulUnlockAttempt() {
-            KeyguardUpdateMonitor.getInstance(mContext).clearFailedUnlockAttempts();
-            mLockPatternUtils.reportSuccessfulPasswordAttempt();
-        }
-
-        public void reportFailedUnlockAttempt() {
-            if (mCurrentSecuritySelection == SecurityMode.Biometric) {
-                KeyguardUpdateMonitor.getInstance(mContext).reportFailedBiometricUnlockAttempt();
-            } else {
-                KeyguardHostView.this.reportFailedUnlockAttempt();
-            }
-        }
-
-        public int getFailedAttempts() {
-            return KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
-        }
-
-        @Override
-        public void showBackupSecurity() {
-            KeyguardHostView.this.showBackupSecurityScreen();
-        }
-
-        @Override
-        public void setOnDismissAction(OnDismissAction action) {
-            KeyguardHostView.this.setOnDismissAction(action);
-        }
-
-    };
-
-    private void showDialog(String title, String message) {
-        final AlertDialog dialog = new AlertDialog.Builder(mContext)
-            .setTitle(title)
-            .setMessage(message)
-            .setNeutralButton(R.string.ok, null)
-            .create();
-        if (!(mContext instanceof Activity)) {
-            dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
-        }
-        dialog.show();
-    }
-
-    private void showTimeoutDialog() {
-        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
-        int messageId = 0;
-
-        switch (mSecurityModel.getSecurityMode()) {
-            case Pattern:
-                messageId = R.string.kg_too_many_failed_pattern_attempts_dialog_message;
-                break;
-            case PIN:
-                messageId = R.string.kg_too_many_failed_pin_attempts_dialog_message;
-                break;
-            case Password:
-                messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
-                break;
-        }
-
-        if (messageId != 0) {
-            final String message = mContext.getString(messageId,
-                    KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(),
-                    timeoutInSeconds);
-            showDialog(null, message);
-        }
-    }
-
-    private void showAlmostAtWipeDialog(int attempts, int remaining) {
-        String message = mContext.getString(R.string.kg_failed_attempts_almost_at_wipe,
-                attempts, remaining);
-        showDialog(null, message);
-    }
-
-    private void showWipeDialog(int attempts) {
-        String message = mContext.getString(R.string.kg_failed_attempts_now_wiping, attempts);
-        showDialog(null, message);
-    }
-
-    private void showAlmostAtAccountLoginDialog() {
-        final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
-        final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
-                - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
-        String message = mContext.getString(R.string.kg_failed_attempts_almost_at_login,
-                count, LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, timeoutInSeconds);
-        showDialog(null, message);
-    }
-
-    private void reportFailedUnlockAttempt() {
-        final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
-        final int failedAttempts = monitor.getFailedUnlockAttempts() + 1; // +1 for this time
-
-        if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts);
-
-        SecurityMode mode = mSecurityModel.getSecurityMode();
-        final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern;
-
-        final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
-                .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser());
-
-        final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
-                - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
-
-        final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
-                (failedAttemptsBeforeWipe - failedAttempts)
-                : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
-
-        boolean showTimeout = false;
-        if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
-            // If we reach this code, it means the user has installed a DevicePolicyManager
-            // that requests device wipe after N attempts.  Once we get below the grace
-            // period, we'll post this dialog every time as a clear warning until the
-            // bombshell hits and the device is wiped.
-            if (remainingBeforeWipe > 0) {
-                showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
-            } else {
-                // Too many attempts. The device will be wiped shortly.
-                Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
-                showWipeDialog(failedAttempts);
-            }
-        } else {
-            showTimeout =
-                (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
-            if (usingPattern && mEnableFallback) {
-                if (failedAttempts == failedAttemptWarning) {
-                    showAlmostAtAccountLoginDialog();
-                    showTimeout = false; // don't show both dialogs
-                } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
-                    mLockPatternUtils.setPermanentlyLocked(true);
-                    showSecurityScreen(SecurityMode.Account);
-                    // don't show timeout dialog because we show account unlock screen next
-                    showTimeout = false;
-                }
-            }
-        }
-        monitor.reportFailedUnlockAttempt();
-        mLockPatternUtils.reportFailedPasswordAttempt();
-        if (showTimeout) {
-            showTimeoutDialog();
-        }
-    }
-
-    /**
-     * Shows the primary security screen for the user. This will be either the multi-selector
-     * or the user's security method.
-     * @param turningOff true if the device is being turned off
-     */
-    void showPrimarySecurityScreen(boolean turningOff) {
-        SecurityMode securityMode = mSecurityModel.getSecurityMode();
-        if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
-        if (!turningOff &&
-                KeyguardUpdateMonitor.getInstance(mContext).isAlternateUnlockEnabled()) {
-            // If we're not turning off, then allow biometric alternate.
-            // We'll reload it when the device comes back on.
-            securityMode = mSecurityModel.getAlternateFor(securityMode);
-        }
-        showSecurityScreen(securityMode);
-    }
-
-    /**
-     * Shows the backup security screen for the current security mode.  This could be used for
-     * password recovery screens but is currently only used for pattern unlock to show the
-     * account unlock screen and biometric unlock to show the user's normal unlock.
-     */
-    private void showBackupSecurityScreen() {
-        if (DEBUG) Log.d(TAG, "showBackupSecurity()");
-        SecurityMode backup = mSecurityModel.getBackupSecurityMode(mCurrentSecuritySelection);
-        showSecurityScreen(backup);
-    }
-
-    public boolean showNextSecurityScreenIfPresent() {
-        SecurityMode securityMode = mSecurityModel.getSecurityMode();
-        // Allow an alternate, such as biometric unlock
-        securityMode = mSecurityModel.getAlternateFor(securityMode);
-        if (SecurityMode.None == securityMode) {
-            return false;
-        } else {
-            showSecurityScreen(securityMode); // switch to the alternate security view
-            return true;
-        }
-    }
-
-    private void showNextSecurityScreenOrFinish(boolean authenticated) {
-        if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
-        boolean finish = false;
-        if (SecurityMode.None == mCurrentSecuritySelection) {
-            SecurityMode securityMode = mSecurityModel.getSecurityMode();
-            // Allow an alternate, such as biometric unlock
-            securityMode = mSecurityModel.getAlternateFor(securityMode);
-            if (SecurityMode.None == securityMode) {
-                finish = true; // no security required
-            } else {
-                showSecurityScreen(securityMode); // switch to the alternate security view
-            }
-        } else if (authenticated) {
-            switch (mCurrentSecuritySelection) {
-                case Pattern:
-                case Password:
-                case PIN:
-                case Account:
-                case Biometric:
-                    finish = true;
-                    break;
-
-                case SimPin:
-                case SimPuk:
-                    // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
-                    SecurityMode securityMode = mSecurityModel.getSecurityMode();
-                    if (securityMode != SecurityMode.None) {
-                        showSecurityScreen(securityMode);
-                    } else {
-                        finish = true;
-                    }
-                    break;
-
-                default:
-                    Log.v(TAG, "Bad security screen " + mCurrentSecuritySelection + ", fail safe");
-                    showPrimarySecurityScreen(false);
-                    break;
-            }
-        } else {
-            showPrimarySecurityScreen(false);
-        }
-        if (finish) {
-            // If the alternate unlock was suppressed, it can now be safely
-            // enabled because the user has left keyguard.
-            KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
-
-            // If there's a pending runnable because the user interacted with a widget
-            // and we're leaving keyguard, then run it.
-            boolean deferKeyguardDone = false;
-            if (mDismissAction != null) {
-                deferKeyguardDone = mDismissAction.onDismiss();
-                mDismissAction = null;
-            }
-            if (mViewMediatorCallback != null) {
-                if (deferKeyguardDone) {
-                    mViewMediatorCallback.keyguardDonePending();
-                } else {
-                    mViewMediatorCallback.keyguardDone(true);
-                }
-            }
-        } else {
-            mViewStateManager.showBouncer(true);
-        }
-    }
 
     private static class MyOnClickHandler extends OnClickHandler {
 
@@ -843,17 +590,17 @@
         // due to Binder GC linkages to AppWidgetHost. By the same token,
         // this click handler should not keep references to any large
         // objects.
-        WeakReference<KeyguardHostView> mThis;
+        WeakReference<KeyguardHostView> mKeyguardHostView;
 
         MyOnClickHandler(KeyguardHostView hostView) {
-            mThis = new WeakReference<KeyguardHostView>(hostView);
+            mKeyguardHostView = new WeakReference<KeyguardHostView>(hostView);
         }
 
         @Override
         public boolean onClickHandler(final View view,
                 final android.app.PendingIntent pendingIntent,
                 final Intent fillInIntent) {
-            KeyguardHostView hostView = mThis.get();
+            KeyguardHostView hostView = mKeyguardHostView.get();
             if (hostView == null) {
                 return false;
             }
@@ -883,7 +630,7 @@
                 if (hostView.mViewStateManager.isChallengeShowing()) {
                     hostView.mViewStateManager.showBouncer(true);
                 } else {
-                    hostView.mCallback.dismiss(false);
+                    hostView.dismiss();
                 }
                 return true;
             } else {
@@ -892,153 +639,11 @@
         };
     };
 
-    // Used to ignore callbacks from methods that are no longer current (e.g. face unlock).
-    // This avoids unwanted asynchronous events from messing with the state.
-    private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
-
-        @Override
-        public void userActivity(long timeout) {
-        }
-
-        @Override
-        public void showBackupSecurity() {
-        }
-
-        @Override
-        public void setOnDismissAction(OnDismissAction action) {
-        }
-
-        @Override
-        public void reportSuccessfulUnlockAttempt() {
-        }
-
-        @Override
-        public void reportFailedUnlockAttempt() {
-        }
-
-        @Override
-        public boolean isVerifyUnlockOnly() {
-            return false;
-        }
-
-        @Override
-        public int getFailedAttempts() {
-            return 0;
-        }
-
-        @Override
-        public void dismiss(boolean securityVerified) {
-        }
-    };
-
-    /**
-     * Sets an action to perform when keyguard is dismissed.
-     * @param action
-     */
-    protected void setOnDismissAction(OnDismissAction action) {
-        mDismissAction = action;
-    }
-
-    private KeyguardSecurityView getSecurityView(SecurityMode securityMode) {
-        final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
-        KeyguardSecurityView view = null;
-        final int children = mSecurityViewContainer.getChildCount();
-        for (int child = 0; child < children; child++) {
-            if (mSecurityViewContainer.getChildAt(child).getId() == securityViewIdForMode) {
-                view = ((KeyguardSecurityView)mSecurityViewContainer.getChildAt(child));
-                break;
-            }
-        }
-        int layoutId = getLayoutIdFor(securityMode);
-        if (view == null && layoutId != 0) {
-            final LayoutInflater inflater = LayoutInflater.from(mContext);
-            if (DEBUG) Log.v(TAG, "inflating id = " + layoutId);
-            View v = inflater.inflate(layoutId, mSecurityViewContainer, false);
-            mSecurityViewContainer.addView(v);
-            updateSecurityView(v);
-            view = (KeyguardSecurityView)v;
-        }
-
-        if (view instanceof KeyguardSelectorView) {
-            KeyguardSelectorView selectorView = (KeyguardSelectorView) view;
-            View carrierText = selectorView.findViewById(R.id.keyguard_selector_fade_container);
-            selectorView.setCarrierArea(carrierText);
-        }
-
-        return view;
-    }
-
-    /**
-     * Switches to the given security view unless it's already being shown, in which case
-     * this is a no-op.
-     *
-     * @param securityMode
-     */
-    private void showSecurityScreen(SecurityMode securityMode) {
-        if (DEBUG) Log.d(TAG, "showSecurityScreen(" + securityMode + ")");
-
-        if (securityMode == mCurrentSecuritySelection) return;
-
-        KeyguardSecurityView oldView = getSecurityView(mCurrentSecuritySelection);
-        KeyguardSecurityView newView = getSecurityView(securityMode);
-
-        // Enter full screen mode if we're in SIM or Account screen
-        boolean fullScreenEnabled = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
-        boolean isSimOrAccount = securityMode == SecurityMode.SimPin
-                || securityMode == SecurityMode.SimPuk
-                || securityMode == SecurityMode.Account;
-        mAppWidgetContainer.setVisibility(
-                isSimOrAccount && fullScreenEnabled ? View.GONE : View.VISIBLE);
-
-        // Don't show camera or search in navbar when SIM or Account screen is showing
-        setSystemUiVisibility(isSimOrAccount ?
-                (getSystemUiVisibility() | View.STATUS_BAR_DISABLE_SEARCH)
-                : (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_SEARCH));
-
-        if (mSlidingChallengeLayout != null) {
-            mSlidingChallengeLayout.setChallengeInteractive(!fullScreenEnabled);
-        }
-
-        // Emulate Activity life cycle
-        if (oldView != null) {
-            oldView.onPause();
-            oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
-        }
-        newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
-        newView.setKeyguardCallback(mCallback);
-
-        final boolean needsInput = newView.needsInput();
-        if (mViewMediatorCallback != null) {
-            mViewMediatorCallback.setNeedsInput(needsInput);
-        }
-
-        // Find and show this child.
-        final int childCount = mSecurityViewContainer.getChildCount();
-
-        final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
-        for (int i = 0; i < childCount; i++) {
-            if (mSecurityViewContainer.getChildAt(i).getId() == securityViewIdForMode) {
-                mSecurityViewContainer.setDisplayedChild(i);
-                break;
-            }
-        }
-
-        if (securityMode == SecurityMode.None) {
-            // Discard current runnable if we're switching back to the selector view
-            setOnDismissAction(null);
-        }
-        if (securityMode == SecurityMode.Account && !mLockPatternUtils.isPermanentlyLocked()) {
-            // we're showing account as a backup, provide a way to get back to primary
-            setBackButtonEnabled(true);
-        }
-        mCurrentSecuritySelection = securityMode;
-    }
-
     @Override
     public void onScreenTurnedOn() {
         if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
-        showPrimarySecurityScreen(false);
-        getSecurityView(mCurrentSecuritySelection).onResume(KeyguardSecurityView.SCREEN_ON);
+        mSecurityContainer.showPrimarySecurityScreen(false);
+        mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
 
         // This is a an attempt to fix bug 7137389 where the device comes back on but the entire
         // layout is blank but forcing a layout causes it to reappear (e.g. with with
@@ -1065,8 +670,8 @@
         if (KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
             checkAppWidgetConsistency();
         }
-        showPrimarySecurityScreen(true);
-        getSecurityView(mCurrentSecuritySelection).onPause();
+        mSecurityContainer.showPrimarySecurityScreen(true);
+        mSecurityContainer.onPause();
         CameraWidgetFrame cameraPage = findCameraPage();
         if (cameraPage != null) {
             cameraPage.onScreenTurnedOff();
@@ -1082,12 +687,12 @@
     @Override
     public void show() {
         if (DEBUG) Log.d(TAG, "show()");
-        showPrimarySecurityScreen(false);
+        mSecurityContainer.showPrimarySecurityScreen(false);
     }
 
     @Override
     public void verifyUnlock() {
-        SecurityMode securityMode = mSecurityModel.getSecurityMode();
+        SecurityMode securityMode = mSecurityContainer.getSecurityMode();
         if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
             if (mViewMediatorCallback != null) {
                 mViewMediatorCallback.keyguardDone(true);
@@ -1101,37 +706,7 @@
             }
         } else {
             // otherwise, go to the unlock screen, see if they can verify it
-            mIsVerifyUnlockOnly = true;
-            showSecurityScreen(securityMode);
-        }
-    }
-
-    private int getSecurityViewIdForMode(SecurityMode securityMode) {
-        switch (securityMode) {
-            case None: return R.id.keyguard_selector_view;
-            case Pattern: return R.id.keyguard_pattern_view;
-            case PIN: return R.id.keyguard_pin_view;
-            case Password: return R.id.keyguard_password_view;
-            case Biometric: return R.id.keyguard_face_unlock_view;
-            case Account: return R.id.keyguard_account_view;
-            case SimPin: return R.id.keyguard_sim_pin_view;
-            case SimPuk: return R.id.keyguard_sim_puk_view;
-        }
-        return 0;
-    }
-
-    private int getLayoutIdFor(SecurityMode securityMode) {
-        switch (securityMode) {
-            case None: return R.layout.keyguard_selector_view;
-            case Pattern: return R.layout.keyguard_pattern_view;
-            case PIN: return R.layout.keyguard_pin_view;
-            case Password: return R.layout.keyguard_password_view;
-            case Biometric: return R.layout.keyguard_face_unlock_view;
-            case Account: return R.layout.keyguard_account_view;
-            case SimPin: return R.layout.keyguard_sim_pin_view;
-            case SimPuk: return R.layout.keyguard_sim_puk_view;
-            default:
-                return 0;
+            mSecurityContainer.verifyUnlock();
         }
     }
 
@@ -1189,14 +764,19 @@
         }
 
         @Override
-        KeyguardSecurityCallback getCallback() {
-            return mCallback;
+        void setOnDismissAction(OnDismissAction action) {
+            mDismissAction = action;
         }
 
         @Override
         LockPatternUtils getLockPatternUtils() {
             return mLockPatternUtils;
         }
+
+        @Override
+        void requestDismissKeyguard() {
+            KeyguardHostView.this.dismiss(false);
+        }
     };
 
     private int numWidgets() {
@@ -1618,18 +1198,18 @@
                 UserSwitcherCallback callback = new UserSwitcherCallback() {
                     @Override
                     public void hideSecurityView(int duration) {
-                        mSecurityViewContainer.animate().alpha(0).setDuration(duration);
+                        mSecurityContainer.animate().alpha(0).setDuration(duration);
                     }
 
                     @Override
                     public void showSecurityView() {
-                        mSecurityViewContainer.setAlpha(1.0f);
+                        mSecurityContainer.setAlpha(1.0f);
                     }
 
                     @Override
                     public void showUnlockHint() {
-                        if (mKeyguardSelectorView != null) {
-                            mKeyguardSelectorView.showUsabilityHint();
+                        if (mSecurityContainer != null) {
+                            mSecurityContainer.showUsabilityHint();
                         }
                     }
 
@@ -1688,21 +1268,21 @@
     public boolean handleMenuKey() {
         // The following enables the MENU key to work for testing automation
         if (shouldEnableMenuKey()) {
-            showNextSecurityScreenOrFinish(false);
+            dismiss();
             return true;
         }
         return false;
     }
 
     public boolean handleBackKey() {
-        if (mCurrentSecuritySelection == SecurityMode.Account) {
+        if (mSecurityContainer.getCurrentSecuritySelection() == SecurityMode.Account) {
             // go back to primary screen and re-disable back
             setBackButtonEnabled(false);
-            showPrimarySecurityScreen(false /*turningOff*/);
+            mSecurityContainer.showPrimarySecurityScreen(false /*turningOff*/);
             return true;
         }
-        if (mCurrentSecuritySelection != SecurityMode.None) {
-            mCallback.dismiss(false);
+        if (mSecurityContainer.getCurrentSecuritySelection() != SecurityMode.None) {
+            mSecurityContainer.dismiss(false);
             return true;
         }
         return false;
@@ -1712,7 +1292,54 @@
      *  Dismisses the keyguard by going to the next screen or making it gone.
      */
     public void dismiss() {
-        showNextSecurityScreenOrFinish(false);
+        dismiss(false);
+    }
+
+    private void dismiss(boolean authenticated) {
+        boolean finished = mSecurityContainer.showNextSecurityScreenOrFinish(authenticated);
+        if (!finished) {
+            updateAfterSecuritySelection();
+            mViewStateManager.showBouncer(true);
+        }
+    }
+
+    void setOnDismissAction(OnDismissAction action) {
+        mDismissAction = action;
+    }
+
+    public void announceCurrentSecurityMethod() {
+        mSecurityContainer.announceCurrentSecurityMethod();
+    }
+
+    private void updateAfterSecuritySelection() {
+        // Enable or disable the back button based on security mode
+        if (mSecurityContainer.getSecurityMode() == SecurityMode.Account
+                && !mLockPatternUtils.isPermanentlyLocked()) {
+            // we're showing account as a backup, provide a way to get back to primary
+            setBackButtonEnabled(true);
+        }
+
+        // Enter full screen mode if we're in SIM or Account screen
+        SecurityMode securityMode = mSecurityContainer.getSecurityMode();
+        boolean isFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
+        boolean isSimOrAccount = securityMode == SecurityMode.SimPin
+                || securityMode == SecurityMode.SimPuk
+                || securityMode == SecurityMode.Account;
+        mAppWidgetContainer.setVisibility(
+                isSimOrAccount && isFullScreen ? View.GONE : View.VISIBLE);
+
+        // Don't show camera or search in navbar when SIM or Account screen is showing
+        setSystemUiVisibility(isSimOrAccount ?
+                (getSystemUiVisibility() | View.STATUS_BAR_DISABLE_SEARCH)
+                : (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_SEARCH));
+
+        if (mSlidingChallengeLayout != null) {
+            mSlidingChallengeLayout.setChallengeInteractive(!isFullScreen);
+        }
+
+        if (mViewMediatorCallback != null) {
+            mViewMediatorCallback.setNeedsInput(mSecurityContainer.needsInput());
+        }
     }
 
     public void showAssistant() {
@@ -1726,9 +1353,7 @@
                 getHandler(), null);
 
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-        mActivityLauncher.launchActivityWithAnimation(
-                intent, false, opts.toBundle(), null, null);
+        mActivityLauncher.launchActivityWithAnimation(intent, false, opts.toBundle(), null, null);
     }
 
     public void dispatch(MotionEvent event) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index e7f1259..0fa27c1 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -260,7 +260,7 @@
 
         public void onPatternDetected(List<LockPatternView.Cell> pattern) {
             if (mLockPatternUtils.checkPattern(pattern)) {
-                mCallback.reportSuccessfulUnlockAttempt();
+                mCallback.reportUnlockAttempt(true);
                 mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
                 mTotalFailedPatternAttempts = 0;
                 mCallback.dismiss(true);
@@ -272,7 +272,7 @@
                 if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
                     mTotalFailedPatternAttempts++;
                     mFailedPatternAttemptsSinceLastTimeout++;
-                    mCallback.reportFailedUnlockAttempt();
+                    mCallback.reportUnlockAttempt(false);
                 }
                 if (mFailedPatternAttemptsSinceLastTimeout
                         >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
index 4f139ad..957098c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
@@ -15,8 +15,6 @@
  */
 package com.android.keyguard;
 
-import com.android.keyguard.KeyguardHostView.OnDismissAction;
-
 public interface KeyguardSecurityCallback {
 
     /**
@@ -40,29 +38,13 @@
 
     /**
      * Call when user correctly enters their credentials
+     * @param success
      */
-    void reportSuccessfulUnlockAttempt();
-
-    /**
-     * Call when the user incorrectly enters their credentials
-     */
-    void reportFailedUnlockAttempt();
-
-    /**
-     * Gets the number of attempts thus far as reported by {@link #reportFailedUnlockAttempt()}
-     * @return number of failed attempts
-     */
-    int getFailedAttempts();
+    void reportUnlockAttempt(boolean success);
 
     /**
      * Shows the backup security for the current method.  If none available, this call is a no-op.
      */
     void showBackupSecurity();
 
-    /**
-     * Sets an action to perform after the user successfully enters their credentials.
-     * @param action
-     */
-    void setOnDismissAction(OnDismissAction action);
-
 }
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index 9d03c6a..7606689 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -1,11 +1,39 @@
 package com.android.keyguard;
 
+import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.Context;
 import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Slog;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.view.WindowManager;
 import android.widget.FrameLayout;
 
-public class KeyguardSecurityContainer extends FrameLayout {
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
+
+public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSecurityView {
+    private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+    private static final String TAG = "KeyguardSecurityView";
+    private KeyguardSecurityModel mSecurityModel;
+    private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
+    private LockPatternUtils mLockPatternUtils;
+
+    private KeyguardSecurityViewFlipper mSecurityViewFlipper;
+    private boolean mIsVerifyUnlockOnly;
+    private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
+    private boolean mIsBouncing;
+    private SecurityCallback mSecurityCallback;
+
+    // Used to notify the container when something interesting happens.
+    public interface SecurityCallback {
+        public void dismiss(boolean authenticated);
+        public void userActivity(long timeout);
+        public void finish();
+    }
+
     public KeyguardSecurityContainer(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
     }
@@ -16,9 +44,336 @@
 
     public KeyguardSecurityContainer(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
+        mSecurityModel = new KeyguardSecurityModel(context);
+        mLockPatternUtils = new LockPatternUtils(context);
     }
 
-    KeyguardSecurityViewFlipper getFlipper() {
+    public void setSecurityCallback(SecurityCallback callback) {
+        mSecurityCallback = callback;
+    }
+
+    @Override
+    public void onResume(int reason) {
+        getSecurityView(mCurrentSecuritySelection).onResume(reason);
+    }
+
+    @Override
+    public void onPause() {
+        getSecurityView(mCurrentSecuritySelection).onPause();
+    }
+
+    void updateSecurityViews(boolean isBouncing) {
+        int children = mSecurityViewFlipper.getChildCount();
+        for (int i = 0; i < children; i++) {
+            updateSecurityView(mSecurityViewFlipper.getChildAt(i), isBouncing);
+        }
+    }
+
+    public void announceCurrentSecurityMethod() {
+        View v = (View) getSecurityView(mCurrentSecuritySelection);
+        if (v != null) {
+            v.announceForAccessibility(v.getContentDescription());
+        }
+    }
+
+    private KeyguardSecurityView getSecurityView(SecurityMode securityMode) {
+        final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
+        KeyguardSecurityView view = null;
+        final int children = mSecurityViewFlipper.getChildCount();
+        for (int child = 0; child < children; child++) {
+            if (mSecurityViewFlipper.getChildAt(child).getId() == securityViewIdForMode) {
+                view = ((KeyguardSecurityView)mSecurityViewFlipper.getChildAt(child));
+                break;
+            }
+        }
+        int layoutId = getLayoutIdFor(securityMode);
+        if (view == null && layoutId != 0) {
+            final LayoutInflater inflater = LayoutInflater.from(mContext);
+            if (DEBUG) Log.v(TAG, "inflating id = " + layoutId);
+            View v = inflater.inflate(layoutId, mSecurityViewFlipper, false);
+            mSecurityViewFlipper.addView(v);
+            updateSecurityView(v, mIsBouncing);
+            view = (KeyguardSecurityView)v;
+        }
+
+        if (view instanceof KeyguardSelectorView) {
+            KeyguardSelectorView selectorView = (KeyguardSelectorView) view;
+            View carrierText = selectorView.findViewById(R.id.keyguard_selector_fade_container);
+            selectorView.setCarrierArea(carrierText);
+        }
+
+        return view;
+    }
+
+    private void updateSecurityView(View view, boolean isBouncing) {
+        mIsBouncing = isBouncing;
+        if (view instanceof KeyguardSecurityView) {
+            KeyguardSecurityView ksv = (KeyguardSecurityView) view;
+            ksv.setKeyguardCallback(mCallback);
+            ksv.setLockPatternUtils(mLockPatternUtils);
+            if (isBouncing) {
+                ksv.showBouncer(0);
+            } else {
+                ksv.hideBouncer(0);
+            }
+        } else {
+            Log.w(TAG, "View " + view + " is not a KeyguardSecurityView");
+        }
+    }
+
+    protected void onFinishInflate() {
+        mSecurityViewFlipper = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
+        mSecurityViewFlipper.setLockPatternUtils(mLockPatternUtils);
+    }
+
+    public void setLockPatternUtils(LockPatternUtils utils) {
+        mLockPatternUtils = utils;
+        mSecurityModel.setLockPatternUtils(utils);
+        mSecurityViewFlipper.setLockPatternUtils(mLockPatternUtils);
+    }
+
+    private void showDialog(String title, String message) {
+        final AlertDialog dialog = new AlertDialog.Builder(mContext)
+            .setTitle(title)
+            .setMessage(message)
+            .setNeutralButton(R.string.ok, null)
+            .create();
+        if (!(mContext instanceof Activity)) {
+            dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
+        }
+        dialog.show();
+    }
+
+    private void showTimeoutDialog() {
+        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
+        int messageId = 0;
+
+        switch (mSecurityModel.getSecurityMode()) {
+            case Pattern:
+                messageId = R.string.kg_too_many_failed_pattern_attempts_dialog_message;
+                break;
+            case PIN:
+                messageId = R.string.kg_too_many_failed_pin_attempts_dialog_message;
+                break;
+            case Password:
+                messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
+                break;
+            // These don't have timeout dialogs.
+            case Account:
+            case Biometric:
+            case Invalid:
+            case None:
+            case SimPin:
+            case SimPuk:
+                break;
+        }
+
+        if (messageId != 0) {
+            final String message = mContext.getString(messageId,
+                    KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(),
+                    timeoutInSeconds);
+            showDialog(null, message);
+        }
+    }
+
+    private void showAlmostAtWipeDialog(int attempts, int remaining) {
+        String message = mContext.getString(R.string.kg_failed_attempts_almost_at_wipe,
+                attempts, remaining);
+        showDialog(null, message);
+    }
+
+    private void showWipeDialog(int attempts) {
+        String message = mContext.getString(R.string.kg_failed_attempts_now_wiping, attempts);
+        showDialog(null, message);
+    }
+
+    private void showAlmostAtAccountLoginDialog() {
+        final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
+        final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+                - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+        String message = mContext.getString(R.string.kg_failed_attempts_almost_at_login,
+                count, LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, timeoutInSeconds);
+        showDialog(null, message);
+    }
+
+    private void reportFailedUnlockAttempt() {
+        final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
+        final int failedAttempts = monitor.getFailedUnlockAttempts() + 1; // +1 for this time
+
+        if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts);
+
+        SecurityMode mode = mSecurityModel.getSecurityMode();
+        final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern;
+
+        final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
+                .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser());
+
+        final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+                - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+
+        final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
+                (failedAttemptsBeforeWipe - failedAttempts)
+                : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
+
+        boolean showTimeout = false;
+        if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
+            // If we reach this code, it means the user has installed a DevicePolicyManager
+            // that requests device wipe after N attempts.  Once we get below the grace
+            // period, we'll post this dialog every time as a clear warning until the
+            // bombshell hits and the device is wiped.
+            if (remainingBeforeWipe > 0) {
+                showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
+            } else {
+                // Too many attempts. The device will be wiped shortly.
+                Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
+                showWipeDialog(failedAttempts);
+            }
+        } else {
+            showTimeout =
+                (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
+            if (usingPattern && mEnableFallback) {
+                if (failedAttempts == failedAttemptWarning) {
+                    showAlmostAtAccountLoginDialog();
+                    showTimeout = false; // don't show both dialogs
+                } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
+                    mLockPatternUtils.setPermanentlyLocked(true);
+                    showSecurityScreen(SecurityMode.Account);
+                    // don't show timeout dialog because we show account unlock screen next
+                    showTimeout = false;
+                }
+            }
+        }
+        monitor.reportFailedUnlockAttempt();
+        mLockPatternUtils.reportFailedPasswordAttempt();
+        if (showTimeout) {
+            showTimeoutDialog();
+        }
+    }
+
+    /**
+     * Shows the primary security screen for the user. This will be either the multi-selector
+     * or the user's security method.
+     * @param turningOff true if the device is being turned off
+     */
+    void showPrimarySecurityScreen(boolean turningOff) {
+        SecurityMode securityMode = mSecurityModel.getSecurityMode();
+        if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
+        if (!turningOff &&
+                KeyguardUpdateMonitor.getInstance(mContext).isAlternateUnlockEnabled()) {
+            // If we're not turning off, then allow biometric alternate.
+            // We'll reload it when the device comes back on.
+            securityMode = mSecurityModel.getAlternateFor(securityMode);
+        }
+        showSecurityScreen(securityMode);
+    }
+
+    /**
+     * Shows the backup security screen for the current security mode.  This could be used for
+     * password recovery screens but is currently only used for pattern unlock to show the
+     * account unlock screen and biometric unlock to show the user's normal unlock.
+     */
+    private void showBackupSecurityScreen() {
+        if (DEBUG) Log.d(TAG, "showBackupSecurity()");
+        SecurityMode backup = mSecurityModel.getBackupSecurityMode(mCurrentSecuritySelection);
+        showSecurityScreen(backup);
+    }
+
+    private boolean showNextSecurityScreenIfPresent() {
+        SecurityMode securityMode = mSecurityModel.getSecurityMode();
+        // Allow an alternate, such as biometric unlock
+        securityMode = mSecurityModel.getAlternateFor(securityMode);
+        if (SecurityMode.None == securityMode) {
+            return false;
+        } else {
+            showSecurityScreen(securityMode); // switch to the alternate security view
+            return true;
+        }
+    }
+
+    boolean showNextSecurityScreenOrFinish(boolean authenticated) {
+        if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
+        boolean finish = false;
+        if (SecurityMode.None == mCurrentSecuritySelection) {
+            SecurityMode securityMode = mSecurityModel.getSecurityMode();
+            // Allow an alternate, such as biometric unlock
+            securityMode = mSecurityModel.getAlternateFor(securityMode);
+            if (SecurityMode.None == securityMode) {
+                finish = true; // no security required
+            } else {
+                showSecurityScreen(securityMode); // switch to the alternate security view
+            }
+        } else if (authenticated) {
+            switch (mCurrentSecuritySelection) {
+                case Pattern:
+                case Password:
+                case PIN:
+                case Account:
+                case Biometric:
+                    finish = true;
+                    break;
+
+                case SimPin:
+                case SimPuk:
+                    // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
+                    SecurityMode securityMode = mSecurityModel.getSecurityMode();
+                    if (securityMode != SecurityMode.None) {
+                        showSecurityScreen(securityMode);
+                    } else {
+                        finish = true;
+                    }
+                    break;
+
+                default:
+                    Log.v(TAG, "Bad security screen " + mCurrentSecuritySelection + ", fail safe");
+                    showPrimarySecurityScreen(false);
+                    break;
+            }
+        } else {
+            showPrimarySecurityScreen(false);
+        }
+        if (finish) {
+            mSecurityCallback.finish();
+        }
+        return finish;
+    }
+
+    /**
+     * Switches to the given security view unless it's already being shown, in which case
+     * this is a no-op.
+     *
+     * @param securityMode
+     */
+    private void showSecurityScreen(SecurityMode securityMode) {
+        if (DEBUG) Log.d(TAG, "showSecurityScreen(" + securityMode + ")");
+
+        if (securityMode == mCurrentSecuritySelection) return;
+
+        KeyguardSecurityView oldView = getSecurityView(mCurrentSecuritySelection);
+        KeyguardSecurityView newView = getSecurityView(securityMode);
+
+        // Emulate Activity life cycle
+        if (oldView != null) {
+            oldView.onPause();
+            oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
+        }
+        newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
+        newView.setKeyguardCallback(mCallback);
+
+        // Find and show this child.
+        final int childCount = mSecurityViewFlipper.getChildCount();
+
+        final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
+        for (int i = 0; i < childCount; i++) {
+            if (mSecurityViewFlipper.getChildAt(i).getId() == securityViewIdForMode) {
+                mSecurityViewFlipper.setDisplayedChild(i);
+                break;
+            }
+        }
+
+        mCurrentSecuritySelection = securityMode;
+    }
+
+    private KeyguardSecurityViewFlipper getFlipper() {
         for (int i = 0; i < getChildCount(); i++) {
             View child = getChildAt(i);
             if (child instanceof KeyguardSecurityViewFlipper) {
@@ -41,5 +396,129 @@
             flipper.hideBouncer(duration);
         }
     }
+
+    private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
+
+        public void userActivity(long timeout) {
+            if (mSecurityCallback != null) {
+                mSecurityCallback.userActivity(timeout);
+            }
+        }
+
+        public void dismiss(boolean authenticated) {
+            mSecurityCallback.dismiss(authenticated);
+        }
+
+        public boolean isVerifyUnlockOnly() {
+            return mIsVerifyUnlockOnly;
+        }
+
+        public void reportUnlockAttempt(boolean success) {
+            KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
+            if (success) {
+                monitor.clearFailedUnlockAttempts();
+                mLockPatternUtils.reportSuccessfulPasswordAttempt();
+            } else {
+                if (mCurrentSecuritySelection == SecurityMode.Biometric) {
+                    monitor.reportFailedBiometricUnlockAttempt();
+                } else {
+                    KeyguardSecurityContainer.this.reportFailedUnlockAttempt();
+                }
+            }
+        }
+
+        @Override
+        public void showBackupSecurity() {
+            KeyguardSecurityContainer.this.showBackupSecurityScreen();
+        }
+
+    };
+
+    // The following is used to ignore callbacks from SecurityViews that are no longer current
+    // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the
+    // state for the current security method.
+    private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
+        @Override
+        public void userActivity(long timeout) { }
+        @Override
+        public void showBackupSecurity() { }
+        @Override
+        public void reportUnlockAttempt(boolean success) { }
+        @Override
+        public boolean isVerifyUnlockOnly() { return false; }
+        @Override
+        public void dismiss(boolean securityVerified) { }
+    };
+
+    private int getSecurityViewIdForMode(SecurityMode securityMode) {
+        switch (securityMode) {
+            case None: return R.id.keyguard_selector_view;
+            case Pattern: return R.id.keyguard_pattern_view;
+            case PIN: return R.id.keyguard_pin_view;
+            case Password: return R.id.keyguard_password_view;
+            case Biometric: return R.id.keyguard_face_unlock_view;
+            case Account: return R.id.keyguard_account_view;
+            case SimPin: return R.id.keyguard_sim_pin_view;
+            case SimPuk: return R.id.keyguard_sim_puk_view;
+        }
+        return 0;
+    }
+
+    private int getLayoutIdFor(SecurityMode securityMode) {
+        switch (securityMode) {
+            case None: return R.layout.keyguard_selector_view;
+            case Pattern: return R.layout.keyguard_pattern_view;
+            case PIN: return R.layout.keyguard_pin_view;
+            case Password: return R.layout.keyguard_password_view;
+            case Biometric: return R.layout.keyguard_face_unlock_view;
+            case Account: return R.layout.keyguard_account_view;
+            case SimPin: return R.layout.keyguard_sim_pin_view;
+            case SimPuk: return R.layout.keyguard_sim_puk_view;
+            default:
+                return 0;
+        }
+    }
+
+    public SecurityMode getSecurityMode() {
+        return mSecurityModel.getSecurityMode();
+    }
+
+    public void verifyUnlock() {
+        mIsVerifyUnlockOnly = true;
+        showSecurityScreen(getSecurityMode());
+    }
+
+    public SecurityMode getCurrentSecuritySelection() {
+        return mCurrentSecuritySelection;
+    }
+
+    public void dismiss(boolean authenticated) {
+        mCallback.dismiss(authenticated);
+    }
+
+    public boolean needsInput() {
+        return mSecurityViewFlipper.needsInput();
+    }
+
+    @Override
+    public void setKeyguardCallback(KeyguardSecurityCallback callback) {
+        mSecurityViewFlipper.setKeyguardCallback(callback);
+    }
+
+    @Override
+    public void reset() {
+        mSecurityViewFlipper.reset();
+    }
+
+    @Override
+    public KeyguardSecurityCallback getCallback() {
+        return mSecurityViewFlipper.getCallback();
+    }
+
+    @Override
+    public void showUsabilityHint() {
+        mSecurityViewFlipper.showUsabilityHint();
+    }
+
 }
 
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
index 718b06e..97aec68 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
@@ -58,23 +58,6 @@
             final int resId = mGlowPadView.getResourceIdForTarget(target);
 
             switch (resId) {
-                case R.drawable.ic_action_assist_generic:
-                    Intent assistIntent =
-                            ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
-                            .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
-                    if (assistIntent != null) {
-                        mActivityLauncher.launchActivity(assistIntent, false, true, null, null);
-                    } else {
-                        Log.w(TAG, "Failed to get intent for assist activity");
-                    }
-                    mCallback.userActivity(0);
-                    break;
-
-                case R.drawable.ic_lockscreen_camera:
-                    mActivityLauncher.launchCamera(null, null);
-                    mCallback.userActivity(0);
-                    break;
-
                 case R.drawable.ic_lockscreen_unlock_phantom:
                 case R.drawable.ic_lockscreen_unlock:
                     mCallback.userActivity(0);
@@ -117,23 +100,6 @@
         }
     };
 
-    private final KeyguardActivityLauncher mActivityLauncher = new KeyguardActivityLauncher() {
-
-        @Override
-        KeyguardSecurityCallback getCallback() {
-            return mCallback;
-        }
-
-        @Override
-        LockPatternUtils getLockPatternUtils() {
-            return mLockPatternUtils;
-        }
-
-        @Override
-        Context getContext() {
-            return mContext;
-        }};
-
     public KeyguardSelectorView(Context context) {
         this(context, null);
     }
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 5cf3a83..024d0c3 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -173,7 +173,7 @@
     gContextId             = _env->GetFieldID(_this, "mContext", "J");
 
     jclass bitmapClass = _env->FindClass("android/graphics/Bitmap");
-    gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
+    gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
 }
 
 // ---------------------------------------------------------------------------
@@ -578,7 +578,7 @@
 nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+            (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
 
     bitmap.lockPixels();
@@ -594,7 +594,7 @@
 nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+            (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
 
     bitmap.lockPixels();
@@ -610,7 +610,7 @@
 nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+            (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
 
     bitmap.lockPixels();
@@ -626,7 +626,7 @@
 nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+            (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
     int w = bitmap.width();
     int h = bitmap.height();
@@ -643,7 +643,7 @@
 nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
 {
     SkBitmap const * nativeBitmap =
-            (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+            (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
     const SkBitmap& bitmap(*nativeBitmap);
 
     bitmap.lockPixels();
diff --git a/services/core/java/com/android/server/AssetAtlasService.java b/services/core/java/com/android/server/AssetAtlasService.java
index 26b4652..3fb006b 100644
--- a/services/core/java/com/android/server/AssetAtlasService.java
+++ b/services/core/java/com/android/server/AssetAtlasService.java
@@ -288,8 +288,8 @@
                         }
                         canvas.drawBitmap(bitmap, 0.0f, 0.0f, null);
                         canvas.restore();
-
-                        atlasMap[mapIndex++] = bitmap.mNativeBitmap;
+                        // TODO: Change mAtlasMap to long[] to support 64-bit systems
+                        atlasMap[mapIndex++] = (int) bitmap.mNativeBitmap;
                         atlasMap[mapIndex++] = entry.x;
                         atlasMap[mapIndex++] = entry.y;
                         atlasMap[mapIndex++] = entry.rotated ? 1 : 0;
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 4d863dc..70d85fc 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1099,6 +1099,7 @@
                             if (!r.visible) {
                                 if (DEBUG_VISBILITY) Slog.v(
                                         TAG, "Starting and making visible: " + r);
+                                r.visible = true;
                                 mWindowManager.setAppVisibility(r.appToken, true);
                             }
                             if (r != starting) {
diff --git a/services/core/jni/com_android_server_AssetAtlasService.cpp b/services/core/jni/com_android_server_AssetAtlasService.cpp
index 885d21e..4a1b55d 100644
--- a/services/core/jni/com_android_server_AssetAtlasService.cpp
+++ b/services/core/jni/com_android_server_AssetAtlasService.cpp
@@ -54,11 +54,11 @@
     jfieldID mNativeCanvas;
 } gCanvasFinalizerClassInfo;
 
-#define GET_INT(object, field) \
-    env->GetIntField(object, field)
+#define GET_LONG(object, field) \
+    env->GetLongField(object, field)
 
-#define SET_INT(object, field, value) \
-    env->SetIntField(object, field, value)
+#define SET_LONG(object, field, value) \
+    env->SetLongField(object, field, value)
 
 // ----------------------------------------------------------------------------
 // Canvas management
@@ -67,9 +67,9 @@
 static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
     jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
     SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
-            GET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas));
-    SET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas, (int) newCanvas);
-    SET_INT(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int) newCanvas);
+            GET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas));
+    SET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas, (long) newCanvas);
+    SET_LONG(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (long) newCanvas);
     SkSafeUnref(previousCanvas);
 }
 
@@ -261,10 +261,10 @@
     FIND_CLASS(clazz, "android/graphics/Canvas");
     GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
             "Landroid/graphics/Canvas$CanvasFinalizer;");
-    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
 
     FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
-    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+    GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
 
     return jniRegisterNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
index a50a2bd..34ae825 100644
--- a/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
@@ -61,7 +61,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int opColor, int tolerance, int nativeMode) {
+    /*package*/ static long nativeCreate(int opColor, int tolerance, int nativeMode) {
         AvoidXfermode_Delegate newDelegate = new AvoidXfermode_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
index 65a75b0..cdbbe46 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
@@ -65,7 +65,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int native_bitmap, int shaderTileModeX,
+    /*package*/ static long nativeCreate(long native_bitmap, int shaderTileModeX,
             int shaderTileModeY) {
         Bitmap_Delegate bitmap = Bitmap_Delegate.getDelegate(native_bitmap);
         if (bitmap == null) {
@@ -80,7 +80,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate(int native_shader, int native_bitmap,
+    /*package*/ static long nativePostCreate(long native_shader, long native_bitmap,
             int shaderTileModeX, int shaderTileModeY) {
         // pass, not needed.
         return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index 2787eca..0bdc28d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -83,7 +83,7 @@
     /**
      * Returns the native delegate associated to a given an int referencing a {@link Bitmap} object.
      */
-    public static Bitmap_Delegate getDelegate(int native_bitmap) {
+    public static Bitmap_Delegate getDelegate(long native_bitmap) {
         return sManager.getDelegate(native_bitmap);
     }
 
@@ -272,7 +272,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static Bitmap nativeCopy(int srcBitmap, int nativeConfig, boolean isMutable) {
+    /*package*/ static Bitmap nativeCopy(long srcBitmap, int nativeConfig, boolean isMutable) {
         Bitmap_Delegate srcBmpDelegate = sManager.getDelegate(srcBitmap);
         if (srcBmpDelegate == null) {
             return null;
@@ -301,17 +301,17 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int nativeBitmap) {
+    /*package*/ static void nativeDestructor(long nativeBitmap) {
         sManager.removeJavaReferenceFor(nativeBitmap);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeRecycle(int nativeBitmap) {
+    /*package*/ static void nativeRecycle(long nativeBitmap) {
         sManager.removeJavaReferenceFor(nativeBitmap);
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
+    /*package*/ static boolean nativeCompress(long nativeBitmap, int format, int quality,
             OutputStream stream, byte[] tempStorage) {
         Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.compress() is not supported", null /*data*/);
@@ -319,7 +319,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeErase(int nativeBitmap, int color) {
+    /*package*/ static void nativeErase(long nativeBitmap, int color) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -339,7 +339,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeWidth(int nativeBitmap) {
+    /*package*/ static int nativeWidth(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -350,7 +350,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeHeight(int nativeBitmap) {
+    /*package*/ static int nativeHeight(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -361,7 +361,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeRowBytes(int nativeBitmap) {
+    /*package*/ static int nativeRowBytes(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -372,7 +372,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConfig(int nativeBitmap) {
+    /*package*/ static int nativeConfig(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -383,7 +383,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeHasAlpha(int nativeBitmap) {
+    /*package*/ static boolean nativeHasAlpha(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -394,7 +394,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeHasMipMap(int nativeBitmap) {
+    /*package*/ static boolean nativeHasMipMap(long nativeBitmap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -405,7 +405,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeGetPixel(int nativeBitmap, int x, int y) {
+    /*package*/ static int nativeGetPixel(long nativeBitmap, int x, int y) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -416,7 +416,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeGetPixels(int nativeBitmap, int[] pixels, int offset,
+    /*package*/ static void nativeGetPixels(long nativeBitmap, int[] pixels, int offset,
             int stride, int x, int y, int width, int height) {
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -428,7 +428,7 @@
 
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetPixel(int nativeBitmap, int x, int y, int color) {
+    /*package*/ static void nativeSetPixel(long nativeBitmap, int x, int y, int color) {
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
             return;
@@ -438,7 +438,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetPixels(int nativeBitmap, int[] colors, int offset,
+    /*package*/ static void nativeSetPixels(long nativeBitmap, int[] colors, int offset,
             int stride, int x, int y, int width, int height) {
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -449,21 +449,21 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeCopyPixelsToBuffer(int nativeBitmap, Buffer dst) {
+    /*package*/ static void nativeCopyPixelsToBuffer(long nativeBitmap, Buffer dst) {
         // FIXME implement native delegate
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.copyPixelsToBuffer is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeCopyPixelsFromBuffer(int nb, Buffer src) {
+    /*package*/ static void nativeCopyPixelsFromBuffer(long nb, Buffer src) {
         // FIXME implement native delegate
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.copyPixelsFromBuffer is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeGenerationId(int nativeBitmap) {
+    /*package*/ static int nativeGenerationId(long nativeBitmap) {
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
             return 0;
@@ -483,7 +483,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeWriteToParcel(int nativeBitmap, boolean isMutable,
+    /*package*/ static boolean nativeWriteToParcel(long nativeBitmap, boolean isMutable,
             int density, Parcel p) {
         // This is only called when sending a bitmap through aidl, so really this should not
         // be called.
@@ -494,7 +494,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static Bitmap nativeExtractAlpha(int nativeBitmap, int nativePaint,
+    /*package*/ static Bitmap nativeExtractAlpha(long nativeBitmap, long nativePaint,
             int[] offsetXY) {
         Bitmap_Delegate bitmap = sManager.getDelegate(nativeBitmap);
         if (bitmap == null) {
@@ -522,12 +522,12 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativePrepareToDraw(int nativeBitmap) {
+    /*package*/ static void nativePrepareToDraw(long nativeBitmap) {
         // nothing to be done here.
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetHasAlpha(int nativeBitmap, boolean hasAlpha) {
+    /*package*/ static void nativeSetHasAlpha(long nativeBitmap, boolean hasAlpha) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -538,7 +538,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetHasMipMap(int nativeBitmap, boolean hasMipMap) {
+    /*package*/ static void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
@@ -549,7 +549,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeSameAs(int nb0, int nb1) {
+    /*package*/ static boolean nativeSameAs(long nb0, long nb1) {
         Bitmap_Delegate delegate1 = sManager.getDelegate(nb0);
         if (delegate1 == null) {
             return false;
@@ -602,7 +602,7 @@
     private static Bitmap createBitmap(Bitmap_Delegate delegate,
             Set<BitmapCreateFlags> createFlags, int density) {
         // get its native_int
-        int nativeInt = sManager.addNewDelegate(delegate);
+        long nativeInt = sManager.addNewDelegate(delegate);
 
         int width = delegate.mImage.getWidth();
         int height = delegate.mImage.getHeight();
diff --git a/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
index 4becba1..d2569c7 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
@@ -55,7 +55,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConstructor(float radius, int style) {
+    /*package*/ static long nativeConstructor(float radius, int style) {
         BlurMaskFilter_Delegate newDelegate = new BlurMaskFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index 62b47bd..ba771dd 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -77,7 +77,7 @@
     /**
      * Returns the native delegate associated to a given an int referencing a {@link Canvas} object.
      */
-    public static Canvas_Delegate getDelegate(int native_canvas) {
+    public static Canvas_Delegate getDelegate(long native_canvas) {
         return sManager.getDelegate(native_canvas);
     }
 
@@ -310,7 +310,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int initRaster(int nativeBitmapOrZero) {
+    /*package*/ static long initRaster(long nativeBitmapOrZero) {
         if (nativeBitmapOrZero > 0) {
             // get the Bitmap from the int
             Bitmap_Delegate bitmapDelegate = Bitmap_Delegate.getDelegate(nativeBitmapOrZero);
@@ -328,7 +328,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void copyNativeCanvasState(int srcCanvas, int dstCanvas) {
+    /*package*/ static void copyNativeCanvasState(long srcCanvas, long dstCanvas) {
         // get the delegate from the native int.
         Canvas_Delegate srcCanvasDelegate = sManager.getDelegate(srcCanvas);
         if (srcCanvasDelegate == null) {
@@ -344,8 +344,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_saveLayer(int nativeCanvas, RectF bounds,
-                                               int paint, int layerFlags) {
+    /*package*/ static long native_saveLayer(long nativeCanvas, RectF bounds,
+                                               long paint, int layerFlags) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -361,9 +361,9 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_saveLayer(int nativeCanvas, float l,
+    /*package*/ static long native_saveLayer(long nativeCanvas, float l,
                                                float t, float r, float b,
-                                               int paint, int layerFlags) {
+                                               long paint, int layerFlags) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -380,7 +380,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_saveLayerAlpha(int nativeCanvas,
+    /*package*/ static long native_saveLayerAlpha(long nativeCanvas,
                                                     RectF bounds, int alpha,
                                                     int layerFlags) {
         // get the delegate from the native int.
@@ -393,7 +393,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_saveLayerAlpha(int nativeCanvas, float l,
+    /*package*/ static long native_saveLayerAlpha(long nativeCanvas, float l,
                                                     float t, float r, float b,
                                                     int alpha, int layerFlags) {
         // get the delegate from the native int.
@@ -407,7 +407,7 @@
 
 
     @LayoutlibDelegate
-    /*package*/ static void native_concat(int nCanvas, int nMatrix) {
+    /*package*/ static void native_concat(long nCanvas, long nMatrix) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
         if (canvasDelegate == null) {
@@ -435,7 +435,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setMatrix(int nCanvas, int nMatrix) {
+    /*package*/ static void native_setMatrix(long nCanvas, long nMatrix) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
         if (canvasDelegate == null) {
@@ -465,7 +465,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_clipRect(int nCanvas,
+    /*package*/ static boolean native_clipRect(long nCanvas,
                                                   float left, float top,
                                                   float right, float bottom,
                                                   int regionOp) {
@@ -480,8 +480,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_clipPath(int nativeCanvas,
-                                                  int nativePath,
+    /*package*/ static boolean native_clipPath(long nativeCanvas,
+                                                  long nativePath,
                                                   int regionOp) {
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -497,8 +497,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_clipRegion(int nativeCanvas,
-                                                    int nativeRegion,
+    /*package*/ static boolean native_clipRegion(long nativeCanvas,
+                                                    long nativeRegion,
                                                     int regionOp) {
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -514,7 +514,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetDrawFilter(int nativeCanvas, int nativeFilter) {
+    /*package*/ static void nativeSetDrawFilter(long nativeCanvas, long nativeFilter) {
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
             return;
@@ -530,7 +530,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_getClipBounds(int nativeCanvas,
+    /*package*/ static boolean native_getClipBounds(long nativeCanvas,
                                                        Rect bounds) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
@@ -551,7 +551,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_getCTM(int canvas, int matrix) {
+    /*package*/ static void native_getCTM(long canvas, long matrix) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(canvas);
         if (canvasDelegate == null) {
@@ -568,21 +568,21 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_quickReject(int nativeCanvas,
+    /*package*/ static boolean native_quickReject(long nativeCanvas,
                                                      RectF rect) {
         // FIXME properly implement quickReject
         return false;
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_quickReject(int nativeCanvas,
-                                                     int path) {
+    /*package*/ static boolean native_quickReject(long nativeCanvas,
+                                                     long path) {
         // FIXME properly implement quickReject
         return false;
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_quickReject(int nativeCanvas,
+    /*package*/ static boolean native_quickReject(long nativeCanvas,
                                                      float left, float top,
                                                      float right, float bottom) {
         // FIXME properly implement quickReject
@@ -590,25 +590,25 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawRGB(int nativeCanvas, int r, int g, int b) {
+    /*package*/ static void native_drawRGB(long nativeCanvas, int r, int g, int b) {
         native_drawColor(nativeCanvas, 0xFF000000 | r << 16 | (g&0xFF) << 8 | (b&0xFF),
                 PorterDuff.Mode.SRC_OVER.nativeInt);
 
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawARGB(int nativeCanvas, int a, int r, int g, int b) {
+    /*package*/ static void native_drawARGB(long nativeCanvas, int a, int r, int g, int b) {
         native_drawColor(nativeCanvas, a << 24 | (r&0xFF) << 16 | (g&0xFF) << 8 | (b&0xFF),
                 PorterDuff.Mode.SRC_OVER.nativeInt);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawColor(int nativeCanvas, int color) {
+    /*package*/ static void native_drawColor(long nativeCanvas, int color) {
         native_drawColor(nativeCanvas, color, PorterDuff.Mode.SRC_OVER.nativeInt);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawColor(int nativeCanvas, final int color, final int mode) {
+    /*package*/ static void native_drawColor(long nativeCanvas, final int color, final int mode) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -639,16 +639,16 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawPaint(int nativeCanvas, int paint) {
+    /*package*/ static void native_drawPaint(long nativeCanvas, long paint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawPaint is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawLine(int nativeCanvas,
+    /*package*/ static void native_drawLine(long nativeCanvas,
             final float startX, final float startY, final float stopX, final float stopY,
-            int paint) {
+            long paint) {
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
@@ -660,14 +660,13 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawRect(int nativeCanvas, RectF rect,
-                                               int paint) {
+    /*package*/ static void native_drawRect(long nativeCanvas, RectF rect, long paint) {
         native_drawRect(nativeCanvas, rect.left, rect.top, rect.right, rect.bottom, paint);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawRect(int nativeCanvas,
-            final float left, final float top, final float right, final float bottom, int paint) {
+    /*package*/ static void native_drawRect(long nativeCanvas,
+            final float left, final float top, final float right, final float bottom, long paint) {
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
@@ -692,7 +691,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawOval(int nativeCanvas, final RectF oval, int paint) {
+    /*package*/ static void native_drawOval(long nativeCanvas, final RectF oval, long paint) {
         if (oval.right > oval.left && oval.bottom > oval.top) {
             draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                     new GcSnapshot.Drawable() {
@@ -718,17 +717,17 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawCircle(int nativeCanvas,
-            float cx, float cy, float radius, int paint) {
+    /*package*/ static void native_drawCircle(long nativeCanvas,
+            float cx, float cy, float radius, long paint) {
         native_drawOval(nativeCanvas,
                 new RectF(cx - radius, cy - radius, cx + radius, cy + radius),
                 paint);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawArc(int nativeCanvas,
+    /*package*/ static void native_drawArc(long nativeCanvas,
             final RectF oval, final float startAngle, final float sweep,
-            final boolean useCenter, int paint) {
+            final boolean useCenter, long paint) {
         if (oval.right > oval.left && oval.bottom > oval.top) {
             draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                     new GcSnapshot.Drawable() {
@@ -757,8 +756,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawRoundRect(int nativeCanvas,
-            final RectF rect, final float rx, final float ry, int paint) {
+    /*package*/ static void native_drawRoundRect(long nativeCanvas,
+            final RectF rect, final float rx, final float ry, long paint) {
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
@@ -787,7 +786,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawPath(int nativeCanvas, int path, int paint) {
+    /*package*/ static void native_drawPath(long nativeCanvas, int path, long paint) {
         final Path_Delegate pathDelegate = Path_Delegate.getDelegate(path);
         if (pathDelegate == null) {
             return;
@@ -814,9 +813,9 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawBitmap(Canvas thisCanvas, int nativeCanvas, int bitmap,
+    /*package*/ static void native_drawBitmap(Canvas thisCanvas, long nativeCanvas, long bitmap,
                                                  float left, float top,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int canvasDensity,
                                                  int screenDensity,
                                                  int bitmapDensity) {
@@ -836,9 +835,9 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawBitmap(Canvas thisCanvas, int nativeCanvas, int bitmap,
+    /*package*/ static void native_drawBitmap(Canvas thisCanvas, long nativeCanvas, long bitmap,
                                                  Rect src, RectF dst,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int screenDensity,
                                                  int bitmapDensity) {
         // get the delegate from the native int.
@@ -861,9 +860,9 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawBitmap(int nativeCanvas, int bitmap,
+    /*package*/ static void native_drawBitmap(long nativeCanvas, long bitmap,
                                                  Rect src, Rect dst,
-                                                 int nativePaintOrZero,
+                                                 long nativePaintOrZero,
                                                  int screenDensity,
                                                  int bitmapDensity) {
         // get the delegate from the native int.
@@ -886,11 +885,11 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawBitmap(int nativeCanvas, int[] colors,
+    /*package*/ static void native_drawBitmap(long nativeCanvas, int[] colors,
                                                 int offset, int stride, final float x,
                                                  final float y, int width, int height,
                                                  boolean hasAlpha,
-                                                 int nativePaintOrZero) {
+                                                 long nativePaintOrZero) {
 
         // create a temp BufferedImage containing the content.
         final BufferedImage image = new BufferedImage(width, height,
@@ -912,8 +911,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDrawBitmapMatrix(int nCanvas, int nBitmap,
-                                                      int nMatrix, int nPaint) {
+    /*package*/ static void nativeDrawBitmapMatrix(long nCanvas, long nBitmap,
+                                                      long nMatrix, long nPaint) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
         if (canvasDelegate == null) {
@@ -953,30 +952,30 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDrawBitmapMesh(int nCanvas, int nBitmap,
+    /*package*/ static void nativeDrawBitmapMesh(long nCanvas, long nBitmap,
             int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors,
-            int colorOffset, int nPaint) {
+            int colorOffset, long nPaint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawBitmapMesh is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDrawVertices(int nCanvas, int mode, int n,
+    /*package*/ static void nativeDrawVertices(long nCanvas, int mode, int n,
             float[] verts, int vertOffset,
             float[] texs, int texOffset,
             int[] colors, int colorOffset,
             short[] indices, int indexOffset,
-            int indexCount, int nPaint) {
+            int indexCount, long nPaint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawVertices is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawText(int nativeCanvas,
+    /*package*/ static void native_drawText(long nativeCanvas,
             final char[] text, final int index, final int count,
-            final float startX, final float startY, final int flags, int paint) {
+            final float startX, final float startY, final int flags, long paint) {
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
@@ -1005,8 +1004,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawText(int nativeCanvas, String text,
-            int start, int end, float x, float y, final int flags, int paint) {
+    /*package*/ static void native_drawText(long nativeCanvas, String text,
+            int start, int end, float x, float y, final int flags, long paint) {
         int count = end - start;
         char[] buffer = TemporaryBuffer.obtain(count);
         TextUtils.getChars(text, start, end, buffer, 0);
@@ -1015,9 +1014,9 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawTextRun(int nativeCanvas, String text,
+    /*package*/ static void native_drawTextRun(long nativeCanvas, String text,
             int start, int end, int contextStart, int contextEnd,
-            float x, float y, int flags, int paint) {
+            float x, float y, int flags, long paint) {
         int count = end - start;
         char[] buffer = TemporaryBuffer.obtain(count);
         TextUtils.getChars(text, start, end, buffer, 0);
@@ -1026,56 +1025,56 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawTextRun(int nativeCanvas, char[] text,
+    /*package*/ static void native_drawTextRun(long nativeCanvas, char[] text,
             int start, int count, int contextStart, int contextCount,
-            float x, float y, int flags, int paint) {
+            float x, float y, int flags, long paint) {
         native_drawText(nativeCanvas, text, start, count, x, y, flags, paint);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawPosText(int nativeCanvas,
+    /*package*/ static void native_drawPosText(long nativeCanvas,
                                                   char[] text, int index,
                                                   int count, float[] pos,
-                                                  int paint) {
+                                                  long paint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawPosText is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawPosText(int nativeCanvas,
+    /*package*/ static void native_drawPosText(long nativeCanvas,
                                                   String text, float[] pos,
-                                                  int paint) {
+                                                  long paint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawPosText is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawTextOnPath(int nativeCanvas,
+    /*package*/ static void native_drawTextOnPath(long nativeCanvas,
                                                      char[] text, int index,
-                                                     int count, int path,
+                                                     int count, long path,
                                                      float hOffset,
                                                      float vOffset, int bidiFlags,
-                                                     int paint) {
+                                                     long paint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawTextOnPath is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawTextOnPath(int nativeCanvas,
-                                                     String text, int path,
+    /*package*/ static void native_drawTextOnPath(long nativeCanvas,
+                                                     String text, long path,
                                                      float hOffset,
                                                      float vOffset,
-                                                     int flags, int paint) {
+                                                     int flags, long paint) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawTextOnPath is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int nativeCanvas) {
+    /*package*/ static void finalizer(long nativeCanvas) {
         // get the delegate from the native int so that it can be disposed.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
         if (canvasDelegate == null) {
@@ -1095,7 +1094,7 @@
      * <p>Note that the drawable may actually be executed several times if there are
      * layers involved (see {@link #saveLayer(RectF, int, int)}.
      */
-    private static void draw(int nCanvas, int nPaint, boolean compositeOnly, boolean forceSrcMode,
+    private static void draw(long nCanvas, long nPaint, boolean compositeOnly, boolean forceSrcMode,
             GcSnapshot.Drawable drawable) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
@@ -1115,7 +1114,7 @@
      * <p>Note that the drawable may actually be executed several times if there are
      * layers involved (see {@link #saveLayer(RectF, int, int)}.
      */
-    private static void draw(int nCanvas, GcSnapshot.Drawable drawable) {
+    private static void draw(long nCanvas, GcSnapshot.Drawable drawable) {
         // get the delegate from the native int.
         Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
         if (canvasDelegate == null) {
@@ -1193,9 +1192,9 @@
     }
 
     private static void drawBitmap(
-            int nativeCanvas,
+            long nativeCanvas,
             Bitmap_Delegate bitmap,
-            int nativePaintOrZero,
+            long nativePaintOrZero,
             final int sleft, final int stop, final int sright, final int sbottom,
             final int dleft, final int dtop, final int dright, final int dbottom) {
         // get the delegate from the native int.
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
index e5a7ab6..d6b3da1 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
@@ -46,7 +46,7 @@
 
     // ---- Public Helper methods ----
 
-    public static ColorFilter_Delegate getDelegate(int nativeShader) {
+    public static ColorFilter_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -56,7 +56,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int native_instance, int nativeColorFilter) {
+    /*package*/ static void finalizer(long native_instance, long nativeColorFilter) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
index 2de344b..ca8f450 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
@@ -55,13 +55,13 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeColorMatrixFilter(float[] array) {
+    /*package*/ static long nativeColorMatrixFilter(float[] array) {
         ColorMatrixColorFilter_Delegate newDelegate = new ColorMatrixColorFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nColorMatrixFilter(int nativeFilter, float[] array) {
+    /*package*/ static long nColorMatrixFilter(long nativeFilter, float[] array) {
         // pass
         return 0;
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
index 7c04a87..bc3df7d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
@@ -62,7 +62,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int outerpe, int innerpe) {
+    /*package*/ static long nativeCreate(long outerpe, long innerpe) {
         ComposePathEffect_Delegate newDelegate = new ComposePathEffect_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
index f6e1d00..fae8aef 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
@@ -63,15 +63,15 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate1(int native_shaderA, int native_shaderB,
-            int native_mode) {
+    /*package*/ static long nativeCreate1(long native_shaderA, long native_shaderB,
+            long native_mode) {
         // FIXME not supported yet.
         ComposeShader_Delegate newDelegate = new ComposeShader_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate2(int native_shaderA, int native_shaderB,
+    /*package*/ static long nativeCreate2(long native_shaderA, long native_shaderB,
             int porterDuffMode) {
         // FIXME not supported yet.
         ComposeShader_Delegate newDelegate = new ComposeShader_Delegate();
@@ -79,15 +79,15 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate1(int native_shader, int native_skiaShaderA,
-            int native_skiaShaderB, int native_mode) {
+    /*package*/ static long nativePostCreate1(long native_shader, long native_skiaShaderA,
+            long native_skiaShaderB, long native_mode) {
         // pass, not needed.
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate2(int native_shader, int native_skiaShaderA,
-            int native_skiaShaderB, int porterDuffMode) {
+    /*package*/ static long nativePostCreate2(long native_shader, long native_skiaShaderA,
+            long native_skiaShaderB, int porterDuffMode) {
         // pass, not needed.
         return 0;
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
index b0f8168..73745c3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
@@ -62,7 +62,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(float radius) {
+    /*package*/ static long nativeCreate(float radius) {
         CornerPathEffect_Delegate newDelegate = new CornerPathEffect_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
index d97c2ec..881afde 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
@@ -73,7 +73,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(float intervals[], float phase) {
+    /*package*/ static long nativeCreate(float intervals[], float phase) {
         DashPathEffect_Delegate newDelegate = new DashPathEffect_Delegate(intervals, phase);
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
index ec4a810..46109f3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
@@ -62,7 +62,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(float length, float deviation) {
+    /*package*/ static long nativeCreate(float length, float deviation) {
         DiscretePathEffect_Delegate newDelegate = new DiscretePathEffect_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
index 870c46b..2e10740 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
@@ -46,7 +46,7 @@
 
     // ---- Public Helper methods ----
 
-    public static DrawFilter_Delegate getDelegate(int nativeDrawFilter) {
+    public static DrawFilter_Delegate getDelegate(long nativeDrawFilter) {
         return sManager.getDelegate(nativeDrawFilter);
     }
 
@@ -56,7 +56,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int nativeDrawFilter) {
+    /*package*/ static void nativeDestructor(long nativeDrawFilter) {
         sManager.removeJavaReferenceFor(nativeDrawFilter);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
index ebc1c1d..e5040cc 100644
--- a/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
@@ -55,7 +55,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConstructor(float[] direction, float ambient,
+    /*package*/ static long nativeConstructor(float[] direction, float ambient,
             float specular, float blurRadius) {
         EmbossMaskFilter_Delegate newDelegate = new EmbossMaskFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
diff --git a/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
index 51e0576..10cc572 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
@@ -55,13 +55,13 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConstructor() {
+    /*package*/ static long nativeConstructor() {
         LayerRasterizer_Delegate newDelegate = new LayerRasterizer_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeAddLayer(int native_layer, int native_paint, float dx, float dy) {
+    /*package*/ static void nativeAddLayer(long native_layer, long native_paint, float dx, float dy) {
 
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
index 0ee883d..defaac3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
@@ -55,13 +55,13 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int native_CreateLightingFilter(int mul, int add) {
+    /*package*/ static long native_CreateLightingFilter(int mul, int add) {
         LightingColorFilter_Delegate newDelegate = new LightingColorFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nCreateLightingFilter(int nativeFilter, int mul, int add) {
+    /*package*/ static int nCreateLightingFilter(long nativeFilter, int mul, int add) {
         // pass
         return 0;
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
index f117fca..ac77377 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
@@ -54,7 +54,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate1(LinearGradient thisGradient,
+    /*package*/ static long nativeCreate1(LinearGradient thisGradient,
             float x0, float y0, float x1, float y1,
             int colors[], float positions[], int tileMode) {
         LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(x0, y0, x1, y1,
@@ -63,7 +63,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate2(LinearGradient thisGradient,
+    /*package*/ static long nativeCreate2(LinearGradient thisGradient,
             float x0, float y0, float x1, float y1,
             int color0, int color1, int tileMode) {
         return nativeCreate1(thisGradient,
@@ -72,16 +72,16 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate1(LinearGradient thisGradient,
-            int native_shader, float x0, float y0, float x1, float y1,
+    /*package*/ static long nativePostCreate1(LinearGradient thisGradient,
+            long native_shader, float x0, float y0, float x1, float y1,
             int colors[], float positions[], int tileMode) {
         // nothing to be done here.
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate2(LinearGradient thisGradient,
-            int native_shader, float x0, float y0, float x1, float y1,
+    /*package*/ static long nativePostCreate2(LinearGradient thisGradient,
+            long native_shader, float x0, float y0, float x1, float y1,
             int color0, int color1, int tileMode) {
         // nothing to be done here.
         return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
index c2f27e4..e726c59 100644
--- a/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
@@ -46,7 +46,7 @@
 
     // ---- Public Helper methods ----
 
-    public static MaskFilter_Delegate getDelegate(int nativeShader) {
+    public static MaskFilter_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -56,7 +56,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int native_filter) {
+    /*package*/ static void nativeDestructor(long native_filter) {
         sManager.removeJavaReferenceFor(native_filter);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
index 5df2a21..1d66586 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
@@ -53,7 +53,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Matrix_Delegate getDelegate(int native_instance) {
+    public static Matrix_Delegate getDelegate(long native_instance) {
         return sManager.getDelegate(native_instance);
     }
 
@@ -174,7 +174,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int native_create(int native_src_or_zero) {
+    /*package*/ static long native_create(long native_src_or_zero) {
         // create the delegate
         Matrix_Delegate newDelegate = new Matrix_Delegate();
 
@@ -193,7 +193,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_isIdentity(int native_object) {
+    /*package*/ static boolean native_isIdentity(long native_object) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -203,7 +203,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_rectStaysRect(int native_object) {
+    /*package*/ static boolean native_rectStaysRect(long native_object) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return true;
@@ -213,7 +213,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_reset(int native_object) {
+    /*package*/ static void native_reset(long native_object) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -223,7 +223,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_set(int native_object, int other) {
+    /*package*/ static void native_set(long native_object, long other) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -238,7 +238,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setTranslate(int native_object, float dx, float dy) {
+    /*package*/ static void native_setTranslate(long native_object, float dx, float dy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -248,7 +248,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setScale(int native_object, float sx, float sy,
+    /*package*/ static void native_setScale(long native_object, float sx, float sy,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -259,7 +259,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setScale(int native_object, float sx, float sy) {
+    /*package*/ static void native_setScale(long native_object, float sx, float sy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -277,7 +277,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setRotate(int native_object, float degrees, float px, float py) {
+    /*package*/ static void native_setRotate(long native_object, float degrees, float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -287,7 +287,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setRotate(int native_object, float degrees) {
+    /*package*/ static void native_setRotate(long native_object, float degrees) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -297,7 +297,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setSinCos(int native_object, float sinValue, float cosValue,
+    /*package*/ static void native_setSinCos(long native_object, float sinValue, float cosValue,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -316,7 +316,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setSinCos(int native_object, float sinValue, float cosValue) {
+    /*package*/ static void native_setSinCos(long native_object, float sinValue, float cosValue) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -326,7 +326,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setSkew(int native_object, float kx, float ky,
+    /*package*/ static void native_setSkew(long native_object, float kx, float ky,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -337,7 +337,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setSkew(int native_object, float kx, float ky) {
+    /*package*/ static void native_setSkew(long native_object, float kx, float ky) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -355,7 +355,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_setConcat(int native_object, int a, int b) {
+    /*package*/ static boolean native_setConcat(long native_object, long a, long b) {
         if (a == native_object) {
             return native_preConcat(native_object, b);
         } else if (b == native_object) {
@@ -383,7 +383,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preTranslate(int native_object, float dx, float dy) {
+    /*package*/ static boolean native_preTranslate(long native_object, float dx, float dy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -394,7 +394,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preScale(int native_object, float sx, float sy,
+    /*package*/ static boolean native_preScale(long native_object, float sx, float sy,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -406,7 +406,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preScale(int native_object, float sx, float sy) {
+    /*package*/ static boolean native_preScale(long native_object, float sx, float sy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -417,7 +417,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preRotate(int native_object, float degrees,
+    /*package*/ static boolean native_preRotate(long native_object, float degrees,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -429,7 +429,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preRotate(int native_object, float degrees) {
+    /*package*/ static boolean native_preRotate(long native_object, float degrees) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -444,7 +444,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preSkew(int native_object, float kx, float ky,
+    /*package*/ static boolean native_preSkew(long native_object, float kx, float ky,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -456,7 +456,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preSkew(int native_object, float kx, float ky) {
+    /*package*/ static boolean native_preSkew(long native_object, float kx, float ky) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -467,7 +467,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_preConcat(int native_object, int other_matrix) {
+    /*package*/ static boolean native_preConcat(long native_object, long other_matrix) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -483,7 +483,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postTranslate(int native_object, float dx, float dy) {
+    /*package*/ static boolean native_postTranslate(long native_object, float dx, float dy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -494,7 +494,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postScale(int native_object, float sx, float sy,
+    /*package*/ static boolean native_postScale(long native_object, float sx, float sy,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -506,7 +506,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postScale(int native_object, float sx, float sy) {
+    /*package*/ static boolean native_postScale(long native_object, float sx, float sy) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -517,7 +517,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postRotate(int native_object, float degrees,
+    /*package*/ static boolean native_postRotate(long native_object, float degrees,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -529,7 +529,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postRotate(int native_object, float degrees) {
+    /*package*/ static boolean native_postRotate(long native_object, float degrees) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -540,7 +540,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postSkew(int native_object, float kx, float ky,
+    /*package*/ static boolean native_postSkew(long native_object, float kx, float ky,
             float px, float py) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -552,7 +552,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postSkew(int native_object, float kx, float ky) {
+    /*package*/ static boolean native_postSkew(long native_object, float kx, float ky) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -563,7 +563,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_postConcat(int native_object, int other_matrix) {
+    /*package*/ static boolean native_postConcat(long native_object, long other_matrix) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -579,7 +579,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_setRectToRect(int native_object, RectF src,
+    /*package*/ static boolean native_setRectToRect(long native_object, RectF src,
             RectF dst, int stf) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -644,7 +644,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_setPolyToPoly(int native_object, float[] src, int srcIndex,
+    /*package*/ static boolean native_setPolyToPoly(long native_object, float[] src, int srcIndex,
             float[] dst, int dstIndex, int pointCount) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -654,7 +654,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_invert(int native_object, int inverse) {
+    /*package*/ static boolean native_invert(long native_object, int inverse) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -682,7 +682,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_mapPoints(int native_object, float[] dst, int dstIndex,
+    /*package*/ static void native_mapPoints(long native_object, float[] dst, int dstIndex,
             float[] src, int srcIndex, int ptCount, boolean isPts) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
@@ -697,7 +697,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_mapRect(int native_object, RectF dst, RectF src) {
+    /*package*/ static boolean native_mapRect(long native_object, RectF dst, RectF src) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
@@ -707,7 +707,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static float native_mapRadius(int native_object, float radius) {
+    /*package*/ static float native_mapRadius(long native_object, float radius) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return 0.f;
@@ -723,7 +723,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_getValues(int native_object, float[] values) {
+    /*package*/ static void native_getValues(long native_object, float[] values) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -733,7 +733,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setValues(int native_object, float[] values) {
+    /*package*/ static void native_setValues(long native_object, float[] values) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return;
@@ -743,7 +743,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_equals(int native_a, int native_b) {
+    /*package*/ static boolean native_equals(long native_a, long native_b) {
         Matrix_Delegate a = sManager.getDelegate(native_a);
         if (a == null) {
             return false;
@@ -764,7 +764,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int native_instance) {
+    /*package*/ static void finalizer(long native_instance) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
index fa68796..a5c52e55 100644
--- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -158,7 +158,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int validateNinePatchChunk(int bitmap, byte[] chunk) {
+    /*package*/ static long validateNinePatchChunk(long bitmap, byte[] chunk) {
         // the default JNI implementation only checks that the byte[] has the same
         // size as the C struct it represent. Since we cannot do the same check (serialization
         // will return different size depending on content), we do nothing.
@@ -167,13 +167,13 @@
         return sManager.addNewDelegate(newDelegate);
     }
 
-    /*package*/ static void nativeFinalize(int chunk) {
+    /*package*/ static void nativeFinalize(long chunk) {
         sManager.removeJavaReferenceFor(chunk);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance,
-            int chunk, int paint_instance_or_null, int destDensity, int srcDensity) {
+    /*package*/ static void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance,
+            long chunk, long paint_instance_or_null, int destDensity, int srcDensity) {
         draw(canvas_instance,
                 (int) loc.left, (int) loc.top, (int) loc.width(), (int) loc.height(),
                 bitmap_instance, chunk, paint_instance_or_null,
@@ -181,8 +181,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance,
-            int chunk, int paint_instance_or_null, int destDensity, int srcDensity) {
+    /*package*/ static void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance,
+            long chunk, long paint_instance_or_null, int destDensity, int srcDensity) {
         draw(canvas_instance,
                 loc.left, loc.top, loc.width(), loc.height(),
                 bitmap_instance, chunk, paint_instance_or_null,
@@ -190,15 +190,15 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeGetTransparentRegion(int bitmap, int chunk, Rect location) {
+    /*package*/ static long nativeGetTransparentRegion(long bitmap, long chunk, Rect location) {
         return 0;
     }
 
     // ---- Private Helper methods ----
 
-    private static void draw(int canvas_instance,
+    private static void draw(long canvas_instance,
             final int left, final int top, final int right, final int bottom,
-            int bitmap_instance, int chunk, int paint_instance_or_null,
+            long bitmap_instance, long chunk, long paint_instance_or_null,
             final int destDensity, final int srcDensity) {
         // get the delegate from the native int.
         final Bitmap_Delegate bitmap_delegate = Bitmap_Delegate.getDelegate(bitmap_instance);
diff --git a/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
index 71d346a..fa20746 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
@@ -55,7 +55,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConstructor(int clearBits, int setBits) {
+    /*package*/ static long nativeConstructor(int clearBits, int setBits) {
         PaintFlagsDrawFilter_Delegate newDelegate = new PaintFlagsDrawFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index 41953ed..ca8e8aa 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -96,7 +96,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Paint_Delegate getDelegate(int native_paint) {
+    public static Paint_Delegate getDelegate(long native_paint) {
         return sManager.getDelegate(native_paint);
     }
 
@@ -640,13 +640,13 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_init() {
+    /*package*/ static long native_init() {
         Paint_Delegate newDelegate = new Paint_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_initWithPaint(int paint) {
+    /*package*/ static long native_initWithPaint(long paint) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(paint);
         if (delegate == null) {
@@ -658,7 +658,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_reset(int native_object) {
+    /*package*/ static void native_reset(long native_object) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -669,7 +669,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_set(int native_dst, int native_src) {
+    /*package*/ static void native_set(long native_dst, long native_src) {
         // get the delegate from the native int.
         Paint_Delegate delegate_dst = sManager.getDelegate(native_dst);
         if (delegate_dst == null) {
@@ -686,7 +686,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getStyle(int native_object) {
+    /*package*/ static long native_getStyle(long native_object) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -697,7 +697,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setStyle(int native_object, int style) {
+    /*package*/ static void native_setStyle(long native_object, int style) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -708,7 +708,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getStrokeCap(int native_object) {
+    /*package*/ static long native_getStrokeCap(long native_object) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -719,7 +719,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setStrokeCap(int native_object, int cap) {
+    /*package*/ static void native_setStrokeCap(long native_object, int cap) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -730,7 +730,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getStrokeJoin(int native_object) {
+    /*package*/ static long native_getStrokeJoin(long native_object) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -741,7 +741,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setStrokeJoin(int native_object, int join) {
+    /*package*/ static void native_setStrokeJoin(long native_object, int join) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -752,7 +752,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_getFillPath(int native_object, int src, int dst) {
+    /*package*/ static boolean native_getFillPath(long native_object, long src, long dst) {
         Paint_Delegate paint = sManager.getDelegate(native_object);
         if (paint == null) {
             return false;
@@ -778,7 +778,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setShader(int native_object, int shader) {
+    /*package*/ static long native_setShader(long native_object, long shader) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -791,7 +791,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setColorFilter(int native_object, int filter) {
+    /*package*/ static long native_setColorFilter(long native_object, long filter) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -810,7 +810,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setXfermode(int native_object, int xfermode) {
+    /*package*/ static long native_setXfermode(long native_object, long xfermode) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -823,7 +823,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setPathEffect(int native_object, int effect) {
+    /*package*/ static long native_setPathEffect(long native_object, long effect) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -836,7 +836,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setMaskFilter(int native_object, int maskfilter) {
+    /*package*/ static long native_setMaskFilter(long native_object, long maskfilter) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -855,7 +855,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setTypeface(int native_object, int typeface) {
+    /*package*/ static long native_setTypeface(long native_object, long typeface) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -868,7 +868,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_setRasterizer(int native_object, int rasterizer) {
+    /*package*/ static long native_setRasterizer(long native_object, long rasterizer) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -887,7 +887,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getTextAlign(int native_object) {
+    /*package*/ static long native_getTextAlign(long native_object) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -898,7 +898,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setTextAlign(int native_object, int align) {
+    /*package*/ static void native_setTextAlign(long native_object, int align) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -909,7 +909,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setTextLocale(int native_object, String locale) {
+    /*package*/ static void native_setTextLocale(long native_object, String locale) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -920,7 +920,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getTextWidths(int native_object, char[] text, int index,
+    /*package*/ static long native_getTextWidths(long native_object, char[] text, int index,
             int count, int bidiFlags, float[] widths) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
@@ -962,21 +962,21 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getTextWidths(int native_object, String text, int start,
+    /*package*/ static long native_getTextWidths(long native_object, String text, int start,
             int end, int bidiFlags, float[] widths) {
         return native_getTextWidths(native_object, text.toCharArray(), start, end - start,
                 bidiFlags, widths);
     }
 
     @LayoutlibDelegate
-    /* package */static int native_getTextGlyphs(int native_object, String text, int start,
+    /* package */static long native_getTextGlyphs(long native_object, String text, int start,
             int end, int contextStart, int contextEnd, int flags, char[] glyphs) {
         // FIXME
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static float native_getTextRunAdvances(int native_object,
+    /*package*/ static float native_getTextRunAdvances(long native_object,
             char[] text, int index, int count, int contextIndex, int contextCount,
             int flags, float[] advances, int advancesIndex) {
 
@@ -996,7 +996,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static float native_getTextRunAdvances(int native_object,
+    /*package*/ static float native_getTextRunAdvances(long native_object,
             String text, int start, int end, int contextStart, int contextEnd,
             int flags, float[] advances, int advancesIndex) {
         // FIXME: support contextStart and contextEnd
@@ -1009,7 +1009,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getTextRunCursor(Paint thisPaint, int native_object, char[] text,
+    /*package*/ static long native_getTextRunCursor(Paint thisPaint, long native_object, char[] text,
             int contextStart, int contextLength, int flags, int offset, int cursorOpt) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -1018,7 +1018,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getTextRunCursor(Paint thisPaint, int native_object, String text,
+    /*package*/ static long native_getTextRunCursor(Paint thisPaint, long native_object, String text,
             int contextStart, int contextEnd, int flags, int offset, int cursorOpt) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -1027,30 +1027,30 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_getTextPath(int native_object, int bidiFlags,
-                char[] text, int index, int count, float x, float y, int path) {
+    /*package*/ static void native_getTextPath(long native_object, int bidiFlags,
+                char[] text, int index, int count, float x, float y, long path) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextPath is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_getTextPath(int native_object, int bidiFlags,
-            String text, int start, int end, float x, float y, int path) {
+    /*package*/ static void native_getTextPath(long native_object, int bidiFlags,
+            String text, int start, int end, float x, float y, long path) {
         // FIXME
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextPath is not supported.", null, null /*data*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeGetStringBounds(int nativePaint, String text, int start,
+    /*package*/ static void nativeGetStringBounds(long nativePaint, String text, int start,
             int end, int bidiFlags, Rect bounds) {
         nativeGetCharArrayBounds(nativePaint, text.toCharArray(), start, end - start, bidiFlags,
                 bounds);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeGetCharArrayBounds(int nativePaint, char[] text, int index,
+    /*package*/ static void nativeGetCharArrayBounds(long nativePaint, char[] text, int index,
             int count, int bidiFlags, Rect bounds) {
 
         // get the delegate from the native int.
@@ -1064,7 +1064,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int nativePaint) {
+    /*package*/ static void finalizer(long nativePaint) {
         sManager.removeJavaReferenceFor(nativePaint);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
index c448f0e..fd9ba62e 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
@@ -62,7 +62,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int native_path, float advance, float phase,
+    /*package*/ static long nativeCreate(long native_path, float advance, float phase,
             int native_style) {
         PathDashPathEffect_Delegate newDelegate = new PathDashPathEffect_Delegate();
         return sManager.addNewDelegate(newDelegate);
diff --git a/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
index bd2b6de..000481e 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
@@ -48,7 +48,7 @@
 
     // ---- Public Helper methods ----
 
-    public static PathEffect_Delegate getDelegate(int nativeShader) {
+    public static PathEffect_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -60,7 +60,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int native_patheffect) {
+    /*package*/ static void nativeDestructor(long native_patheffect) {
         sManager.removeJavaReferenceFor(native_patheffect);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index 64f19d3..f3b56d9 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -63,7 +63,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Path_Delegate getDelegate(int nPath) {
+    public static Path_Delegate getDelegate(long nPath) {
         return sManager.getDelegate(nPath);
     }
 
@@ -88,7 +88,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int init1() {
+    /*package*/ static long init1() {
         // create the delegate
         Path_Delegate newDelegate = new Path_Delegate();
 
@@ -96,7 +96,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int init2(int nPath) {
+    /*package*/ static long init2(long nPath) {
         // create the delegate
         Path_Delegate newDelegate = new Path_Delegate();
 
@@ -110,7 +110,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_reset(int nPath) {
+    /*package*/ static void native_reset(long nPath) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -120,14 +120,14 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_rewind(int nPath) {
+    /*package*/ static void native_rewind(long nPath) {
         // call out to reset since there's nothing to optimize in
         // terms of data structs.
         native_reset(nPath);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_set(int native_dst, int native_src) {
+    /*package*/ static void native_set(long native_dst, long native_src) {
         Path_Delegate pathDstDelegate = sManager.getDelegate(native_dst);
         if (pathDstDelegate == null) {
             return;
@@ -142,7 +142,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int native_getFillType(int nPath) {
+    /*package*/ static long native_getFillType(long nPath) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return 0;
@@ -152,7 +152,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setFillType(int nPath, int ft) {
+    /*package*/ static void native_setFillType(long nPath, int ft) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -162,7 +162,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_isEmpty(int nPath) {
+    /*package*/ static boolean native_isEmpty(long nPath) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return true;
@@ -172,7 +172,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_isRect(int nPath, RectF rect) {
+    /*package*/ static boolean native_isRect(long nPath, RectF rect) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return false;
@@ -192,7 +192,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_computeBounds(int nPath, RectF bounds) {
+    /*package*/ static void native_computeBounds(long nPath, RectF bounds) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -202,13 +202,13 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_incReserve(int nPath, int extraPtCount) {
+    /*package*/ static void native_incReserve(long nPath, int extraPtCount) {
         // since we use a java2D path, there's no way to pre-allocate new points,
         // so we do nothing.
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_moveTo(int nPath, float x, float y) {
+    /*package*/ static void native_moveTo(long nPath, float x, float y) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -218,7 +218,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_rMoveTo(int nPath, float dx, float dy) {
+    /*package*/ static void native_rMoveTo(long nPath, float dx, float dy) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -228,7 +228,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_lineTo(int nPath, float x, float y) {
+    /*package*/ static void native_lineTo(long nPath, float x, float y) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -238,7 +238,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_rLineTo(int nPath, float dx, float dy) {
+    /*package*/ static void native_rLineTo(long nPath, float dx, float dy) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -248,7 +248,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_quadTo(int nPath, float x1, float y1, float x2, float y2) {
+    /*package*/ static void native_quadTo(long nPath, float x1, float y1, float x2, float y2) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -258,7 +258,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_rQuadTo(int nPath, float dx1, float dy1, float dx2, float dy2) {
+    /*package*/ static void native_rQuadTo(long nPath, float dx1, float dy1, float dx2, float dy2) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -268,7 +268,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_cubicTo(int nPath, float x1, float y1,
+    /*package*/ static void native_cubicTo(long nPath, float x1, float y1,
             float x2, float y2, float x3, float y3) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -279,7 +279,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_rCubicTo(int nPath, float x1, float y1,
+    /*package*/ static void native_rCubicTo(long nPath, float x1, float y1,
             float x2, float y2, float x3, float y3) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -290,7 +290,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_arcTo(int nPath, RectF oval,
+    /*package*/ static void native_arcTo(long nPath, RectF oval,
                     float startAngle, float sweepAngle, boolean forceMoveTo) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -301,7 +301,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_close(int nPath) {
+    /*package*/ static void native_close(long nPath) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -311,7 +311,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addRect(int nPath, RectF rect, int dir) {
+    /*package*/ static void native_addRect(long nPath, RectF rect, int dir) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -321,7 +321,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addRect(int nPath,
+    /*package*/ static void native_addRect(long nPath,
             float left, float top, float right, float bottom, int dir) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -332,7 +332,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addOval(int nPath, RectF oval, int dir) {
+    /*package*/ static void native_addOval(long nPath, RectF oval, int dir) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -343,7 +343,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addCircle(int nPath, float x, float y, float radius, int dir) {
+    /*package*/ static void native_addCircle(long nPath, float x, float y, float radius, int dir) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -355,7 +355,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addArc(int nPath, RectF oval,
+    /*package*/ static void native_addArc(long nPath, RectF oval,
             float startAngle, float sweepAngle) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -370,7 +370,7 @@
 
     @LayoutlibDelegate
     /*package*/ static void native_addRoundRect(
-            int nPath, RectF rect, float rx, float ry, int dir) {
+            long nPath, RectF rect, float rx, float ry, int dir) {
 
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
@@ -382,7 +382,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addRoundRect(int nPath, RectF rect, float[] radii, int dir) {
+    /*package*/ static void native_addRoundRect(long nPath, RectF rect, float[] radii, int dir) {
         // Java2D doesn't support different rounded corners in each corner, so just use the
         // first value.
         native_addRoundRect(nPath, rect, radii[0], radii[1], dir);
@@ -401,17 +401,17 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(int nPath, int src, float dx, float dy) {
+    /*package*/ static void native_addPath(long nPath, int src, float dx, float dy) {
         addPath(nPath, src, AffineTransform.getTranslateInstance(dx, dy));
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(int nPath, int src) {
+    /*package*/ static void native_addPath(long nPath, int src) {
         addPath(nPath, src, null /*transform*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(int nPath, int src, int matrix) {
+    /*package*/ static void native_addPath(long nPath, int src, long matrix) {
         Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(matrix);
         if (matrixDelegate == null) {
             return;
@@ -421,7 +421,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_offset(int nPath, float dx, float dy, int dst_path) {
+    /*package*/ static void native_offset(long nPath, float dx, float dy, long dst_path) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -434,12 +434,12 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_offset(int nPath, float dx, float dy) {
+    /*package*/ static void native_offset(long nPath, float dx, float dy) {
         native_offset(nPath, dx, dy, 0);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_setLastPoint(int nPath, float dx, float dy) {
+    /*package*/ static void native_setLastPoint(long nPath, float dx, float dy) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -450,8 +450,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_transform(int nPath, int matrix,
-                                                int dst_path) {
+    /*package*/ static void native_transform(long nPath, long matrix,
+                                                long dst_path) {
         Path_Delegate pathDelegate = sManager.getDelegate(nPath);
         if (pathDelegate == null) {
             return;
@@ -469,12 +469,12 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_transform(int nPath, int matrix) {
+    /*package*/ static void native_transform(long nPath, long matrix) {
         native_transform(nPath, matrix, 0);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int nPath) {
+    /*package*/ static void finalizer(long nPath) {
         sManager.removeJavaReferenceFor(nPath);
     }
 
@@ -522,7 +522,7 @@
         return null;
     }
 
-    private static void addPath(int destPath, int srcPath, AffineTransform transform) {
+    private static void addPath(long destPath, long srcPath, AffineTransform transform) {
         Path_Delegate destPathDelegate = sManager.getDelegate(destPath);
         if (destPathDelegate == null) {
             return;
diff --git a/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
index 4ab044b..f27144f 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
@@ -61,7 +61,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int opColor) {
+    /*package*/ static long nativeCreate(int opColor) {
         PixelXorXfermode_Delegate newDelegate = new PixelXorXfermode_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
index c45dbaa..6049919 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
@@ -55,13 +55,13 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode) {
+    /*package*/ static long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode) {
         PorterDuffColorFilter_Delegate newDelegate = new PorterDuffColorFilter_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+    /*package*/ static long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
             int porterDuffMode) {
         // pass
         return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
index 4301c1a..a89fd57 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
@@ -127,7 +127,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreateXfermode(int mode) {
+    /*package*/ static long nativeCreateXfermode(int mode) {
         PorterDuffXfermode_Delegate newDelegate = new PorterDuffXfermode_Delegate(mode);
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
index 3fe45fa..4f16dcf 100644
--- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
@@ -54,7 +54,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate1(float x, float y, float radius,
+    /*package*/ static long nativeCreate1(float x, float y, float radius,
             int colors[], float positions[], int tileMode) {
         RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(x, y, radius,
                 colors, positions, Shader_Delegate.getTileMode(tileMode));
@@ -62,21 +62,21 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate2(float x, float y, float radius,
+    /*package*/ static long nativeCreate2(float x, float y, float radius,
             int color0, int color1, int tileMode) {
         return nativeCreate1(x, y, radius, new int[] { color0, color1 }, null /*positions*/,
                 tileMode);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate1(int native_shader, float x, float y, float radius,
+    /*package*/ static long nativePostCreate1(long native_shader, float x, float y, float radius,
             int colors[], float positions[], int tileMode) {
         // nothing to be done here.
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate2(int native_shader, float x, float y, float radius,
+    /*package*/ static long nativePostCreate2(long native_shader, float x, float y, float radius,
             int color0, int color1, int tileMode) {
         // nothing to be done here.
         return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
index 2812b6b..a742840 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
@@ -46,7 +46,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Rasterizer_Delegate getDelegate(int nativeShader) {
+    public static Rasterizer_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -56,7 +56,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int native_instance) {
+    /*package*/ static void finalizer(long native_instance) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
index cb31b8f..ea23649 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
@@ -57,7 +57,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Region_Delegate getDelegate(int nativeShader) {
+    public static Region_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -264,18 +264,18 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeConstructor() {
+    /*package*/ static long nativeConstructor() {
         Region_Delegate newDelegate = new Region_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int native_region) {
+    /*package*/ static void nativeDestructor(long native_region) {
         sManager.removeJavaReferenceFor(native_region);
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeSetRegion(int native_dst, int native_src) {
+    /*package*/ static boolean nativeSetRegion(long native_dst, long native_src) {
         Region_Delegate dstRegion = sManager.getDelegate(native_dst);
         if (dstRegion == null) {
             return true;
@@ -293,7 +293,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeSetRect(int native_dst,
+    /*package*/ static boolean nativeSetRect(long native_dst,
             int left, int top, int right, int bottom) {
         Region_Delegate dstRegion = sManager.getDelegate(native_dst);
         if (dstRegion == null) {
@@ -305,7 +305,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeSetPath(int native_dst, int native_path, int native_clip) {
+    /*package*/ static boolean nativeSetPath(long native_dst, long native_path, long native_clip) {
         Region_Delegate dstRegion = sManager.getDelegate(native_dst);
         if (dstRegion == null) {
             return true;
@@ -327,7 +327,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeGetBounds(int native_region, Rect rect) {
+    /*package*/ static boolean nativeGetBounds(long native_region, Rect rect) {
         Region_Delegate region = sManager.getDelegate(native_region);
         if (region == null) {
             return true;
@@ -347,7 +347,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeGetBoundaryPath(int native_region, int native_path) {
+    /*package*/ static boolean nativeGetBoundaryPath(long native_region, long native_path) {
         Region_Delegate region = sManager.getDelegate(native_region);
         if (region == null) {
             return false;
@@ -368,7 +368,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeOp(int native_dst,
+    /*package*/ static boolean nativeOp(long native_dst,
             int left, int top, int right, int bottom, int op) {
         Region_Delegate region = sManager.getDelegate(native_dst);
         if (region == null) {
@@ -387,7 +387,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeOp(int native_dst, Rect rect, int native_region, int op) {
+    /*package*/ static boolean nativeOp(long native_dst, Rect rect, long native_region, int op) {
         Region_Delegate region = sManager.getDelegate(native_dst);
         if (region == null) {
             return false;
@@ -405,8 +405,8 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeOp(int native_dst,
-            int native_region1, int native_region2, int op) {
+    /*package*/ static boolean nativeOp(long native_dst,
+            long native_region1, long native_region2, int op) {
         Region_Delegate dstRegion = sManager.getDelegate(native_dst);
         if (dstRegion == null) {
             return true;
@@ -434,7 +434,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreateFromParcel(Parcel p) {
+    /*package*/ static long nativeCreateFromParcel(Parcel p) {
         // This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
         // used during aidl call so really this should not be called.
         Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
@@ -444,7 +444,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeWriteToParcel(int native_region,
+    /*package*/ static boolean nativeWriteToParcel(long native_region,
                                                       Parcel p) {
         // This is only called when sending a region through aidl, so really this should not
         // be called.
@@ -455,7 +455,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean nativeEquals(int native_r1, int native_r2) {
+    /*package*/ static boolean nativeEquals(long native_r1, long native_r2) {
         Region_Delegate region1 = sManager.getDelegate(native_r1);
         if (region1 == null) {
             return false;
@@ -470,7 +470,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static String nativeToString(int native_region) {
+    /*package*/ static String nativeToString(long native_region) {
         Region_Delegate region = sManager.getDelegate(native_region);
         if (region == null) {
             return "not found";
diff --git a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
index 368c0384..70a0a43 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
@@ -49,7 +49,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Shader_Delegate getDelegate(int nativeShader) {
+    public static Shader_Delegate getDelegate(long nativeShader) {
         return sManager.getDelegate(nativeShader);
     }
 
@@ -76,13 +76,13 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void nativeDestructor(int native_shader, int native_skiaShader) {
+    /*package*/ static void nativeDestructor(long native_shader, long native_skiaShader) {
         sManager.removeJavaReferenceFor(native_shader);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetLocalMatrix(int native_shader, int native_skiaShader,
-            int matrix_instance) {
+    /*package*/ static void nativeSetLocalMatrix(long native_shader, long native_skiaShader,
+            long matrix_instance) {
         // get the delegate from the native int.
         Shader_Delegate shaderDelegate = sManager.getDelegate(native_shader);
         if (shaderDelegate == null) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
index 410df0c..6d2e9b4 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
@@ -62,7 +62,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate(int first, int second) {
+    /*package*/ static long nativeCreate(long first, long second) {
         SumPathEffect_Delegate newDelegate = new SumPathEffect_Delegate();
         return sManager.addNewDelegate(newDelegate);
     }
diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
index 13ae12e..f2b3e8d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
@@ -52,25 +52,25 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate1(float x, float y, int colors[], float positions[]) {
+    /*package*/ static long nativeCreate1(float x, float y, int colors[], float positions[]) {
         SweepGradient_Delegate newDelegate = new SweepGradient_Delegate(x, y, colors, positions);
         return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeCreate2(float x, float y, int color0, int color1) {
+    /*package*/ static long nativeCreate2(float x, float y, int color0, int color1) {
         return nativeCreate1(x, y, new int[] { color0, color1 }, null /*positions*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate1(int native_shader, float cx, float cy,
+    /*package*/ static long nativePostCreate1(long native_shader, float cx, float cy,
             int[] colors, float[] positions) {
         // nothing to be done here.
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativePostCreate2(int native_shader, float cx, float cy,
+    /*package*/ static long nativePostCreate2(long native_shader, float cx, float cy,
             int color0, int color1) {
         // nothing to be done here.
         return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
index 8701cc8..a25fb59 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
@@ -75,7 +75,7 @@
         sPostInitDelegate.clear();
     }
 
-    public static Typeface_Delegate getDelegate(int nativeTypeface) {
+    public static Typeface_Delegate getDelegate(long nativeTypeface) {
         return sManager.getDelegate(nativeTypeface);
     }
 
@@ -83,7 +83,7 @@
         return getFonts(typeface.native_instance);
     }
 
-    public static List<Font> getFonts(int native_int) {
+    public static List<Font> getFonts(long native_int) {
         Typeface_Delegate delegate = sManager.getDelegate(native_int);
         if (delegate == null) {
             return null;
@@ -99,7 +99,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static synchronized int nativeCreate(String familyName, int style) {
+    /*package*/ static synchronized long nativeCreate(String familyName, int style) {
         if (familyName == null) {
             familyName = DEFAULT_FAMILY;
         }
@@ -118,7 +118,7 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static synchronized int nativeCreateFromTypeface(int native_instance, int style) {
+    /*package*/ static synchronized long nativeCreateFromTypeface(long native_instance, int style) {
         Typeface_Delegate delegate = sManager.getDelegate(native_instance);
         if (delegate == null) {
             return 0;
@@ -138,14 +138,14 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
+    /*package*/ static synchronized long nativeCreateFromAsset(AssetManager mgr, String path) {
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Typeface.createFromAsset() is not supported.", null /*throwable*/, null /*data*/);
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static synchronized int nativeCreateFromFile(String path) {
+    /*package*/ static synchronized long nativeCreateFromFile(String path) {
         if (path.startsWith(SYSTEM_FONTS) ) {
             String relativePath = path.substring(SYSTEM_FONTS.length());
             File f = new File(sFontLoader.getOsFontsLocation(), relativePath);
@@ -174,12 +174,12 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeUnref(int native_instance) {
+    /*package*/ static void nativeUnref(long native_instance) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
     @LayoutlibDelegate
-    /*package*/ static int nativeGetStyle(int native_instance) {
+    /*package*/ static int nativeGetStyle(long native_instance) {
         Typeface_Delegate delegate = sManager.getDelegate(native_instance);
         if (delegate == null) {
             return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
index 962d69c..94a6d76 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
@@ -48,7 +48,7 @@
 
     // ---- Public Helper methods ----
 
-    public static Xfermode_Delegate getDelegate(int native_instance) {
+    public static Xfermode_Delegate getDelegate(long native_instance) {
         return sManager.getDelegate(native_instance);
     }
 
@@ -60,7 +60,7 @@
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(int native_instance) {
+    /*package*/ static void finalizer(long native_instance) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
index ae1217d..261cc98 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
@@ -94,7 +94,7 @@
      * @param native_object the native int.
      * @return the delegate or null if not found.
      */
-    public T getDelegate(int native_object) {
+    public T getDelegate(long native_object) {
         if (native_object > 0) {
             T delegate =  mDelegates.get(native_object);
 
@@ -116,8 +116,8 @@
      * @param newDelegate the delegate to add
      * @return a unique native int to identify the delegate
      */
-    public int addNewDelegate(T newDelegate) {
-        int native_object = ++mDelegateCounter;
+    public long addNewDelegate(T newDelegate) {
+        long native_object = ++mDelegateCounter;
         mDelegates.put(native_object, newDelegate);
         assert !mJavaReferences.contains(newDelegate);
         mJavaReferences.add(newDelegate);
@@ -133,7 +133,7 @@
      * Removes the main reference on the given delegate.
      * @param native_object the native integer representing the delegate.
      */
-    public void removeJavaReferenceFor(int native_object) {
+    public void removeJavaReferenceFor(long native_object) {
         T delegate = getDelegate(native_object);
 
         if (Debug.DEBUG) {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
index 4d0c9ce..53e1640 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
@@ -30,13 +30,14 @@
  *
  * The code is taken from {@link SparseArray} directly and adapted to use weak references.
  *
- * Because our usage means that we never actually call {@link #remove(int)} or {@link #delete(int)},
- * we must manually check if there are reclaimed references to trigger an internal compact step
- * (which is normally only triggered when an item is manually removed).
+ * Because our usage means that we never actually call {@link #remove(long)} or
+ * {@link #delete(long)}, we must manually check if there are reclaimed references to
+ * trigger an internal compact step (which is normally only triggered when an item is manually
+ * removed).
  *
- * SparseArrays map integers to Objects.  Unlike a normal array of Objects,
+ * SparseArrays map integral values to Objects.  Unlike a normal array of Objects,
  * there can be gaps in the indices.  It is intended to be more efficient
- * than using a HashMap to map Integers to Objects.
+ * than using a HashMap to map Integers (or Longs) to Objects.
  */
 @SuppressWarnings("unchecked")
 public class SparseWeakArray<E> {
@@ -58,9 +59,9 @@
      * number of mappings.
      */
     public SparseWeakArray(int initialCapacity) {
-        initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity);
+        initialCapacity = ArrayUtils.idealLongArraySize(initialCapacity);
 
-        mKeys = new int[initialCapacity];
+        mKeys = new long[initialCapacity];
         mValues = new WeakReference[initialCapacity];
         mSize = 0;
     }
@@ -69,7 +70,7 @@
      * Gets the Object mapped from the specified key, or <code>null</code>
      * if no such mapping has been made.
      */
-    public E get(int key) {
+    public E get(long key) {
         return get(key, null);
     }
 
@@ -77,7 +78,7 @@
      * Gets the Object mapped from the specified key, or the specified Object
      * if no such mapping has been made.
      */
-    public E get(int key, E valueIfKeyNotFound) {
+    public E get(long key, E valueIfKeyNotFound) {
         int i = binarySearch(mKeys, 0, mSize, key);
 
         if (i < 0 || mValues[i] == DELETED || mValues[i].get() == null) {
@@ -90,7 +91,7 @@
     /**
      * Removes the mapping from the specified key, if there was any.
      */
-    public void delete(int key) {
+    public void delete(long key) {
         int i = binarySearch(mKeys, 0, mSize, key);
 
         if (i >= 0) {
@@ -102,9 +103,9 @@
     }
 
     /**
-     * Alias for {@link #delete(int)}.
+     * Alias for {@link #delete(long)}.
      */
-    public void remove(int key) {
+    public void remove(long key) {
         delete(key);
     }
 
@@ -121,7 +122,7 @@
     private void gc() {
         int n = mSize;
         int o = 0;
-        int[] keys = mKeys;
+        long[] keys = mKeys;
         WeakReference<?>[] values = mValues;
 
         for (int i = 0; i < n; i++) {
@@ -142,9 +143,9 @@
         mGarbage = false;
         mSize = o;
 
-        int newSize = ArrayUtils.idealIntArraySize(mSize);
+        int newSize = ArrayUtils.idealLongArraySize(mSize);
         if (newSize < mKeys.length) {
-            int[] nkeys = new int[newSize];
+            long[] nkeys = new long[newSize];
             WeakReference<?>[] nvalues = new WeakReference[newSize];
 
             System.arraycopy(mKeys, 0, nkeys, 0, newSize);
@@ -160,7 +161,7 @@
      * replacing the previous mapping from the specified key if there
      * was one.
      */
-    public void put(int key, E value) {
+    public void put(long key, E value) {
         int i = binarySearch(mKeys, 0, mSize, key);
 
         if (i >= 0) {
@@ -182,9 +183,9 @@
             }
 
             if (mSize >= mKeys.length) {
-                int n = ArrayUtils.idealIntArraySize(mSize + 1);
+                int n = ArrayUtils.idealLongArraySize(mSize + 1);
 
-                int[] nkeys = new int[n];
+                long[] nkeys = new long[n];
                 WeakReference<?>[] nvalues = new WeakReference[n];
 
                 // Log.e("SparseArray", "grow " + mKeys.length + " to " + n);
@@ -224,7 +225,7 @@
      * the key from the <code>index</code>th key-value mapping that this
      * SparseArray stores.
      */
-    public int keyAt(int index) {
+    public long keyAt(int index) {
         if (mGarbage) {
             gc();
         }
@@ -263,7 +264,7 @@
      * specified key, or a negative number if the specified
      * key is not mapped.
      */
-    public int indexOfKey(int key) {
+    public int indexOfKey(long key) {
         if (mGarbage) {
             gc();
         }
@@ -310,7 +311,7 @@
      * Puts a key/value pair into the array, optimizing for the case where
      * the key is greater than all existing keys in the array.
      */
-    public void append(int key, E value) {
+    public void append(long key, E value) {
         if (mSize != 0 && key <= mKeys[mSize - 1]) {
             put(key, value);
             return;
@@ -322,9 +323,9 @@
 
         int pos = mSize;
         if (pos >= mKeys.length) {
-            int n = ArrayUtils.idealIntArraySize(pos + 1);
+            int n = ArrayUtils.idealLongArraySize(pos + 1);
 
-            int[] nkeys = new int[n];
+            long[] nkeys = new long[n];
             WeakReference<?>[] nvalues = new WeakReference[n];
 
             // Log.e("SparseArray", "grow " + mKeys.length + " to " + n);
@@ -350,7 +351,7 @@
         return false;
     }
 
-    private static int binarySearch(int[] a, int start, int len, int key) {
+    private static int binarySearch(long[] a, int start, int len, long key) {
         int high = start + len, low = start - 1, guess;
 
         while (high - low > 1) {
@@ -370,7 +371,7 @@
             return ~high;
     }
 
-    private int[] mKeys;
+    private long[] mKeys;
     private WeakReference<?>[] mValues;
     private int mSize;
 }
