Merge "GLES2Dbg: use 256KB chunks for lzf compression"
diff --git a/core/java/android/text/CharSequenceIterator.java b/core/java/android/text/CharSequenceIterator.java
new file mode 100644
index 0000000..4946406
--- /dev/null
+++ b/core/java/android/text/CharSequenceIterator.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2011 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.text;
+
+import android.util.MathUtils;
+
+import java.text.CharacterIterator;
+
+/** {@hide} */
+public class CharSequenceIterator implements CharacterIterator {
+    private final CharSequence mValue;
+
+    private final int mStart;
+    private final int mEnd;
+    private int mIndex;
+
+    public CharSequenceIterator(CharSequence value) {
+        mValue = value;
+        mStart = 0;
+        mEnd = value.length();
+        mIndex = 0;
+    }
+
+    @Override
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public char current() {
+        if (mIndex == mEnd) {
+            return DONE;
+        }
+        return mValue.charAt(mIndex);
+    }
+
+    /** {@inheritDoc} */
+    public int getBeginIndex() {
+        return mStart;
+    }
+
+    /** {@inheritDoc} */
+    public int getEndIndex() {
+        return mEnd;
+    }
+
+    /** {@inheritDoc} */
+    public int getIndex() {
+        return mIndex;
+    }
+
+    /** {@inheritDoc} */
+    public char first() {
+        return setIndex(mStart);
+    }
+
+    /** {@inheritDoc} */
+    public char last() {
+        return setIndex(mEnd - 1);
+    }
+
+    /** {@inheritDoc} */
+    public char next() {
+        return setIndex(mIndex + 1);
+    }
+
+    /** {@inheritDoc} */
+    public char previous() {
+        return setIndex(mIndex - 1);
+    }
+
+    /** {@inheritDoc} */
+    public char setIndex(int index) {
+        mIndex = MathUtils.constrain(index, mStart, mEnd);
+        return current();
+    }
+}
diff --git a/core/java/android/text/Selection.java b/core/java/android/text/Selection.java
index 13cb5e6..b18570a 100644
--- a/core/java/android/text/Selection.java
+++ b/core/java/android/text/Selection.java
@@ -16,6 +16,11 @@
 
 package android.text;
 
+import android.util.Log;
+
+import java.text.BreakIterator;
+import java.text.CharacterIterator;
+
 
 /**
  * Utility class for manipulating cursors and selections in CharSequences.
@@ -38,7 +43,7 @@
         else
             return -1;
     }
-   
+
     /**
      * Return the offset of the selection edge or cursor, or -1 if
      * there is no selection or cursor.
@@ -57,7 +62,7 @@
     // private static int pin(int value, int min, int max) {
     //     return value < min ? 0 : (value > max ? max : value);
     // }
-   
+
     /**
      * Set the selection anchor to <code>start</code> and the selection edge
      * to <code>stop</code>.
@@ -69,7 +74,7 @@
 
         int ostart = getSelectionStart(text);
         int oend = getSelectionEnd(text);
-    
+
         if (ostart != start || oend != stop) {
             text.setSpan(SELECTION_START, start, start,
                          Spanned.SPAN_POINT_POINT|Spanned.SPAN_INTERMEDIATE);
@@ -357,6 +362,42 @@
         return true;
     }
 
+    /** {@hide} */
+    public static interface PositionIterator {
+        public static final int DONE = BreakIterator.DONE;
+
+        public int preceding(int position);
+        public int following(int position);
+    }
+
+    /** {@hide} */
+    public static boolean moveToPreceding(
+            Spannable text, PositionIterator iter, boolean extendSelection) {
+        final int offset = iter.preceding(getSelectionEnd(text));
+        if (offset != PositionIterator.DONE) {
+            if (extendSelection) {
+                extendSelection(text, offset);
+            } else {
+                setSelection(text, offset);
+            }
+        }
+        return true;
+    }
+
+    /** {@hide} */
+    public static boolean moveToFollowing(
+            Spannable text, PositionIterator iter, boolean extendSelection) {
+        final int offset = iter.following(getSelectionEnd(text));
+        if (offset != PositionIterator.DONE) {
+            if (extendSelection) {
+                extendSelection(text, offset);
+            } else {
+                setSelection(text, offset);
+            }
+        }
+        return true;
+    }
+
     private static int findEdge(Spannable text, Layout layout, int dir) {
         int pt = getSelectionEnd(text);
         int line = layout.getLineForOffset(pt);
@@ -419,7 +460,7 @@
 
     private static final class START implements NoCopySpan { }
     private static final class END implements NoCopySpan { }
-    
+
     /*
      * Public constants
      */
diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java
index a61ff13..80c0106 100644
--- a/core/java/android/text/method/ArrowKeyMovementMethod.java
+++ b/core/java/android/text/method/ArrowKeyMovementMethod.java
@@ -17,14 +17,23 @@
 package android.text.method;
 
 import android.graphics.Rect;
+import android.text.CharSequenceIterator;
+import android.text.Editable;
 import android.text.Layout;
 import android.text.Selection;
 import android.text.Spannable;
+import android.text.Spanned;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.util.MathUtils;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
 import android.widget.TextView;
 
+import java.text.BreakIterator;
+import java.text.CharacterIterator;
+
 /**
  * A movement method that provides cursor movement and selection.
  * Supports displaying the context menu on DPad Center.
@@ -193,6 +202,20 @@
         }
     }
 
+    /** {@hide} */
+    @Override
+    protected boolean leftWord(TextView widget, Spannable buffer) {
+        mWordIterator.setCharSequence(buffer);
+        return Selection.moveToPreceding(buffer, mWordIterator, isSelecting(buffer));
+    }
+
+    /** {@hide} */
+    @Override
+    protected boolean rightWord(TextView widget, Spannable buffer) {
+        mWordIterator.setCharSequence(buffer);
+        return Selection.moveToFollowing(buffer, mWordIterator, isSelecting(buffer));
+    }
+
     @Override
     protected boolean home(TextView widget, Spannable buffer) {
         return lineStart(widget, buffer);
@@ -205,7 +228,8 @@
 
     @Override
     public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
-        int initialScrollX = -1, initialScrollY = -1;
+        int initialScrollX = -1;
+        int initialScrollY = -1;
         final int action = event.getAction();
 
         if (action == MotionEvent.ACTION_UP) {
@@ -220,7 +244,7 @@
               boolean cap = isSelecting(buffer);
               if (cap) {
                   int offset = widget.getOffset((int) event.getX(), (int) event.getY());
-                  
+
                   buffer.setSpan(LAST_TAP_DOWN, offset, offset, Spannable.SPAN_POINT_POINT);
 
                   // Disallow intercepting of the touch events, so that
@@ -308,6 +332,103 @@
         return sInstance;
     }
 
+    /**
+     * Walks through cursor positions at word boundaries. Internally uses
+     * {@link BreakIterator#getWordInstance()}, and caches {@link CharSequence}
+     * for performance reasons.
+     */
+    private static class WordIterator implements Selection.PositionIterator {
+        private CharSequence mCurrent;
+        private boolean mCurrentDirty = false;
+
+        private BreakIterator mIterator;
+
+        private TextWatcher mWatcher = new TextWatcher() {
+            /** {@inheritDoc} */
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                // ignored
+            }
+
+            /** {@inheritDoc} */
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                mCurrentDirty = true;
+            }
+
+            /** {@inheritDoc} */
+            public void afterTextChanged(Editable s) {
+                // ignored
+            }
+        };
+
+        public void setCharSequence(CharSequence incoming) {
+            if (mIterator == null) {
+                mIterator = BreakIterator.getWordInstance();
+            }
+
+            // when incoming is different object, move listeners to new sequence
+            // and mark as dirty so we reload contents.
+            if (mCurrent != incoming) {
+                if (mCurrent instanceof Editable) {
+                    ((Editable) mCurrent).removeSpan(mWatcher);
+                }
+
+                if (incoming instanceof Editable) {
+                    ((Editable) incoming).setSpan(
+                            mWatcher, 0, incoming.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                }
+
+                mCurrent = incoming;
+                mCurrentDirty = true;
+            }
+
+            if (mCurrentDirty) {
+                final CharacterIterator charIterator = new CharSequenceIterator(mCurrent);
+                mIterator.setText(charIterator);
+
+                mCurrentDirty = false;
+            }
+        }
+
+        private boolean isValidOffset(int offset) {
+            return offset >= 0 && offset < mCurrent.length();
+        }
+
+        private boolean isLetterOrDigit(int offset) {
+            if (isValidOffset(offset)) {
+                return Character.isLetterOrDigit(mCurrent.charAt(offset));
+            } else {
+                return false;
+            }
+        }
+
+        /** {@inheritDoc} */
+        public int preceding(int offset) {
+            // always round cursor index into valid string index
+            offset = MathUtils.constrain(offset, 0, mCurrent.length() - 1);
+
+            do {
+                offset = mIterator.preceding(offset);
+                if (isLetterOrDigit(offset)) break;
+            } while (isValidOffset(offset));
+
+            return offset;
+        }
+
+        /** {@inheritDoc} */
+        public int following(int offset) {
+            // always round cursor index into valid string index
+            offset = MathUtils.constrain(offset, 0, mCurrent.length() - 1);
+
+            do {
+                offset = mIterator.following(offset);
+                if (isLetterOrDigit(offset - 1)) break;
+            } while (isValidOffset(offset));
+
+            return offset;
+        }
+    }
+
+    private WordIterator mWordIterator = new WordIterator();
 
     private static final Object LAST_TAP_DOWN = new Object();
     private static ArrowKeyMovementMethod sInstance;
diff --git a/core/java/android/text/method/BaseMovementMethod.java b/core/java/android/text/method/BaseMovementMethod.java
index 94c6ed0..f554b90 100644
--- a/core/java/android/text/method/BaseMovementMethod.java
+++ b/core/java/android/text/method/BaseMovementMethod.java
@@ -164,6 +164,9 @@
                 if (KeyEvent.metaStateHasNoModifiers(movementMetaState)) {
                     return left(widget, buffer);
                 } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
+                        KeyEvent.META_CTRL_ON)) {
+                    return leftWord(widget, buffer);
+                } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
                         KeyEvent.META_ALT_ON)) {
                     return lineStart(widget, buffer);
                 }
@@ -173,6 +176,9 @@
                 if (KeyEvent.metaStateHasNoModifiers(movementMetaState)) {
                     return right(widget, buffer);
                 } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
+                        KeyEvent.META_CTRL_ON)) {
+                    return rightWord(widget, buffer);
+                } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
                         KeyEvent.META_ALT_ON)) {
                     return lineEnd(widget, buffer);
                 }
@@ -217,12 +223,18 @@
             case KeyEvent.KEYCODE_MOVE_HOME:
                 if (KeyEvent.metaStateHasNoModifiers(movementMetaState)) {
                     return home(widget, buffer);
+                } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
+                        KeyEvent.META_CTRL_ON)) {
+                    return top(widget, buffer);
                 }
                 break;
 
             case KeyEvent.KEYCODE_MOVE_END:
                 if (KeyEvent.metaStateHasNoModifiers(movementMetaState)) {
                     return end(widget, buffer);
+                } else if (KeyEvent.metaStateHasModifiers(movementMetaState,
+                        KeyEvent.META_CTRL_ON)) {
+                    return bottom(widget, buffer);
                 }
                 break;
         }
@@ -349,6 +361,16 @@
         return false;
     }
 
+    /** {@hide} */
+    protected boolean leftWord(TextView widget, Spannable buffer) {
+        return false;
+    }
+
+    /** {@hide} */
+    protected boolean rightWord(TextView widget, Spannable buffer) {
+        return false;
+    }
+
     /**
      * Performs a home movement action.
      * Moves the cursor or scrolls to the start of the line or to the top of the
diff --git a/core/jni/android_bluetooth_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp
index bbf1ae5..5b21c56 100644
--- a/core/jni/android_bluetooth_HeadsetBase.cpp
+++ b/core/jni/android_bluetooth_HeadsetBase.cpp
@@ -96,11 +96,12 @@
     return 0;
 }
 
-static int is_ascii(char *line) {
-    for (;;line++) {
-        if (*line == 0) return 1;
-        if (*line >> 7) return 0;
-    }
+static void mask_eighth_bit(char *line)
+{
+   for (;;line++) {
+     if (0 == *line) return;
+     *line &= 0x7F;
+   }
 }
 
 static const char* get_line(int fd, char *buf, int len, int timeout_ms,
@@ -164,16 +165,15 @@
 
     *bufit = NULL;
 
-    // Simple validation. Must be all ASCII.
-    // (we sometimes send non-ASCII UTF-8 in address book, but should
-    // never receive non-ASCII UTF-8).
-    // This was added because of the BMW 2005 E46 which sends binary junk.
-    if (is_ascii(buf)) {
-        IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT recv", "%s", buf);
-    } else {
-        LOGW("Ignoring invalid AT command: %s", buf);
-        buf[0] = NULL;
-    }
+    // According to ITU V.250 section 5.1, IA5 7 bit chars are used, 
+    //   the eighth bit or higher bits are ignored if they exists
+    // We mask out only eighth bit, no higher bit, since we do char
+    // string here, not wide char.
+    // We added this processing due to 2 real world problems.
+    // 1 BMW 2005 E46 which sends binary junk
+    // 2 Audi 2010 A3, dial command use 0xAD (soft-hyphen) as number 
+    //   formater, which was rejected by the AT handler
+    mask_eighth_bit(buf);
 
     return buf;
 }
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index 0f71b9f..1c326ba 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -533,16 +533,69 @@
 static void
 android_glGetBufferParameteriv__II_3II
   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGetBufferParameteriv");
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetBufferParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
 static void
 android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGetBufferParameteriv");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetBufferParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 942a0d9..1390506 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -1621,171 +1621,495 @@
 static jboolean
 android_glIsRenderbufferOES__I
   (JNIEnv *_env, jobject _this, jint renderbuffer) {
-    _env->ThrowNew(UOEClass,
-        "glIsRenderbufferOES");
-    return JNI_FALSE;
+    GLboolean _returnValue;
+    _returnValue = glIsRenderbufferOES(
+        (GLuint)renderbuffer
+    );
+    return _returnValue;
 }
 
 /* void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer ) */
 static void
 android_glBindRenderbufferOES__II
   (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
-    _env->ThrowNew(UOEClass,
-        "glBindRenderbufferOES");
+    glBindRenderbufferOES(
+        (GLenum)target,
+        (GLuint)renderbuffer
+    );
 }
 
 /* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */
 static void
 android_glDeleteRenderbuffersOES__I_3II
   (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glDeleteRenderbuffersOES");
+    GLuint *renderbuffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *renderbuffers = (GLuint *) 0;
+
+    if (!renderbuffers_ref) {
+        _env->ThrowNew(IAEClass, "renderbuffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    renderbuffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+    renderbuffers = renderbuffers_base + offset;
+
+    glDeleteRenderbuffersOES(
+        (GLsizei)n,
+        (GLuint *)renderbuffers
+    );
+
+exit:
+    if (renderbuffers_base) {
+        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+            JNI_ABORT);
+    }
 }
 
 /* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */
 static void
 android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
-    _env->ThrowNew(UOEClass,
-        "glDeleteRenderbuffersOES");
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *renderbuffers = (GLuint *) 0;
+
+    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glDeleteRenderbuffersOES(
+        (GLsizei)n,
+        (GLuint *)renderbuffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, renderbuffers, JNI_FALSE);
+    }
 }
 
 /* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */
 static void
 android_glGenRenderbuffersOES__I_3II
   (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGenRenderbuffersOES");
+    jint _exception = 0;
+    GLuint *renderbuffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *renderbuffers = (GLuint *) 0;
+
+    if (!renderbuffers_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "renderbuffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    renderbuffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+    renderbuffers = renderbuffers_base + offset;
+
+    glGenRenderbuffersOES(
+        (GLsizei)n,
+        (GLuint *)renderbuffers
+    );
+
+exit:
+    if (renderbuffers_base) {
+        _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */
 static void
 android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGenRenderbuffersOES");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *renderbuffers = (GLuint *) 0;
+
+    renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glGenRenderbuffersOES(
+        (GLsizei)n,
+        (GLuint *)renderbuffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
 static void
 android_glRenderbufferStorageOES__IIII
   (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
-    _env->ThrowNew(UOEClass,
-        "glRenderbufferStorageOES");
+    glRenderbufferStorageOES(
+        (GLenum)target,
+        (GLenum)internalformat,
+        (GLsizei)width,
+        (GLsizei)height
+    );
 }
 
 /* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */
 static void
 android_glGetRenderbufferParameterivOES__II_3II
   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGetRenderbufferParameterivOES");
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetRenderbufferParameterivOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */
 static void
 android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGetRenderbufferParameterivOES");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetRenderbufferParameterivOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* GLboolean glIsFramebufferOES ( GLuint framebuffer ) */
 static jboolean
 android_glIsFramebufferOES__I
   (JNIEnv *_env, jobject _this, jint framebuffer) {
-    _env->ThrowNew(UOEClass,
-        "glIsFramebufferOES");
-    return JNI_FALSE;
+    GLboolean _returnValue;
+    _returnValue = glIsFramebufferOES(
+        (GLuint)framebuffer
+    );
+    return _returnValue;
 }
 
 /* void glBindFramebufferOES ( GLenum target, GLuint framebuffer ) */
 static void
 android_glBindFramebufferOES__II
   (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
-    _env->ThrowNew(UOEClass,
-        "glBindFramebufferOES");
+    glBindFramebufferOES(
+        (GLenum)target,
+        (GLuint)framebuffer
+    );
 }
 
 /* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */
 static void
 android_glDeleteFramebuffersOES__I_3II
   (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glDeleteFramebuffersOES");
+    GLuint *framebuffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *framebuffers = (GLuint *) 0;
+
+    if (!framebuffers_ref) {
+        _env->ThrowNew(IAEClass, "framebuffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    framebuffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+    framebuffers = framebuffers_base + offset;
+
+    glDeleteFramebuffersOES(
+        (GLsizei)n,
+        (GLuint *)framebuffers
+    );
+
+exit:
+    if (framebuffers_base) {
+        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+            JNI_ABORT);
+    }
 }
 
 /* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */
 static void
 android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
-    _env->ThrowNew(UOEClass,
-        "glDeleteFramebuffersOES");
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *framebuffers = (GLuint *) 0;
+
+    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glDeleteFramebuffersOES(
+        (GLsizei)n,
+        (GLuint *)framebuffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, framebuffers, JNI_FALSE);
+    }
 }
 
 /* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */
 static void
 android_glGenFramebuffersOES__I_3II
   (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGenFramebuffersOES");
+    jint _exception = 0;
+    GLuint *framebuffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *framebuffers = (GLuint *) 0;
+
+    if (!framebuffers_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "framebuffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    framebuffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+    framebuffers = framebuffers_base + offset;
+
+    glGenFramebuffersOES(
+        (GLsizei)n,
+        (GLuint *)framebuffers
+    );
+
+exit:
+    if (framebuffers_base) {
+        _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */
 static void
 android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGenFramebuffersOES");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *framebuffers = (GLuint *) 0;
+
+    framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glGenFramebuffersOES(
+        (GLsizei)n,
+        (GLuint *)framebuffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* GLenum glCheckFramebufferStatusOES ( GLenum target ) */
 static jint
 android_glCheckFramebufferStatusOES__I
   (JNIEnv *_env, jobject _this, jint target) {
-    _env->ThrowNew(UOEClass,
-        "glCheckFramebufferStatusOES");
-    return 0;
+    GLenum _returnValue;
+    _returnValue = glCheckFramebufferStatusOES(
+        (GLenum)target
+    );
+    return _returnValue;
 }
 
 /* void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
 static void
 android_glFramebufferRenderbufferOES__IIII
   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
-    _env->ThrowNew(UOEClass,
-        "glFramebufferRenderbufferOES");
+    glFramebufferRenderbufferOES(
+        (GLenum)target,
+        (GLenum)attachment,
+        (GLenum)renderbuffertarget,
+        (GLuint)renderbuffer
+    );
 }
 
 /* void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
 static void
 android_glFramebufferTexture2DOES__IIIII
   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
-    _env->ThrowNew(UOEClass,
-        "glFramebufferTexture2DOES");
+    glFramebufferTexture2DOES(
+        (GLenum)target,
+        (GLenum)attachment,
+        (GLenum)textarget,
+        (GLuint)texture,
+        (GLint)level
+    );
 }
 
 /* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
 static void
 android_glGetFramebufferAttachmentParameterivOES__III_3II
   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGetFramebufferAttachmentParameterivOES");
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetFramebufferAttachmentParameterivOES(
+        (GLenum)target,
+        (GLenum)attachment,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
 static void
 android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGetFramebufferAttachmentParameterivOES");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetFramebufferAttachmentParameterivOES(
+        (GLenum)target,
+        (GLenum)attachment,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* void glGenerateMipmapOES ( GLenum target ) */
 static void
 android_glGenerateMipmapOES__I
   (JNIEnv *_env, jobject _this, jint target) {
-    _env->ThrowNew(UOEClass,
-        "glGenerateMipmapOES");
+    glGenerateMipmapOES(
+        (GLenum)target
+    );
 }
 
 /* void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) */
diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp
index ef25319..7ac0f6e 100644
--- a/core/jni/android_opengl_GLES20.cpp
+++ b/core/jni/android_opengl_GLES20.cpp
@@ -249,16 +249,19 @@
 static void
 android_glBlendEquation__I
   (JNIEnv *_env, jobject _this, jint mode) {
-    _env->ThrowNew(UOEClass,
-        "glBlendEquation");
+    glBlendEquation(
+        (GLenum)mode
+    );
 }
 
 /* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
 static void
 android_glBlendEquationSeparate__II
   (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
-    _env->ThrowNew(UOEClass,
-        "glBlendEquationSeparate");
+    glBlendEquationSeparate(
+        (GLenum)modeRGB,
+        (GLenum)modeAlpha
+    );
 }
 
 /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
@@ -275,8 +278,12 @@
 static void
 android_glBlendFuncSeparate__IIII
   (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
-    _env->ThrowNew(UOEClass,
-        "glBlendFuncSeparate");
+    glBlendFuncSeparate(
+        (GLenum)srcRGB,
+        (GLenum)dstRGB,
+        (GLenum)srcAlpha,
+        (GLenum)dstAlpha
+    );
 }
 
 /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
@@ -1643,16 +1650,69 @@
 static void
 android_glGetBufferParameteriv__II_3II
   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
-    _env->ThrowNew(UOEClass,
-        "glGetBufferParameteriv");
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetBufferParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
 }
 
 /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
 static void
 android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
-    _env->ThrowNew(UOEClass,
-        "glGetBufferParameteriv");
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetBufferParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
 }
 
 /* GLenum glGetError ( void ) */
diff --git a/docs/html/guide/market/billing/billing_about.jd b/docs/html/guide/market/billing/billing_about.jd
index ed45c19..5924170 100755
--- a/docs/html/guide/market/billing/billing_about.jd
+++ b/docs/html/guide/market/billing/billing_about.jd
@@ -25,66 +25,6 @@
 </div>
 </div>
 
-<p>The in-app billing release has now entered the testing phase. During this phase we are providing <a href="{@docRoot}guide/market/billing/index.html">documentation</a> and a <a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">sample application</a> that shows you how to implement in-app billing. You can use these resources to start designing and testing your in-app billing implementations.</p>
+<p>Android Market In-app Billing has reached the final launch milestone and is now available to developers and users. You can now publish applications that use Android Market's in-app billing service, and users can make in-app purchases. To find out how to implement in-app billing in your applications, see the  <a href="{@docRoot}guide/market/billing/index.html">documentation</a> and the <a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">sample application</a>.</p>
 
-<p>Following the testing phase we will launch in-app billing to the general public (see table 1 for a summary launch milestones).
 
-<p class="table-caption"><strong>Table 1.</strong> Summary of launch milestones for in-app billing.</p>
-
-<table>
-
-<tr>
-<th>Release Phase</th>
-<th>Status</th>
-<th>Description</th>
-</tr>
-<tr>
-  <td>Early Development</td>
-  <td>Completed</td>
-  <td>Provided an early look at the documentation and the sample application.</td>
-</tr>
-<tr>
-  <td>Test Development</td>
-  <td>In process</td>
-  <td>You can perform static testing with reserved product IDs and end-to-end testing with real product IDs. You cannot publish applications that use in-app billing.</td>
-</tr>
-<tr>
-  <td>Final Release</td>
-  <td>Coming soon</td>
-  <td>You can perform static testing with reserved product IDs and end-to-end testing with real product IDs. You can publish applications that use in-app billing.</td>
-</tr>
-
-</table>
-
-<p>During the testing phase we are releasing version 2.3.4 of the Android Market application and version 5.0.12 of the MyApps application. To support in-app billing, devices running Android 3.0 must have version 5.0.12 (or higher) of the MyApps application. Devices running all other versions of Android must have version 2.3.4 (or higher) of the Android Market application. Table 2 summarizes these requirements.</p>
-
-<p class="table-caption"><strong>Table 2.</strong> Summary of in-app billing requirements.</p>
-
-<table>
-
-<tr>
-<th>If your device is running this...</th>
-<th>In-app billing requires this</th>
-</tr>
-<tr>
-  <td>Android 1.6</td>
-  <td>Android Market 2.3.4 (or higher)</td>
-</tr>
-<tr>
-  <td>Android 2.x</td>
-  <td>Android Market 2.3.4 (or higher)</td>
-</tr>
-<tr>
-  <td>Android 3.0</td>
-  <td>MyApps 5.0.12 (or higher)</td>
-</tr>
-
-</table>
-
-<p class="note"><strong>Note:</strong> To learn how to check the version of the Android Market application, see <a href="http://market.android.com/support/bin/answer.py?answer=190860">Updating Android Market</a>. To learn about other requirements for in-app billing, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-limitations">Requirements and Limitations.</a></p>
-
-<p>You can test your in-app billing implementation two ways during the testing phase: you can use the <a href="{@docRoot}guide/market/billing/billing_testing.html#billing-testing-static">reserved product IDs</a> to test static responses or you can use <a href="{@docRoot}guide/market/billing/billing_testing.html#billing-testing-real">your own product IDs</a> to test end-to-end in-app purchases. To perform end-to-end testing you need to upload your application as a draft application and add products to the application's product list.</p>
-
-<p>During the testing phase, you cannot publish applications that use in-app billing; you can only upload the applications as draft applications. After the testing phase is complete, we will launch in-app billing to the general public and you will be able to publish applications that use in-app billing.</p>
-
-<p>This documentation may change as we move from the testing phase to the final release. Be sure to check this documentation frequently for updates.</p>
diff --git a/docs/html/guide/market/billing/billing_admin.jd b/docs/html/guide/market/billing/billing_admin.jd
index 16a2a36..38099ee 100755
--- a/docs/html/guide/market/billing/billing_admin.jd
+++ b/docs/html/guide/market/billing/billing_admin.jd
@@ -28,28 +28,24 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
 <p>In-app billing frees you from processing financial transactions, but you still need to perform a few administrative tasks, including setting up and maintaining your product list on the publisher site, registering test accounts, and handling refunds when necessary.</p>
 
 <p>You must have an Android Market publisher account to register test accounts. And you must have a Google Checkout Merchant account to create a product list and issue refunds to your users. If you already have a publisher account on Android Market, you can use your existing account. You do not need to register for a new account to support in-app billing. If you do not have a publisher account, you can register as an Android Market developer and set up a publisher account at the Android Market <a href="http://market.android.com/publish">publisher site</a>. If you do not have a Google Checkout Merchant account, you can register for one at the <a href="http://checkout.google.com">Google Checkout site</a>.</p>
 
 <h2 id="billing-list-setup">Creating a Product List</h2>
 
-<p>The Android Market publisher site provides a product list for each of your published applications. You can sell an item using the in-app billing feature only if the item is listed on an application's product list. Each application has its own product list; you cannot sell items that are listed in another application's product list.</p>
+<p>The Android Market publisher site provides a product list for each of your published applications. You can sell an item using Android Market's in-app billing feature only if the item is listed on an application's product list. Each application has its own product list; you cannot sell items that are listed in another application's product list.</p>
 
 <p>You can access an application's product list by clicking the <strong>In-App Products</strong> link that appears under each of the applications that are listed for your publisher account (see figure 1). The <strong>In-App Products</strong> link appears only if you have a Google Checkout Merchant account and an application's manifest includes the <code>com.android.vending.BILLING</code> permission.</p>
 
-<img src="{@docRoot}images/billing_product_list_entry.png" height="540" id="figure1" />
+<img src="{@docRoot}images/billing_product_list_entry.png" height="548" id="figure1" />
 <p class="img-caption">
   <strong>Figure 1.</strong> You can access an application's product list by clicking the <strong>In-App Products</strong> link.
 </p>
 
 <p>A product list contains information about the items you are selling, such as a product id, product description, and price (see figure 2). The product list stores only metadata about the items you are selling in your application. It does not store any digital content. You are responsible for storing and delivering the digital content that you sell in your applications.</p>
 
-<img src="{@docRoot}images/billing_product_list.png" height="742" id="figure2" />
+<img src="{@docRoot}images/billing_product_list.png" height="560" id="figure2" />
 <p class="img-caption">
   <strong>Figure 2.</strong> An application's product list.
 </p>
@@ -65,7 +61,7 @@
   <li>On the Create New In-app Product page (see figure 3), provide details about the item you are selling and then click <strong>Save</strong>.</li>
 </ol>
 
-<img src="{@docRoot}images/billing_list_form.png" height="854" id="figure3" />
+<img src="{@docRoot}images/billing_list_form.png" height="840" id="figure3" />
 <p class="img-caption">
   f<strong>Figure 3.</strong> The Create New In-app Product page lets you add items to an application's product list.
 </p>
@@ -117,7 +113,7 @@
 
 <h2 id="billing-refunds">Handling Refunds</h2>
 
-<p>The in-app billing feature does not allow users to send a refund request to Android Market. Refunds for purchases that were made with the in-app billing feature must be directed to you (the application developer). You can then process the refund through your Google Checkout Merchant account. When you do this, Android Market receives a refund notification from Google Checkout, and Android Market sends a refund message to your application. For more information, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-action-notify">Handling IN_APP_NOTIFY messages</a> and <a href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing Pricing</a>.</p>
+<p>In-app billing does not allow users to send a refund request to Android Market. Refunds for in-app purchases must be directed to you (the application developer). You can then process the refund through your Google Checkout Merchant account. When you do this, Android Market receives a refund notification from Google Checkout, and Android Market sends a refund message to your application. For more information, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-action-notify">Handling IN_APP_NOTIFY messages</a> and <a href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing Pricing</a>.</p>
 
 <h2 id="billing-testing-setup">Setting Up Test Accounts</h2>
 
@@ -171,12 +167,6 @@
 href="http://stackoverflow.com/questions/tagged/android">http://stackoverflow.com/questions/tagged/android</a></td>
 </tr>
 <tr>
-<td>Accounts, publishing, and deployment issues</td>
-<td><a href="http://www.google.com/support/forum/p/Android+Market">Android
-Market Help Forum</a></td>
-<td>Publisher accounts, Android Market key pair, test accounts, server responses, test responses, application deployment and results.</td>
-</tr>
-<tr>
 <td>Market billing issue tracker</td>
 <td><a href="http://code.google.com/p/marketbilling/issues/">Market billing
 project issue tracker</a></td>
diff --git a/docs/html/guide/market/billing/billing_best_practices.jd b/docs/html/guide/market/billing/billing_best_practices.jd
index a505de4..6f9f64c 100755
--- a/docs/html/guide/market/billing/billing_best_practices.jd
+++ b/docs/html/guide/market/billing/billing_best_practices.jd
@@ -24,11 +24,7 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
-<p>As you design your in-app billing implementation, be sure to follow the security and design guidelines that are discussed in this document. These guidelines are recommended best practices for anyone who is using the Android Market in-app billing service and can be incorporated into any in-app billing implementation.</p>
+<p>As you design your in-app billing implementation, be sure to follow the security and design guidelines that are discussed in this document. These guidelines are recommended best practices for anyone who is using Android Market's in-app billing service.</p>
 
 <h2>Security Best Practices</h2>
 
diff --git a/docs/html/guide/market/billing/billing_integrate.jd b/docs/html/guide/market/billing/billing_integrate.jd
index d027686..26bda66 100755
--- a/docs/html/guide/market/billing/billing_integrate.jd
+++ b/docs/html/guide/market/billing/billing_integrate.jd
@@ -30,11 +30,7 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
-<p>The Android Market in-app billing service provides a straightforward, simple interface for sending in-app billing requests and managing in-app billing transactions using Android Market. This document helps you implement in-app billing by stepping through the primary implementation tasks, using the in-app billing sample application as an example.</p>
+<p>Android Market In-app Billing provides a straightforward, simple interface for sending in-app billing requests and managing in-app billing transactions using Android Market. This document helps you implement in-app billing by stepping through the primary implementation tasks, using the in-app billing sample application as an example.</p>
 
 <p>Before you implement in-app billing in your own application, be sure that you read <a href="{@docRoot}guide/market/billing/billing_overview.html">Overview of In-app Billing</a> and <a href="{@docRoot}guide/market/billing/billing_best_practices.html">Security and Design</a>. These documents provide background information that will make it easier for you to implement in-app billing.</p>
 
@@ -51,7 +47,7 @@
 
 <h2 id="billing-download">Downloading the Sample Application</h2>
 
-<p>The in-app billing sample application shows you how to perform several tasks that are common to all in-app billing implementations, including:</p>
+<p>The in-app billing sample application shows you how to perform several tasks that are common to all Android Market in-app billing implementations, including:</p>
 
 <ul>
   <li>Sending in-app billing requests to the Android Market application.</li>
@@ -64,8 +60,7 @@
 <p>The sample application includes an application file (<code>Dungeons.java</code>), the AIDL file for the <code>MarketBillingService</code> (<code>IMarketBillingService.aidl</code>), and several classes that demonstrate in-app billing messaging. It also includes a class that demonstrates basic security tasks, such as signature verification.</p>
 
 <p>Table 1 lists the source files that are included with the sample application.</p>
-<p class="table-caption" id="source-files-table"><strong>Table 1.</strong>
-In-app billing sample application source files.</p>
+<p class="table-caption" id="source-files-table"><strong>Table 1.</strong> In-app billing sample application source files.</p>
 
 <table>
 <tr>
@@ -75,7 +70,7 @@
 
 <tr>
 <td>IMarketBillingService.aidl</td>
-<td>Android Interface Definition Library (AIDL) file that defines the IPC interface to the Android Market in-app billing service (<code>MarketBillingService</code>).</td>
+<td>Android Interface Definition Library (AIDL) file that defines the IPC interface to Android Market's in-app billing service (<code>MarketBillingService</code>).</td>
 </tr>
 
 <tr>
@@ -142,7 +137,7 @@
 <ul>
   <li>Configuring and building the sample application.</li>
   <li>Uploading the sample application to Android Market.</li>
-  <li>Setting up test accounts and running the sample application</li>
+  <li>Setting up test accounts and running the sample application.</li>
 </ul>
 
 <p class="note"><strong>Note:</strong> Building and running the sample application is necessary only if you want to see a demonstration of in-app billing. If you do not want to run the sample application, you can skip to the next section, <a href="#billing-add-aidl">Adding the AIDL file to your project</a>.</p>
@@ -221,7 +216,7 @@
 
 <h2 id="billing-add-aidl">Adding the AIDL file to your project</h2>
 
-<p>The sample application contains an Android Interface Definition Language (AIDL) file,  which defines the interface to the Android Market in-app billing service <code>MarketBillingService</code>). When you add this file to your project, the Android build environment creates an interface file (<code>IMarketBillingService.java</code>). You can then use this interface to make billing requests by invoking IPC method calls.</p>
+<p>The sample application contains an Android Interface Definition Language (AIDL) file,  which defines the interface to Android Market's in-app billing service (<code>MarketBillingService</code>). When you add this file to your project, the Android build environment creates an interface file (<code>IMarketBillingService.java</code>). You can then use this interface to make billing requests by invoking IPC method calls.</p>
 
 <p>If you are using the ADT plug-in with Eclipse, you can just add this file to your <code>/src</code> directory. Eclipse will automatically generate the interface file when you build your project (which should happen immediately). If you are not using the ADT plug-in, you can put the AIDL file into your project and use the Ant tool to build your project so that the <code>IMarketBillingService.java</code> file gets generated.</p>
 
@@ -372,7 +367,7 @@
 <p>The <code>makeRequestBundle()</code> method constructs an initial Bundle, which contains the three keys that are required for all requests: <code>BILLING_REQUEST</code>, <code>API_VERSION</code>, and <code>PACKAGE_NAME</code>. The request returns a synchronous {@link android.os.Bundle} response, which contains only a single key: <code>RESPONSE_CODE</code>. The <code>RESPONSE_CODE</code> key can have the following values:</p>
 <ul>
   <li><code>RESULT_OK</code>&mdash;in-app billing is supported.</li>
-  <li><code>RESULT_BILLING_UNAVAILABLE</code>&mdash;in-app billing is not available because the in-app billing API version you specified is not recognized or the user is not eligible to make in-app purchases (for example, the user resides in a country that prohibits in-app purchases).</li>
+  <li><code>RESULT_BILLING_UNAVAILABLE</code>&mdash;in-app billing is not available because the API version you specified is not recognized or the user is not eligible to make in-app purchases (for example, the user resides in a country that prohibits in-app purchases).</li>
   <li><code>RESULT_ERROR</code>&mdash;there was an error connecting with the Android Market application.</li>
   <li><code>RESULT_DEVELOPER_ERROR</code>&mdash;the application is trying to make an in-app billing request but the application has not declared the <code>com.android.vending.BILLING</code> permission in its manifest. Can also indicate that an application is not properly signed, or that you sent a malformed request.</li>
 </ul>
@@ -633,7 +628,7 @@
 
 <h2 id="billing-signatures">Verifying Signatures and Nonces</h2>
 
-<p>The in-app billing service uses two mechanisms to help verify the integrity of the transaction information you receive from Android Market: nonces and signatures. A nonce (number used once) is a cryptographically secure number that your application generates and sends with every <code>GET_PURCHASE_INFORMATION</code> and <code>RESTORE_TRANSACTIONS</code> request. The nonce is returned with the <code>PURCHASE_STATE_CHANGED</code> broadcast intent, enabling you to verify that any given <code>PURCHASE_STATE_CHANGED</code> response corresponds to an actual request that you made. Every <code>PURCHASE_STATE_CHANGED</code> broadcast intent also includes a signed JSON string and a signature, which you can use to verify the integrity of the response.</p>
+<p>Android Market's in-app billing service uses two mechanisms to help verify the integrity of the transaction information you receive from Android Market: nonces and signatures. A nonce (number used once) is a cryptographically secure number that your application generates and sends with every <code>GET_PURCHASE_INFORMATION</code> and <code>RESTORE_TRANSACTIONS</code> request. The nonce is returned with the <code>PURCHASE_STATE_CHANGED</code> broadcast intent, enabling you to verify that any given <code>PURCHASE_STATE_CHANGED</code> response corresponds to an actual request that you made. Every <code>PURCHASE_STATE_CHANGED</code> broadcast intent also includes a signed JSON string and a signature, which you can use to verify the integrity of the response.</p>
 
 <p>Your application must provide a way to generate, manage, and verify nonces. The following sample code shows some simple methods you can use to do this.</p>
 
diff --git a/docs/html/guide/market/billing/billing_overview.jd b/docs/html/guide/market/billing/billing_overview.jd
index 36f9d53c..feac5b0 100755
--- a/docs/html/guide/market/billing/billing_overview.jd
+++ b/docs/html/guide/market/billing/billing_overview.jd
@@ -33,11 +33,7 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
-<p>The Android Market In-app Billing service is an Android Market feature that provides checkout processing for in-app purchases. To use the service, your application sends a billing request for a specific in-app product. The service then handles all of the checkout details for the transaction, including requesting and validating the form of payment and processing the financial transaction. When the checkout process is complete, the service sends your application the purchase details, such as the order number, the order date and time, and the price paid. At no point does your application have to handle any financial transactions; that role is provided by the in-app billing service.</p>
+<p>Android Market In-app Billing is an Android Market service that provides checkout processing for in-app purchases. To use the service, your application sends a billing request for a specific in-app product. The service then handles all of the checkout details for the transaction, including requesting and validating the form of payment and processing the financial transaction. When the checkout process is complete, the service sends your application the purchase details, such as the order number, the order date and time, and the price paid. At no point does your application have to handle any financial transactions; that role is provided by Android Market's in-app billing service.</p>
 
 <h2 id="billing-arch">In-app Billing Architecture</h2>
 
@@ -53,7 +49,7 @@
 
 <p>A typical in-app billing implementation relies on three components:</p>
 <ul>
-  <li>A {@link android.app.Service} (named <code>BillingService</code> in the sample application), which processes purchase messages from the application and sends billing requests to the in-app billing service.</li>
+  <li>A {@link android.app.Service} (named <code>BillingService</code> in the sample application), which processes purchase messages from the application and sends billing requests to Android Market's in-app billing service.</li>
   <li>A {@link android.content.BroadcastReceiver} (named <code>BillingReceiver</code> in the sample application), which receives all asynchronous billing responses from the Android Market application.</li>
   <li>A security component (named <code>Security</code> in the sample application), which performs security-related tasks, such as signature verification and nonce generation. For more information about in-app billing security, see <a href="#billing-security">Security controls</a> later in this document.</li>
 </ul>
@@ -68,7 +64,7 @@
 
 <h2 id="billing-msgs">In-app Billing Messages</h2>
 
-<p>When the user initiates a purchase, your application sends billing messages to the in-app billing service (named <code>MarketBillingService</code>) using simple IPC method calls. The Android Market application responds to all billing requests synchronously, providing your application with status notifications and other information. The Android Market application also responds to some billing requests asynchronously, providing your application with error messages and detailed transaction information. The following section describes the basic request-response messaging that takes place between your application and the Android Market application.</p>
+<p>When the user initiates a purchase, your application sends billing messages to Android Market's in-app billing service (named <code>MarketBillingService</code>) using simple IPC method calls. The Android Market application responds to all billing requests synchronously, providing your application with status notifications and other information. The Android Market application also responds to some billing requests asynchronously, providing your application with error messages and detailed transaction information. The following section describes the basic request-response messaging that takes place between your application and the Android Market application.</p>
 
 <h3 id="billing-request">In-app billing requests</h3>
 
@@ -76,7 +72,7 @@
 
 <p>The <code>sendBillingRequest()</code> method has a single {@link android.os.Bundle} parameter. The Bundle that you deliver must include several key-value pairs that specify various parameters for the request, such as the type of billing request you are making, the item that is being purchased, and the application that is making the request. For more information about the Bundle keys that are sent with a request, see <a href="{@docRoot}guide/market/billing/billing_reference.html#billing-interface">In-app Billing Service Interface</a>.
 
-<p>One of the most important keys that every request Bundle must have is the <code>BILLING_REQUEST</code> key. This key lets you specify the type of billing request you are making. The in-app billing service supports the following five types of billing requests:</p>
+<p>One of the most important keys that every request Bundle must have is the <code>BILLING_REQUEST</code> key. This key lets you specify the type of billing request you are making. Android Market's in-app billing service supports the following five types of billing requests:</p>
 
 <ul>
   <li><code>CHECK_BILLING_SUPPORTED</code>
@@ -190,7 +186,7 @@
 </p>
 </div>
 
-<p>The synchronous response for a <code>CHECK_BILLING_SUPPORTED</code> request provides a Bundle with a server response code.  A <code>RESULT_OK</code> response code indicates that in-app billing is supported; a <code>RESULT_BILLING_UNAVAILABLE</code> response code indicates that in-app billing is unavailable because the in-app billing API version you specified is unrecognized or the user is not eligible to make in-app purchases (for example, the user resides in a country that does not allow in-app billing). A <code>SERVER_ERROR</code> can also be returned, indicating that there was a problem with the Android Market server.</p>
+<p>The synchronous response for a <code>CHECK_BILLING_SUPPORTED</code> request provides a Bundle with a server response code.  A <code>RESULT_OK</code> response code indicates that in-app billing is supported; a <code>RESULT_BILLING_UNAVAILABLE</code> response code indicates that in-app billing is unavailable because the API version you specified is unrecognized or the user is not eligible to make in-app purchases (for example, the user resides in a country that does not allow in-app billing). A <code>SERVER_ERROR</code> can also be returned, indicating that there was a problem with the Android Market server.</p>
 
 <h3 id="billing-action-notify">Handling IN_APP_NOTIFY messages</h3>
 
@@ -227,7 +223,7 @@
 
 <ul>
   <li>In-app billing can be implemented only in applications that you publish through Android Market.</li>
-  <li>You must have a Google Checkout Merchant account to use the in-app billing service.</li>
+  <li>You must have a Google Checkout Merchant account to use Android Market In-app Billing.</li>
   <li>If your device is running Android 3.0, in-app billing requires version 5.0.12 (or higher) of the MyApps application. If your device is running any other version of Android, in-app billing requires version 2.3.4 (or higher) of the Android Market application.</li>
   <li>An application can use in-app billing only if the device is running Android 1.6 (API level 4) or higher.</li>
   <li>You can use in-app billing to sell only digital content. You cannot use in-app billing to sell physical goods, personal services, or anything that requires physical delivery.</li>
diff --git a/docs/html/guide/market/billing/billing_reference.jd b/docs/html/guide/market/billing/billing_reference.jd
index 744c4d1..292823d 100755
--- a/docs/html/guide/market/billing/billing_reference.jd
+++ b/docs/html/guide/market/billing/billing_reference.jd
@@ -27,10 +27,6 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
 <p>The following document provides technical reference information for the following:</p>
 
 <ul>
@@ -84,7 +80,7 @@
 
 <h2 id="billing-interface">In-app Billing Service Interface</h2>
 
-<p>The following section describes the interface for the Android Market in-app billing service. The interface is defined in the <code>IMarketBillingService.aidl</code> file, which is included with the in-app billing <a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">sample application</a>.</p>
+<p>The following section describes the interface for Android Market's in-app billing service. The interface is defined in the <code>IMarketBillingService.aidl</code> file, which is included with the in-app billing <a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">sample application</a>.</p>
 <p>The interface consists of a single request method <code>sendBillingRequest()</code>. This method takes a single {@link android.os.Bundle} parameter. The Bundle parameter includes several key-value pairs, which are summarized in table 2.</p>
 
 <p class="table-caption"><strong>Table 2.</strong> Description of Bundle keys passed in a <code>sendBillingRequest()</code> request.</p>
@@ -110,7 +106,7 @@
   <td><code>int</code></td>
   <td>1</td>
   <td>Yes</td>
-  <td>The version of the in-app billing service you are using. The current version is 1.</td>
+  <td>The version of Android Market's in-app billing service you are using. The current version is 1.</td>
 </tr>
 <tr>
   <td><code>PACKAGE_NAME</code></td>
@@ -124,7 +120,7 @@
   <td><code>String</code></td>
   <td>Any valid product identifier.</td>
   <td>Required for <code>REQUEST_PURCHASE</code> requests.</td>
-  <td>The product ID of the item you are making a billing request for. Every in-app item that you sell using the in-app billing service must have a unique product ID, which you specify on the Android Market publisher site.</td>
+  <td>The product ID of the item you are making a billing request for. Every in-app item that you sell using Android Market's in-app billing service must have a unique product ID, which you specify on the Android Market publisher site.</td>
 </tr>
 <tr>
   <td><code>NONCE</code></td>
diff --git a/docs/html/guide/market/billing/billing_testing.jd b/docs/html/guide/market/billing/billing_testing.jd
index c900e8b..742e7ef4d 100755
--- a/docs/html/guide/market/billing/billing_testing.jd
+++ b/docs/html/guide/market/billing/billing_testing.jd
@@ -26,10 +26,6 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
-
 <p>The Android Market publisher site provides several tools that help you test your in-app billing implementation before it is published. You can use these tools to create test accounts and purchase special reserved items that send static billing responses to your application.</p>
 
 <p>To test in-app billing in an application you must install the application on an Android-powered device. You cannot use the Android emulator to test in-app billing.  The device you use for testing must run a standard version of the Android 1.6 or later platform (API level 4 or higher), and have the most current version of the Android Market application installed. If a device is not running the most current Android Market application, your application won't be able to send in-app billing requests to Android Market. For general information about how to set up a device for use in developing Android applications, see <a
@@ -60,7 +56,7 @@
     <p>When you make an in-app billing request with this product ID Android Market responds as though the purchase was canceled. This can occur when an error is encountered in the order process, such as an invalid credit card, or when you cancel a user's order before it is charged.</p>
   </li>
   <li><strong>android.test.refunded</strong>
-    <p>When you make an in-app billing request with this product ID, Android Market responds as though the purchase was refunded. Refunds cannot be initiated through the in-app billing feature. Refunds must be initiated by you (the merchant). A refund message is sent to your application by Android Market only when Android Market gets notification from Google Checkout that a refund has been made. For more information about refunds, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-action-notify">Handling IN_APP_NOTIFY messages</a> and <a href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing Pricing</a>.</p>
+    <p>When you make an in-app billing request with this product ID, Android Market responds as though the purchase was refunded. Refunds cannot be initiated through Android Market's in-app billing service. Refunds must be initiated by you (the merchant). After you process a refund request through your Google Checkout account, a refund message is sent to your application by Android Market. This occurs only when Android Market gets notification from Google Checkout that a refund has been made. For more information about refunds, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-action-notify">Handling IN_APP_NOTIFY messages</a> and <a href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing Pricing</a>.</p>
   </li>
   <li><strong>android.test.item_unavailable</strong>
     <p>When you make an in-app billing request with this product ID, Android Market responds as though the item being purchased was not listed in your application's product list.</p>
diff --git a/docs/html/guide/market/billing/index.jd b/docs/html/guide/market/billing/index.jd
index e7f8ee3..fb85fa6 100755
--- a/docs/html/guide/market/billing/index.jd
+++ b/docs/html/guide/market/billing/index.jd
@@ -23,13 +23,9 @@
 </div>
 </div>
 
-<div class="special" style="margin-right:345px">
-  <p>During the testing phase of the in-app billing release you cannot publish applications that implement in-app billing. You can only upload in-app billing applications as draft applications. For more information, see <a href="{@docRoot}guide/market/billing/billing_about.html">About this Release</a></p>
-</div>
+<p>Android Market In-app Billing is an Android Market service that lets you sell digital content in your applications. You can use the service to sell a wide range of content, including downloadable content such as media files or photos, and virtual content such as game levels or potions.</p>
 
-<p>In-app billing is an Android Market service that lets you sell digital content in your applications. You can use the service to sell a wide range of content, including downloadable content such as media files or photos, and virtual content such as game levels or potions.</p>
-
-<p>When you use the Android Market in-app billing service to sell an item, Android Market handles all checkout details so your application never has to directly process any financial transactions. Android Market uses the same checkout service that is used for application purchases, so your users experience a consistent and familiar purchase flow (see figure 1). Also, the transaction fee for in-app purchases is the same as the transaction fee for application purchases (30%).</p>
+<p>When you use Android Market's in-app billing service to sell an item, Android Market handles all checkout details so your application never has to directly process any financial transactions. Android Market uses the same checkout service that is used for application purchases, so your users experience a consistent and familiar purchase flow (see figure 1). Also, the transaction fee for in-app purchases is the same as the transaction fee for application purchases (30%).</p>
 
 <p>Any application that you publish through Android Market can implement in-app billing. No special account or registration is required other than an Android Market publisher account and a Google Checkout Merchant account. Also, because the service uses no dedicated framework APIs, you can add in-app billing to any application that uses a minimum API level of 4 or higher.</p>
 
@@ -42,7 +38,7 @@
   <strong>Figure 1.</strong> Applications initiate in-app billing requests through their own UI (first screen). Android Market responds to the request by providing the checkout user interface (middle screen). When checkout is complete, the application resumes.
 </p>
 
-<p>To learn more about the in-app billing service and start integrating in-app billing into your applications, read the following documents:</p>
+<p>To learn more about Android Market's in-app billing service and start integrating it into your applications, read the following documents:</p>
 
 <dl>
   <dt><strong><a href="{@docRoot}guide/market/billing/billing_overview.html">Overview of In-app Billing</a></strong></dt>
diff --git a/docs/html/images/billing_list_form.png b/docs/html/images/billing_list_form.png
index ee30de3..de7ea22 100755
--- a/docs/html/images/billing_list_form.png
+++ b/docs/html/images/billing_list_form.png
Binary files differ
diff --git a/docs/html/images/billing_product_list.png b/docs/html/images/billing_product_list.png
index 5b8d174..49a7e79 100755
--- a/docs/html/images/billing_product_list.png
+++ b/docs/html/images/billing_product_list.png
Binary files differ
diff --git a/docs/html/images/billing_product_list_entry.png b/docs/html/images/billing_product_list_entry.png
index b7bfc7a..df3f9a8 100755
--- a/docs/html/images/billing_product_list_entry.png
+++ b/docs/html/images/billing_product_list_entry.png
Binary files differ
diff --git a/graphics/java/android/graphics/YuvImage.java b/graphics/java/android/graphics/YuvImage.java
index 9368da6..af3f276 100644
--- a/graphics/java/android/graphics/YuvImage.java
+++ b/graphics/java/android/graphics/YuvImage.java
@@ -36,7 +36,7 @@
     private final static int WORKING_COMPRESS_STORAGE = 4096;
 
    /**
-     * The YUV format as defined in {@link PixelFormat}.
+     * The YUV format as defined in {@link ImageFormat}.
      */
     private int mFormat;
 
@@ -67,7 +67,7 @@
      *
      * @param yuv     The YUV data. In the case of more than one image plane, all the planes must be
      *                concatenated into a single byte array.
-     * @param format  The YUV data format as defined in {@link PixelFormat}.
+     * @param format  The YUV data format as defined in {@link ImageFormat}.
      * @param width   The width of the YuvImage.
      * @param height  The height of the YuvImage.
      * @param strides (Optional) Row bytes of each image plane. If yuv contains padding, the stride
@@ -152,7 +152,7 @@
     }
 
     /**
-     * @return the YUV format as defined in {@link PixelFormat}.
+     * @return the YUV format as defined in {@link ImageFormat}.
      */
     public int getYuvFormat() {
         return mFormat;
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index f3c8f64..3c6dccc 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -219,12 +219,6 @@
             // send command to camera driver
             status_t    sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
 
-            // return the total number of available video buffers.
-            int32_t     getNumberOfVideoBuffers() const;
-
-            // return the individual video buffer corresponding to the given index.
-            sp<IMemory> getVideoBuffer(int32_t index) const;
-
             // tell camera hal to store meta data or real YUV in video buffers.
             status_t    storeMetaDataInBuffers(bool enabled);
 
diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h
index 86bd849..3f34120 100644
--- a/include/camera/CameraHardwareInterface.h
+++ b/include/camera/CameraHardwareInterface.h
@@ -28,16 +28,6 @@
 
 namespace android {
 
-/**
- *  The size of image for display.
- */
-typedef struct image_rect_struct
-{
-  uint32_t width;      /* Image width */
-  uint32_t height;     /* Image height */
-} image_rect_type;
-
-
 typedef void (*notify_callback)(int32_t msgType,
                                 int32_t ext1,
                                 int32_t ext2,
@@ -90,9 +80,6 @@
     /** Set the ANativeWindow to which preview frames are sent */
     virtual status_t setPreviewWindow(const sp<ANativeWindow>& buf) = 0;
 
-    /** Return the IMemoryHeap for the raw image heap */
-    virtual sp<IMemoryHeap>         getRawHeap() const = 0;
-
     /** Set the notification and data callbacks */
     virtual void setCallbacks(notify_callback notify_cb,
                               data_callback data_cb,
@@ -145,47 +132,6 @@
     virtual bool        previewEnabled() = 0;
 
     /**
-     * Retrieve the total number of available buffers from camera hal for passing
-     * video frame data in a recording session. Must be called again if a new
-     * recording session is started.
-     *
-     * This method should be called after startRecording(), since
-     * the some camera hal may choose to allocate the video buffers only after
-     * recording is started.
-     *
-     * Some camera hal may not implement this method, and 0 can be returned to
-     * indicate that this feature is not available.
-     *
-     * @return the number of video buffers that camera hal makes available.
-     *      Zero (0) is returned to indicate that camera hal does not support
-     *      this feature.
-     */
-    virtual int32_t     getNumberOfVideoBuffers() const { return 0; }
-
-    /**
-     * Retrieve the video buffer corresponding to the given index in a
-     * recording session. Must be called again if a new recording session
-     * is started.
-     *
-     * It allows a client to retrieve all video buffers that camera hal makes
-     * available to passing video frame data by calling this method with all
-     * valid index values. The valid index value ranges from 0 to n, where
-     * n = getNumberOfVideoBuffers() - 1. With an index outside of the valid
-     * range, 0 must be returned. This method should be called after
-     * startRecording().
-     *
-     * The video buffers should NOT be modified/released by camera hal
-     * until stopRecording() is called and all outstanding video buffers
-     * previously sent out via CAMERA_MSG_VIDEO_FRAME have been released
-     * via releaseVideoBuffer().
-     *
-     * @param index an index to retrieve the corresponding video buffer.
-     *
-     * @return the video buffer corresponding to the given index.
-     */
-    virtual sp<IMemory> getVideoBuffer(int32_t index) const { return 0; }
-
-    /**
      * Request the camera hal to store meta data or real YUV data in
      * the video buffers send out via CAMERA_MSG_VIDEO_FRRAME for a
      * recording session. If it is not called, the default camera
diff --git a/include/camera/ICamera.h b/include/camera/ICamera.h
index 2344b3f..400d7f4 100644
--- a/include/camera/ICamera.h
+++ b/include/camera/ICamera.h
@@ -102,12 +102,6 @@
     // send command to camera driver
     virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
 
-    // return the total number of available video buffers
-    virtual int32_t         getNumberOfVideoBuffers() const  = 0;
-
-    // return the individual video buffer corresponding to the given index.
-    virtual sp<IMemory>     getVideoBuffer(int32_t index) const = 0;
-
     // tell the camera hal to store meta data or real YUV data in video buffers.
     virtual status_t        storeMetaDataInBuffers(bool enabled) = 0;
 };
diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h
index 4a39fbf2..bb25bae3 100644
--- a/include/media/stagefright/CameraSource.h
+++ b/include/media/stagefright/CameraSource.h
@@ -99,34 +99,6 @@
     virtual sp<MetaData> getFormat();
 
     /**
-     * Retrieve the total number of video buffers available from
-     * this source.
-     *
-     * This method is useful if these video buffers are used
-     * for passing video frame data to other media components,
-     * such as OMX video encoders, in order to eliminate the
-     * memcpy of the data.
-     *
-     * @return the total numbner of video buffers. Returns 0 to
-     *      indicate that this source does not make the video
-     *      buffer information availalble.
-     */
-    size_t getNumberOfVideoBuffers() const;
-
-    /**
-     * Retrieve the individual video buffer available from
-     * this source.
-     *
-     * @param index the index corresponding to the video buffer.
-     *      Valid range of the index is [0, n], where n =
-     *      getNumberOfVideoBuffers() - 1.
-     *
-     * @return the video buffer corresponding to the given index.
-     *      If index is out of range, 0 should be returned.
-     */
-    sp<IMemory> getVideoBuffer(size_t index) const;
-
-    /**
      * Tell whether this camera source stores meta data or real YUV
      * frame data in video buffers.
      *
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index e288312..5eb48da 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -205,22 +205,6 @@
     return c->startPreview();
 }
 
-int32_t Camera::getNumberOfVideoBuffers() const
-{
-    LOGV("getNumberOfVideoBuffers");
-    sp <ICamera> c = mCamera;
-    if (c == 0) return 0;
-    return c->getNumberOfVideoBuffers();
-}
-
-sp<IMemory> Camera::getVideoBuffer(int32_t index) const
-{
-    LOGV("getVideoBuffer: %d", index);
-    sp <ICamera> c = mCamera;
-    if (c == 0) return 0;
-    return c->getVideoBuffer(index);
-}
-
 status_t Camera::storeMetaDataInBuffers(bool enabled)
 {
     LOGV("storeMetaDataInBuffers: %s",
diff --git a/libs/camera/ICamera.cpp b/libs/camera/ICamera.cpp
index 931b57d..5f6e5ef 100644
--- a/libs/camera/ICamera.cpp
+++ b/libs/camera/ICamera.cpp
@@ -46,8 +46,6 @@
     STOP_RECORDING,
     RECORDING_ENABLED,
     RELEASE_RECORDING_FRAME,
-    GET_NUM_VIDEO_BUFFERS,
-    GET_VIDEO_BUFFER,
     STORE_META_DATA_IN_BUFFERS,
 };
 
@@ -149,27 +147,6 @@
         remote()->transact(RELEASE_RECORDING_FRAME, data, &reply);
     }
 
-    int32_t getNumberOfVideoBuffers() const
-    {
-        LOGV("getNumberOfVideoBuffers");
-        Parcel data, reply;
-        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
-        remote()->transact(GET_NUM_VIDEO_BUFFERS, data, &reply);
-        return reply.readInt32();
-    }
-
-    sp<IMemory> getVideoBuffer(int32_t index) const
-    {
-        LOGV("getVideoBuffer: %d", index);
-        Parcel data, reply;
-        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
-        data.writeInt32(index);
-        remote()->transact(GET_VIDEO_BUFFER, data, &reply);
-        sp<IMemory> mem = interface_cast<IMemory>(
-                            reply.readStrongBinder());
-        return mem;
-    }
-
     status_t storeMetaDataInBuffers(bool enabled)
     {
         LOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
@@ -355,19 +332,6 @@
             releaseRecordingFrame(mem);
             return NO_ERROR;
         } break;
-        case GET_NUM_VIDEO_BUFFERS: {
-            LOGV("GET_NUM_VIDEO_BUFFERS");
-            CHECK_INTERFACE(ICamera, data, reply);
-            reply->writeInt32(getNumberOfVideoBuffers());
-            return NO_ERROR;
-        } break;
-        case GET_VIDEO_BUFFER: {
-            LOGV("GET_VIDEO_BUFFER");
-            CHECK_INTERFACE(ICamera, data, reply);
-            int32_t index = data.readInt32();
-            reply->writeStrongBinder(getVideoBuffer(index)->asBinder());
-            return NO_ERROR;
-        } break;
         case STORE_META_DATA_IN_BUFFERS: {
             LOGV("STORE_META_DATA_IN_BUFFERS");
             CHECK_INTERFACE(ICamera, data, reply);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9aa84a03..cc689bb 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -715,15 +715,13 @@
     }
 
     /**
-     * Registers the current activity to be notified periodically by
-     * the named provider.  Periodically, the supplied LocationListener will
-     * be called with the current Location or with status updates.
+     * Requests a single location update from the named provider.
      *
      * <p> It may take a while to receive the most recent location. If
      * an immediate location is required, applications may use the
      * {@link #getLastKnownLocation(String)} method.
      *
-     * <p> In case the provider is disabled by the user, updates will stop,
+     * <p> In case the provider is disabled by the user, the update will not be received,
      * and the {@link LocationListener#onProviderDisabled(String)}
      * method will be called. As soon as the provider is enabled again,
      * the {@link LocationListener#onProviderEnabled(String)} method will
@@ -733,8 +731,8 @@
      *
      * @param provider the name of the provider with which to register
      * @param listener a {#link LocationListener} whose
-     * {@link LocationListener#onLocationChanged} method will be called for
-     * each location update
+     * {@link LocationListener#onLocationChanged} method will be called when
+     * the location update is available
      * @param looper a Looper object whose message queue will be used to
      * implement the callback mechanism.
      * If looper is null then the callbacks will be called on the main thread.
@@ -754,15 +752,13 @@
     }
 
     /**
-     * Registers the current activity to be notified periodically based on
-     * the specified criteria.  Periodically, the supplied LocationListener will
-     * be called with the current Location or with status updates.
+     * Requests a single location update based on the specified criteria.
      *
      * <p> It may take a while to receive the most recent location. If
      * an immediate location is required, applications may use the
      * {@link #getLastKnownLocation(String)} method.
      *
-     * <p> In case the provider is disabled by the user, updates will stop,
+     * <p> In case the provider is disabled by the user, the update will not be received,
      * and the {@link LocationListener#onProviderDisabled(String)}
      * method will be called. As soon as the provider is enabled again,
      * the {@link LocationListener#onProviderEnabled(String)} method will
@@ -773,8 +769,8 @@
      * @param criteria contains parameters for the location manager to choose the
      * appropriate provider and parameters to compute the location
      * @param listener a {#link LocationListener} whose
-     * {@link LocationListener#onLocationChanged} method will be called for
-     * each location update
+     * {@link LocationListener#onLocationChanged} method will be called when
+     * the location update is available
      * @param looper a Looper object whose message queue will be used to
      * implement the callback mechanism.
      * If looper is null then the callbacks will be called on the current thread.
@@ -795,16 +791,20 @@
     }
 
     /**
-     * Registers the current activity to be notified periodically by
-     * the named provider.  Periodically, the supplied PendingIntent will
-     * be broadcast with the current Location or with status updates.
-     *
-     * <p> Location updates are sent with a key of KEY_LOCATION_CHANGED and a Location value.
+     * Requests a single location update from the named provider.
      *
      * <p> It may take a while to receive the most recent location. If
      * an immediate location is required, applications may use the
      * {@link #getLastKnownLocation(String)} method.
      *
+     * <p> Location updates are sent with a key of KEY_LOCATION_CHANGED and a Location value.
+     *
+     * <p> In case the provider is disabled by the user, the update will not be received,
+     * and the {@link LocationListener#onProviderDisabled(String)}
+     * method will be called. As soon as the provider is enabled again,
+     * the {@link LocationListener#onProviderEnabled(String)} method will
+     * be called and location updates will start again.
+     *
      * @param provider the name of the provider with which to register
      * @param intent a {#link PendingIntent} to be sent for the location update
      *
@@ -823,16 +823,20 @@
     }
 
     /**
-     * Registers the current activity to be notified periodically based on
-     * the specified criteria.  Periodically, the supplied PendingIntent will
-     * be broadcast with the current Location or with status updates.
-     *
-     * <p> Location updates are sent with a key of KEY_LOCATION_CHANGED and a Location value.
+     * Requests a single location update based on the specified criteria.
      *
      * <p> It may take a while to receive the most recent location. If
      * an immediate location is required, applications may use the
      * {@link #getLastKnownLocation(String)} method.
      *
+     * <p> Location updates are sent with a key of KEY_LOCATION_CHANGED and a Location value.
+     *
+     * <p> In case the provider is disabled by the user, the update will not be received,
+     * and the {@link LocationListener#onProviderDisabled(String)}
+     * method will be called. As soon as the provider is enabled again,
+     * the {@link LocationListener#onProviderEnabled(String)} method will
+     * be called and location updates will start again.
+     *
      * @param criteria contains parameters for the location manager to choose the
      * appropriate provider and parameters to compute the location
      * @param intent a {#link PendingIntent} to be sent for the location update
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 8a24bc45..a1f04d3 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -740,28 +740,6 @@
     mFrameAvailableCondition.signal();
 }
 
-size_t CameraSource::getNumberOfVideoBuffers() const {
-    LOGV("getNumberOfVideoBuffers");
-    size_t nBuffers = 0;
-    int64_t token = IPCThreadState::self()->clearCallingIdentity();
-    if (mInitCheck == OK && mCamera != 0) {
-        nBuffers = mCamera->getNumberOfVideoBuffers();
-    }
-    IPCThreadState::self()->restoreCallingIdentity(token);
-    return nBuffers;
-}
-
-sp<IMemory> CameraSource::getVideoBuffer(size_t index) const {
-    LOGV("getVideoBuffer: %d", index);
-    sp<IMemory> buffer = 0;
-    int64_t token = IPCThreadState::self()->clearCallingIdentity();
-    if (mInitCheck == OK && mCamera != 0) {
-        buffer = mCamera->getVideoBuffer(index);
-    }
-    IPCThreadState::self()->restoreCallingIdentity(token);
-    return buffer;
-}
-
 bool CameraSource::isMetaDataStoredInVideoBuffers() const {
     LOGV("isMetaDataStoredInVideoBuffers");
     return mIsMetaDataStoredInVideoBuffers;
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index a6a34b3..904bd62 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1912,6 +1912,11 @@
 }
 
 void OMXCodec::on_message(const omx_message &msg) {
+    if (mState == ERROR) {
+        LOGW("Dropping OMX message - we're in ERROR state.");
+        return;
+    }
+
     switch (msg.type) {
         case omx_message::EVENT:
         {
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 6cbd599..cdce772 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
 #define LOG_TAG "OMXNodeInstance"
 #include <utils/Log.h>
 
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
index f917128..f478a32 100644
--- a/opengl/tools/glgen/specs/gles11/checks.spec
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -31,28 +31,12 @@
 glDrawTexivOES check coords 5
 glDrawTexsvOES check coords 5
 glDrawTexxvOES check coords 5
-glBindFramebufferOES unsupported
-glBindRenderbufferOES unsupported
-glBlendEquation unsupported
-glBlendEquationSeparate unsupported
-glBlendFuncSeparate unsupported
-glCheckFramebufferStatusOES unsupported return 0
-glDeleteFramebuffersOES unsupported
-glDeleteRenderbuffersOES unsupported
-glFramebufferRenderbufferOES unsupported
-glFramebufferStorageOES unsupported
-glFramebufferTexture2DOES unsupported
-glGenFramebuffersOES unsupported
-glGenRenderbuffersOES unsupported
-glGenerateMipmapOES unsupported
-glGetBufferParameter unsupported
-glGetFramebufferAttachmentParameterivOES unsupported
-glGetRenderbufferParameterivOES unsupported
-glGetTexGen unsupported
-glIsFramebufferOES unsupported return JNI_FALSE
-glIsRenderbufferOES unsupported return JNI_FALSE
-glRenderbufferStorageOES unsupported return false
-glTexGen unsupported
-glTexGenf unsupported
-glTexGeni unsupported
-glTexGenx unsupported
+glDeleteFramebuffersOES check framebuffers n
+glDeleteRenderbuffersOES check renderbuffers n
+glGenFramebuffersOES check framebuffers n
+glGenRenderbuffersOES check renderbuffers n
+glGetBufferParameter check params 1
+glGetFramebufferAttachmentParameterivOES check params 1
+glGetRenderbufferParameterivOES check params 1
+glGetTexGen ifcheck params 1 pname GL_TEXTURE_GEN_MODE ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE
+
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index a09e16b..f3c9959 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -666,20 +666,6 @@
     mHardware->releaseRecordingFrame(mem);
 }
 
-int32_t CameraService::Client::getNumberOfVideoBuffers() const {
-    LOG1("getNumberOfVideoBuffers");
-    Mutex::Autolock lock(mLock);
-    if (checkPidAndHardware() != NO_ERROR) return 0;
-    return mHardware->getNumberOfVideoBuffers();
-}
-
-sp<IMemory> CameraService::Client::getVideoBuffer(int32_t index) const {
-    LOG1("getVideoBuffer: %d", index);
-    Mutex::Autolock lock(mLock);
-    if (checkPidAndHardware() != NO_ERROR) return 0;
-    return mHardware->getVideoBuffer(index);
-}
-
 status_t CameraService::Client::storeMetaDataInBuffers(bool enabled)
 {
     LOG1("storeMetaDataInBuffers: %s", enabled? "true": "false");
@@ -938,7 +924,7 @@
     switch (msgType) {
         case CAMERA_MSG_SHUTTER:
             // ext1 is the dimension of the yuv picture.
-            client->handleShutter((image_rect_type *)ext1);
+            client->handleShutter();
             break;
         default:
             client->handleGenericNotify(msgType, ext1, ext2);
@@ -997,9 +983,7 @@
 }
 
 // snapshot taken callback
-// "size" is the width and height of yuv picture for registerBuffer.
-// If it is NULL, use the picture size from parameters.
-void CameraService::Client::handleShutter(image_rect_type *size) {
+void CameraService::Client::handleShutter(void) {
     if (mPlayShutterSound) {
         mCameraService->playSound(SOUND_SHUTTER);
     }
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 1c43b00..28e8cc0 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -99,8 +99,6 @@
         virtual status_t        startPreview();
         virtual void            stopPreview();
         virtual bool            previewEnabled();
-        virtual int32_t         getNumberOfVideoBuffers() const;
-        virtual sp<IMemory>     getVideoBuffer(int32_t index) const;
         virtual status_t        storeMetaDataInBuffers(bool enabled);
         virtual status_t        startRecording();
         virtual void            stopRecording();
@@ -152,7 +150,7 @@
         // convert client from cookie
         static sp<Client>       getClientFromCookie(void* user);
         // handlers for messages
-        void                    handleShutter(image_rect_type *size);
+        void                    handleShutter(void);
         void                    handlePreviewData(const sp<IMemory>& mem);
         void                    handlePostview(const sp<IMemory>& mem);
         void                    handleRawPicture(const sp<IMemory>& mem);
diff --git a/services/jni/com_android_server_UsbService.cpp b/services/jni/com_android_server_UsbService.cpp
index 816f76f..6aeede2 100644
--- a/services/jni/com_android_server_UsbService.cpp
+++ b/services/jni/com_android_server_UsbService.cpp
@@ -117,9 +117,14 @@
     jintArray endpointArray = env->NewIntArray(length);
     env->SetIntArrayRegion(endpointArray, 0, length, endpointValues.array());
 
+    jstring deviceName = env->NewStringUTF(devname);
     env->CallVoidMethod(thiz, method_usbDeviceAdded,
-            env->NewStringUTF(devname), vendorId, productId, deviceClass,
+            deviceName, vendorId, productId, deviceClass,
             deviceSubClass, protocol, interfaceArray, endpointArray);
+
+    env->DeleteLocalRef(interfaceArray);
+    env->DeleteLocalRef(endpointArray);
+    env->DeleteLocalRef(deviceName);
     checkAndClearExceptionFromCallback(env, __FUNCTION__);
 
     return 0;
@@ -129,7 +134,9 @@
     JNIEnv* env = AndroidRuntime::getJNIEnv();
     jobject thiz = (jobject)client_data;
 
+    jstring deviceName = env->NewStringUTF(devname);
     env->CallVoidMethod(thiz, method_usbDeviceRemoved, env->NewStringUTF(devname));
+    env->DeleteLocalRef(deviceName);
     checkAndClearExceptionFromCallback(env, __FUNCTION__);
     return 0;
 }
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index d4a3c0a..be97124 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -247,6 +247,9 @@
     /* Currently active APN */
     protected ApnSetting mActiveApn;
 
+    /* Once disposed dont handle any messages */
+    protected boolean mIsDisposed = false;
+
     protected BroadcastReceiver mIntentReceiver = new BroadcastReceiver ()
     {
         @Override
@@ -327,6 +330,7 @@
     }
 
     public void dispose() {
+        mIsDisposed = true;
         mPhone.getContext().unregisterReceiver(this.mIntentReceiver);
     }
 
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index b244945..b24909f 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -118,6 +118,8 @@
 
     @Override
     public void dispose() {
+        cleanUpConnection(false, null);
+
         super.dispose();
 
         // Unregister from all events
@@ -861,7 +863,7 @@
     @Override
     public void handleMessage (Message msg) {
 
-        if (!mPhone.mIsTheCurrentActivePhone) {
+        if (!mPhone.mIsTheCurrentActivePhone || mIsDisposed) {
             log("Ignore CDMA msgs since CDMA phone is inactive");
             return;
         }
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 48e8ea9..d8ff268 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -192,6 +192,8 @@
 
     @Override
     public void dispose() {
+        cleanUpAllConnections(false, null);
+
         super.dispose();
 
         //Unregister for all events
@@ -1791,7 +1793,7 @@
     public void handleMessage (Message msg) {
         if (DBG) log("GSMDataConnTrack handleMessage "+msg);
 
-        if (!mPhone.mIsTheCurrentActivePhone) {
+        if (!mPhone.mIsTheCurrentActivePhone || mIsDisposed) {
             log("Ignore GSM msgs since GSM phone is inactive");
             return;
         }
diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
old mode 100755
new mode 100644
index 7373cbb..5471289
--- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java
+++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
@@ -40,6 +40,7 @@
 
 import java.text.ParseException;
 import java.util.List;
+import java.util.regex.Pattern;
 
 /**
  * {@hide}
@@ -386,8 +387,8 @@
         Connection dial(String originalNumber) throws SipException {
             String calleeSipUri = originalNumber;
             if (!calleeSipUri.contains("@")) {
-                calleeSipUri = mProfile.getUriString().replaceFirst(
-                        mProfile.getUserName() + "@",
+                String replaceStr = Pattern.quote(mProfile.getUserName() + "@");
+                calleeSipUri = mProfile.getUriString().replaceFirst(replaceStr,
                         calleeSipUri + "@");
             }
             try {
diff --git a/voip/java/com/android/server/sip/SipHelper.java b/voip/java/com/android/server/sip/SipHelper.java
index ac580e7..4ee86b6 100644
--- a/voip/java/com/android/server/sip/SipHelper.java
+++ b/voip/java/com/android/server/sip/SipHelper.java
@@ -27,6 +27,8 @@
 import java.util.ArrayList;
 import java.util.EventObject;
 import java.util.List;
+import java.util.regex.Pattern;
+
 import javax.sip.ClientTransaction;
 import javax.sip.Dialog;
 import javax.sip.DialogTerminatedEvent;
@@ -215,9 +217,11 @@
             String tag) throws ParseException, SipException {
         FromHeader fromHeader = createFromHeader(userProfile, tag);
         ToHeader toHeader = createToHeader(userProfile);
+
+        String replaceStr = Pattern.quote(userProfile.getUserName() + "@");
         SipURI requestURI = mAddressFactory.createSipURI(
-                userProfile.getUriString().replaceFirst(
-                userProfile.getUserName() + "@", ""));
+                userProfile.getUriString().replaceFirst(replaceStr, ""));
+
         List<ViaHeader> viaHeaders = createViaHeaders();
         CallIdHeader callIdHeader = createCallIdHeader();
         CSeqHeader cSeqHeader = createCSeqHeader(requestType);